/* Lexicon Clash — ivory letter tiles on a night-blue reading room.
   Desktop 1280x720 and phone 390x844. */
:root {
  --bg: #141224;
  --panel: #1e1b33;
  --panel2: #29254a;
  --ink: #efeaff;
  --muted: #a39dc4;
  --tile: #f4ead6;
  --tile-edge: #cdbf9f;
  --tile-ink: #2a2140;
  --accent: #ffb84d;      /* the path being traced */
  --good: #4fd1c5;        /* accepted */
  --bad: #ff6b81;         /* refused */
  --gold: #ffd166;        /* a solo find, doubled */
  --missed: #a78bfa;      /* the one that got away */
  --vvh: 100vh;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  /* shared panels (rankings.css / fun_stats.css) pick these up */
  --lb-accent: #ffb84d; --lb-text: #efeaff; --lb-dim: #a39dc4;
  --lb-edge: rgba(255, 184, 77, .22); --lb-panel: rgba(255, 255, 255, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; }
button { font: inherit; cursor: pointer; color: inherit; }
.muted { color: var(--muted); }
.lb-panel, .lb-card { --lb-accent: #ffb84d; --lb-text: #efeaff; --lb-dim: #a39dc4;
  --lb-edge: rgba(255, 184, 77, .22); --lb-panel: rgba(255, 255, 255, .04); }
/* the overlay board lives in the site's .overlay-card, capped at 420px by
   web/style.css — a max-width is what lifts it (CLAUDE.md) */
.lb-card { max-width: min(620px, 96vw) !important; }

/* ── game screen ─────────────────────────────────────────────────────── */
#game {
  position: fixed; left: 0; right: 0; top: 0; height: var(--vvh);
  display: flex; flex-direction: column; overflow: hidden;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(255, 184, 77, .10), transparent 60%),
    radial-gradient(800px 460px at 100% 110%, rgba(79, 209, 197, .10), transparent 60%),
    var(--bg);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: rgba(14, 12, 28, .85); border-bottom: 1px solid rgba(255, 184, 77, .18);
}
.tb-left { flex: 1; min-width: 0; }
.tb-mode { font-weight: 800; letter-spacing: .03em; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-round { font-size: 12px; color: var(--muted); min-height: 14px; }
.tb-clock { font: 800 30px ui-monospace, Menlo, Consolas, monospace; color: #fff; min-width: 86px;
  text-align: center; padding: 2px 10px; border-radius: 10px; background: var(--panel2); }
.tb-clock.low { color: #fff; background: #b3263c; animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }
.tb-right { flex: 1; display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.tb-score { display: flex; align-items: baseline; gap: 4px; margin-right: 4px; }
.tb-score b { font: 800 24px ui-monospace, Menlo, Consolas, monospace; color: var(--gold); display: inline-block; }
.tb-score b.bump { animation: bump .35s ease-out; }
@keyframes bump { 30% { transform: scale(1.45); color: #fff; } }
.tb-score small { color: var(--muted); font-size: 11px; }
.tb-btn, .help-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255, 184, 77, .35);
  background: var(--panel2); color: var(--ink); font-weight: 700; padding: 0; flex: 0 0 auto;
}
#lobbyPane { position: relative; }
.help-btn.corner { position: absolute; top: 4px; right: 0; }
.hud-gear { position: relative; flex: 0 0 auto; }
.hud-gear summary {
  list-style: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: var(--panel2); border: 1px solid rgba(255, 184, 77, .35);
}
.hud-gear summary::-webkit-details-marker { display: none; }
/* site_audio.css pins #hudAudio fixed bottom-centre; inside the gear it sits
   under the button instead, so restate ALL four placement properties. */
#hudAudio {
  position: absolute; top: 42px; right: 0; left: auto; bottom: auto; transform: none;
  z-index: 30; width: max-content; max-width: 92vw;
}
/* web/style.css pins .volume-slider position:fixed top:12px — undo it here
   (CLAUDE.md item 5). */
.volume-slider { position: static !important; top: auto !important; }

.stage {
  flex: 1; min-height: 0; display: grid; gap: 14px; padding: 14px 18px;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr) minmax(260px, 360px);
  max-width: 1240px; width: 100%; margin: 0 auto;
}

/* the scoreboard: counts and points, never words */
/* explicit columns: the tutorial hides the scoreboard, and the board must not
   slide into its (narrow) column when it does */
.hud-board { grid-column: 1; display: flex; flex-direction: column; gap: 6px; align-self: start; min-width: 0; }
.play-col { grid-column: 2; }
.side-col { grid-column: 3; }
.hud-row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px;
  background: var(--panel); border: 1px solid transparent; min-width: 0; }
.hud-row.me { border-color: rgba(255, 184, 77, .55); background: var(--panel2); }
.dot { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 13px; color: #1a1630; }
.hud-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700; font-size: 14px; }
.hud-n { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hud-v { font: 800 17px ui-monospace, Menlo, Consolas, monospace; min-width: 30px; text-align: right; }

/* the play column */
.play-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; min-height: 0; }
.coach { width: min(100%, 560px); display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border-radius: 12px; background: #2b2452; border: 1px solid var(--accent); line-height: 1.45; font-size: 15px; }
.coach-text { flex: 1; }
.coach-text i { color: var(--gold); }
.word-bar { width: min(100%, 520px); height: 52px; display: flex; align-items: center; justify-content: center;
  gap: 12px; border-radius: 12px; background: var(--panel); border: 1px solid rgba(255, 184, 77, .2);
  padding: 0 12px; overflow: hidden; }
.cur-word { font: 700 30px var(--serif); letter-spacing: .12em; color: #fff; white-space: nowrap; }
.cur-pts { font-weight: 800; color: var(--gold); white-space: nowrap; }
.word-bar.is-dup .cur-word { color: var(--muted); text-decoration: line-through; }
.word-bar.is-dup .cur-pts, .word-bar.is-bad .cur-pts { color: var(--muted); font-weight: 600; font-size: 13px; }
.word-bar.is-bad .cur-word { color: var(--bad); }
.word-bar.shake { animation: shake .32s linear; }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
/* Anagram Rush: the word is a row of tiles in seven slots */
.slots { display: none; gap: 6px; }
#game.anagram .slots { display: flex; }
#game.anagram .cur-word { display: none; }
#game.anagram .word-bar { height: 68px; width: min(100%, 560px); }
.slot { width: 46px; height: 50px; border-radius: 9px; border: 2px dashed #4b456e; display: flex; align-items: center;
  justify-content: center; font: 700 28px var(--serif); font-style: normal; color: var(--tile-ink); }
.slot.full { border: 1px solid #c98718; background: linear-gradient(160deg, #fff3d6, var(--accent));
  box-shadow: 0 2px 0 #a36a0c; cursor: pointer; }
.slot.last { animation: pop .16s ease-out; }
.word-bar.is-bad .slot.full { background: linear-gradient(160deg, #ffe1e6, #ff9aaa); border-color: var(--bad); box-shadow: 0 2px 0 #9c2a3d; }
.word-bar.is-dup .slot.full { background: #b9b3d6; border-color: #8e88b3; box-shadow: 0 2px 0 #6a6490; }
#game.anagram .play-col { justify-content: center; padding-bottom: 9vh; }
#game.anagram.revealing .play-col { justify-content: flex-start; padding-bottom: 0; }
#game.anagram .board-wrap.is-rack { width: min(100%, 640px); }
.feedback { height: 22px; font-weight: 700; font-size: 15px; opacity: 0; transition: opacity .25s; text-align: center; }
.feedback.show { opacity: 1; }
.feedback.ok { color: var(--good); }
.feedback.bad { color: var(--bad); }
.feedback.dup { color: var(--muted); }

.board-wrap { position: relative; touch-action: none; }
.board-wrap.is-grid { width: min(100%, 470px, calc(var(--vvh) - 262px)); aspect-ratio: 1; }
.board-wrap.is-rack { width: min(100%, 560px); padding: 26px 0; }
.board { position: relative; touch-action: none; }
.board.grid { width: 100%; height: 100%; display: grid; gap: 0;
  grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); }
.board.rack { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 0; }
.tile { position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; cursor: pointer; }
/* the visible stone is inset from the cell, so tiles do not touch */
.tile::before { content: ""; position: absolute; inset: 6%; border-radius: 16%;
  background: linear-gradient(160deg, #fffaf0, var(--tile) 55%, #e6d9bd);
  border: 1px solid var(--tile-edge);
  box-shadow: 0 3px 0 #a8997a, 0 6px 14px rgba(0, 0, 0, .35);
  transition: transform .09s ease-out, background .12s, box-shadow .12s; }
.face { position: relative; font: 700 clamp(22px, 7.2vmin, 44px) var(--serif); color: var(--tile-ink);
  transition: transform .09s ease-out; pointer-events: none; }
.board.g5 .face { font-size: clamp(18px, 5.8vmin, 36px); }
.board.rack .face { font-size: clamp(22px, 5.4vw, 40px); }
.tile.wide-face .face { font-size: clamp(18px, 5.4vmin, 34px); }
.ord { position: absolute; right: 13%; top: 10%; font: 700 11px ui-monospace, monospace; color: #7a5a14;
  pointer-events: none; }
.tile.sel::before { background: linear-gradient(160deg, #fff3d6, var(--accent)); border-color: #c98718;
  box-shadow: 0 1px 0 #a36a0c, 0 0 18px rgba(255, 184, 77, .7); transform: translateY(2px) scale(1.04); }
.tile.sel .face { transform: translateY(2px) scale(1.08); }
.tile.head::before { animation: pop .16s ease-out; }
@keyframes pop { 0% { transform: translateY(2px) scale(.86); } 60% { transform: translateY(2px) scale(1.14); }
  100% { transform: translateY(2px) scale(1.04); } }
.tile.stale::before { background: linear-gradient(160deg, #ffe1e6, #ff9aaa); border-color: var(--bad);
  box-shadow: 0 1px 0 #9c2a3d; }
.tile.flash-ok::before { animation: flashok .5s ease-out; }
.tile.flash-bad::before { animation: flashbad .5s ease-out; }
.tile.flash-dup::before { animation: flashdup .5s ease-out; }
@keyframes flashok { 0%, 40% { background: var(--good); box-shadow: 0 0 22px var(--good); transform: scale(1.08); } }
@keyframes flashbad { 0%, 40% { background: var(--bad); box-shadow: 0 0 22px var(--bad); } }
@keyframes flashdup { 0%, 40% { background: #b9b3d6; } }
.board.rack .tile.sel::before { background: #4b456e; border-color: #5f5890; box-shadow: none;
  transform: translateY(3px); }
.board.rack .tile.sel .face { color: #8e88b3; transform: translateY(3px); }
.board.deal .tile { animation: deal .42s cubic-bezier(.2, 1.4, .4, 1) backwards; }
@keyframes deal { from { transform: translateY(-18px) scale(.6) rotate(-8deg); opacity: 0; } }
.board.blank .tile::before { background: #2f2a52; border-color: #3e3870; box-shadow: none; }
.board.off .tile { cursor: default; }
.board.shake { animation: shake .28s linear; }
/* tutorial: the tiles to trace, numbered */
.tile.hint::after { content: attr(data-h); position: absolute; left: 10%; bottom: 8%; width: 20px; height: 20px;
  border-radius: 50%; background: var(--missed); color: #fff; font: 800 12px/20px system-ui; text-align: center;
  animation: pulse .6s ease-in-out infinite alternate; }
/* the reveal: one word lit on the board */
.tile.traced[data-trace="found"]::before { background: linear-gradient(160deg, #e2fffb, var(--good)); border-color: #2a9d92;
  box-shadow: 0 0 18px rgba(79, 209, 197, .7); }
.tile.traced[data-trace="gold"]::before { background: linear-gradient(160deg, #fff6d8, var(--gold)); border-color: #c79a1c;
  box-shadow: 0 0 22px rgba(255, 209, 102, .85); }
.tile.traced[data-trace="missed"]::before { background: linear-gradient(160deg, #efe8ff, var(--missed)); border-color: #7559d6;
  box-shadow: 0 0 18px rgba(167, 139, 250, .7); }
#game.revealing .tile:not(.traced)::before { filter: brightness(.6); }

.path-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.path-svg polyline { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round;
  opacity: .5; filter: drop-shadow(0 0 7px rgba(255, 184, 77, .95)); }
.path-svg polyline.stale { stroke: var(--bad); filter: drop-shadow(0 0 7px rgba(255, 107, 129, .9)); }
.path-svg polyline.trace.found { stroke: var(--good); filter: drop-shadow(0 0 8px rgba(79, 209, 197, .95)); }
.path-svg polyline.trace.gold { stroke: var(--gold); filter: drop-shadow(0 0 9px rgba(255, 209, 102, 1)); }
.path-svg polyline.trace.missed { stroke: var(--missed); filter: drop-shadow(0 0 8px rgba(167, 139, 250, .95)); }

.callouts { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.callout { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center;
  animation: rise 1.05s ease-out forwards; white-space: nowrap; }
.callout b { font: 900 30px system-ui; color: var(--good); text-shadow: 0 2px 0 #0d4a45, 0 0 14px rgba(0, 0, 0, .7); }
.callout.big b { font-size: 44px; color: var(--gold); text-shadow: 0 2px 0 #7a5a14, 0 0 18px rgba(0, 0, 0, .7); }
.callout span { font: 800 17px system-ui; color: #fff; text-shadow: 0 0 10px rgba(0, 0, 0, .9); }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); }
  18% { opacity: 1; transform: translate(-50%, -70%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 8;
  font: 900 110px system-ui; color: #fff; text-shadow: 0 0 34px rgba(255, 184, 77, .9); pointer-events: none; }
.countdown.go { color: var(--good); animation: gopop .6s ease-out forwards; }
@keyframes gopop { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

.actions { display: flex; gap: 8px; width: min(100%, 470px); margin-top: 4px; }
.act-btn { flex: 1; height: 46px; border-radius: 12px; border: 1px solid rgba(255, 184, 77, .3);
  background: var(--panel2); font-weight: 700; font-size: 15px; white-space: nowrap; }
.act-btn.primary-act { flex: 1.6; background: linear-gradient(90deg, var(--accent), #ff8f5c); color: #231a05; border: 0; }
.act-btn:active { transform: translateY(1px); }
.hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; min-height: 16px; }

/* your words */
.side-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.found { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-radius: 14px;
  padding: 10px 12px; border: 1px solid rgba(255, 184, 77, .14); }
.found h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.found h3 b { color: var(--accent); font-size: 16px; margin-left: 4px; }
.found-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.found-empty { margin: 4px 0; font-size: 13px; }
.chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 9px; border-radius: 8px;
  background: var(--panel2); font: 700 14px var(--serif); letter-spacing: .05em; }
.chip small { font: 700 11px system-ui; color: var(--gold); }
.chip.big { background: #3d3350; box-shadow: inset 0 0 0 1px var(--gold); }
.chip.fresh { animation: fresh .6s ease-out; }
@keyframes fresh { from { background: var(--good); transform: scale(1.25); } }

/* ── the reveal ──────────────────────────────────────────────────────── */
#game.revealing .word-bar, #game.revealing .feedback, #game.revealing .actions,
#game.revealing .hint { display: none; }
.reveal { flex: 1; min-height: 0; overflow-y: auto; background: var(--panel); border-radius: 14px; padding: 12px 14px;
  border: 1px solid rgba(255, 184, 77, .3); }
.rv-head h2 { margin: 0; font: 700 22px var(--serif); color: var(--accent); }
.rv-sub { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.rv-spot { min-height: 62px; border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; background: #17142b;
  border: 1px solid rgba(79, 209, 197, .5); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  opacity: 0; transition: opacity .2s; }
.rv-spot.show { opacity: 1; }
.rv-spot.x2 { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 209, 102, .25); }
.rv-spot.missed { border-color: var(--missed); }
.rv-word { font: 700 26px var(--serif); letter-spacing: .1em; color: #fff; }
.rv-spot.x2 .rv-word { color: var(--gold); }
.rv-spot.missed .rv-word { color: var(--missed); }
.rv-val { font-weight: 800; color: var(--good); }
.rv-spot.x2 .rv-val { color: var(--gold); }
.rv-spot.missed .rv-val { color: var(--missed); }
.rv-by { font-size: 13px; color: var(--muted); flex-basis: 100%; }
.rv-scores { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.rv-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.rv-row.me .rv-name { color: var(--accent); }
.rv-name { width: 34%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rv-bar { flex: 1; height: 14px; border-radius: 7px; background: #17142b; display: flex; overflow: hidden; }
.rv-bar i { display: block; height: 100%; width: 0; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.rv-bar i.bonus { background: repeating-linear-gradient(45deg, var(--gold), var(--gold) 5px, #ffe9a8 5px, #ffe9a8 10px);
  transition-delay: .7s; }
.rv-pts { min-width: 58px; text-align: right; font: 700 13px ui-monospace, monospace; }
.rv-total { min-width: 30px; text-align: right; font: 800 15px ui-monospace, monospace; color: var(--gold); }
.rv-h { margin: 10px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.rv-words { display: flex; flex-wrap: wrap; gap: 6px; }
.rchip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 8px; border: 1px solid transparent;
  background: var(--panel2); font: 700 13.5px var(--serif); letter-spacing: .05em; }
.rchip small { font: 700 11px system-ui; color: var(--good); }
.rchip.x2 { border-color: var(--gold); }
.rchip.x2 small { color: var(--gold); }
.rchip.mine { background: #3a3260; }
.rchip.miss { border: 1px dashed var(--missed); background: transparent; }
.rchip.miss small { color: var(--missed); }
.rchip.lit { outline: 2px solid #fff; }
/* a find that is in the dictionary but not an everyday word (reveal row `rare`) */
.rare-tag { font: italic 600 10px system-ui; letter-spacing: 0; text-transform: none; color: var(--muted);
  border: 1px solid currentColor; border-radius: 6px; padding: 0 4px; opacity: .85; white-space: nowrap; }
.rv-spot .rare-tag { display: inline-block; margin-top: 3px; font-size: 11px; }
.rv-all-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.pips { display: inline-flex; gap: 2px; }
.pips i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.rv-all { margin-top: 10px; font-size: 13px; }
.rv-all summary { cursor: pointer; color: var(--accent); font-weight: 600; }
#rvAll { margin-top: 6px; line-height: 1.7; color: var(--muted); font-family: var(--serif); max-height: 180px; overflow-y: auto; }
#rvAll .got { color: #fff; font-weight: 700; }
.rv-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px;
  position: sticky; bottom: -12px; background: var(--panel); padding: 8px 0 4px; }
.rv-foot .small-btn { display: inline-block; width: auto; padding: 9px 22px; margin: 0 0 0 auto; }

.toast-box { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; flex-direction: column; align-items: center;
  gap: 6px; pointer-events: none; z-index: 20; }
.toast { background: rgba(20, 18, 36, .95); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 14px;
  max-width: 92vw; font-size: 14px; }
.toast.bad { border-color: var(--bad); }
.toast.floating { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 80; }

/* ── overlays (menu, lobby, results) ─────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; display: flex; justify-content: center; overflow-y: auto; padding: 14px 10px;
  background:
    radial-gradient(900px 520px at 18% 8%, rgba(255, 184, 77, .13), transparent 60%),
    radial-gradient(800px 520px at 85% 92%, rgba(79, 209, 197, .13), transparent 60%),
    var(--bg);
}
.card {
  width: min(500px, 94vw); padding: 18px 20px 14px; margin: auto 0; position: relative;
  border-radius: 16px; text-align: center; background: var(--panel);
  border: 1px solid rgba(255, 184, 77, .25); box-shadow: 0 10px 50px rgba(0, 0, 0, .5);
}
.card.results-wide { width: min(820px, 96vw); }
.card-top { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.lobby-audio { display: flex; justify-content: center; min-width: 0; }
/* UI language: EN | DE (per player, kept site-wide in localStorage ms_lang) */
.lang-toggle { display: inline-flex; border-radius: 9px; overflow: hidden; border: 1px solid rgba(255, 184, 77, .35); flex: 0 0 auto; }
.lang-toggle button { padding: 7px 9px; border: 0; background: #17142b; color: var(--muted); font: 700 12px system-ui; }
.lang-toggle button.on { background: var(--accent); color: #231a05; }
.lang-btn { font: 800 11px system-ui; letter-spacing: .02em; }
.lx-title { margin: 8px 0 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.lx-tiles { display: flex; gap: 4px; }
.lx-tiles i { width: 42px; height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font: 700 28px var(--serif); font-style: normal; color: var(--tile-ink);
  background: linear-gradient(160deg, #fffaf0, var(--tile) 55%, #e6d9bd); box-shadow: 0 3px 0 #a8997a; }
.lx-tiles i:nth-child(3) { background: linear-gradient(160deg, #fff3d6, var(--accent)); transform: translateY(-3px) rotate(-4deg); }
.lx-clash { font: italic 700 26px var(--serif); color: var(--good); letter-spacing: .28em; margin-left: .28em;
  text-transform: uppercase; }
.lx-title.small .lx-tiles i { width: 30px; height: 34px; font-size: 20px; }
.lx-title.small .lx-clash { font-size: 17px; }
.lx-head { margin: 4px 0; font: 700 32px var(--serif); color: var(--accent); }
.tagline { color: var(--muted); margin: 2px 0 12px; }
#nameInput { width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid rgba(255, 184, 77, .3);
  background: #17142b; color: #fff; font-size: 16px; margin-bottom: 8px; }
.primary, .secondary { display: block; width: 100%; padding: 12px; margin: 8px 0; border-radius: 12px;
  font-weight: 800; font-size: 16px; border: 0; }
.primary { background: linear-gradient(90deg, var(--accent), #ff8f5c); color: #231a05; }
.primary:disabled, .secondary:disabled { opacity: .45; cursor: default; }
.secondary { background: var(--panel2); color: var(--ink); border: 1px solid rgba(255, 184, 77, .3); }
.daily-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px; }
.daily-btn small { font-weight: 600; font-size: 12px; opacity: .8; }
.link-row { display: flex; justify-content: center; gap: 4px 14px; flex-wrap: wrap; margin: 8px 0 2px; }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 6px; }
.back-link { display: inline-block; margin-top: 8px; color: var(--muted); font-size: 14px; }

.setup { text-align: left; margin: 6px 0 4px; }
.settings-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.settings-label { width: 74px; flex: 0 0 74px; font-size: 13px; color: var(--muted); }
.seg { display: flex; gap: 4px; flex: 1; min-width: 0; }
.seg.wrap { flex-wrap: wrap; }
.seg button { flex: 1; padding: 7px 6px; border-radius: 8px; border: 1px solid rgba(255, 184, 77, .25);
  background: #17142b; color: var(--ink); font-size: 13px; white-space: nowrap; }
.seg button.on { background: var(--accent); color: #231a05; font-weight: 800; border-color: var(--accent); }
.seg.locked button { cursor: default; }
.seg.locked button:not(.on) { opacity: .5; }
.setup:not(.is-room) .room-only { display: none; }
.setup.no-bots .bots-only { display: none; }

.squad-count { color: var(--muted); margin-bottom: 6px; }
.player-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; text-align: left; }
.player-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: #17142b; }
.player-row .player-name { font-weight: 700; flex: 1; min-width: 0; }
.player-row .tag { font-size: 12px; color: var(--muted); }
.need-more { margin: 4px 0; font-size: 13px; }
.leaderboard { margin-top: 12px; text-align: left; }
.board-note { font-size: 12px; margin: 6px 0 0; }

.daily-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.ds-cell.wide { grid-column: 1 / -1; }
.ds-cell.wide b { letter-spacing: .12em; }
.ds-cell { background: #17142b; border-radius: 10px; padding: 10px 4px; }
.ds-cell b { display: block; font: 700 20px var(--serif); color: var(--gold); overflow: hidden; text-overflow: ellipsis; }
.ds-cell small { color: var(--muted); font-size: 12px; }

/* results */
.result-note { margin: 4px 0 10px; font-weight: 700; color: var(--gold); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 8px 0 14px; }
.pod { display: flex; flex-direction: column; align-items: center; min-width: 96px; max-width: 170px; }
.pod .pname { font-weight: 700; font-size: 14px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.pod .ppts { color: var(--muted); font-size: 13px; margin: 2px 0 4px; }
.pod .block { width: 100%; border-radius: 8px 8px 0 0; display: flex; align-items: flex-start;
  justify-content: center; padding-top: 6px; font: 900 18px var(--serif); color: #231a05; }
.pod.p1 .block { height: 70px; background: var(--gold); }
.pod.p2 .block { height: 50px; background: #d6d0ee; }
.pod.p3 .block { height: 36px; background: #e9a77c; }
.result-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* how-to */
.howto { position: fixed; inset: 0; z-index: 50; background: rgba(8, 6, 18, .78);
  display: flex; align-items: center; justify-content: center; padding: 12px; }
.howto-card { width: min(520px, 100%); background: var(--panel); border-radius: 16px; padding: 18px;
  position: relative; border: 1px solid var(--accent); max-height: 96vh; overflow-y: auto; }
.howto-x { position: absolute; top: 10px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 18px; }
.howto-card h2 { margin: 0 0 10px; font-family: var(--serif); }
.hstep { display: none; }
.hstep.on { display: block; }
.hstep h3 { margin: 10px 0 4px; color: var(--accent); }
.hstep p { margin: 0; line-height: 1.5; color: #dcd6f5; }
.hart { min-height: 96px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #17142b; border-radius: 12px; padding: 10px; flex-wrap: wrap; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 28px); gap: 3px; }
.mini-grid i, .mini-rack i { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font: 700 16px var(--serif); font-style: normal; color: var(--tile-ink); background: var(--tile); position: relative; }
.mini-grid i.on { background: var(--accent); box-shadow: 0 0 10px rgba(255, 184, 77, .8); }
.mini-grid i.on::after { position: absolute; right: 2px; top: 0; font: 700 8px system-ui; color: #5c3d05; }
.mini-grid i.o1::after { content: "1"; } .mini-grid i.o2::after { content: "2"; }
.mini-grid i.o3::after { content: "3"; } .mini-grid i.o4::after { content: "4"; }
.mini-rack { display: flex; gap: 3px; }
.demo-word { font: 700 18px var(--serif); letter-spacing: .08em; color: var(--accent); }
.kbd { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 7px; border: 1px solid #6e679a; border-bottom-width: 3px;
  display: inline-flex; align-items: center; justify-content: center; font: 700 15px ui-monospace, monospace; }
.kbd.wide { color: var(--good); border-color: var(--good); }
.pts-pill { background: var(--panel2); padding: 5px 10px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.pts-pill b { font-size: 17px; color: var(--gold); }
.x2-chip { font: 700 18px var(--serif); letter-spacing: .08em; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--gold); }
.x2-chip b { color: var(--gold); font-family: system-ui; }
.who-dot { font-size: 13px; color: var(--muted); }
.howto-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.howto-dots { display: flex; gap: 6px; }
.howto-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--panel2); }
.howto-dots i.on { background: var(--accent); }
.mini-btn { padding: 7px 12px; border-radius: 8px; border: 1px solid rgba(255, 184, 77, .3);
  background: var(--panel2); color: var(--ink); font-size: 13px; white-space: nowrap; }
.mini-btn:disabled { opacity: .4; }
.primary-mini { background: var(--accent); color: #231a05; font-weight: 800; border-color: var(--accent); }
.tut-link { display: block; margin: 10px auto 0; }

/* ── phone ──────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  /* two rows: the mode + round line on top (German names are long), then
     the clock, the score and the buttons */
  .topbar { padding: 4px 8px 6px; padding-top: calc(4px + env(safe-area-inset-top)); gap: 3px 6px; flex-wrap: wrap; }
  .tb-left { flex: 0 0 100%; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  .tb-round { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .tb-clock { order: 1; }
  .tb-right { order: 2; }
  .tb-clock { font-size: 24px; min-width: 70px; padding: 2px 6px; }
  .tb-btn, .hud-gear summary { width: 30px; height: 30px; }
  .tb-right { gap: 5px; }
  .tb-score b { font-size: 20px; }
  .tb-mode { font-size: 14px; }
  .stage { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 8px; }
  .hud-board { flex-direction: row; overflow-x: auto; align-self: stretch; gap: 5px; flex: 0 0 auto;
    scrollbar-width: none; }
  .hud-board::-webkit-scrollbar { display: none; }
  .hud-row { flex: 0 0 auto; padding: 4px 8px 4px 5px; gap: 5px; max-width: 46vw; }
  .hud-row .dot { width: 20px; height: 20px; flex-basis: 20px; font-size: 11px; }
  .hud-who { font-size: 12.5px; }
  .hud-n { display: none; }
  .hud-v { font-size: 14px; min-width: 0; }
  .play-col { flex: 0 0 auto; gap: 4px; }
  .word-bar { height: 44px; }
  #game.anagram .word-bar { height: 56px; }
  .slots { gap: 4px; }
  .slot { width: 36px; height: 42px; font-size: 22px; }
  #game.anagram .play-col { justify-content: flex-start; padding-bottom: 0; }
  #game.anagram .board-wrap.is-rack { padding: 18px 0 14px; }
  .cur-word { font-size: 24px; }
  .feedback { height: 20px; font-size: 14px; }
  .board-wrap.is-grid { width: min(100%, calc(var(--vvh) - 350px)); }
  .actions { margin-top: 2px; }
  .act-btn { height: 42px; }
  .hint { display: none; }
  .side-col { flex: 1 1 auto; min-height: 60px; }
  .found { padding: 8px 10px; }
  .found h3 { margin-bottom: 5px; }
  .coach { font-size: 14px; padding: 8px 10px; }
  /* the reveal: the board shrinks, the lists scroll under it */
  #game.revealing .board-wrap.is-grid { width: min(62vw, 250px); }
  #game.revealing .board-wrap.is-rack { padding: 6px 0; }
  #game.revealing .face { font-size: clamp(15px, 6vw, 26px); }
  .reveal { padding: 10px; }
  .rv-word { font-size: 22px; }
  .callout b { font-size: 26px; } .callout.big b { font-size: 36px; }
  .countdown { font-size: 84px; }
  /* four stat columns have to fit a 390px card without a sideways scroll */
  .fs-table th, .fs-table td { padding: 7px 5px; font-size: 13px; }
  .fs-table th { letter-spacing: 0; font-size: 10.5px; }
  .lx-tiles i { width: 36px; height: 40px; font-size: 24px; }
  .card { padding: 14px 14px 12px; }
  .settings-label { width: 62px; flex-basis: 62px; font-size: 12px; }
  .seg button { font-size: 12.5px; padding: 7px 4px; }
}
@media (max-height: 700px) and (min-width: 761px) {
  .board-wrap.is-grid { width: min(100%, 440px, calc(var(--vvh) - 250px)); }
}
/* a watcher is told so where a player reads the controls hint — also on a phone */
#game.watching .hint { display: block; color: var(--gold); }
#game.watching.revealing .hint { display: none; }
