/* ════════════════════════════════════════════════════════════
   JAGA-JAGA! v2 — "KL after dark" design system
   Dark (default): ink #06080F · glass surfaces · gold #F5B84C
   · cyan #55E6FF · rose #FF5D7A · mint #3BE8A0
   Display: Unbounded · Body: Space Grotesk · Data: IBM Plex Mono
   ════════════════════════════════════════════════════════════ */
:root {
  --bg: #06080F;
  --bg-2: #0A0E1A;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-hi: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.09);
  --text: #EAF0F8;
  --text-dim: #93A1B8;
  --gold: #F5B84C;
  --gold-2: #FF9A3D;
  --cyan: #55E6FF;
  --rose: #FF5D7A;
  --mint: #3BE8A0;
  --radius: 22px;
  --radius-s: 14px;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --glow-gold: 0 0 24px rgba(245, 184, 76, 0.25);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
html[data-theme="light"] {
  --bg: #EEF1F7;
  --bg-2: #FFFFFF;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-hi: rgba(255, 255, 255, 0.95);
  --stroke: rgba(10, 20, 40, 0.1);
  --text: #10182B;
  --text-dim: #5A6880;
  --gold: #D98A12;
  --gold-2: #E86A1C;
  --cyan: #0891B2;
  --rose: #E11D48;
  --mint: #0FA968;
  --glow-gold: 0 0 0 rgba(0,0,0,0);
  --shadow: 0 14px 34px rgba(20, 32, 60, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(85, 230, 255, 0.07), transparent 60%),
    radial-gradient(700px 420px at 0% 30%, rgba(245, 184, 76, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s, color 0.4s;
}
main { max-width: 680px; margin: 0 auto; padding: 26px 18px 80px; display: flex; flex-direction: column; gap: 40px; }
a { color: var(--cyan); text-decoration-thickness: 1px; }
.muted { color: var(--text-dim); font-size: 0.92rem; }

/* ─────────── HERO ─────────── */
.diorama {
  position: relative;
  height: min(64vh, 620px);
  min-height: 460px;
  overflow: hidden;
}
#sky-canvas, .diorama-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.diorama-fallback { display: none; background: linear-gradient(180deg, #040713, #0b1230 70%, #16224a); }
.diorama.no-webgl #sky-canvas { display: none; }
.diorama.no-webgl .diorama-fallback { display: block; }
.diorama::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 46%;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none;
}

.hud { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 20px 18px 8px; z-index: 2; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 4.4vw, 1.5rem);
  letter-spacing: 0.01em;
  background: linear-gradient(92deg, var(--gold), var(--gold-2) 55%, var(--rose));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 12px rgba(245,150,60,0.35));
}
.hud-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chip-btn {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  color: var(--text);
  background: rgba(10, 14, 26, 0.55);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  padding: 8px 13px; cursor: pointer;
  transition: border-color .2s, transform .15s;
}
html[data-theme="light"] .chip-btn { background: rgba(255,255,255,0.7); }
.chip-btn:hover { border-color: var(--gold); transform: translateY(-1px); }

.xp-chip {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.7rem;
  background: rgba(10, 14, 26, 0.55);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(12px);
  border-radius: 999px; padding: 8px 14px;
}
html[data-theme="light"] .xp-chip { background: rgba(255,255,255,0.7); }
.xp-rank { color: var(--gold); font-weight: 700; white-space: nowrap; }
.xp-bar { width: 58px; height: 6px; background: rgba(255,255,255,0.12); border-radius: 99px; overflow: hidden; }
html[data-theme="light"] .xp-bar { background: rgba(10,20,40,0.12); }
.xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--rose)); border-radius: 99px; transition: width .6s cubic-bezier(.2,.9,.3,1.3); }
.xp-num { white-space: nowrap; color: var(--text); }

.hud-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; padding-bottom: 10px; }
.eyebrow { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.28em; color: var(--cyan); text-transform: uppercase; }
.loc-name {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.2rem, 5.4vw, 1.9rem);
  color: var(--text); background: none; border: none; cursor: pointer;
  text-align: left; padding: 4px 0;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55);
}
.loc-name:hover { color: var(--gold); }
.now-line { font-size: 0.92rem; color: var(--text); opacity: 0.92; max-width: 44ch; text-shadow: 0 1px 10px rgba(0,0,0,0.6); }
html[data-theme="light"] .loc-name, html[data-theme="light"] .now-line { text-shadow: none; }

.temp-block { text-align: right; flex-shrink: 0; }
.temp-big {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.6rem, 11vw, 4rem); line-height: 1;
  background: linear-gradient(180deg, #fff, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 20px rgba(245,184,76,0.35));
  display: block;
}
html[data-theme="light"] .temp-big { background: linear-gradient(180deg, #1a2540, var(--gold-2)); -webkit-background-clip: text; background-clip: text; }
.temp-small { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); }

/* ─────────── sections / cards ─────────── */
.section-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 0.92rem; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.week-tag { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-dim); font-weight: 400; }

.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }

/* check-in */
.checkin-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.streak-flame { font-size: 2.1rem; filter: grayscale(1) opacity(0.5); transition: filter .3s, transform .3s; }
.streak-flame.lit { filter: none; animation: flame 1.2s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scale(1) rotate(-4deg); } to { transform: scale(1.14) rotate(4deg); } }
.checkin-copy { flex: 1; min-width: 150px; }

/* buttons */
.btn {
  font-family: var(--font-display); font-weight: 600; font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 13px 20px; border-radius: 999px;
  border: none; cursor: pointer;
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.btn:active { transform: scale(0.97); }
.btn-yellow {
  background: linear-gradient(92deg, var(--gold), var(--gold-2));
  color: #17120a;
  box-shadow: var(--glow-gold);
}
.btn-yellow:hover { transform: translateY(-2px); box-shadow: 0 0 32px rgba(245,184,76,0.4); }
.btn-yellow:disabled { background: var(--surface-hi); color: var(--text-dim); box-shadow: none; cursor: default; transform: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--stroke); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost.picked { border-color: var(--mint); color: var(--mint); box-shadow: 0 0 18px rgba(59,232,160,0.2); }

/* alerts */
.alerts-list { display: flex; flex-direction: column; gap: 12px; }
.alert-card {
  border-radius: var(--radius);
  padding: 18px 20px; font-size: 0.92rem;
  border: 1px solid var(--stroke);
  background: var(--surface);
  backdrop-filter: blur(16px);
}
.alert-danger { border-color: rgba(255, 93, 122, 0.55); background: linear-gradient(180deg, rgba(255,93,122,0.1), var(--surface)); }
.alert-clear { border-color: rgba(59, 232, 160, 0.5); background: linear-gradient(180deg, rgba(59,232,160,0.08), var(--surface)); }
.alert-loading, .fuel-loading, .fc-loading { color: var(--text-dim); }
.alert-title { font-weight: 700; display: block; margin-bottom: 3px; }
.alert-meta { font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-dim); display: block; margin-top: 8px; }
.siren { display: inline-block; animation: siren 1.6s linear infinite; }
@keyframes siren { 0%,100% { transform: rotate(-10deg);} 50% { transform: rotate(10deg);} }
.alerts-more { align-self: flex-start; }

/* forecast strip */
.forecast-strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; }
.forecast-strip::-webkit-scrollbar { height: 5px; }
.forecast-strip::-webkit-scrollbar-thumb { background: var(--surface-hi); border-radius: 99px; }
.fc-card {
  scroll-snap-align: start;
  min-width: 116px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px 12px; text-align: center;
  backdrop-filter: blur(16px);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.fc-card:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: var(--glow-gold); }
.fc-card.today { border-color: var(--gold); background: linear-gradient(180deg, rgba(245,184,76,0.1), var(--surface)); }
.fc-day { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.14em; color: var(--text-dim); }
.fc-emoji { font-size: 2rem; display: block; margin: 10px 0 6px; }
.fc-temp { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: var(--gold); }
.fc-desc { font-size: 0.72rem; color: var(--text-dim); margin-top: 5px; line-height: 1.35; }

.src-line { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-dim); margin-top: 6px; opacity: 0.8; }

/* game */
.game-options { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.game-status { margin-top: 14px; font-size: 0.9rem; color: var(--mint); min-height: 1.2em; }

/* fuel */
.fuel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.fuel-card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(16px);
  position: relative; overflow: hidden;
}
.fuel-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.fuel-card.ron97::before { background: linear-gradient(90deg, var(--mint), transparent); }
.fuel-card.diesel::before { background: linear-gradient(90deg, var(--rose), transparent); }
.fuel-name { font-family: var(--font-display); font-weight: 600; font-size: 0.7rem; color: var(--text-dim); }
.fuel-price { font-family: var(--font-mono); font-size: 1.55rem; font-weight: 700; margin: 8px 0 2px; }
.fuel-price small { font-size: 0.7rem; color: var(--text-dim); }
.fuel-delta { font-family: var(--font-mono); font-size: 0.68rem; }
.delta-up { color: var(--rose); } .delta-down { color: var(--mint); } .delta-flat { color: var(--text-dim); }
.fuel-note { font-family: var(--font-mono); font-size: 0.64rem; color: var(--cyan); margin-top: 10px; }

/* badges */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.badge {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px 10px; text-align: center;
  opacity: 0.35; filter: grayscale(1);
  backdrop-filter: blur(16px);
  transition: opacity .3s, filter .3s, transform .3s, border-color .3s;
}
.badge.earned { opacity: 1; filter: none; border-color: var(--gold); box-shadow: var(--glow-gold); }
.badge.earned:hover { transform: rotate(-3deg) scale(1.06); }
.badge-emoji { font-size: 1.7rem; display: block; }
.badge-name { font-family: var(--font-mono); font-size: 0.6rem; margin-top: 8px; display: block; color: var(--text-dim); }
.badge.earned .badge-name { color: var(--text); }

/* footer */
.footer { text-align: center; font-size: 0.85rem; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.footer-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }

/* dialogs */
.modal {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 26px;
  width: min(92vw, 460px);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(3, 6, 14, 0.72); backdrop-filter: blur(4px); }
.loc-form { display: flex; flex-direction: column; gap: 16px; }
.loc-input {
  font-family: var(--font-body); font-size: 1rem;
  padding: 13px 16px; border-radius: var(--radius-s);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
}
.loc-input:focus { outline: none; border-color: var(--gold); }
.loc-chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 180px; overflow-y: auto; }
.loc-chip {
  font-family: var(--font-mono); font-size: 0.68rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--stroke); border-radius: 999px;
  padding: 7px 13px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.loc-chip:hover { border-color: var(--gold); color: var(--gold); }
.loc-actions { display: flex; justify-content: flex-end; gap: 10px; }
.about-body { display: flex; flex-direction: column; gap: 12px; font-size: 0.92rem; }
.about-body h3 { font-family: var(--font-display); font-size: 0.85rem; margin-top: 6px; }
.about-close { align-self: flex-end; margin-top: 8px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translate(-50%, 130%);
  background: linear-gradient(92deg, var(--gold), var(--gold-2));
  color: #17120a;
  font-family: var(--font-display); font-weight: 600; font-size: 0.78rem;
  padding: 15px 24px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: transform .35s cubic-bezier(.2,.9,.3,1.3);
  z-index: 60; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

button:focus-visible, .loc-input:focus-visible, .forecast-strip:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
@media (max-width: 420px) {
  .hud-controls { gap: 6px; }
  .chip-btn { padding: 7px 10px; font-size: 0.66rem; }
}
