/* HEXLE — Evil Neuro palette: void black, blood/crimson red, rose pink, black heart; pumpkin for Halloween. */
:root {
  --void: #07040a;
  --ink-1: #0f0810;
  --ink-2: #170d18;
  --ink-3: #221422;
  --line: #3a2433;
  --line-2: #573447;
  --text: #f6edf2;
  --muted: #b39aa8;
  --faint: #7b6170;

  --blood: #8e0b24;
  --red: #c4122f;
  --crimson: #ff2e5b;
  --rose: #ff8fb0;
  --plum: #3b1235;
  --violet: #9b3dd6;
  --pumpkin: #ff7a1a;
  --amber: #ffb23f;

  --g-evil: linear-gradient(135deg, #ff4d73 0%, #d81f43 45%, #7a0a22 100%);
  --g-evil-soft: linear-gradient(135deg, rgba(255, 46, 91, .18), rgba(155, 61, 214, .12));
  --g-title: linear-gradient(180deg, #ffd1de 0%, #ff4d73 40%, #b00d2c 80%, #5c0717 100%);
  --g-correct: linear-gradient(145deg, #ff4f74 0%, #d81f43 50%, #8e0b24 100%);
  --g-present: linear-gradient(145deg, #ffc35c 0%, #ff8a1f 50%, #c94f07 100%);
  --g-absent: linear-gradient(145deg, #34242e 0%, #241820 100%);
  --c-correct: #d81f43;
  --c-present: #f07a14;
  --c-absent: #2b1d26;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .03);
  --glow: 0 0 24px rgba(255, 46, 91, .35);
  --font: 'Outfit', system-ui, sans-serif;
  --font-spooky: 'Creepster', 'Outfit', cursive;
  --tile: 60px;
  --header-h: 60px;
  color-scheme: dark;
}
:root.contrast {
  --g-correct: linear-gradient(145deg, #ffa24a 0%, #f5793a 60%, #c4520f 100%);
  --g-present: linear-gradient(145deg, #a6dcff 0%, #4fb0f0 60%, #1f78c2 100%);
  --c-correct: #f5793a;
  --c-present: #4fb0f0;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--void);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--rose); }
[hidden] { display: none !important; }
::selection { background: rgba(255, 46, 91, .4); }
:focus-visible { outline: 2px solid var(--crimson); outline-offset: 2px; }
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -.15em; flex: none; }

/* ---------- atmosphere ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(196, 18, 47, .28), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(91, 20, 82, .35), transparent 60%),
    radial-gradient(800px 500px at 50% 120%, rgba(255, 122, 26, .10), transparent 60%),
    linear-gradient(180deg, #0c050c 0%, #07040a 60%);
}
.sky .moon {
  position: absolute; top: 70px; right: 7vw; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #ffe9f0 0%, #ffb3c6 30%, #ff4d73 70%, #8e0b24 100%);
  box-shadow: 0 0 80px 20px rgba(255, 46, 91, .25), 0 0 200px 60px rgba(196, 18, 47, .15);
  opacity: .55; filter: saturate(1.1);
}
.sky .moon::after { content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 70% 60%, rgba(120, 10, 40, .35) 0 10%, transparent 11%),
              radial-gradient(circle at 30% 70%, rgba(120, 10, 40, .25) 0 7%, transparent 8%),
              radial-gradient(circle at 55% 25%, rgba(120, 10, 40, .2) 0 5%, transparent 6%); }
.sky .web { position: absolute; top: -18px; left: -18px; width: 210px; height: 210px; opacity: .14; }
.sky .web svg { width: 100%; height: 100%; }
.sky .spider { position: absolute; top: 0; right: 22%; width: 34px; transform-origin: top center; animation: dangle 7s ease-in-out infinite; }
.sky .spider::before { content: ''; position: absolute; left: 50%; bottom: 26px; width: 1px; height: 140px; background: linear-gradient(transparent, #cdbac4aa); }
.sky .spider svg { width: 34px; height: 34px; margin-top: 140px; filter: drop-shadow(0 0 6px rgba(255, 46, 91, .4)); }
@keyframes dangle { 0%, 100% { transform: translateY(-40px) rotate(2deg); } 50% { transform: translateY(0) rotate(-3deg); } }
.sky .fog { position: absolute; left: -20%; right: -20%; bottom: -60px; height: 260px; filter: blur(30px); opacity: .5;
  background: radial-gradient(40% 60% at 20% 70%, rgba(155, 61, 214, .25), transparent 70%),
              radial-gradient(40% 60% at 60% 80%, rgba(255, 46, 91, .18), transparent 70%),
              radial-gradient(40% 60% at 90% 70%, rgba(155, 61, 214, .2), transparent 70%);
  animation: fog 22s ease-in-out infinite alternate; }
@keyframes fog { to { transform: translateX(8%); } }
.bat-fly { position: absolute; width: 38px; height: 38px; top: 20%; left: -60px; opacity: .8; animation: batfly linear forwards; }
.bat-fly svg { width: 100%; height: 100%; animation: flap .22s ease-in-out infinite alternate; }
@keyframes batfly { to { transform: translate(calc(100vw + 120px), var(--dy, -60px)); } }
@keyframes flap { to { transform: scaleY(.55) scaleX(.9); } }
.ember { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--pumpkin); animation: ember linear forwards; opacity: 0; }
@keyframes ember { 10% { opacity: .9; } 100% { transform: translate(var(--dx, 30px), -60vh); opacity: 0; } }
:root.calm .sky .spider, :root.calm .sky .fog { animation: none; }
:root.calm .bat-fly, :root.calm .ember { display: none; }
@media (prefers-reduced-motion: reduce) {
  .sky .spider, .sky .fog { animation: none; }
  .bat-fly, .ember { display: none; }
}

/* ---------- shell ---------- */
.app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: var(--header-h); display: flex; align-items: center; gap: 8px; padding: 0 16px;
  border-bottom: 1px solid rgba(87, 52, 71, .5); background: rgba(10, 5, 11, .65); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .left, .topbar .right { flex: 1; display: flex; align-items: center; gap: 4px; }
.topbar .right { justify-content: flex-end; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand .logo-word { font-family: var(--font-spooky); font-size: 32px; letter-spacing: 3px; line-height: 1;
  background: var(--g-title); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #3a0410) drop-shadow(0 0 14px rgba(255, 46, 91, .35)); }
.brand .ico { font-size: 26px; }
.brand .mode-tag { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--rose);
  border: 1px solid var(--line-2); padding: 3px 8px; border-radius: 99px; margin-left: 2px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.me-chip:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .06); }
.me-chip .nm { font-weight: 600; font-size: 14px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { flex: 1; display: flex; flex-direction: column; }

/* ---------- buttons & inputs ---------- */
.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 700; letter-spacing: .02em; transition: transform .12s, filter .15s, background .15s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--g-evil); color: #fff; box-shadow: 0 8px 24px -8px rgba(255, 46, 91, .6), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.btn.pumpkin { background: var(--g-present); color: #2a0e00; box-shadow: 0 8px 24px -8px rgba(255, 122, 26, .6); }
.btn.small { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.btn svg { width: 18px; height: 18px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink-1); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--crimson); box-shadow: 0 0 0 3px rgba(255, 46, 91, .18); }
.input:disabled { opacity: .7; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ink-1); border: 1px solid var(--line); }
.seg button { height: 34px; min-width: 38px; padding: 0 10px; border-radius: 8px; font-weight: 600; color: var(--muted); font-size: 14px; }
.seg button:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .05); }
.seg button.on { background: var(--g-evil); color: #fff; box-shadow: 0 4px 14px -6px rgba(255, 46, 91, .7); }
.seg button:disabled { cursor: default; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #3a2a33; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.switch input:checked + i { background: var(--g-evil); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:disabled + i { opacity: .5; }
.row-set { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(87, 52, 71, .45); }
.row-set:last-child { border-bottom: 0; }
.row-set .t { font-weight: 600; }
.row-set .d { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- home ---------- */
.home { width: 100%; max-width: 1080px; margin: 0 auto; padding: 48px 16px 64px; display: grid; gap: 40px; }
.hero { text-align: center; display: grid; gap: 14px; justify-items: center; }
.hero .big { font-family: var(--font-spooky); font-size: clamp(72px, 15vw, 150px); line-height: .9; letter-spacing: 6px;
  background: var(--g-title); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #3a0410) drop-shadow(0 0 40px rgba(255, 46, 91, .4)); margin: 0; }
.hero .tiles { display: flex; gap: 6px; }
.hero .tiles .tile { --tile: 46px; animation: heroFlip 1s both; }
.hero p { margin: 0; color: var(--muted); font-size: 18px; max-width: 560px; }
@keyframes heroFlip { 0% { transform: rotateX(90deg); } 60% { transform: rotateX(-10deg); } 100% { transform: none; } }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .modes { grid-template-columns: 1fr; } }
.mode-card { color: inherit; text-decoration: none; position: relative; text-align: left; padding: 26px 24px 22px; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(34, 20, 34, .85), rgba(15, 8, 16, .9)); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s; display: grid; gap: 10px; align-content: start; min-height: 230px; }
.mode-card::before { content: ''; position: absolute; inset: 0; background: var(--accent, var(--g-evil-soft)); opacity: .55; pointer-events: none; transition: opacity .2s; }
.mode-card:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: var(--shadow), var(--glow); }
.mode-card:hover::before { opacity: .9; }
.mode-card > * { position: relative; }
.mode-card .art { position: absolute; right: -14px; top: -10px; width: 120px; height: 120px; opacity: .9; transform: rotate(10deg); filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .5)); transition: transform .3s; }
.mode-card:hover .art { transform: rotate(0) scale(1.06); }
.mode-card .art svg { width: 100%; height: 100%; }
.mode-card .kicker { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--rose); }
.mode-card h3 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.mode-card p { margin: 0; color: var(--muted); line-height: 1.5; max-width: 30ch; }
.mode-card .meta { margin-top: auto; padding-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); color: var(--muted); }
.pill.hot { color: #fff; border-color: rgba(255, 46, 91, .5); background: rgba(255, 46, 91, .18); }
.pill .ico { font-size: 14px; }
.foot { text-align: center; color: var(--faint); font-size: 13px; }

/* ---------- game board ---------- */
.play { flex: 1; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 8px 8px; gap: 10px; min-height: 0; }
.play.solo { height: calc(100dvh - var(--header-h)); }
.play .toolbar { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; }
.board-wrap { flex: 1; display: grid; place-items: center; width: 100%; min-height: 0; }
.board { display: grid; gap: 6px; }
.board .row { display: grid; gap: 6px; grid-auto-flow: column; justify-content: center; }
.tile {
  width: var(--tile); height: var(--tile); display: grid; place-items: center; border-radius: 10px;
  border: 2px solid var(--line); background: rgba(15, 8, 16, .7);
  font-weight: 800; font-size: calc(var(--tile) * .52); text-transform: uppercase; line-height: 1; user-select: none;
  transition: border-color .1s; position: relative;
}
.tile.filled { border-color: #7d566b; animation: pop .1s ease-in; }
.tile.revealed { border-color: transparent; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.tile.c { background: var(--g-correct); box-shadow: 0 0 18px -4px rgba(255, 46, 91, .6), inset 0 1px 0 rgba(255, 255, 255, .25); }
.tile.p { background: var(--g-present); box-shadow: 0 0 18px -6px rgba(255, 122, 26, .6), inset 0 1px 0 rgba(255, 255, 255, .3); }
.tile.a { background: var(--g-absent); color: #c9b5c0; }
:root.contrast .tile.p { box-shadow: 0 0 18px -6px rgba(79, 176, 240, .6), inset 0 1px 0 rgba(255, 255, 255, .3); }
.tile.flip { animation: flipIn .25s ease-in forwards; }
.tile.flip2 { animation: flipOut .25s ease-out forwards; }
.tile.bounce { animation: bounce .9s ease both; }
.tile.hint { color: rgba(255, 255, 255, .2); }
.row.shake { animation: shake .6s; }
.row.pending .tile { animation: pending 1s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.85); } 50% { transform: scale(1.1); } to { transform: scale(1); } }
@keyframes flipIn { from { transform: rotateX(0); } to { transform: rotateX(-90deg); } }
@keyframes flipOut { from { transform: rotateX(-90deg); } to { transform: rotateX(0); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }
@keyframes bounce { 0%, 20% { transform: translateY(0); } 40% { transform: translateY(-30px); } 50% { transform: translateY(5px); } 60% { transform: translateY(-15px); } 80% { transform: translateY(2px); } 100% { transform: translateY(0); } }
@keyframes pending { 50% { border-color: var(--crimson); } }

.keyboard { width: 100%; max-width: 520px; display: grid; gap: 8px; user-select: none; padding-bottom: 8px; }
.keyboard .krow { display: flex; gap: 6px; justify-content: center; }
.key { flex: 1; height: 56px; border-radius: 8px; background: #3d2b37; font-weight: 700; font-size: 15px; text-transform: uppercase; display: grid; place-items: center; transition: background .2s, transform .05s; max-width: 46px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3); }
.key:active { transform: translateY(1px); }
.key.wide { flex: 1.5; max-width: 72px; font-size: 12px; }
.key.wide svg { width: 22px; height: 22px; }
.key.spacer { flex: .5; visibility: hidden; max-width: 22px; }
.key.c { background: var(--g-correct); }
.key.p { background: var(--g-present); }
.key.a { background: #1e141b; color: #7b6170; box-shadow: none; }

/* ---------- toast ---------- */
.toasts { position: fixed; top: calc(var(--header-h) + 18px); left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: #f6edf2; color: #160810; padding: 12px 16px; border-radius: 10px; font-weight: 700; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: tIn .15s ease-out; transition: opacity .3s; }
.toast.dark { background: var(--g-evil); color: #fff; }
@keyframes tIn { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(5, 2, 6, .72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fadeIn .15s; }
.modal { position: relative; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto; border-radius: var(--r-lg); background: linear-gradient(180deg, #1b0f1b 0%, #100811 100%); border: 1px solid var(--line-2); box-shadow: 0 40px 80px -20px #000, var(--glow); padding: 28px 24px 24px; animation: mIn .2s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { max-width: 760px; }
.modal h2 { margin: 0 0 18px; font-size: 22px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; text-align: center; }
.modal h3 { margin: 22px 0 10px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--rose); }
.modal .x { position: absolute; top: 14px; right: 14px; }
.modal p { color: #e3d4dc; line-height: 1.55; margin: 0 0 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes mIn { from { opacity: 0; transform: translateY(20px) scale(.97); } }
.example { display: flex; gap: 4px; margin: 10px 0 4px; }
.example .tile { --tile: 38px; }

/* stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats-grid b { display: block; font-size: 34px; font-weight: 800; line-height: 1.1; }
.stats-grid span { font-size: 12px; color: var(--muted); }
.dist { display: grid; gap: 4px; }
.dist .d { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.dist .bar { min-width: 26px; padding: 2px 8px; text-align: right; background: #3d2b37; border-radius: 4px; transition: width .6s cubic-bezier(.2, .9, .3, 1); }
.dist .bar.now { background: var(--g-correct); }
.after { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.after .next { flex: 1; text-align: center; border-right: 1px solid var(--line); }
.after .next span { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.after .next b { display: block; font-size: 30px; font-variant-numeric: tabular-nums; }
.after .acts { flex: 1; display: grid; gap: 8px; }
.reveal-word { text-align: center; margin: 0 0 16px; }
.reveal-word .lbl { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .14em; }
.reveal-word .w { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.reveal-word .tile { --tile: 42px; }

/* profile */
.prof-head { display: flex; gap: 18px; align-items: center; margin-bottom: 8px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.icon-grid button { aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--line); background: var(--ink-1); display: grid; place-items: center; transition: border-color .15s, transform .15s; }
.icon-grid button:hover { transform: translateY(-2px); border-color: var(--line-2); }
.icon-grid button.on { border-color: var(--crimson); box-shadow: var(--glow); }
.icon-grid svg { width: 34px; height: 34px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .3); }
.swatches button.on { border-color: #fff; transform: scale(1.1); }
.swatches label { position: relative; width: 32px; height: 32px; border-radius: 50%; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); cursor: pointer; }
.swatches input[type=color] { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* avatars */
.av { --s: 36px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; position: relative;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--pc, #ff2e5b) 85%, #fff 15%), color-mix(in srgb, var(--pc, #ff2e5b) 70%, #000 30%) 70%, color-mix(in srgb, var(--pc, #ff2e5b) 40%, #000 60%));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc, #ff2e5b) 55%, transparent), 0 4px 12px rgba(0, 0, 0, .4); }
.av svg { width: 72%; height: 72%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.off { filter: grayscale(.8) brightness(.6); }
.av .crown { position: absolute; top: -2px; right: -2px; }

/* ---------- multiplayer dashboard ---------- */
.dash { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 16px; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; flex: 1; min-height: 0; }
@media (max-width: 980px) { .dash { grid-template-columns: 1fr; } }
.panel { border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(27, 15, 27, .88), rgba(14, 7, 15, .92)); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-h h2 { margin: 0; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; flex: 1; display: flex; align-items: center; gap: 8px; }
.panel-h h2 .ico { font-size: 20px; }
.panel-b { padding: 18px; }
.dash-top { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; padding: 22px; margin-bottom: 20px; position: relative; overflow: hidden; }
.dash-top::after { content: ''; position: absolute; right: -40px; top: -60px; width: 260px; height: 260px; background: radial-gradient(circle, rgba(255, 46, 91, .25), transparent 60%); pointer-events: none; }
.dash-top h1 { margin: 0 0 6px; font-size: 30px; font-weight: 800; }
.dash-top p { margin: 0; color: var(--muted); }
.join-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.join-row .input { width: 160px; text-transform: uppercase; letter-spacing: .3em; font-weight: 800; text-align: center; height: 44px; }
@media (max-width: 640px) { .dash-top { grid-template-columns: 1fr; } }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.room-card { text-align: left; padding: 16px; border-radius: var(--r-md); background: var(--ink-1); border: 1px solid var(--line); display: grid; gap: 10px; transition: border-color .15s, transform .15s; }
.room-card:hover { border-color: var(--crimson); transform: translateY(-2px); }
.room-card .top { display: flex; align-items: center; gap: 10px; }
.room-card .nm { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-card .by { font-size: 12px; color: var(--muted); }
.room-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.status { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; padding: 3px 8px; border-radius: 6px; }
.status.lobby { background: rgba(79, 209, 62, .15); color: #8af07c; }
.status.playing, .status.intermission { background: rgba(255, 122, 26, .18); color: var(--amber); }
.status.podium { background: rgba(155, 61, 214, .2); color: #d4a6ff; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty .ico { font-size: 56px; opacity: .8; }

/* ---------- room ---------- */
.room { width: 100%; max-width: 1440px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 280px minmax(0, 1fr) 360px; gap: 16px; flex: 1; min-height: 0; height: calc(100dvh - var(--header-h)); }
.room > .panel { display: flex; flex-direction: column; min-height: 0; }
.room .center { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
.mtabs { display: none; }
@media (max-width: 1100px) { .room { grid-template-columns: 240px minmax(0, 1fr); } .room .chat-col { grid-column: 1 / -1; height: 420px; } .room { height: auto; } }
@media (max-width: 760px) {
  .room { grid-template-columns: 1fr; padding: 8px; gap: 8px; height: calc(100dvh - var(--header-h)); grid-template-rows: auto minmax(0, 1fr); }
  .room .chat-col { height: auto; grid-column: auto; }
  .mtabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ink-1); border: 1px solid var(--line); }
  .mtabs button { flex: 1; height: 36px; border-radius: 9px; font-weight: 700; color: var(--muted); position: relative; }
  .mtabs button.on { background: var(--g-evil); color: #fff; }
  .mtabs .badge { position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--amber); color: #2a0e00; font-size: 11px; display: grid; place-items: center; padding: 0 4px; }
  .room[data-tab=game] .players-col, .room[data-tab=game] .chat-col { display: none; }
  .room[data-tab=players] .center, .room[data-tab=players] .chat-col { display: none; }
  .room[data-tab=chat] .center, .room[data-tab=chat] .players-col { display: none; }
}
.plist { overflow: auto; padding: 8px; display: grid; gap: 4px; align-content: start; }
.pl { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; position: relative; }
.pl:hover { background: rgba(255, 255, 255, .03); }
.pl.me { background: rgba(255, 46, 91, .07); }
.pl .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.pl .sub { font-size: 12px; color: var(--muted); }
.pl .pts { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.pl .pts small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.pl .mini { grid-column: 2 / 4; display: grid; gap: 2px; justify-content: start; }
.pl .mini .mr { display: flex; gap: 2px; }
.pl .mini i { width: 12px; height: 12px; border-radius: 3px; background: #2b1d26; }
.pl .mini i.c { background: var(--c-correct); }
.pl .mini i.p { background: var(--c-present); }
.pl .mini i.a { background: #46323e; }
.pl .acts { display: none; gap: 2px; }
.pl:hover .acts { display: flex; }
.pl .acts button { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.pl .acts button:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.pl .acts svg { width: 16px; height: 16px; }
.tag-host { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); }
.done-badge { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: rgba(255, 46, 91, .2); color: var(--rose); }
.done-badge.fail { background: rgba(255, 255, 255, .06); color: var(--muted); }

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 18px; gap: 14px; min-height: 0; }
.stage-head { width: 100%; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stage-head h2 { margin: 0; font-size: 22px; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite { display: flex; gap: 8px; align-items: center; width: 100%; padding: 12px; border-radius: var(--r-md); background: var(--ink-1); border: 1px dashed var(--line-2); flex-wrap: wrap; }
.invite code { flex: 1; min-width: 0; font-size: 14px; color: var(--rose); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-big { font-family: var(--font); font-weight: 800; letter-spacing: .3em; font-size: 18px; color: var(--text); }
.settings-grid { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px 18px; }
.settings-grid .full { grid-column: 1 / -1; }
.timer-input { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.timer-input .input { width: 100px; }
.hud { width: 100%; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.hud .round { font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: 13px; color: var(--muted); }
.hud .round b { color: var(--text); font-size: 18px; }
.clock { display: flex; align-items: center; gap: 8px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 22px; }
.clock.low { color: var(--crimson); animation: pulse 1s infinite; }
.clock svg { width: 20px; height: 20px; }
@keyframes pulse { 50% { opacity: .5; } }
.timebar { width: 100%; height: 4px; border-radius: 4px; background: var(--ink-3); overflow: hidden; }
.timebar i { display: block; height: 100%; background: var(--g-evil); transition: width 1s linear; }
.waiting { color: var(--muted); font-weight: 600; text-align: center; }
.result-list { width: 100%; max-width: 560px; display: grid; gap: 6px; }
.res { display: grid; grid-template-columns: 30px auto 1fr auto auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--ink-1); border: 1px solid var(--line); }
.res.win { border-color: rgba(255, 46, 91, .6); background: linear-gradient(90deg, rgba(255, 46, 91, .18), var(--ink-1)); }
.res .place { font-weight: 800; color: var(--muted); text-align: center; }
.res .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .g { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.res .plus { font-weight: 800; color: var(--amber); }
.big-word { display: flex; gap: 6px; justify-content: center; }
.big-word .tile { --tile: 54px; }
.next-in { color: var(--muted); font-weight: 600; }

/* podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; padding-top: 40px; width: 100%; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(160px, 30%); animation: rise .8s cubic-bezier(.2, .9, .3, 1.1) both; }
.pod:nth-child(1) { animation-delay: .5s; }
.pod:nth-child(2) { animation-delay: .9s; }
.pod:nth-child(3) { animation-delay: .2s; }
.pod .nm { font-weight: 800; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .score { font-size: 13px; color: var(--muted); font-weight: 600; }
.pod .block { width: 100%; border-radius: 14px 14px 4px 4px; display: grid; place-items: start center; padding-top: 12px; font-family: var(--font-spooky); font-size: 44px; color: rgba(255, 255, 255, .9); text-shadow: 0 2px 0 rgba(0, 0, 0, .4); position: relative; overflow: hidden; }
.pod .block::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 40%); }
.pod.p1 .block { height: 170px; background: var(--g-correct); box-shadow: 0 0 40px rgba(255, 46, 91, .45); }
.pod.p2 .block { height: 120px; background: linear-gradient(145deg, #a37ac2, #5b2c7c); }
.pod.p3 .block { height: 86px; background: var(--g-present); }
.pod.p1 .av { --s: 84px; }
.pod .av { --s: 64px; }
.pod .crown-ico { font-size: 34px; margin-bottom: -10px; animation: float 2.4s ease-in-out infinite; }
@keyframes rise { from { transform: translateY(60px); opacity: 0; } }
@keyframes float { 50% { transform: translateY(-6px); } }
.final-table { width: 100%; max-width: 620px; }
.final-table .res { grid-template-columns: 30px auto 1fr auto; }
.rounds-sum { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 620px; }
.rounds-sum span { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--ink-1); border: 1px solid var(--line); letter-spacing: .1em; text-transform: uppercase; }
.end-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.confetti { position: fixed; top: -20px; z-index: 50; pointer-events: none; width: 24px; height: 24px; animation: fall linear forwards; }
.confetti svg { width: 100%; height: 100%; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; position: relative; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 8px 8px; display: flex; flex-direction: column; gap: 2px; min-height: 0; overscroll-behavior: contain; }
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding: 4px 8px; border-radius: 10px; position: relative; }
.msg:hover { background: rgba(255, 255, 255, .03); }
.msg.cont { padding-top: 0; }
.msg.cont .av { visibility: hidden; height: 0; }
.msg.cont .mh { display: none; }
.msg.mention { background: rgba(255, 178, 63, .08); box-shadow: inset 2px 0 0 var(--amber); }
.msg.flash { animation: flash 1.2s; }
@keyframes flash { 30% { background: rgba(255, 46, 91, .25); } }
.msg .mh { display: flex; align-items: baseline; gap: 8px; }
.msg .who { font-weight: 700; font-size: 14px; }
.msg .when { font-size: 11px; color: var(--faint); }
.msg .tx { font-size: 14.5px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; color: #ecdfe6; }
.msg .tx .ico { width: 1.5em; height: 1.5em; vertical-align: -.4em; }
.msg .tx.jumbo .ico { width: 2.6em; height: 2.6em; }
.msg .tx .at { color: var(--amber); font-weight: 700; background: rgba(255, 178, 63, .12); border-radius: 4px; padding: 0 3px; }
.msg .tx.deleted { font-style: italic; color: var(--faint); }
.msg .quote { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 2px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg .quote::before { content: ''; width: 18px; height: 8px; border: 2px solid var(--line-2); border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; flex: none; margin-top: 6px; }
.msg .quote b { color: var(--text); font-weight: 700; }
.msg .quote .ico { width: 1.2em; height: 1.2em; }
.msg .tools { position: absolute; top: -14px; right: 8px; display: none; gap: 2px; padding: 2px; border-radius: 10px; background: var(--ink-3); border: 1px solid var(--line-2); box-shadow: 0 6px 16px rgba(0, 0, 0, .5); z-index: 2; }
.msg:hover .tools, .msg.tools-open .tools { display: flex; }
.msg .tools button { width: 30px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 16px; }
.msg .tools button:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.msg .tools svg { width: 17px; height: 17px; }
.msg.sys { grid-template-columns: 1fr; text-align: center; padding: 6px 8px; }
.msg.sys .tx { font-size: 12.5px; color: var(--muted); font-style: italic; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { height: 26px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 99px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--muted); }
.react:hover { border-color: var(--line-2); }
.react.mine { background: rgba(255, 46, 91, .16); border-color: rgba(255, 46, 91, .6); color: var(--text); }
.react .ico { width: 18px; height: 18px; }
.react small { font-size: 12px; }
.typing { height: 20px; padding: 0 16px; font-size: 12px; color: var(--muted); font-style: italic; }
.typing .dots i { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); margin: 0 1px; animation: dot 1s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-3px); opacity: .4; } }
.composer { padding: 8px 10px 10px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.replying { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 6px 10px; border-radius: 8px; background: var(--ink-1); }
.replying b { color: var(--text); }
.replying span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-row { display: flex; align-items: flex-end; gap: 6px; padding: 4px; border-radius: 14px; background: var(--ink-1); border: 1px solid var(--line); }
.compose-row:focus-within { border-color: var(--crimson); }
.compose-row textarea { flex: 1; resize: none; border: 0; outline: 0; background: transparent; padding: 8px 6px; max-height: 120px; min-height: 36px; line-height: 1.4; font-size: 14.5px; }
.compose-row .icon-btn { width: 36px; height: 36px; }
.jump { position: absolute; bottom: 110px; left: 50%; transform: translateX(-50%); z-index: 3; }
.mention-pop { position: absolute; bottom: 100%; left: 10px; right: 10px; background: var(--ink-3); border: 1px solid var(--line-2); border-radius: 12px; padding: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); z-index: 5; }
.mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; font-weight: 600; }
.mention-pop button.on, .mention-pop button:hover { background: rgba(255, 46, 91, .18); }
.mention-pop .av { --s: 24px; }

/* emoji picker */
.picker { position: fixed; z-index: 80; width: 330px; max-width: calc(100vw - 16px); height: 340px; display: flex; flex-direction: column; background: #1c101c; border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .7); animation: mIn .12s; overflow: hidden; }
.picker .ptabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); }
.picker .ptabs button { flex: 1; height: 32px; border-radius: 8px; font-size: 18px; display: grid; place-items: center; opacity: .6; }
.picker .ptabs button.on { background: rgba(255, 46, 91, .18); opacity: 1; }
.picker .ptabs .ico { width: 22px; height: 22px; }
.picker .pgrid { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; align-content: start; }
.picker .pgrid button { aspect-ratio: 1; border-radius: 8px; font-size: 22px; display: grid; place-items: center; }
.picker .pgrid button:hover { background: rgba(255, 255, 255, .08); transform: scale(1.12); }
.picker .pgrid .ico { width: 28px; height: 28px; }
.picker .plabel { padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); height: 30px; }

/* word lists */
.wl-mode { display: grid; gap: 8px; }
.wl-mode label { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.wl-mode label:has(input:checked) { border-color: var(--crimson); background: rgba(255, 46, 91, .08); }
.wl-mode input { accent-color: var(--crimson); margin-top: 3px; }
.wl-mode b { display: block; }
.wl-mode small { color: var(--muted); }
.wl-stats { font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.wl-stats b { color: var(--text); }
.wl-saved { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--ink-1); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.chip button { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.chip button:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.chip .load { width: auto; padding: 0; border-radius: 0; color: inherit; }

@media (max-width: 520px) {
  .topbar { padding: 0 8px; }
  .brand .logo-word { font-size: 26px; }
  .brand .mode-tag { display: none; }
  .me-chip .nm { display: none; }
  .me-chip { padding: 3px; }
  .key { height: 52px; font-size: 13px; }
  .keyboard .krow { gap: 5px; }
  .modal { padding: 24px 16px 18px; }
  .stats-grid b { font-size: 28px; }
}
