/* ============================================================================
   Leaverite Rocks — styles. Earthy lapidary workshop meets underground cave.
   Mobile-first, GPU-only animations (transform/opacity), light + dark themes.
   ============================================================================ */

:root {
  /* Earthy palette: Nude #E7D7C8 · Camel #B99470 · Russet #783D19 ·
     Orange #C4661F · Olive #5F6F52 · Slate #2F2E2C.
     Semantics: OLIVE = good/safe, RUSSET/ORANGE-RED = risk/bad, ORANGE = gold/treasure. */
  --game-primary: #783D19;        /* russet */
  --game-secondary: #E7D7C8;      /* nude */
  --game-text: #2F2E2C;           /* slate */
  --game-text-muted: #6E5942;     /* deep camel (AA on nude) */
  --game-interactive: #5F6F52;    /* olive — "go" / good */
  --game-good: #5F6F52;           /* olive */
  --game-danger: #A6401F;         /* risk red (deep orange-russet) */
  --game-border: #CDB99E;         /* camel tint */
  --game-prestige: #7E5B8F;       /* muted plum — the one off-earth accent (empowered) */
  --game-prestige-light: #E3D4EC;
  --game-header: #783D19;         /* russet header */
  --game-gold: #C4661F;           /* orange — treasure/gold */
  /* Leaderboard medal colors — tuned per-theme so each clears WCAG AA (4.5:1)
     on the pale panel as a small bold rank glyph (the orange --game-gold itself
     only hits ~3.3:1 here, so rank 1 gets its own deeper gold). */
  --medal-gold: #9A5212; --medal-silver: #5E5E5E; --medal-bronze: #8A4E22;

  --panel: #F4E9DA;
  --panel-2: #E7D7C8;             /* nude */
  /* Dig-cell tile: a SOFT semi-transparent wash so the dirt sits on a gentle
     tile, not an abrupt opaque square (per request, ~low alpha so it blends). */
  --cell-base: rgba(120, 92, 58, 0.22);
  --heading: #9A5212;             /* warm amber heading — pleasant + AA on cream */
  --panel-scrim: rgba(244, 233, 218, 0.82);
  --shadow: 0 4px 14px rgba(47, 46, 44, 0.18);
  --shadow-sm: 0 2px 6px rgba(47, 46, 44, 0.13);
  --radius: 14px;
  --radius-sm: 10px;
  --bg-1: #d9c4a4;               /* camel */
  --bg-2: #b99470;              /* camel-deep */
  --bg-frost: rgba(231, 215, 200, 0.42);

  font-size: clamp(15px, 1vw + 0.5rem, 18px);
  -webkit-text-size-adjust: 100%;
}

html[data-theme="dark"] {
  /* Dark = slate cave lit by russet/orange embers; olive stays the "good" green. */
  --game-primary: #C98A52;        /* warm russet-camel */
  --game-secondary: #2F2E2C;      /* slate */
  --game-text: #EADBC8;           /* nude light */
  --game-text-muted: #C0A887;     /* camel */
  --game-interactive: #86996F;    /* lifted olive */
  --game-good: #86996F;
  --game-danger: #D2622C;         /* ember orange-red */
  --game-border: #4C4034;
  --game-prestige: #A988B8;       /* muted plum */
  --game-prestige-light: #E3D4EC;
  --game-header: #5B3318;         /* deep russet */
  --game-gold: #E07B2C;           /* bright orange */
  /* Lighter medals on the dark panel — the earlier darkened silver/bronze
     dropped to ~2.6–3.2:1 on slate; these clear AA while staying gold/silver/bronze. */
  --medal-gold: #E8A24A; --medal-silver: #B9B2A6; --medal-bronze: #D08A4E;

  --panel: #332f2a;
  --panel-2: #29251f;
  /* Soft warm wash on the dark cave (was an abrupt opaque tile). */
  --cell-base: rgba(245, 236, 224, 0.15);
  --heading: #E8A24A;             /* warm amber heading — pleasant + AA on slate */
  --panel-scrim: rgba(51, 47, 42, 0.82);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  /* Lifted off pure black + lighter frost so the rotating cave gradient stays
     faintly visible — empty areas read as a deep warm cave, not a dead void. */
  --bg-1: #3a2f24;
  --bg-2: #211a13;
  --bg-frost: rgba(33, 26, 19, 0.4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg-2);
  color: var(--game-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  overscroll-behavior: none;
}
button, .tappable { touch-action: manipulation; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--game-interactive); outline-offset: 2px; border-radius: 6px; }

/* --- Animated background --- */
.bg {
  position: fixed; inset: -25%; z-index: -3;
  background: conic-gradient(from 0deg,
    var(--bg-1), var(--bg-2), var(--bg-1), var(--bg-2), var(--bg-1));
  animation: bgspin 20s linear infinite;
  will-change: transform;
}
.bg-accent {
  z-index: -2; opacity: 0.5; mix-blend-mode: overlay;
  background: radial-gradient(circle at 30% 30%, var(--bg-1), transparent 55%),
              radial-gradient(circle at 70% 70%, var(--bg-2), transparent 55%);
  animation: bgspin 31s linear infinite reverse;
}
.bg-frost { position: fixed; inset: 0; z-index: -1; background: var(--bg-frost); }
/* Soft radial mask over the conic gradient's convergence point so empty screens
   never show a visible "pinwheel" seam at center. Centered on the real viewport
   midpoint (the conic converges at 50% 50%) and feathered with the LIGHTER
   camel tone — the seam reads as a dark cross, so washing it with --bg-1 (not the
   darker --bg-2) actually erases it instead of deepening it. */
.bg-frost::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, var(--bg-1) 0%, var(--bg-1) 12%, transparent 58%); opacity: 0.7; }
/* Dark cave intentionally keeps a faint visible swirl, so mask lighter there. */
html[data-theme="dark"] .bg-frost::after { opacity: 0.4; }
html[data-theme="dark"] .bg { animation-direction: reverse; }
@keyframes bgspin { to { transform: rotate(360deg); } }
body.no-motion-bg .bg, body.no-motion-bg .bg-accent { animation: none; }

/* --- App shell --- */
.app {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  max-width: 560px; margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

/* --- Header --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--game-header);
  color: #fff; box-shadow: var(--shadow-sm);
}
.icon-btn {
  flex: 0 0 auto; width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.14); color: #fff; font-size: 1.5rem; line-height: 1;
  display: grid; place-items: center;
}
.icon-btn:active { transform: scale(0.92); }
.goal-mini {
  flex: 1 1 auto; min-width: 0; border: none; background: rgba(0,0,0,0.16);
  color: #fff; border-radius: var(--radius-sm); padding: 5px 10px;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  gap: 1px 8px; align-items: center; text-align: left;
}
.goal-mini-label { font-size: 0.6rem; letter-spacing: 0.1em; opacity: 0.85; grid-row: 1; }
.goal-mini-text { font-size: 0.72rem; font-weight: 700; grid-row: 2; grid-column: 1; white-space: nowrap; }
.goal-mini-bar { grid-row: 1 / 3; grid-column: 2; height: 8px; background: rgba(255,255,255,0.22); border-radius: 6px; overflow: hidden; }
.goal-mini-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #E8A35A, var(--game-gold)); transition: width 0.4s ease; }
.topbar-right { flex: 0 0 auto; text-align: right; line-height: 1.1; }
.stat-gold { font-weight: 800; font-size: 1.05rem; }
.stat-sub { font-size: 0.7rem; opacity: 1; display: flex; gap: 6px; justify-content: flex-end; }
.stat-sub .timer { color: #FBEAD0; }
.timer { font-variant-numeric: tabular-nums; }
.prestige-badge {
  position: absolute; top: 4px; right: 8px; background: var(--game-prestige);
  color: #fff; font-size: 0.6rem; font-weight: 800; padding: 1px 6px; border-radius: 999px;
}

/* --- Main / screens --- */
.main { flex: 1 1 auto; padding: 12px 12px 16px; display: flex; flex-direction: column; }
.screen { animation: fade 0.22s ease; }
.screen[hidden] { display: none; }
/* Dig + polish are focused, single-purpose screens: let them claim the full
   column and center their content so short grids don't leave a dead void. */
#screen-dig:not([hidden]), #screen-polish:not([hidden]) { flex: 1 1 auto; display: flex; flex-direction: column; }
#screen-dig .dig-grid-wrap { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
/* Center the polish gem + minigame card as a group rather than top-aligning. */
#screen-polish:not([hidden]) { justify-content: center; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-title { font-size: 1.05rem; margin: 4px 2px 10px; color: var(--heading); }

/* --- Goal panel (map) --- */
.goal-panel {
  background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
/* Treasure image (flavor) on ::before so the scrim can paint over it.
   PRD §12 requires the goal text/bar to stay crisp ("never bleeds through"). */
.goal-panel::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 0;
  background: url("assets/treasure-bar-bg.webp") center/cover; transition: opacity 0.6s ease;
  pointer-events: none;
}
.goal-panel.has-progress::before { opacity: calc(var(--goalp) * 0.22); }
/* Readability scrim paints above the image (::after stacks over ::before at the
   same z-index) and below the text — keeps the panel near-opaque at 100%. */
.goal-panel::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-color: var(--panel-scrim);
}
.goal-panel > * { position: relative; z-index: 1; }
.goal-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.goal-flag { font-weight: 800; color: var(--game-interactive); font-size: 0.95rem; animation: goalpulse 5s ease-in-out infinite; }
@keyframes goalpulse { 0%,100%{ filter: hue-rotate(0deg);} 50%{ filter: hue-rotate(25deg);} }
.goal-amount { font-weight: 700; }
.goal-bar { height: 14px; background: var(--panel-2); border-radius: 8px; overflow: hidden; border: 1px solid var(--game-border); }
.goal-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #E8A35A, var(--game-gold)); transition: width 0.5s ease; }
.goal-status { font-size: 0.8rem; color: var(--game-text-muted); margin-top: 7px; }
.goal-status.win { color: var(--game-interactive); font-weight: 700; }

/* --- Site cards --- */
.site-list { display: grid; gap: 12px; }
.site-card {
  position: relative; border: 1px solid var(--game-border); border-radius: var(--radius);
  padding: 14px; overflow: hidden; color: #fff; min-height: 96px;
  background: #2c2418; box-shadow: var(--shadow); text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px; width: 100%;
}
.site-card .site-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0.9; z-index: 0;
}
.site-card::before { content:""; position:absolute; inset:0; z-index:1; background: linear-gradient(120deg, rgba(20,12,6,0.78), rgba(20,12,6,0.35)); }
.site-card > * { position: relative; z-index: 2; }
.site-card:active { transform: scale(0.985); }
.site-card.locked { filter: grayscale(0.5) brightness(0.7); }
/* Reserve space at the top-right so the absolutely-positioned status badge
   never overlaps a longer site name (e.g. "Crystal Depths"). */
.site-name { font-weight: 800; font-size: 1.1rem; text-shadow: 0 1px 3px rgba(0,0,0,0.7); padding-right: 88px; }
.site-meta { font-size: 0.74rem; opacity: 0.95; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
.site-cta {
  align-self: flex-start; background: var(--game-interactive); color: #fff; font-weight: 700;
  border: none; border-radius: 999px; padding: 6px 14px; font-size: 0.8rem; min-height: 32px;
}
.site-cta.locked-cta { background: rgba(0,0,0,0.5); }
.site-cta.cant { background: var(--game-danger); }

/* --- Dig screen --- */
.dig-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
/* Name is the flexible middle: it absorbs slack and truncates so Leave / name /
   ⛏-count always stay on ONE row, even at 320px with a long rare-vein name. */
.dig-site-name { font-weight: 800; font-size: 1.05rem; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.text-btn { background: none; border: none; color: var(--game-interactive); font-weight: 700; font-size: 0.9rem; padding: 8px; min-height: 44px; flex: 0 0 auto; }
.stamina { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.stam-count { font-weight: 800; font-size: 0.9rem; color: var(--game-text); white-space: nowrap; }
/* Pips clip rather than wrap; on narrow screens the row is capped so it can't
   starve the site name. The "⛏ N" count remains the source of truth. */
.pips { display: flex; gap: 3px; overflow: hidden; max-width: 156px; }
@media (max-width: 360px) { .pips { max-width: 80px; } }
.pip { width: 10px; height: 10px; border-radius: 50%; background: var(--game-good); box-shadow: inset 0 -1px 2px rgba(0,0,0,0.3); }
.pip.spent { background: var(--game-border); }
.dig-buffs { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; margin-bottom: 8px; }
.buff-chip { background: var(--panel); border: 1px solid var(--game-border); border-radius: 999px; padding: 3px 9px; font-size: 0.72rem; font-weight: 600; color: var(--game-text); }
.buff-chip.hot { background: var(--game-prestige-light); border-color: var(--game-prestige); }
.buff-chip.found { background: color-mix(in srgb, var(--game-good) 18%, var(--panel)); border-color: var(--game-good); font-weight: 700; }

.dig-grid-wrap { container-type: inline-size; }
.dig-grid { display: grid; gap: 5px; width: 100%; }
.dig-cell {
  position: relative; aspect-ratio: 1; border-radius: 8px; border: none; padding: 0;
  /* Warm tile base shows through the (now semi-transparent) dirt so the grid
     reads as soft earth, not heavy mud. */
  background: var(--cell-base);
  display: grid; place-items: center; font-size: clamp(1rem, 9cqi, 1.9rem);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); overflow: hidden;
}
.dig-cell .layer {
  position: absolute; inset: 0; background-image: url("assets/dirt-tile.webp"); background-size: cover;
  opacity: 0.92; /* pebbles read clearly on the now-soft tile */
  display: grid; place-items: center;
}
/* Layer-count badge: a small dark chip so the number stays legible on any tile. */
.dig-cell .layer[data-n]::after {
  content: attr(data-n); color: #fff; font-weight: 800; font-size: 0.72rem;
  background: rgba(40,26,14,0.62); border-radius: 999px; min-width: 18px; height: 18px;
  display: grid; place-items: center; padding: 0 4px; text-shadow: 0 1px 1px rgba(0,0,0,0.5);
}
.dig-cell.rock .layer { filter: brightness(0.78) saturate(0.8); opacity: 0.95; }
/* Revealed cells keep the same soft tile (gems carry their own drop-shadow) so
   the grid stays cohesive instead of flashing a bright opaque square. */
.dig-cell.revealed { background: var(--cell-base); }
.dig-cell .content-ico { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }
.dig-cell.empowered::after { content:"⚡"; position:absolute; top:2px; right:3px; font-size:0.7rem; color: var(--game-prestige); filter: drop-shadow(0 0 2px #fff); animation: pulse 1.4s ease-in-out infinite; }
.dig-cell.hint .layer { box-shadow: inset 0 0 0 3px var(--game-gold); animation: pulse 1s ease-in-out infinite; }
.dig-cell:active { transform: scale(0.95); }
@keyframes pulse { 0%,100%{ opacity:1;} 50%{ opacity:0.55;} }
@keyframes pop { 0%{ transform: scale(0.3); opacity:0;} 70%{ transform: scale(1.15);} 100%{ transform: scale(1); opacity:1;} }
.dig-cell.just-revealed .content-ico { animation: pop 0.4s ease; }

.dig-foot { margin-top: 12px; display: grid; gap: 8px; }

/* --- Buttons --- */
.btn {
  border: none; border-radius: var(--radius-sm); padding: 12px 16px; font-weight: 700; font-size: 0.95rem;
  min-height: 48px; background: var(--game-interactive); color: #fff; box-shadow: var(--shadow-sm);
  width: 100%; transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.98); }
.btn.secondary { background: transparent; color: var(--game-text); border: 2px solid var(--game-border); }
.btn.gold { background: linear-gradient(90deg, #E0A92E, var(--game-gold)); }
.btn.prestige { background: var(--game-prestige); }
.btn[disabled] { opacity: 0.5; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* --- Polish minigame --- */
.polish-screen { display: flex; flex-direction: column; }
.polish-gem { text-align: center; margin: 6px 0 12px; }
.polish-gem img { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)); }
.polish-gem .pname { font-weight: 800; font-size: 1.15rem; margin-top: 4px; }
.polish-gem .pemp { color: var(--game-prestige); font-weight: 700; font-size: 0.8rem; }
.polish-phase { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius); padding: 16px 14px; box-shadow: var(--shadow); }
.phase-step { text-align: center; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--game-text-muted); margin-bottom: 2px; }
.phase-title { font-weight: 800; text-align: center; margin-bottom: 4px; font-size: 1.15rem; }
.phase-hint { text-align: center; font-size: 0.8rem; color: var(--game-text-muted); margin-bottom: 14px; min-height: 1.1em; }

.shape-bar, .buff-bar { position: relative; height: 46px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--game-border); overflow: hidden; }
.shape-green { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--game-good) 32%, transparent); border-left: 2px solid var(--game-good); border-right: 2px solid var(--game-good); }
.shape-marker { position: absolute; top: -3px; bottom: -3px; width: 5px; background: var(--game-text); border-radius: 3px; will-change: transform; }
.progress-wrap { margin-top: 14px; }
.progress-label { font-size: 0.78rem; display: flex; justify-content: space-between; margin-bottom: 4px; }
.progress-track { height: 16px; background: var(--panel-2); border-radius: 8px; overflow: hidden; border: 1px solid var(--game-border); }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--game-good), color-mix(in srgb, var(--game-good) 60%, #fff)); transition: width 0.2s ease; }
.progress-bar.overflow { background: linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f); background-size: 300% 100%; animation: rainbow 1.2s linear infinite; }
@keyframes rainbow { to { background-position: 300% 0; } }

/* Buffing sweet spot: pulses gently so first-timers see WHERE to release. */
.buff-sweet { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--game-good) 38%, transparent); animation: sweetpulse 1.3s ease-in-out infinite; }
@keyframes sweetpulse { 0%,100%{ background: color-mix(in srgb, var(--game-good) 32%, transparent);} 50%{ background: color-mix(in srgb, var(--game-good) 56%, transparent);} }
.buff-center { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--game-good); z-index: 2; }
/* "Release here" caret: solid olive glyph with a light halo so it reads on top
   of the (semi-transparent) sweet-spot band in BOTH themes. White-on-olive was
   nearly invisible; this is the key first-timer affordance, so make it pop. */
.buff-center::before { content: "▼"; position: absolute; top: 1px; left: 50%; transform: translateX(-50%); font-size: 1rem; line-height: 1; color: var(--game-text); text-shadow: 0 0 2px var(--panel), 0 0 4px var(--panel); }
.buff-fill { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, var(--game-gold), color-mix(in srgb, var(--game-gold) 70%, #fff)); width: 0%; opacity: 0.55; will-change: width; }
/* Frozen "landing" state after release — a bright marker edge so the player
   clearly sees where they stopped before the round proceeds. */
.buff-fill.landed { opacity: 0.92; box-shadow: inset -3px 0 0 #fff, 0 0 14px rgba(255,255,255,.5); transition: width .08s ease; }
.buff-fill.landed.hit { box-shadow: inset -3px 0 0 #fff, 0 0 16px var(--game-good); }
.buff-fill.landed.off { box-shadow: inset -3px 0 0 #fff, 0 0 16px var(--game-danger); }
.buff-speed { text-align: center; font-size: 0.8rem; font-weight: 700; margin-top: 8px; min-height: 1.1em; }

/* --- Per-gem polish result card --- */
.polish-gem.done img { animation: resultpop 0.5s ease; }
@keyframes resultpop { 0%{ transform: scale(0.7); } 60%{ transform: scale(1.12); } 100%{ transform: scale(1); } }
.polish-result { text-align: center; animation: fade 0.3s ease; }
.pr-tier { display: inline-block; color: #fff; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.04em; padding: 5px 16px; border-radius: 999px; text-shadow: 0 1px 2px rgba(0,0,0,0.35); box-shadow: var(--shadow-sm); }
.pr-pct { font-weight: 800; font-size: 1.05rem; color: var(--game-text); margin: 12px 0 6px; }
.pr-bar { height: 12px; background: var(--panel-2); border: 1px solid var(--game-border); border-radius: 7px; overflow: hidden; }
.pr-bar > div { height: 100%; width: 0%; border-radius: 6px; transition: width 0.6s var(--ease, ease); animation: prfill 0.7s ease; }
@keyframes prfill { from { width: 0 !important; } }
.pr-rewards { display: grid; gap: 8px; margin: 16px 0; }
.pr-reward { display: flex; align-items: center; justify-content: space-between; background: var(--panel-2); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 11px 14px; }
.pr-reward span { font-weight: 600; color: var(--game-text-muted); font-size: 0.88rem; }
.pr-reward b { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pr-reward .pr-gold { color: var(--game-gold); }
.pr-reward .pr-inc { color: var(--game-interactive); }

/* --- Summary --- */
.summary-body { display: grid; gap: 8px; margin-bottom: 14px; }
.sum-row { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-sm); }
.sum-row img { width: 38px; height: 38px; object-fit: contain; }
.sum-row .sr-name { font-weight: 700; flex: 1; }
/* Quality colors (Cut=light blue, etc.) come from content data; darken the
   inline background so white chip text clears WCAG AA on every tier. */
.sum-row .sr-q { font-size: 0.74rem; padding: 2px 8px; border-radius: 999px; color: #fff; font-weight: 700; filter: brightness(0.78) saturate(1.15); text-shadow: 0 1px 1px rgba(0,0,0,0.35); }
.sum-row .sr-gold { font-weight: 800; color: var(--game-gold); }
.sum-total { text-align: center; font-weight: 800; font-size: 1.1rem; padding: 8px; }
.summary-actions { display: grid; gap: 8px; }

/* --- Store / collection --- */
.income-card { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 14px; text-align: center; }
.income-rate { font-size: 1.5rem; font-weight: 800; color: var(--game-interactive); }
.income-sub { font-size: 0.8rem; color: var(--game-text-muted); }
.income-card .btn { margin-top: 10px; }
.collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.gem-card { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 8px 6px; text-align: center; box-shadow: var(--shadow-sm); position: relative; }
.gem-card img { width: 52px; height: 52px; object-fit: contain; }
.gem-card .gc-name { font-size: 0.72rem; font-weight: 700; line-height: 1.15; }
.gem-card .gc-mult { font-size: 0.66rem; font-weight: 800; color: var(--game-gold); font-variant-numeric: tabular-nums; }
.gem-card .gc-q { font-size: 0.62rem; font-weight: 700; margin-top: 1px; }
/* Per-stack income: the headline number on each display case. */
.gem-card .gc-inc { margin-top: 5px; font-weight: 800; font-size: 0.82rem; color: var(--game-interactive); font-variant-numeric: tabular-nums; }
.gem-card .gc-inc small { font-size: 0.62rem; font-weight: 700; opacity: 0.8; }
/* Light-mode panels are pale: darken the inline quality color so the label
   (esp. Cut's light blue) keeps enough contrast on cream. */
html:not([data-theme="dark"]) .gem-card .gc-q { filter: brightness(0.7) saturate(1.2); }
.gem-card.emp { border-color: var(--game-prestige); box-shadow: 0 0 0 2px var(--game-prestige-light); }
.gem-card.emp::after { content:"⚡"; position:absolute; top:3px; right:5px; color: var(--game-prestige); animation: pulse 1.4s ease-in-out infinite; }
/* Give empty states real vertical presence + a little breathing room so they
   read as a designed state instead of one line floating above a void. */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--game-text-muted); padding: 40px 24px; min-height: 38vh; }
.empty-state .es-emoji { font-size: 2.6rem; opacity: 0.85; }

/* --- Upgrades --- */
.upgrade-cat { font-weight: 800; margin: 14px 2px 8px; color: var(--game-text-muted); font-size: 0.85rem; letter-spacing: 0.04em; }
.up-card { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 11px 12px; box-shadow: var(--shadow-sm); margin-bottom: 8px; display: flex; align-items: center; gap: 11px; }
.up-ico { font-size: 1.5rem; flex: 0 0 auto; }
.up-info { flex: 1; min-width: 0; }
.up-name { font-weight: 700; }
.up-name .lvl { font-size: 0.72rem; color: var(--game-text-muted); font-weight: 600; }
.up-desc { font-size: 0.72rem; color: var(--game-text-muted); }
.up-prog { height: 5px; background: var(--panel-2); border-radius: 4px; margin-top: 5px; overflow: hidden; }
.up-prog > div { height: 100%; background: var(--game-gold); width: 0%; }
.up-buy { flex: 0 0 auto; border: none; background: var(--game-interactive); color: #fff; border-radius: 999px; padding: 9px 13px; font-weight: 700; font-size: 0.8rem; min-height: 44px; min-width: 64px; }
.up-buy[disabled] { background: var(--game-border); color: var(--game-text-muted); }
.up-buy.max { background: var(--game-gold); }

/* --- Bottom nav --- */
.bottom-nav {
  position: sticky; bottom: 0; z-index: 15; display: flex;
  background: var(--game-header); padding: 4px 4px env(safe-area-inset-bottom);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.18);
}
.nav-btn { flex: 1; border: none; background: none; color: rgba(255,255,255,0.7); font-size: 0.72rem; font-weight: 700; padding: 7px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; position: relative; }
.nav-btn .nav-ico { font-size: 1.25rem; }
.nav-btn.active { color: #fff; }
.nav-btn.active::after { content:""; position:absolute; bottom:2px; width: 26px; height: 3px; border-radius: 3px; background: var(--game-gold); }
.nav-btn.glow .nav-ico { animation: incomeglow 1.5s ease-in-out infinite; }
@keyframes incomeglow { 0%,100%{ filter: drop-shadow(0 0 0 #66BB6A);} 50%{ filter: drop-shadow(0 0 7px #66BB6A);} }
.nav-dot { position: absolute; top: 4px; right: 28%; background: var(--game-interactive); color:#fff; border-radius:999px; font-size:0.55rem; padding: 0 4px; font-weight:800; }

/* --- Modals --- */
/* Stronger scrim + slight blur so dialogs command focus over the busy,
   animated cave background (0.55 let the map cards read through too clearly). */
.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(8,5,3,0.68); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fade 0.2s ease; }
.modal-root[hidden] { display: none; }
.modal { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); max-width: 440px; width: 100%; max-height: 88vh; overflow: auto; animation: pop 0.28s ease; }
.modal h2 { margin: 0 0 8px; color: var(--heading); font-size: 1.35rem; }
/* Full-contrast narrative + choices (was muted and hard to read on the panel). */
.modal .m-narr { color: var(--game-text); font-size: 0.92rem; line-height: 1.5; margin-bottom: 16px; }
.modal .choice { width: 100%; text-align: left; background: color-mix(in srgb, var(--panel-2) 60%, var(--panel)); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; }
.modal .choice .c-label { font-weight: 800; color: var(--game-text); }
.modal .choice .c-dc { font-size: 0.76rem; color: color-mix(in srgb, var(--game-text) 70%, transparent); }
.modal .roll-result { text-align: center; font-weight: 800; font-size: 1.1rem; padding: 10px; }
.modal .roll-result.ok { color: var(--game-interactive); }
.modal .roll-result.bad { color: var(--game-danger); }
.victory-modal { text-align: center; }
.victory-modal .v-trophy { font-size: 3rem; animation: pulse 1.6s ease-in-out infinite; }
/* --medal-gold (not --game-gold): the deeper, theme-tuned treasure-gold clears
   AA on the panel where plain gold only hits ~3.3:1. See the .v-time rule below. */
.victory-modal .v-time { font-size: 2rem; font-weight: 800; color: var(--medal-gold); }

/* --- Toasts --- */
.toasts { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: 92%; max-width: 420px; }
.toast { background: var(--game-text); color: var(--game-secondary); padding: 9px 14px; border-radius: 999px; font-size: 0.84rem; font-weight: 600; box-shadow: var(--shadow); pointer-events: auto; animation: toastin 0.25s ease; max-width: 100%; text-align: center; }
.toast.good { background: var(--game-interactive); color: #fff; }
.toast.gold { background: var(--game-gold); color: #fff; }
.toast.bad { background: var(--game-danger); color: #fff; }
.toast .tx { background: rgba(255,255,255,0.3); border-radius: 999px; padding: 0 6px; margin-left: 6px; font-weight: 800; }
@keyframes toastin { from { opacity:0; transform: translateY(10px);} to { opacity:1; transform:none;} }

/* --- Settings --- */
.settings-body { display: grid; gap: 8px; }
.set-group-title { font-weight: 800; color: var(--game-text-muted); font-size: 0.82rem; margin: 12px 2px 2px; letter-spacing: 0.04em; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 11px 13px; box-shadow: var(--shadow-sm); }
.set-row .sr-label { font-weight: 600; }
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; }
.switch .track { position: absolute; inset: 0; background: var(--game-border); border-radius: 999px; transition: background 0.2s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: var(--shadow-sm); }
.switch input:checked ~ .track { background: var(--game-interactive); }
.switch input:checked ~ .thumb { transform: translateX(20px); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-box { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 9px 11px; box-shadow: var(--shadow-sm); }
.stat-box .sb-val { font-weight: 800; font-size: 1.05rem; }
.stat-box .sb-label { font-size: 0.68rem; color: var(--game-text-muted); }
.admin-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 8px 11px; }
.admin-field input { width: 90px; padding: 6px; border: 1px solid var(--game-border); border-radius: 6px; background: var(--panel-2); color: var(--game-text); font-size: 0.85rem; }

/* --- Leaderboard --- */
.lb-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.lb-tab { flex: 1; border: 1px solid var(--game-border); background: var(--panel); border-radius: 999px; padding: 8px; font-weight: 700; font-size: 0.82rem; min-height: 40px; color: var(--game-text); }
.lb-tab.active { background: var(--game-interactive); color: #fff; border-color: var(--game-interactive); }
.lb-row { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 6px; box-shadow: var(--shadow-sm); }
.lb-rank { font-weight: 800; width: 28px; }
.lb-rank.gold { color: var(--medal-gold); } .lb-rank.silver { color: var(--medal-silver); } .lb-rank.bronze { color: var(--medal-bronze); }
.lb-name { flex: 1; font-weight: 600; }
.lb-time { font-weight: 800; font-variant-numeric: tabular-nums; }

/* --- Version tag --- */
.version-tag { position: fixed; right: 5px; bottom: 4px; z-index: 70; font-size: 0.58rem; color: var(--game-text-muted); opacity: 0.45; pointer-events: none; font-variant-numeric: tabular-nums; }

/* --- Banner --- */
.warn-banner { background: var(--game-danger); color: #fff; font-size: 0.78rem; text-align: center; padding: 6px 10px; }

/* ============================================================================
   d20 ROLL — spinning die that settles on the event roll
   ============================================================================ */
.d20-target { text-align: center; font-weight: 700; color: var(--game-text-muted); margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.d20-stage { position: relative; width: 124px; height: 124px; margin: 6px auto 10px; display: grid; place-items: center; }
.d20-svg { width: 124px; height: 124px; display: block; }
.d20-body { fill: var(--game-primary); stroke: var(--game-gold); stroke-width: 2.5; stroke-linejoin: round; }
.d20-top  { fill: var(--game-gold); opacity: 0.92; }
.d20-edges line { stroke: rgba(0,0,0,0.28); stroke-width: 1; }
.d20-num {
  position: absolute; top: 47%; left: 50%; transform: translate(-50%, -50%);
  font-weight: 900; font-size: 1.7rem; color: #2F2E2C;
  text-shadow: 0 0 6px rgba(255,255,255,0.8), 0 1px 1px rgba(255,255,255,0.9);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.d20-svg.spin { animation: d20spin 1.5s cubic-bezier(.25,.7,.25,1) forwards; transform-origin: 50% 52%; }
.d20-svg.settle { animation: d20settle 0.45s ease; transform-origin: 50% 52%; }
@keyframes d20spin {
  0%   { transform: rotate(0deg)    scale(0.8); }
  70%  { transform: rotate(900deg)  scale(1.08); }
  100% { transform: rotate(1080deg) scale(1); }
}
@keyframes d20settle { 0%{ transform: scale(1.14);} 55%{ transform: scale(0.94);} 100%{ transform: scale(1);} }
/* success → olive glow + lock; fail → russet-red */
.d20-stage.ok  .d20-body { stroke: var(--game-good);   filter: drop-shadow(0 0 10px var(--game-good)); }
.d20-stage.ok  .d20-top  { fill: var(--game-good); }
.d20-stage.bad .d20-body { stroke: var(--game-danger); filter: drop-shadow(0 0 10px var(--game-danger)); }
.d20-stage.ok, .d20-stage.bad { animation: d20pop 0.4s ease; }
@keyframes d20pop { 0%{ transform: scale(1);} 40%{ transform: scale(1.12);} 100%{ transform: scale(1);} }

/* --- Event choices: olive = safe/good, russet-red = risky --- */
.modal .choice.safe  { border-left: 5px solid var(--game-good); }
.modal .choice.risky { border-left: 5px solid var(--game-danger); }
.modal .choice:active { transform: scale(0.985); }
.risk-tag { font-weight: 800; }
.choice.safe  .risk-tag { color: var(--game-good); }
.choice.risky .risk-tag { color: var(--game-danger); }
.roll-result.ok  { color: var(--game-good); }
.roll-result.bad { color: var(--game-danger); }

/* ============================================================================
   FANFARE & VISUAL FLOW
   ============================================================================ */
/* Per-screen entrance: gentle rise + fade (already on .screen; add slide variety) */
#screen-summary:not([hidden]) .sum-row { animation: rowin 0.35s ease backwards; }
.sum-row:nth-child(1){ animation-delay: .02s } .sum-row:nth-child(2){ animation-delay: .09s }
.sum-row:nth-child(3){ animation-delay: .16s } .sum-row:nth-child(4){ animation-delay: .23s }
.sum-row:nth-child(5){ animation-delay: .30s } .sum-row:nth-child(n+6){ animation-delay: .36s }
@keyframes rowin { from { opacity:0; transform: translateX(-14px); } to { opacity:1; transform:none; } }

/* Gem reveal: a brighter pop + a quick golden ring flash on the cell */
.dig-cell.just-revealed { animation: cellflash 0.5s ease; }
@keyframes cellflash { 0%{ box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); } 35%{ box-shadow: inset 0 0 0 3px var(--game-gold), 0 0 14px var(--game-gold); } 100%{ box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); } }
.dig-cell.empowered.just-revealed { animation: cellflashemp 0.6s ease; }
@keyframes cellflashemp { 0%{} 35%{ box-shadow: inset 0 0 0 3px var(--game-prestige), 0 0 16px var(--game-prestige); } 100%{} }

/* Goal: a shine sweep across the progress bar so the core goal feels alive */
.goal-fill { position: relative; overflow: hidden; }
.goal-fill::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  animation: shine 2.6s ease-in-out infinite; transform: translateX(-120%);
}
@keyframes shine { 0%{ transform: translateX(-120%);} 60%,100%{ transform: translateX(320%);} }

/* Primary buttons: subtle sheen on press-ready CTAs */
.btn { position: relative; overflow: hidden; }
.btn.gold::after, .btn.prestige::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transform: skewX(-18deg); animation: sweep 3.4s ease-in-out infinite;
}
@keyframes sweep { 0%{ left: -60%; } 45%,100%{ left: 130%; } }

/* Victory: confetti-free, tasteful — radiating sparkles + a warm glow ring */
.victory-modal { position: relative; overflow: hidden; }
.victory-modal::before {
  content: ""; position: absolute; inset: -40% 0 auto; height: 200%; pointer-events: none;
  background: radial-gradient(circle at 50% 18%, color-mix(in srgb, var(--game-gold) 45%, transparent), transparent 60%);
  animation: vglow 3s ease-in-out infinite;
}
@keyframes vglow { 0%,100%{ opacity: 0.55; } 50%{ opacity: 1; } }
.victory-modal .v-trophy { position: relative; animation: trophy 1.8s ease-in-out infinite; }
@keyframes trophy { 0%,100%{ transform: translateY(0) rotate(-4deg);} 50%{ transform: translateY(-6px) rotate(4deg);} }
/* Soft shadow seats the hero number on the warm card; color is the AA-safe
   --medal-gold set in the base .v-time rule above. */
.victory-modal .v-time { text-shadow: 0 1px 1px rgba(0,0,0,0.18); animation: vtime 1.6s ease-in-out infinite; }
@keyframes vtime { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.06);} }

/* Income collect / nav glow already animate; add a gentle bob to the store dot */
.nav-dot { animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-2px);} }

/* Toasts: small bounce-in already; add a gold sparkle accent on gold toasts */
.toast.gold::before { content: "✦ "; }
.toast.good::before { content: "✓ "; }

/* Gem cards: brilliant shimmer + empowered pulse already; lift on the collection */
.gem-card { transition: transform 0.12s ease, box-shadow 0.12s ease; }
.gem-card:active { transform: translateY(1px); }

/* Settings gear: rotate when open (toggled state) */
#btn-settings.open { transform: rotate(90deg); transition: transform 0.2s ease; }

/* Gem-confetti burst (victory / paragon peak moments) */
.confetti { position: fixed; inset: 0; z-index: 80; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -16px; width: 9px; height: 14px; background: var(--c); border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25); animation: confetti-fall 2s cubic-bezier(.25,.6,.5,1) forwards; }
@keyframes confetti-fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 130px), 108vh) rotate(var(--rot)); opacity: 0.5; }
}

/* "Run Complete!" celebratory banner on the leaderboard after a Paragon */
.run-complete {
  text-align: center; padding: 18px 14px; margin-bottom: 14px; border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--game-gold) 26%, var(--panel)), var(--panel));
  border: 1px solid var(--game-gold); box-shadow: var(--shadow); animation: pop 0.4s ease;
}
.run-complete .rc-burst { font-size: 2.2rem; animation: trophy 1.8s ease-in-out infinite; }
.run-complete .rc-title { font-weight: 800; font-size: 1.2rem; color: var(--game-text); }
/* Hero number: --medal-gold (deeper, AA-safe) reads on the gold-tinted card
   where plain --game-gold only hit ~2.5:1; shadow seats it. Matches the #1 rank
   gold in the board right below — the climax time and the top score rhyme. */
.run-complete .rc-time { font-weight: 800; font-size: 2.1rem; color: var(--medal-gold); text-shadow: 0 1px 1px rgba(0,0,0,0.18); font-variant-numeric: tabular-nums; line-height: 1.1; }
.run-complete .rc-sub { font-size: 0.82rem; color: var(--game-text-muted); font-weight: 600; margin-top: 4px; }

/* First-run coach tips — dismissible, one per screen */
.coach-tip {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--game-good) 16%, var(--panel));
  border: 1px solid var(--game-good); box-shadow: var(--shadow-sm);
  animation: tipin 0.3s ease;
}
@keyframes tipin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.coach-tip .tip-ico { font-size: 1.1rem; flex: 0 0 auto; }
.coach-tip .tip-text { flex: 1; font-size: 0.8rem; font-weight: 600; color: var(--game-text); line-height: 1.35; }
/* 44px min tap target — a thumb dismiss button shouldn't be a near-miss. */
.coach-tip .tip-x { flex: 0 0 auto; border: none; background: var(--game-good); color: #fff; font-weight: 800; font-size: 0.72rem; padding: 8px 13px; border-radius: 999px; min-height: 44px; }

/* ============================================================================
   SHOP BANNERS — Store (storefront) + Upgrades (miner's workshop)
   ============================================================================ */
.shop-banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--game-border);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.store-banner { background: linear-gradient(135deg, color-mix(in srgb, var(--game-prestige-light) 50%, var(--panel)), var(--panel)); }
.shop-workshop { background: linear-gradient(135deg, color-mix(in srgb, var(--game-gold) 22%, var(--panel)), var(--panel)); }
.shop-art { width: 64px; height: 64px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.25)); animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 0%,100%{ transform: translateY(0) rotate(-1.5deg);} 50%{ transform: translateY(-4px) rotate(1.5deg);} }
.shop-title { margin: 0; font-size: 1.25rem; color: var(--heading); }
.shop-sub { margin: 3px 0 0; font-size: 0.78rem; color: var(--game-text-muted); line-height: 1.35; }

/* Store income card as a shop counter / till */
.register { display: flex; align-items: center; gap: 12px; justify-content: center; }
.register-ico { font-size: 2rem; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2)); }
.register-body { text-align: left; }
.income-rate .per { font-size: 0.9rem; font-weight: 700; opacity: 0.8; }

/* Shelf label above the display cases */
.shelf-label { display: flex; align-items: center; gap: 10px; margin: 4px 2px 10px; font-weight: 800; color: var(--game-text-muted); font-size: 0.85rem; letter-spacing: 0.04em; }
.shelf-label::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--game-border), transparent); }

/* Display-case gem cards: glass shine + wood shelf foot */
.gem-card { background: linear-gradient(180deg, var(--panel), var(--panel-2)); border-bottom: 3px solid color-mix(in srgb, var(--game-primary) 55%, var(--panel-2)); overflow: hidden; }
.gem-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 42%; background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent); pointer-events: none; }
.gem-card img { filter: drop-shadow(0 3px 4px rgba(0,0,0,0.28)); }

/* Store empty state art */
.es-art { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto 10px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25)); }

/* ============================================================================
   UPGRADE category headers (workshop crates) + cards
   ============================================================================ */
.upgrade-cat { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 16px 2px 8px; }
.upgrade-cat .uc-ico { font-size: 1.15rem; }
.upgrade-cat .uc-name { font-weight: 800; color: var(--game-text); font-size: 0.95rem; letter-spacing: 0.02em; }
.upgrade-cat .uc-blurb { font-size: 0.72rem; color: var(--game-text-muted); }
.up-card { border-left: 4px solid color-mix(in srgb, var(--game-primary) 60%, transparent); }

/* ============================================================================
   MAP site availability badges + card states (clear "what can I mine")
   ============================================================================ */
.site-badge {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.4);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.badge-ready      { background: var(--game-good); animation: readypulse 1.8s ease-in-out infinite; }
.badge-unlockable { background: var(--game-gold); }
.badge-short      { background: rgba(40,30,20,0.78); }
.badge-locked     { background: rgba(30,24,18,0.82); font-weight: 700; }
@keyframes readypulse { 0%,100%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--game-good) 70%, transparent); } 50%{ box-shadow: 0 0 0 5px transparent; } }
/* Diggable-now sites get an inviting olive ring; locked/too-pricey dim back. */
.site-card.status-ready  { outline: 2px solid color-mix(in srgb, var(--game-good) 75%, transparent); outline-offset: -2px; }
.site-card.status-locked { filter: grayscale(0.55) brightness(0.62); }
.site-card.status-short  { filter: brightness(0.86); }

/* ============================================================================
   SETTINGS — grouped cards for readability
   ============================================================================ */
.set-card { background: var(--panel); border: 1px solid var(--game-border); border-radius: var(--radius-sm); padding: 4px; box-shadow: var(--shadow-sm); display: grid; gap: 2px; }
.set-card .set-row { background: transparent; border: none; box-shadow: none; border-radius: 8px; }
.set-card .set-row:not(:last-child) { border-bottom: 1px solid color-mix(in srgb, var(--game-border) 60%, transparent); }
.set-group-title { display: flex; align-items: center; gap: 6px; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .bg, .bg-accent { animation: none !important; }
  .goal-fill::after, .btn.gold::after, .btn.prestige::after, .victory-modal::before { display: none; }
}
