/* Alpine Mountain Learning — game HUD styling.
   Dark theme is the default; [data-theme="light"] switches the palette. */
:root {
  --bg: #0a0f0d;
  --bg-2: #0e1512;
  --panel: rgba(255, 255, 255, .045);
  --panel-strong: rgba(255, 255, 255, .08);
  --panel-solid: #131b17;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .22);
  --ink: #e9efe9;
  --muted: #8fa198;
  --gold: #ffd75e;
  --gold-deep: #d9a93c;
  --gold-soft: rgba(255, 215, 94, .12);
  --green: #7cf0a5;
  --green-deep: #35754f;
  --ok-soft: rgba(124, 240, 165, .12);
  --wrong: #ff8a66;
  --wrong-soft: rgba(255, 138, 102, .12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef1ec;
  --bg-2: #e4e9e2;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-solid: #ffffff;
  --line: #d9dfd6;
  --line-strong: #b7c1b4;
  --ink: #182420;
  --muted: #62716a;
  --gold: #c9931f;
  --gold-deep: #a87c15;
  --gold-soft: #f4e3bd;
  --green: #2a5e40;
  --green-deep: #2a5e40;
  --ok-soft: #e2f2e7;
  --wrong: #c14e33;
  --wrong-soft: #f8e4dc;
  --shadow-sm: 0 1px 2px rgba(15, 35, 24, .08);
  --shadow: 0 2px 6px rgba(15, 35, 24, .08), 0 12px 32px rgba(15, 35, 24, .10);
  --shadow-lg: 0 4px 12px rgba(15, 35, 24, .12), 0 24px 60px rgba(15, 35, 24, .16);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 500px at 50% -140px, rgba(124, 240, 165, .06), transparent 65%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
main {
  max-width: 1020px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    calc(56px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

h1 { font-size: 1.6rem; margin: .2em 0; letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: 1.2rem; margin: .5em 0 .4em; letter-spacing: -.01em; font-weight: 750; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .22em; font-size: .68rem;
  color: var(--green); font-weight: 800; margin: 0 0 2px;
}
.section-title {
  font-size: .74rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .18em; color: var(--muted); margin: 26px 2px 10px;
}
.ico-svg { vertical-align: -4px; flex: none; }

button {
  font: inherit; font-weight: 650;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--panel); color: var(--ink); padding: 11px 18px; cursor: pointer;
  min-height: 44px; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
button:hover { border-color: var(--line-strong); background: var(--panel-strong); }
button:active { transform: scale(.97); }
button.primary {
  background: linear-gradient(160deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #141004; border-color: transparent; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; font-size: .92rem;
  box-shadow: 0 4px 18px rgba(217, 169, 60, .35);
}
button.primary:hover { box-shadow: 0 6px 26px rgba(217, 169, 60, .5); background: linear-gradient(160deg, var(--gold) 0%, var(--gold-deep) 100%); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
button.ghost:hover { color: var(--ink); background: var(--panel); border-color: transparent; }
button:disabled { opacity: .45; cursor: default; box-shadow: none; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; margin: 12px 0;
  box-shadow: var(--shadow-sm);
}
.muted { color: var(--muted); font-size: .9rem; }
.center { text-align: center; }

/* ================= hero banner ================= */
.hero {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-lg); margin: 4px 0 18px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.hero img { width: 100%; display: block; min-height: 190px; object-fit: cover; }
.hero .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(5, 9, 7, .12) 30%, rgba(5, 9, 7, .82) 100%);
}
.hero .hero-text {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 24px;
  color: #fff; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
}
.hero .hero-text h1 { color: #fff; margin: 0; text-shadow: 0 1px 10px rgba(0,0,0,.5); }
.hero .hero-text p { margin: 2px 0 0; opacity: .93; text-shadow: 0 1px 6px rgba(0,0,0,.55); font-size: .95rem; }
.hero .eyebrow { color: #a9dcbc; }

/* progress ring */
.ring { flex: none; width: 74px; height: 74px; position: relative; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .bgc { stroke: rgba(255,255,255,.22); }
.ring .fgc { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: .95rem; color: #fff;
}

/* ================= action tiles ================= */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.action {
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel);
  padding: 16px; cursor: pointer; text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex; flex-direction: column; gap: 5px; min-height: 0;
}
.action:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.action .ico { color: var(--gold); line-height: 1; }
.action b { font-size: 1rem; letter-spacing: .02em; text-transform: uppercase; font-size: .88rem; font-weight: 800; }
.action span { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.action.big {
  grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 16px;
  background: linear-gradient(150deg, rgba(53, 117, 79, .55) 0%, rgba(14, 27, 20, .9) 100%);
  color: #fff; border-color: rgba(124, 240, 165, .25); padding: 20px 22px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.action.big span { color: #cfe4d6; text-transform: none; }
.action.big b { font-size: 1.02rem; }
.action.big .go {
  margin-left: auto; background: var(--gold); color: #141004; border-radius: var(--r-md);
  padding: 10px 18px; font-weight: 800; font-size: .85rem; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .06em;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 3px 14px rgba(217, 169, 60, .35);
}

/* difficulty segmented control */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.seg button {
  border: none; border-radius: 0; min-height: 38px; padding: 7px 16px;
  background: transparent; color: var(--muted); font-size: .82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--gold-soft); color: var(--gold); }
/* the seg inside the dark-green start card needs its own contrast */
.action.big .seg { border-color: rgba(255,255,255,.35); }
.action.big .seg button { color: #cfe0d4; border-color: rgba(255,255,255,.35); }
.action.big .seg button.on { background: rgba(255, 215, 94, .2); color: #ffd75e; }

/* ================= map ================= */
.map-card { padding: 8px; overflow: hidden; }
.map-wrap {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: var(--bg-2) center/cover no-repeat;
  width: 100%;
}
.map-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), inset 0 -30px 60px rgba(5, 10, 7, .35);
}
.map-wrap svg.cantons {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.map-dot {
  position: absolute; transform: translate(-50%, -50%); cursor: pointer;
  font-size: 15px; line-height: 1; background: none; border: none; padding: 6px;
  min-height: 0; z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,.75);
  transition: transform .1s ease;
}
.map-dot:hover { transform: translate(-50%, -50%) scale(1.35); box-shadow: none; border-color: transparent; background: none; }
.map-dot span.name {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  font-size: .58rem; font-weight: 700; color: #fff; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
}
.legend { display: flex; gap: 16px; justify-content: center; padding: 10px 0 4px; font-size: .78rem; color: var(--muted); }
.legend b { font-weight: 400; }

/* ================= scene ================= */
.scene-wrap {
  position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--bg-2);
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.scene-wrap img { display: block; width: 100%; height: auto; }
.scene-cap {
  display: flex; align-items: center; gap: 6px;
  margin: 8px 4px 0; font-size: .85rem; color: var(--muted); font-weight: 550;
}
.expand-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  min-height: 0; width: 38px; height: 38px; padding: 0; border-radius: var(--r-sm);
  background: rgba(8, 12, 10, .55); color: #fff; border-color: rgba(255,255,255,.25);
  backdrop-filter: blur(4px);
}
.expand-btn:hover { background: rgba(8, 12, 10, .75); }
.expand-btn.wide { width: auto; padding: 0 12px; gap: 6px; font-size: .8rem; font-weight: 750; }
.marker {
  position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 3px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,.5), inset 0 0 0 2px rgba(0,0,0,.5), 0 2px 10px rgba(0,0,0,.4);
  pointer-events: none;
}
.marker.correct { border-color: #8ff0ac; }
.marker.wrong { border-color: #ffab8a; }
.peak-label {
  position: absolute; transform: translate(-50%, -150%);
  background: rgba(10, 15, 12, .9); color: #fff; padding: 4px 11px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.16);
  font-size: .85rem; font-weight: 650; white-space: nowrap; pointer-events: none;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.peak-label.small { font-size: .72rem; opacity: .92; font-weight: 500; }
.dimmer { position: absolute; inset: 0; pointer-events: none; }
.dimmer div { position: absolute; top: 0; bottom: 0; background: rgba(6, 9, 8, .55); }

/* ================= lightbox (panorama viewer) ================= */
.lightbox { position: fixed; inset: 0; background: #000; z-index: 60; }
.lb-scroll {
  width: 100%; height: 100%; overflow: hidden;   /* never a scrollbar: panning is pointer-driven */
  cursor: grab; touch-action: none; scrollbar-width: none;
}
.lb-scroll::-webkit-scrollbar { display: none; }
.lb-scroll.dragging { cursor: grabbing; }
.lb-canvas { position: relative; border-radius: 0; border: none; box-shadow: none; }
.lb-canvas img { width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.lb-close {
  position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 48px); right: max(14px, env(safe-area-inset-right));
  z-index: 61; min-height: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  background: rgba(8, 12, 10, .6); color: #fff; border-color: rgba(255,255,255,.3);
  backdrop-filter: blur(4px);
}
.lb-compass {
  position: fixed; left: 0; right: 0; top: 0; z-index: 61; pointer-events: none;
}
.lightbox .expand-btn { display: none; }
.lightbox .season-btn { display: block; position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 48px); right: calc(max(14px, env(safe-area-inset-right)) + 54px); }
.lb-hint {
  position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  z-index: 61; color: rgba(255,255,255,.75); font-size: .78rem;
  background: rgba(8,12,10,.55); padding: 6px 14px; border-radius: 999px; pointer-events: none;
}

/* ================= session ================= */
.session-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.session-progress { display: flex; gap: 5px; flex: 1; }
.session-progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-strong); }
.session-progress i.done { background: var(--green); }
.session-progress i.bad { background: var(--wrong); }
.quit-x {
  flex: none; min-height: 0; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); font-size: 1rem;
}

.question-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--r-md); padding: 10px 18px; margin: 0 0 12px;
  font-weight: 750; font-size: 1.1rem; letter-spacing: -.01em;
  box-shadow: var(--shadow-sm);
}

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 9px; margin-top: 14px; }
.options button {
  text-align: left; justify-content: flex-start; border-radius: var(--r-md); padding: 12px 16px;
  border: 1px solid var(--line); background: var(--panel); font-size: 1rem;
  display: flex; align-items: center; gap: 12px;
}
.options button .key {
  flex: none; width: 28px; height: 28px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--panel-strong); color: var(--muted); font-size: .82rem; font-weight: 750;
}
.options button:hover { border-color: var(--gold); }
.options button:hover .key { background: var(--gold); color: #141004; }
.options button.correct { background: var(--ok-soft); border-color: var(--green); }
.options button.correct .key { background: var(--green); color: #06130b; }
.options button.wrong { background: var(--wrong-soft); border-color: var(--wrong); }
.options button.wrong .key { background: var(--wrong); color: #1b0a04; }

.feedback { margin-top: 14px; }
.feedback .verdict { font-weight: 750; font-size: 1.06rem; margin: 0 0 6px; }
.feedback .verdict.ok { color: var(--green); }
.feedback .verdict.no { color: var(--wrong); }
.inset-map {
  border-radius: var(--r-sm); background: var(--bg-2) no-repeat;
  position: relative; overflow: hidden;
}

/* ================= summary ================= */
.summary-hero {
  background: linear-gradient(150deg, rgba(53, 117, 79, .5) 0%, rgba(8, 13, 10, .95) 100%);
  border: 1px solid rgba(124, 240, 165, .2);
  border-radius: var(--r-lg); color: #fff; padding: 30px 24px; text-align: center;
  box-shadow: var(--shadow-lg); margin-bottom: 16px;
}
.summary-hero h1 { color: #fff; }
.summary-hero .big-score { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; }
.summary-hero .muted { color: #b9d4c3; }

/* ================= panorama tray ================= */
.tray { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tray button.used { opacity: .35; }
.tray button.selected { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ================= thumbnails ================= */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.thumbs .th {
  position: relative; border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line);
  transition: transform .12s ease, box-shadow .15s ease;
}
.thumbs .th:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.thumbs .th img { width: 100%; display: block; aspect-ratio: 3/2; object-fit: cover; }
.thumbs .th::after {
  content: ""; position: absolute; inset: 55% 0 0 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(5, 9, 7, .8));
}
.thumbs .th .tag {
  position: absolute; left: 10px; bottom: 8px; right: 10px; z-index: 1;
  color: #fff; font-size: .78rem; font-weight: 650;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
}
.thumbs .th.mastered { outline: 2px solid var(--gold); outline-offset: -2px; }
.thumbs .th.mastered::before {
  content: "✓"; position: absolute; top: 8px; right: 8px; z-index: 1;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--gold); color: #141004; font-weight: 800; font-size: .8rem;
  display: grid; place-items: center;
}

/* detail key-value rows */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 10px 0; }
.kv dt { color: var(--muted); font-size: .84rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kv dd { margin: 0; font-size: .95rem; }

footer.attr { margin: 34px 0 6px; text-align: center; color: var(--muted); font-size: .74rem; }
.statechip {
  display: inline-block; font-size: .76rem; font-weight: 750; padding: 3px 11px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.4rem; }
  .hero .hero-text { padding: 14px 16px; }
  .ring { width: 60px; height: 60px; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .map-dot span.name { display: none; }
  /* scenes go full-bleed: the image is the game */
  .scene-wrap:not(.lb-canvas) {
    margin-left: calc(-1 * max(16px, env(safe-area-inset-left)));
    margin-right: calc(-1 * max(16px, env(safe-area-inset-right)));
    border-radius: 0; border-left: none; border-right: none;
  }
  .options { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Squad-style: heading tape sits along the top edge of the scene */
.compass {
  position: absolute; left: 0; right: 0; top: 0; width: 100%;
  pointer-events: none;
}
.scene-wrap .expand-btn { top: 50px; }
.scene-wrap .season-btn { top: 94px; }
