:root {
  color-scheme: dark;
  --bg: #071410; --surface: #10251f; --surface-2: #17332b; --surface-3: #204238;
  --text: #f3f6ed; --muted: #a9bbb3; --accent: #d5ff5f; --accent-ink: #102018;
  --blue: #70d7ff; --danger: #ff7a7a; --warning: #ffd166; --line: #315348;
  --shadow: 0 20px 60px rgba(0, 0, 0, .28); --radius: 22px; --text-scale: 1;
}
[data-theme="light"] {
  color-scheme: light; --bg: #f3f6ed; --surface: #fff; --surface-2: #e7eee8; --surface-3: #d7e5dc;
  --text: #102018; --muted: #50635b; --line: #bdd0c5; --shadow: 0 18px 50px rgba(16, 32, 24, .12);
}
[data-theme="contrast"] {
  color-scheme: dark; --bg: #000; --surface: #090909; --surface-2: #161616; --surface-3: #222;
  --text: #fff; --muted: #eee; --accent: #ffff00; --accent-ink: #000; --blue: #00ffff; --line: #fff;
}
* { box-sizing: border-box; }
html { font-size: calc(16px * var(--text-scale)); background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--surface-3) 55%, transparent), transparent 28rem), var(--bg); color: var(--text); font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 100; left: 1rem; top: -5rem; padding: .8rem 1rem; background: var(--accent); color: var(--accent-ink); border-radius: 10px; }
.skip-link:focus { top: 1rem; }
.app-shell { width: min(1180px, 100%); min-height: 100vh; margin: auto; padding: 0 clamp(1rem, 4vw, 3rem); display: grid; grid-template-rows: auto 1fr auto; }
.site-header { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { border: 0; background: none; display: flex; align-items: center; gap: .65rem; padding: .4rem 0; font-size: 1.2rem; cursor: pointer; }
.brand-mark { width: 38px; height: 38px; fill: var(--accent); }
.brand-mark path + path { fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; }
.brand span { letter-spacing: -.03em; }.brand strong { font-weight: 800; }
nav { display: flex; align-items: center; gap: .4rem; }
.nav-button, .icon-button, .link-button { border: 0; background: transparent; cursor: pointer; }
.nav-button { padding: .75rem 1rem; color: var(--muted); border-radius: 999px; }.nav-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button { width: 44px; height: 44px; padding: 10px; border-radius: 50%; }.icon-button:hover { background: var(--surface-2); }.icon-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; }
main { padding: clamp(1.5rem, 5vh, 4rem) 0; }
footer { min-height: 64px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--muted); font-size: .8rem; }
.link-button { color: var(--blue); padding: .5rem; text-decoration: underline; text-underline-offset: 3px; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; color: var(--accent); font-size: .77rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
h1, h2, h3, p { margin-top: 0; } h1 { font-size: clamp(2.8rem, 8vw, 6rem); line-height: .93; letter-spacing: -.065em; max-width: 850px; margin: 1rem 0 1.4rem; } h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -.04em; } h3 { font-size: 1rem; }
.lede { color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.65; max-width: 650px; }
.hero { padding-top: 4vh; }.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: 2rem 0 3rem; }
.button { min-height: 50px; border: 1px solid transparent; border-radius: 14px; padding: .8rem 1.25rem; background: var(--surface-2); font-weight: 750; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-2px); background: var(--surface-3); }.button.primary { background: var(--accent); color: var(--accent-ink); }.button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }.button.outline { border-color: var(--line); background: transparent; }.button.danger { border-color: var(--danger); color: var(--danger); background: transparent; }.button:disabled { opacity: .45; pointer-events: none; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.mode-card { text-align: left; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem; background: color-mix(in srgb, var(--surface) 84%, transparent); min-height: 170px; cursor: pointer; box-shadow: 0 0 0 transparent; transition: .2s ease; }
.mode-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }.mode-card span { display: block; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 1rem; }.mode-card p { color: var(--muted); line-height: 1.5; margin-bottom: 0; font-size: .9rem; }
.game-layout { display: grid; grid-template-columns: minmax(300px, 620px) minmax(240px, 1fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.game-topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 1rem; }.game-topbar > :last-child { justify-self: end; }
.metric { color: var(--muted); font-size: .77rem; text-transform: uppercase; letter-spacing: .08em; }.metric strong { display: block; color: var(--text); font-size: 1.4rem; letter-spacing: -.03em; margin-top: .2rem; font-variant-numeric: tabular-nums; }.timer { text-align: center; }.timer.warning strong { color: var(--warning); }.timer.urgent strong { color: var(--danger); animation: pulse 1s infinite; }
.board-wrap { position: relative; touch-action: none; user-select: none; }
.gesture-hint { margin: 0 0 .6rem; color: var(--muted); text-align: center; font-size: .88rem; }
.board { --size: 4; aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--size), 1fr); gap: clamp(6px, 1.5vw, 12px); padding: clamp(8px, 2vw, 14px); background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow); }
.selection-lines { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.selection-segment { stroke: var(--accent); stroke-width: 5; stroke-linecap: round; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
#selection-arrow path { fill: var(--accent); }
.cell { position: relative; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: clamp(11px, 2vw, 18px); background: linear-gradient(145deg, var(--surface-3), var(--surface-2)); color: var(--text); font-size: clamp(1.55rem, 6vw, 3.2rem); font-weight: 850; letter-spacing: -.08em; text-transform: uppercase; cursor: pointer; box-shadow: inset 0 1px rgba(255,255,255,.08), 0 5px 10px rgba(0,0,0,.13); min-width: 44px; min-height: 44px; }
.cell:hover { border-color: var(--blue); }.cell.selected { background: var(--accent); color: var(--accent-ink); transform: scale(.94); z-index: 2; }.cell.selected::after { content: attr(data-order); position: absolute; right: 7px; top: 5px; font-size: .65rem; font-weight: 900; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: var(--accent-ink); letter-spacing: 0; }
.cell.feedback-accepted { background: #39d98a; border-color: #a6f4ce; color: #062b1c; box-shadow: 0 0 0 4px color-mix(in srgb, #39d98a 36%, transparent), 0 7px 18px rgba(0,0,0,.2); transform: scale(.96); }
.cell.feedback-rejected { background: #ff6577; border-color: #ffc0c8; color: #37070d; box-shadow: 0 0 0 4px color-mix(in srgb, #ff6577 36%, transparent), 0 7px 18px rgba(0,0,0,.2); transform: scale(.96); }
.cell.feedback-duplicate { background: #f6c945; border-color: #ffeba6; color: #332500; box-shadow: 0 0 0 4px color-mix(in srgb, #f6c945 36%, transparent), 0 7px 18px rgba(0,0,0,.2); transform: scale(.96); }
.composer { min-height: 58px; display: grid; place-items: center; margin-top: .45rem; }.composer-word { width: 100%; text-align: center; font-size: clamp(1.6rem, 5vw, 2.8rem); font-weight: 850; text-transform: uppercase; letter-spacing: .08em; min-width: 0; overflow: hidden; text-overflow: ellipsis; }.composer-word.placeholder { color: var(--muted); font-weight: 500; font-size: 1rem; text-transform: none; letter-spacing: 0; }
.game-side { position: sticky; top: 1rem; }.panel { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }.panel-header h2, .panel-header h3 { margin: 0; }.count-badge { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 .5rem; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: .8rem; }
.word-list { list-style: none; margin: 0; padding: 0; max-height: 390px; overflow: auto; }.word-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-top: 1px solid var(--line); padding: .7rem .2rem; }.word-list li:first-child { border-top: 0; }.word-list strong { text-transform: uppercase; letter-spacing: .06em; }.word-list small { color: var(--muted); }.empty { color: var(--muted); text-align: center; padding: 2rem .5rem; line-height: 1.5; }.side-actions { display: flex; gap: .5rem; margin-top: 1rem; }.side-actions .button { flex: 1; padding-inline: .5rem; }
.missed-actions { display: flex; justify-content: center; padding-top: 1rem; border-top: 1px solid var(--line); }.missed-actions .button { width: 100%; min-height: 44px; padding-block: .55rem; }
.status-pill { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .8rem; }.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5ce19c; box-shadow: 0 0 0 4px color-mix(in srgb, #5ce19c 16%, transparent); }.status-pill[data-state="connecting"]::before { background: var(--warning); }.status-pill[data-state="disconnected"],.status-pill[data-state="offline"] { color: var(--danger); }.status-pill[data-state="disconnected"]::before,.status-pill[data-state="offline"]::before { background: var(--danger); }
.room-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; max-width: 820px; }.room-code { font-size: clamp(2rem, 7vw, 4rem); letter-spacing: .16em; color: var(--accent); font-weight: 900; margin: 1rem 0; }.participants { list-style: none; padding: 0; margin: 0; }.participants li { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: .7rem; padding: .8rem .2rem; border-top: 1px solid var(--line); }.participants li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #5ce19c; }.participants li.disconnected::before { background: var(--muted); }.participants small { color: var(--muted); }.lobby-layout { display: grid; grid-template-columns: 1fr minmax(260px, .55fr); gap: 1rem; }.reaction-row { display: flex; flex-wrap: wrap; gap: .5rem; }.reaction-row button { min-width: 52px; }
.results-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }.score-hero { font-size: clamp(3.5rem, 10vw, 7rem); font-weight: 900; line-height: .8; letter-spacing: -.08em; color: var(--accent); }.score-hero small { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-top: 1rem; }
.results-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; }.result-word { cursor: pointer; }.result-word:hover strong { color: var(--accent); }.reason { color: var(--danger); }.found-mark { color: #5ce19c; }
.path-preview { display: grid; grid-template-columns: repeat(var(--size), 1fr); gap: 5px; width: min(240px, 100%); margin: 1rem auto; }.path-preview span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); font-weight: 800; }.path-preview span.active { background: var(--accent); color: var(--accent-ink); }
.definition-word { text-transform: uppercase; letter-spacing: .06em; }.word-definition { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }.word-definition h3 { margin: 0 0 .75rem; }.definition-entry + .definition-entry { margin-top: 1rem; }.definition-entry h4 { margin: 0 0 .35rem; color: var(--accent); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }.definition-entry ol { margin: 0; padding-left: 1.35rem; }.definition-entry li { padding-left: .2rem; line-height: 1.5; }.definition-entry li + li { margin-top: .45rem; }.definition-loading,.definition-unavailable,.definition-attribution { color: var(--muted); }.definition-attribution { margin: 1rem 0 0; font-size: .72rem; line-height: 1.45; }.definition-attribution a { color: inherit; }
.share-text { width: 100%; resize: none; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: .8rem; font: inherit; line-height: 1.5; }.share-text:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); }.share-status { min-height: 1.5em; color: var(--muted); font-size: .85rem; }
.settings-grid { display: grid; grid-template-columns: minmax(180px, .35fr) 1fr; gap: 2rem; }.settings-nav { display: flex; flex-direction: column; gap: .3rem; }.settings-nav button { text-align: left; border: 0; border-radius: 10px; padding: .8rem; background: transparent; cursor: pointer; }.settings-nav button.active { background: var(--surface-2); color: var(--accent); }
.form-stack { display: grid; gap: 1.25rem; max-width: 580px; }.field { display: grid; gap: .45rem; }.field label, fieldset legend { font-weight: 700; }.field small { color: var(--muted); }.field input, .field select { width: 100%; min-height: 48px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: .7rem .8rem; }.toggle-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem 0; border-top: 1px solid var(--line); }.toggle-row input { width: 22px; height: 22px; accent-color: var(--accent); }.segmented { display: flex; padding: 4px; background: var(--surface-2); border-radius: 12px; }.segmented button { flex: 1; border: 0; border-radius: 9px; padding: .65rem; background: transparent; cursor: pointer; }.segmented button.active { background: var(--accent); color: var(--accent-ink); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 2rem; }.stat { padding: 1rem; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; }.stat span { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; }.stat strong { display: block; margin-top: .4rem; font-size: 1.6rem; }
.history-table { width: 100%; border-collapse: collapse; }.history-table th, .history-table td { padding: .9rem .6rem; text-align: left; border-bottom: 1px solid var(--line); }.history-table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }.history-table td:nth-child(n+3), .history-table th:nth-child(n+3) { text-align: right; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 1rem; background: rgba(0,0,0,.68); backdrop-filter: blur(8px); }.modal { width: min(500px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.toast-region { position: fixed; z-index: 50; bottom: 1rem; left: 50%; translate: -50% 0; display: grid; gap: .5rem; width: min(420px, calc(100% - 2rem)); }.toast { padding: .9rem 1rem; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); text-align: center; font-weight: 700; animation: toast-in .2s ease-out; }.toast.error { background: var(--danger); color: #230000; }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }
@keyframes pulse { 50% { opacity: .45; } } @keyframes toast-in { from { opacity: 0; translate: 0 10px; } }
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation-duration: .01ms!important; animation-iteration-count: 1!important; scroll-behavior: auto!important; transition-duration: .01ms!important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms!important; animation-iteration-count: 1!important; scroll-behavior: auto!important; transition-duration: .01ms!important; } }
@media (max-width: 760px) { .mode-grid, .results-grid, .settings-grid, .room-grid, .lobby-layout { grid-template-columns: 1fr; }.game-layout { grid-template-columns: 1fr; }.game-side { position: static; }.game-side .word-list { max-height: 220px; }.stats { grid-template-columns: repeat(2, 1fr); }.results-head { align-items: start; flex-direction: column; }.site-header { min-height: 70px; }.hero { padding-top: 1vh; }h1 { font-size: clamp(2.8rem, 16vw, 4.5rem); }.settings-nav { flex-direction: row; overflow-x: auto; }.settings-nav button { white-space: nowrap; } }
@media (max-width: 440px) { .app-shell { padding-inline: .8rem; }.brand span { font-size: 1rem; }.nav-button { display: none; }.board { gap: 6px; padding: 7px; }.cell { border-radius: 10px; }.game-topbar { margin-inline: .3rem; }.metric strong { font-size: 1.1rem; }.history-table th:nth-child(2), .history-table td:nth-child(2) { display: none; } }
