:root {
  --navy-0: #040a14;
  --navy-1: #06101f;
  --navy-2: #0c1c36;
  --frost: #9ec8ef;
  --frost-dim: #6a8db0;
  --amber: #ff9a2e;
  --amber-hot: #ffc45a;
  --amber-deep: #d96a00;
  --glass: rgba(12, 28, 54, .78);
  --line: rgba(158, 200, 239, .18);
  --text: #eef4fb;
  --muted: #8aa4c4;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%; overflow: hidden;
  background: var(--navy-1);
  font-family: "Figtree", system-ui, sans-serif;
  color: var(--text);
}

#game { display: block; width: 100vw; height: 100vh; touch-action: none; }

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  text-align: center;
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(255, 154, 46, .16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(80, 140, 220, .12), transparent 50%),
    rgba(4, 10, 20, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  animation: overlayIn .45s ease both;
}
.overlay.hidden { display: none; }

@keyframes overlayIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 8px 0 var(--amber-deep), 0 14px 36px rgba(255, 154, 46, .35); }
  50% { box-shadow: 0 8px 0 var(--amber-deep), 0 14px 48px rgba(255, 196, 90, .55); }
}
@keyframes scorePop {
  from { transform: scale(.72); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.brand-logo {
  width: min(220px, 58vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .35));
}
.brand-logo--sm { width: min(160px, 46vw); }

.title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(22px, 5.5vw, 30px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tagline {
  color: var(--muted);
  font-size: clamp(14px, 3.6vw, 17px);
  max-width: 380px;
  line-height: 1.5;
  font-weight: 500;
}

.fuel-picker {
  width: min(360px, 92vw);
  margin: 4px 0 2px;
}
.fuel-picker__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--frost-dim);
  margin-bottom: 8px;
}
.fuel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fuel-card {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  background: rgba(4, 10, 20, .45);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: border-color .15s, background .15s, transform .1s;
}
.fuel-card:active { transform: scale(.97); }
.fuel-card.selected {
  border-color: rgba(255, 154, 46, .75);
  background: rgba(255, 154, 46, .14);
  box-shadow: 0 0 0 1px rgba(255, 154, 46, .25), inset 0 0 20px rgba(255, 154, 46, .08);
}
.fuel-card__icon {
  width: 28px;
  height: 28px;
  display: block;
  position: relative;
}
.fuel-card__icon--propane {
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  background: linear-gradient(180deg, #ffc45a, #ff8c1a);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.12);
}
.fuel-card__icon--propane::after {
  content: "";
  position: absolute;
  top: 4px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 6px;
  border-radius: 2px;
  background: #0b1e3a;
}
.fuel-card__icon--pellet {
  background:
    radial-gradient(circle at 30% 40%, #c4a574 0 35%, transparent 36%),
    radial-gradient(circle at 68% 48%, #b89560 0 32%, transparent 33%),
    radial-gradient(circle at 48% 72%, #d4b888 0 28%, transparent 29%);
}
.fuel-card__icon--coal {
  background:
    radial-gradient(circle at 28% 40%, #5a6270 0 30%, transparent 31%),
    radial-gradient(circle at 58% 52%, #3e4652 0 34%, transparent 35%),
    radial-gradient(circle at 72% 30%, #7a8492 0 22%, transparent 23%),
    radial-gradient(circle at 42% 72%, #2a3038 0 26%, transparent 27%);
}
.fuel-card__icon--oil {
  border-radius: 4px 4px 10px 10px;
  background: linear-gradient(180deg, #6a7888, #2e3844);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.12);
}
.fuel-card__icon--oil::before {
  content: "";
  position: absolute;
  top: 2px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 4px;
  border-radius: 2px;
  background: #ff9a2e;
}
.fuel-card__name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.fuel-card__hint {
  font-size: 10px;
  font-weight: 500;
  color: var(--frost-dim);
  line-height: 1.2;
}
.fuel-card.selected .fuel-card__hint { color: #ffd7a0; }

.panel {
  width: min(360px, 92vw);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

.btn {
  border: 0; border-radius: 16px;
  padding: 15px 32px;
  font-family: inherit;
  font-size: 17px; font-weight: 700;
  cursor: pointer; color: #1a0e00;
  background: linear-gradient(180deg, var(--amber-hot), var(--amber));
  box-shadow: 0 8px 0 var(--amber-deep), 0 14px 36px rgba(255, 154, 46, .35);
  transition: transform .1s, box-shadow .1s;
  animation: pulseGlow 2.4s ease-in-out infinite;
}
.btn:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--amber-deep); animation: none; }
.btn.ghost {
  background: rgba(255,255,255,.06);
  color: var(--frost);
  box-shadow: none;
  border: 1px solid var(--line);
  font-weight: 600;
  animation: none;
}
.btn.ghost:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.cluster {
  background: linear-gradient(180deg, #3d6fa8, #2a4f7a);
  color: #e8f0fa;
  box-shadow: 0 6px 0 #1a3350;
  border: 0;
}
.btn.cluster:active { box-shadow: 0 3px 0 #1a3350; }
.btn.store {
  background: linear-gradient(180deg, #3ddc84, #1aae5a);
  color: #062816;
  box-shadow: 0 8px 0 #0f7a3c, 0 14px 36px rgba(26, 174, 90, .3);
  animation: none;
  gap: 8px;
}
.btn.store:active { box-shadow: 0 3px 0 #0f7a3c; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

.howto {
  color: var(--frost-dim);
  font-size: 13px;
  max-width: 340px;
  line-height: 1.55;
}
.howto strong { color: var(--frost); font-weight: 600; }

.score-big {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: clamp(56px, 16vw, 92px);
  font-weight: 800;
  color: var(--amber-hot);
  line-height: .95;
  letter-spacing: -0.04em;
  text-shadow: 0 0 40px rgba(255, 154, 46, .45);
  animation: scorePop .4s cubic-bezier(.2, 1.2, .4, 1) both;
}
.score-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.fuel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,154,46,.12);
  border: 1px solid rgba(255,154,46,.28);
  color: var(--amber-hot);
  font-size: 13px;
  font-weight: 600;
}
.fuel-badge:empty { display: none; }

.priority-note {
  color: #ffd7a0;
  font-size: 14px;
  max-width: 340px;
  line-height: 1.45;
  font-weight: 500;
}
.fine { color: #5a7396; font-size: 11px; max-width: 320px; line-height: 1.45; }

.best-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255,154,46,.12);
  border: 1px solid rgba(255,154,46,.28);
  color: var(--amber-hot);
  font-size: 13px; font-weight: 600;
}
.best-pill:empty { display: none; }

.daily-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(158,200,239,.1);
  border: 1px solid rgba(158,200,239,.22);
  color: var(--frost);
  font-size: 12px; font-weight: 600;
  letter-spacing: .02em;
}

.area-stats {
  max-width: min(360px, 92vw);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255,154,46,.08);
  border: 1px solid rgba(255,154,46,.28);
  color: var(--amber-hot);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
}
.area-stats[hidden] { display: none !important; }
.area-stats .area-stats__sub {
  display: block;
  margin-top: 2px;
  color: var(--frost-dim);
  font-size: 11px;
  font-weight: 600;
}

.goal-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255,196,90,.16);
  border: 1px solid rgba(255,196,90,.4);
  color: var(--amber-hot);
  font-size: 12px; font-weight: 700;
}
.goal-badge.hidden { display: none; }

.record-gap {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  min-height: 1.2em;
}
.record-gap:empty { display: none; }
.record-gap--new {
  color: var(--amber-hot);
  text-shadow: 0 0 18px rgba(255,154,46,.35);
}

.overlay--pause {
  z-index: 20;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(255,154,46,.1), transparent 55%),
    rgba(4, 10, 20, .82);
}

.mute-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--frost-dim);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.mute-btn[aria-pressed="true"] { color: #5a7396; }

#leadForm, #scoreForm { display: flex; flex-direction: column; gap: 10px; width: 100%; }
#leadForm input, #scoreForm input {
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(4, 10, 20, .55);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; text-align: center;
}
#leadForm input:focus, #scoreForm input:focus {
  outline: none;
  border-color: rgba(255,154,46,.65);
  box-shadow: 0 0 0 3px rgba(255,154,46,.18);
}
#leadForm input::placeholder, #scoreForm input::placeholder { color: #5f789c; }
.hp { position: absolute; left: -9999px; }

.consent {
  font-size: 12px; color: var(--muted);
  display: flex; gap: 8px; align-items: flex-start;
  text-align: left; line-height: 1.4;
}
.consent input { margin-top: 2px; accent-color: var(--amber); }

.score-row { display: flex; gap: 8px; width: 100%; }
.score-row input { flex: 1; min-width: 0; text-align: left; }
.score-row .btn { padding: 12px 14px; flex-shrink: 0; }

.board { width: 100%; margin-top: 4px; text-align: left; }
.board-title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--frost-dim);
  margin-bottom: 8px;
}
.board-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; padding: 6px 2px;
  border-bottom: 1px solid rgba(158,200,239,.08);
  font-size: 13px; color: #cfe0f5;
}
.board-row:last-child { border-bottom: 0; }
.board-rank { color: var(--frost-dim); font-variant-numeric: tabular-nums; min-width: 1.4em; }
.board-nick { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-pc { color: #5f789c; font-size: 11px; }
.board-score { color: var(--amber-hot); font-weight: 700; font-variant-numeric: tabular-nums; }

.panel.hidden { display: none; }
.panel-title {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}
.panel-copy {
  margin: 0 auto 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.next-step { width: min(360px, 92vw); }
.next-step__eyebrow {
  margin-bottom: 9px;
  color: var(--frost-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.next-step__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.path-card {
  min-height: 106px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.055);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.path-card--warm {
  border-color: rgba(255,154,46,.35);
  background: rgba(255,154,46,.1);
}
.path-card__title { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 800; line-height: 1.2; }
.path-card__desc { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
.path-card:active { transform: scale(.98); }

.actions { display: flex; flex-direction: column; gap: 14px; width: min(360px, 92vw); }
.actions .btn { width: 100%; min-height: 50px; padding: 13px 18px; font-size: 15px; }
.actions .action-link { box-shadow: 0 5px 0 var(--amber-deep); }
.actions .cluster { box-shadow: 0 5px 0 #1a3350; }
.actions .store { box-shadow: 0 5px 0 #0f7a3c; }

@media (max-width: 480px) {
  .overlay { justify-content: flex-start; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom)); }
  #startScreen { justify-content: center; }
  .brand-logo--sm { width: 124px; }
  .score-big { font-size: 58px; }
  .panel, .actions, .next-step { width: 100%; }
  .next-step__grid { grid-template-columns: 1fr; }
  .path-card { min-height: 0; }
  .score-row { flex-direction: column; }
  .score-row .btn { width: 100%; }
  .actions { gap: 13px; }
  .actions .btn { min-height: 48px; }
}

@media (max-height: 700px) {
  #startScreen { justify-content: flex-start; }
  .fuel-card { padding: 8px; }
  .fuel-card__icon { width: 22px; height: 22px; }
}

.saved-mark {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #2a3a55, #0c1c36 70%);
  border: 1px solid var(--line);
  box-shadow: 0 0 40px rgba(255,154,46,.25);
}
.saved-mark img { width: 40px; height: 40px; }
