/* Lyra – feste Zonen im Hochformat: nichts schiebt etwas anderes weg.
   Bühne → Statuszeile → Kartendeck → Gespräch/Aktivität. Bewusst nur dunkel. */
:root {
  --grund: #05070c;
  --flaeche: rgba(120, 160, 220, .06);
  --flaeche-fest: #0b111c;
  --linie: rgba(140, 180, 240, .18);
  --text: #dfe8f5;
  --leise: #8494ad;
  --akzent: #7cc4ff;
  --blau: #0a9df0;
  --warm: #ffc59a;
  --orange: #d4532e;
  --gruen: #5fe0a0;
  --rot: #ff7a7a;
  --f-hud: "Chakra Petch", system-ui, sans-serif;
  --f-text: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--grund); color: var(--text); font: 16px/1.4 var(--f-text); }
body {
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  background: radial-gradient(ellipse at 50% 26%, #0c1626 0%, var(--grund) 62%);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
header, footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
header { padding-top: max(10px, env(safe-area-inset-top, 0px)); }
footer { padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); color: var(--leise); font-size: 13px; }
.links { display: flex; align-items: center; gap: 10px; }
.marke { height: 22px; display: block; }
.zustand { display: flex; align-items: center; gap: 8px; color: var(--leise); font-size: 14px; min-width: 0; }
#zustand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--leise); flex: none; }
.punkt.an { background: var(--gruen); box-shadow: 0 0 10px var(--gruen); }
.punkt.denkt { background: var(--warm); box-shadow: 0 0 10px var(--warm); }
.punkt.fehler { background: var(--rot); }
.rund { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--linie); background: transparent; color: var(--text);
  font-size: 17px; cursor: pointer; display: grid; place-items: center; }
.fuss-rechts { display: flex; align-items: center; gap: 12px; }
#verwaltung { color: var(--leise); text-decoration: none; font-size: 18px; padding: 4px 6px; }

main {
  min-height: 0; padding: 0 12px;
  display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(150px, 1fr) 22px 118px minmax(0, 1fr);
}

/* Zone 1 – Bühne */
.buehne { position: relative; min-height: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; outline: none; }
.buehne canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring { position: absolute; left: 50%; top: 50%; height: 96%; aspect-ratio: 1; max-width: 100%; transform: translate(-50%, -50%);
  fill: none; stroke: var(--akzent); stroke-width: .35; opacity: .28; pointer-events: none; }
.ring path { stroke-width: .6; opacity: .9; transform-origin: 50px 50px; animation: drehen 90s linear infinite; }
.buehne.aktiv .ring { opacity: .5; }
.buehne.aktiv .ring path { animation-duration: 18s; }
@keyframes drehen { to { transform: rotate(360deg); } }
.ecken { position: absolute; left: 50%; top: 50%; height: 100%; aspect-ratio: 1; max-width: 100%; transform: translate(-50%, -50%); pointer-events: none; }
.ecken i { position: absolute; width: 18px; height: 18px; border: 1.5px solid var(--akzent); opacity: .35; }
.ecken i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.ecken i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.ecken i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.ecken i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }

/* Zone 2 – Statuszeile */
.hinweis { text-align: center; color: var(--leise); font-size: 14px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Zone 3 – Kartendeck */
.deck-zone { position: relative; min-height: 0; min-width: 0; }
.deck { height: 100%; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  scrollbar-width: none; padding-bottom: 2px; }
.deck::-webkit-scrollbar { display: none; }
.deck-leer { margin: auto; color: var(--leise); font-size: 14px; text-align: center; padding: 0 20px; }
.k { flex: 0 0 auto; width: min(76%, 300px); height: 100%; scroll-snap-align: start; cursor: pointer;
  border: 1px solid var(--linie); border-radius: 14px; background: rgba(9, 16, 28, .92);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; position: relative;
  animation: einfliegen .26s cubic-bezier(.22, 1, .36, 1); }
.k::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kf, var(--akzent)); opacity: .8; }
@keyframes einfliegen { from { opacity: 0; transform: translateY(-14px) scale(.95); } to { opacity: 1; transform: none; } }
.k-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.k-kachel { font-family: var(--f-hud); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--kf, var(--akzent)); }
.k-zeit { font-size: 11px; color: var(--leise); }
.k-titel { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-gross { font-family: var(--f-hud); font-size: 24px; font-weight: 500; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-zeilen { font-size: 13px; color: #b9c6d8; display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow: hidden; }
.k-zeilen div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k.laeuft { --kf: var(--warm); }
.k.fehler { --kf: var(--rot); }

/* Freigabe überlagert das Deck */
.freigabe { position: absolute; inset: 0; z-index: 5; border: 1px solid rgba(255, 197, 154, .5); border-radius: 14px; padding: 10px 12px;
  background: #1a130e; display: flex; flex-direction: column; gap: 6px; animation: einfliegen .26s cubic-bezier(.22, 1, .36, 1); }
.freigabe-titel { font-family: var(--f-hud); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--warm); }
.freigabe-text { font-size: 15px; flex: 1; min-height: 0; overflow-y: auto; }
.knoepfe { display: flex; gap: 10px; }
.knopf { flex: 1; border-radius: 999px; padding: 10px 16px; min-height: 44px; border: 1px solid var(--linie); background: transparent;
  color: var(--text); font-size: 16px; cursor: pointer; font-family: inherit; }
.knopf.hell { background: var(--warm); color: #1d1208; border-color: var(--warm); font-weight: 600; }

/* Zone 4 – Gespräch und Aktivität */
.spalten { min-height: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1.6fr) minmax(0, 1fr); gap: 8px; }
.karte { min-height: 0; border: 1px solid var(--linie); border-radius: 14px; background: var(--flaeche);
  display: flex; flex-direction: column; overflow: hidden; position: relative; }
.karte-kopf { flex: none; display: flex; justify-content: space-between; padding: 7px 12px; font-family: var(--f-hud); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--leise); border-bottom: 1px solid var(--linie); }
.gespraech, .aktivitaet { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.zeile { font-size: 15px; }
.zeile .wer { color: var(--leise); font-size: 11px; margin-right: 6px; text-transform: uppercase; letter-spacing: .1em; font-family: var(--f-hud); }
.zeile.lyra { color: #cfe6ff; }
.eintrag { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: baseline; font-size: 14px; }
.eintrag .was { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag .kachel { color: var(--akzent); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-family: var(--f-hud); }
.eintrag .zeit { color: var(--leise); font-size: 12px; font-variant-numeric: tabular-nums; }
.eintrag.laeuft .kachel { color: var(--warm); }
.eintrag.fehler .kachel { color: var(--rot); }
.leer { color: var(--leise); font-size: 14px; }
.neu-hinweis { position: absolute; right: 10px; bottom: 8px; border-radius: 999px; border: 1px solid var(--linie); background: #0d1626;
  color: var(--akzent); font-size: 13px; padding: 5px 12px; cursor: pointer; }

/* Detailblatt */
.blatt-schleier { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; }
.blatt { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 78dvh; display: flex; flex-direction: column; gap: 8px;
  background: var(--flaeche-fest); border-top: 1px solid var(--linie); border-radius: 18px 18px 0 0;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: hoch .24s cubic-bezier(.22, 1, .36, 1); }
@keyframes hoch { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.blatt-kopf { display: flex; justify-content: space-between; align-items: center; }
.blatt-kachel { font-family: var(--f-hud); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--akzent); }
.blatt h2 { margin: 0; font-size: 20px; font-weight: 600; text-wrap: balance; }
.blatt-inhalt { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; font-size: 16px; }
.blatt-inhalt .reihe { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.blatt-inhalt .reihe span:last-child { color: var(--akzent); text-align: right; font-variant-numeric: tabular-nums; }
.blatt-inhalt .tippbar { cursor: pointer; }
.blatt-inhalt .text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; color: #c9d5e6; }
.blatt-inhalt .klein { color: var(--leise); font-size: 13px; }
.modi { display: flex; flex-wrap: wrap; gap: 8px; }
.modi button { border-radius: 999px; border: 1px solid var(--linie); background: transparent; color: var(--text); padding: 9px 14px; min-height: 44px;
  font-size: 15px; cursor: pointer; font-family: inherit; }
.modi button.an { background: var(--akzent); color: #04101d; border-color: var(--akzent); }

/* Wand-Tablets im Hochformat (CSS-Breite ≈ 1024): größer, Gespräch und Aktivität nebeneinander */
@media (min-width: 700px) and (orientation: portrait) {
  body { font-size: 19px; }
  header, footer { padding-left: 28px; padding-right: 28px; }
  header { padding-top: 18px; } footer { font-size: 16px; padding-bottom: 14px; }
  .marke { height: 32px; }
  .zustand { font-size: 19px; } .punkt { width: 12px; height: 12px; }
  main { padding: 0 28px; gap: 14px; grid-template-rows: minmax(0, 1.25fr) 30px 200px minmax(0, 1fr); }
  .hinweis { font-size: 19px; line-height: 30px; }
  .k { width: 360px; padding: 16px 18px; gap: 6px; }
  .k-kachel { font-size: 13px; } .k-titel { font-size: 19px; } .k-gross { font-size: 34px; } .k-zeilen { font-size: 16px; }
  .spalten { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
  .karte-kopf { font-size: 14px; padding: 12px 18px; }
  .gespraech, .aktivitaet { padding: 12px 18px; gap: 10px; }
  .zeile, .eintrag { font-size: 19px; } .zeile .wer, .eintrag .kachel, .eintrag .zeit { font-size: 14px; }
  .freigabe { padding: 16px 20px; } .freigabe-titel { font-size: 14px; } .freigabe-text { font-size: 22px; }
  .knopf { font-size: 21px; min-height: 56px; }
  .blatt { left: 10%; right: 10%; } .blatt h2 { font-size: 26px; } .blatt-inhalt { font-size: 19px; }
  .rund { width: 48px; height: 48px; font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .ring path, .k, .blatt, .freigabe { animation: none; } }
