/* LM-Cockpit — dunkles Gerätegrau, warme Instrumentenbeleuchtung. */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: #0b0b0c;
  color: #d8d3c3;
  font-family: "Helvetica Neue", Arial, sans-serif;
  user-select: none;
}
.hidden { display: none !important; }
.mono { font-family: "Menlo", "Consolas", monospace; }

#cockpit {
  display: flex;
  height: calc(100% - 64px);
}

/* ── Fenster ─────────────────────────────────────────────────────────── */
#window-area {
  flex: 1.25;
  position: relative;
  background:
    radial-gradient(120% 90% at 30% 20%, #34343a 0%, #232327 55%, #1a1a1d 100%);
  border-right: 3px solid #101012;
  overflow: hidden;
}
#window-frame, #window {
  position: absolute;
  clip-path: polygon(10% 4%, 96% 14%, 58% 97%);
}
#window-frame {
  inset: 2.5%;
  background: #08080a;
  filter: drop-shadow(0 0 14px rgba(0,0,0,.9));
}
#window { inset: 4%; background: #000; }
#window canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#lpd { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#site-marker {
  position: absolute; color: #7fe08f; font-size: 20px; line-height: 1;
  transform: translate(-50%, -50%); text-shadow: 0 0 6px #2c5;
  pointer-events: none;
}
#window-label {
  position: absolute; left: 12px; bottom: 8px;
  font-size: 11px; letter-spacing: 2px; color: #6d6a60;
}

/* ── Panel rechts ────────────────────────────────────────────────────── */
#panel {
  width: 560px; min-width: 470px;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  background: linear-gradient(#26262a, #1c1c1f);
}
#row-instruments { display: flex; gap: 10px; justify-content: center; }
.instr { text-align: center; }
.instr-label { font-size: 10px; letter-spacing: 1.5px; color: #8c8878; margin-top: 3px; }
canvas#fdai, canvas#tapes { background: #14130f; border-radius: 8px; border: 2px solid #0c0c0d; }

/* X-Pointer */
#xpointer {
  position: relative; width: 150px; height: 220px;
  background: #14130f; border-radius: 8px; border: 2px solid #0c0c0d;
  overflow: hidden;
}
.xp-grid {
  position: absolute; inset: 10px;
  background:
    repeating-linear-gradient(0deg, transparent 0 21px, #35332b 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 14px, #35332b 14px 15px);
  opacity: .6;
}
#xp-h, #xp-v { position: absolute; background: #e8e2ce; box-shadow: 0 0 4px #000; }
#xp-h { left: 6px; right: 6px; top: 50%; height: 2px; }
#xp-v { top: 6px; bottom: 6px; left: 50%; width: 2px; }
.xp-scale { position: absolute; right: 6px; top: 4px; font-size: 10px; color: #b9b29c; }

/* Warnlampen */
#row-lamps { display: flex; gap: 8px; justify-content: center; align-items: stretch; }
.lamp {
  min-width: 62px; padding: 6px 8px;
  background: #202020; color: #4a4a44;
  border: 2px solid #101011; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-align: center; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; line-height: 1.25;
}
button.lamp { cursor: pointer; }
.lamp.on.red { background: #d3312a; color: #fff; box-shadow: 0 0 18px #d3312a; }
.lamp.on.amber { background: #e2a13a; color: #241a04; box-shadow: 0 0 14px #e2a13a; }
.lamp.on.blue { background: #3f7fd8; color: #fff; box-shadow: 0 0 18px #3f7fd8; }
.lamp.stop { background: #3a1210; color: #d3877f; border-color: #58201c; }
.lamp.stop:active, .lamp.stop.pressed { background: #d3312a; color: #fff; }

/* ── DSKY ────────────────────────────────────────────────────────────── */
#row-dsky { display: flex; gap: 10px; justify-content: center; }
#dsky {
  display: flex; gap: 8px;
  background: #303034; border: 2px solid #0e0e10; border-radius: 6px;
  padding: 8px;
}
.dsky-lamps { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; align-content: start; }
.dsky-lamp {
  width: 64px; padding: 3px 2px;
  background: #1f1f22; color: #4c4c46;
  font-size: 8px; font-weight: 700; text-align: center; line-height: 1.3;
  border-radius: 2px;
}
.dsky-lamp.on { background: #e2c33a; color: #201a02; box-shadow: 0 0 10px #e2c33a; }
.dsky-display {
  background: #101208; padding: 6px 10px; border-radius: 4px;
  display: flex; flex-direction: column; gap: 2px; min-width: 128px;
}
.dsky-cap { font-size: 8px; color: #6f7a5a; letter-spacing: 1px; display: block; }
.dsky-num, .dsky-reg {
  font-family: "Menlo", "Consolas", monospace;
  color: #7dff8a; text-shadow: 0 0 6px #35d84a;
  font-size: 20px; font-weight: 700;
}
.dsky-small { display: inline-block; }
.dsky-vn { display: flex; gap: 14px; }
.dsky-reg { border-top: 1px solid #24301c; padding-top: 1px; letter-spacing: 2px; }
.dsky-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-content: center; }
.dsky-keys button {
  background: #444448; color: #e8e4d8; border: 1px solid #1c1c1e;
  border-radius: 3px; font-size: 9px; font-weight: 700; padding: 7px 6px; cursor: pointer;
}
.dsky-keys button:active { background: #2c2c30; }

#side-status { display: flex; flex-direction: column; gap: 8px; justify-content: center; min-width: 150px; }
.stat { display: flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 1px; color: #9b9683; }
.stat > span:first-child { width: 46px; }
.bar { flex: 1; height: 9px; background: #101011; border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; width: 50%; background: #7dc46a; transition: width .2s; }
#prop-bar.low { background: #e2a13a; }
#prop-bar.crit { background: #d3312a; }
#tgo-txt, #mode-txt { font-size: 13px; color: #d8d3c3; }

/* ── Untere Leiste ───────────────────────────────────────────────────── */
#bottombar {
  height: 64px; display: flex; gap: 16px; align-items: center;
  background: #131315; border-top: 2px solid #060607;
  padding: 4px 14px;
}
#commlog {
  flex: 1; height: 100%; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  font-family: "Menlo", "Consolas", monospace; font-size: 11px; color: #86b98a;
}
#commlog div { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
#commlog div.you { color: #d8d3c3; }
#keyhelp { font-size: 10px; color: #77746a; max-width: 460px; line-height: 1.6; }
#keyhelp b { color: #a5a091; }

/* ── Overlays ────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(4,4,6,.82);
  display: flex; align-items: center; justify-content: center;
}
.card {
  width: min(680px, 92vw); max-height: 92vh; overflow: auto;
  background: #1b1b1f; border: 1px solid #333338; border-radius: 12px;
  padding: 28px 32px;
}
.card h1 { font-size: 34px; letter-spacing: 10px; color: #e8e4d8; }
.card .sub { color: #8c8878; margin: 4px 0 18px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.mode-btn {
  text-align: left; padding: 12px 14px; cursor: pointer;
  background: #26262b; color: #d8d3c3; border: 1px solid #3a3a40; border-radius: 8px;
}
.mode-btn b { display: block; font-size: 15px; margin-bottom: 3px; }
.mode-btn span { font-size: 11px; color: #8c8878; line-height: 1.4; display: block; }
.mode-btn:hover:not(.disabled) { background: #33333a; border-color: #55555e; }
.mode-btn.disabled { opacity: .45; cursor: default; }
.chk { display: block; font-size: 12px; color: #a5a091; margin: 6px 0; cursor: pointer; }
.hint { font-size: 11px; color: #77746a; line-height: 1.55; margin-top: 14px; }

#db-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
#db-table td { padding: 5px 8px; border-bottom: 1px solid #2b2b30; }
#db-table td:last-child { text-align: right; font-family: "Menlo", monospace; }
#db-verdict { font-size: 13px; color: #b9b29c; line-height: 1.5; margin-top: 8px; }

#crashflash {
  position: fixed; inset: 0; z-index: 15; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,60,30,.55), rgba(120,10,5,.85));
  animation: flash .6s ease-out;
}
@keyframes flash { from { opacity: 1; } to { opacity: .75; } }

@media (max-width: 1150px) {
  #panel { width: 470px; }
  #keyhelp { display: none; }
}
