 
:root {
  --bg-top: #2D1B5A;
  --bg-bottom: #120A26;
  --accent: #FFC83D;
  --accent-ink: #2C1A6B;
  --pink: #FF5C8A;
  --red: #FF5C5C;
  --ink: rgba(255, 255, 255, 0.72);
  --tile: #FFF3DA;
  --tile-lip: #D8B88C;
  --tile-ink: #3A2466;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-bottom);
  color: #fff;
  font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.screen { position: fixed; inset: 0; background: radial-gradient(120% 80% at 50% 0%, var(--bg-top), var(--bg-bottom)); }
.hidden { display: none !important; }

button { font: inherit; cursor: pointer; }
button.primary {
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 20px; border: 0; border-radius: 999px; padding: 14px 22px;
  box-shadow: 0 4px 0 #B8861A;
}
button.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #B8861A; }
button.outline {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.5); border-radius: 999px; padding: 6px 18px; font-size: 13px;
}
button.outline.on { background: rgba(255,200,61,0.2); border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.45; cursor: default; }

 
.c-page, .c-overlay {
  --c-accent: var(--accent); --c-on-accent: var(--accent-ink); --c-panel: #23173f;
  --c-page-bg: radial-gradient(120% 80% at 50% 0%, var(--bg-top), var(--bg-bottom));
}
 
.c-page .c-pbtn.primary, .c-overlay .c-pbtn.primary { box-shadow: 0 4px 0 #B8861A; }
.c-page .c-pbtn.primary:active, .c-overlay .c-pbtn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #B8861A; }
.c-page .c-net.on::before { color: #8CE85C; }
.c-page .c-best { color: var(--accent); }

 
.c-home .c-title { letter-spacing: 0; }
.logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 4px; }
.logoRow { display: flex; gap: 7px; }
.logoRow span {
  width: 64px; height: 66px; border-radius: 13px; background: var(--tile); color: var(--tile-ink); font-weight: 900; font-size: 40px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 0 var(--tile-lip);
  animation: bob 2.6s ease-in-out infinite;
}
.logoRow span:nth-child(2) { animation-delay: .15s; }
.logoRow span:nth-child(3) { animation-delay: .3s; }
.logoRow span:nth-child(4) { animation-delay: .45s; }
.logoRow.pop span { background: var(--pink); color: #fff; box-shadow: 0 6px 0 #A8355A; animation-name: bobPop; }
.logoRow.pop span:nth-child(1) { animation-delay: .6s; }
.logoRow.pop span:nth-child(2) { animation-delay: .75s; }
.logoRow.pop span:nth-child(3) { animation-delay: .9s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bobPop { 0%, 70%, 100% { transform: translateY(0) scale(1); } 80% { transform: translateY(-10px) scale(1.12); } 90% { transform: translateY(0) scale(.95); } }
 
.scr-compact .logoRow span { width: 54px; height: 56px; font-size: 34px; }

 
#field { position: absolute; inset: 0; display: block; touch-action: none; }
 
.panel { position: absolute; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
 
#game[data-phase="lobby"] .panel, #game[data-phase="results"] .panel { display: none; }

#panelA { justify-content: space-between; }
#hudTop { display: flex; align-items: center; gap: 8px; }
#clock { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
#clockText { font-size: 28px; font-weight: 900; letter-spacing: 1px; font-variant-numeric: tabular-nums; line-height: 1; }
.clockBar { width: 100%; max-width: 180px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.14); overflow: hidden; }
#clockFill { height: 100%; width: 100%; border-radius: 3px; background: var(--accent); transition: width .25s linear; }
#clock.urgent #clockText { color: var(--red); animation: throb .5s ease-in-out infinite; }
#clock.urgent #clockFill { background: var(--red); }
#clock.flash #clockText { color: var(--accent); transform: scale(1.25); transition: transform .1s; }
#clockBonus {
  position: absolute; left: calc(50% + 46px); top: -2px; font-weight: 900; color: var(--accent); font-size: 18px; opacity: 0; pointer-events: none;
}
#clockBonus.show { animation: bonus 0.9s ease-out; }
#clockBonus.max { color: var(--ink); font-size: 12px; font-weight: 700; }
@keyframes throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes bonus { 0% { opacity: 0; transform: translateY(12px) scale(.6); } 25% { opacity: 1; transform: translateY(0) scale(1.2); } 100% { opacity: 0; transform: translateY(-14px) scale(1); } }

 
#wordLine { height: 46px; display: flex; align-items: center; justify-content: center; gap: 4px; }
#wordLine .wl { display: flex; gap: 3px; align-items: center; }
#wordLine .wl span {
  min-width: 30px; height: 36px; padding: 0 5px; border-radius: 8px; font-weight: 900; font-size: 22px;
  display: flex; align-items: center; justify-content: center; color: #fff; animation: letterIn .12s ease-out;
}
#wordLine .pts { margin-left: 8px; font-weight: 900; font-size: 20px; color: var(--accent); animation: letterIn .15s ease-out; }
 
#wordLine .note { font-weight: 800; font-size: 17px; color: #E8E0FF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; animation: msgIn .15s ease-out; }
#wordLine .note.good { color: var(--accent); font-size: 20px; font-weight: 900; }
#wordLine .note.bad { color: #FF8A8A; }
@keyframes letterIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes msgIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

 
#players { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pchip {
  display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.35); border-radius: 999px; padding: 5px 11px 5px 6px;
  font-size: 13px; border: 2px solid transparent; transition: transform .2s;
}
.pchip .dot { width: 18px; height: 18px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; color: rgba(0,0,0,0.6); }
.pchip .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.pchip .sc { font-weight: 900; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 20px; text-align: right; }
.pchip.me { border-color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.1); }
.pchip.bump { animation: bump .35s ease-out; }
.pchip .vote { font-size: 12px; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

 
#bench { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; font-size: 12px; color: var(--ink); }
#bench:empty { display: none; }
 
#vote.on { border-color: var(--accent); color: var(--accent); }

 
#game.wide #players { flex-direction: column; flex-wrap: nowrap; align-items: stretch; overflow-y: auto; min-height: 0; }
#game.wide .pchip .nm { flex: 1; max-width: none; }
#game.wide #panelB { justify-content: flex-start; }
 
#game:not(.wide) #clock { flex: none; width: 132px; align-items: flex-start; }

 
#stage { position: absolute; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#stageBody { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; width: 100%; padding: 12px; max-height: 100%; overflow-y: auto; overflow-x: hidden; box-sizing: border-box; }
 
#game[data-phase="results"] #stageBody { background: var(--c-panel); border-radius: 16px; max-width: 420px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.stTitle { font-size: 26px; font-weight: 900; letter-spacing: 3px; color: var(--accent); margin: 0; }
.stSub { color: var(--ink); font-size: 14px; margin: 0; }
.stCount { font-size: 120px; font-weight: 900; color: #fff; line-height: 1; text-shadow: 0 6px 0 rgba(0,0,0,0.35); animation: countIn .9s ease-out; }
.stCount.go { color: var(--accent); }
@keyframes countIn { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.85); opacity: 0; } }
.stButtons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.stButtons button.outline { font-size: 15px; padding: 9px 14px; min-height: 44px; }
.stButtons button.primary { font-size: 17px; padding: 10px 20px; min-height: 44px; }
.stNext { font-size: 16px; font-weight: 800; color: #fff; }
.stNext b { color: var(--accent); font-size: 22px; font-variant-numeric: tabular-nums; }

.podium { display: flex; flex-direction: column; gap: 5px; width: 100%; max-width: 340px; }
 
.prow { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; box-sizing: border-box; background: rgba(0,0,0,0.45); border-radius: 10px; padding: 6px 12px; animation: msgIn .35s ease-out both; }
[data-tap] { cursor: pointer; }
 
.scr-sideways .podium { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 660px; }
.scr-sideways .seats { max-width: 640px; }
.prow .dot { animation: fidget 1.1s ease-in-out infinite; }
.prow:nth-child(2n) .dot { animation-delay: -.4s; }
.prow:nth-child(3n) .dot { animation-delay: -.7s; }
.prow.me { background: rgba(255,255,255,0.14); }
.prow.new { animation: seatIn .5s cubic-bezier(.3,1.6,.5,1) both; }
.prow.stomp { animation: stomp .4s ease-out; }
.prow .bubble { left: 62%; }
.prow .rk { width: 26px; font-weight: 900; color: var(--ink); }
.prow.first .rk { color: var(--accent); }
.prow .dot { width: 14px; height: 14px; border-radius: 5px; flex: none; }
.prow .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .bw { color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.prow .sc { font-weight: 900; color: var(--accent); font-size: 18px; min-width: 34px; text-align: right; }

 
.seats { display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center; padding-top: 16px; max-width: 360px; }
.seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 72px; min-height: 44px; }
.seat .body {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px;
  color: rgba(0,0,0,0.55); box-shadow: 0 4px 0 rgba(0,0,0,0.3); animation: fidget 1.1s ease-in-out infinite;
}
.seat.me .body { outline: 3px solid #fff; outline-offset: 2px; }
.seat .nm { font-size: 12px; color: var(--ink); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.new .body { animation: seatIn .5s cubic-bezier(.3,1.6,.5,1) both, fidget 1.1s ease-in-out .5s infinite; }
.seat.stomp .body { animation: stomp .4s ease-out; }
.bubble {
  position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%); background: #fff; color: var(--accent-ink);
  border-radius: 10px; padding: 3px 8px; font-size: 12px; font-weight: 800; white-space: nowrap; animation: bubble 1.6s ease-out both;
}
.bubble::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fff; }
.seat.empty .body { background: rgba(255,255,255,0.06) !important; box-shadow: none; animation: none; border: 2px dashed rgba(255,255,255,0.18); }
@keyframes fidget { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-3px) rotate(-4deg); } 75% { transform: translateY(-1px) rotate(4deg); } }
@keyframes seatIn { 0% { transform: translateY(-60px) scale(.4); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes stomp { 0% { transform: scale(1); } 30% { transform: translateY(-18px) scale(1.1); } 60% { transform: translateY(2px) scaleY(.78) scaleX(1.18); } 100% { transform: none; } }
@keyframes bubble { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }
 
.benchSeat { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,0.3); border-radius: 999px; padding: 3px 9px 3px 4px; animation: fidget 1.1s ease-in-out infinite; }
.benchSeat .dot { width: 14px; height: 14px; border-radius: 5px; }

 
.scr-compact.scr-sideways #clockText { font-size: 22px; }
.scr-compact.scr-sideways #wordLine { height: 38px; }
.scr-compact.scr-sideways #wordLine .wl span { min-width: 24px; height: 30px; font-size: 18px; }
.scr-compact.scr-sideways .stCount { font-size: 90px; }
.scr-compact.scr-sideways .stTitle { font-size: 24px; }

 
.roomInfo { margin: 0; text-align: center; color: var(--ink); font-size: 12px; }
.roomInfo:empty { display: none; }
.stCode { font-size: 13px; color: var(--ink); margin: 0; }
.stCode b { color: #fff; letter-spacing: 2px; }

 
#wordLine .wl span.wild { background: linear-gradient(135deg, #FF5C8A, #FFB13D, #FFE04A, #8CE85C, #4DD4FF, #B98CFF); color: #fff; text-shadow: 0 1px 2px rgba(60,20,90,0.6); }
#wordLine .as { margin-left: 8px; font-weight: 900; font-size: 18px; color: #FFE04A; letter-spacing: 1px; animation: letterIn .15s ease-out; }

 
.lvl { border: 0; border-radius: 999px; padding: 1px 7px; font-size: 12px; font-weight: 800; line-height: 1.5; }
.lvl-easy { background: rgba(140,232,92,0.22); color: #8CE85C; }
.lvl-normal { background: rgba(255,200,61,0.2); color: var(--accent); }
.lvl-hard { background: rgba(255,92,92,0.22); color: #FF7A7A; }

 
.seat.empty .nm { display: none; }
.seat .body { width: 40px; height: 40px; }

 
#game:not(.wide) #players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 6px; }
#game:not(.wide) .pchip { min-width: 0; padding: 3px 8px 3px 5px; }
#game:not(.wide) .pchip .nm { flex: 1; min-width: 0; max-width: none; }
.lvl.short { width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 12px; letter-spacing: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
#game.wide #players { gap: 2px; }
#game.wide .pchip { padding: 1px 9px 1px 5px; }

 
.pchip.waiting { animation: wiggle 1.1s ease-in-out infinite; }
.pchip.waiting .sc { color: var(--ink); font-weight: 700; font-size: 12px; font-style: italic; }
.pchip.waiting .dot { animation: fidget 1.1s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-1deg); } 75% { transform: rotate(1deg); } }
 
#game.wide #players { padding: 3px 4px; overflow-x: hidden; }

 
#game[data-phase="countdown"] #stageBody, #game[data-phase="play"] #stageBody { overflow: hidden; }

 
.scr-compact #game.wide #players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 6px; }
.scr-compact #game.wide .pchip { min-width: 0; }
.scr-compact.scr-sideways #stageBody { padding: 6px; gap: 5px; }
.scr-compact.scr-sideways .podium { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
.scr-compact.scr-sideways .prow { min-width: 0; padding: 6px 8px; gap: 6px; }
.scr-compact.scr-sideways .stTitle { font-size: 20px; }
 
.scr-compact.scr-sideways #game[data-phase="results"] .stTitle { display: none; }

 
#wpWait { position: absolute; inset: 0; z-index: 4; }
#wpWait .docs a { color: var(--c-accent); }
 
#playBot { width: min(70vw, 260px); }
#playBot[hidden] { display: none !important; }
