/* Autark musizieren – Bühnen-Case: schwarz, Alu-Kanten, Kabelfarben als Akzente, Leuchtdioden-Grün.
   Bewegung nur über transform/opacity; „Bewegung reduzieren“ schaltet sie ab. */
:root {
  --case: #0b0c0e; --case2: #101215; --panel: #16181c; --panel2: #1d2025; --rand: #2b3036; --rand2: #3a4048;
  --alu: #a7b0ba; --text: #eef1f4; --leise: #9ea8b2; --dunkel: #0b0c0e;
  --led: #39ff88; --led-d: #1b6b40;
  --xlr: #4b93ff; --klinke: #ffc93c; --klinke35: #ff9a3d; --usb: #e6e9ec; --strom: #ff4d5e; --bt: #3fd7ff; --midi: #c58bff;
  --warn: #ffb020; --rot: #ff5b6a; --gut: #39ff88;
  --r: 14px; --kopf: 58px; --nav: 66px;
  --sa-t: env(safe-area-inset-top, 0px); --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px); --sa-r: env(safe-area-inset-right, 0px);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--text); background-color: var(--case);
  background-image: radial-gradient(120% 60% at 50% -10%, #1a1d22 0%, transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 9px);
  background-attachment: fixed;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
a { color: var(--bt); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: .4em 0; }
.leise { color: var(--leise); }
.klein { font-size: .86rem; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.sym { width: 22px; height: 22px; flex: none; }

/* ---------- Kopf ---------- */
#kopf {
  position: fixed; inset: 0 0 auto 0; z-index: 20; padding: var(--sa-t) calc(12px + var(--sa-r)) 0 calc(12px + var(--sa-l));
  background: linear-gradient(#0b0c0ef2, #0b0c0ee6); border-bottom: 1px solid var(--rand);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.kopf-zeile { height: var(--kopf); display: flex; align-items: center; gap: 10px; max-width: 1100px; margin: 0 auto; }
.logo { width: 34px; height: 34px; display: block; }
.kopf-text { flex: 1; min-width: 0; }
.kopf-text h1 { font-size: 1.06rem; letter-spacing: .02em; }
.kopf-text p { margin: 0; font-size: .78rem; color: var(--leise); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.knopf-ic {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--rand2);
  background: var(--panel); cursor: pointer; flex: none; position: relative;
}
.knopf-ic:active { transform: scale(.95); }
.knopf-ic .zahl { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px;
  background: var(--led); color: var(--dunkel); font: 700 12px/20px var(--mono); text-align: center; }

/* ---------- Hauptbereich ---------- */
#haupt {
  padding: calc(var(--kopf) + var(--sa-t) + 12px) calc(14px + var(--sa-r)) calc(var(--nav) + var(--sa-b) + 22px) calc(14px + var(--sa-l));
  max-width: 1100px; margin: 0 auto; outline: none;
}
.bereich { animation: rein .22s ease-out both; }
@keyframes rein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bereich > h2, .titel2 { font-size: 1.3rem; margin: 4px 0 6px; letter-spacing: .01em; }
.unter { color: var(--leise); margin: 0 0 14px; font-size: .94rem; }

/* ---------- Navigation ---------- */
#nav {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 4px calc(4px + var(--sa-r)) calc(4px + var(--sa-b)) calc(4px + var(--sa-l));
  background: linear-gradient(#111317f0, #0b0c0ef7); border-top: 1px solid var(--rand);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
#nav button {
  min-height: 56px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--leise); border-radius: 12px; cursor: pointer; position: relative; padding: 4px 0;
}
#nav button b { font-size: .7rem; font-weight: 600; letter-spacing: .02em; }
#nav button[aria-current="page"] { color: var(--text); background: var(--panel); }
#nav button[aria-current="page"]::after {
  content: ""; position: absolute; top: 5px; right: calc(50% - 20px); width: 7px; height: 7px; border-radius: 50%;
  background: var(--led); box-shadow: 0 0 8px var(--led);
}
#nav button:active { transform: scale(.95); }

/* Quer auf dem Telefon: Leiste links */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --kopf: 48px; }
  #nav { inset: calc(var(--kopf) + var(--sa-t)) auto 0 0; width: calc(84px + var(--sa-l)); grid-template-columns: 1fr; grid-auto-rows: 1fr;
    padding: 6px 6px calc(6px + var(--sa-b)) calc(6px + var(--sa-l)); border-top: 0; border-right: 1px solid var(--rand); }
  #nav button { min-height: 44px; }
  #nav button b { font-size: .66rem; }
  #haupt { padding-left: calc(84px + var(--sa-l) + 16px); padding-bottom: calc(18px + var(--sa-b)); max-width: none; }
  #kopf { padding-left: calc(12px + var(--sa-l)); }
  #toast { bottom: calc(14px + var(--sa-b)); left: calc(50% + 42px); }
  .kopf-text p { display: inline; margin-left: 8px; }
  .kopf-text h1 { display: inline; }
}

/* ---------- Karten / Case-Panels ---------- */
.karte {
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--rand); border-radius: var(--r);
  padding: 14px; margin: 0 0 12px; position: relative; box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 6px 18px rgba(0,0,0,.35);
}
.karte.case::before, .karte.case::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--rand2); pointer-events: none;
}
.karte.case::before { top: 5px; left: 5px; border-right: 0; border-bottom: 0; border-top-left-radius: 7px; }
.karte.case::after { bottom: 5px; right: 5px; border-left: 0; border-top: 0; border-bottom-right-radius: 7px; }
.karte h3 { font-size: 1.06rem; }
.karte h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--leise); margin: 12px 0 6px; }
.raster { display: grid; gap: 12px; }
.raster > .karte { margin: 0; }
@media (min-width: 700px) {
  .raster.zwei { grid-template-columns: 1fr 1fr; }
  .raster.drei { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ---------- Bedienelemente ---------- */
.btn {
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--rand2); background: var(--panel2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 600; text-decoration: none;
  color: var(--text); line-height: 1.15;
}
.btn:active { transform: scale(.97); }
.btn.haupt { background: var(--led); border-color: var(--led); color: var(--dunkel); }
.btn.klein { min-height: 44px; padding: 8px 12px; font-size: .9rem; }
.btn.rand { background: transparent; }
.btn .sym { width: 20px; height: 20px; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 1px solid var(--rand2); background: var(--panel);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; color: var(--text); user-select: none;
}
.chip[aria-pressed="true"] { border-color: var(--led); background: #0f2a1c; color: #c9ffe0; }
.chip[aria-pressed="true"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--led); box-shadow: 0 0 8px var(--led); }
.chip:active { transform: scale(.96); }
.feld {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--rand2); background: #0e1013;
  color: var(--text); outline: none;
}
.feld:focus { border-color: var(--led); box-shadow: 0 0 0 3px #39ff8826; }
textarea.feld { min-height: 140px; resize: vertical; font: .9rem/1.4 var(--mono); }
.suchfeld { position: relative; }
.suchfeld .sym { position: absolute; left: 14px; top: 13px; color: var(--leise); pointer-events: none; }
.suchfeld .feld { padding-left: 46px; font-size: 1.02rem; }
label.zeile { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--led); flex: none; }
input[type="range"] { width: 100%; height: 44px; accent-color: var(--led); }
select.feld { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--leise) 50%), linear-gradient(135deg, var(--leise) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
:focus-visible { outline: 3px solid var(--bt); outline-offset: 2px; }

/* LEDs und Marken */
.led { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--led); box-shadow: 0 0 8px var(--led); flex: none; }
.led.gelb { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.led.rot { background: var(--rot); box-shadow: 0 0 8px var(--rot); }
.led.aus { background: #3a4048; box-shadow: none; }
.led.blink { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.marke { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1px solid var(--rand2); background: #0e1013; white-space: nowrap; }
.marke.gut { color: #b9ffd6; border-color: #1f6b43; }
.marke.gelb { color: #ffe2a6; border-color: #7a5a12; }
.marke.rot { color: #ffc2c8; border-color: #7a2630; }
.marke.blau { color: #cfe2ff; border-color: #2b4f86; }

/* ---------- Setup ---------- */
.vorschlaege { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--rand); border-radius: 12px; overflow: hidden; background: #0e1013; }
.vorschlaege li + li { border-top: 1px solid var(--rand); }
.vorschlag { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: none; border: 0; text-align: left; cursor: pointer; }
.vorschlag:active { background: var(--panel2); }
.vorschlag .gsym { width: 44px; height: 28px; }
.vorschlag .n { flex: 1; min-width: 0; }
.vorschlag .n b { display: block; }
.vorschlag .n span { font-size: .82rem; color: var(--leise); }
.vorschlag.drin { opacity: .55; }
.gsym { width: 56px; height: 35px; flex: none; }
.art-mischpult, .art-audio_interface { color: var(--xlr); }
.art-gesangseffekt { color: var(--bt); }
.art-effektgeraet { color: var(--klinke35); }
.art-synthesizer, .art-keyboard { color: var(--klinke); }
.art-groovebox { color: var(--midi); }
.art-recorder, .art-lautsprecher { color: var(--usb); }

.uebersicht { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 0; }
.wert { background: #0e1013; border: 1px solid var(--rand); border-radius: 12px; padding: 8px 10px; }
.wert b { display: block; font: 700 1.2rem/1.2 var(--mono); color: var(--led); text-shadow: 0 0 10px #39ff8840; }
.wert span { font-size: .74rem; color: var(--leise); }
.stufen { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.geraet { padding: 0; overflow: hidden; }
.geraet.neu { animation: auf .28s ease-out both; }
@keyframes auf { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.geraet .schiene { height: 4px; background: currentColor; opacity: .9; }
.geraet .kopf { display: flex; align-items: center; gap: 12px; padding: 12px 14px 6px; }
.geraet .kopf .n { flex: 1; min-width: 0; }
.geraet .kopf h3 { font-size: 1.05rem; color: var(--text); }
.geraet .kopf .her { font-size: .82rem; color: var(--leise); }
.geraet .innen { padding: 4px 14px 14px; color: var(--text); }
.fakten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 10px; }
.fakten .wert b { font-size: 1rem; color: var(--text); text-shadow: none; white-space: nowrap; }
.fakten .wert.pol { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.fakten .wert.pol b { font-size: .92rem; display: inline; }
.kabel-box { border: 1px solid var(--rand2); border-left: 4px solid var(--strom); border-radius: 10px; padding: 10px 12px; background: #120f11; }
.kabel-box b { display: block; }
.kabel-box p { margin: 4px 0 0; font-size: .9rem; color: #d6dbe0; }
.warn { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 10px; margin: 8px 0 0; font-size: .9rem; background: #0e1013; border: 1px solid var(--rand); }
.warn .sym { width: 20px; height: 20px; margin-top: 1px; }
.warn.rot { border-color: #7a2630; background: #1a0d10; } .warn.rot .sym { color: var(--rot); }
.warn.gelb { border-color: #6b4f12; background: #19140a; } .warn.gelb .sym { color: var(--warn); }
.warn.gut { border-color: #1f6b43; background: #0c1a12; } .warn.gut .sym { color: var(--gut); }
.warn.info .sym { color: var(--bt); }
details.mehr { margin-top: 10px; border-top: 1px dashed var(--rand2); }
details.mehr > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; color: var(--leise); font-weight: 600; }
details.mehr > summary::-webkit-details-marker { display: none; }
details.mehr > summary .sym { width: 18px; height: 18px; transition: transform .2s; }
details.mehr[open] > summary .sym { transform: rotate(90deg); }
.prod { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--rand); }
.prod:first-child { border-top: 0; }
.prod .n { flex: 1; min-width: 0; font-size: .9rem; }
.prod .n small { display: block; color: var(--leise); }
.linkzeile { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 0; text-decoration: none; color: var(--bt); word-break: break-word; font-size: .9rem; }
.linkzeile .sym { width: 18px; height: 18px; flex: none; }
.quellen { list-style: none; padding: 0; margin: 4px 0; }
.foto { margin: 10px 0 0; }
.foto img { width: 100%; max-height: 220px; object-fit: contain; background: #0e1013; border-radius: 10px; border: 1px solid var(--rand); display: block; }
.foto figcaption { font-size: .76rem; color: var(--leise); margin-top: 4px; }
.messen-wahl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.leer { text-align: center; padding: 26px 14px; }
.leer .gsym { width: 96px; height: 60px; color: var(--rand2); }

/* Einkaufszettel */
.zettel { list-style: none; padding: 0; margin: 0; }
.zettel li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--rand); }
.zettel li:first-child { border-top: 0; }
.zettel .anz { font: 700 1rem var(--mono); color: var(--led); width: 34px; text-align: right; flex: none; }
.zettel .n { flex: 1; min-width: 0; }
.zettel .n small { display: block; color: var(--leise); }

/* Dialog */
dialog {
  border: 1px solid var(--rand2); border-radius: 18px; background: var(--panel); color: var(--text); padding: 0;
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px - var(--sa-t) - var(--sa-b));
}
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog[open] { animation: auf .2s ease-out both; }
.dlg-kopf { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; background: var(--panel); border-bottom: 1px solid var(--rand); z-index: 1; }
.dlg-kopf h2 { flex: 1; font-size: 1.08rem; }
.dlg-innen { padding: 14px 16px 18px; }
.polsym { width: 100%; max-width: 320px; display: block; margin: 6px auto; }
.polsym .pz { font: 700 28px var(--mono); }
.polsym .pl { font: 12px -apple-system, system-ui, sans-serif; fill: var(--leise); }
.messbild { width: 100%; display: block; margin: 8px 0; background: #0e1013; border-radius: 12px; border: 1px solid var(--rand); }
.messbild .ml { font: 11px -apple-system, system-ui, sans-serif; fill: var(--leise); }
.messbild .mz { font: 700 22px var(--mono); fill: var(--led); }
.messbild .mk { font: 10px var(--mono); fill: var(--leise); }
.messbild .m-rot { animation: sondeRot 6s ease-in-out infinite; }
.messbild .m-sw { animation: sondeSw 6s ease-in-out infinite; }
.messbild .m-anzeige { animation: anzeige 6s ease-in-out infinite; }
@keyframes sondeRot { 0%, 8% { transform: translate(70px, 60px); opacity: 0; } 22%, 92% { transform: none; opacity: 1; } 100% { transform: none; opacity: 0; } }
@keyframes sondeSw { 0%, 26% { transform: translate(60px, 50px); opacity: 0; } 40%, 92% { transform: none; opacity: 1; } 100% { transform: none; opacity: 0; } }
@keyframes anzeige { 0%, 44% { opacity: 0; } 52%, 92% { opacity: 1; } 100% { opacity: 0; } }
.schritte { margin: 6px 0 0; padding-left: 22px; }
.schritte li { margin: 4px 0; }
.teil-link { font: .85rem/1.35 var(--mono); word-break: break-all; }

/* Toast + Update */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav) + var(--sa-b) + 14px); transform: translate(-50%, 20px); opacity: 0; z-index: 40;
  background: #0f2a1c; color: #d4ffe6; border: 1px solid var(--led-d); padding: 10px 16px; border-radius: 12px; pointer-events: none;
  transition: transform .2s, opacity .2s; max-width: calc(100vw - 32px); }
#toast.zeigen { transform: translate(-50%, 0); opacity: 1; }
#update { position: fixed; top: calc(var(--kopf) + var(--sa-t) + 8px); left: 50%; transform: translate(-50%, -12px); opacity: 0; pointer-events: none; z-index: 30;
  background: var(--panel2); border: 1px solid var(--led-d); border-radius: 12px; padding: 6px 6px 6px 14px; display: flex; align-items: center; gap: 10px;
  transition: transform .2s, opacity .2s; }
#update.zeigen { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }

/* Tabellen-artige Listen (Rechner, Boxen) */
.zeilen { display: grid; gap: 6px; }
.zeile2 { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.zeile2 .n { flex: 1; min-width: 0; }
.zahlfeld { width: 88px; min-height: 44px; text-align: right; font-family: var(--mono); }
.bank .kopf2 { display: flex; gap: 10px; align-items: flex-start; }
.bank .kopf2 .n { flex: 1; min-width: 0; }
.ports { list-style: none; margin: 8px 0 0; padding: 0; font-size: .88rem; }
.ports li { display: flex; gap: 8px; padding: 5px 0; border-top: 1px solid var(--rand); align-items: baseline; }
.ports li b { font-family: var(--mono); font-size: .82rem; min-width: 96px; color: var(--alu); }
.balken { height: 10px; border-radius: 5px; background: #0e1013; border: 1px solid var(--rand); overflow: hidden; margin: 6px 0; }
.balken i { display: block; height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--led-d), var(--led)); transition: transform .3s; }
.balken.knapp i { background: linear-gradient(90deg, #6b4f12, var(--warn)); }
.balken.zuwenig i { background: linear-gradient(90deg, #7a2630, var(--rot)); }
.gross { font: 700 2rem/1.1 var(--mono); color: var(--led); text-shadow: 0 0 14px #39ff8840; white-space: nowrap; min-width: 3.6em; }

/* Boxen */
.boxfakten { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.boxfakten .marke { font-weight: 500; }
.filterleiste { padding: 6px 0 10px; }
.liste-ohne { list-style: none; padding: 0; margin: 4px 0; }
.liste-ohne li { padding: 3px 0; }
ul.punkte { margin: 4px 0; padding-left: 20px; }
ul.punkte li { margin: 3px 0; }

/* Signalweg */
.signal-svg { width: 100%; height: auto; display: block; background: #0e1013; border: 1px solid var(--rand); border-radius: 12px; }
.signal-svg text { font: 11.5px -apple-system, system-ui, sans-serif; fill: var(--text); }
.signal-svg .kl { font-size: 10.5px; fill: var(--leise); }
.signal-svg .kt { font: 600 11px -apple-system, system-ui, sans-serif; }
.signal-svg .puls { animation: blink 2.4s ease-in-out infinite; }
.legende { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .82rem; color: var(--leise); margin: 8px 0 0; }
.legende i { display: inline-block; width: 22px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
@media (min-width: 900px) { .signal-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } }
@media (orientation: landscape) and (max-height: 560px) { .signal-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } }

/* Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
html.ruhig *, html.ruhig *::before, html.ruhig *::after { animation: none !important; transition: none !important; }
