/* InnoKosmos Z9001 – Browser-Fassung */
:root {
  --bg: #0b0b0c;
  --panel: #151517;
  --line: #2a2a2e;
  --text: #ddd9d0;
  --muted: #9b968c;
  --accent: #4aa3ff;
  --beige: #cfc6b0;
  --phos: #ebebe1;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
.page { max-width: 1120px; margin: 0 auto; padding: calc(52px + env(safe-area-inset-top, 0px)) 16px 24px; }

.head { text-align: center; margin: 0 0 14px; }
.head h1 { margin: 0; font: 800 clamp(24px, 4.2vw, 38px)/1.1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }
.h-inno { color: var(--beige); }
.h-duum { color: var(--accent); }
.h-z { color: var(--muted); font-weight: 600; font-size: .7em; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Bildschirm ---------- */
.stage { position: relative; }
.monitor {
  margin: 0 auto;
  width: min(100%, calc((100svh - 250px) * 4 / 3 + 52px));
  min-width: 280px;
  padding: 22px 26px 10px;
  border-radius: 22px;
  background: linear-gradient(160deg, #2c2b29, #1b1a19 60%, #141313);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.tube {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 14px / 18px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .9), 0 0 0 3px #0d0d0d;
}
#screen { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; outline: none; cursor: default; touch-action: none; }
.crt #screen { filter: blur(.35px) brightness(1.12) contrast(1.05); }
.scan { position: absolute; inset: 0; pointer-events: none; display: none; }
.crt .scan {
  display: block;
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, .45) 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .32) 55%, rgba(0, 0, 0, .32) 100%);
  background-size: 100% 100%, 100% calc(100% / 192);
}
.start-hint {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%);
  padding: 10px 18px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
  background: rgba(10, 10, 10, .78); color: #fff; font: 600 15px/1.2 system-ui, sans-serif; cursor: pointer;
}
.start-hint[hidden] { display: none; }
.badge-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 4px 0; color: #7d786e; font: 600 11px/1 ui-monospace, monospace; letter-spacing: .3em; }
.led { width: 8px; height: 8px; border-radius: 50%; background: #3a0b06; box-shadow: inset 0 0 2px #000; }
.led.on { background: #ff3b1f; box-shadow: 0 0 8px #ff3b1f; }

/* ---------- Leiste ---------- */
.bar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px auto 0; }
.bar button, .vkbd button, .tb {
  font: 600 13px/1 system-ui, sans-serif; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.bar button:hover { border-color: #4a4a50; }
.bar button[aria-pressed="true"] { border-color: var(--accent); color: #fff; }
.bar button:focus-visible, .vkbd button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vol { display: inline-flex; align-items: center; padding: 0 4px; }
.vol input { width: 90px; accent-color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Z9001-Tastatur ---------- */
.vkbd { max-width: 640px; margin: 12px auto 0; padding: 8px; border-radius: 12px; background: #1d1c1a; border: 1px solid #2f2d2a; }
.vkbd[hidden] { display: none; }
.vrow { display: flex; gap: 5px; justify-content: center; margin: 5px 0; }
.vkbd button { flex: 1 1 0; min-width: 0; max-width: 56px; padding: 12px 0; background: #2b2a28; border-color: #3a3835; font-family: ui-monospace, monospace; touch-action: manipulation; }
.vkbd button.w2 { max-width: 90px; flex-grow: 2; font-size: 11px; }
.vkbd button.w4 { max-width: 200px; flex-grow: 4; }
.vkbd button.down, .tb.down { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Touch ---------- */
.touch[hidden] { display: none; }
.touch { display: flex; justify-content: space-between; align-items: center; gap: 14px; max-width: 760px; margin: 12px auto 0; touch-action: none; -webkit-user-select: none; user-select: none; }
.tpad { position: relative; width: 168px; height: 168px; border-radius: 50%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); flex: none; touch-action: none; }
.ta { position: absolute; color: rgba(255, 255, 255, .45); font-size: 18px; line-height: 1; }
.ta.up { top: 10px; left: 50%; transform: translateX(-50%); }
.ta.down { bottom: 10px; left: 50%; transform: translateX(-50%); }
.ta.left { left: 12px; top: 50%; transform: translateY(-50%); }
.ta.right { right: 12px; top: 50%; transform: translateY(-50%); }
.tknob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); pointer-events: none; }
.tbtns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; flex: 1 1 auto; min-width: 0; max-width: 340px; }
.tb { padding: 12px 2px; font-size: 11px; background: rgba(30, 30, 32, .9); touch-action: none; min-width: 0; overflow: hidden; }
.tb-fire { grid-column: span 4; font-size: 15px; padding: 18px 2px; border-color: rgba(74, 163, 255, .7); }
.tb-use { grid-column: span 2; font-size: 13px; padding: 20px 2px; }
.tb.on { border-color: var(--accent); color: #fff; }

/* Handy quer mit Touch: Bildschirm füllt die Höhe, Bedienung an den Seiten */
@media (orientation: landscape) and (max-height: 560px) {
  body.touch-on .page { padding: 0; max-width: none; }
  body.touch-on .head, body.touch-on .info, body.touch-on .credits, body.touch-on .s05-footer { display: none; }
  body.touch-on .stage { position: fixed; inset: 0; z-index: 50; background: #000; }
  body.touch-on .monitor { width: calc(100svh * 4 / 3); height: 100svh; padding: 0; border-radius: 0; background: #000; box-shadow: none; min-width: 0; }
  body.touch-on .tube { border-radius: 0; height: 100%; }
  body.touch-on .badge-row { display: none; }
  body.touch-on .touch { position: absolute; inset: 0; margin: 0; max-width: none; pointer-events: none; padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px)); }
  body.touch-on .tpad { pointer-events: auto; width: min(150px, 34svh + 40px, calc((100vw - 100svh * 4 / 3) / 2 - 12px)); height: min(150px, 34svh + 40px, calc((100vw - 100svh * 4 / 3) / 2 - 12px)); margin-top: 22svh; background: rgba(255, 255, 255, .07); }
  body.touch-on .tbtns { pointer-events: auto; flex: none; width: calc((100vw - 100svh * 4 / 3) / 2 - 14px); min-width: 120px; max-width: 220px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12svh; }
  body.touch-on .tb { padding: 9px 2px; font-size: 11px; background: rgba(30, 30, 32, .75); }
  body.touch-on .tb-fire { grid-column: span 2; grid-row: span 1; padding: 14px 2px; }
  body.touch-on .tbtns { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 4svh; }
  body.touch-on .tb { padding: 7px 2px; }
  body.touch-on .bar { position: absolute; top: calc(4px + env(safe-area-inset-top, 0px)); right: max(6px, env(safe-area-inset-right, 0px)); margin: 0; z-index: 3; gap: 4px; flex-wrap: nowrap; }
  body.touch-on .bar .lbl { display: none; }
  body.touch-on .bar > :not(#bKbd):not(#bFull):not(#bTouch) { display: none; }
  body.touch-on .bar button { padding: 7px 8px; font-size: 11px; background: rgba(21, 21, 23, .8); }
  body.touch-on .vkbd { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(640px, 100vw); margin: 0; z-index: 4; background: rgba(29, 28, 26, .94); }
  body.touch-on .vkbd button { padding: 9px 0; }
}

/* ---------- Infos ---------- */
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-top: 26px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.card h2 { margin: 0 0 10px; font: 700 17px/1.2 ui-monospace, Consolas, monospace; color: var(--beige); }
.card p { margin: 0 0 10px; }
.small { font-size: 13px; color: var(--muted); }
.keys { border-collapse: collapse; width: 100%; font-size: 14px; }
.keys td { padding: 3px 0; vertical-align: top; }
.keys td:first-child { padding-right: 10px; white-space: nowrap; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; border: 1px solid #45433e; border-bottom-width: 2px; border-radius: 4px; background: #222120; font: 600 12px/1.4 ui-monospace, monospace; text-align: center; color: #eee; }
code { font: 13px ui-monospace, monospace; background: #222120; padding: 1px 4px; border-radius: 3px; }
.dots { margin: 0; padding-left: 18px; }
.dots li { margin: 3px 0; }
.dl { list-style: none; margin: 0 0 10px; padding: 0; }
.dl li { margin: 6px 0; }
.dl a { color: #fff; font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--accent); }
.dl a:hover { color: var(--accent); }
.dl span { display: block; font-size: 13px; color: var(--muted); }
.credits { text-align: center; color: #6f6a62; font-size: 12px; margin: 22px 0 6px; }

/* Vollbild */
.stage:fullscreen { background: #000; display: flex; flex-direction: column; justify-content: center; }
.stage:fullscreen .monitor { width: min(100vw, calc((100vh - 60px) * 4 / 3)); padding: 0; background: #000; box-shadow: none; }
.stage:fullscreen .tube { border-radius: 0; }
.stage:fullscreen .badge-row { display: none; }

@media (max-width: 520px) {
  .page { padding-left: 10px; padding-right: 10px; }
  .monitor { padding: 12px 12px 6px; border-radius: 14px; }
  .bar button { padding: 8px 8px; font-size: 12px; }
  .vol input { width: 70px; }
  .tpad { width: 140px; height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Kommandanten-Dateien */
.files .dl li { display: flex; align-items: center; gap: 8px; }
.files .dl li a { font-family: ui-monospace, monospace; }
.fdel { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 2px 7px; cursor: pointer; }
.fdel:hover { color: #fff; border-color: var(--accent); }
.files input[type=file] { display: block; margin-top: 6px; color: var(--muted); max-width: 100%; }

/* ---------- Transit: Touch-Bedienung ---------- */
.tbtns.tleft { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 230px; }
.tbtns.tright { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tb-steer { grid-column: span 2; font-size: 24px; padding: 26px 2px; }
.tb-gas { grid-column: span 2; font-size: 15px; padding: 24px 2px; border-color: rgba(120, 220, 120, .7); }
.tb-brake { grid-column: span 2; font-size: 13px; padding: 24px 2px; border-color: rgba(255, 110, 90, .7); }
@media (orientation: landscape) and (max-height: 560px) {
  body.touch-on .tbtns.tleft, body.touch-on .tbtns.tright { pointer-events: auto; flex: none; width: calc((100vw - 100svh * 4 / 3) / 2 - 14px); min-width: 110px; max-width: 220px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 6svh; }
  body.touch-on .tb-steer { grid-column: span 1; padding: 30svh 2px 6svh; font-size: 22px; }
  body.touch-on .tb-gas { grid-column: span 2; padding: 9svh 2px; }
  body.touch-on .tb-brake { grid-column: span 2; padding: 5svh 2px; }
  body.touch-on .tleft .tb-sm { padding: 6px 2px; }
}
/* ---------- Online zu zweit ---------- */
#netz .netrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
#netz .netjoin { display: inline-flex; gap: 6px; }
#netz .netbtn { background: #2b2a28; border: 1px solid var(--line); color: #fff; border-radius: 8px; padding: 8px 12px; cursor: pointer; font: inherit; }
#netz .netbtn:hover { border-color: var(--accent); }
#netz input { width: 6.5em; text-transform: uppercase; letter-spacing: .2em; background: #111; color: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 700 15px ui-monospace, monospace; }
#netz .netcode { font: 700 28px/1.2 ui-monospace, monospace; letter-spacing: .25em; color: var(--beige); margin: 4px 0; }
#netz .netcode:empty { display: none; }
#netz[data-phase="verbunden"] { border-color: rgba(120, 220, 120, .6); }

/* ---------- Kicker: Steuerkreuz und Knoepfe ---------- */
.tpad.cross { border-radius: 50%; }
.tpad.cross .ta { font-size: 20px; color: rgba(255, 255, 255, .5); }
.tbtns .tb-big { grid-column: span 2; font-size: 14px; padding: 16px 2px; font-weight: 600; line-height: 1.15; }
.tbtns .tb-big.tb-fire { border-color: rgba(120, 220, 120, .75); padding: 20px 2px; }
.tbtns .tb-sm { grid-column: span 1; font-size: 11px; padding: 10px 2px; }
@media (orientation: landscape) and (max-height: 560px) {
  body.touch-on .tbtns .tb-big { grid-column: span 2; padding: 4svh 2px; font-size: 12px; }
  body.touch-on .tbtns .tb-big.tb-fire { padding: 6svh 2px; }
  body.touch-on .tbtns .tb-sm { grid-column: span 1; padding: 7px 2px; font-size: 10px; }
}
