/* EverTile -- the Everlyce POS design language, applied to a music tile game.
 *
 * Same tokens as Everriddle and the POS app: the grey page, white cards,
 * 12px radius, the blue accent, the badge/button/stat vocabulary. Nothing is
 * dark; the game is a light board with coloured tiles.
 */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e6e8ec;
  --border-2: #d7dbe1;
  --ink: #20242b;
  --ink-2: #414852;
  --muted: #737b87;
  --accent: #3563b8;
  --accent-strong: #294f98;
  --accent-soft: #edf2fa;
  --accent-softer: #f5f7fb;
  --green: #278252;
  --green-soft: #eaf4ee;
  --red: #bf4c46;
  --red-soft: #f9eeed;
  --amber: #ae721f;
  --amber-soft: #faf3e8;
  --shadow-sm: 0 1px 2px rgba(26, 35, 48, 0.035);
  --shadow: 0 2px 8px rgba(26, 35, 48, 0.045);
  --shadow-lg: 0 18px 48px -22px rgba(18, 27, 42, 0.28);
  --radius: 12px;
  --radius-sm: 8px;
  --green-brand: #17b978;
  --t0: #3563b8;
  --t1: #1f7a5c;
  --t2: #9a6a12;
  --t3: #a8462f;
  --t4: #5b4694;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(47, 122, 212, 0.09), transparent 60%),
    radial-gradient(900px 500px at 100% 10%, rgba(29, 58, 107, 0.06), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
a {
  color: var(--accent);
  text-decoration: none;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.025em;
}
button {
  font-family: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
::selection {
  background: #d6e3f6;
}

/* ---------- boot ---------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 200;
}
.boot-inner {
  text-align: center;
  color: var(--muted);
}
.boot-mark {
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: boot-pulse 1.6s ease-in-out infinite;
}
@keyframes boot-pulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* ---------- layout ---------- */

.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 18px;
}
.brand .brand-mark {
  display: block;
  flex-shrink: 0;
}
.brand .brand-mark svg {
  display: block;
  border-radius: 9px;
}
.brand .titles {
  line-height: 1.15;
  min-width: 0;
}
.brand .titles strong {
  display: block;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.brand .titles span {
  font-size: 11px;
  color: var(--muted);
}
.brand .titles span .prod {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.nav {
  flex: 1;
  padding: 4px 12px 14px;
  overflow-y: auto;
}
.nav .nav-group {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 19px 12px 7px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  color: #4b535f;
  font-size: 13.5px;
  font-weight: 540;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover {
  background: var(--accent-softer);
  color: var(--ink);
}
.nav a.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}
.foot {
  border-top: 1px solid var(--border);
  padding: 14px 18px 18px;
}
.foot-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--muted);
  padding: 3px 0;
}
.foot-row b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.foot-note {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
}

.main {
  flex: 1;
  min-width: 0;
}
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 34px 60px;
}

/* ---------- generic bits ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border-radius: 9px;
  border: 1px solid var(--border-2);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.btn:hover {
  background: var(--accent-softer);
  border-color: #c3ccd9;
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: linear-gradient(135deg, #1d3a6b, #2f7ad4);
  border-color: #24457f;
  color: #fff;
}
.btn.primary:hover {
  background: linear-gradient(135deg, #1a3360, #2b6fc4);
}
.btn.big {
  height: 46px;
  padding: 0 26px;
  font-size: 15px;
  border-radius: 11px;
}
.btn.danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #efc9c6;
}
.btn.danger:hover {
  background: #f5e2e0;
}
.btn.small {
  padding: 6px 10px;
  font-size: 12px;
  min-height: 30px;
}
.btn.ghost {
  background: transparent;
}
.btn.wide {
  width: 100%;
}
.back {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.back:hover {
  color: var(--accent);
}
.eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.grad {
  background: linear-gradient(120deg, #1d3a6b, #2f7ad4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.section-title {
  font-size: 15px;
  margin: 30px 0 14px;
}
.page-head {
  margin-bottom: 22px;
}
.page-head h1 {
  font-size: 27px;
}
.page-sub {
  color: var(--muted);
  font-size: 13px;
}
.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
}

/* ---------- home ---------- */

.hero {
  display: flex;
  gap: 36px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 36px;
  box-shadow: var(--shadow);
}
.hero-copy {
  flex: 1;
  min-width: 0;
}
.hero h1 {
  font-size: 32px;
  line-height: 1.18;
  margin-bottom: 12px;
}
.hero p {
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0 0 20px;
}
.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-mark {
  flex-shrink: 0;
}
.hero-mark svg {
  display: block;
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.stat-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.03em;
}
.stat-note {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- library ---------- */

.library-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.search {
  flex: 1;
  min-width: 220px;
  height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--border-2);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink);
}
.search:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover {
  border-color: #c3ccd9;
}
.chip.on {
  background: var(--accent-soft);
  border-color: #c9d8ef;
  color: var(--accent-strong);
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px;
}
.song-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 16px 13px;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.song-card:hover {
  border-color: #c9d8ef;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.song-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.diff {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.diff-easy {
  background: var(--green-soft);
  color: var(--green);
}
.diff-normal {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.diff-hard {
  background: var(--amber-soft);
  color: var(--amber);
}
.lic {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.new-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}
.song-title {
  font-size: 15px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-artist {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-artist.big {
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.song-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px;
}
.key-badge,
.kv-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
}
.stars {
  letter-spacing: 1px;
  font-size: 13px;
  color: #d4d8de;
  font-style: normal;
}
.stars i {
  font-style: normal;
}
.stars i.on {
  color: #e0a92a;
}
.stars.big {
  font-size: 20px;
}
.stars.huge {
  font-size: 34px;
  letter-spacing: 4px;
  margin: 10px 0 4px;
}

/* ---------- song page ---------- */

.song-hero {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.song-hero-copy {
  flex: 1;
  min-width: 240px;
}
.song-hero-copy h1 {
  font-size: 28px;
  margin-bottom: 2px;
}
.song-hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.kv-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.kv {
  font-size: 12.5px;
  color: var(--muted);
}
.kv b {
  color: var(--ink);
  font-weight: 650;
}
.howto,
.credit-card {
  padding: 18px 20px;
  margin-top: 16px;
}
.howto h3,
.credit-card h3 {
  font-size: 14px;
  margin-bottom: 8px;
}
.howto ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-2);
}
.howto li {
  margin: 4px 0;
}
.credit-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 12.5px;
  word-break: break-word;
}

/* ---------- credits ---------- */

.credits-group {
  margin-top: 24px;
}
.credits-list {
  background:
    linear-gradient(180deg, #fbfcfe 0%, #f3f6fb 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.credit-row {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.credit-row:last-child {
  border-bottom: 0;
}
.credit-title {
  font-weight: 600;
  flex-shrink: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.credit-artist {
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.credit-link {
  font-size: 12px;
  flex-shrink: 0;
}

/* ---------- stats ---------- */

.table-card {
  margin-top: 18px;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
}
.table tr:last-child td {
  border-bottom: 0;
}
.stars-cell {
  width: 90px;
}

/* ---------- the board ---------- */

.game {
  display: flex;
  flex-direction: column;
  /* The small viewport height: it does not change when the browser's
     toolbar slides away, so the board keeps its size and the tiles do not
     jump in the middle of a song. */
  min-height: min(100vh, 100svh);
  padding: 18px 26px 26px;
  /* A phone must not select the words under the finger, and must not zoom
     the board with a double tap. The board itself takes no gestures at all
     (see .board); the rest of the view may still be scrolled, so the panel
     below it can be reached. */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.game-head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 14px;
}
.game-head .back {
  margin: 0;
  flex-shrink: 0;
}
.game-title {
  flex: 1;
  min-width: 0;
}
.game-title h1 {
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-title span {
  font-size: 12.5px;
  color: var(--muted);
}
.game-stats {
  display: flex;
  gap: 22px;
  flex-shrink: 0;
}
.game-stats .stat {
  text-align: right;
  min-width: 64px;
}
.game-stats .stat b {
  display: block;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.game-stats .stat span {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-body {
  flex: 1;
  display: flex;
  gap: 24px;
  align-items: stretch;
  min-height: 0;
}
.board-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.board {
  width: min(480px, 100%);
  aspect-ratio: 4 / 5.6;
  max-height: calc(min(100vh, 100svh) - 120px);
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.lane {
  position: absolute;
  inset: 0;
}
.lanes {
  position: absolute;
  inset: 0;
  display: flex;
}
.lane-col {
  flex: 1;
  border-right: 1px solid var(--border);
}
.lane-col:last-child {
  border-right: 0;
}
.tiles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hitline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(53, 99, 184, 0.15), rgba(53, 99, 184, 0.6), rgba(53, 99, 184, 0.15));
}
.tile {
  position: absolute;
  top: 0;
  left: 0;
  width: 25%;
  height: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 10px rgba(18, 27, 42, 0.16);
  will-change: transform;
}
.tile span {
  line-height: 1;
}
.tile.t0 {
  background: var(--t0);
}
.tile.t1 {
  background: var(--t1);
}
.tile.t2 {
  background: var(--t2);
}
.tile.t3 {
  background: var(--t3);
}
.tile.t4 {
  background: var(--t4);
}
.tile.due {
  filter: brightness(1.12);
}
.tile.hit {
  transform-origin: center;
  animation: tile-pop 0.22s ease-out forwards;
}
.tile.hit.perfect {
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.85);
}
.tile.hit.good {
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.45);
}
/* Late or early is still a hit: amber, not the red of a mistake. */
.tile.hit.late {
  box-shadow: 0 0 0 3px rgba(199, 143, 41, 0.7);
}
.tile.miss {
  opacity: 0.28;
  filter: grayscale(0.7);
  transition: opacity 0.25s ease;
}
.tile.dropped {
  opacity: 0.28;
  filter: grayscale(0.7);
}

/* A hold: the head is tapped, the tail is held down until it is gone. */
.tile.hold {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}
.hold-tail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 0;
  border-radius: 10px 10px 0 0;
  opacity: 0.42;
  border-top: 2px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
.tile.t0 .hold-tail {
  background: var(--t0);
}
.tile.t1 .hold-tail {
  background: var(--t1);
}
.tile.t2 .hold-tail {
  background: var(--t2);
}
.tile.t3 .hold-tail {
  background: var(--t3);
}
.tile.t4 .hold-tail {
  background: var(--t4);
}
.tile.holding {
  filter: brightness(1.16);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.55), 0 3px 10px rgba(18, 27, 42, 0.16);
}
.tile.holding .hold-tail {
  opacity: 0.7;
}
@keyframes tile-pop {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

.combo-badge {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d3a6b, #2f7ad4);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.combo-badge.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* The speed bar under the board. It is the one control a player reaches for
   in the middle of a run, so it sits with the board rather than in the side
   column, and it says out loud whether the run will be saved. */
.speed-live {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 5px 10px 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  -webkit-user-select: none;
  user-select: none;
}
.speed-live-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.speed-live .speed-value {
  min-width: 54px;
  text-align: center;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.speed-live .speed-step {
  height: 30px;
  padding: 0;
  width: 32px;
  font-size: 16px;
  line-height: 1;
}
.speed-state {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.speed-chips .chip {
  min-width: 52px;
}
.speed-note {
  max-width: 620px;
}
.result-practice {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.flash {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  border: 3px solid transparent;
}

.game-side {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.side-card {
  padding: 14px 16px;
}
.side-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
}
.side-row b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.side-note {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* the timing offset on the song page */
.offset-card {
  padding: 16px 18px;
  margin-top: 18px;
}
.offset-value {
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.offset-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.offset-row .btn {
  padding: 6px 12px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.result-timing {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.result-timing a {
  color: var(--accent);
}
.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-top: 10px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1d3a6b, #2f7ad4);
  transition: width 0.12s linear;
}
.switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease;
}
.switch.on {
  background: var(--accent);
  border-color: var(--accent-strong);
}
.switch.on::after {
  transform: translateX(16px);
}

/* ---------- loading ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(245, 246, 248, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
  /* The screen is a message, not a wall: taps go through to the board. */
  pointer-events: none;
}
.loader.in {
  opacity: 1;
}
.loader-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px 32px 26px;
  text-align: center;
  transform: translateY(8px);
  transition: transform 0.24s ease;
}
.loader.in .loader-card {
  transform: translateY(0);
}
.loader-mark {
  display: inline-block;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: boot-pulse 1.6s ease-in-out infinite;
}
.loader-mark svg {
  display: block;
  border-radius: 14px;
}
.loader-title {
  font-size: 19px;
  margin-top: 18px;
}
.loader-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}
.loader-bar {
  height: 6px;
  margin: 22px 0 9px;
  background: var(--accent-soft);
  border-radius: 99px;
  overflow: hidden;
}
.loader-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #1d3a6b, #2f7ad4);
  transition: width 0.18s ease;
}
.loader-bar.indeterminate > i {
  width: 38%;
  animation: loader-slide 1.1s ease-in-out infinite;
}
@keyframes loader-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(300%);
  }
}
.loader-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.loader-song {
  margin: 16px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}
.loader-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  z-index: 160;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  box-shadow: var(--shadow-lg);
  color: var(--ink-2);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.toast.in {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast a {
  font-weight: 600;
  pointer-events: auto;
}

/* ---------- result ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 36, 43, 0.42);
  display: grid;
  place-items: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.22s ease;
  padding: 20px;
}
.overlay.in {
  opacity: 1;
}
.result {
  width: min(460px, 100%);
  padding: 30px 32px;
  text-align: center;
  transform: translateY(10px);
  transition: transform 0.22s ease;
  box-shadow: var(--shadow-lg);
}
.overlay.in .result {
  transform: translateY(0);
}
.result h2 {
  font-size: 22px;
}
.result .song-artist {
  font-size: 13px;
}
.result-reason {
  margin: 12px auto 0;
  max-width: 320px;
  padding: 9px 14px;
  border-radius: var(--radius);
  background: var(--red-soft, rgba(191, 76, 70, 0.08));
  color: var(--red, #bf4c46);
  font-size: 13px;
  font-weight: 600;
}
.result.failed h2 {
  color: var(--ink);
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 22px;
}
.result-stats .stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 12px 10px;
}
.result-stats .stat-value {
  font-size: 20px;
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ---------- narrow screens ---------- */

@media (max-width: 860px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .brand {
    padding: 0 8px 0 0;
  }
  .nav {
    display: flex;
    gap: 4px;
    padding: 0;
    align-items: center;
  }
  .nav .nav-group {
    display: none;
  }
  .nav a {
    padding: 7px 10px;
    white-space: nowrap;
  }
  .foot {
    display: none;
  }
  .page {
    padding: 22px 18px 48px;
  }
  .hero {
    padding: 24px 22px;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 20px;
  }
  .hero h1 {
    font-size: 25px;
  }
  .hero-mark svg {
    width: 96px;
    height: 96px;
  }
  .game {
    padding: 12px 12px 20px;
  }
  .game-head {
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
  }
  .game-head .back {
    order: -1;
    margin: 0;
  }
  .game-title {
    order: -2;
    flex: 1 1 100%;
  }
  .game-title h1 {
    font-size: 17px;
  }
  .game-title span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .game-stats {
    flex: 1 1 100%;
    justify-content: space-between;
    gap: 0;
  }
  .game-stats .stat {
    text-align: left;
    min-width: 0;
  }
  .game-body {
    flex-direction: column;
  }
  .game-side {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .game-side > * {
    flex: 1;
    min-width: 190px;
  }
  .board {
    max-height: calc(100svh - 180px);
  }
}

/* ---------- the player, the wallet and the shop ---------- */

.player-slot {
  padding: 2px 14px 6px;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.player-chip:hover {
  border-color: #c9d8ef;
  background: var(--accent-softer);
}
.player-chip .avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1d3a6b, #2f7ad4);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0;
}
.player-chip .avatar.big {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 16px;
}
.player-chip .who {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}
.player-chip .who b {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-chip .who span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}
.player-chip .wallet {
  font-size: 11.5px;
  font-weight: 700;
  color: #9a6a12;
  background: var(--amber-soft);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.player-chip.guest .avatar {
  background: #eef0f3;
  color: var(--muted);
}

.wallet-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #9a6a12;
  background: var(--amber-soft);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.price-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #9a6a12;
  background: var(--amber-soft);
  border: 1px solid #efdfc2;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.song-card.locked {
  border-style: dashed;
  background: #fdfdfe;
}
.song-card.locked .song-title {
  color: var(--ink-2);
}
.price-note {
  font-size: 10.5px;
  color: var(--muted);
}
.unlock-note {
  margin-top: 8px;
  max-width: 220px;
}

/* ---------- the first-visit card ---------- */

.welcome-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  margin-bottom: 20px;
  border-color: #cddcf2;
  background: linear-gradient(180deg, #fbfcfe, #f5f8fd);
}
.welcome-mark svg {
  display: block;
  border-radius: 11px;
  box-shadow: var(--shadow);
}
.welcome-body {
  flex: 1;
  min-width: 0;
}
.welcome-body h3 {
  font-size: 15px;
  margin-bottom: 3px;
}
.welcome-row {
  display: flex;
  gap: 8px;
  margin: 10px 0 0;
  max-width: 460px;
}
.welcome-row .welcome-input {
  flex: 1;
  min-width: 0;
}
.welcome-note {
  margin: 7px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.welcome-note.bad {
  color: var(--red);
  font-weight: 600;
}
.welcome {
  width: min(480px, 100%);
  padding: 28px 30px;
  text-align: left;
}
.welcome h2 {
  font-size: 21px;
}
.welcome-copy {
  margin: 8px 0 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.welcome .welcome-input {
  width: 100%;
  margin-bottom: 2px;
}
.welcome .btn.primary {
  width: 100%;
  margin-top: 12px;
}
.welcome-skip {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- 1v1 ---------- */

.duel-card {
  padding: 18px 20px;
  margin-top: 18px;
}
.duel-card h3 {
  font-size: 15px;
}
.duel-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  max-width: 480px;
}
.duel-form .duel-input {
  flex: 1;
  min-width: 0;
}
.duel-hint {
  min-height: 17px;
  margin: 8px 0 10px;
  font-size: 12px;
  color: var(--muted);
}
.duel-hint:empty {
  margin: 0;
}

.result-duel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 4px 0 10px;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.duel-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
}
.duel-side span {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duel-side b {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.duel-vs {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.duel-outcome {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent-strong);
}
.result-award {
  margin: 10px 0 2px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: #8a5c14;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.result-award.on {
  opacity: 1;
}
.result-handover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.duel-panel {
  padding: 20px 22px;
  margin-bottom: 18px;
}
.who-row {
  display: flex;
  align-items: center;
  gap: 11px;
}
.who-row b {
  display: block;
  font-size: 15px;
}
.who-row .page-sub {
  margin: 0;
  font-size: 11.5px;
}
.duel-empty,
.duel-pass {
  padding: 20px 22px;
  margin-top: 16px;
}
.duel-empty h3,
.duel-pass h3 {
  margin-bottom: 6px;
  font-size: 15px;
}
.duel-empty .btn,
.duel-pass .btn {
  margin-top: 12px;
}
.duel-results {
  margin-bottom: 18px;
}
.duel-scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 12px;
  text-align: center;
}
.duel-scoreboard .duel-side b {
  font-size: 15px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duel-scoreboard .duel-side .page-sub {
  margin: 2px 0 0;
  font-size: 11.5px;
}
.duel-scoreboard .duel-side.right {
  align-items: flex-end;
}
.duel-scoreboard .duel-side.right .page-sub {
  text-align: right;
}
.duel-tally b {
  display: block;
  font-size: 26px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.duel-tally span {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.duel-table td,
.duel-table th {
  font-size: 12.5px;
}
.duel-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.verdict {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.verdict.win {
  background: var(--green-soft);
  color: var(--green);
}
.verdict.loss {
  background: var(--red-soft);
  color: var(--red);
}
.duel-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.player-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.player-pick:hover {
  border-color: #c9d8ef;
  box-shadow: var(--shadow);
}
.player-pick .avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 13px;
}
.player-pick .who {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.player-pick .who b {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-pick .who span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.player-pick .pick-go {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--accent);
  white-space: nowrap;
}

@media (max-width: 860px) {
  .player-slot {
    padding: 0 8px 0 0;
    flex-shrink: 0;
  }
  .player-chip {
    width: auto;
    padding: 6px 9px;
  }
  .player-chip .who {
    display: none;
  }
  .player-chip .wallet {
    display: inline-block;
  }
  .welcome-card {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }
  .welcome-card .welcome-mark {
    display: none;
  }
  .welcome-row {
    flex-direction: column;
  }
  .welcome-row .btn {
    width: 100%;
  }
  .duel-scoreboard {
    padding: 14px 12px;
    gap: 6px;
  }
  .duel-scoreboard .duel-side b {
    font-size: 12.5px;
    max-width: 90px;
  }
  .duel-scoreboard .duel-side .page-sub {
    display: none;
  }
  .duel-tally b {
    font-size: 20px;
  }
  .duel-form {
    flex-direction: column;
  }
  .duel-form .btn {
    width: 100%;
  }
}

/* ---------- run progress and play background ---------- */

.run-progress {
  position: relative;
  height: 22px;
  margin: 0 0 10px;
  border-radius: 999px;
  background: #eef1f6;
  border: 1px solid var(--border);
  overflow: hidden;
}
.run-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, #2f7ad4, #3ddc97);
  transition: width 0.25s ease;
}
.run-progress-stars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 11px;
  color: rgba(29, 58, 107, 0.45);
  pointer-events: none;
  letter-spacing: 0.5em;
}
.run-progress-label {
  position: absolute;
  right: 10px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-2);
  pointer-events: none;
}

.game-bg {
  position: relative;
}
.game-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}
.game-bg .game-head,
.game-bg .run-progress,
.game-bg .game-body {
  position: relative;
  z-index: 1;
}
.game-bg-easy .game-bg-layer {
  background:
    radial-gradient(ellipse at 20% 100%, rgba(47, 122, 212, 0.28), transparent 60%),
    radial-gradient(ellipse at 80% 0%, rgba(61, 220, 151, 0.18), transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(29, 58, 107, 0.08), transparent 70%);
  animation: drift 6s ease-in-out infinite alternate;
}
.game-bg-normal .game-bg-layer {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(29, 58, 107, 0.22), transparent 65%),
    radial-gradient(ellipse at 10% 20%, rgba(47, 122, 212, 0.14), transparent 50%),
    radial-gradient(ellipse at 90% 30%, rgba(91, 70, 148, 0.12), transparent 50%);
  animation: drift 7s ease-in-out infinite alternate;
}
.game-bg-hard .game-bg-layer {
  background:
    radial-gradient(ellipse at 25% 100%, rgba(255, 90, 30, 0.55), transparent 55%),
    radial-gradient(ellipse at 75% 100%, rgba(255, 160, 40, 0.45), transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(255, 220, 100, 0.3), transparent 60%),
    radial-gradient(ellipse at 50% 0%, rgba(120, 30, 10, 0.25), transparent 70%);
  animation: fire 1.4s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { filter: hue-rotate(0deg); transform: scale(1); }
  100% { filter: hue-rotate(8deg); transform: scale(1.04); }
}
@keyframes fire {
  0% { filter: hue-rotate(0deg) brightness(1); transform: scaleY(1); }
  100% { filter: hue-rotate(-12deg) brightness(1.15); transform: scaleY(1.06); }
}

/* ---------- mobile drawer, fullscreen play, pause, notifications ---------- */

.menu-toggle {
  display: none;
}
.menu-backdrop {
  display: none;
}
.notif-bell {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.notif-badge.on {
  display: flex;
}
.notif-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.notif-close:hover { background: var(--surface-2); color: var(--ink); }
.notif-panel {
  position: fixed;
  top: 60px;
  left: 12px;
  /* anchored to the bell in the sidebar */
  width: min(360px, calc(100vw - 24px));
  max-height: 60vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 60;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.notif-panel.in {
  opacity: 1;
  transform: translateY(0);
}
.notif-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 4px;
}
.notif-item {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child {
  border-bottom: 0;
}
.notif-title {
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 2px;
}
.notif-body {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.notif-actions {
  display: flex;
  gap: 8px;
}
.pause-card {
  width: min(360px, 100%);
  text-align: center;
}
.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.pause-btn {
  margin-left: auto;
}

@media (max-width: 860px) {
  .menu-toggle {
    display: grid;
    place-items: center;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 55;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow);
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100svh;
    width: 280px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 50;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 12px;
    gap: 10px;
    background: #fff;
    box-shadow: 4px 0 24px rgba(18, 27, 42, 0.12);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar .brand {
    padding: 4px 6px 10px;
  }
  .sidebar .nav {
    flex-direction: column;
    gap: 2px;
    padding: 0;
  }
  .sidebar .nav a {
    width: 100%;
    padding: 10px 12px;
    white-space: normal;
  }
  .sidebar .player-slot {
    padding: 0 2px 6px;
  }
  .sidebar .player-chip {
    width: 100%;
  }
  .menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18, 27, 42, 0.35);
    z-index: 49;
  }
  .menu-backdrop.show {
    display: block;
  }
  body.playing .menu-toggle {
    display: none;
  }
  body.playing .sidebar {
    display: none;
  }
  body.playing .main {
    padding: 0;
  }
  body.playing .game {
    min-height: 100vh;
    min-height: 100svh;
    border-radius: 0;
    border: 0;
    padding: 8px 8px 16px;
  }
  body.playing .run-progress {
    margin-top: 4px;
  }
  .pause-btn {
    display: inline-flex;
  }
}

/* ---------- start gate and countdown ---------- */

.start-gate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 5;
  background: rgba(245, 246, 248, 0.55);
  backdrop-filter: blur(2px);
}
.start-btn {
  font-size: 18px;
  padding: 14px 44px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
}
.countdown {
  font-size: clamp(64px, 22vw, 96px);
  font-weight: 800;
  color: var(--accent-strong);
  letter-spacing: -0.04em;
  text-shadow: 0 4px 18px rgba(47, 122, 212, 0.35);
  animation: countdownPop 0.35s ease;
}
@keyframes countdownPop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .game-bg-layer {
    animation: none !important;
  }
}

/* ---------- daily challenge & combo juice ---------- */

.daily-card {
  padding: 20px 22px;
  margin-bottom: 20px;
  border-color: #cddcf2;
  background: linear-gradient(135deg, #f5f8fd 0%, #eef4fb 100%);
}
.daily-card h3 {
  font-size: 18px;
  margin: 4px 0 2px;
}
.daily-card .btn {
  margin-top: 12px;
}
.combo-badge.pop {
  animation: comboPop 0.4s ease;
}
@keyframes comboPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); color: #278252; }
  100% { transform: scale(1); }
}
