/* Nordlicht-Expedition: Polarnacht, Eisblöcke als Türchen, warmes Licht dahinter. Bewusst nur dunkel. */
:root {
  color-scheme: dark;
  --nacht: #050d1d;
  --nacht2: #0b1d3a;
  --polar: #36f2b0;
  --polar-hell: #7ff5cf;
  --violett: #7a5cff;
  --eis: #d6eeff;
  --eis-text: #f2fbff;
  --nebel: #9fc2e8;
  --glut: #ffcf6a;
  --glut2: #ff9f43;
  --rot: #ff7a8a;
  --f-titel: "Big Shoulders Display", "Arial Narrow", system-ui, sans-serif;
  --f-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--nacht);
  color: var(--eis);
  font: 16px/1.55 var(--f-text);
  -webkit-tap-highlight-color: transparent;
}

#himmel { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

.seite {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 22px;
}

/* ---------- Kopf ---------- */
.kopf { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dachzeile { margin: 0; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--nebel); }
h1 {
  margin: 2px 0 0; font: 900 clamp(40px, 8vw, 76px)/0.95 var(--f-titel); letter-spacing: .02em; text-transform: uppercase;
  color: var(--eis-text); text-shadow: 0 0 28px rgba(127, 245, 207, .35);
}
.kopf-rechts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fortschritt { margin: 0; font: 700 20px var(--f-titel); letter-spacing: .06em; text-transform: uppercase; color: var(--polar-hell); }

/* ---------- Expeditionsroute ---------- */
.route { position: relative; height: 26px; }
.route::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; border-top: 2px dashed rgba(159, 194, 232, .35); }
.route-linie { position: absolute; left: 0; top: 11px; height: 4px; border-radius: 2px; width: 0; background: linear-gradient(90deg, var(--polar), var(--polar-hell)); box-shadow: 0 0 12px var(--polar); transition: width 1.2s ease; }
.route-punkte { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; }
.route-punkte span { width: 8px; height: 8px; border-radius: 50%; background: #1d3657; border: 1px solid rgba(159, 194, 232, .5); }
.route-punkte span.da { background: var(--polar-hell); border-color: var(--polar-hell); box-shadow: 0 0 8px var(--polar); }
.route-punkte span.fahne { width: 14px; height: 14px; background: var(--glut); border-color: #fff; box-shadow: 0 0 14px var(--glut); }

.vor-start {
  margin: 0; padding: 14px 18px; border-radius: 12px; text-align: center;
  background: rgba(10, 30, 60, .7); border: 1px solid rgba(159, 194, 232, .35);
  font: 700 22px var(--f-titel); letter-spacing: .05em; text-transform: uppercase; color: var(--polar-hell);
}

/* ---------- Türchen ---------- */
.tueren { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-flow: dense; gap: 14px; }
.tuer {
  position: relative; aspect-ratio: 1 / 1; border: 0; padding: 0; background: none; cursor: pointer;
  perspective: 900px; font: inherit; color: inherit; border-radius: 12px;
}
.tuer[data-tag="24"] { grid-column: span 2; grid-row: span 2; }
.tuer[data-tag="6"], .tuer[data-tag="13"], .tuer[data-tag="20"] { grid-column: span 2; aspect-ratio: auto; }
.tuer:focus-visible { outline: 3px solid var(--glut); outline-offset: 4px; }
.tuer .innen, .tuer .fluegel { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; }

.tuer .innen {
  background: radial-gradient(circle at 50% 45%, #fff3c4 0%, var(--glut) 30%, var(--glut2) 60%, #2a1405 100%);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .55);
  color: #2a1405; font: 900 34px var(--f-titel);
}
.tuer.geloest .innen::after { content: "✓"; }
/* Das Licht dahinter erst zeigen, wenn die Tür aufschwingt (das Eis ist durchscheinend). */
.tuer .innen { visibility: hidden; transition: visibility 0s .9s; }
.tuer.auf .innen { visibility: visible; transition-delay: 0s; }

.tuer .fluegel {
  transform-origin: left center; backface-visibility: hidden; z-index: 2;
  transition: transform 1s cubic-bezier(.3, 1.35, .5, 1), opacity .4s;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(145deg, rgba(204, 236, 255, .30), rgba(110, 165, 220, .14));
  border: 1px solid rgba(220, 240, 255, .5);
  box-shadow: inset 0 0 22px rgba(255, 255, 255, .16), 0 8px 24px rgba(0, 0, 0, .35);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.tuer .fluegel::before {
  /* Risse im Eis */
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: .35; pointer-events: none;
  background:
    linear-gradient(118deg, transparent 47%, rgba(255, 255, 255, .7) 48%, transparent 49.5%),
    linear-gradient(32deg, transparent 63%, rgba(255, 255, 255, .5) 64%, transparent 65%);
}
.tuer .zahl { font: 900 clamp(30px, 5vw, 48px) var(--f-titel); color: var(--eis-text); text-shadow: 0 0 16px rgba(140, 230, 255, .8); }
.tuer[data-tag="24"] .zahl { font-size: clamp(56px, 10vw, 96px); }

.tuer.auf .fluegel { transform: rotateY(-112deg); }
.tuer.gesperrt { cursor: default; }
.tuer.gesperrt .fluegel { filter: saturate(.5) brightness(.7); }
.tuer.offen .fluegel { border-color: rgba(127, 245, 207, .7); background:
    linear-gradient(155deg, rgba(255, 255, 255, .45) 0%, rgba(255, 255, 255, 0) 40%),
    linear-gradient(145deg, rgba(160, 245, 220, .32), rgba(110, 165, 220, .16)); }
.tuer.gesperrt .fluegel::after { content: "❄"; position: absolute; right: 9px; bottom: 6px; font-size: 14px; opacity: .7; }
.tuer.heute .fluegel { animation: polarglut 2.4s ease-in-out infinite; border-color: var(--polar-hell); }
@keyframes polarglut {
  0%, 100% { box-shadow: inset 0 0 22px rgba(255, 255, 255, .16), 0 0 14px rgba(54, 242, 176, .35); }
  50% { box-shadow: inset 0 0 26px rgba(255, 255, 255, .26), 0 0 34px rgba(54, 242, 176, .8); }
}
.tuer.offen:not(.heute):hover .fluegel { transform: rotateY(-14deg); }
.tuer.wackeln { animation: wackeln .45s; }
@keyframes wackeln { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Funde ---------- */
.sammlung { padding: 18px; border-radius: 14px; background: rgba(8, 22, 46, .72); border: 1px solid rgba(159, 194, 232, .25); }
.sammlung h2 { margin: 0; font: 800 26px var(--f-titel); text-transform: uppercase; letter-spacing: .05em; color: var(--polar-hell); }
.sammlung p { margin: 4px 0 12px; color: var(--nebel); font-size: 14px; }
.sammelzeichen { display: flex; flex-wrap: wrap; gap: 6px; }
.zeichen { min-width: 34px; height: 42px; padding: 0 6px; display: grid; place-items: center; border-radius: 8px; border: 1px dashed rgba(159, 194, 232, .4); color: rgba(159, 194, 232, .5); font: 800 24px var(--f-titel); }
.zeichen.voll { border-style: solid; border-color: var(--glut); color: #2a1405; background: var(--glut); box-shadow: 0 0 12px rgba(255, 207, 106, .5); }

.fuss { font-size: 14px; color: var(--nebel); text-align: center; }
.fuss p { margin: 0; }
.fuss b { color: var(--polar-hell); }

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--polar); color: #03261a; font: 600 16px var(--f-text);
}
.knopf:hover { background: var(--polar-hell); }
.knopf:focus-visible { outline: 3px solid var(--glut); outline-offset: 2px; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.zweit { background: rgba(214, 238, 255, .1); color: var(--eis); border: 1px solid rgba(214, 238, 255, .35); }
.knopf.zweit:hover { background: rgba(214, 238, 255, .2); }
.knopf.klein { min-height: 36px; padding: 0 12px; font-size: 14px; }
.knopf.gross { min-height: 52px; font-size: 17px; width: 100%; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 18px;
  background: transparent; color: var(--eis); overflow: visible;
}
.dialog::backdrop { background: rgba(2, 6, 16, .72); backdrop-filter: blur(3px); }
.dialog[open] .d-inhalt { animation: aufsteigen .45s ease-out; }
@keyframes aufsteigen { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.d-inhalt {
  max-height: calc(100dvh - 24px); overflow: auto; padding: 22px;
  background: linear-gradient(180deg, #0b1d3a, #071226); border: 1px solid rgba(127, 245, 207, .35); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 40px rgba(54, 242, 176, .12);
  display: flex; flex-direction: column; gap: 14px;
}
.d-inhalt.wackeln { animation: wackeln .4s; }
.d-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.d-tag { margin: 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--nebel); }
.d-titel { margin: 2px 0 0; font: 800 30px/1.05 var(--f-titel); text-transform: uppercase; letter-spacing: .03em; color: var(--polar-hell); text-wrap: balance; }
.d-zu { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid rgba(214, 238, 255, .35); background: transparent; color: var(--eis); font-size: 24px; line-height: 1; cursor: pointer; }
.d-zu:focus-visible { outline: 3px solid var(--glut); }
.d-aufgabe { white-space: pre-wrap; font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.d-bild { width: 100%; height: auto; border-radius: 10px; border: 1px solid rgba(214, 238, 255, .25); background: #000; }

.d-ton { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #050f20; border: 1px solid rgba(159, 194, 232, .3); }
.d-ton-text { flex: 1; font: 700 18px var(--f-titel); letter-spacing: .08em; text-transform: uppercase; color: var(--nebel); }
.d-lampe { width: 20px; height: 20px; border-radius: 50%; background: #123a2c; border: 2px solid #0a2219; flex: none; transition: background .03s, box-shadow .03s; }
.d-lampe.an { background: #8dffd8; box-shadow: 0 0 18px #36f2b0, 0 0 4px #fff; }

.d-hinweise { display: flex; flex-direction: column; gap: 8px; }
.hinweis { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(122, 92, 255, .16); border: 1px solid rgba(122, 92, 255, .45); font-size: 15px; }
.hinweis b { color: #c3b5ff; }
.hinweis-bald { margin: 0; font-size: 13px; color: var(--nebel); }

.d-form { display: flex; gap: 10px; flex-wrap: wrap; }
.d-eingabe {
  flex: 1 1 180px; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 10px;
  border: 1px solid #4f7fb0; background: #0d2340; color: #fff; font: 600 18px var(--f-text);
}
.d-eingabe:focus { outline: 3px solid var(--polar); outline-offset: 1px; }
.d-meldung { margin: 0; min-height: 1.4em; font-weight: 600; }
.d-meldung.richtig { color: var(--polar-hell); font: 800 24px var(--f-titel); text-transform: uppercase; letter-spacing: .05em; }
.d-meldung.fehler { color: var(--rot); }
.d-meldung.warten, .d-meldung.info { color: var(--glut); }

.d-loesung { padding: 16px; border-radius: 14px; background: linear-gradient(160deg, #fff6d8, #ffe6a8); color: #3b2a00; display: flex; flex-direction: column; gap: 10px; animation: aufdecken 1s ease-out; }
@keyframes aufdecken { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.d-loesung h3 { margin: 0; font: 900 24px var(--f-titel); text-transform: uppercase; letter-spacing: .05em; color: #6a3f00; }
.versteck-text { margin: 0; white-space: pre-wrap; font-size: 18px; font-weight: 600; }
.versteck-bald { margin: 0; }
.koordinaten { display: flex; flex-direction: column; gap: 4px; }
.koordinaten p { margin: 0; }
.koord-gc { font: 800 22px var(--f-titel); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.koord-dez { font-size: 13px; color: #6a5420; font-variant-numeric: tabular-nums; }
.koord-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px !important; }
.d-loesung .knopf { background: #0b1d3a; color: #fff; }
.d-loesung .knopf.zweit { background: transparent; color: #3b2a00; border-color: #b78a2a; }
.sammel { margin: 0; font-weight: 600; }
.sammel-zeichen { display: inline-grid; place-items: center; min-width: 36px; height: 40px; padding: 0 8px; border-radius: 8px; background: #0b1d3a; color: var(--glut); font: 900 26px var(--f-titel); vertical-align: middle; }

.ehrenwort .d-inhalt { gap: 12px; }
.ehrenwort ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.ehrenwort p { margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--eis); color: #0b1d3a; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center;
}
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 760px) {
  .tueren { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 460px) {
  .tueren { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .tuer[data-tag="6"], .tuer[data-tag="13"], .tuer[data-tag="20"] { grid-column: span 1; aspect-ratio: 1 / 1; }
  .d-inhalt { padding: 16px; }
  .d-titel { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
