/* Word Duel: look on top of ../arcade-common/pz.css */
body[data-tod="day"] {
  --accent: #d9480f; --accent2: #a8205f; --ttl1: #d9480f; --ttl2: #a8205f; --glow: rgba(217, 72, 15, .2);
  --tile1: #fff8e3; --tile2: #ffe3a6; --tile-edge: #d9a24a; --tile-ink: #5a2d00; --tile-pt: #9a5b12; --slot: #eadcc0; --gold1: #ffe680; --gold2: #ffb02e;
}
body[data-tod="night"] {
  --accent: #d9480f; --accent2: #a8205f; --ttl1: #ff9a5c; --ttl2: #ff6fa8; --glow: rgba(255, 122, 69, .22);
  --tile1: #5a3fb8; --tile2: #3a2a86; --tile-edge: #8e74f0; --tile-ink: #fff0c4; --tile-pt: #c9b8ff; --slot: #232d62; --gold1: #ffd84d; --gold2: #ff8a1f;
}
.brand span, .hero-card h2, .lobby-code { background: linear-gradient(90deg, var(--ttl1), var(--ttl2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* menu */
.points { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.points li { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.points b { font-size: 1.15rem; line-height: 1; color: var(--ttl1); }
.points span { font-size: .72rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.points .gold { background: linear-gradient(180deg, color-mix(in srgb, var(--gold1) 35%, var(--card2)), var(--card2)); border-color: var(--gold2); }
.best { font-weight: 700; margin: 12px 0 0; min-height: 1.4em; }
.best small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
#paneFriends .card { box-shadow: none; border: 0; padding: 0; background: transparent; }
.chips.opts { margin-top: 4px; }
#modeCard .field { margin-top: 8px; }
.menu-art { aspect-ratio: 64 / 30; }

/* HUD */
.hud { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.ring { position: relative; width: 56px; height: 56px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring .trk { stroke: var(--line); }
.ring .bar { stroke: var(--ttl1); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.ring.low .bar { stroke: #ff3b4e; }
.ring.low { animation: tick 1s ease-in-out infinite; }
@keyframes tick { 50% { transform: scale(1.1); } }
.hud-mid { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hud-mid .mode { font-weight: 800; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-mid .rnd { color: var(--muted); font-size: .82rem; font-weight: 600; }
.scorepill { font-size: 1rem; padding: 8px 14px; }
.scorepill span { color: var(--muted); font-weight: 600; font-size: .8rem; }
.scorepill b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.scorepill.bump b { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.35); color: var(--ttl1); } }
#quitBtn { flex: none; }
.board { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.board .pill { flex: 1 1 130px; justify-content: flex-start; min-width: 0; }
.board .pill .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.board .pill .pc { color: var(--muted); font-weight: 600; font-size: .75rem; white-space: nowrap; }
.board .pill.me { border-color: var(--seatc); }

/* play area */
.playgrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .playgrid { grid-template-columns: minmax(0, 1fr); } }
.playcol { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.status { font-size: .95rem; }
.status.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.wordrow { display: flex; gap: 6px; justify-content: center; min-height: 56px; position: relative; }
.slot { width: var(--ts); height: calc(var(--ts) * .86); max-height: 56px; border-radius: 12px; background: var(--slot); border: 2px dashed var(--line); display: grid; place-items: center; font-weight: 800; font-size: calc(var(--ts) * .5); color: var(--tile-ink); padding: 0; text-transform: uppercase; }
.slot.on { background: linear-gradient(180deg, var(--tile1), var(--tile2)); border: 2px solid var(--tile-edge); animation: pop .18s; }
.slot.on.bad { animation: shake .35s; border-color: #ff3b4e; }
.slot.on.good { animation: goodpop .4s; }
@keyframes pop { from { transform: scale(.7); } }
@keyframes goodpop { 40% { transform: translateY(-8px) scale(1.12); } }
body { --ts: clamp(44px, calc((100vw - 28px - 36px) / 7), 74px); }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tile { width: var(--ts); height: calc(var(--ts) * 1.08); border-radius: 14px; border: 2px solid var(--tile-edge); background: linear-gradient(180deg, var(--tile1), var(--tile2)); color: var(--tile-ink); font-weight: 800; font-size: calc(var(--ts) * .56); text-transform: uppercase; position: relative; padding: 0; box-shadow: 0 5px 0 var(--tile-edge), 0 10px 18px rgba(0, 0, 0, .25); transition: transform .1s, opacity .15s, box-shadow .1s; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.tile:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--tile-edge), 0 4px 10px rgba(0, 0, 0, .25); }
.tile.used { opacity: .28; transform: scale(.9); box-shadow: 0 2px 0 var(--tile-edge); }
.tile:disabled { cursor: default; }
.tile.hidden { color: transparent; }
.tile.hidden::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--tile-pt); font-size: 1em; }
.tile.flip { animation: flip .5s both; }
@keyframes flip { from { transform: scale(.55) rotate(-10deg); opacity: 0; } }
.tile.shuf { animation: shuf .35s; }
@keyframes shuf { 40% { transform: translateY(-14px) rotate(-6deg); } }
.actions { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 10px; }
.actions .btn { margin: 0; width: 100%; padding: 12px 8px; }
.combo { text-align: center; font-weight: 800; min-height: 1.6em; color: var(--ttl1); }
.combo.on { animation: goodpop .5s; text-shadow: 0 0 14px var(--glow); }
.keys { text-align: center; margin: 0; }
kbd { background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font: 600 .78rem var(--font); }
@media (pointer: coarse) { .keys { display: none; } }

/* found words */
.wordscol h3 { margin: 0 0 10px; font-size: 1rem; display: flex; justify-content: space-between; }
.wordscol h3 span { color: var(--muted); font-weight: 600; }
.found { display: flex; flex-wrap: wrap; gap: 6px; max-height: 46vh; overflow: auto; align-content: flex-start; }
@media (max-width: 760px) { .found { max-height: none; } }
.wchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-weight: 700; font-size: .92rem; text-transform: lowercase; }
.wchip.new { animation: pop .25s; }
.wchip i { font-style: normal; font-size: .72rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); border-radius: 999px; padding: 1px 7px; }
.wchip.gold { background: linear-gradient(180deg, var(--gold1), var(--gold2)); color: #4a1d00; border-color: transparent; }
.wchip.gold i { background: #4a1d00; color: #ffe680; }
.wchip.uniq { border-color: var(--go1); box-shadow: 0 0 0 2px color-mix(in srgb, var(--go1) 30%, transparent); }
.wchip.same { opacity: .6; }
.wchip.miss { border-style: dashed; }
.fly { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); font-weight: 800; font-size: 1.3rem; color: var(--go1); pointer-events: none; animation: fly .9s ease-out forwards; text-shadow: 0 2px 8px rgba(0, 0, 0, .4); z-index: 5; }
@keyframes fly { to { transform: translate(-50%, -48px); opacity: 0; } }

/* countdown overlay */
.cd { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(5, 8, 25, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); pointer-events: none; }
.cd b { font-size: clamp(5rem, 28vw, 11rem); line-height: 1; color: #fff; text-shadow: 0 0 40px var(--ttl1), 0 8px 30px rgba(0, 0, 0, .5); animation: cdpop .9s ease-out; }
.cd small { display: block; text-align: center; color: #fff; font-weight: 700; margin-top: 6px; }
@keyframes cdpop { from { transform: scale(2.2); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }

/* results */
.res { max-width: 860px; margin: 0 auto; }
.res h2 { text-align: center; font-size: clamp(1.4rem, 6vw, 2rem); margin: 4px 0 4px; }
.res .big { text-align: center; font-size: 3rem; line-height: 1; }
.res .sub { text-align: center; color: var(--muted); margin: 0 0 14px; font-weight: 600; }
.standings { display: grid; gap: 8px; margin: 10px 0 16px; }
.stand { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--card2); border: 2px solid var(--line); min-width: 0; }
.stand.win { border-color: var(--gold2); background: linear-gradient(180deg, color-mix(in srgb, var(--gold1) 22%, var(--card2)), var(--card2)); }
.stand .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stand .nm small { display: block; color: var(--muted); font-weight: 600; font-size: .74rem; }
.stand .tot { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stand .tot small { font-size: .7rem; color: var(--muted); font-weight: 600; display: block; text-align: right; }
.rounds-line { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.rounds-line em { font-style: normal; font-size: .72rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); font-weight: 700; }
.res h3 { margin: 18px 0 8px; font-size: .95rem; }
.res h3 small { color: var(--muted); font-weight: 600; margin-left: 6px; }
.wordlist { display: flex; flex-wrap: wrap; gap: 6px; }
.res .legend { color: var(--muted); font-size: .8rem; margin: 6px 0 0; }
.next-in { text-align: center; font-weight: 800; color: var(--ttl1); margin: 14px 0 0; }
.res .row { justify-content: center; margin-top: 18px; }

@media (max-width: 560px) { .back { min-width: 44px; justify-content: center; } }
@media (max-width: 380px) { .tabs button { font-size: .8rem; padding: 10px 2px; } .tabs { gap: 3px; } }
@media (max-width: 420px) {
  .hud { gap: 8px; } .scorepill { padding: 6px 10px; } #quitBtn { padding: 8px 10px; }
  .card { padding: 14px; } .actions { gap: 8px; }
}
@media (max-height: 520px) and (orientation: landscape) { .keys { display: none; } .playcol { gap: 8px; } }
