:root {
  --bg: #0b0b0c;
  --fg: #f2f0ec;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* App-Shell: genau eine Karte (Node) sichtbar, volle Bildschirmhoehe.
   Navigation zwischen Karten per Wisch/Pfeiltaste/Trackpad, siehe main.js
   (1:1 uebernommenes Muster aus Dropcasts drop-runtime). */
#app {
  position: relative;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  overflow: hidden;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), opacity 280ms ease;
  touch-action: none;
  user-select: none;
  background: #14141a;
}

.card.exiting { z-index: 3; }
.card.current { transform: translate(0, 0); opacity: 1; z-index: 2; }
.card.exit-fade { transform: scale(0.92); opacity: 0; z-index: 3; }

.card .bg-media {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}
.card .scrim {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.15) 45%, rgba(0,0,0,0.05) 100%);
}
.card .text-block {
  position: relative; z-index: 2;
  padding: 6vh 8vw 14vh;
  max-width: 640px;
}
.card.type-text .text-block {
  padding-bottom: 6vh;
  display: flex; flex-direction: column; justify-content: center;
  height: 100%;
}
/* --card-font-family/--card-font-size werden pro Karte per JS gesetzt
   (siehe buildCard() in main.js, node.font_family/font_size) - Titel und
   Hub-Labels skalieren proportional zur Basis-Schriftgroesse (--card-
   font-size = Textkoerper-Groesse), damit die Hierarchie erhalten bleibt,
   auch wenn nur EIN Wert pro Karte eingestellt wird. */
.card h1 {
  font-size: calc(var(--card-font-size, 1.05rem) * 1.65);
  font-family: var(--card-font-family, inherit);
  margin: 0 0 12px;
  font-weight: 500;
}
.card p {
  font-size: var(--card-font-size, 1.05rem);
  font-family: var(--card-font-family, inherit);
  line-height: 1.5;
  color: #e4e4ea;
  margin: 0;
  white-space: pre-wrap;
}

/* Mosaic-Karte: randlos, kein Scrim/Titel - die Crossfade-Wand fuellt die
   ganze Karte. */
.card.type-mosaic { justify-content: stretch; align-items: stretch; }
.card.type-mosaic .mosaic { flex: 1; overflow-y: auto; width: 100%; height: 100%; }

/* Hub-Karte: Kreuz-Overlay mit 4 Sprungmarken ("+"-Icon + Label) statt
   Titel/Text unten - Hintergrundbild/-video kommt aus content wie bei
   den Bild/Video-Karten (siehe buildCard in main.js). */
.hub-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
}
/* Fest auf Gruen (dasselbe wie der "aktuelle Position"-Punkt der
   Minimap, #22c55e) - bewusst ohne Konfigurationsoption, zum
   unkomplizierten Testen. Linien deutlich dicker + fast deckend, und
   die Icon-Kreise bekommen dieselbe dunkle, verwaschene Unterlage wie
   die Nav-Pfeile/Home-Button (siehe .nav-arrow/.home-button) - auf dem
   Testbild-Hintergrund verschwand ein reines gruenes Icon ohne
   Unterlage sonst fast komplett. */
.hub-overlay::before, .hub-overlay::after { content: ""; position: absolute; background: #22c55e; opacity: 0.9; }
.hub-overlay::before { left: 6%; right: 6%; top: 50%; height: 3px; margin-top: -1.5px; }
.hub-overlay::after  { top: 8%; bottom: 8%; left: 50%; width: 3px; margin-left: -1.5px; }
.hub-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: #22c55e; text-decoration: none; cursor: pointer;
  background: none; border: none; padding: 0; margin: 0; font: inherit;
  width: 100%; height: 100%; -webkit-appearance: none; appearance: none;
}
.hub-link .plus {
  width: 50px; height: 50px; border-radius: 50%;
  border: 2.5px solid #22c55e;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 300; line-height: 1;
  overflow: hidden;
}
.hub-link .plus svg { width: 28px; height: 28px; }
.hub-link .plus svg * { stroke-width: 2.2; }
.hub-link .plus img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.hub-link .label {
  font-size: calc(var(--card-font-size, 1.05rem) * 0.7);
  font-family: var(--card-font-family, inherit);
  letter-spacing: 0.09em; text-transform: uppercase; font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,0.85), 0 0 10px rgba(0,0,0,0.5);
}

.nav-arrow {
  position: absolute; z-index: 6;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  border: 1.5px solid #22c55e;
  color: #22c55e; cursor: pointer;
}
.nav-arrow svg { width: 20px; height: 20px; stroke-width: 2.4; }
.nav-arrow.up    { top: max(14px, env(safe-area-inset-top));    left: 50%; transform: translateX(-50%); }
.nav-arrow.down  { bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); }
.nav-arrow.left  { left: max(14px, env(safe-area-inset-left));   top: 50%; transform: translateY(-50%); }
.nav-arrow.right { right: max(14px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); }

/* Minimap: zeigt Position im Grid (graue Punkte = belegte Nachbarkarten,
   gruen = aktuelle Position). Ersetzt den frueheren separaten
   Home-Button - anklickbar, springt zur Startkarte (siehe main.js). */
.minimap {
  position: absolute; z-index: 7;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 6px;
  display: grid;
  gap: 3px;
  cursor: pointer;
}
.minimap .mm-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
}
.minimap .mm-dot.occupied { background: rgba(255,255,255,0.4); }
.minimap .mm-dot.current { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.35); }

#status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #888; font-size: 0.95rem; text-align: center; padding: 0 10vw; z-index: 10;
}

/* Mosaic — echtes Masonry via CSS Columns: jede Kachel bekommt ihr
   Seitenverhaeltnis inline (aspect-ratio) ueber JS, Spalten fuellen sich
   lueckenlos von oben nach unten. Groesse bleibt fix, auch wenn sich der
   Bildinhalt per Crossfade aendert (main.js). */
.mosaic {
  column-width: 150px;
  column-gap: 3px;
  padding: 3px;
}

@media (min-width: 700px) {
  .mosaic {
    column-width: 220px;
    column-gap: 4px;
    padding: 4px;
  }
}

.tile {
  position: relative;
  width: 100%;
  margin: 0 0 3px;
  break-inside: avoid;
  overflow: hidden;
  background: #1a1a1c;
}

@media (min-width: 700px) {
  .tile { margin-bottom: 4px; }
}

/* Zwei uebereinanderliegende Bild-Layer pro Kachel fuer den Crossfade. */
.tile .layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 2.6s ease;
  will-change: opacity;
}

.tile .layer.active {
  opacity: 1;
}

.tile:hover .layer.active {
  transform: scale(1.04);
  transition: opacity 2.6s ease, transform 0.6s ease;
}
