
.games-hero{text-align:center;margin:0 0 1.5rem}
.games-hero h1{font-size:clamp(1.6rem,4vw,2.2rem);margin:0 0 .4rem}
.games-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px;margin:1rem 0 2rem}
.game-card{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px;border-radius:14px;border:1px solid var(--line);background:var(--card);text-decoration:none;color:inherit;min-height:120px;transition:transform .12s,border-color .12s}
.game-card:hover{transform:translateY(-2px);border-color:var(--accent)}
.game-card .ge{font-size:1.75rem;line-height:1}
.game-card h2{margin:0;font-size:1rem}
.game-card p{margin:0;font-size:12px;color:var(--mute);line-height:1.35}
.game-card .theme{font-size:10px;text-transform:uppercase;letter-spacing:.05em;opacity:.8}
.game-shell{max-width:520px;margin:0 auto}
.game-top{display:flex;gap:12px;align-items:center;margin-bottom:1rem}
.game-emoji{font-size:2.2rem}
.game-level{margin:0;color:var(--mute);font-size:13px}
.game-board{margin:1rem 0;padding:1rem;border-radius:14px;border:1px solid var(--line);background:var(--card)}
.game-input{width:100%;max-width:100%;padding:12px 14px;font-size:16px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--ink);box-sizing:border-box}
.game-actions{display:flex;flex-wrap:wrap;gap:8px;margin:1rem 0}
.game-status{min-height:1.4em;font-weight:600}
.game-status .ok{color:#16a34a}
.game-status .bad{color:#dc2626}
.game-note{font-size:12px;color:var(--mute)}
.scramble-letters{font-size:clamp(1.4rem,5vw,2rem);font-weight:800;letter-spacing:.12em;text-align:center}
.ws-grid{display:grid;gap:4px;justify-content:center;margin:0 auto 12px}
.ws-cell{width:1.8rem;height:1.8rem;display:flex;align-items:center;justify-content:center;border-radius:6px;background:var(--bg2);font-weight:700;font-size:13px;text-transform:uppercase}
.choice-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.choice{padding:12px;border-radius:10px;border:1px solid var(--line);background:var(--bg);cursor:pointer;font-weight:600}
.choice.on{border-color:var(--accent);background:var(--bg2)}
.tile-row{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-bottom:12px}
.tile{width:2.4rem;height:2.8rem;display:flex;align-items:center;justify-content:center;border-radius:8px;background:var(--bg2);font-weight:800;border:1px solid var(--line)}
.mem-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.mem-card{aspect-ratio:1;border-radius:10px;border:1px solid var(--line);background:var(--bg2);font-weight:700;cursor:pointer}
.mem-card.show,.mem-card.matched{background:var(--card)}
.found-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.found-chips span{padding:4px 8px;border-radius:999px;background:var(--bg2);font-size:12px}
.emoji-big{font-size:3.5rem;text-align:center;margin:0}
.chip-row{display:flex;flex-wrap:wrap;gap:6px}
.chip-row span{padding:6px 10px;border-radius:8px;background:var(--bg2);font-weight:600}
.pattern{font-size:1.5rem;letter-spacing:.2em;text-align:center;font-weight:700}
.game-toast{position:fixed;bottom:1.25rem;left:50%;transform:translateX(-50%) translateY(120%);background:#0f172a;color:#fff;padding:10px 16px;border-radius:999px;font-size:13px;z-index:99;transition:transform .2s;max-width:90vw}
.game-toast.on{transform:translateX(-50%) translateY(0)}
.share-bar{display:flex;flex-wrap:wrap;gap:8px;margin:1rem 0}

.games-grid-all{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px}
.games-grid-all .game-card{min-height:130px}
.page-hero .share-bar{margin-top:1rem}


.how-to-play{margin:.75rem 0;padding:.65rem .85rem;border-radius:10px;border:1px solid var(--line);background:var(--bg2,rgba(0,0,0,.03));font-size:14px}
.how-to-play summary{cursor:pointer;font-weight:600}
.how-to-play p{margin:.4rem 0 0;color:var(--mute);line-height:1.45}
.hint-msg{color:var(--accent,#0ea5e9);font-weight:500}


/* Professional game polish */
.game-shell{
  border-radius:16px;
  border:1px solid var(--line);
  background:var(--card);
  padding:1rem 1.1rem 1.25rem;
  box-shadow:0 1px 3px rgba(0,0,0,.05);
}
.game-top{display:flex;gap:.75rem;align-items:center;margin-bottom:.5rem}
.game-emoji{font-size:1.75rem;line-height:1}
.game-title-line{margin:0;font-size:1.15rem}
.game-level{margin:.15rem 0 0;font-size:13px;color:var(--mute)}
.game-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:1rem}
.game-actions .btn{min-height:42px}
.game-status{min-height:1.4em;margin:.35rem 0;font-size:14px}
.game-input{
  width:100%;max-width:20rem;padding:.65rem .75rem;font-size:16px;
  border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--ink);
}
.x-clues{display:flex;flex-direction:column;gap:.4rem;margin:0 0 .75rem}
.x-clues .clue{
  text-align:left;padding:.55rem .7rem;border-radius:10px;border:1px solid var(--line);
  background:var(--bg2,transparent);color:inherit;cursor:pointer;font-size:13px;
}
.x-clues .clue.on{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.xgrid{display:grid;gap:3px;margin:.5rem 0 75rem 0;margin-bottom:.75rem}
.xcell{
  width:2.2rem;height:2.2rem;border-radius:6px;border:1px solid var(--line);
  background:var(--bg);color:var(--ink);font-weight:700;font-size:14px;
  display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0;
}
.xcell.blocked{background:var(--ink);opacity:.12;border-color:transparent;cursor:default}
.xcell.hilite{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 12%, var(--bg))}
.x-help{font-size:12px;margin:.25rem 0 .5rem}


/* —— Professional game UI —— */
.game-shell{
  border-radius:18px;
  border:1px solid var(--line);
  background:var(--card);
  overflow:hidden;
  box-shadow:0 4px 24px rgba(0,0,0,.06);
  margin-bottom:1.25rem;
}
.game-hero{
  color:#fff;
  padding:1.1rem 1.15rem;
}
.game-hero-inner{display:flex;gap:.85rem;align-items:center}
.game-emoji{font-size:2rem;line-height:1;filter:drop-shadow(0 2px 4px rgba(0,0,0,.2))}
.game-title-line{margin:0;font-size:1.2rem;color:#fff}
.game-title-line strong{font-weight:800;letter-spacing:-.02em}
.game-level{margin:.2rem 0 0;font-size:13px;opacity:.9;color:#fff}
.how-to-play{
  margin:.85rem 1.1rem;
  padding:.7rem .9rem;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--bg2,rgba(0,0,0,.03));
  font-size:14px;
}
.how-to-play summary{
  cursor:pointer;font-weight:700;color:var(--ink);
  list-style:none;display:flex;align-items:center;gap:.35rem;
}
.how-to-play summary::-webkit-details-marker{display:none}
.how-to-play summary::before{content:"▶";font-size:10px;opacity:.6}
.how-to-play[open] summary::before{content:"▼"}
.how-to-play p{margin:.5rem 0 0;color:var(--mute);line-height:1.5}
.game-board{padding:0 1.1rem 1rem}
.game-status{min-height:1.5em;margin:0 1.1rem .5rem;font-size:14px;font-weight:600}
.feedback-ok{color:#16a34a}
.feedback-bad{color:#dc2626}
.game-actions{
  display:flex;flex-wrap:wrap;gap:.5rem;
  padding:0 1.1rem 1rem;
}
.game-actions .g-btn{
  min-height:44px;border-radius:12px;font-weight:700;font-size:14px;
  padding:.65rem 1rem;
}
.game-actions .btn.primary{
  background:var(--g-accent,var(--accent,#0ea5e9));
  color:#0f172a;border:none;
}
.game-actions .btn.primary:hover{filter:brightness(1.05)}
.game-note{
  margin:0;padding:.75rem 1.1rem 1.1rem;
  font-size:12px;color:var(--mute);
  border-top:1px solid var(--line);
}
.game-input{
  width:100%;max-width:22rem;padding:.7rem .85rem;font-size:16px;
  border-radius:12px;border:1px solid var(--line);
  background:var(--bg);color:var(--ink);
}
.game-input:focus{outline:2px solid var(--g-accent,var(--accent));outline-offset:1px}

/* Hint modal */
.hint-modal{
  position:fixed;inset:0;z-index:9999;
  background:rgba(15,23,42,.55);
  display:flex;align-items:center;justify-content:center;
  padding:1rem;
  backdrop-filter:blur(4px);
}
.hint-modal[hidden]{display:none !important}
.hint-modal.open{animation:hintFade .18s ease}
@keyframes hintFade{from{opacity:0}to{opacity:1}}
.hint-dialog{
  width:min(400px,100%);
  background:var(--card,#fff);
  color:var(--ink);
  border-radius:18px;
  border:1px solid var(--line);
  box-shadow:0 20px 50px rgba(0,0,0,.25);
  padding:1.15rem 1.2rem 1.2rem;
  animation:hintPop .2s ease;
}
@keyframes hintPop{from{transform:scale(.94);opacity:0}to{transform:scale(1);opacity:1}}
.hint-dialog-top{display:flex;align-items:center;gap:.5rem;margin-bottom:.65rem}
.hint-ico{font-size:1.4rem}
.hint-dialog h3{margin:0;flex:1;font-size:1.1rem;font-weight:800}
.hint-close{
  border:none;background:var(--bg2);width:32px;height:32px;border-radius:999px;
  font-size:1.25rem;cursor:pointer;color:var(--ink);line-height:1;
}
.hint-body{margin:0 0 1rem;font-size:15px;line-height:1.5;color:var(--mute)}
.hint-ok{width:100%;min-height:44px;border-radius:12px;font-weight:700}

/* Crossword cells polish */
.x-clues{display:flex;flex-direction:column;gap:.4rem;margin:0 0 .75rem}
.x-clues .clue{
  text-align:left;padding:.6rem .75rem;border-radius:12px;border:1px solid var(--line);
  background:var(--bg2,transparent);color:inherit;cursor:pointer;font-size:13px;
}
.x-clues .clue.on{border-color:var(--g-accent,var(--accent));box-shadow:0 0 0 1px var(--g-accent,var(--accent))}
.xgrid{display:grid;gap:4px;margin:.5rem 0 .75rem}
.xcell{
  width:2.35rem;height:2.35rem;border-radius:8px;border:1px solid var(--line);
  background:var(--bg);color:var(--ink);font-weight:800;font-size:14px;
  display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0;
}
.xcell.blocked{background:var(--ink);opacity:.12;border-color:transparent;cursor:default}
.xcell.hilite{border-color:var(--g-accent,var(--accent));background:color-mix(in srgb,var(--g-accent,var(--accent)) 14%, var(--bg))}


/* Professional themed game chrome */
.game-shell{
  border-radius:20px;
  border:1px solid var(--line);
  background:var(--g-board, var(--card));
  overflow:hidden;
  box-shadow:0 8px 30px rgba(0,0,0,.08);
  margin:0 0 1.5rem;
}
.game-hero{
  background:var(--g-hero, linear-gradient(135deg,#0c4a6e,#0284c7));
  color:#fff;
  padding:1.25rem 1.2rem;
}
.game-hero-inner{display:flex;gap:.9rem;align-items:center;flex-wrap:wrap}
.game-hero-text{flex:1;min-width:140px}
.game-emoji{font-size:2.2rem;line-height:1}
.game-title-line{margin:0;font-size:1.25rem;color:#fff}
.game-title-line strong{font-weight:800;letter-spacing:-.02em;color:#fff}
.game-level{margin:.25rem 0 0;font-size:13px;opacity:.92;color:#fff}
.game-timer{
  margin-left:auto;
  background:rgba(255,255,255,.18);
  border:1px solid rgba(255,255,255,.35);
  border-radius:999px;
  padding:.45rem .85rem;
  font-weight:800;
  font-size:15px;
  color:#fff;
  font-variant-numeric:tabular-nums;
}
.game-timer.urgent{background:rgba(220,38,38,.85);border-color:transparent;animation:pulse .8s infinite}
@keyframes pulse{50%{transform:scale(1.04)}}
.how-to-play{
  margin:1rem 1.15rem .5rem;
  padding:.75rem .95rem;
  border-radius:14px;
  border:1px solid var(--line);
  background:var(--g-soft, var(--bg2));
  font-size:14px;
}
.how-to-play summary{cursor:pointer;font-weight:800;color:var(--ink)}
.how-to-play p{margin:.45rem 0 0;color:var(--mute);line-height:1.5}
.game-board{
  padding:.75rem 1.15rem 1rem;
  background:var(--g-board, transparent);
}
.game-status{min-height:1.5em;margin:.25rem 1.15rem;font-size:14px;font-weight:700}
.feedback-ok{color:#16a34a}
.feedback-bad{color:#dc2626}
.reveal-status{color:var(--g-accent,#0ea5e9)}
.game-actions{display:flex;flex-wrap:wrap;gap:.5rem;padding:.25rem 1.15rem 1.1rem}
.game-actions .g-btn{
  min-height:46px;border-radius:12px;font-weight:800;font-size:14px;padding:.65rem 1.05rem
}
.game-actions .btn.primary{
  background:var(--g-accent,#0ea5e9)!important;
  color:#fff!important;border:none!important
}
.game-note{margin:0;padding:.85rem 1.15rem;font-size:12px;color:var(--mute);border-top:1px solid var(--line);background:var(--card)}
.game-input{
  width:100%;max-width:22rem;padding:.75rem .9rem;font-size:16px;
  border-radius:12px;border:2px solid var(--line);background:#fff;color:#0f172a
}
.game-input:focus{border-color:var(--g-accent,#0ea5e9);outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--g-accent,#0ea5e9) 25%, transparent)}

.hint-modal{position:fixed;inset:0;z-index:10000;background:rgba(15,23,42,.6);display:flex;align-items:center;justify-content:center;padding:1rem;backdrop-filter:blur(5px)}
.hint-modal[hidden]{display:none!important}
.hint-dialog{width:min(420px,100%);background:#fff;color:#0f172a;border-radius:20px;padding:1.25rem;box-shadow:0 25px 60px rgba(0,0,0,.3)}
html.dark .hint-dialog,[data-theme="dark"] .hint-dialog{background:#1e293b;color:#f8fafc}
.hint-dialog-top{display:flex;align-items:center;gap:.5rem;margin-bottom:.6rem}
.hint-ico{font-size:1.5rem}
.hint-dialog h3{margin:0;flex:1;font-size:1.15rem;font-weight:800}
.hint-close{border:none;background:rgba(0,0,0,.06);width:34px;height:34px;border-radius:999px;font-size:1.3rem;cursor:pointer}
.hint-body{margin:0 0 1rem;font-size:15px;line-height:1.55;color:#475569}
html.dark .hint-body,[data-theme="dark"] .hint-body{color:#cbd5e1}
.hint-ok{width:100%;min-height:46px;border-radius:12px;font-weight:800;background:var(--g-accent,#0ea5e9)!important;color:#fff!important;border:none}

.x-clues{display:flex;flex-direction:column;gap:.4rem;margin:0 0 .75rem}
.x-clues .clue{text-align:left;padding:.65rem .8rem;border-radius:12px;border:1px solid var(--line);background:#fff;cursor:pointer;font-size:13px}
.x-clues .clue.on{border-color:var(--g-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--g-accent) 30%, transparent)}
.xgrid{display:grid;gap:4px;margin:.5rem 0 .75rem}
.xcell{width:2.4rem;height:2.4rem;border-radius:8px;border:2px solid var(--line);background:#fff;font-weight:800;display:flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
.xcell.blocked{background:#0f172a;opacity:.15;border:none;cursor:default}
.xcell.hilite{border-color:var(--g-accent);background:var(--g-soft)}


.game-board{min-height:120px;display:block !important;visibility:visible !important;opacity:1 !important}
.scramble-letters{font-size:1.75rem;font-weight:800;letter-spacing:.2em;margin:.5rem 0 1rem;color:var(--ink)}
.hang-mask{font-size:1.5rem;font-weight:800;letter-spacing:.25em;margin:.5rem 0;color:var(--ink)}
.game-board .bad{color:#dc2626;font-weight:700;padding:.5rem 0}
.game-board p{color:var(--ink)}


/* FORCE readable game content — never blank/ghost text */
.game-shell,
.game-shell *{
  box-sizing:border-box;
}
.game-shell{
  background:#ffffff !important;
  color:#0f172a !important;
  border:1px solid #e2e8f0;
  border-radius:20px;
  overflow:hidden;
  box-shadow:0 8px 30px rgba(0,0,0,.08);
}
.game-hero{
  background:var(--g-hero, linear-gradient(135deg,#0c4a6e,#0284c7)) !important;
  color:#ffffff !important;
  padding:1.25rem 1.2rem;
}
.game-hero *,
.game-title-line,
.game-title-line strong,
.game-level{
  color:#ffffff !important;
  opacity:1 !important;
}
.game-board{
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
  min-height:140px;
  padding:1rem 1.15rem 1.25rem !important;
  background:#ffffff !important;
  color:#0f172a !important;
}
.game-board p,
.game-board li,
.game-board label,
.game-board span,
.game-board strong,
.game-board b,
.game-board .mute,
.game-board .clue,
.game-board .x-help,
.game-board .scramble-letters,
.game-board .hang-mask{
  color:#0f172a !important;
  opacity:1 !important;
  visibility:visible !important;
}
.game-board .mute{color:#475569 !important}
.scramble-letters,
.hang-mask{
  font-size:1.6rem !important;
  font-weight:800 !important;
  letter-spacing:.18em;
  margin:.5rem 0 1rem;
  color:#0f172a !important;
}
.how-to-play{
  margin:1rem 1.15rem .5rem;
  padding:.75rem .95rem;
  border-radius:14px;
  border:1px solid #e2e8f0;
  background:#f8fafc !important;
  color:#0f172a !important;
}
.how-to-play summary{color:#0f172a !important;font-weight:800}
.how-to-play p{color:#334155 !important;opacity:1 !important}
.game-status{color:#0f172a !important;min-height:1.5em;margin:.25rem 1.15rem;font-weight:700}
.game-actions{
  display:flex;flex-wrap:wrap;gap:.5rem;
  padding:.5rem 1.15rem 1.15rem;
  background:#ffffff !important;
}
.game-actions .g-btn,
.game-actions .btn{
  min-height:46px !important;
  border-radius:12px !important;
  font-weight:800 !important;
  font-size:14px !important;
  padding:.65rem 1.05rem !important;
  opacity:1 !important;
  visibility:visible !important;
  cursor:pointer !important;
  pointer-events:auto !important;
}
.game-actions .btn.primary,
#g-check{
  background:#0284c7 !important;
  background:var(--g-accent,#0284c7) !important;
  color:#ffffff !important;
  border:none !important;
}
.game-actions .btn.ghost,
#g-hint,#g-reveal,#g-next,#g-share{
  background:#f1f5f9 !important;
  color:#0f172a !important;
  border:1px solid #cbd5e1 !important;
}
.game-actions a.btn{text-decoration:none !important;display:inline-flex;align-items:center}
.game-input{
  width:100%;
  max-width:24rem;
  padding:.75rem .9rem !important;
  font-size:16px !important;
  border-radius:12px !important;
  border:2px solid #94a3b8 !important;
  background:#ffffff !important;
  color:#0f172a !important;
  opacity:1 !important;
}
.game-input::placeholder{color:#64748b !important;opacity:1 !important}
.game-note{color:#475569 !important;background:#f8fafc !important}

/* list clues for acrostic etc */
.game-board ol,.game-board ul{color:#0f172a !important;margin:.5rem 0;padding-left:1.25rem}
.game-board li{margin:.25rem 0;color:#0f172a !important}

/* dark page background shouldn't wash out card */
html.dark .game-shell,
[data-theme="dark"] .game-shell{background:#1e293b !important;color:#f8fafc !important}
html.dark .game-board,
[data-theme="dark"] .game-board{background:#1e293b !important;color:#f8fafc !important}
html.dark .game-board p,
html.dark .game-board li,
html.dark .game-board .mute,
[data-theme="dark"] .game-board p,
[data-theme="dark"] .game-board li{color:#e2e8f0 !important}
html.dark .game-input,
[data-theme="dark"] .game-input{background:#0f172a !important;color:#f8fafc !important;border-color:#475569 !important}
html.dark .game-actions .btn.ghost,
[data-theme="dark"] .game-actions .btn.ghost{background:#334155 !important;color:#f8fafc !important;border-color:#475569 !important}

.hint-modal{z-index:10000}
.hint-dialog{background:#fff !important;color:#0f172a !important}
.hint-body{color:#334155 !important}


.ws-grid, .xgrid{display:grid;gap:4px;margin:.75rem 0 1rem;justify-content:start}
.ws-cell, .tile-cell, .boggle-cell{
  width:2.1rem;height:2.1rem;
  display:inline-flex;align-items:center;justify-content:center;
  border-radius:8px;font-weight:800;font-size:14px;text-transform:uppercase;
  background:#1e293b !important;color:#ffffff !important;
  border:1px solid #334155;opacity:1 !important;
}
html.dark .ws-cell,[data-theme="dark"] .ws-cell{
  background:#0f172a !important;color:#ffffff !important;
}
.xcell:not(.blocked){
  background:#1e293b !important;color:#ffffff !important;border-color:#334155 !important;
}
.xcell.hilite{background:#0284c7 !important;color:#fff !important}
.xcell.blocked{background:#94a3b8 !important;opacity:.35 !important;color:transparent !important}
html.dark .scramble-letters,html.dark .hang-mask,
[data-theme="dark"] .scramble-letters,[data-theme="dark"] .hang-mask{color:#f8fafc !important}
.scramble-letters,.hang-mask{color:#0f172a !important;font-weight:800 !important}


/* Dark mode only: crossword / grid letters white */
html.dark .ws-cell,
[data-theme="dark"] .ws-cell,
html.dark .xcell:not(.blocked),
[data-theme="dark"] .xcell:not(.blocked),
html.dark .tile-cell,
[data-theme="dark"] .tile-cell,
html.dark .boggle-cell,
[data-theme="dark"] .boggle-cell{
  color:#ffffff !important;
}
html.dark .ws-cell,
[data-theme="dark"] .ws-cell{
  background:#1e293b !important;
  border-color:#475569;
}
html.dark .xcell:not(.blocked),
[data-theme="dark"] .xcell:not(.blocked){
  background:#1e293b !important;
  border-color:#475569 !important;
}
html.dark .xcell.hilite,
[data-theme="dark"] .xcell.hilite{
  background:#0284c7 !important;
  color:#ffffff !important;
}
/* Light mode grid: keep dark text (do not force white) */
.ws-cell{
  background:#e2e8f0;
  color:#0f172a;
  font-weight:800;
}
.xcell:not(.blocked){
  background:#ffffff;
  color:#0f172a;
}


/* Initial + toggled dark mode: crossword/grid letters white */
html.dark .ws-cell,
html[data-theme="dark"] .ws-cell,
[data-theme="dark"] .ws-cell,
html.dark .xcell:not(.blocked),
html[data-theme="dark"] .xcell:not(.blocked),
[data-theme="dark"] .xcell:not(.blocked),
html.dark .tile-cell,
html[data-theme="dark"] .tile-cell,
html.dark .boggle-cell,
html[data-theme="dark"] .boggle-cell{
  color:#ffffff !important;
}
html.dark .ws-cell,
html[data-theme="dark"] .ws-cell,
[data-theme="dark"] .ws-cell{
  background:#1e293b !important;
  border-color:#475569 !important;
}
html.dark .xcell:not(.blocked),
html[data-theme="dark"] .xcell:not(.blocked),
[data-theme="dark"] .xcell:not(.blocked){
  background:#1e293b !important;
  border-color:#475569 !important;
}
html.dark .xcell.hilite,
html[data-theme="dark"] .xcell.hilite,
[data-theme="dark"] .xcell.hilite{
  background:#0284c7 !important;
  color:#ffffff !important;
}
/* light mode unchanged */
html:not(.dark):not([data-theme="dark"]) .ws-cell,
html[data-theme="light"] .ws-cell{
  color:#0f172a !important;
  background:#e2e8f0 !important;
}
html:not(.dark):not([data-theme="dark"]) .xcell:not(.blocked),
html[data-theme="light"] .xcell:not(.blocked){
  color:#0f172a !important;
  background:#ffffff !important;
}


/* ========== GLOBAL DARK MODE: readable game text (all games) ========== */
html.dark .game-shell,
html[data-theme="dark"] .game-shell,
[data-theme="dark"] .game-shell{
  color:#f1f5f9 !important;
}
html.dark .game-board,
html[data-theme="dark"] .game-board,
[data-theme="dark"] .game-board{
  background:transparent !important;
  color:#f1f5f9 !important;
}
/* All text inside the board */
html.dark .game-board,
html.dark .game-board p,
html.dark .game-board span,
html.dark .game-board li,
html.dark .game-board label,
html.dark .game-board strong,
html.dark .game-board b,
html.dark .game-board em,
html.dark .game-board small,
html.dark .game-board .mute,
html.dark .game-board .cap,
html.dark .game-board .x-help,
html.dark .game-board .clue,
html.dark .game-status,
html.dark .how-to-play,
html.dark .how-to-play summary,
html.dark .how-to-play p,
html.dark .game-note,
html[data-theme="dark"] .game-board,
html[data-theme="dark"] .game-board p,
html[data-theme="dark"] .game-board span,
html[data-theme="dark"] .game-board li,
html[data-theme="dark"] .game-board label,
html[data-theme="dark"] .game-board strong,
html[data-theme="dark"] .game-board b,
html[data-theme="dark"] .game-board .mute,
html[data-theme="dark"] .game-board .cap,
html[data-theme="dark"] .game-board .x-help,
html[data-theme="dark"] .game-board .clue,
html[data-theme="dark"] .game-status,
html[data-theme="dark"] .how-to-play,
html[data-theme="dark"] .how-to-play summary,
html[data-theme="dark"] .how-to-play p,
html[data-theme="dark"] .game-note,
[data-theme="dark"] .game-board,
[data-theme="dark"] .game-board p,
[data-theme="dark"] .game-board span,
[data-theme="dark"] .game-board li,
[data-theme="dark"] .game-board label,
[data-theme="dark"] .game-board strong,
[data-theme="dark"] .game-board .mute,
[data-theme="dark"] .game-status,
[data-theme="dark"] .how-to-play,
[data-theme="dark"] .how-to-play p,
[data-theme="dark"] .game-note{
  color:#f1f5f9 !important;
  opacity:1 !important;
}
/* Word chips / tags / pills inside games */
html.dark .game-board button:not(.btn):not(.xcell),
html.dark .game-board .chip,
html.dark .game-board .tag,
html.dark .game-board .pill,
html.dark .game-board [class*="chip"],
html.dark .game-board [class*="tag"],
html[data-theme="dark"] .game-board button:not(.btn):not(.xcell),
[data-theme="dark"] .game-board button:not(.btn):not(.xcell){
  color:#f8fafc !important;
  background:#334155 !important;
  border-color:#475569 !important;
  opacity:1 !important;
}
/* Grid / crossword / search cells */
html.dark .ws-cell,
html.dark .xcell:not(.blocked),
html.dark .tile-cell,
html.dark .boggle-cell,
html[data-theme="dark"] .ws-cell,
html[data-theme="dark"] .xcell:not(.blocked),
[data-theme="dark"] .ws-cell,
[data-theme="dark"] .xcell:not(.blocked){
  color:#ffffff !important;
  background:#1e293b !important;
  border-color:#475569 !important;
  opacity:1 !important;
}
html.dark .xcell.hilite,
html[data-theme="dark"] .xcell.hilite,
[data-theme="dark"] .xcell.hilite{
  color:#ffffff !important;
  background:#0284c7 !important;
}
html.dark .scramble-letters,
html.dark .hang-mask,
html[data-theme="dark"] .scramble-letters,
html[data-theme="dark"] .hang-mask,
[data-theme="dark"] .scramble-letters,
[data-theme="dark"] .hang-mask{
  color:#f8fafc !important;
}
/* Inputs: light text on dark field */
html.dark .game-input,
html.dark .game-board input,
html.dark .game-board textarea,
html[data-theme="dark"] .game-input,
html[data-theme="dark"] .game-board input,
[data-theme="dark"] .game-input,
[data-theme="dark"] .game-board input{
  color:#f8fafc !important;
  background:#0f172a !important;
  border-color:#475569 !important;
  caret-color:#f8fafc !important;
}
html.dark .game-input::placeholder,
html[data-theme="dark"] .game-input::placeholder,
[data-theme="dark"] .game-input::placeholder{
  color:#94a3b8 !important;
  opacity:1 !important;
}
/* Clue buttons */
html.dark .x-clues .clue,
html[data-theme="dark"] .x-clues .clue,
[data-theme="dark"] .x-clues .clue{
  color:#f1f5f9 !important;
  background:#1e293b !important;
  border-color:#475569 !important;
}
html.dark .how-to-play,
html[data-theme="dark"] .how-to-play,
[data-theme="dark"] .how-to-play{
  background:#1e293b !important;
  border-color:#334155 !important;
}
/* Semantic status colors kept readable */
html.dark .feedback-ok, [data-theme="dark"] .feedback-ok{ color:#4ade80 !important; }
html.dark .feedback-bad, [data-theme="dark"] .feedback-bad{ color:#f87171 !important; }
html.dark .reveal-status, [data-theme="dark"] .reveal-status{ color:#38bdf8 !important; }
/* Hint modal stays readable */
html.dark .hint-dialog,
[data-theme="dark"] .hint-dialog{
  background:#1e293b !important;
  color:#f8fafc !important;
}
html.dark .hint-body,
[data-theme="dark"] .hint-body{
  color:#cbd5e1 !important;
}

/* ===== GAMES RESPONSIVE FIXES ===== */

@media (max-width: 768px) {
  .game-shell { max-width: 100%; padding: 0 12px; }
  .game-hero-text { min-width: 100%; text-align: center; }
}

@media (pointer: coarse) {
  .game-shell button, .game-shell .gt, .game-shell .t, 
  .game-shell [data-key], .game-shell .key,
  .game-shell .btn, .game-shell a[href] {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 480px) {
  .gt { width: 40px !important; height: 46px !important; font-size: 16px !important; }
  .t { width: 36px !important; height: 40px !important; font-size: 18px !important; }
  .game-hero-text { font-size: clamp(1.1rem, 5vw, 1.5rem); }
}

