:root {
  --bg: #0f2a1d;
  --card: #163a28;
  --text: #f4efe6;
  --muted: #b9c7bd;
  --red: #c0392b;
  --gold: #e8c547;
  --green: #2e8b57;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1d4a33, var(--bg) 70%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
.snow {
  position: fixed; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff8, transparent),
    radial-gradient(2px 2px at 120px 80px, #fff6, transparent),
    radial-gradient(3px 3px at 200px 150px, #fff5, transparent),
    radial-gradient(2px 2px at 60px 200px, #fff7, transparent);
  background-size: 250px 250px;
  animation: snow 12s linear infinite;
}
@keyframes snow { to { background-position: 0 250px; } }
.container { position: relative; max-width: 640px; margin: 0 auto; padding: 32px 16px; }
h1, h2 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.card {
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 24px #0006;
}
.form { display: grid; gap: 16px; margin-top: 16px; }
label { display: grid; gap: 6px; font-weight: 600; }
input {
  padding: 10px 12px; font-size: 1rem; border-radius: 8px;
  border: 1px solid #ffffff40; background: #0b1f15; color: var(--text);
}
button {
  padding: 10px 16px; font-size: 1rem; font-weight: 600; cursor: pointer;
  border: none; border-radius: 8px; background: var(--red); color: #fff;
}
button:hover { filter: brightness(1.1); }
button.link { background: none; color: var(--muted); text-decoration: underline; padding: 0; }
.error { color: #ff8a80; font-weight: 600; }
.success { color: #9be7a8; font-size: 1.1rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 24px 0;
}
@media (max-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.square {
  aspect-ratio: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff; text-decoration: none;
  border-radius: 10px; border: 2px dashed var(--gold);
  transition: transform .15s;
}
.square:hover { transform: scale(1.05); }
.square.solved { background: var(--green); border-style: solid; }
.square .num { position: absolute; top: 4px; left: 8px; font-size: .8rem; opacity: .8; }
.square .letter { font-size: 2.2rem; font-weight: 800; }
.question { font-size: 1.15rem; white-space: pre-line; }
.back { color: var(--muted); }
.done { text-align: center; }
.completion { white-space: pre-line; font-size: 1.1rem; }
.console { margin: 16px 0 24px; padding-top: 8px; border-top: 1px solid #ffffff30; }
.console h2 { font-size: 1.1rem; }
textarea {
  width: 100%; padding: 10px 12px; font-size: .95rem; border-radius: 8px;
  border: 1px solid #ffffff40; background: #0b1f15; color: #9be7a8;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; resize: vertical;
}
.sql-error { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; word-break: break-word; }
.result { overflow-x: auto; margin-top: 8px; border-radius: 8px; border: 1px solid #ffffff30; }
.result table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.result th, .result td { padding: 6px 10px; text-align: left; white-space: nowrap; }
.result th { background: #0b1f15; color: var(--gold); }
.result tbody tr:nth-child(even) { background: #ffffff0d; }
.terminal {
  margin: 16px 0 24px; padding: 12px; height: 320px; overflow-y: auto;
  background: #050a07; color: #7CFC9A; border-radius: 8px; border: 1px solid #ffffff30;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9rem;
  cursor: text;
}
.term-out div { white-space: pre-wrap; word-break: break-word; }
.term-echo { color: #d6f5de; }
.term-err { color: #ff8a80; }
.term-line { display: flex; gap: 8px; align-items: baseline; }
.term-prompt { color: var(--gold); white-space: nowrap; }
.term-line input {
  flex: 1; min-width: 0; padding: 0; border: none; outline: none; border-radius: 0;
  background: transparent; color: inherit; font: inherit;
}
.lichtpult { margin: 16px 0 24px; padding-top: 8px; border-top: 1px solid #ffffff30; }
.lichtpult h2 { font-size: 1.1rem; }
.schaltplan { width: 100%; height: auto; display: block; margin: 8px 0 16px; }
.schaltplan .wire path { fill: none; stroke: var(--muted); stroke-width: 2; }
.schaltplan .joint { fill: var(--muted); }
.schaltplan .switch-labels text { fill: var(--text); font-weight: 700; font-size: 16px; }
.schaltplan .gate rect { fill: #0b1f15; stroke: var(--gold); stroke-width: 2; }
.schaltplan .gate text { fill: var(--gold); font-size: 13px; font-weight: 700; text-anchor: middle; }
.schaltplan .lamp { fill: #333; stroke: var(--muted); stroke-width: 2; }
.schaltplan .lamp.lit { fill: #ffe066; stroke: #fff3b0; filter: drop-shadow(0 0 12px #ffe066); }
.schaltplan .lamp-label { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.switches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.switch {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative; font-weight: 700; cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-state {
  width: 52px; padding: 6px 0; text-align: center; border-radius: 6px; font-size: .8rem;
  background: #333; color: var(--muted); border: 2px solid #ffffff30;
}
.switch-state::after { content: "AUS"; }
.switch input:checked ~ .switch-state { background: var(--gold); color: #1b1b1b; border-color: #fff3b0; }
.switch input:checked ~ .switch-state::after { content: "AN"; }
.switch input:focus-visible ~ .switch-state { outline: 2px solid #fff; outline-offset: 2px; }
.switches button { margin-left: auto; }
.spotlight {
  font-size: 1.15rem; font-weight: 700; color: #1b1b1b; background: #ffe066;
  padding: 10px 14px; border-radius: 8px; box-shadow: 0 0 24px #ffe06699;
}
.regiebuch {
  margin: 16px 0 24px; padding: 16px 18px; border-radius: 8px;
  background: #3a1414; border: 2px solid var(--red);
}
.regiebuch h2 { font-size: 1.15rem; }
.regiebuch code { background: #0b1f15; padding: 2px 6px; border-radius: 4px; color: #9be7a8; }
.regiebuch.offen { background: #f5ecd7; color: #2b2116; border-color: var(--gold); box-shadow: 0 0 24px #e8c54755; }
.regiebuch.offen .muted { color: #6b5a42; }
.regie-text { font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; font-style: italic; margin: 8px 0 0; }
.katalog {
  margin: 16px 0 24px; padding: 16px; border-radius: 8px;
  background: #2b2116; border: 2px solid #8a6d3b;
}
.katalog-nr { color: var(--gold); font-weight: 700; font-size: .9rem; letter-spacing: .04em; }
.katalog-item { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.katalog-emoji { font-size: 2.6rem; line-height: 1; }
.katalog-name { font-size: 1.2rem; font-weight: 700; }
.katalog-nav { display: flex; justify-content: space-between; gap: 12px; }
.katalog-nav button:disabled { opacity: .4; cursor: default; filter: none; }
.schatz {
  white-space: pre-line; font-size: 1.1rem; font-weight: 600; color: #1b1b1b;
  background: linear-gradient(135deg, #ffe066, #e8c547); padding: 14px 16px; border-radius: 8px;
  box-shadow: 0 0 24px #ffe06699;
}
.bonus-star {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin-bottom: 16px; font-size: 1.8rem; text-decoration: none;
  border-radius: 10px; background: #ffe066; box-shadow: 0 0 18px #ffe06699;
}
