﻿/* Designed by Graaphix — Guess The Word v2 · "Luxe ink notebook" */

:root {
  --ink-0: #0c0b09;
  --ink-1: #13120f;
  --ink-2: #1b1915;
  --ink-3: #26231e;
  --ink-4: #34302a;
  --rule: rgba(236, 224, 198, 0.055);
  --hair: rgba(236, 224, 198, 0.1);
  --hair-strong: rgba(236, 224, 198, 0.18);
  --text: #f1eadc;
  --text-dim: #b3aa99;
  --text-faint: #7a7264;
  --gold: #e3c27a;
  --gold-hi: #f6dfa4;
  --gold-lo: #a88343;
  --gold-glow: rgba(227, 194, 122, 0.28);
  --p1: #7cb2ff;
  --p2: #ff9f6e;
  --hit: #86d9ae;
  --miss: #e2716d;
  --red-ink: #ff6b62;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 40px -18px rgba(0, 0, 0, 0.8), 0 2px 6px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-hand: "Caveat", "Segoe Print", cursive;
  --f-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--ink-0);
  color: var(--text);
  font: 15px/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

/* ---------- paper backdrop ---------- */
.paper-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(227, 194, 122, 0.08), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(124, 178, 255, 0.05), transparent 60%),
    radial-gradient(circle at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    var(--ink-0);
}
.paper-bg::before {
  content: ""; position: absolute; inset: 0; opacity: 0.5;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  mask-image: linear-gradient(to bottom, transparent, #000 15%, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 15%, #000 85%, transparent);
}
.paper-bg::after {
  content: ""; position: absolute; inset: 0; opacity: 0.09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- shell ---------- */
.app {
  width: 100%; max-width: 560px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: calc(10px + var(--safe-t)) 16px calc(14px + var(--safe-b));
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 0 12px; position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; border-radius: 12px; }
.brand-mark { width: 34px; height: 34px; filter: drop-shadow(0 4px 12px rgba(227, 194, 122, 0.25)); }
.brand-word { font-family: var(--f-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; }
.brand-word em { font-style: italic; font-weight: 600; color: var(--gold); padding: 0 1px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.room-chip {
  display: flex; align-items: baseline; gap: 6px; padding: 6px 11px; border-radius: 999px;
  background: var(--ink-2); border: 1px solid var(--hair); font-size: 0.78rem;
}
.room-chip-label { color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.62rem; }
.room-chip strong { letter-spacing: 0.14em; font-weight: 700; color: var(--gold-hi); }
.voice { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; position: relative;
  background: var(--ink-2); border: 1px solid var(--hair); color: var(--text-dim);
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--hair-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .slash { display: none; }
.icon-btn.mic[aria-pressed="false"] .slash, .icon-btn[aria-pressed="false"]:not(.mic) .slash { display: block; }
.icon-btn[aria-pressed="false"]:not(.mic) .wave { display: none; }
.icon-btn.mic[aria-pressed="true"] { color: #0f0e0b; background: var(--hit); border-color: transparent; }
.icon-btn.mic.busy { opacity: 0.6; }
.mic-level {
  position: absolute; inset: -3px; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 0 rgba(134, 217, 174, 0.55); transition: box-shadow 0.08s linear;
}
.hub-link {
  position: fixed; left: 12px; bottom: calc(12px + var(--safe-b)); z-index: 20;
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px 7px 9px; border-radius: 999px;
  background: rgba(19, 18, 15, 0.82); border: 1px solid var(--hair); color: var(--text-dim);
  font-size: 0.78rem; font-weight: 600; text-decoration: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.hub-link:hover { color: var(--gold-hi); border-color: var(--gold-lo); transform: translateY(-1px); }
.hub-link svg { stroke: currentColor; }

.stage { flex: 1; display: flex; flex-direction: column; }
.screen { display: flex; flex-direction: column; gap: 14px; animation: screen-in 0.45s var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.footer {
  text-align: center; color: var(--text-faint); font-size: 0.72rem; padding: 22px 0 4px; letter-spacing: 0.02em;
}
.footer a { color: var(--text-dim); text-decoration: none; border-bottom: 1px solid var(--hair); }
.footer a:hover { color: var(--gold-hi); border-color: var(--gold-lo); }

/* ---------- type ---------- */
.eyebrow {
  margin: 0; font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600; color: var(--gold);
}
.hero { padding: 18px 2px 4px; }
.hero-title {
  margin: 8px 0 10px; font-family: var(--f-display); font-weight: 800; font-size: clamp(2.3rem, 9vw, 3.1rem);
  line-height: 1.02; letter-spacing: -0.025em;
}
.gold-ink {
  font-style: italic; font-weight: 600;
  background: linear-gradient(100deg, var(--gold-hi), var(--gold) 45%, var(--gold-lo));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  position: relative;
}
.gold-ink::after {
  content: ""; position: absolute; left: 2%; right: 6%; bottom: -0.08em; height: 0.11em; border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-lo) 90%, transparent);
  transform-origin: left; animation: underline 1.1s 0.25s var(--ease) both; opacity: 0.8;
}
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hero-sub, .screen-sub { margin: 0; color: var(--text-dim); max-width: 34ch; }
.screen-head { padding: 10px 2px 0; }
.screen-title {
  margin: 6px 0 6px; font-family: var(--f-display); font-weight: 700; font-size: clamp(1.7rem, 6.5vw, 2.1rem);
  letter-spacing: -0.02em; line-height: 1.1;
}
.ellipsis i { font-style: normal; animation: blink 1.4s infinite both; }
.ellipsis i:nth-child(2) { animation-delay: 0.2s; }
.ellipsis i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

/* ---------- cards / fields / buttons ---------- */
.card {
  position: relative; background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--hair); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 0.74rem; color: var(--text-dim); font-weight: 600; letter-spacing: 0.04em; }
.input {
  width: 100%; height: 50px; padding: 0 15px; border-radius: var(--radius-sm);
  background: var(--ink-0); border: 1px solid var(--hair-strong); color: var(--text);
  font-size: 1rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-glow); }
.input.shake { animation: shake 0.4s; border-color: var(--miss); }
.ink-input {
  height: 60px; font-family: var(--f-hand); font-size: 1.85rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--gold-hi);
}
.ink-input::placeholder { text-transform: none; letter-spacing: 0.01em; font-weight: 500; }
.code-input { text-transform: uppercase; letter-spacing: 0.22em; font-weight: 700; }
.code-input::placeholder { letter-spacing: 0.04em; font-weight: 500; text-transform: none; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 20px; border-radius: var(--radius-sm); font-weight: 650; font-size: 0.95rem;
  letter-spacing: 0.01em; white-space: nowrap; position: relative; overflow: hidden;
  transition: transform 0.15s var(--ease), box-shadow 0.25s, background 0.25s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn-block { width: 100%; }
.btn-sm { height: 40px; padding: 0 14px; font-size: 0.86rem; }
.btn-gold {
  color: #1a1408;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, #c9a35b);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 -2px 0 rgba(0, 0, 0, 0.18) inset, 0 10px 26px -10px var(--gold-glow);
}
.btn-gold:hover:not(:disabled) { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 -2px 0 rgba(0, 0, 0, 0.18) inset, 0 14px 32px -10px rgba(227, 194, 122, 0.5); }
.btn-gold::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
}
.btn-gold:hover:not(:disabled)::after { transition: transform 0.8s var(--ease); transform: translateX(120%); }
.btn-ghost { background: var(--ink-3); border: 1px solid var(--hair-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--gold-lo); color: var(--gold-hi); }
.link-btn {
  align-self: center; color: var(--text-dim); font-size: 0.86rem; padding: 8px 12px;
  border-bottom: 1px dashed var(--hair-strong); border-radius: 0;
}
.link-btn:hover { color: var(--gold-hi); border-color: var(--gold-lo); }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  background: var(--ink-3); border: 1px solid var(--hair); color: var(--text-dim); font-size: 0.8rem; font-weight: 600;
  transition: color 0.2s, border-color 0.2s, transform 0.15s;
}
.chip-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.chip-btn:hover { color: var(--gold-hi); border-color: var(--gold-lo); }
.chip-btn:active { transform: scale(0.95); }
.chip-btn.spin svg { animation: spin 0.6s var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- menu ---------- */
.menu-card { display: flex; flex-direction: column; gap: 16px; }
.menu-actions { display: flex; flex-direction: column; gap: 10px; }
.mode-tile {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px;
  border-radius: 14px; background: var(--ink-1); border: 1px solid var(--hair);
  transition: border-color 0.25s, transform 0.2s var(--ease), background 0.25s, box-shadow 0.25s;
}
.mode-tile:hover { border-color: var(--gold-lo); background: var(--ink-2); box-shadow: 0 12px 30px -18px var(--gold-glow); }
.mode-tile:active { transform: scale(0.985); }
.mode-tile:disabled { opacity: 0.55; }
.mode-icon {
  width: 46px; height: 46px; flex: none; border-radius: 13px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(246, 223, 164, 0.25), transparent 65%), var(--ink-3);
  border: 1px solid rgba(227, 194, 122, 0.25); color: var(--gold);
}
.mode-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mode-solo .mode-icon { color: var(--p1); border-color: rgba(124, 178, 255, 0.28); background: radial-gradient(circle at 30% 25%, rgba(124, 178, 255, 0.22), transparent 65%), var(--ink-3); }
.mode-copy { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mode-copy strong { font-family: var(--f-display); font-size: 1.08rem; font-weight: 700; }
.mode-copy small { color: var(--text-dim); font-size: 0.8rem; }
.mode-arrow { color: var(--text-faint); font-size: 1.2rem; transition: transform 0.25s var(--ease), color 0.2s; }
.mode-tile:hover .mode-arrow { transform: translateX(4px); color: var(--gold); }
.join-row { display: flex; gap: 8px; }
.join-row .input { flex: 1; min-width: 0; }
.join-row .btn { flex: none; }
.solo-box { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--hair); margin-top: 4px; }
.solo-box .mode-tile { margin-top: 6px; }
.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; gap: 4px; border-radius: 12px;
  background: var(--ink-0); border: 1px solid var(--hair);
}
.segmented button {
  height: 34px; border-radius: 9px; font-size: 0.82rem; font-weight: 600; color: var(--text-dim);
  transition: background 0.25s var(--ease), color 0.2s;
}
.segmented button[aria-checked="true"] { background: var(--ink-3); color: var(--gold-hi); box-shadow: 0 0 0 1px var(--hair-strong) inset; }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: rgba(227, 194, 122, 0.35); }
.invite-text { margin: 4px 0 0; font-size: 0.95rem; }
.invite-text strong { color: var(--gold-hi); letter-spacing: 0.12em; }

/* ---------- waiting ---------- */
.waiting-card { display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.code-tiles { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.code-tile {
  width: 52px; height: 64px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 800; font-size: 1.9rem; color: var(--gold-hi);
  background: linear-gradient(180deg, var(--ink-3), var(--ink-1)); border: 1px solid rgba(227, 194, 122, 0.3);
  box-shadow: 0 10px 22px -14px var(--gold-glow), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  animation: tile-drop 0.55s var(--spring) both;
}
.code-tiles.long .code-tile { width: 38px; height: 50px; font-size: 1.35rem; }
@keyframes tile-drop { from { opacity: 0; transform: translateY(-14px) rotate(-6deg); } to { opacity: 1; transform: none; } }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-row #btn-share { grid-column: 1 / -1; }
.mini-rules { margin: 0; padding: 14px 4px 0 22px; border-top: 1px dashed var(--hair); color: var(--text-dim); font-size: 0.86rem; display: grid; gap: 6px; }
.mini-rules li::marker { color: var(--gold); font-family: var(--f-display); font-weight: 700; }

/* ---------- setup ---------- */
.rival-status {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 9px; padding: 7px 13px; border-radius: 999px;
  background: var(--ink-2); border: 1px solid var(--hair); font-size: 0.83rem; color: var(--text-dim);
}
.rival-status.ready { color: var(--hit); border-color: rgba(134, 217, 174, 0.35); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); position: relative; }
.rival-status:not(.ready) .pulse-dot { background: var(--gold); animation: pulse 1.6s infinite; }
.rival-status.ready .pulse-dot { background: var(--hit); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(227, 194, 122, 0.6); } 100% { box-shadow: 0 0 0 9px rgba(227, 194, 122, 0); } }
.setup-card { display: flex; flex-direction: column; gap: 12px; }
.setup-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.counter { font-size: 0.78rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.counter.ok { color: var(--hit); }
.counter.bad { color: var(--miss); }
.preview { min-height: 34px; display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; padding: 6px 0 2px; }
.preview .pv-word { display: flex; gap: 4px; }
.preview .pv-slot { width: 16px; height: 22px; border-bottom: 2px solid var(--gold-lo); animation: tile-drop 0.3s var(--spring) both; }
.preview .pv-punct { width: 10px; color: var(--text-faint); text-align: center; font-weight: 700; }
.form-error { margin: 0; color: var(--miss); font-size: 0.85rem; text-align: center; }
.sealed-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-top: 44px; margin-top: 18px; }
.wax-seal svg { width: 26px; height: 26px; }
.wax-seal {
  position: absolute; top: -26px; left: 50%; width: 56px; height: 56px; margin-left: -28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.5rem; color: rgba(255, 230, 220, 0.85);
  background: radial-gradient(circle at 35% 30%, #c2463c, #7c1e19 70%);
  box-shadow: 0 0 0 4px rgba(124, 30, 25, 0.35), 0 10px 20px -6px rgba(0, 0, 0, 0.7), 0 2px 0 rgba(255, 255, 255, 0.2) inset;
  animation: stamp 0.55s var(--spring) both;
}
@keyframes stamp { from { transform: scale(1.8) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
.sealed-word {
  margin: 0; font-family: var(--f-hand); font-size: 2.1rem; font-weight: 700; color: var(--gold-hi);
  letter-spacing: 0.06em; line-height: 1.1; word-break: break-word;
}
.sealed-wait { margin: 0; color: var(--text-dim); font-size: 0.88rem; }
.edit-note { color: var(--text-faint); font-size: 0.75rem; min-height: 1em; }
.spellcheck { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 14px; border-radius: 14px; background: var(--ink-0); border: 1px solid var(--hair); }
.spellcheck strong { display: block; font-size: 0.95rem; }
.spellcheck small { color: var(--text-dim); font-size: 0.78rem; }
.ring { width: 44px; height: 44px; transform: rotate(-90deg); flex: none; }
.ring circle { fill: none; stroke-width: 3.5; }
.ring-track { stroke: var(--ink-3); }
.ring-fill { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 0; }

/* ---------- play: HUD ---------- */
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.vs { font-family: var(--f-display); font-style: italic; color: var(--text-faint); font-size: 0.9rem; }
.pcard {
  --c: var(--p1);
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 15px; min-width: 0;
  background: var(--ink-2); border: 1px solid var(--hair); position: relative;
  transition: border-color 0.3s, box-shadow 0.4s var(--ease), transform 0.3s var(--ease), opacity 0.3s;
}
.pcard.is-rival { justify-content: flex-end; text-align: right; }
.pcard.seat-1 { --c: var(--p2); }
.pcard.active { border-color: color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent), 0 12px 28px -14px var(--c); transform: translateY(-1px); }
.pcard.offline { opacity: 0.55; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 800; font-size: 0.95rem; color: #101010;
  background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent);
}
.pinfo { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pcard.is-rival .pinfo { align-items: flex-end; }
.pname { font-weight: 650; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; }
.pname > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.pscore { font-family: var(--f-display); font-weight: 800; font-size: 1.4rem; color: var(--c); font-variant-numeric: tabular-nums; margin-left: auto; padding: 0 2px; }
.pcard.is-rival .pscore { margin-left: 0; margin-right: auto; }
.pscore.bump { animation: bump 0.6s var(--spring); }
@keyframes bump { 40% { transform: scale(1.5); } }
.lives { display: flex; gap: 3px; }
.pcard.is-rival .lives { flex-direction: row-reverse; }
.drop {
  width: 9px; height: 12px; display: block; position: relative;
  transition: transform 0.4s var(--spring), opacity 0.35s;
}
.drop::before {
  content: ""; position: absolute; inset: 0; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--c) 30%, white), var(--c) 60%);
  clip-path: polygon(50% 0, 100% 62%, 92% 85%, 72% 100%, 28% 100%, 8% 85%, 0 62%);
}
.drop.spent { opacity: 0.18; transform: scale(0.75); }
.drop.spent::before { background: var(--text-faint); }
.drop.spill { animation: spill 0.7s var(--ease); }
@keyframes spill { 0% { transform: scale(1); } 30% { transform: scale(1.6) translateY(-3px); } 100% { transform: scale(0.75) translateY(4px); } }
.speaking { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; }
.speaking i { width: 2px; background: var(--hit); border-radius: 2px; animation: eq 0.8s infinite ease-in-out; }
.speaking i:nth-child(2) { animation-delay: 0.15s; }
.speaking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 11px; } }

/* ---------- play: turn bar ---------- */
.turn-bar {
  --c: var(--gold);
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 14px 12px;
  border-radius: 14px; background: var(--ink-1); border: 1px solid var(--hair); position: relative; overflow: hidden;
}
.turn-bar.mine { border-color: color-mix(in srgb, var(--c) 45%, transparent); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 10%, var(--ink-1)), var(--ink-1)); }
.turn-text { font-family: var(--f-display); font-weight: 700; font-size: 1.02rem; }
.turn-bar.mine .turn-text { color: var(--c); }
.turn-secs { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-dim); font-size: 0.9rem; }
.turn-bar.urgent .turn-secs { color: var(--miss); animation: tick 1s infinite; }
@keyframes tick { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } }
.turn-track { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: var(--ink-3); overflow: hidden; }
.turn-fill { display: block; height: 100%; width: 100%; background: var(--c); transform-origin: left; border-radius: 3px; }
.turn-bar.urgent .turn-fill { background: var(--miss); }

/* ---------- play: board ---------- */
.board { padding: 14px 14px 12px; }
.board-head, .mine-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.board-label { font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.board-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; background: var(--ink-0); border: 1px solid var(--hair); color: var(--text-dim); white-space: nowrap; }
.tag-gold { color: var(--gold-hi); border-color: rgba(227, 194, 122, 0.35); }
.slots { --slot: 40px; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0 6px; }
.slots.sz-md { --slot: 33px; }
.slots.sz-sm { --slot: 27px; }
.slots.sz-xs { --slot: 22px; }
.slot-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 100%; }
.slot {
  width: var(--slot); height: calc(var(--slot) * 1.28); position: relative; perspective: 400px;
}
.slot-face {
  position: absolute; inset: 0 0 12px; display: grid; place-items: center; border-radius: 8px;
  font-family: var(--f-display); font-weight: 800; font-size: calc(var(--slot) * 0.6);
  background: var(--ink-0); border: 1px solid var(--hair); border-bottom: 2px solid var(--hair-strong);
  transition: background 0.3s, border-color 0.3s;
}
.slot-num { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 0.58rem; color: var(--text-faint); font-variant-numeric: tabular-nums; line-height: 1; }
.slot.open .slot-face {
  color: var(--gold-hi); border-color: rgba(227, 194, 122, 0.35); border-bottom-color: var(--gold);
  background: linear-gradient(180deg, rgba(227, 194, 122, 0.14), rgba(227, 194, 122, 0.03));
  text-shadow: 0 0 18px rgba(227, 194, 122, 0.35);
}
.slot.flip .slot-face { animation: flip 0.6s var(--ease) both; }
@keyframes flip { 0% { transform: rotateX(90deg); } 60% { transform: rotateX(-12deg); } 100% { transform: none; } }
.slot.punct .slot-face { background: none; border: 0; color: var(--text-faint); }
.slot.lost .slot-face { color: var(--miss); border-bottom-color: var(--miss); background: rgba(226, 113, 109, 0.07); }
.board-actions { display: flex; justify-content: center; margin-top: 10px; }

/* ---------- play: keyboard ---------- */
.keyboard { display: flex; flex-direction: column; gap: 7px; user-select: none; -webkit-user-select: none; }
.kb-row { display: flex; justify-content: center; gap: 5px; }
.key {
  flex: 1 1 0; max-width: 46px; height: 50px; border-radius: 10px; font-weight: 700; font-size: 1.05rem;
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2)); border: 1px solid var(--hair-strong);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  transition: transform 0.08s, background 0.25s, color 0.25s, opacity 0.25s, border-color 0.25s, box-shadow 0.1s;
  position: relative;
}
.key:hover:not(:disabled) { border-color: var(--gold-lo); }
.key:active:not(:disabled), .key.press { transform: translateY(2px); box-shadow: 0 0 0 rgba(0, 0, 0, 0.45); }
.key.hit { background: linear-gradient(180deg, rgba(134, 217, 174, 0.3), rgba(134, 217, 174, 0.12)); color: var(--hit); border-color: rgba(134, 217, 174, 0.45); }
.key.miss { background: var(--ink-1); color: var(--text-faint); border-color: var(--hair); box-shadow: none; }
.key.miss::after { content: ""; position: absolute; left: 22%; right: 22%; top: 50%; height: 2px; background: var(--miss); opacity: 0.7; transform: rotate(-18deg); border-radius: 2px; }
.keyboard.locked .key:not(.hit):not(.miss) { opacity: 0.5; }

/* ---------- play: my word ---------- */
.mine { padding: 12px 14px; }
.mine-head { margin-bottom: 6px; }
.mine-word { font-family: var(--f-hand); font-size: 1.75rem; font-weight: 700; letter-spacing: 0.08em; line-height: 1.15; word-break: break-word; color: var(--text-dim); }
.mine-word .found { color: var(--red-ink); text-shadow: 0 0 14px rgba(255, 107, 98, 0.35); }
.mine-word .w { display: inline-block; margin-right: 0.45em; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.feed li {
  font-size: 0.8rem; color: var(--text-dim); padding: 7px 11px; border-radius: 10px; background: var(--ink-1);
  border: 1px solid var(--hair); display: flex; align-items: center; gap: 8px; animation: feed-in 0.35s var(--ease) both;
}
.feed li b { color: var(--text); font-weight: 650; }
.feed .badge { font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-left: auto; letter-spacing: 0.04em; }
.feed .badge.hit { color: var(--hit); background: rgba(134, 217, 174, 0.12); }
.feed .badge.miss { color: var(--miss); background: rgba(226, 113, 109, 0.12); }
.feed .badge.idle { color: var(--text-faint); background: var(--ink-3); }
@keyframes feed-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- game over ---------- */
.result { text-align: center; padding: 16px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.result-emblem { width: 92px; height: 92px; margin-bottom: 6px; animation: stamp 0.7s var(--spring) both; }
.result-emblem svg { width: 100%; height: 100%; }
.result-title {
  margin: 6px 0 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(2.4rem, 11vw, 3.2rem); letter-spacing: -0.03em; line-height: 1;
}
.result.win .result-title { background: linear-gradient(100deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result.lose .result-title { color: var(--text-dim); }
.result-reason { margin: 6px 0 10px; color: var(--text-dim); max-width: 32ch; }
.scoreline { display: flex; align-items: center; gap: 14px; padding: 9px 16px; border-radius: 999px; background: var(--ink-2); border: 1px solid var(--hair); }
.sl-name { font-size: 0.82rem; color: var(--text-dim); max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-score { font-family: var(--f-display); font-size: 1.5rem; font-weight: 800; display: flex; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
.sl-score i { font-style: normal; color: var(--text-faint); font-size: 1rem; }
#sl-me-score { color: var(--c-me, var(--p1)); }
#sl-rival-score { color: var(--c-rival, var(--p2)); }
.reveal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reveal { display: flex; flex-direction: column; gap: 8px; padding: 14px; min-width: 0; }
.reveal-word { font-family: var(--f-hand); font-size: 1.6rem; font-weight: 700; color: var(--gold-hi); letter-spacing: 0.05em; line-height: 1.1; word-break: break-word; }
.reveal-stat { font-size: 0.74rem; color: var(--text-faint); }
.over-actions { display: flex; flex-direction: column; gap: 8px; }
.rematch-note { margin: 0; text-align: center; font-size: 0.86rem; color: var(--gold-hi); }
#btn-rematch.waiting { background: var(--ink-3); color: var(--text-dim); box-shadow: none; border: 1px solid var(--hair-strong); }
#btn-rematch.invited { animation: glow 1.6s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(227, 194, 122, 0.18), 0 14px 32px -10px rgba(227, 194, 122, 0.6); } }

/* ---------- banners / toasts / dialogs ---------- */
.conn-banner {
  margin: 0 0 12px; padding: 9px 14px; border-radius: 12px; font-size: 0.84rem; font-weight: 550; text-align: center;
  background: rgba(227, 194, 122, 0.1); border: 1px solid rgba(227, 194, 122, 0.3); color: var(--gold-hi);
  animation: feed-in 0.3s var(--ease);
}
.conn-banner.error { background: rgba(226, 113, 109, 0.1); border-color: rgba(226, 113, 109, 0.35); color: #ffb3ae; }
.conn-banner.ok { background: rgba(134, 217, 174, 0.1); border-color: rgba(134, 217, 174, 0.35); color: var(--hit); }
.toasts {
  position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(92vw, 420px); pointer-events: none;
}
.toast {
  pointer-events: auto; padding: 10px 16px; border-radius: 14px; font-size: 0.88rem; font-weight: 550;
  background: rgba(27, 25, 21, 0.94); border: 1px solid var(--hair-strong); color: var(--text);
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: toast-in 0.4s var(--spring) both; max-width: 100%; text-align: center;
}
.toast.hit { border-color: rgba(134, 217, 174, 0.45); }
.toast.miss { border-color: rgba(226, 113, 109, 0.45); }
.toast.gold { border-color: rgba(227, 194, 122, 0.5); color: var(--gold-hi); }
.toast.out { animation: toast-out 0.3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) scale(0.97); } }

.sheet {
  border: 1px solid var(--hair-strong); border-radius: 22px; padding: 0; width: min(92vw, 440px);
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); color: var(--text);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.95);
}
.sheet[open] { animation: sheet-in 0.35s var(--spring); }
.sheet::backdrop { background: rgba(5, 5, 4, 0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
.sheet-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; margin: 0; }
.sheet h3 { margin: 0; font-family: var(--f-display); font-size: 1.45rem; letter-spacing: -0.01em; }
.sheet-sub { margin: 0; color: var(--text-dim); font-size: 0.88rem; }
.sheet-sub strong { color: var(--miss); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.rules { margin: 0; padding-left: 20px; display: grid; gap: 9px; color: var(--text-dim); font-size: 0.9rem; }
.rules b { color: var(--text); }
.rules li::marker { color: var(--gold); font-family: var(--f-display); font-weight: 700; }
kbd { font: 600 0.75rem var(--f-ui); padding: 1px 6px; border-radius: 6px; background: var(--ink-3); border: 1px solid var(--hair-strong); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { width: 44px; height: 26px; border-radius: 99px; background: var(--ink-4); position: relative; transition: background 0.25s; flex: none; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); transition: transform 0.3s var(--spring); }
.toggle input:checked + i { background: var(--gold); }
.toggle input:checked + i::after { transform: translateX(18px); background: #1a1408; }
.toggle input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 3px; }

.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ---------- responsive ---------- */
@media (max-width: 380px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .brand-word { font-size: 1rem; }
  .room-chip-label { display: none; }
  .key { height: 46px; font-size: 0.98rem; }
  .kb-row { gap: 4px; }
  .pcard { padding: 8px; gap: 7px; }
  .avatar { width: 28px; height: 28px; font-size: 0.82rem; }
  .pscore { font-size: 1.2rem; }
  .code-tile { width: 44px; height: 56px; font-size: 1.6rem; }
  .reveal-grid { grid-template-columns: 1fr; }
}
@media (min-width: 720px) {
  .app { padding-top: calc(22px + var(--safe-t)); }
  .hub-link { top: 18px; bottom: auto; left: 18px; }
  .card { padding: 22px; }
  .slots { --slot: 46px; }
  .key { height: 54px; }
}
@media (min-height: 900px) and (min-width: 720px) { .stage { justify-content: center; } }

body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Designed by Graaphix */
