:root {
  --bg: #262624;
  --bg-leiste: #1f1e1d;
  --bg-karte: #30302e;
  --rand: #3a3936;
  --text: #ece9e1;
  --text-leise: #a8a49a;
  --akzent: #d97757;
  --fehler: #f87171;
  --radius: 12px;
  --schrift-titel: "Source Serif 4", Georgia, serif;
  --schrift-text: Inter, system-ui, sans-serif;
  --schrift-mono: "JetBrains Mono", Consolas, monospace;
  --leiste-breite: 264px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--schrift-text); }
h1, h2, h3 { font-family: var(--schrift-titel); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.mitte { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-box { display: grid; gap: 12px; width: min(320px, 100%); text-align: center; justify-items: center; }
.login-box h1 { margin: 0; }
.feld { width: 100%; padding: 12px; border-radius: var(--radius); border: 1px solid var(--rand); background: var(--bg-karte); color: var(--text); font: inherit; }
.knopf { width: 100%; padding: 12px; border: 0; border-radius: var(--radius); background: var(--akzent); color: #111; font: inherit; font-weight: 600; cursor: pointer; }
.knopf.zweit { background: var(--bg-karte); color: var(--text); margin-top: 8px; }
.fehlerzeile { color: var(--fehler); min-height: 1.5em; margin: 0; }
.leise { color: var(--text-leise); }

/* Aufbau */
#app { display: grid; grid-template-columns: var(--leiste-breite) 1fr; height: 100dvh; overflow: hidden; position: relative; }
#app.leiste-zu { grid-template-columns: 0 1fr; }
#leiste { background: var(--bg-leiste); border-right: 1px solid var(--rand); display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 16px 12px; gap: 8px; }
#app.leiste-zu #leiste { position: absolute; top: 0; bottom: 0; left: 0; width: var(--leiste-breite); z-index: 20; transform: translateX(-100%); }
#app.leiste-zu.leiste-ueber #leiste { transform: none; }
#randstreifen { display: none; position: absolute; top: 0; bottom: 0; left: 0; width: 12px; z-index: 15; }
#app.leiste-zu #randstreifen { display: block; }
.menueknopf { display: none; }
#inhalt { min-width: 0; min-height: 0; overflow: hidden; padding: 32px 40px; }

/* Seitenleiste */
.leiste-kopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.titel { background: none; border: 0; padding: 4px; cursor: pointer; font-family: var(--schrift-titel); font-size: 20px; font-weight: 600; text-align: left; }
.leiseknopf { background: none; border: 0; padding: 4px 8px; color: var(--text-leise); cursor: pointer; font-size: 18px; }
.suche { position: relative; }
.suche .feld { padding: 8px 32px 8px 12px; background: var(--bg); }
.suche kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--schrift-mono); font-size: 12px; color: var(--text-leise); border: 1px solid var(--rand); border-radius: 4px; padding: 0 5px; }
.abschnitt { margin: 8px 0 0; font-family: var(--schrift-text); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-leise); }
#kategorien { display: grid; gap: 2px; }
.zeile { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: 0; border-radius: 8px; padding: 8px; text-align: left; cursor: pointer; }
.zeile:hover, .zeile.aktiv { background: var(--bg-karte); }
.zeile .anzahl { color: var(--text-leise); font-family: var(--schrift-mono); font-size: 13px; }
.neues { flex: 1; min-height: 0; overflow: hidden; border: 1px solid var(--rand); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.neues .abschnitt { margin: 0; }
.neues p { margin: 4px 0 0; }
.leiste-fuss { display: grid; gap: 2px; }
.status { margin: 4px 8px 0; font-family: var(--schrift-mono); font-size: 12px; color: var(--text-leise); }

/* Kachelfenster */
#kachelfenster { position: absolute; top: 0; bottom: 0; left: var(--leiste-breite); width: 420px; z-index: 10; background: var(--bg-leiste); border-right: 1px solid var(--rand); display: flex; flex-direction: column; min-height: 0; }
#app.leiste-zu #kachelfenster { left: 0; }
.kachel-kopf { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.kachel-kopf h2 { margin: 0; font-size: 20px; }
#kacheln { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 16px; display: grid; gap: 12px; align-content: start; }
.kachel { display: flex; flex-direction: column; gap: 4px; width: 100%; height: 232px; background: var(--bg-karte); border: 1px solid var(--rand); border-radius: 8px; padding: 8px; text-align: left; cursor: pointer; overflow: hidden; }
.kachel .vorschau { aspect-ratio: 16 / 9; width: 100%; background: var(--bg-karte); border: 1px solid var(--rand); border-radius: 6px; flex: none; }
.kachel .name { font-weight: 600; }
.kachel .beschreibung { color: var(--text-leise); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.leer { color: var(--text-leise); margin: 0; }

/* Hauptfläche */
#inhalt h1 { margin: 0 0 8px; font-size: 32px; padding-right: 48px; }
.lead { color: var(--text-leise); margin: 0 0 24px; }
.zahlen { color: var(--text-leise); margin: 0 0 24px; font-family: var(--schrift-mono); font-size: 14px; }
.spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.spalte { display: grid; gap: 16px; align-content: start; }
.rahmen { border: 1px solid var(--rand); border-radius: 8px; padding: 12px 16px; background: var(--bg-karte); }
.rahmen h3 { margin: 0 0 4px; font-size: 16px; }
.rahmen p { margin: 0; color: var(--text-leise); }

/* Dialoge */
dialog { width: min(480px, calc(100% - 32px)); border: 0; border-radius: var(--radius); background: var(--bg-karte); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / 0.5); }
dialog h2 { margin-top: 0; }
.resetknopf { position: fixed; top: 10px; right: 10px; z-index: 40; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rand); background: var(--bg-leiste); color: var(--text-leise); font-size: 18px; line-height: 1; cursor: pointer; }
.resetknopf:hover { color: var(--text); }
#wunsch-speichern { margin-top: 8px; }
#wunsch-liste { list-style: none; padding: 0; }
#wunsch-liste li { padding: 8px 0; border-bottom: 1px solid var(--rand); display: flex; gap: 8px; align-items: baseline; }
.loeschen { margin-left: auto; background: none; border: 0; color: var(--text-leise); font-size: 20px; cursor: pointer; }

/* Handy: Seite darf scrollen, Leiste als Menü */
@media (max-width: 799px) {
  .kachel-kopf { padding-right: 56px; }
  html, body { height: auto; overflow: auto; }
  #app, #app.leiste-zu { display: block; height: auto; overflow: visible; }
  #randstreifen, #app.leiste-zu #randstreifen { display: none; }
  .menueknopf { display: block; position: fixed; top: 8px; left: 8px; z-index: 30; background: var(--bg-leiste); border: 1px solid var(--rand); border-radius: 8px; padding: 4px 12px; cursor: pointer; }
  #leiste, #app.leiste-zu #leiste { position: fixed; top: 0; bottom: 0; left: 0; width: min(var(--leiste-breite), 85vw); z-index: 25; transform: translateX(-100%); }
  #app.menue-offen #leiste { transform: none; }
  #btn-einklappen { display: none; }
  #kachelfenster, #app.leiste-zu #kachelfenster { position: fixed; left: 0; width: 100%; z-index: 26; }
  #inhalt { overflow: visible; padding: 56px 16px 24px; }
  .spalten { grid-template-columns: 1fr; }
}
