/* fill.zone — styles.css
 * Mobile-first, portrait. Colors come from CSS variables that app.js sets
 * from the active theme (store.THEMES), so the canvas and DOM stay in sync.
 */

:root {
  --bg: #eef1f7;
  --panel: #ffffff;
  --text: #0e1730;
  --muted: #8a93a6;
  --blue: #2e6bff;
  --red: #f23b36;
  --board: #ffffff;
  --board-edge: #dfe4ee;
  --empty: #e9edf4;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(20, 30, 60, 0.10);
  --shadow-sm: 0 3px 10px rgba(20, 30, 60, 0.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
}

body { display: flex; justify-content: center; }

.app {
  position: relative;
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  transition: background 0.4s ease;
}

/* ---------- screens ---------- */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
}
.screen.active { display: flex; animation: screenIn 0.34s cubic-bezier(.2,.7,.3,1); }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}

/* ---------- shared buttons ---------- */
.icon-btn {
  width: 44px; height: 44px;
  border: none; border-radius: 14px;
  background: var(--panel); color: var(--text);
  font-size: 20px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: grid; place-items: center;
  transition: transform .12s ease, box-shadow .12s ease;
}
.icon-btn:active { transform: scale(0.92); }

.start-btn {
  width: 100%;
  border: none; border-radius: var(--radius);
  background: var(--blue); color: #fff;
  font-size: 18px; font-weight: 800; letter-spacing: .3px;
  padding: 17px; cursor: pointer;
  box-shadow: 0 10px 22px rgba(46,107,255,0.35);
  transition: transform .12s ease, filter .12s ease;
}
.start-btn:active { transform: scale(0.97); filter: brightness(1.05); }

.ghost-btn {
  flex: 1;
  border: 1.5px solid var(--board-edge);
  border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text);
  font-size: 15px; font-weight: 700;
  padding: 13px; cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.ghost-btn:active { transform: scale(0.97); }
.ghost-btn--danger { color: var(--red); border-color: transparent; background: transparent; width: 100%; margin-top: 4px; }

/* ---------- main menu ---------- */
.menu-top { display: flex; justify-content: flex-start; margin-bottom: 6px; }

.logo {
  text-align: center;
  font-weight: 900;
  font-size: clamp(40px, 13vw, 56px);
  letter-spacing: -2px;
  margin-top: 8px;
  line-height: 1;
}
.logo-fill { color: var(--blue); }
.logo-dot  { color: var(--red); }
.logo-zone { color: var(--red); }
.tagline { text-align: center; color: var(--muted); margin: 8px 0 4px; font-size: 15px; font-weight: 500; }

.hero {
  display: grid; place-items: center;
  margin: 6px auto 14px;
  width: 100%;
}
#hero-canvas {
  width: min(62vw, 240px);
  height: min(62vw, 240px);
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }

.big-btn {
  display: flex; align-items: center; gap: 14px;
  border: none; border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer;
  color: #fff; text-align: left;
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease;
}
.big-btn:active { transform: scale(0.975); }
.big-btn--blue { background: linear-gradient(135deg, var(--blue), color-mix(in srgb, var(--blue) 78%, #000)); }
.big-btn--red  { background: linear-gradient(135deg, var(--red), color-mix(in srgb, var(--red) 80%, #000)); }
.big-btn__icon {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,0.20);
  display: grid; place-items: center; font-size: 22px; flex: 0 0 auto;
}
.big-btn__text { flex: 1; display: flex; flex-direction: column; }
.big-btn__title { font-size: 19px; font-weight: 800; }
.big-btn__sub { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.big-btn__chev { font-size: 26px; opacity: 0.8; }

.menu-row { display: flex; gap: 12px; }
.row-card {
  position: relative;
  flex: 1; border: none; border-radius: var(--radius);
  background: var(--panel); color: var(--text);
  padding: 16px; cursor: pointer; text-align: left;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 2px;
  transition: transform .14s ease;
}
.row-card:active { transform: scale(0.97); }
.row-card__icon { font-size: 24px; margin-bottom: 4px; }
.row-card__title { font-weight: 800; font-size: 16px; }
.row-card__sub { color: var(--muted); font-size: 12px; }
.row-card__badge {
  position: absolute; top: 12px; right: 12px;
  min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--red); color: #fff;
  border-radius: 11px; font-size: 12px; font-weight: 800;
  display: grid; place-items: center;
  animation: pop .3s ease;
}
.version { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

/* ---------- sub-screen headers ---------- */
.sub-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sub-title { font-size: 22px; font-weight: 900; margin: 0; flex: 1; text-align: center; }
.sub-spacer { width: 44px; }

/* ---------- setup ---------- */
.setup-scroll, .tut-scroll, .stats-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }

.brief {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.brief__avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex: 0 0 auto; }
.brief__avatar--blue { background: color-mix(in srgb, var(--blue) 16%, var(--panel)); }
.brief__avatar--red { background: color-mix(in srgb, var(--red) 16%, var(--panel)); }
.brief__text { flex: 1; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.brief__text strong { color: var(--text); font-size: 15px; margin-bottom: 2px; }
.t-blue { color: var(--blue); } .t-red { color: var(--red); } .t-mut { color: var(--muted); }

.opt-group { margin-bottom: 20px; }
.opt-label { font-weight: 800; font-size: 13px; letter-spacing: .4px; text-transform: uppercase; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.opt-num { width: 20px; height: 20px; border-radius: 6px; background: color-mix(in srgb, var(--blue) 14%, var(--panel)); color: var(--blue); font-size: 12px; display: grid; place-items: center; }
.opt-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opt-choices--2 { grid-template-columns: repeat(2, 1fr); }

.choice {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--panel); color: var(--muted);
  padding: 16px 8px; cursor: pointer;
  font-size: 13px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .15s ease, color .15s ease;
}
.choice:active { transform: scale(0.96); }
.choice.selected { border-color: var(--blue); color: var(--blue); background: color-mix(in srgb, var(--blue) 7%, var(--panel)); }
.choice--wide { align-items: flex-start; text-align: left; padding: 14px; }
.choice__big { font-size: 22px; }
.choice__t { font-size: 14px; font-weight: 800; color: inherit; }
.choice__d { font-size: 11px; color: var(--muted); font-weight: 600; }
.choice.selected .choice__d { color: color-mix(in srgb, var(--blue) 60%, var(--muted)); }

/* shape glyphs */
.choice__glyph { width: 26px; height: 26px; display: inline-block; }
.glyph-square { background: currentColor; border-radius: 5px; }
.glyph-circle { background: currentColor; border-radius: 50%; }
.glyph-triangle { width: 0; height: 0; background: transparent; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 24px solid currentColor; border-radius: 2px; }

.setup-foot, .game-foot { padding-top: 12px; }

/* ---------- game ---------- */
.screen--game { padding: max(14px, env(safe-area-inset-top)) 10px max(14px, env(safe-area-inset-bottom)); }
.game-top { display: flex; align-items: center; justify-content: space-between; }
.match-timer { position: relative; width: 52px; height: 52px; display: grid; place-items: center; }
.timer-ring { width: 52px; height: 52px; transform: rotate(-90deg); }
.timer-ring__bg { fill: none; stroke: var(--board-edge); stroke-width: 4; }
.timer-ring__fg { fill: none; stroke: var(--blue); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 119.38; stroke-dashoffset: 0; transition: stroke-dashoffset .25s linear, stroke .25s; }
.match-timer__num { position: absolute; font-weight: 900; font-size: 17px; }

.scoreboard { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; }
.score { display: flex; flex-direction: column; }
.score--right { align-items: flex-end; }
.score__who { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--muted); }
.score--blue .score__who { color: var(--blue); }
.score--red .score__who { color: var(--red); }
.score__pct { font-size: 30px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }

.score-bar {
  display: flex; height: 14px; border-radius: 8px; overflow: hidden;
  background: var(--empty); margin-top: 10px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}
.score-bar__blue { background: var(--blue); width: 0%; transition: width .35s cubic-bezier(.2,.7,.3,1); }
.score-bar__red { background: var(--red); width: 0%; margin-left: auto; transition: width .35s cubic-bezier(.2,.7,.3,1); }
.score-bar--lg { height: 20px; border-radius: 10px; margin-top: 14px; }

.turn-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-weight: 700; font-size: 14px; min-height: 26px; }
.turn-line__left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.turn-line__left span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 60%, transparent); animation: pulse 1.4s ease-out infinite; flex: 0 0 auto; }

/* shape + mode chip shown during the round */
.mode-chip { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; font-size: 12px;
  font-weight: 800; color: var(--muted); background: var(--panel); padding: 5px 11px; border-radius: 999px;
  box-shadow: var(--shadow-sm); }
.mode-chip .shp { display: inline-block; width: 13px; height: 13px; }
.mode-chip .shp--circle { border-radius: 50%; background: currentColor; }
.mode-chip .shp--square { border-radius: 3px; background: currentColor; }
.mode-chip .shp--triangle { width: 0; height: 0; background: transparent;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 13px solid currentColor; }
.mode-chip .filler { color: var(--blue); }
.mode-chip .board { color: var(--muted); }
.turn-dot.red { background: var(--red); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 55%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.board-wrap { flex: 1; display: grid; place-items: center; padding: 6px 0; min-height: 0; }
#game-canvas {
  width: min(100%, 86vh);
  max-height: 100%;
  aspect-ratio: 1 / 1;
  touch-action: none;
  border-radius: 20px;
}

.game-foot { display: flex; align-items: center; justify-content: space-between; }
.toggle { display: inline-flex; align-items: center; gap: 9px; border: none; background: none; color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; }
.toggle__box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--board-edge); display: inline-block; position: relative; transition: background .15s, border-color .15s; }
.toggle.on .toggle__box { background: var(--blue); border-color: var(--blue); }
.toggle.on .toggle__box::after { content: "✓"; color: #fff; position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 900; }
.empty-pill { font-size: 13px; color: var(--muted); font-weight: 600; }
.empty-pill b { color: var(--text); }

/* ---------- result overlay ---------- */
.overlay { position: absolute; inset: 0; background: rgba(10,16,32,0.45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; z-index: 30; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.result-card { position: relative; width: 100%; max-width: 360px; background: var(--panel); border-radius: 24px; padding: 26px 22px; box-shadow: var(--shadow); text-align: center; animation: cardPop .4s cubic-bezier(.2,.8,.3,1.2); }
@keyframes cardPop { from { transform: scale(0.8) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.result-title { font-size: 32px; font-weight: 900; margin-bottom: 18px; }
.result-title.win { color: var(--blue); } .result-title.loss { color: var(--red); } .result-title.draw { color: var(--muted); }
.result-scores { display: flex; justify-content: space-around; }
.rscore { display: flex; flex-direction: column; }
.rscore__who { font-size: 13px; font-weight: 800; color: var(--muted); }
.rscore--blue .rscore__who { color: var(--blue); } .rscore--red .rscore__who { color: var(--red); }
.rscore__pct { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.result-empty { color: var(--muted); font-size: 13px; margin-top: 8px; }
.result-empty b { color: var(--text); }
.result-ach { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 4px; }
.ach-toast { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--blue) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--blue) 20%, transparent); border-radius: 12px; padding: 9px 12px; text-align: left; animation: slideIn .4s ease backwards; }
.ach-toast__icon { font-size: 22px; }
.ach-toast__t { font-weight: 800; font-size: 14px; }
.ach-toast__d { font-size: 11px; color: var(--muted); }
@keyframes slideIn { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.result-btns { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.result-btns__row { display: flex; gap: 10px; }
/* brief post-game tap-block so a stray match tap can't hit a button */
.result-btns.locked { pointer-events: none; animation: btnsIn .5s ease; }
@keyframes btnsIn { from { opacity: .3; } to { opacity: 1; } }

/* ---------- profile ---------- */
.profile-body { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 10px; }
.profile-avatar { width: 92px; height: 92px; border-radius: 50%; color: #fff; display: grid; place-items: center;
  font-size: 42px; font-weight: 900; box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--blue), var(--red)); }
.profile-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; align-self: flex-start; margin-top: 4px; }
.profile-name-row { display: flex; gap: 10px; width: 100%; }
.profile-input { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; padding: 12px 14px;
  border: 2px solid var(--board-edge); border-radius: 14px; background: var(--panel); color: var(--text); outline: none; }
.profile-input:focus { border-color: var(--blue); }
.profile-input.shake { animation: shake .4s; }
.profile-save { width: auto; padding: 12px 22px; }
.profile-hint { font-size: 13px; color: var(--muted); min-height: 18px; align-self: flex-start; }
.profile-stats { display: flex; gap: 12px; width: 100%; }
.profile-stat { flex: 1; background: var(--panel); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.profile-stat__n { font-size: 28px; font-weight: 900; color: var(--blue); }
.profile-stat__l { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.profile-body .ghost-btn { width: 100%; margin-top: 6px; }

/* ---------- settings sheet ---------- */
.sheet { position: absolute; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(10,16,32,0.4); animation: fadeIn .2s ease; }
.sheet__panel { position: relative; width: 100%; max-width: 440px; background: var(--bg); border-radius: 24px 24px 0 0; padding: 14px 22px max(24px, env(safe-area-inset-bottom)); box-shadow: var(--shadow); animation: sheetUp .3s cubic-bezier(.2,.8,.3,1); display: flex; flex-direction: column; gap: 14px; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet__handle { width: 44px; height: 5px; border-radius: 3px; background: var(--board-edge); margin: 2px auto 4px; }
.sheet__title { margin: 0; font-size: 20px; font-weight: 900; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel); border-radius: var(--radius-sm); padding: 14px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow-sm); }
.setting-row--switch { cursor: pointer; }
.switch { width: 46px; height: 28px; border-radius: 16px; background: var(--board-edge); position: relative; transition: background .2s; flex: 0 0 auto; }
.switch__knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform .2s; }
.setting-row.on .switch { background: var(--blue); }
.setting-row.on .switch__knob { transform: translateX(18px); }
.theme-list { display: flex; gap: 8px; }
.theme-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; display: grid; place-items: center; }
.theme-dot.selected { border-color: var(--text); }
.theme-dot__inner { width: 18px; height: 18px; border-radius: 50%; }

/* ---------- segmented tabs + stats ---------- */
.seg { display: flex; background: var(--panel); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.seg__btn { flex: 1; border: none; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; padding: 10px; border-radius: 9px; cursor: pointer; transition: background .2s, color .2s; }
.seg__btn.active { background: var(--blue); color: #fff; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .25s ease; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-grid .wdl { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.wdl__seg { flex: 1; text-align: center; }
.wdl__seg + .wdl__seg { border-left: 1px solid var(--board-edge); }
.wdl__n { font-size: 26px; font-weight: 900; line-height: 1; }
.wdl__l { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.stat-card { background: var(--panel); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.stat-card__num { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-card__label { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat-card--wide { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }

.ach-grid { display: flex; flex-direction: column; gap: 10px; }
.ach-item { display: flex; align-items: center; gap: 14px; background: var(--panel); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); transition: opacity .2s; }
.ach-item.locked { opacity: 0.55; }
.ach-item__icon { width: 46px; height: 46px; border-radius: 13px; background: var(--empty); display: grid; place-items: center; font-size: 24px; flex: 0 0 auto; filter: grayscale(1); }
.ach-item.unlocked .ach-item__icon { filter: none; background: color-mix(in srgb, var(--blue) 12%, var(--panel)); }
.ach-item__t { font-weight: 800; font-size: 15px; }
.ach-item__d { font-size: 12px; color: var(--muted); }
.ach-item__check { margin-left: auto; color: var(--blue); font-size: 20px; font-weight: 900; }

/* ---------- tutorial ---------- */
.tut-card { background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 12px; display: flex; gap: 14px; align-items: flex-start; }
.tut-card__n { width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--blue) 14%, var(--panel)); color: var(--blue); font-weight: 900; display: grid; place-items: center; flex: 0 0 auto; }
.tut-card__t { font-weight: 800; font-size: 16px; margin-bottom: 3px; }
.tut-card__d { font-size: 13px; color: var(--muted); line-height: 1.5; }

@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

@media (max-width: 360px) {
  .score__pct { font-size: 26px; }
  .big-btn__icon { width: 40px; height: 40px; }
}

/* ---------- multiplayer additions ---------- */
#screen-menu { overflow-y: auto; }
#hero-canvas { width: min(52vw, 180px); height: min(52vw, 180px); }
.hero { margin: 4px auto 10px; }
.menu-buttons { gap: 11px; }

.big-btn--violet { background: linear-gradient(135deg, #7b5cff, #5b3fd6); }

.mp-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  border: none; border-radius: var(--radius); background: var(--panel); color: var(--text);
  padding: 16px 18px; cursor: pointer; text-align: left; box-shadow: var(--shadow-sm);
  margin-bottom: 12px; transition: transform .14s ease;
}
.mp-card:active { transform: scale(0.98); }
.mp-card.disabled { opacity: 0.5; pointer-events: none; }
.mp-card__icon { width: 46px; height: 46px; border-radius: 14px;
  background: color-mix(in srgb, var(--blue) 12%, var(--panel)); display: grid; place-items: center;
  font-size: 22px; flex: 0 0 auto; }
.mp-card__text { flex: 1; display: flex; flex-direction: column; }
.mp-card__title { font-weight: 800; font-size: 17px; }
.mp-card__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mp-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 18px; line-height: 1.5; padding: 0 8px; }

.room-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; text-align: center; padding-bottom: 30px; }
.room-hint { color: var(--muted); font-size: 15px; margin: 0; }
.room-code { font-size: clamp(48px, 18vw, 68px); font-weight: 900; letter-spacing: 10px;
  color: var(--text); background: var(--panel); border-radius: 20px; padding: 16px 26px;
  box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }
.room-share { display: flex; gap: 10px; width: 100%; max-width: 300px; }
.room-share .ghost-btn { padding: 11px; font-size: 14px; }
.room-share .ghost-btn.copied { color: var(--blue); border-color: var(--blue); }
.room-status { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); min-height: 22px; }
.room-status.err { color: var(--red); }
.room-status.err .spinner { display: none; }
.room-sub { color: var(--muted); font-size: 13px; margin: 0; max-width: 280px; line-height: 1.5; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--board-edge);
  border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.code-input { font-size: 46px; font-weight: 900; letter-spacing: 14px; text-align: center; width: 230px;
  padding: 14px 14px 14px 28px; border: 2px solid var(--board-edge); border-radius: 18px;
  background: var(--panel); color: var(--text); outline: none; font-variant-numeric: tabular-nums; }
.code-input:focus { border-color: var(--blue); }
.code-input.shake { animation: shake .4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* ---------- result race graph ---------- */
.result-card { max-height: 92vh; overflow-y: auto; }
.result-graph { margin-top: 16px; text-align: left; }
.result-graph__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.result-graph__title { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.result-graph__legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 700; }
.result-graph__legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--blue { background: var(--blue); }
.dot--red { background: var(--red); margin-left: 8px; }
.race-graph { width: 100%; height: 150px; display: block; }
.result-note { font-size: 13px; color: var(--muted); text-align: center; padding: 10px; }

/* ---------- pre-match countdown ---------- */
.board-wrap { position: relative; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 5; }
.countdown__num { font-size: clamp(80px, 30vw, 130px); font-weight: 900; color: var(--blue);
  text-shadow: 0 6px 28px rgba(20,30,60,0.18); font-variant-numeric: tabular-nums; }
.countdown__num.pop { animation: cdpop .75s cubic-bezier(.2,.8,.3,1.2); }
@keyframes cdpop {
  0% { transform: scale(0.3); opacity: 0; }
  30% { transform: scale(1.12); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.82); opacity: 0.12; }
}

/* ---------- rating (ELO) ---------- */
.menu-top { justify-content: space-between; align-items: center; }
.rating-pill { background: var(--panel); border-radius: 14px; padding: 9px 14px; font-weight: 800;
  font-size: 15px; box-shadow: var(--shadow-sm); cursor: pointer; color: var(--text); font-variant-numeric: tabular-nums; }
.rating-pill b { color: var(--blue); }

.result-elo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px;
  background: color-mix(in srgb, var(--blue) 7%, var(--panel)); border-radius: 12px; padding: 10px 14px; }
.result-elo__label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.result-elo__val { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.result-elo__delta { font-size: 14px; font-weight: 800; padding: 2px 8px; border-radius: 8px; }
.result-elo__delta.up { color: #0a8f4e; background: rgba(16,185,129,0.14); }
.result-elo__delta.down { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.result-elo__delta.flat { color: var(--muted); background: var(--empty); }
.stat-card--rating .stat-card__num { color: var(--blue); }
.elo-graph-card { background: var(--panel); border-radius: var(--radius); padding: 14px 14px 10px; box-shadow: var(--shadow-sm); }
.elo-graph-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px;
  font-weight: 800; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.elo-graph { width: 100%; height: 130px; display: block; }

/* ---------- leaderboard ---------- */
.lb-empty { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted);
  font-size: 14px; text-align: center; padding: 40px 16px; line-height: 1.5; }
.lb-you { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #7b5cff, #5b3fd6);
  color: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.lb-you__rank { font-weight: 900; font-size: 18px; min-width: 44px; }
.lb-you__name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-you__elo { font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; }
.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 12px;
  padding: 11px 14px; box-shadow: var(--shadow-sm); }
.lb-row--me { outline: 2px solid var(--blue); }
.lb-row__rank { min-width: 30px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-row__name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row__wr { color: var(--muted); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-row__elo { font-weight: 900; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

/* ---------- featured (random match) card ---------- */
.mp-card--feature { background: linear-gradient(135deg, #7b5cff, #5b3fd6); color: #fff; }
.mp-card--feature .mp-card__icon { background: rgba(255,255,255,0.2); }
.mp-card--feature .mp-card__sub { color: rgba(255,255,255,0.85); }
.mp-card--feature .big-btn__chev { color: rgba(255,255,255,0.9); }

/* ---------- powerups ---------- */
.setting-row__hint { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 5px; }
.pw-toast { position: absolute; top: 13%; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--panel); border-radius: 16px; padding: 11px 20px; box-shadow: var(--shadow);
  pointer-events: none; z-index: 6; opacity: 0; text-align: center; border: 2px solid transparent; }
.pw-toast--blue { border-color: var(--blue); }
.pw-toast--red { border-color: var(--red); }
.pw-toast.show { animation: pwpop 1.5s cubic-bezier(.2,.8,.3,1.1) forwards; }
@keyframes pwpop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(10px); }
  14% { opacity: 1; transform: translateX(-50%) scale(1.06) translateY(0); }
  24% { transform: translateX(-50%) scale(1) translateY(0); }
  80% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.95) translateY(-8px); }
}
.pw-toast__e { font-size: 30px; line-height: 1; }
.pw-toast__t { font-size: 17px; font-weight: 900; color: var(--text); }
.pw-toast__b { font-size: 12px; font-weight: 600; color: var(--muted); }
