:root {
  --bg: #fff7e6;
  --surface: #fffdf6;
  --surface-2: #fff1cf;
  --ink: #2b2417;
  --ink-2: #6c5f44;
  --muted: #a08d63;
  --accent: #f0a500;
  --accent-2: #e08900;
  --danger: #d9374f;
  --good: #4caf50;
  --shadow: 0 8px 24px rgba(60, 40, 0, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --region-tint: 240, 165, 0;
}

body.theme-dark {
  --bg: #0e1424;
  --surface: #161e36;
  --surface-2: #1d2748;
  --ink: #eef3ff;
  --ink-2: #b8c3df;
  --muted: #7c87a8;
  --accent: #58e3ff;
  --accent-2: #28c1e8;
  --danger: #ff6675;
  --good: #6ddc8a;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --region-tint: 88, 227, 255;
}

body.theme-sunset {
  --bg: #2a1233;
  --surface: #3a1a44;
  --surface-2: #4a2256;
  --ink: #ffeede;
  --ink-2: #f3c4b4;
  --muted: #b09080;
  --accent: #ff8c42;
  --accent-2: #ff5e62;
  --danger: #ff3366;
  --good: #ffd166;
  --shadow: 0 8px 24px rgba(40, 10, 30, 0.55);
  --region-tint: 255, 140, 66;
}

body.theme-ocean {
  --bg: #04263d;
  --surface: #073a55;
  --surface-2: #0a4d6e;
  --ink: #e0f6ff;
  --ink-2: #a8d4e8;
  --muted: #6996b0;
  --accent: #00d4ff;
  --accent-2: #0099cc;
  --danger: #ff6b6b;
  --good: #66ffcc;
  --shadow: 0 8px 24px rgba(0, 20, 40, 0.55);
  --region-tint: 0, 212, 255;
}

body.theme-forest {
  --bg: #0e2818;
  --surface: #143a22;
  --surface-2: #1d4a2c;
  --ink: #eef7e8;
  --ink-2: #bfd9b2;
  --muted: #7da26a;
  --accent: #9ee37d;
  --accent-2: #6cc14a;
  --danger: #d96565;
  --good: #ffd23f;
  --shadow: 0 8px 24px rgba(10, 30, 15, 0.50);
  --region-tint: 158, 227, 125;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { background: linear-gradient(180deg, rgba(var(--region-tint), 0.10), transparent 240px) fixed, var(--bg); }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ---- Splash ---- */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 400ms ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
#splash-logo { width: 128px; height: 128px; }
#splash-title { font-size: 28px; font-weight: 800; margin-top: 16px; opacity: 0; animation: fadeUp 700ms 250ms forwards; }
#splash-tag {
  font-size: 16px; font-weight: 800; font-style: italic;
  color: var(--accent-2); letter-spacing: 0.08em;
  margin-top: 6px; opacity: 0; animation: fadeUp 700ms 450ms forwards;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Layout ---- */
#app { min-height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: 0 14px env(safe-area-inset-bottom, 0); }
.screen { display: flex; flex-direction: column; gap: 14px; padding: 14px 0 32px; }

.header { display: flex; align-items: center; gap: 10px; padding-top: env(safe-area-inset-top, 8px); }
.header h1 { font-size: 22px; margin: 0; flex: 1; }
.header .back, .worlds-back {
  width: 46px; height: 40px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  filter: drop-shadow(0 4px 10px rgba(240, 165, 0, 0.30));
}
.header .back svg, .worlds-back svg { width: 14px; height: 14px; transform: translateX(-1px); }
.header .back:active, .worlds-back:active { transform: scale(0.95); }
.header .coin { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); font-weight: 700; }
.coin-dot { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, #ffd86b, #f0a500); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08); }

.surface { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.btn.primary { background: var(--accent); color: #1a1200; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { box-shadow: none; background: transparent; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn:active { transform: translateY(1px); }

.h2 { font-size: 18px; font-weight: 700; margin: 6px 0; }
.h3 { font-size: 15px; font-weight: 700; margin: 4px 0; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- Home (brand + PLAY + shortcuts) ---- */
.home-screen {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  padding:
    max(20px, env(safe-area-inset-top)) 18px
    max(20px, env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.home-brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  margin-top: 4vh;
}
.home-brand-logo {
  width: 124px; height: 124px; border-radius: 28px;
  box-shadow: 0 16px 36px rgba(240, 165, 0, 0.25), 0 4px 14px rgba(0,0,0,0.30);
  margin-bottom: 8px;
}

.home-play-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 14px;
  width: 84%; max-width: 360px;
  padding: 26px 32px;
  background:
    radial-gradient(circle at 85% 25%, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
  border: 0; border-radius: 999px;
  box-shadow: 0 18px 40px rgba(240, 165, 0, 0.40);
  font-size: 28px; font-weight: 900; letter-spacing: 0.12em;
}
.home-play-btn:active { transform: translateY(2px); box-shadow: 0 8px 18px rgba(240, 165, 0, 0.30); }
.home-play-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: #1a1200; color: var(--accent);
  border-radius: 50%;
  font-size: 16px;
}
.home-play-label { line-height: 1; }

.home-settings-btn {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  width: 46px; height: 40px;
  border: 0; padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  filter: drop-shadow(0 4px 10px rgba(240, 165, 0, 0.30));
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: transform 220ms;
}
.home-settings-btn svg { width: 18px; height: 18px; }
.home-settings-btn:active { transform: scale(0.94) rotate(30deg); }

.home-shortcuts {
  display: flex; align-items: flex-end; justify-content: space-around;
  width: 100%;
  gap: 12px;
  margin-bottom: 1vh;
}
.home-shortcut {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  background: transparent; border: 0;
  padding: 4px 12px;
}
.home-shortcut:active { transform: translateY(1px); }
.home-shortcut-hex {
  width: 58px; height: 52px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  filter: drop-shadow(0 6px 14px rgba(240, 165, 0, 0.30));
}
.home-shortcut-label {
  font-size: 11px; font-weight: 800;
  color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.12em;
}

.home-topbar { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--ink-2);
  border: 0;
}
.icon-btn:active { transform: translateY(1px); }
.hex-mini {
  width: 30px; height: 26px; opacity: 0.55;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.home-hero {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; text-align: center;
  margin-top: 2px;
}
.home-wordmark {
  font-size: 52px; font-weight: 900; letter-spacing: -0.03em;
  margin: 0; line-height: 1;
}
.home-wordmark .wm-accent { color: var(--accent); }
.home-tag {
  font-size: 16px; font-weight: 800; font-style: italic;
  color: var(--accent-2); letter-spacing: 0.08em;
  margin-top: 6px;
}
body.theme-dark .home-tag { color: var(--accent); }

.hex-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-top: 4px;
}
.hex-stat { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hex-stat-shape {
  width: 78px; height: 70px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0% 50%);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  filter: drop-shadow(0 4px 10px rgba(60, 40, 0, 0.12));
}
body.theme-dark .hex-stat-shape {
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.45));
}
.hex-stat-num {
  font-size: 22px; font-weight: 900; color: var(--accent);
  letter-spacing: -0.02em;
}
.hex-stat-label {
  font-size: 9.5px; font-weight: 800; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.16em;
}

.play-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 18px 18px;
  background:
    radial-gradient(circle at 88% 22%, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
  border: 0; border-radius: 22px;
  box-shadow: 0 14px 30px rgba(240, 165, 0, 0.32);
  text-align: left;
  position: relative; overflow: hidden;
  margin-top: 6px;
}
.play-card::before {
  content: ""; position: absolute; left: -30px; bottom: -50px;
  width: 140px; height: 122px;
  background: rgba(26, 18, 0, 0.10);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  pointer-events: none;
}
.play-card:active { transform: translateY(1px); }
.pc-left { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pc-kicker { font-size: 10.5px; font-weight: 800; letter-spacing: 0.20em; opacity: 0.72; }
.pc-title  { font-size: 28px;  font-weight: 900; letter-spacing: -0.02em; line-height: 1; margin-top: 2px; }
.pc-sub    { font-size: 12px;  font-weight: 600; opacity: 0.78; margin-top: 4px; }
.pc-play {
  width: 56px; height: 50px;
  background: #1a1200; color: var(--accent);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  flex-shrink: 0;
}
.pc-play-arrow { transform: translateX(2px); }

.hex-menu { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.hex-row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 10px 16px 10px 10px;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow);
  border: 0; text-align: left; color: var(--ink);
}
.hex-row:active { transform: translateY(1px); }
.hex-row-icon {
  width: 50px; height: 44px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
  flex-shrink: 0;
}
.hex-row-label {
  flex: 1; font-size: 13px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink);
}
.hex-row-chev {
  font-size: 22px; color: var(--muted); line-height: 1;
}

/* ---- Worlds hub (stats + continue + region tiles + shortcuts) ---- */
.hub-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.hub-stat {
  background: var(--surface); border-radius: 14px;
  padding: 10px 6px; text-align: center; box-shadow: var(--shadow);
}
.hub-stat-num {
  font-size: 20px; font-weight: 900; color: var(--accent);
  letter-spacing: -0.02em; line-height: 1;
}
.hub-stat-label {
  font-size: 10px; font-weight: 800; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.14em;
  margin-top: 6px;
}

.hub-continue {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px;
  background:
    radial-gradient(circle at 88% 22%, rgba(255,255,255,0.30), transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
  border: 0; border-radius: 18px;
  box-shadow: 0 10px 22px rgba(240, 165, 0, 0.28);
  text-align: left;
}
.hub-continue:active { transform: translateY(1px); }
.hub-continue-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  background: #1a1200; color: var(--accent);
  border-radius: 50%;
  font-size: 16px; flex-shrink: 0;
}
.hub-continue-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hub-continue-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.18em; opacity: 0.72; }
.hub-continue-where { font-size: 18px; font-weight: 900; letter-spacing: -0.01em; }

.hub-shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.hub-shortcut {
  padding: 12px 14px;
  background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow); border: 0;
  font-weight: 800; font-size: 13px; color: var(--ink);
  letter-spacing: 0.10em; text-transform: uppercase;
}
.hub-shortcut:active { transform: translateY(1px); }

/* ---- Stats screen ---- */
.stats-screen {
  display: flex; flex-direction: column;
  gap: 14px; padding-bottom: 28px;
}
.stats-screen .stats-hero { margin-top: 6px; }

/* ---- Section labels (used in stats + settings) ---- */
.section-label {
  font-size: 11px; font-weight: 800; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.16em;
  margin: 14px 4px 4px;
}

/* ---- Stats screen ---- */
.stats-hero {
  position: relative;
  padding: 20px 22px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 85% 25%, rgba(255,255,255,0.30), transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
  box-shadow: 0 14px 30px rgba(240, 165, 0, 0.30);
}
.stats-hero-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; opacity: 0.72;
}
.stats-hero-row { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.stats-hero-num { font-size: 46px; font-weight: 900; letter-spacing: -0.02em; line-height: 1; }
.stats-hero-total { font-size: 14px; font-weight: 700; opacity: 0.75; }
.stats-progress {
  margin-top: 12px;
  height: 8px; border-radius: 999px;
  background: rgba(26, 18, 0, 0.25); overflow: hidden;
}
.stats-progress-fill { height: 100%; background: #1a1200; border-radius: 999px; }
.stats-hero-sub { margin-top: 8px; font-size: 12px; font-weight: 600; opacity: 0.78; }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.stat-card {
  position: relative;
  background: var(--surface); border-radius: 18px;
  padding: 18px 12px 14px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute; inset: -40% -40% auto auto;
  width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(var(--region-tint), 0.55), transparent 65%);
  pointer-events: none;
}
.stat-card-glyph {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 12px rgba(240, 165, 0, 0.32);
  position: relative;
}
.stat-card-glyph svg { width: 20px; height: 20px; }
.stat-card-value {
  font-size: 22px; font-weight: 900;
  color: var(--ink); line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.stat-card-label {
  font-size: 10px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.stat-card-sub {
  font-size: 10px; font-weight: 800;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  margin-top: -2px;
}
body.theme-dark .stat-card-sub { color: var(--accent); }
.stats-lives-card { cursor: pointer; }
.stats-lives-card:active { transform: scale(0.97); }

/* Hero panel split into two columns - Levels cleared on the left,
   Trophies on the right. Stack vertically on very narrow screens. */
.stats-hero-split {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
}
.stats-hero-col { display: flex; flex-direction: column; min-width: 0; }
.stats-hero-col-right { align-items: flex-end; text-align: right; }
.stats-hero-trophies-row { gap: 8px; }
.stats-hero-trophy-icon {
  display: inline-flex; line-height: 0; color: #1a1200;
}
.stats-hero-trophy-icon svg { width: 28px; height: 28px; }

.region-breakdown { display: flex; flex-direction: column; gap: 8px; }
.rp-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  grid-template-areas: "dot text meta" "dot bar bar";
  align-items: center;
  column-gap: 12px; row-gap: 6px;
  background: var(--surface); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.rp-row.locked { opacity: 0.5; }
.rp-dot { grid-area: dot; width: 10px; height: 10px; border-radius: 50%; }
.rp-text { grid-area: text; display: flex; flex-direction: column; gap: 1px; }
.rp-name { font-size: 14px; font-weight: 800; color: var(--ink); }
.rp-meta { grid-area: meta; font-size: 11px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.04em; }
.rp-bar {
  grid-area: bar; grid-column: 2 / span 2;
  height: 6px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.rp-bar-fill { height: 100%; border-radius: 999px; }

/* ---- Worlds screen (5 regions + daily card, single-screen) ---- */
.worlds-screen {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  padding:
    max(12px, env(safe-area-inset-top)) 16px
    max(14px, env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.worlds-header {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
}
/* Hex-shaped gold back button defined globally above; only grid width
   placeholder kept here so the worlds-header columns line up. */
.worlds-header { grid-template-columns: 46px 1fr 46px; }
.worlds-spacer { width: 46px; }
.worlds-title {
  text-align: center;
  font-size: 22px; font-weight: 900; letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}
.worlds-title-hex {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  position: relative;
}
.worlds-title-glyph {
  display: inline-flex; align-items: center;
  color: var(--accent-2);
  filter: drop-shadow(0 2px 5px rgba(240, 165, 0, 0.35));
}
body.theme-dark .worlds-title-glyph { color: var(--accent); }
.worlds-title-glyph svg { width: 22px; height: 22px; }
.worlds-title-hex::after {
  content: "";
  position: absolute;
  bottom: -6px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  opacity: 0.85;
}
.worlds-spacer { width: 42px; }

.help-btn {
  width: 46px; height: 40px;
  border: 0; padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: inline-flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 4px 10px rgba(240, 165, 0, 0.30));
  cursor: pointer;
  transition: transform 120ms;
}
.help-btn svg { width: 14px; height: 14px; }
.help-btn:active { transform: scale(0.94); }

.levels-title {
  display: flex; align-items: baseline; justify-content: center;
  gap: 8px;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
}
.lt-world { font-weight: 900; color: var(--accent-2); }
body.theme-dark .lt-world { color: var(--accent); }
.lt-sep { color: var(--muted); }
.lt-name {
  font-weight: 800; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis;
}

.worlds-daily {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 12px 16px;
  background:
    radial-gradient(circle at 88% 20%, rgba(255,255,255,0.30), transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
  border: 0; border-radius: 18px;
  box-shadow: 0 10px 24px rgba(240, 165, 0, 0.30);
  text-align: left;
}
.worlds-daily.done {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.worlds-daily:active { transform: translateY(1px); }
.wd-icon {
  width: 42px; height: 42px;
  background: rgba(26, 18, 0, 0.18);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
  flex-shrink: 0;
}
.worlds-daily.done .wd-icon {
  background: rgba(var(--region-tint), 0.18);
  color: var(--accent);
}
.wd-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wd-kicker {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.18em;
  text-transform: uppercase; opacity: 0.72;
}
.wd-sub { font-size: 14px; font-weight: 700; }
.wd-chev { font-size: 22px; opacity: 0.65; }

.worlds-list {
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0;
}
.worlds-tile {
  flex: 1;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border: 0; border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: left;
  min-height: 0;
}
.worlds-tile:active { transform: translateY(1px); }
.worlds-tile.locked { opacity: 0.55; }
.wt-num {
  width: 46px; height: 42px;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: #fff;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.18));
}
.wt-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wt-name-row { display: flex; align-items: baseline; gap: 8px; }
.wt-name { font-size: 15px; font-weight: 800; color: var(--ink); }
.wt-tier {
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.wt-progress { display: flex; align-items: center; gap: 8px; }
.wt-bar {
  flex: 1; height: 5px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.wt-bar-fill { height: 100%; border-radius: 999px; }
.wt-count { font-size: 10.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.wt-lock { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.wt-chev { font-size: 22px; color: var(--muted); line-height: 1; }

/* ---- Worlds (regions) — region cards ---- */
.region-list { display: flex; flex-direction: column; gap: 12px; }
.region-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px;
  border: 0; border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: left;
}
.region-card:active { transform: translateY(1px); }
.region-card.locked { opacity: 0.55; }
.rc-numhex {
  width: 64px; height: 58px;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 900; color: #ffffff;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.20));
}
.rc-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rc-name { font-size: 17px; font-weight: 800; color: var(--ink); line-height: 1; }
.rc-blurb { font-size: 12px; font-weight: 500; color: var(--ink-2); line-height: 1.3; }
.rc-meta { display: flex; gap: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin-top: 2px; }
.rc-tier { font-weight: 900; }
.rc-progress { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.rc-progress-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rc-progress-fill { height: 100%; border-radius: 999px; }
.rc-progress-text { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.rc-lock { font-size: 11px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.04em; }
.rc-chev { font-size: 24px; color: var(--muted); line-height: 1; padding-right: 4px; }

/* ---- World grid (10 worlds in one region, single-screen 2x5) ---- */
.world-screen {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  padding:
    max(12px, env(safe-area-inset-top)) 14px
    max(14px, env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.world-grid {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  gap: 8px;
}
.world-tile {
  position: relative;
  border: 0; border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 10px;
  display: flex; align-items: center; gap: 10px;
  text-align: left;
  min-height: 0; overflow: hidden;
}
.world-tile::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 90% 100%, rgba(var(--region-tint), 0.18), transparent 35%);
  pointer-events: none;
}
.world-tile:active { transform: translateY(1px); }
.world-tile.locked { opacity: 0.55; }
.world-tile.locked .wt-mini-hex svg { width: 18px; height: 18px; }
.world-tile.locked .wt-tlock {
  font-size: 10.5px; font-weight: 700; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.world-tile.complete { outline: 2px solid rgba(var(--region-tint), 0.6); }

.wt-mini-hex {
  width: 38px; height: 34px;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900; color: #fff;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
  z-index: 1;
}
.wt-info { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; z-index: 1; }
.wt-tname {
  font-size: 13px; font-weight: 800; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wt-tprogress { display: flex; align-items: center; gap: 6px; }
.wt-tbar { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.wt-tbar-fill { height: 100%; border-radius: 999px; }
.wt-tcount { font-size: 9.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.wt-tlock { font-size: 10px; font-weight: 700; color: var(--ink-2); }
.wt-check {
  position: absolute; top: 6px; right: 8px;
  font-size: 11px; font-weight: 900;
  color: var(--accent-2);
  z-index: 1;
}
body.theme-dark .wt-check { color: var(--accent); }
.lock-pill { display: inline-block; padding: 2px 8px; background: var(--surface-2); border-radius: 999px; font-size: 11px; }

/* ---- Levels screen (all 200 levels, scrollable, header fixed) ---- */
.levels-screen {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  padding:
    max(12px, env(safe-area-inset-top)) 14px
    max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Scroll container for the 200 tiles. Plain transparent — the tiles
   themselves carry the visual weight. */
.levels-screen .level-grid {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 2px 18px;
  -webkit-overflow-scrolling: touch;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 60px;
  gap: 8px;
}

.level-tile {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; border: 0;
  color: var(--ink);
  overflow: hidden;
  transition: transform 100ms;
}
.level-tile:active { transform: scale(0.94); }

/* Locked: muted, no shadow, dashed border to differentiate from cleared */
.level-tile.locked {
  opacity: 0.45;
  background: transparent;
  box-shadow: none;
  border: 1.5px dashed var(--surface-2);
  color: var(--muted);
}

/* Cleared: soft surface-2 background with a tiny check below the number */
.level-tile.cleared {
  background: var(--surface-2);
  color: var(--ink-2);
  box-shadow: 0 2px 6px rgba(60, 40, 0, 0.06);
}
/* Top-right tick badge on every cleared tile — coexists with the
   bottom PR time so the player sees both "I cleared this" and
   "my best time was X". */
.level-tile.cleared::after {
  content: "✓";
  position: absolute;
  top: 3px; right: 5px;
  font-size: 9px; font-weight: 900;
  color: var(--accent-2);
  line-height: 1;
}
body.theme-dark .level-tile.cleared::after { color: var(--accent); }
.level-tile.current::after { content: none; }
.level-tile-pr {
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  font-size: 8.5px; font-weight: 800;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  pointer-events: none;
}
body.theme-dark .level-tile-pr { color: var(--accent); }
.level-tile.current .level-tile-pr { color: rgba(26,18,0,0.78); }
.level-tile-num { line-height: 1; }

/* Current: prominent gold gradient with a glow ring so the player's eye
   lands on it immediately after the auto-scroll. */
.level-tile.current {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  box-shadow:
    0 0 0 3px rgba(240, 165, 0, 0.20),
    0 8px 18px rgba(240, 165, 0, 0.40);
  font-size: 17px;
  animation: currentPulse 2.4s ease-in-out infinite;
}
@keyframes currentPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.20), 0 8px 18px rgba(240, 165, 0, 0.40); }
  50%      { box-shadow: 0 0 0 6px rgba(240, 165, 0, 0.10), 0 10px 22px rgba(240, 165, 0, 0.55); }
}
.pager { display: flex; gap: 6px; flex-wrap: wrap; }
.pager .chip { padding: 6px 10px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; }
.pager .chip.active { background: var(--accent); color: #1a1200; }

/* ---- Pre-level / Power-ups ---- */
.preview-board { background: rgba(var(--region-tint), 0.10); border-radius: var(--radius); padding: 14px; }
.powerup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.powerup-card { padding: 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; position: relative; }
.powerup-card.on { outline: 2px solid var(--accent); }
.powerup-card .name { font-weight: 700; }
.powerup-card .desc { font-size: 12px; color: var(--ink-2); }
.powerup-card .price { font-size: 12px; color: var(--ink-2); }
.powerup-card .owned { position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--accent-2); font-weight: 700; }

/* ---- HUD / Game ---- */
.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow);
}
.hud-back {
  width: 42px; height: 36px;
  border: 0; padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: inline-flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 3px 8px rgba(240, 165, 0, 0.30));
  cursor: pointer;
}
.hud-back svg { width: 13px; height: 13px; transform: translateX(-1px); }
.hud-back:active { transform: scale(0.94); }
.hud-title {
  justify-self: center;
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 0;
}
.hud-title-world {
  font-weight: 900; font-size: 15px;
  color: var(--accent-2);
  letter-spacing: -0.01em;
}
body.theme-dark .hud-title-world { color: var(--accent); }
.hud-sep { color: var(--muted); font-size: 13px; }
.hud-title-level {
  font-weight: 800; font-size: 14px;
  color: var(--ink);
}
.hud-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px;
}
.hud-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 15px;
  color: var(--ink);
  padding: 4px 10px;
  background: var(--surface-2);
  border-radius: 999px;
  letter-spacing: 0.02em;
  transition: background 200ms, color 200ms;
}
.hud-lives-row { display: inline-flex; gap: 2px; }
.hud-life {
  display: inline-flex; align-items: center; justify-content: center;
  width: 10px; height: 10px;
  color: var(--muted); opacity: 0.45;
}
.hud-life.on { color: var(--ink); opacity: 1; }
.hud-life svg { width: 10px; height: 10px; }
.hud-timer.frozen {
  background: linear-gradient(135deg, #7cd1ff, #4ea8e0);
  color: #06243a;
  box-shadow: 0 0 0 2px rgba(126, 196, 240, 0.40), 0 4px 10px rgba(78, 168, 224, 0.40);
}
.hud-lives {
  display: inline-flex; gap: 3px; align-items: center;
  padding: 3px 8px;
  background: var(--surface-2);
  border-radius: 999px;
}
.hud-heart { display: inline-flex; line-height: 0; }
.hud-heart.full   { color: var(--ink); }
.hud-heart.empty  { color: var(--muted); opacity: 0.40; }
body.theme-dark .hud-heart.full { color: var(--ink); }

.hud-shield {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
}
.hud-shield svg { width: 16px; height: 16px; }
.hud-shield.armed {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  box-shadow: 0 3px 10px rgba(240, 165, 0, 0.40);
}
.hud-shield.spent { opacity: 0.45; text-decoration: line-through; }

.hud .pill { padding: 4px 10px; background: var(--surface-2); border-radius: 999px; font-weight: 700; font-size: 13px; }
.shield-pill {
  padding: 4px 10px; border-radius: 999px;
  font-weight: 800; font-size: 12px; letter-spacing: 0.08em;
  background: var(--surface-2); color: var(--ink-2);
}
.shield-pill.armed { background: var(--accent); color: #1a1200; }
.shield-pill.spent { opacity: 0.55; text-decoration: line-through; }
.danger-pill {
  padding: 4px 10px; border-radius: 999px;
  font-weight: 800; font-size: 12px;
  background: var(--danger); color: #fff;
}

.board-wrap { width: 100%; overflow: auto; touch-action: pan-x pan-y; }

/* Gameplay surface — fixed to the viewport so the page never scrolls
   mid-run. The board itself already auto-fits via JS sizing, so any
   leftover space sits as breathable padding instead of a scrollbar. */
.game-screen {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  padding:
    max(10px, env(safe-area-inset-top)) 14px
    max(10px, env(safe-area-inset-bottom));
  overflow: hidden;
  gap: 8px;
}
.game-screen .board-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-screen .board { margin: 0 auto; }
.board {
  position: relative; margin: 12px auto; user-select: none;
}
.hex {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0% 50%);
  font-weight: 800; font-size: 14px; color: var(--ink);
  transition: background 120ms, transform 120ms;
}
.hex.hidden { background: rgba(var(--region-tint), 0.45); }
.hex.hidden:active { transform: scale(0.97); }
.hex.revealed { background: var(--surface); }
.hex.revealed.zero { background: var(--surface-2); color: transparent; }
.hex.flag { background: rgba(var(--region-tint), 0.55); color: #1a1200; }
.hex.flag::after { content: "⚑"; font-size: 16px; }
.hex.flag.qmark::after { content: "?"; }
.hex.mine { background: var(--danger); color: #fff; }
.hex.mine::after { content: "✦"; }
.hex.boom { animation: boom 480ms ease; }
@keyframes boom { 0%{transform:scale(1)} 30%{transform:scale(1.15)} 100%{transform:scale(1)} }
.hex.dark { filter: brightness(0.30); }
.hex.treasure { background: linear-gradient(135deg, #ffd86b, var(--accent)); }
.n1 { color: #3478f6; } .n2 { color: #2e8b57; } .n3 { color: #d9374f; }
.n4 { color: #5a2d82; } .n5 { color: #8b3a3a; } .n6 { color: #1f6e7a; }
body.theme-dark .hex.n1 { color: #7ab7ff; }
body.theme-dark .hex.n2 { color: #66e08b; }
body.theme-dark .hex.n3 { color: #ff7a90; }
body.theme-dark .hex.n4 { color: #c69bef; }
body.theme-dark .hex.n5 { color: #e8a37a; }
body.theme-dark .hex.n6 { color: #66d4e0; }

/* Colorblind-safe palette (red/green deuteranopia + tritanopia friendly).
   Uses blue / yellow / orange / pink with high luminance contrast. */
body.colorblind .hex.n1 { color: #0072b2; }
body.colorblind .hex.n2 { color: #009e73; }
body.colorblind .hex.n3 { color: #d55e00; }
body.colorblind .hex.n4 { color: #cc79a7; }
body.colorblind .hex.n5 { color: #f0e442; }
body.colorblind .hex.n6 { color: #56b4e9; }

.fab-bar {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.fab-buy {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  flex: 1; min-width: 0;
  padding: 8px 4px 6px;
  background: var(--surface); border: 0; border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--ink); cursor: pointer;
}
.fab-buy:active:not([disabled]) { transform: translateY(1px); }
.fab-buy[disabled], .fab-buy.disabled { opacity: 0.45; pointer-events: none; }
.fab-buy-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 22px;
  color: var(--accent-2);
}
body.theme-dark .fab-buy-glyph { color: var(--accent); }
.fab-buy-glyph svg { width: 20px; height: 20px; }
.fab-buy-name {
  font-size: 10px; font-weight: 800;
  color: var(--ink); letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
.fab-buy-cost {
  font-size: 10px; font-weight: 800;
  color: var(--muted); letter-spacing: 0.04em;
  line-height: 1;
}
body.theme-dark .fab-buy-cost { color: var(--accent); }
.fab-buy.armed {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  opacity: 1;
  box-shadow: 0 6px 16px rgba(240, 165, 0, 0.40);
}
.fab-buy.armed .fab-buy-glyph,
.fab-buy.armed .fab-buy-name,
.fab-buy.armed .fab-buy-cost { color: #1a1200; }
.fab-buy.spent, .fab-buy.used { opacity: 0.45; }
.fab-buy.spent .fab-buy-cost, .fab-buy.used .fab-buy-cost { color: var(--muted); }

.fab-rewind {
  padding: 10px 14px;
  background: var(--surface); border: 0; border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 13px; font-weight: 800; color: var(--ink);
  letter-spacing: 0.04em;
}
.fab-rewind:active { transform: translateY(1px); }

.fab-quit {
  width: 38px; height: 38px;
  background: var(--surface); border: 0; border-radius: 50%;
  box-shadow: var(--shadow);
  color: var(--danger);
  display: inline-flex; align-items: center; justify-content: center;
}
.fab-quit svg { width: 16px; height: 16px; }
.fab-quit:active { transform: translateY(1px); }

.fab-flagmode {
  flex: 0 0 54px;
  align-self: stretch;
  background: var(--surface); border: 0; border-radius: 50%;
  box-shadow: var(--shadow);
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 120ms, background 200ms, box-shadow 200ms;
  margin: 0 2px;
}
.fab-flagmode svg { width: 22px; height: 22px; }
.fab-flagmode.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  box-shadow: 0 6px 18px rgba(240, 165, 0, 0.50);
  transform: scale(1.06);
}
.fab-flagmode:active { transform: scale(0.96); }
.fab-flagmode.on:active { transform: scale(1.02); }

.fab-blocked {
  flex: 1; padding: 10px;
  text-align: center;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  background: var(--surface-2); border-radius: 12px;
}

/* ---- Post-level ---- */
.post-screen { gap: 14px; }

/* Both win + lose screens use a viewport-fixed layout so nothing scrolls.
   Padding + glyph sizes are compressed; reward breakdown trimmed to fit. */
.post-fitted-screen {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  padding:
    max(12px, env(safe-area-inset-top)) 14px
    max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
  gap: 8px;
}
.post-fitted-screen .post-hero { padding: 12px 16px; gap: 2px; }
.post-fitted-screen .post-hero-glyph { width: 46px; height: 46px; margin-bottom: 2px; }
.post-fitted-screen .post-hero-glyph svg { width: 26px; height: 26px; }
.post-fitted-screen .post-hero-title { font-size: 18px; line-height: 1.1; }
.post-fitted-screen .post-hero-sub { font-size: 11.5px; }
.post-fitted-screen .post-hero-pr { font-size: 10px; padding: 2px 9px; margin-top: 3px; }
.post-fitted-screen .post-stat { padding: 8px 6px; gap: 2px; }
.post-fitted-screen .post-stat-glyph { width: 24px; height: 24px; }
.post-fitted-screen .post-stat-glyph svg { width: 16px; height: 16px; }
.post-fitted-screen .post-stat-value { font-size: 15px; }
.post-fitted-screen .post-stat-label { font-size: 9px; }
.post-fitted-screen .post-lives { padding: 10px 16px; gap: 6px; }
.post-fitted-screen .post-lives-label { font-size: 12px; }
.post-fitted-screen .post-life { width: 22px; height: 22px; }
.post-fitted-screen .post-lives-hearts { gap: 5px; }
.post-fitted-screen .post-lives-regen { padding: 3px 12px; margin-top: 0; }
.post-fitted-screen .post-lives-regen-label { font-size: 10.5px; }
.post-fitted-screen .post-lives-regen-time { font-size: 13px; }
.post-fitted-screen .post-rewards { padding: 8px 14px; }
.post-fitted-screen .post-reward-row { padding: 3px 0; font-size: 12px; }
.post-fitted-screen .post-reward-total { margin-top: 3px; padding-top: 6px; font-size: 15px; }
.post-fitted-screen .post-reward-coin svg { width: 16px; height: 16px; }
.post-fitted-screen .post-actions {
  margin-top: auto;
  gap: 6px;
}
.post-fitted-screen .post-actions .btn { padding: 10px; font-size: 13.5px; }
.post-actions-row { display: flex; gap: 6px; }
.post-actions-row .btn { flex: 1; }
.post-fitted-screen .post-action { padding: 11px 16px; font-size: 14px; gap: 10px; }
.post-fitted-screen .post-action-glyph { width: 22px; height: 22px; }
.post-fitted-screen .post-action-glyph svg { width: 20px; height: 20px; }
.post-hero {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 18px 18px;
  border-radius: 22px;
  text-align: center;
  box-shadow: var(--shadow);
}
.post-hero.won {
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.30), transparent 55%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1a1200;
}
.post-hero.lost {
  background:
    radial-gradient(circle at 50% 12%, rgba(var(--region-tint), 0.18), transparent 55%),
    var(--surface);
  color: var(--ink);
  border: 1.5px solid rgba(var(--region-tint), 0.35);
  position: relative;
  overflow: hidden;
}
.post-hero.lost::before {
  content: "";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 64px; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 0 0 999px 999px;
}
.post-hero-glyph {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.20);
  margin-bottom: 4px;
}
.post-hero.lost .post-hero-glyph {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  box-shadow: 0 6px 16px rgba(240, 165, 0, 0.40);
}
.post-hero-glyph svg { width: 34px; height: 34px; }
.post-hero-title {
  font-size: 22px; font-weight: 900; letter-spacing: -0.01em;
}
.post-hero-sub {
  font-size: 13px; font-weight: 700; opacity: 0.78;
}
.post-hero-pr {
  margin-top: 8px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.22);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 900;
  letter-spacing: 0.04em;
}
.post-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.post-stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 10px;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow);
}
.post-stat-glyph {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-2);
}
body.theme-dark .post-stat-glyph { color: var(--accent); }
.post-stat-glyph svg { width: 20px; height: 20px; }
.post-stat-value {
  font-size: 17px; font-weight: 900; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.post-stat-label {
  font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--muted);
}
.post-lives {
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.post-lives-label {
  font-size: 13px; font-weight: 800; color: var(--ink-2);
  letter-spacing: 0.02em;
  text-align: center;
}
.post-lives-hearts { display: inline-flex; gap: 6px; }
.post-life {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  color: var(--muted); opacity: 0.40;
}
.post-life.on { color: var(--accent-2); opacity: 1; }
body.theme-dark .post-life.on { color: var(--accent); }
.post-life svg { width: 100%; height: 100%; }
.post-lives-regen {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
  padding: 6px 14px;
  background: var(--surface-2);
  border-radius: 999px;
}
.post-lives-regen-label {
  font-size: 11px; font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.post-lives-regen-time {
  font-size: 14px; font-weight: 900;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
body.theme-dark .post-lives-regen-time { color: var(--accent); }

.post-rewards {
  display: flex; flex-direction: column;
  padding: 14px 18px;
  background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow);
}
.post-reward-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  font-size: 13.5px; color: var(--ink-2);
  font-weight: 700;
}
.post-reward-row + .post-reward-row { border-top: 1px solid var(--surface-2); }
.post-reward-row span:last-child {
  color: var(--ink); font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.post-reward-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding-top: 12px;
  border-top: 2px solid var(--surface-2);
  font-size: 18px; font-weight: 900; color: var(--ink);
}
.post-reward-total > span:first-child {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent-2);
}
body.theme-dark .post-reward-total > span:first-child { color: var(--accent); }
.post-reward-coin {
  display: inline-flex; align-items: center; justify-content: center;
}
.post-reward-coin svg { width: 22px; height: 22px; }
.post-actions {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 4px;
}
.post-actions .btn { width: 100%; }

/* Lose-screen action buttons — icon + label, gold primary / surface secondary.
   Bigger tap target, dramatic shadow, on-brand glow on the primary. */
.post-action {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border: 0; border-radius: 16px;
  font-size: 15px; font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 120ms, box-shadow 200ms;
}
.post-action-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
}
.post-action-glyph svg { width: 22px; height: 22px; }
.post-action-primary {
  background:
    radial-gradient(circle at 85% 25%, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  box-shadow: 0 8px 22px rgba(240, 165, 0, 0.40);
}
.post-action-primary:active {
  transform: translateY(1px);
  box-shadow: 0 4px 12px rgba(240, 165, 0, 0.35);
}
.post-action-secondary {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.post-action-secondary .post-action-glyph { color: var(--accent-2); }
body.theme-dark .post-action-secondary .post-action-glyph { color: var(--accent); }
.post-action-secondary:active { transform: translateY(1px); }

/* ---- Leaderboard ---- */
/* Leaderboard sign-in shares the Settings group chrome so the button
   matches the Account section pixel-for-pixel. */
.lb-signin-group { margin-bottom: 8px; }

/* Refresh button in the leaderboard header. Same gold hex family as the
   back/help buttons for visual consistency. Spins while syncing. */
.lb-refresh-btn {
  width: 46px; height: 40px;
  border: 0; padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  display: inline-flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 4px 10px rgba(240, 165, 0, 0.30));
  cursor: pointer;
  transition: transform 120ms;
}
.lb-refresh-btn svg { width: 16px; height: 16px; }
.lb-refresh-btn:active { transform: scale(0.94); }
.lb-refresh-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.lb-refresh-btn:disabled:active { transform: none; }
.lb-refresh-btn.spinning svg { animation: refreshSpin 700ms linear infinite; }
@keyframes refreshSpin {
  to { transform: rotate(360deg); }
}

.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-loading, .lb-empty {
  padding: 18px; border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow);
  color: var(--ink-2); font-size: 13px; text-align: center;
}
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow);
}
/* Top 3 rows: faint tint matching the medal so the eye lands there first
   without making the rest of the list feel demoted. */
.lb-row.medalist { padding-left: 10px; }
.lb-row.medal-1 { background: linear-gradient(135deg, rgba(240,165,0,0.20), var(--surface) 60%); }
.lb-row.medal-2 { background: linear-gradient(135deg, rgba(160,170,190,0.20), var(--surface) 60%); }
.lb-row.medal-3 { background: linear-gradient(135deg, rgba(200,140,80,0.18), var(--surface) 60%); }
.lb-row.me {
  outline: 2px solid var(--accent);
  background: linear-gradient(135deg, rgba(240,165,0,0.22), rgba(240,165,0,0.08) 80%);
  box-shadow: 0 4px 16px rgba(240,165,0,0.25);
}
.lb-row.me .lb-row-name { color: var(--ink); font-weight: 900; }
.lb-row.me .lb-row-rank { color: var(--accent-2); font-weight: 900; }
.lb-row.me .lb-row-trophies { color: var(--accent-2); font-weight: 900; }
.lb-row.me .lb-row-trophies-icon { color: var(--accent-2); }
.lb-row.me-bottom { position: sticky; bottom: 6px; }
.lb-gap {
  height: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); opacity: 0.55;
  letter-spacing: 6px; font-weight: 900; font-size: 14px;
}
.lb-gap::before { content: "•  •  •"; }
.lb-row-rank { width: 34px; font-weight: 800; color: var(--ink-2); font-size: 13px; text-align: center; }
.lb-row-rank.medal {
  display: inline-flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
}
.lb-row-rank.medal svg { width: 30px; height: 30px; }
.lb-row-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
.lb-row-name { flex: 1; font-size: 14px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row-trophies {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 800; color: var(--accent-2); letter-spacing: 0.02em;
}
.lb-row-trophies-icon { display: inline-flex; line-height: 0; color: var(--accent); }
body.theme-dark .lb-row-trophies { color: var(--accent); }

.lb-invite {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 16px;
  background: var(--surface); border: 0; border-radius: 16px;
  box-shadow: var(--shadow);
  font-size: 14px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink);
}
.lb-invite:active { transform: translateY(1px); }
.lb-invite-glyph {
  width: 28px; height: 28px;
  background: rgba(var(--region-tint), 0.18);
  color: var(--accent);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}

/* ---- Dialog ---- */
.dialog-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  backdrop-filter: blur(3px);
  animation: dialogFade 180ms ease-out;
}
@keyframes dialogFade { from { opacity: 0; } to { opacity: 1; } }
.dialog-panel {
  position: relative;
  background:
    radial-gradient(circle at 50% -10%, rgba(240,165,0,0.12), transparent 50%),
    var(--surface);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  padding: 22px;
  width: 100%;
  max-width: 380px;
  display: flex; flex-direction: column; gap: 14px;
  animation: dialogPop 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dialogPop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.dialog-panel::before {
  content: ""; position: absolute;
  left: 50%; top: 0;
  transform: translateX(-50%);
  width: 44px; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 0 0 3px 3px;
}
.dialog-panel h3 {
  margin: 0;
  font-size: 18px; font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: center;
}

/* Quit-this-level dialog: centered body, no extra glyph. */
.quit-dialog {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  text-align: center;
}
.quit-dialog-body {
  font-size: 13.5px; color: var(--ink-2);
  line-height: 1.45;
  padding: 0 6px;
}
.dialog-panel .preview { background: var(--surface-2); padding: 12px; border-radius: 12px; font-size: 13px; white-space: pre-wrap; color: var(--ink-2); }
.dialog-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.dialog-actions.single { justify-content: center; }
.dialog-actions.single .btn { min-width: 60%; justify-content: center; }
.dialog-actions .btn { flex: 1; justify-content: center; padding: 12px 16px; font-weight: 800; }
.dialog-actions .btn.primary {
  box-shadow: 0 6px 18px rgba(240, 165, 0, 0.40);
}
.dialog-actions .btn.danger {
  background: var(--danger); color: #fff;
  box-shadow: 0 6px 18px rgba(217, 55, 79, 0.35);
}

/* ---- Settings ---- */
.settings-group {
  background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-group > * + * {
  border-top: 1px solid rgba(var(--region-tint), 0.12);
}
.settings-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
}
.settings-row-glyph {
  width: 32px; height: 32px;
  background: rgba(var(--region-tint), 0.15);
  color: var(--accent);
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  flex-shrink: 0;
}
.settings-row-glyph svg { width: 16px; height: 16px;
}
.settings-row-label { flex: 1; font-size: 14px; font-weight: 600; color: var(--ink); }
.toggle { width: 42px; height: 24px; background: var(--surface-2); border-radius: 999px; position: relative; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: var(--ink-2); border-radius: 50%; transition: all 180ms; }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 21px; background: #fff; }

.settings-account { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.settings-account-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
.settings-account-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-account-name { font-size: 15px; font-weight: 800; color: var(--ink); }
.settings-account-sub { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Name change dialog */
.name-dialog {
  display: flex; flex-direction: column; gap: 12px;
  align-items: stretch;
}
.name-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: 12px;
  outline: none;
  transition: border-color 120ms;
}
.name-input:focus { border-color: var(--accent); }
.name-dialog-hint {
  text-align: center;
  font-size: 12px; font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

/* Avatar dialog — wider picker, more columns */
.dialog-panel.avatar-dialog-panel { max-width: 420px; }
.avatar-picker-dialog { padding: 8px 4px 4px; }
.avatar-picker-dialog .avatar-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Welcome / onboarding dialog — bigger panel, vertical stack of name input + avatar grid */
.dialog-panel.onboarding-panel { max-width: 440px; }
.onboarding-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 4px 0; }
.onboarding-intro { color: var(--muted); line-height: 1.4; font-size: 14px; }
.onboarding-section { display: flex; flex-direction: column; gap: 6px; }
.onboarding-label {
  font-size: 10px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.onboarding-panel .avatar-picker { padding: 0; }

/* Avatar picker — 12 hex-themed custom animal avatars. */
.avatar-picker { padding: 12px 16px 16px; }
.avatar-picker-label {
  font-size: 10px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em;
  margin-bottom: 10px;
}
.avatar-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.avatar-slot {
  position: relative;
  width: 100%; aspect-ratio: 1;
  background: transparent; border: 0; padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 120ms;
}
.avatar-slot:active { transform: scale(0.94); }
.avatar-slot img {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: block;
  background: var(--surface-2);
  object-fit: cover;
}
.avatar-slot.active {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.settings-action {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px;
  background: transparent; border: 0;
  font-size: 14px; font-weight: 700; color: var(--ink);
  text-align: left;
}
.settings-action:active { background: var(--surface-2); }
.settings-action-glyph {
  width: 32px; height: 32px;
  background: rgba(var(--region-tint), 0.15);
  color: var(--accent);
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
}
.settings-action.danger { color: var(--danger); }
.settings-action.danger .settings-action-glyph { background: rgba(217, 55, 79, 0.12); color: var(--danger); }

.settings-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 14px 16px;
  background: var(--accent); color: #1a1200;
  border: 0; font-size: 14px; font-weight: 800;
  letter-spacing: 0.04em;
}
.settings-google-g {
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; color: #1a1200;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px;
}

.settings-empty { padding: 18px; color: var(--ink-2); font-size: 13px; text-align: center; }

.settings-link {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  text-decoration: none; color: var(--ink);
  font-size: 14px; font-weight: 600;
  /* button-element reset so the tutorial trigger matches the <a> rows */
  background: transparent; border: 0; width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.settings-link:active { background: var(--surface-2); }
.settings-link-glyph {
  width: 32px; height: 32px;
  background: rgba(var(--region-tint), 0.15);
  color: var(--accent);
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.settings-link-glyph svg { width: 16px; height: 16px; }
.settings-link-label { flex: 1; }
.settings-link-chev { color: var(--muted); font-size: 20px; }

.settings-version {
  padding: 14px 16px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em;
  text-align: center;
}

/* Lives info dialog */
.lives-dialog { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.lives-hearts {
  display: flex; justify-content: center; gap: 6px;
  margin: 6px 0;
}
.lives-heart {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); opacity: 0.4;
}
.lives-heart.on { color: var(--ink); opacity: 1; }
.lives-heart svg { width: 100%; height: 100%; }
.lives-count-line {
  text-align: center;
  font-size: 20px; font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lives-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}
.lives-row-label { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.lives-row-value {
  font-size: 16px; font-weight: 900; color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
body.theme-dark .lives-row-value { color: var(--accent); }
.lives-status {
  text-align: center; padding: 6px 0;
  font-size: 13px; color: var(--ink-2); font-weight: 600;
}
.lives-hint {
  text-align: center;
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.02em;
  padding-top: 4px;
}

/* No-lives dialog body */
.no-lives-body { text-align: center; color: var(--ink-2); font-size: 14px; }
.no-lives-countdown {
  text-align: center; margin-top: 10px;
  font-size: 22px; font-weight: 900;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
body.theme-dark .no-lives-countdown { color: var(--accent); }

/* ---- Home top row (streak + chest) ---- */
.home-toprow {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 0 2px;
}
.streak-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  border-radius: 999px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(240, 165, 0, 0.30);
}
.streak-flame { font-size: 16px; }
.streak-num { font-size: 16px; }
.streak-label { font-size: 11px; opacity: 0.75; letter-spacing: 0.08em; text-transform: uppercase; }

.chest-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0;
  width: 56px; height: 56px;
  background: var(--surface); border: 0; border-radius: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.chest-btn.ready { animation: chestBounce 1.4s ease-in-out infinite; }
.chest-btn.claimed { opacity: 0.55; }
.chest-glyph { font-size: 22px; line-height: 1; }
.chest-label { font-size: 9px; font-weight: 800; color: var(--accent-2); letter-spacing: 0.04em; margin-top: 2px; }
.chest-btn.claimed .chest-label { color: var(--muted); }
@keyframes chestBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ---- Home daily challenge card ---- */
.home-daily {
  display: flex; align-items: center; gap: 12px;
  width: 84%; max-width: 360px;
  padding: 12px 16px;
  background: var(--surface); border: 0; border-radius: 18px;
  box-shadow: var(--shadow);
  text-align: left;
}
.home-daily.done { opacity: 0.65; }
.home-daily:active { transform: translateY(1px); }
.home-daily-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  flex-shrink: 0;
}
.home-daily-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-daily-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2); }
.home-daily-sub { font-size: 13px; font-weight: 700; color: var(--ink); }
.home-daily-chev { font-size: 22px; color: var(--muted); }

/* ---- Daily challenge screen ---- */
.daily-banner {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 4px 2px;
}
.streak-chip.dim {
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow);
}

.daily-hero {
  padding: 20px;
  background: var(--surface); border-radius: 22px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.daily-day { font-size: 12px; font-weight: 800; letter-spacing: 0.20em; text-transform: uppercase; color: var(--ink-2); }
.daily-where { font-size: 28px; font-weight: 900; letter-spacing: -0.02em; color: var(--ink); }
.daily-blurb { font-size: 13px; color: var(--ink-2); margin: 4px 0 8px; max-width: 320px; }
.daily-done { padding: 12px 18px; background: var(--surface-2); border-radius: 12px; }
.daily-time { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.daily-start { width: 100%; max-width: 280px; }

.daily-history { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daily-dot {
  background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 4px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.daily-dot.done { background: linear-gradient(135deg, rgba(var(--region-tint), 0.20), var(--surface)); }
.daily-dot-label { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.daily-dot-glyph { font-size: 18px; font-weight: 800; color: var(--muted); }
.daily-dot.done .daily-dot-glyph { color: var(--accent-2); }

/* ---- Daily reward chest popup ---- */
.dialog-panel.chest-panel {
  max-width: 340px;
  padding: 28px 24px 22px;
  background:
    radial-gradient(circle at 50% 30%, rgba(240,165,0,0.16), transparent 70%),
    var(--surface);
  text-align: center;
  align-items: stretch;
}

.chest-dialog {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 8px 4px;
  text-align: center;
}
.chest-dialog-glow {
  position: absolute;
  width: 220px; height: 220px;
  left: 50%; top: -10px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(240,165,0,0.55), transparent 60%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}
.chest-dialog-rays {
  position: absolute;
  width: 260px; height: 260px;
  left: 50%; top: -30px;
  transform: translateX(-50%);
  background:
    conic-gradient(from 0deg,
      rgba(255,216,107,0.18) 0deg, transparent 22deg,
      rgba(255,216,107,0.18) 45deg, transparent 67deg,
      rgba(255,216,107,0.18) 90deg, transparent 112deg,
      rgba(255,216,107,0.18) 135deg, transparent 157deg,
      rgba(255,216,107,0.18) 180deg, transparent 202deg,
      rgba(255,216,107,0.18) 225deg, transparent 247deg,
      rgba(255,216,107,0.18) 270deg, transparent 292deg,
      rgba(255,216,107,0.18) 315deg, transparent 337deg
    );
  mask: radial-gradient(circle, black 0%, black 35%, transparent 70%);
  -webkit-mask: radial-gradient(circle, black 0%, black 35%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: raysSpin 14s linear infinite;
}
@keyframes raysSpin {
  to { transform: translateX(-50%) rotate(360deg); }
}
.chest-dialog-glyph {
  position: relative; z-index: 1;
  width: 88px; height: 88px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  box-shadow: 0 12px 28px rgba(240,165,0,0.45);
  animation: chestPop 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chest-dialog-glyph svg { width: 48px; height: 48px; }

/* ---- World Complete popup ---- */
.world-complete-panel { overflow: hidden; }
.wc-dialog {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 8px 4px;
  gap: 4px;
  text-align: center;
}
.wc-rays {
  position: absolute;
  top: -10%; left: 50%;
  transform: translateX(-50%);
  width: 320px; height: 320px;
  background:
    conic-gradient(
      from 0deg,
      transparent 0 14deg,
      rgba(240,165,0,0.25) 14deg 28deg,
      transparent 28deg 42deg,
      rgba(240,165,0,0.25) 42deg 56deg,
      transparent 56deg 70deg,
      rgba(240,165,0,0.25) 70deg 84deg,
      transparent 84deg 98deg,
      rgba(240,165,0,0.25) 98deg 112deg,
      transparent 112deg 126deg,
      rgba(240,165,0,0.25) 126deg 140deg,
      transparent 140deg 154deg,
      rgba(240,165,0,0.25) 154deg 168deg,
      transparent 168deg 182deg,
      rgba(240,165,0,0.25) 182deg 196deg,
      transparent 196deg 210deg,
      rgba(240,165,0,0.25) 210deg 224deg,
      transparent 224deg 238deg,
      rgba(240,165,0,0.25) 238deg 252deg,
      transparent 252deg 266deg,
      rgba(240,165,0,0.25) 266deg 280deg,
      transparent 280deg 294deg,
      rgba(240,165,0,0.25) 294deg 308deg,
      transparent 308deg 322deg,
      rgba(240,165,0,0.25) 322deg 336deg,
      transparent 336deg 350deg,
      rgba(240,165,0,0.25) 350deg 360deg
    );
  border-radius: 50%;
  z-index: 0;
  opacity: 0.55;
  animation: wcRays 18s linear infinite;
}
@keyframes wcRays {
  to { transform: translateX(-50%) rotate(360deg); }
}
.wc-glyph {
  position: relative; z-index: 1;
  width: 96px; height: 96px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  box-shadow: 0 14px 32px rgba(240,165,0,0.50);
  margin-bottom: 6px;
  animation: chestPop 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wc-glyph svg { width: 52px; height: 52px; }
.wc-eyebrow {
  position: relative; z-index: 1;
  font-size: 10.5px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--accent-2);
}
body.theme-dark .wc-eyebrow { color: var(--accent); }
.wc-name {
  position: relative; z-index: 1;
  font-size: 26px; font-weight: 900;
  color: var(--ink); letter-spacing: -0.02em;
  line-height: 1.05;
}
.wc-sub {
  position: relative; z-index: 1;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  margin-bottom: 8px;
}
.wc-reward {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  border-radius: 999px;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(240,165,0,0.40);
}
.wc-reward-glyph svg { width: 22px; height: 22px; }
.wc-reward-amount { font-size: 22px; letter-spacing: -0.01em; }
.wc-reward-label {
  font-size: 11.5px; letter-spacing: 0.10em;
  text-transform: uppercase; opacity: 0.85;
}
@keyframes chestPop {
  0%   { transform: scale(0.3) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(6deg);  opacity: 1; }
  100% { transform: scale(1) rotate(0);        opacity: 1; }
}
.chest-dialog-title {
  position: relative; z-index: 1;
  font-size: 22px; font-weight: 900; color: var(--ink);
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.chest-dialog-body {
  position: relative; z-index: 1;
  font-size: 13px; color: var(--ink-2);
  max-width: 260px;
}
.chest-dialog-reward {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; margin-top: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  border-radius: 999px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(240, 165, 0, 0.45);
  animation: rewardPop 600ms 400ms backwards cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes rewardPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.chest-dialog-amount { font-size: 26px; line-height: 1; }
.chest-dialog-coin {
  display: inline-flex; align-items: center; justify-content: center;
  color: #1a1200;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.20));
}
.chest-dialog-coin svg { width: 26px; height: 26px; }
.chest-dialog-name {
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.10em; text-transform: uppercase;
  opacity: 0.85;
}

/* Bigger, more prominent Claim button when chest-panel is active */
.dialog-panel.chest-panel .dialog-actions.single .btn {
  min-width: 80%;
  padding: 14px 24px;
  font-size: 16px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  border-radius: 14px;
}

/* ---- Tutorial overlay ---- */
.tutorial-step {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; padding: 8px 4px;
}
.tutorial-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200;
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(240, 165, 0, 0.35);
  margin-bottom: 4px;
}
.tutorial-glyph svg { width: 38px; height: 38px; }
.tutorial-title { font-size: 20px; font-weight: 900; color: var(--ink); }
.tutorial-body { font-size: 14px; color: var(--ink-2); max-width: 280px; }
.tutorial-dots { display: flex; gap: 6px; margin-top: 8px; }
.tutorial-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface-2);
}
.tutorial-dot.active { background: var(--accent); }

/* ---- Stats: win/loss + days chart ---- */
.stats-wl-card {
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.stats-wl-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.stats-wl-pct { font-size: 20px; font-weight: 900; color: var(--accent); }
.stats-wl-bar {
  display: flex; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--surface-2);
}
.stats-wl-wins   { background: var(--good); }
.stats-wl-losses { background: var(--danger); }
.stats-wl-legend {
  display: flex; justify-content: space-between;
  font-size: 11px; font-weight: 700; color: var(--ink-2);
}

/* Activity heatmap — 4-week (28-cell) playing-rhythm grid */
.period-panel {
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.period-tabs {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  padding: 4px;
  background: var(--surface-2); border-radius: 12px;
}
.period-tab {
  padding: 8px 0;
  background: transparent; border: 0; border-radius: 9px;
  font-size: 12.5px; font-weight: 800;
  color: var(--muted); letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.period-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.period-tab:active:not(.active) { transform: translateY(1px); }
.period-body {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  padding: 4px 2px 6px;
}
.period-stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px;
}
.period-stat-value {
  font-size: 20px; font-weight: 900; color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.period-stat-label {
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--muted);
}

/* ---- Theme picker (Settings) ---- */
.theme-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.theme-swatch {
  position: relative;
  height: 70px; border: 0; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.theme-swatch.theme-light  { background: linear-gradient(135deg, #fff7e6, #f0a500); color: #2b2417; }
.theme-swatch.theme-dark   { background: linear-gradient(135deg, #161e36, #58e3ff); color: #fff; }
.theme-swatch.theme-sunset { background: linear-gradient(135deg, #2a1233, #ff8c42); color: #fff; }
.theme-swatch.theme-ocean  { background: linear-gradient(135deg, #04263d, #00d4ff); color: #fff; }
.theme-swatch.theme-forest { background: linear-gradient(135deg, #0e2818, #9ee37d); color: #fff; }
.theme-swatch.active { outline: 3px solid var(--accent); }
.theme-swatch.locked { opacity: 0.55; }
.theme-name { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.theme-lock { position: absolute; top: 4px; right: 6px; font-size: 12px; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); z-index: 2000; font-size: 14px; }

