/* PRISM CLASH — a glass workshop at night: deep navy, frosted panels, one
   prismatic accent. Nothing here depends on web/style.css (not loaded). */
:root {
  --bg0: #070b16;
  --bg1: #0f1a30;
  --panel: rgba(255, 255, 255, 0.06);
  --edge: rgba(255, 255, 255, 0.14);
  --text: #eef3ff;
  --dim: rgba(238, 243, 255, 0.62);
  --accent: #7fd4ff;
  --gold: #ffd95a;
  --prism: linear-gradient(90deg, #ff6b6b, #ffd95a, #5fe39a, #5fb8ff, #b98bff);
  --fs-accent: #7fd4ff;
  --fs-text: #eef3ff;
  --fs-dim: rgba(238, 243, 255, 0.6);
  --fs-edge: rgba(255, 255, 255, 0.14);
  --fs-panel: rgba(255, 255, 255, 0.05);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg0); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(95, 184, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at 95% 110%, rgba(185, 139, 255, 0.2), transparent 60%),
    linear-gradient(160deg, var(--bg1), var(--bg0));
}
button { font: inherit; color: inherit; cursor: pointer; }
/* web/style.css pins .volume-slider position:fixed top:12px on pages that load
   it. This page does not, but a shared strip must never land in a corner. */
.volume-slider { position: static !important; top: auto !important; }

.pc-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.pc-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.muted { color: var(--dim); font-size: 13px; }

/* ── menus ─────────────────────────────────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-start;
  justify-content: center; overflow-y: auto; padding: 18px 12px 28px;
}
.card {
  width: 100%; max-width: 460px; margin: auto; padding: 22px 22px 18px;
  background: rgba(13, 22, 40, 0.86); border: 1px solid var(--edge); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px); text-align: center;
}
.card.wide { max-width: 980px; text-align: left; }
.card.mid { max-width: 720px; }
.prism-title {
  margin: 4px 0 6px; font-size: 44px; font-weight: 900; letter-spacing: 0.06em; line-height: 1;
}
.prism-title.small { font-size: 26px; margin: 0; }
.title-accent {
  margin-left: 0.18em; background: var(--prism); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.tagline { color: var(--dim); margin: 6px 0 12px; font-size: 15px; line-height: 1.45; }
.join-demo { display: flex; justify-content: center; gap: 6px; margin: 4px 0 14px; }
.join-demo canvas { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
#nameInput {
  width: 100%; max-width: 300px; padding: 12px 14px; margin: 0 auto 10px; display: block;
  border-radius: 12px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.08);
  color: var(--text); font-size: 16px; text-align: center; outline: none;
}
#nameInput:focus { border-color: var(--accent); }
.primary {
  display: block; width: 100%; max-width: 300px; margin: 8px auto; padding: 13px 16px;
  border: 0; border-radius: 12px; font-size: 17px; font-weight: 800; color: #06121f;
  background: linear-gradient(180deg, #a5e4ff, #55b9f3);
  box-shadow: 0 6px 18px rgba(85, 185, 243, 0.35);
}
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: 0.5; cursor: default; }
.ghost {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.06); font-size: 14px; font-weight: 600;
}
.ghost:hover { background: rgba(255, 255, 255, 0.12); }
.back-link { display: inline-block; margin-top: 12px; color: var(--dim); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--text); }
.lobby-audio { margin: 12px auto 0; display: flex; justify-content: center; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 12px; }
.btn-row .primary { width: auto; margin: 0; padding: 11px 22px; }

/* the hub */
.hub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hub-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; margin: 14px 0 12px; border-bottom: 1px solid var(--edge); }
.tab {
  flex: 1 1 0; padding: 11px 8px; border: 0; background: transparent; font-size: 15px; font-weight: 700;
  color: var(--dim); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:not(.active) { color: #c9d4e6; background: rgba(255, 255, 255, 0.05); border-radius: 10px 10px 0 0; }
.tab:not(.active):hover { background: rgba(255, 255, 255, 0.1); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.join-modes { display: flex; flex-direction: column; gap: 0; }
.mode-btn small { display: block; font-size: 12px; font-weight: 600; opacity: 0.75; margin-top: 2px; }
.mode-btn.multi { background: linear-gradient(180deg, #ffd59a, #f39c55); box-shadow: 0 6px 18px rgba(243, 156, 85, 0.35); }
.tab-stars { font-weight: 600; color: var(--gold); margin-left: 4px; font-size: 13px; }
.save-note { margin: 0 0 10px; }
.chapter { margin-bottom: 18px; }
.chapter-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.chapter-head h3 { margin: 0; font-size: 18px; }
.chapter-head .ch-stars { color: var(--gold); font-weight: 700; font-size: 14px; margin-left: auto; }
.map-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.map-node {
  position: relative; padding: 9px 4px 7px; border-radius: 14px; border: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  text-align: center; min-height: 86px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.map-node:hover:not(.locked) { border-color: var(--accent); transform: translateY(-1px); }
.map-node .mn-num { font-size: 20px; font-weight: 900; line-height: 1; }
.map-node .mn-name { font-size: 11px; color: var(--dim); line-height: 1.15; min-height: 25px; display: flex; align-items: center; }
.map-node .mn-stars { font-size: 13px; letter-spacing: 1px; color: rgba(255, 255, 255, 0.22); }
.map-node .mn-stars b { color: var(--gold); font-weight: 400; }
.map-node.locked { opacity: 0.45; cursor: default; }
.map-node.next { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 217, 90, 0.25), 0 0 18px rgba(255, 217, 90, 0.25); }
.map-node .mn-goal { position: absolute; top: 5px; right: 6px; font-size: 11px; opacity: 0.8; }
.map-node.blast:not(.locked) { background: linear-gradient(160deg, rgba(255, 120, 60, 0.16), rgba(255, 210, 80, 0.06)); }

.multi-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.player-list { margin: 6px 0 10px; display: flex; flex-direction: column; gap: 5px; }
.player-row {
  display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 10px;
  background: var(--panel); border: 1px solid transparent; font-size: 14px;
}
.player-row.me { border-color: rgba(127, 212, 255, 0.5); }
.player-row .tag { margin-left: auto; color: var(--dim); font-size: 12px; white-space: nowrap; }
.player-row .pstars { color: var(--gold); font-size: 12px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 9px 0; font-size: 14px; }
.setting select {
  flex: 1 1 auto; max-width: 250px; padding: 8px; border-radius: 10px; border: 1px solid var(--edge);
  background: #14233d; color: var(--text); font-size: 14px;
}
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; padding: 8px 12px; background: transparent; font-size: 13px; font-weight: 600; color: var(--dim); }
.seg button.on { background: var(--accent); color: #06121f; }
.seg button:disabled, .stepper button:disabled, .setting select:disabled { cursor: default; }
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--edge); background: var(--panel); font-size: 18px; line-height: 1; }
.mode-blurb { margin: -2px 0 8px; min-height: 34px; }
.round-note { padding: 9px 12px; border-radius: 10px; background: rgba(255, 217, 90, 0.12); border: 1px solid rgba(255, 217, 90, 0.4); margin-bottom: 12px; font-size: 14px; }
#multiTab .primary { max-width: none; }

.count-info { color: var(--dim); font-size: 15px; margin-bottom: 4px; }
.countdown { font-size: 120px; font-weight: 900; line-height: 1.1; background: var(--prism); -webkit-background-clip: text; background-clip: text; color: transparent; }
.end-stars { font-size: 54px; letter-spacing: 8px; margin: 6px 0 2px; }
.end-stars span { display: inline-block; color: rgba(255, 255, 255, 0.16); transform: scale(0.8); transition: transform 0.35s cubic-bezier(.2, 1.6, .4, 1), color 0.2s; }
.end-stars span.on { color: var(--gold); transform: scale(1.12); text-shadow: 0 0 22px rgba(255, 217, 90, 0.7); }
.end-line { font-size: 16px; margin: 4px 0; }
.end-credits { color: var(--gold); font-size: 14px; min-height: 18px; margin: 4px 0 8px; }
.series { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.series .chip { padding: 5px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--edge); font-size: 13px; }
.series .chip b { color: var(--gold); margin-left: 4px; }

/* fun_stats: a bot's name must not collapse to "Gl…" beside its BOT tag */
.fs-table .fs-name-col { min-width: 8.5em; }

/* the shared boards, themed */
.lb-panel, .lb-card { --lb-accent: #7fd4ff; --lb-text: #eef3ff; --lb-dim: rgba(238, 243, 255, 0.6); --lb-edge: rgba(255, 255, 255, 0.14); --lb-panel: rgba(13, 22, 40, 0.96); }
.overlay-card { max-width: 560px; }

/* ── modals ────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(3, 6, 14, 0.78); padding: 14px; overflow-y: auto; }
.modal-card { position: relative; width: 100%; max-width: 780px; margin: auto; padding: 22px; border-radius: 18px; background: #101b31; border: 1px solid var(--edge); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); }
.modal-card h2 { margin: 0 0 12px; font-size: 24px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; }
.help-grid h3 { margin: 10px 0 6px; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.help-grid p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; }
.help-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; line-height: 1.35; }
.help-icon { flex: 0 0 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.help-close { position: absolute; top: 12px; right: 12px; }
.intro-card { max-width: 380px; text-align: center; }
.intro-icon { display: flex; justify-content: center; gap: 6px; margin: 10px 0 6px; }
.intro-card p { font-size: 15px; line-height: 1.5; color: var(--text); margin: 6px 0 14px; }
.coach-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--gold); color: #2a1d00; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }

/* ── the play screen ───────────────────────────────────────────────────── */
#playScreen { position: fixed; inset: 0; display: flex; flex-direction: column; }
#playTop { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
.icon-btn { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; border: 1px solid var(--edge); background: var(--panel); font-size: 18px; font-weight: 800; line-height: 1; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.hud-title { flex: 1 1 auto; min-width: 0; font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title small { display: block; font-weight: 500; color: var(--dim); font-size: 12px; }
.hud-clock { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; padding: 2px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--edge); }
.hud-clock.low { color: #ff8b8b; border-color: #ff8b8b; animation: pulse 0.8s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.audio-pop { position: fixed; top: 58px; right: 10px; z-index: 30; padding: 10px; border-radius: 14px; background: #101b31; border: 1px solid var(--edge); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }

#playMain { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr) 270px; gap: 12px; padding: 4px 12px 12px; }
#playMain > * { min-width: 0; }
/* a spectator has no board of their own: the rivals' boards get the room */
#playMain.watching { grid-template-columns: minmax(0, 1fr); }
#sidePanel, #rivalPanel { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 10px 12px; }
.me-plate { font-weight: 700; font-size: 15px; text-align: center; }
.goal-box { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.goal-line { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.goal-line .tile-icon { flex: 0 0 auto; }
.goal-line .g-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.goal-line.done .g-count { color: #7dffb0; }
.goal-text { font-size: 13px; color: var(--dim); line-height: 1.35; }
.bar { height: 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #5fb8ff, #7dffb0); transition: width 0.25s; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: center; }
#hudMoves.low { color: #ff8b8b; }
.star-track { position: relative; height: 12px; margin: 14px 8px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); }
.star-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 8px; background: linear-gradient(90deg, #ffb347, #ffd95a); transition: width 0.3s; }
.star-pip { position: absolute; top: -13px; transform: translateX(-50%); font-size: 22px; color: rgba(255, 255, 255, 0.25); transition: color 0.2s, transform 0.3s; }
.star-pip.on { color: var(--gold); transform: translateX(-50%) scale(1.25); text-shadow: 0 0 10px rgba(255, 217, 90, 0.8); }

#boardWrap { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: none; }
#board { display: block; touch-action: none; }
.callout {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(0.4); opacity: 0; pointer-events: none;
  font-size: clamp(34px, 7vw, 68px); font-weight: 900; letter-spacing: 0.04em; white-space: nowrap;
  background: var(--prism); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(4, 8, 18, 0.9)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.4));
}
.callout.show { animation: callout 0.9s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes callout { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); } 70% { opacity: 1; transform: translate(-50%, -58%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(0.95); } }
.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 16px 26px; border-radius: 16px; background: rgba(8, 14, 26, 0.92); border: 1px solid var(--edge); text-align: center; font-size: 22px; font-weight: 800; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6); z-index: 4; max-width: 92%; }
.banner small { display: block; font-size: 14px; font-weight: 500; color: var(--dim); margin-top: 4px; }
.coach { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); width: min(94%, 460px); padding: 10px 14px 12px; border-radius: 14px; background: rgba(16, 27, 49, 0.97); border: 2px solid var(--gold); font-size: 16px; font-weight: 600; line-height: 1.4; text-align: center; z-index: 5; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.6); }
.coach.top { bottom: auto; top: 6px; }
.coach .coach-tag { margin-bottom: 4px; }
.toast { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: rgba(8, 14, 26, 0.94); border: 1px solid var(--edge); font-size: 14px; font-weight: 600; z-index: 6; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }

.rival-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.rival { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--edge); }
.rival.me { border-color: rgba(127, 212, 255, 0.6); }
.rival.finished { border-color: rgba(125, 255, 176, 0.7); }
.rival canvas { grid-row: 1 / span 3; border-radius: 6px; background: #0a1322; }
.rival .r-name { font-size: 14px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rival .r-place { color: var(--gold); margin-right: 4px; }
.rival .r-score { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; gap: 6px; }
.rival .r-score b { color: var(--text); font-size: 15px; }
.rival .bar { height: 6px; }
.rival .mg-name-title-block { font-size: 11px; }
.solo-info { font-size: 13px; color: var(--dim); line-height: 1.5; }
.solo-info b { color: var(--text); }
.solo-info .thr { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.1); }
.solo-info .thr span:first-child { color: var(--gold); }

.spectate-grid { position: absolute; inset: 0; display: flex; flex-wrap: wrap; gap: 14px; align-content: center; justify-content: center; overflow-y: auto; padding: 44px 8px 8px; }
.spectate-grid .rival { grid-template-columns: 1fr; justify-items: center; flex: 0 0 auto; width: 236px; }
.spectate-grid .rival canvas { grid-row: auto; }
.spectate-grid .rival .r-score, .spectate-grid .rival .bar, .spectate-grid .rival .r-name { width: 100%; }
.spectator-flag { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 15; padding: 6px 14px; border-radius: 999px; background: rgba(8, 14, 26, 0.92); border: 1px solid var(--gold); color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; }

/* ── tablets and phones ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  #playMain { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px; padding: 0 8px 8px; }
  #playMain.watching { grid-template-rows: minmax(0, 1fr); }
  .spectate-grid .rival { width: 170px; }
  /* one row about yourself is what the line above it already says */
  #soloEndTable { display: none; }
  .fs-table .fs-name-col { min-width: 9em; }
  .fs-table { font-size: 12.5px; }
  .fs-table th, .fs-table td { padding-left: 5px !important; padding-right: 5px !important; }
  #sidePanel { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  #sidePanel .panel { padding: 6px 10px; }
  .me-plate { display: none; }
  .goal-panel { flex: 1 1 56%; min-width: 0; }
  .goal-panel .pc-label { display: none; }
  .goal-box { margin-top: 0; gap: 4px; }
  .goal-text { display: none; }
  .goal-line { font-size: 14px; }
  .stat-row { flex: 1 1 36%; gap: 4px; }
  .pc-value { font-size: 21px; }
  .star-panel { flex: 1 1 100%; padding: 2px 10px 0 !important; background: none; border: 0; }
  .star-track { margin: 13px 8px 4px; height: 8px; }
  .star-pip { font-size: 18px; top: -11px; }
  #rivalPanel { flex-direction: column; gap: 4px; }
  #rivalLabel { display: none; }
  .rival-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 6px; padding-bottom: 2px; }
  .rival { flex: 0 0 auto; min-width: 150px; padding: 6px 8px; }
  .solo-info { display: none; }
  .hud-clock { font-size: 20px; padding: 2px 8px; }
  .icon-btn { width: 36px; height: 36px; flex-basis: 36px; font-size: 16px; }
  .multi-cols { grid-template-columns: 1fr; }
  .map-grid { grid-template-columns: repeat(4, 1fr); }
  .help-grid { grid-template-columns: 1fr; }
  .card { padding: 16px 14px 14px; }
  .prism-title { font-size: 36px; }
  .hub-head { justify-content: center; }
  .coach { font-size: 14px; }
}
@media (max-width: 420px) {
  .map-grid { grid-template-columns: repeat(3, 1fr); }
  .hub-actions .ghost { padding: 8px 10px; font-size: 13px; }
  .end-stars { font-size: 44px; }
}
