:root {
  --nacht: #0b1020;
  --text: #1d2230;
  --text-leise: #6b7285;
  --linie: #e4e6ec;
  --akzent: #c8342b;
  --akzent-hell: #fbe9e7;
  --fenster: #fbfbfd;
  --kopf: #f1f2f6;
  --ungelesen: #2f6fde;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--nacht);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#welt, #welt canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* Ladebildschirm */
#laden {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 40%, #1b2547, var(--nacht) 70%);
  color: #e9ecf5; transition: opacity .6s ease;
}
#laden.weg { opacity: 0; pointer-events: none; }
.laden-stern { font-size: 46px; color: #ffd27a; animation: funkeln 1.6s ease-in-out infinite; }
.laden-text { font-size: 15px; letter-spacing: .02em; opacity: .85; }
.laden-balken { width: 180px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
#laden-fortschritt { width: 0; height: 100%; background: #ffd27a; transition: width .2s; }
@keyframes funkeln { 0%,100% { transform: scale(1) rotate(0); opacity: .8 } 50% { transform: scale(1.18) rotate(20deg); opacity: 1 } }

/* Hinweis */
#hinweis {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 10;
  transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px;
  background: rgba(12, 16, 32, .72); color: #fff; font-size: 15px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: pulsieren 2.2s ease-in-out infinite;
  pointer-events: none; white-space: nowrap;
}
@keyframes pulsieren { 0%,100% { opacity: .65 } 50% { opacity: 1 } }

/* Das Spiel ist fuer Querformat gebaut: im Hochformat bitten wir ums Kippen */
#hochformat { display: none; }
@media (orientation: portrait) {
  #hochformat {
    display: flex; flex-direction: column; gap: 18px; position: fixed; inset: 0; z-index: 50;
    align-items: center; justify-content: center; text-align: center; padding: 24px;
    background: radial-gradient(circle at 50% 40%, #1b2547, var(--nacht) 70%); color: #fff; font-size: 18px;
  }
  #hochformat .kipp-handy {
    width: 54px; height: 92px; border: 4px solid #ffd27a; border-radius: 10px;
    animation: kippen 2.4s ease-in-out infinite;
  }
}
@keyframes kippen { 0%, 25% { transform: rotate(0) } 55%, 85% { transform: rotate(-90deg) } 100% { transform: rotate(0) } }

#vollbild {
  position: fixed; right: calc(14px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); z-index: 12;
  padding: 8px 12px; border-radius: 999px; border: 0; font: inherit; font-size: 14px;
  background: rgba(12, 16, 32, .72); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
#vollbild[hidden] { display: none; }

/* Mail-Programm */
#mail { position: fixed; z-index: 20; inset: 0; pointer-events: none; }
#mail[hidden] { display: none; }
.mail-fenster {
  position: absolute; display: flex; flex-direction: column; overflow: hidden;
  background: var(--fenster); border-radius: 0; pointer-events: auto;
  transform-origin: 0 0;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.mail-kopf {
  flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
  background: var(--kopf); border-bottom: 1px solid var(--linie);
}
.mail-titel { grid-column: 2; margin: 0; font-size: 17px; font-weight: 650; }
.mail-kopf button {
  border: 0; background: none; font: inherit; color: var(--akzent); padding: 8px 6px; cursor: pointer;
}
.mail-zurueck { grid-column: 1; justify-self: start; font-size: 16px; }
.mail-schliessen { grid-column: 3; justify-self: end; font-size: 18px; width: 40px; height: 40px; border-radius: 50% !important; }
.mail-schliessen:active, .mail-zurueck:active { background: rgba(0,0,0,.06) !important; }

.mail-inhalt { position: relative; flex: 1; overflow: hidden; }
.mail-liste, .mail-detail {
  position: absolute; inset: 0; margin: 0; padding: 0; list-style: none;
  overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  transition: transform .32s cubic-bezier(.2,.8,.2,1);
}
.mail-liste.versteckt { transform: translateX(-30%); }
.mail-detail { background: var(--fenster); transform: translateX(100%); }
.mail-detail.offen { transform: translateX(0); }
.mail-detail[hidden] { display: block; visibility: hidden; }

.mail-eintrag {
  display: grid; grid-template-columns: 12px 42px minmax(0, 1fr); gap: 0 10px; align-items: start;
  padding: 14px 16px 14px 8px; border-bottom: 1px solid var(--linie); cursor: pointer;
}
.mail-eintrag:active { background: #eef1f8; }
.mail-punkt { width: 9px; height: 9px; border-radius: 50%; margin-top: 16px; background: var(--ungelesen); }
.mail-eintrag.gelesen .mail-punkt { visibility: hidden; }
.mail-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--akzent-hell); color: var(--akzent); font-weight: 700; font-size: 17px;
}
.mail-zeile1 { display: flex; justify-content: space-between; gap: 8px; }
.mail-von { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-zeit { color: var(--text-leise); font-size: 13px; flex: none; }
.mail-betreff { font-size: 14.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-eintrag:not(.gelesen) .mail-betreff { font-weight: 600; }
.mail-vorschau {
  color: var(--text-leise); font-size: 13.5px; margin-top: 3px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.mail-detail { padding: 18px 18px calc(40px + env(safe-area-inset-bottom)); user-select: text; -webkit-user-select: text; }
.mail-detail h2 { margin: 0 0 14px; font-size: 21px; line-height: 1.25; }
.mail-absender { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--linie); }
.mail-absender .mail-avatar { flex: none; }
.mail-absender-name { font-weight: 650; }
.mail-absender-adresse, .mail-absender-datum { color: var(--text-leise); font-size: 13px; }
.mail-text { font-size: 16px; line-height: 1.55; padding-top: 14px; }
.mail-text p { margin: 0 0 12px; }

.mail-leer { padding: 40px 20px; text-align: center; color: var(--text-leise); }

/* Olaflinge (Pixelspiel auf dem Notebook) */
#spiel { position: fixed; z-index: 20; inset: 0; pointer-events: none; }
#spiel[hidden] { display: none; }
.spiel-fenster {
  position: absolute; display: flex; flex-direction: column; overflow: hidden; pointer-events: auto;
  background: #1a1423; color: #f4f1ea; font-family: ui-monospace, "Courier New", monospace;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.spiel-kopf {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px; background: #2e2236; border-bottom: 2px solid #4a3a4f;
}
.spiel-status { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; font-weight: 700; color: #e6c58a; }
.spiel-schliessen { border: 2px solid #6b5a6e; background: #4a3a4f; color: #f4f1ea; width: 38px; height: 38px; font: inherit; font-size: 16px; }
.spiel-feld { position: relative; flex: none; width: 100%; aspect-ratio: 320 / 176; background: #1c2a4f; }
.spiel-feld canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
.spiel-meldung {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(26, 20, 35, .72); padding: 8px;
}
.spiel-meldung[hidden] { display: none; }
.spiel-karte {
  max-width: 92%; max-height: 100%; overflow: auto; background: #2e2236; border: 3px solid #9cc3e6; padding: 10px 12px;
  font-size: 13px; line-height: 1.4; text-align: center; box-shadow: 4px 4px 0 #1a1423;
}
.spiel-karte h2 { margin: 0 0 6px; font-size: 15px; color: #9cc3e6; }
.spiel-karte p { margin: 4px 0; }
.spiel-karte button, .spiel-steuerung button, .spiel-knopf {
  font: inherit; color: #f4f1ea; background: #4a3a4f; border: 2px solid #6b5a6e; padding: 6px 10px; margin: 3px;
  box-shadow: 2px 2px 0 #1a1423;
}
.spiel-karte button:active, .spiel-steuerung button:active, .spiel-knopf:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #1a1423; }
.spiel-levelwahl { display: flex; flex-direction: column; align-items: stretch; margin-top: 6px; }
.spiel-levelwahl button:disabled { opacity: .4; }
.spiel-faehigkeiten { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 8px 4px; }
.spiel-knopf {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; padding: 6px 2px 4px;
  color: #c8e39a;
}
.spiel-knopf .zahl { position: absolute; top: 2px; right: 5px; font-size: 13px; font-weight: 700; color: #f2d36b; }
.spiel-knopf .name { font-size: 11px; color: #dcd6d6; }
.spiel-knopf.gewaehlt { border-color: #f2d36b; background: #74462a; }
.spiel-knopf.leer { opacity: .45; }
.spiel-steuerung { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; padding: 4px 8px calc(12px + env(safe-area-inset-bottom)); }
.spiel-steuerung .freigabe { min-width: 28px; text-align: center; font-weight: 700; color: #e6c58a; }
.spiel-steuerung .an { border-color: #f2d36b; }
.spiel-steuerung .tauwetter { background: #6e2a26; border-color: #a33a2e; }

/* Querformat: Spielfeld links so gross wie moeglich, Bedienung rechts */
@media (orientation: landscape) {
  .spiel-fenster {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr);
  }
  .spiel-kopf { grid-column: 1 / 3; padding: 6px calc(8px + env(safe-area-inset-right)) 6px calc(8px + env(safe-area-inset-left)); }
  .spiel-schliessen { width: 34px; height: 34px; }
  .spiel-feld {
    grid-column: 1; grid-row: 2; width: auto; height: 100%; max-width: 100%; aspect-ratio: 320 / 176;
    justify-self: center; align-self: center; margin-left: env(safe-area-inset-left);
  }
  .spiel-seite { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; overflow-y: auto; width: 190px; padding-right: env(safe-area-inset-right); }
  .spiel-faehigkeiten { grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 6px 6px 2px; }
  .spiel-knopf { padding: 3px 2px 2px; }
  .spiel-knopf svg { width: 18px; height: 18px; }
  .spiel-knopf .name { font-size: 10px; }
  .spiel-steuerung { padding: 4px 4px 8px; gap: 0; }
  .spiel-steuerung button { padding: 4px 7px; margin: 2px; }
}
@media (orientation: portrait) { .spiel-seite { display: contents; } }

/* Mail im Querformat: Lesespalte nicht ueber die ganze Breite ziehen */
@media (orientation: landscape) {
  .mail-liste, .mail-detail { padding-left: max(env(safe-area-inset-left), calc((100% - 760px) / 2)); padding-right: max(env(safe-area-inset-right), calc((100% - 760px) / 2)); }
  .mail-kopf { padding-top: 8px; padding-left: calc(10px + env(safe-area-inset-left)); padding-right: calc(10px + env(safe-area-inset-right)); }
}

/* Virtueller Joystick: ruht unten links als Hinweis, springt beim Beruehren unter den Finger */
#joystick {
  position: fixed; z-index: 9; width: 112px; height: 112px; margin: -56px 0 0 -56px;
  left: calc(84px + env(safe-area-inset-left)); top: calc(100% - 84px - env(safe-area-inset-bottom));
  border-radius: 50%; border: 2px solid rgba(255,255,255,.35); background: rgba(12,16,32,.22);
  pointer-events: none; opacity: .55; transition: opacity .2s;
}
#joystick.aktiv { opacity: 1; transition: none; background: rgba(12,16,32,.35); }
.joystick-knopf {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  background: rgba(255,255,255,.75); box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
#joystick:not(.aktiv) .joystick-knopf { transition: transform .15s ease-out; }

/* weicher, warmer Rand fuer eine gemuetlichere Stimmung */
#vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 55%, rgba(40,20,5,.38) 100%); }

/* Schneeflocke OS (Notebook) */
#os { position: fixed; z-index: 18; inset: 0; pointer-events: none; }
#os[hidden] { display: none; }
.os-bildschirm {
  position: absolute; overflow: hidden; pointer-events: auto; display: flex; flex-direction: column;
  background: linear-gradient(135deg, #1d2b5e 0%, #47306b 55%, #a3485a 100%); color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.os-bildschirm::before {      /* Schneehuegel wie auf dem Bildschirm im Zimmer */
  content: ""; position: absolute; inset: auto 0 0 0; height: 38%; pointer-events: none;
  background: radial-gradient(120% 90% at 30% 100%, rgba(255,255,255,.16) 0 60%, transparent 61%),
              radial-gradient(120% 80% at 80% 110%, rgba(255,255,255,.12) 0 60%, transparent 61%);
}
.os-bildschirm.hochfahren .os-symbole { animation: osEin .8s ease-out; }
@keyframes osEin { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
.os-symbole {
  position: relative; flex: 1; display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 96px);
  grid-auto-columns: 92px; gap: 6px; align-content: start; justify-content: start;
  padding: calc(18px + env(safe-area-inset-top)) 18px 18px calc(18px + env(safe-area-inset-left));
}
.os-symbol { border: 0; background: none; color: #fff; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border-radius: 12px; }
.os-symbol:active { background: rgba(255,255,255,.15); }
.os-symbol-bild {
  position: relative; width: 56px; height: 56px; border-radius: 15px; display: grid; place-items: center;
  font-size: 26px; font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.os-zahl { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; border-radius: 11px; background: #ff3b30;
  font-style: normal; font-size: 13px; display: grid; place-items: center; padding: 0 5px; }
.os-symbol-name { font-size: 13px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.os-leiste {
  position: relative; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 8px calc(14px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  background: rgba(10,12,24,.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 14px;
}
.os-logo { font-weight: 650; }
.os-uhr { margin-left: auto; opacity: .9; }
.os-aus { border: 0; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 18px; }
.os-fenster {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: min(560px, 86%); max-height: 74%;
  display: flex; flex-direction: column; background: #fbfbfd; color: #1d2230; border-radius: 12px; overflow: hidden;
  box-shadow: 0 16px 50px rgba(0,0,0,.45);
}
.os-fenster[hidden] { display: none; }
.os-fenster-kopf { display: flex; align-items: center; padding: 8px 8px 8px 14px; background: #f1f2f6; border-bottom: 1px solid #e4e6ec; font-weight: 650; }
.os-fenster-zu { margin-left: auto; border: 0; background: none; font-size: 16px; width: 34px; height: 34px; border-radius: 50%; color: #c8342b; }
.os-fenster-inhalt { padding: 12px 14px 16px; overflow: auto; }
.os-notizen { width: 100%; min-height: 160px; border: 1px solid #e4e6ec; border-radius: 8px; padding: 10px; font: inherit; font-size: 15px; resize: vertical; background: #fffdf3; }
.os-hinweis { margin: 0 0 10px; color: #6b7285; font-size: 14px; }
.os-kalender { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.os-tag { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; font-weight: 650; background: #eef0f5; color: #9aa0ae; }
.os-tag.heute { background: #c8342b; color: #fff; }
.os-tag.offen { background: #fbe9e7; color: #c8342b; }
.os-tag.geloest { background: #3fa36b; color: #fff; }
.os-tag.geloest::after { content: "✓"; font-size: 11px; margin-left: 2px; }

/* PsyQuatsch: Praxissoftware im Stil der 2000er (eigene Gestaltung) */
.pq { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: #d4d0c8; color: #000;
  font: 13px Tahoma, Verdana, "Segoe UI", sans-serif; transition: opacity .2s; }
.pq.weg { opacity: 0; }
.pq-titel { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; color: #fff; font-weight: bold;
  background: linear-gradient(90deg, #0a246a, #3a6ea5); }
.pq-knoepfe i { display: inline-grid; place-items: center; width: 18px; height: 16px; margin-left: 2px; font-style: normal; font-size: 11px;
  background: #d4d0c8; color: #000; border: 1px solid; border-color: #fff #404040 #404040 #fff; }
.pq-menue { display: flex; gap: 14px; padding: 3px 8px; border-bottom: 1px solid #808080; }
.pq-werkzeug { display: flex; gap: 4px; padding: 4px 6px; border-bottom: 1px solid #808080; }
.pq-werkzeug b { width: 28px; height: 26px; display: grid; place-items: center; font-weight: normal; border: 1px solid; border-color: #fff #808080 #808080 #fff; }
.pq-flaeche { flex: 1; display: grid; grid-template-columns: 30% 1fr; gap: 6px; padding: 6px; min-height: 0; }
.pq-liste, .pq-plan { background: #fff; border: 2px inset #d4d0c8; overflow: hidden; }
.pq-kopf { background: #d4d0c8; padding: 3px 6px; border-bottom: 1px solid #808080; font-weight: bold; }
.pq-zeile { height: 18px; margin: 4px 6px; background: repeating-linear-gradient(90deg, #e8e8f0 0 60%, transparent 60% 100%); }
.pq-slot { display: flex; height: 26px; border-bottom: 1px dotted #c0c0c0; }
.pq-slot span { width: 52px; padding: 5px; background: #eef2fa; color: #333; font-size: 12px; }
.pq-status { display: flex; gap: 2px; padding: 2px; }
.pq-status span { flex: 1; padding: 2px 6px; border: 1px solid; border-color: #808080 #fff #fff #808080; font-size: 12px; }
.pq-start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(160deg, #e9eef7, #bccbe4); color: #0a246a; }
.pq-logo { font-size: 34px; font-weight: bold; letter-spacing: .02em; }
.pq-balken { width: 240px; height: 16px; border: 1px solid #0a246a; background: #fff; }
.pq-balken i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #0a246a 0 10px, #fff 10px 12px); animation: pqLaden 2s steps(20) forwards; }
@keyframes pqLaden { to { width: 100% } }
.pq-lade { font-size: 12px; color: #334; }
.pq-dialog { position: absolute; left: 50%; top: 45%; width: min(420px, 86%); background: #d4d0c8; border: 2px solid; border-color: #fff #404040 #404040 #fff;
  box-shadow: 2px 2px 0 #000; }
.pq-dialog-inhalt { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px 8px; }
.pq-dialog-inhalt p { margin: 0; line-height: 1.4; }
.pq-symbol { font-size: 30px; line-height: 1; }
.pq-dialog-fuss { display: flex; justify-content: center; padding: 6px 0 12px; }
.pq-dialog-fuss button { min-width: 84px; padding: 4px 10px; font: inherit; background: #d4d0c8; border: 2px solid; border-color: #fff #404040 #404040 #fff; outline: 1px dotted #000; outline-offset: -5px; }
.pq-dialog-fuss button:active { border-color: #404040 #fff #fff #404040; }

/* Knoepfe fuer Szenen */
.szene-knopf { position: fixed; z-index: 15; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 12px 22px; border: 0; border-radius: 999px; font: inherit; font-size: 16px; color: #fff;
  background: rgba(12,16,32,.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 6px 20px rgba(0,0,0,.35); }

body.in-szene #joystick, body.in-szene #vollbild { display: none; }

/* ---------- Intro: schwarzer Bildschirm, Play-Knopf, Untertitel, Gedanken der Heldin */
#intro { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; place-items: center; transition: opacity 3s ease-in-out; }
#intro.aufblenden { opacity: 0; pointer-events: none; }
.intro-play { width: 96px; height: 96px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); background: rgba(255,255,255,.06);
  color: #fff; font-size: 38px; display: grid; place-items: center; padding-left: 8px; transition: opacity .6s, transform .6s; cursor: pointer; }
.intro-play:disabled { opacity: .25; }
.intro-play.weg { opacity: 0; transform: scale(1.3); pointer-events: none; }
.intro-play:not(:disabled) span { animation: introPuls 2.4s ease-in-out infinite; }
@keyframes introPuls { 50% { opacity: .55; } }
.intro-lade { position: absolute; bottom: 18%; color: rgba(255,255,255,.5); font-size: 14px; }
#untertitel { position: fixed; z-index: 60; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(760px, 86vw); text-align: center; color: #fff; font-size: 17px; line-height: 1.45; pointer-events: none;
  text-shadow: 0 1px 3px #000, 0 0 12px rgba(0,0,0,.8); font-family: Georgia, "Times New Roman", serif; }
#gedanke { position: fixed; z-index: 60; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(620px, 88vw); padding: 16px 20px 14px; border-radius: 16px; color: #fff;
  background: rgba(10,12,24,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: gedankeEin .4s ease-out; }
#gedanke p { margin: 0 0 12px; font-size: 18px; font-style: italic; line-height: 1.4; }
#gedanke p::before { content: 'Du denkst:'; display: block; font-style: normal; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; margin-bottom: 4px; }
.gedanke-antworten { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.gedanke-antworten button { border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; font: inherit; font-size: 15px;
  padding: 8px 18px; border-radius: 999px; }
.gedanke-antworten button:active { background: rgba(255,255,255,.25); }
@keyframes gedankeEin { from { opacity: 0; transform: translate(-50%, 12px); } }
.os-symbol.markiert .os-symbol-bild { animation: osMarkiert 1s ease-in-out infinite; }
@keyframes osMarkiert { 50% { box-shadow: 0 0 0 6px rgba(255,255,255,.75), 0 0 24px 8px rgba(120,180,255,.9); transform: scale(1.08); } }
#intro[hidden], #untertitel[hidden], #gedanke[hidden] { display: none; }
.gedanke-zeile { display: block; animation: gedankeZeile .5s ease-out both; }
@keyframes gedankeZeile { from { opacity: 0; transform: translateY(6px); } }
.gedanke-antworten { animation: gedankeZeile .4s ease-out both; animation-delay: var(--antwort-verzug, 0s); }
#gedanke p::before { content: none; }
.gedanke-kopf { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; margin-bottom: 4px; }
#gedanke p:empty { display: none; }

/* OS-Meldungen (Sitzung abgeschlossen) und grosse Haftzettel */
.os-meldung { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.25); font: 13px Tahoma, Verdana, "Segoe UI", sans-serif; color: #000; }
.os-meldung .pq-dialog { transform: translate(-50%, -50%); }
.pq-felder { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.pq-felder label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pq-felder input { width: 150px; font: inherit; padding: 2px 4px; border: 2px inset #d4d0c8; background: #fff; }
.pq-felder input:disabled { background: #eee; color: #555; }
.pq-meldung { margin: 0; min-height: 2.6em; color: #a00000; font-size: 12px; }
.pq-anmeldung { transform: translate(-50%, -50%); }
.pq-dialog-fuss button + button { margin-left: 8px; }
.zettel-gross { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(0,0,0,.55); }
.zettel-papier { position: relative; width: min(46vh, 60vw); aspect-ratio: 1; background: linear-gradient(160deg, #fff59a, #f6dc4a); box-shadow: 0 14px 40px rgba(0,0,0,.45); transform: rotate(-3deg);
  display: grid; place-items: center; font-family: "Segoe Print", "Comic Sans MS", cursive; color: #233; animation: zettelEin .35s ease-out; }
.zettel-nr { position: absolute; left: 10%; top: 8%; font-size: min(7vh, 9vw); }
.zettel-buchstabe { font-size: min(24vh, 30vw); line-height: 1; }
.zettel-hinweis { color: #fff; font-size: 14px; opacity: .85; }
@keyframes zettelEin { from { transform: rotate(-12deg) scale(.6); opacity: 0; } }
/* Start eines Tages: schwarzer Bildschirm mit Titel */
.tag-titel { position: absolute; top: 24%; width: 100%; text-align: center; color: #fff; font-family: Georgia, "Times New Roman", serif; }
.tag-titel b { display: block; font-size: 30px; font-weight: normal; letter-spacing: .04em; }
.tag-titel span { font-size: 15px; opacity: .65; }
/* Inventar-Leiste oben */
#inventar { position: fixed; z-index: 14; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px;
  padding: 6px 10px; border-radius: 14px; background: rgba(12,16,32,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#inventar[hidden] { display: none; }
#inventar button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); font-size: 22px; color: #fff;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55), var(--farbe) 45%, rgba(0,0,0,.4)); display: grid; place-items: center; }
#inventar button span { color: #fff8dc; text-shadow: 0 0 6px rgba(255,248,220,.95), 0 0 2px #000, 0 1px 2px rgba(0,0,0,.6); font-weight: 700; }
#inventar button.gewaehlt { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
#inventar.neu { animation: invNeu .6s ease-out; }
@keyframes invNeu { 40% { transform: translateX(-50%) scale(1.15); } }
body.in-szene #inventar { opacity: .5; }
.mail-zusatz { margin-top: 10px; padding-top: 12px; border-top: 1px solid rgba(0,0,0,.1); }
.mail-zusatz input { font: inherit; padding: 8px 10px; border: 1px solid #c8c8d0; border-radius: 8px; width: min(320px, 70%); }
.mail-zusatz button { font: inherit; padding: 8px 14px; border: 0; border-radius: 8px; background: #2b6cb0; color: #fff; margin-left: 6px; }
.mail-zusatz .antwort-meldung { margin-top: 8px; color: #a33; font-size: 14px; }
.abrechnung { border-collapse: collapse; width: min(420px, 100%); margin-bottom: 10px; }
.abrechnung td { padding: 6px 8px; border-bottom: 1px solid #ddd; }
.abrechnung td:last-child { text-align: right; }
.abrechnung tr.posten { cursor: pointer; }
.abrechnung tr.gestrichen td { text-decoration: line-through; color: #999; }
.abrechnung tr.summe td { font-weight: bold; border-top: 2px solid #333; }
.pq-mitte { transform: translate(-50%, -50%); z-index: 3; }
.tafel { max-width: min(560px, 86vw); padding: 26px 30px; background: #fffaf0; color: #2a2016; border-radius: 6px; box-shadow: 0 14px 40px rgba(0,0,0,.45);
  font: 20px/1.6 Georgia, "Times New Roman", serif; text-align: center; animation: zettelEin .35s ease-out; }
.tafel.karte { font-family: "Segoe Print", "Comic Sans MS", cursive; transform: rotate(-2deg); }
.tafel.blinken { font-size: 42px; font-weight: bold; color: #b00; animation: tafelBlink .5s steps(2) 4; }
@keyframes tafelBlink { 50% { opacity: .2; } }
.pq-formular { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, 90%); z-index: 2; }
.pq-formular .pq-wahl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 16px 14px; }
.pq-formular .pq-wahl button { padding: 10px; font: inherit; background: #d4d0c8; border: 2px solid; border-color: #fff #404040 #404040 #fff; }
#klospiel { position: fixed; inset: 0; z-index: 40; background: #000; touch-action: none; }
#klospiel canvas { width: 100%; height: 100%; display: block; }
#klospiel .klo-zu { position: absolute; right: 14px; top: 12px; padding: 8px 14px; border: 0; border-radius: 999px; background: rgba(255,255,255,.85); font: inherit; }
#schwarzblende { position: fixed; inset: 0; z-index: 45; background: #000; opacity: 0; transition: opacity 1.2s; pointer-events: none; }
#lider { position: fixed; inset: 0; z-index: 46; background: #000; opacity: 0; pointer-events: none; }
/* Kalenderseite zwischen den Tagen */
#kalender-seite { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, #23305e, #0b1020 70%); color: #f4efe6; font-family: Georgia, "Times New Roman", serif; overflow: auto; }
.kal-karte { width: min(560px, 96vw); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.15); border-radius: 18px; padding: 18px 20px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.kal-kopf { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.kal-kopf b { font-size: 26px; font-weight: normal; letter-spacing: .03em; }
.kal-kopf span { opacity: .6; font-size: 13px; }
.kal-woche, .kal-raster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.kal-woche span { text-align: center; font-size: 12px; opacity: .55; }
.kal-tag { position: relative; aspect-ratio: 1.25; border-radius: 9px; display: grid; place-items: center; font-size: 17px; background: rgba(255,255,255,.07); }
.kal-tag.geloest { background: rgba(120,200,140,.18); color: #cfe9d6; }
.kal-tag.geloest i { position: absolute; right: 5px; top: 2px; font-style: normal; font-size: 12px; color: #8fe0a6; }
.kal-tag.naechster { background: #c8342b; color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.6), 0 0 18px rgba(200,52,43,.7); }
.kal-tag.nach { opacity: .25; }
.kal-unten { margin-top: 16px; text-align: center; }
.kal-text { margin: 0 0 6px; font-size: 17px; }
.kal-countdown { margin: 0 0 14px; font-size: 34px; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.kal-knoepfe { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.kal-knoepfe button { font: inherit; font-size: 16px; padding: 10px 20px; border-radius: 999px; border: 0; cursor: pointer; }
.kal-start { background: #f4efe6; color: #1b2340; }
.kal-test { background: rgba(255,255,255,.12); color: #f4efe6; font-size: 14px !important; }
#abschluss-hinweis { position: fixed; z-index: 13; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  padding: 8px 16px; border-radius: 999px; background: rgba(20,60,35,.82); color: #e8fbe9; font-size: 14px; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.35); animation: abschlussPuls 2.4s ease-in-out infinite; }
#abschluss-hinweis[hidden] { display: none; }
@keyframes abschlussPuls { 50% { box-shadow: 0 4px 16px rgba(0,0,0,.35), 0 0 0 4px rgba(140,230,160,.35); } }
.kal-tag[data-tag] { cursor: pointer; }
.kal-tag.spielbar:not(.geloest):not(.naechster) { background: rgba(255,255,255,.14); }
.kal-tag.gesperrt { opacity: .35; }
.kal-oben { display: flex; flex-direction: column; align-items: center; margin: 0 0 12px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
.kal-oben span { font-size: 14px; opacity: .7; }
.kal-oben b { font-size: 34px; font-weight: normal; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.kal-tipp { margin: 8px 0 0; font-size: 12px; opacity: .55; text-align: center; }
.pq-update { width: min(440px, 90%); }
.pq-fortschritt { height: 16px; margin-top: 10px; border: 1px solid #808080; background: #fff; }
.pq-fortschritt i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #0a246a 0 10px, #fff 10px 12px); }
.pq-prozent { margin: 4px 0 0; font-size: 12px; color: #333; }
.pq.flackern { animation: pqFlackern .5s steps(5); }
@keyframes pqFlackern { 20% { filter: brightness(2.5) invert(1); } 40% { filter: none; } 60% { filter: brightness(.2); } 80% { filter: brightness(1.8); } }
/* Intro-Tutorial */
#tutorial { position: fixed; z-index: 16; inset: 0; pointer-events: none; }
#tutorial[hidden] { display: none; }
#tutorial p { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); margin: 0;
  max-width: 80vw; padding: 10px 18px; border-radius: 14px; background: rgba(12,16,32,.8); color: #fff; font-size: 15px; text-align: center; }
.tut-zeichen { position: absolute; width: 90px; height: 90px; }
.tutorial-umsehen .tut-zeichen { right: 18%; top: 42%; }
.tutorial-umsehen .tut-zeichen i { position: absolute; left: 30px; top: 30px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.85);
  box-shadow: 0 0 0 8px rgba(255,255,255,.25); animation: tutWisch 1.8s ease-in-out infinite; }
@keyframes tutWisch { 0%, 100% { transform: translateX(-60px); } 50% { transform: translateX(60px); } }
.tutorial-laufen .tut-zeichen { left: 14%; top: 50%; border: 2px solid rgba(255,255,255,.6); border-radius: 50%; background: rgba(255,255,255,.08); }
.tutorial-laufen .tut-zeichen i { position: absolute; left: 30px; top: 30px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.85);
  animation: tutJoy 2.2s ease-in-out infinite; }
@keyframes tutJoy { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(0, -26px); } 60% { transform: translate(22px, -10px); } }
.tutorial-tippen .tut-zeichen { left: 50%; top: 40%; margin-left: -45px; }
.tutorial-tippen .tut-zeichen i { position: absolute; left: 30px; top: 30px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.85);
  animation: tutTipp 1.2s ease-out infinite; }
@keyframes tutTipp { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); } 100% { box-shadow: 0 0 0 26px rgba(255,255,255,0); } }

/* Falt-Minispiel (Tag 5) */
.falten { position: fixed; inset: 0; z-index: 900; background: #4a2f1c; opacity: 0; transition: opacity .6s; touch-action: none; }
.falten.an { opacity: 1; }
.falten canvas { position: absolute; inset: 0; display: block; touch-action: none; }
.falten-kopf { position: absolute; left: 0; right: 0; top: calc(14px + env(safe-area-inset-top)); text-align: center; color: #fff; pointer-events: none;
  text-shadow: 0 1px 3px #000; font-family: Georgia, "Times New Roman", serif; }
.falten-kopf b { display: block; font: 600 12px/1.4 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.falten-kopf span { font-size: 20px; font-style: italic; }
/* Tag 8: Greifer-Minispiel ueber der echten Kloschuessel */
#klospiel3d { position: fixed; inset: 0; z-index: 40; touch-action: none; }
#klospiel3d .klo-hinweis { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; font-size: 17px; text-shadow: 0 1px 4px #000, 0 0 2px #000; pointer-events: none; }
#klospiel3d .klo-greifer { position: absolute; left: -100px; top: -100px; opacity: 0; font-size: 54px; transform: translate(-50%, -85%); pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#klospiel3d .klo-greifer.zu { opacity: 1; animation: kloGreifen .45s ease-out; }
@keyframes kloGreifen { 0% { transform: translate(-50%, -150%) scale(1.15); } 45% { transform: translate(-50%, -70%) scale(0.9); } 100% { transform: translate(-50%, -110%) scale(1); } }

/* Kalender im Querformat auf dem Handy: Countdown links, Monat rechts, alles ohne Scrollen */
@media (orientation: landscape) and (max-height: 520px) {
  .kal-karte { width: min(860px, 96vw); display: grid; grid-template-columns: minmax(200px, 0.75fr) 1.5fr; column-gap: 22px;
    grid-template-areas: "oben oben" "unten kopf" "unten woche" "unten raster" "unten tipp"; align-items: start; padding: 12px 18px 12px; }
  .kal-oben { grid-area: oben; flex-direction: row; justify-content: center; align-items: baseline; gap: 14px; margin: 0 0 8px; padding: 0 0 8px; }
  .kal-oben b { font-size: 30px; }
  .kal-kopf { grid-area: kopf; margin-bottom: 4px; }
  .kal-kopf b { font-size: 20px; }
  .kal-woche { grid-area: woche; }
  .kal-raster { grid-area: raster; gap: 4px; }
  .kal-tag { aspect-ratio: 1.9; font-size: 14px; border-radius: 7px; }
  .kal-tipp { grid-area: tipp; margin-top: 4px; }
  .kal-unten { grid-area: unten; margin-top: 0; align-self: center; }
  .kal-text { font-size: 15px; }
  .kal-countdown { font-size: 24px; margin-bottom: 8px; }
}
