/* =====================================================================
   BunkerHost – Stylesheet (Pixel-Look)
   ===================================================================== */
@font-face { font-family: 'Press Start 2P'; src: url('../assets/fonts/press-start-2p.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'VT323'; src: url('../assets/fonts/vt323.woff2') format('woff2'); font-display: block; }

:root {
  --bg: #07090d; --panel: #10141c; --panel2: #191f2a; --panel3: #242c3a; --rand: #323c4d; --rand2: #4a566b;
  --text: #c9d2e0; --dim: #7f8ca3; --weiss: #f2f5fa;
  --gruen: #3ddc84; --rot: #ff4d4d; --gelb: #ffd84d; --orange: #ffa23d; --blau: #3da5ff; --cyan: #3df5e6; --lila: #b45cff;
  --pix: 'Press Start 2P', monospace; --term: 'VT323', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--term); font-size: 20px; line-height: 1.15; }
body { background: radial-gradient(ellipse at top, #121826 0%, var(--bg) 70%); overflow: hidden; }
button { font-family: inherit; }
b { color: var(--weiss); font-weight: normal; }
small { color: var(--dim); }
.gruen { color: var(--gruen) !important; } .rot { color: var(--rot) !important; } .gelb { color: var(--gelb) !important; }
.orange { color: var(--orange) !important; } .blau { color: var(--blau) !important; } .lila { color: var(--lila) !important; }
.klein { font-size: 17px; color: var(--dim); }
[hidden] { display: none !important; }

#laden { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; font-family: var(--pix); font-size: 12px; color: var(--gruen); background: var(--bg); z-index: 100; gap: 16px; }
#ladefehler { color: var(--rot); font-family: var(--term); font-size: 20px; max-width: 520px; }

/* Icons aus icons.png (10×10, doppelt skaliert) */
.ic { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: -4px; margin-right: 4px;
  background: url('../assets/img/icons.png') no-repeat; background-size: 400px 20px; image-rendering: pixelated; }
.ic-money { background-position: 0 0; } .ic-star { background-position: -20px 0; } .ic-power { background-position: -40px 0; }
.ic-cool { background-position: -60px 0; } .ic-temp { background-position: -80px 0; } .ic-net { background-position: -100px 0; }
.ic-shield { background-position: -120px 0; } .ic-cpu { background-position: -140px 0; } .ic-disk { background-position: -160px 0; }
.ic-user { background-position: -180px 0; } .ic-warn { background-position: -200px 0; } .ic-wrench { background-position: -220px 0; }
.ic-clock { background-position: -240px 0; } .ic-bolt_r { background-position: -260px 0; } .ic-speaker { background-position: -280px 0; }
.ic-mute { background-position: -300px 0; } .ic-pause { background-position: -320px 0; } .ic-play { background-position: -340px 0; }
.ic-rank { background-position: -360px 0; } .ic-ticket { background-position: -380px 0; }

/* ---------------------------------------------------------------- Layout */
#app { display: flex; flex-direction: column; height: 100vh; }
#hud { display: flex; align-items: center; gap: 18px; padding: 8px 14px; background: var(--panel); border-bottom: 3px solid var(--rand); flex-wrap: wrap; }
.logo { font-family: var(--pix); font-size: 14px; color: var(--gruen); text-shadow: 2px 2px 0 #0b3b22, 0 0 12px rgba(61,220,132,.35); letter-spacing: 1px; }
.logo.gross { font-size: 30px; text-align: center; margin: 8px 0 10px; text-shadow: 4px 4px 0 #0b3b22, 0 0 24px rgba(61,220,132,.4); }
.hud-item { display: flex; align-items: center; gap: 4px; }
.hud-item .ic { margin-right: 2px; }
.hud-item b { font-family: var(--pix); font-size: 11px; display: block; }
.hud-item small { display: block; font-size: 16px; margin-top: 2px; }
.hud-item.rang { min-width: 170px; }
.hud-item.rang .balken { margin-top: 5px; width: 150px; }
.hud-knoepfe { margin-left: auto; display: flex; gap: 6px; }

main { flex: 1; display: flex; min-height: 0; }
#links { flex: 1; display: flex; flex-direction: column; padding: 10px 12px; gap: 8px; min-width: 0; overflow: hidden; }
#seite { width: 430px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-left: 3px solid var(--rand); min-height: 0; }

#raumTabs { display: flex; gap: 4px; width: min(100%, calc((100vh - 310px) * 16 / 9)); margin: 0 auto; }
.rtab { font-family: var(--pix); font-size: 9px; padding: 7px 10px; background: var(--panel2); color: var(--dim); border: 2px solid var(--rand); border-bottom: none; cursor: pointer; position: relative; }
.rtab.aktiv { background: var(--panel3); color: var(--gelb); border-color: var(--rand2); }
.rtab.zu { opacity: .7; }
.rtab .punkt { position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; background: var(--rot); box-shadow: 0 0 6px var(--rot); animation: blink .6s steps(2) infinite; }

#stage { position: relative; width: min(100%, calc((100vh - 310px) * 16 / 9)); margin: 0 auto; border: 3px solid var(--rand2); box-shadow: 0 0 0 3px #000, 0 10px 30px rgba(0,0,0,.6); background: #000; flex: none; }
#cv { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; aspect-ratio: 16 / 9; }

#pauseHinweis { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); font-family: var(--pix); font-size: 22px; color: var(--gelb); text-shadow: 3px 3px 0 #000; pointer-events: none; animation: blink 1s steps(2) infinite; }
#insolvenz { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); font-family: var(--pix); font-size: 11px; background: var(--rot); color: #000; padding: 8px 12px; animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

#tooltip { position: absolute; z-index: 6; background: rgba(7,9,13,.95); border: 2px solid var(--rand2); padding: 6px 9px; font-size: 18px; pointer-events: none; max-width: 240px; }

/* Anzeigen unter dem Bunker */
#gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 18px; width: min(100%, calc((100vh - 310px) * 16 / 9)); margin: 0 auto; flex: none; }
.gauge { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; font-size: 18px; min-width: 0; }
.gauge .g-bar { grid-column: 1 / -1; grid-row: 2; }
.gauge span { white-space: nowrap; color: var(--dim); overflow: hidden; text-overflow: ellipsis; }
.g-bar { height: 10px; background: #000; border: 2px solid var(--rand); position: relative; }
.g-fill { height: 100%; background: var(--gruen); transition: width .3s; }
.gauge em { font-style: normal; font-size: 17px; color: var(--text); white-space: nowrap; }
.gauge.warn .g-fill { background: var(--orange); }
.gauge.kritisch .g-fill { background: var(--rot); animation: blink .6s steps(2) infinite; }
.gauge.kritisch em { color: var(--rot); }
.gauge.ereignis .g-fill { background: var(--cyan); transition: none; }

#logBox { flex: 1; min-height: 60px; width: min(100%, calc((100vh - 310px) * 16 / 9)); margin: 0 auto; background: var(--panel); border: 2px solid var(--rand); display: flex; flex-direction: column; }
.log-titel { font-family: var(--pix); font-size: 8px; color: var(--dim); padding: 5px 8px; border-bottom: 2px solid var(--rand); }
#log { overflow-y: auto; padding: 4px 8px; flex: 1; }
#log .l { font-size: 18px; padding: 1px 0; }
#log .l span { color: var(--dim); margin-right: 8px; }
#log .l.gut { color: var(--gruen); } #log .l.schlecht { color: var(--rot); } #log .l.warn { color: var(--orange); }

/* ---------------------------------------------------------------- Buttons */
.btn { font-family: var(--term); font-size: 19px; color: var(--weiss); background: var(--panel3); border: 2px solid var(--rand2); box-shadow: inset -2px -2px 0 rgba(0,0,0,.35), inset 2px 2px 0 rgba(255,255,255,.08);
  padding: 4px 10px; cursor: pointer; line-height: 1.1; }
.btn:hover:not([disabled]) { background: #2f3a4c; border-color: var(--cyan); }
.btn:active:not([disabled]) { box-shadow: inset 2px 2px 0 rgba(0,0,0,.35); transform: translateY(1px); }
.btn[disabled], .btn[data-gesperrt] { opacity: .45; cursor: not-allowed; }
.btn.gruen { background: #14532f; border-color: var(--gruen); }
.btn.gruen:hover:not([disabled]) { background: #1b6b40; }
.btn.gross { font-family: var(--pix); font-size: 12px; padding: 12px 18px; }
.btn.icon { width: 36px; height: 34px; padding: 0; display: grid; place-items: center; font-family: var(--pix); font-size: 11px; }
.btn.icon .ic { margin: 0; }

/* ---------------------------------------------------------------- Seitenleiste */
#tabs { display: flex; border-bottom: 3px solid var(--rand); flex: none; }
.tab { flex: 1; font-family: var(--pix); font-size: 8px; padding: 12px 2px; background: var(--panel2); color: var(--dim); border: none; border-right: 2px solid var(--rand); cursor: pointer; position: relative; }
.tab:last-child { border-right: none; }
.tab.aktiv { background: var(--panel); color: var(--gelb); box-shadow: inset 0 -3px 0 var(--gelb); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 3px; font-style: normal; font-family: var(--pix); font-size: 7px; line-height: 16px; background: var(--blau); color: #000; }
.badge.rot { background: var(--rot); animation: blink .8s steps(2) infinite; }
#panel { flex: 1; overflow-y: auto; padding: 10px 12px 24px; }
#panel h3 { font-family: var(--pix); font-size: 10px; color: var(--gelb); margin: 14px 0 8px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
#panel h3:first-child { margin-top: 2px; }
#panel h3 .klein { font-family: var(--term); font-size: 17px; }
#panel h4 { font-family: var(--pix); font-size: 8px; color: var(--dim); margin: 14px 0 6px; }
#panel p { margin: 6px 0; }
.leer { color: var(--dim); font-size: 18px; } .leer.ok { color: var(--gruen); }
.sprite { image-rendering: pixelated; flex: none; }

.karte-item { display: flex; gap: 10px; align-items: center; background: var(--panel2); border: 2px solid var(--rand); padding: 8px; margin-bottom: 6px; }
.karte-item.gesperrt { opacity: .55; }
.item-info { flex: 1; min-width: 0; }
.item-info .he { font-size: 16px; color: var(--dim); }
.werte { font-size: 17px; margin: 2px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.werte .ic { transform: scale(.8); margin-right: 0; }
.item-kauf { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: none; }
.item-kauf s { font-size: 15px; color: var(--dim); }
.item-kauf small { font-size: 15px; color: var(--orange); max-width: 110px; }
.banner { padding: 6px 8px; margin-bottom: 8px; border: 2px solid; font-size: 18px; }
.banner.chance { border-color: var(--gruen); color: var(--gruen); background: rgba(61,220,132,.08); animation: blink 1.2s steps(2) infinite; }

.ausbau { background: var(--panel2); border: 2px solid var(--rand); padding: 8px; margin-bottom: 6px; transition: border-color .3s; }
.ausbau.blitz { border-color: var(--gelb); box-shadow: 0 0 0 2px var(--gelb); }
.a-kopf { display: flex; align-items: center; gap: 2px; }
.a-kopf b { flex: 1; }
.pips { display: flex; gap: 3px; }
.pip { width: 9px; height: 9px; background: #000; border: 1px solid var(--rand2); }
.pip.an { background: var(--gruen); border-color: var(--gruen); }
.a-jetzt { font-size: 18px; margin: 4px 0; }
.a-next { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 18px; }

.anfrage { background: var(--panel2); border: 2px solid var(--blau); padding: 8px; margin-bottom: 8px; }
.anfrage .a-kopf { justify-content: space-between; }
.kinfo { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 6px 0; font-size: 18px; }
.kinfo span { display: inline-flex; align-items: center; }
.kinfo .ic { transform: scale(.8); margin-right: 1px; }
.kextra { font-size: 16px; color: var(--orange); margin-bottom: 4px; }
.knoepfe-klein { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.balken { height: 8px; background: #000; border: 1px solid var(--rand2); flex: 1; min-width: 40px; }
.balken > div { height: 100%; background: var(--cyan); }
.balken.gut > div { background: var(--gruen); } .balken.mittel > div { background: var(--orange); } .balken.schlecht > div { background: var(--rot); }
.balken.zeit > div { background: var(--blau); }
.balken.klein-b { height: 6px; } .balken.klein-b > div { background: var(--gelb); }

.kliste { display: flex; flex-direction: column; gap: 3px; }
.kzeile { display: grid; grid-template-columns: 12px 1fr 90px 90px; gap: 8px; align-items: center; background: var(--panel2); padding: 4px 6px; border: 1px solid var(--rand); cursor: pointer; font-size: 18px; }
.kzeile:hover { border-color: var(--cyan); }
.kname { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kname small { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.kzufr { display: flex; align-items: center; gap: 4px; }
.kzufr small, .kpay small { font-size: 15px; }
.kpay { text-align: right; white-space: nowrap; }
.dot { width: 10px; height: 10px; display: inline-block; }
.dot.gruen { background: var(--gruen); } .dot.rot { background: var(--rot); animation: blink .6s steps(2) infinite; } .dot.orange { background: var(--orange); }

.stoer { border: 2px solid var(--rot); background: rgba(255,77,77,.06); padding: 8px; margin-bottom: 8px; }
.stoer.warn { border-color: var(--orange); background: rgba(255,162,61,.06); }
.stoer > b { display: flex; align-items: center; }
.diag { color: var(--cyan); font-family: var(--term); }
.sb-kopf { display: flex; gap: 10px; align-items: center; }
.auslast { display: grid; grid-template-columns: 120px 1fr 100px; gap: 8px; align-items: center; font-size: 18px; margin: 3px 0; }
.auslast small { text-align: right; }

/* ---------------------------------------------------------------- Ereigniskarte */
.karte { position: absolute; top: 8px; right: 8px; width: min(430px, 62%); background: rgba(16,20,28,.97); border: 3px solid var(--rot); box-shadow: 0 0 0 3px #000, 0 12px 30px rgba(0,0,0,.7); z-index: 5;
  animation: rein .25s steps(4); max-height: calc(100% - 16px); overflow-y: auto; }
@keyframes rein { from { transform: translateY(-30px); opacity: 0; } }
.karte.chance { border-color: var(--gruen); } .karte.ticket { border-color: var(--blau); } .karte.info { border-color: var(--cyan); }
.k-kopf { display: flex; align-items: center; gap: 4px; padding: 8px 10px; font-family: var(--pix); font-size: 10px; background: #2a0f14; color: var(--rot); }
.k-kopf.chance { background: #0c2a19; color: var(--gruen); } .k-kopf.ticket { background: #0c1f38; color: var(--blau); } .k-kopf.info { background: #0b2928; color: var(--cyan); }
.k-kopf span { flex: 1; }
.k-kopf em { font-style: normal; font-size: 8px; color: var(--gelb); }
.k-kopf.gefahr { animation: alarmkopf 1s steps(2) infinite; }
@keyframes alarmkopf { 50% { background: #4a121b; } }
.k-text { padding: 8px 12px 4px; font-size: 19px; }
.k-text .von { display: block; color: var(--dim); font-size: 17px; margin-bottom: 4px; }
.k-text.erg.gut { color: var(--gruen); } .k-text.erg.schlecht { color: var(--rot); } .k-text.erg.info { color: var(--text); }
.k-text .kinfo { margin-bottom: 0; }
.k-opt { display: flex; flex-direction: column; gap: 5px; padding: 8px 12px 10px; }
.btn.opt { display: flex; align-items: center; gap: 10px; text-align: left; }
.btn.opt kbd { font-family: var(--pix); font-size: 8px; color: #000; background: var(--gelb); padding: 3px 5px; flex: none; }
.btn.opt span { flex: 1; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.btn.opt small { font-size: 16px; color: var(--dim); }
.k-zeit { height: 5px; background: #000; }
.k-zeit div { height: 100%; background: var(--gelb); }

/* ---------------------------------------------------------------- Toasts */
#toasts { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 4; max-width: 46%; pointer-events: none; }
.toast { background: rgba(7,9,13,.92); border-left: 4px solid var(--cyan); padding: 5px 9px; font-size: 18px; animation: rein .2s steps(3); transition: opacity .4s; }
.toast.gut { border-color: var(--gruen); } .toast.schlecht { border-color: var(--rot); } .toast.warn { border-color: var(--orange); }
.toast.weg { opacity: 0; }

/* ---------------------------------------------------------------- Overlays */
#overlay { position: fixed; inset: 0; display: none; place-items: center; background: rgba(3,5,9,.78); z-index: 50; backdrop-filter: blur(2px); padding: 16px; }
#overlay.sichtbar { display: grid; }
.dialog { width: min(680px, 100%); max-height: 92vh; overflow-y: auto; background: var(--panel); border: 3px solid var(--gruen); box-shadow: 0 0 0 4px #000, 0 0 40px rgba(61,220,132,.15); padding: 22px 26px; }
.dialog h2 { font-family: var(--pix); font-size: 16px; text-align: center; color: var(--gelb); margin: 4px 0 16px; }
.dialog p { margin: 10px 0; }
.dialog .unter { text-align: center; font-family: var(--pix); font-size: 9px; color: var(--dim); margin-bottom: 16px; }
.dialog .knoepfe { display: flex; justify-content: center; gap: 12px; margin: 20px 0 8px; flex-wrap: wrap; }
.hilfe p { font-size: 19px; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; background: var(--panel2); border: 2px solid var(--rand); padding: 10px 14px; margin: 14px 0; }
.stats span { color: var(--dim); }

/* ---------------------------------------------------------------- Kleine Bildschirme */
@media (max-width: 1100px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  main { flex-direction: column; }
  #seite { width: 100%; border-left: none; border-top: 3px solid var(--rand); min-height: 60vh; }
  #raumTabs, #stage, #gauges, #logBox { width: 100%; }
  #logBox { min-height: 120px; max-height: 180px; }
  .karte { width: min(430px, 92%); }
}
@media (max-width: 640px) {
  #gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #hud { gap: 10px; }
  .karte { position: fixed; top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 60vh; }
}

.meldung { text-align: center; font-size: 19px; margin: 10px 0 0; padding: 6px 10px; border: 2px solid var(--rand2); }
.meldung.gut { color: var(--gruen); border-color: var(--gruen); }
.meldung.schlecht { color: #ff6b6b; border-color: #ff4d4d; }

/* Diagnose-Konsole */
.konsole { margin: 6px 0; padding: 6px 8px; background: #05080c; border: 2px solid var(--rand); font-family: var(--term); font-size: 17px; line-height: 1.1; color: #8fd9a8; max-height: 190px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.konsole .cmd { color: var(--cyan); margin-top: 3px; }
.konsole .err { color: #ff8c8c; }

/* Bank */
.btn.sel { background: #14405a; border-color: var(--cyan); color: var(--cyan); }
.banner.warnung { border-color: var(--rot); color: var(--rot); background: rgba(255,77,77,.08); animation: blink 1.2s steps(2) infinite; }
.kred-wahl { margin: 6px 0; } .kred-wahl .knoepfe-klein { margin-top: 3px; flex-wrap: wrap; }
.kred-vorschau { margin: 8px 0; padding: 8px 12px; }
.b-zeile { display: grid; grid-template-columns: 56px 1fr; gap: 0 8px; align-items: center; margin: 4px 0; }
.b-zeile small { grid-column: 2; }
.ausbau.verzug { border-color: var(--rot); }
