:root {
  color-scheme: dark;
  --bg: #04070d;
  --bg-soft: #07111e;
  --panel: rgba(4, 12, 22, 0.88);
  --panel-hot: rgba(13, 28, 42, 0.96);
  --cyan: #35f2ff;
  --cyan-soft: rgba(53, 242, 255, 0.19);
  --green: #5aff91;
  --amber: #ffb547;
  --red: #ff365f;
  --text: #dff8ff;
  --muted: #8195a9;
  --grid: rgba(53, 242, 255, 0.08);
  --shadow: 0 0 36px rgba(53, 242, 255, 0.1), inset 0 0 28px rgba(53, 242, 255, 0.04);
  --font: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: radial-gradient(circle at 20% 0%, rgba(25, 97, 128, 0.22), transparent 36%),
    radial-gradient(circle at 84% 12%, rgba(255, 54, 95, 0.12), transparent 30%),
    linear-gradient(135deg, #02050a 0%, #06101b 50%, #02050a 100%);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.noise-layer,
.scanline-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.noise-layer {
  opacity: 0.07;
  background-image: linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 13px 17px;
  mix-blend-mode: screen;
}

.scanline-layer {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.035),
    rgba(255,255,255,0.035) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.16;
}

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 3, 8, 0.96);
  transition: opacity 420ms ease, visibility 420ms ease;
}

.boot-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.boot-card {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid rgba(53, 242, 255, 0.35);
  background: linear-gradient(180deg, rgba(6, 20, 33, 0.96), rgba(2, 8, 14, 0.96));
  box-shadow: 0 0 70px rgba(53, 242, 255, 0.12);
  padding: 28px;
}

.boot-title {
  color: var(--cyan);
  letter-spacing: 0.22em;
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.boot-lines {
  min-height: 240px;
  color: #b9f8ff;
  line-height: 1.72;
  text-shadow: 0 0 10px rgba(53, 242, 255, 0.5);
}

.enter-button,
.audio-button,
.command-ribbon button {
  border: 1px solid rgba(53, 242, 255, 0.36);
  background: rgba(53, 242, 255, 0.07);
  color: var(--cyan);
  padding: 11px 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 0 14px rgba(53, 242, 255, 0.06);
}

.enter-button {
  margin-top: 22px;
  width: 100%;
  display: none;
}

.enter-button.ready {
  display: block;
}

.enter-button:hover,
.audio-button:hover,
.command-ribbon button:hover {
  background: rgba(53, 242, 255, 0.16);
}

.deck-shell {
  width: min(1640px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0;
}

.deck-header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 18px;
  border: 1px solid rgba(53, 242, 255, 0.23);
  background: linear-gradient(90deg, rgba(4, 13, 24, 0.92), rgba(8, 25, 39, 0.78));
  padding: 18px;
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--muted);
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 3rem);
  letter-spacing: 0.14em;
  color: #f1fcff;
  text-shadow: 0 0 18px rgba(53, 242, 255, 0.34);
}

.header-metrics {
  display: grid;
  grid-template-columns: minmax(160px, 230px) minmax(120px, 170px) auto;
  gap: 12px;
  align-items: stretch;
}

.metric-card {
  border: 1px solid rgba(53, 242, 255, 0.2);
  background: rgba(1, 9, 17, 0.72);
  padding: 12px;
  min-width: 0;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}

.metric-card strong {
  display: block;
  color: var(--cyan);
  font-size: 1.05rem;
  margin-top: 5px;
}

.bar {
  height: 8px;
  margin-top: 9px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 63%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
  box-shadow: 0 0 10px rgba(53, 242, 255, 0.42);
  transition: width 300ms ease;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(420px, 1fr) minmax(320px, 440px);
  gap: 16px;
  min-height: calc(100vh - 150px);
}

.panel {
  position: relative;
  border: 1px solid rgba(53, 242, 255, 0.22);
  background: linear-gradient(180deg, var(--panel), rgba(2, 7, 13, 0.94));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.6;
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(53, 242, 255, 0.18);
  background: rgba(53, 242, 255, 0.055);
}

.panel-header h2 {
  margin: 0;
  color: var(--cyan);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.file-list {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.file-row {
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.22);
  padding: 11px 10px;
  display: grid;
  grid-template-columns: 11px 1fr;
  gap: 9px;
  align-items: start;
  color: var(--text);
  text-align: left;
  width: 100%;
}

.file-row:hover,
.file-row.active {
  border-color: rgba(53, 242, 255, 0.48);
  background: rgba(53, 242, 255, 0.08);
}

.file-row .status-light,
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
}

.green {
  color: var(--green);
  background: var(--green);
}

.amber {
  color: var(--amber);
  background: var(--amber);
}

.red {
  color: var(--red);
  background: var(--red);
}

.file-name {
  font-size: 0.9rem;
  color: #f2fbff;
  overflow-wrap: anywhere;
}

.file-meta {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.68rem;
}

.panel-note {
  margin: 12px 10px;
  border-top: 1px solid rgba(53, 242, 255, 0.18);
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.panel-note p {
  color: var(--text);
  margin-bottom: 4px;
}

.waveform {
  width: calc(100% - 24px);
  height: 92px;
  display: block;
  margin: 12px;
  border: 1px solid rgba(53, 242, 255, 0.16);
  background: rgba(0, 0, 0, 0.22);
}

.bio-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 12px 12px;
}

.bio-strip div {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.18);
  padding: 9px;
  min-width: 0;
}

.bio-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

.bio-strip strong {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-output {
  height: calc(100vh - 384px);
  min-height: 410px;
  overflow-y: auto;
  padding: 10px 18px 24px;
  line-height: 1.78;
  scrollbar-color: rgba(53, 242, 255, 0.45) rgba(255,255,255,0.06);
}

.telemetry-output p {
  margin: 0 0 14px;
}

.system-line {
  color: var(--cyan);
}

.bio-line {
  color: var(--amber);
  border-left: 2px solid rgba(255, 181, 71, 0.55);
  padding-left: 10px;
  text-shadow: 0 0 10px rgba(255, 181, 71, 0.22);
}

.warning-line {
  color: var(--red);
  border-left: 2px solid rgba(255, 54, 95, 0.75);
  padding-left: 10px;
  text-shadow: 0 0 12px rgba(255, 54, 95, 0.3);
}

.corrupt {
  color: #f4fbff;
  text-shadow: 0 0 8px rgba(53, 242, 255, 0.55);
}

.terminal-panel {
  display: flex;
  flex-direction: column;
}

.terminal-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  line-height: 1.55;
  scrollbar-color: rgba(53, 242, 255, 0.45) rgba(255,255,255,0.06);
}

.terminal-entry {
  margin-bottom: 10px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.terminal-entry.command {
  color: #f1fcff;
}

.terminal-entry.success {
  color: var(--green);
}

.terminal-entry.error {
  color: var(--red);
}

.terminal-entry.warn {
  color: var(--amber);
}

.terminal-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(53, 242, 255, 0.18);
  padding: 12px 14px;
  background: rgba(0,0,0,0.24);
}

.terminal-form label {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.terminal-form span {
  color: var(--cyan);
}

.terminal-form input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--cyan);
  letter-spacing: 0.03em;
}

.terminal-form input::placeholder {
  color: rgba(129, 149, 169, 0.8);
}

.command-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(53, 242, 255, 0.12);
}

.command-ribbon button {
  padding: 8px 9px;
  font-size: 0.68rem;
}

body.degauss {
  animation: deckShake 430ms steps(2, end);
}

body.degauss .panel,
body.degauss .deck-header {
  border-color: rgba(255, 54, 95, 0.7);
  box-shadow: 0 0 52px rgba(255, 54, 95, 0.18), inset 0 0 24px rgba(255, 54, 95, 0.08);
}

@keyframes deckShake {
  0% { transform: translate(0, 0); }
  12% { transform: translate(8px, -5px); }
  24% { transform: translate(-7px, 5px); }
  36% { transform: translate(5px, 6px); }
  48% { transform: translate(-8px, -4px); }
  60% { transform: translate(6px, 3px); }
  72% { transform: translate(-5px, 4px); }
  100% { transform: translate(0, 0); }
}

@media (max-width: 1180px) {
  .dashboard-grid {
    grid-template-columns: 300px 1fr;
  }

  .terminal-panel {
    grid-column: 1 / -1;
    min-height: 360px;
  }

  .telemetry-output {
    height: 480px;
  }
}

@media (max-width: 820px) {
  .deck-shell {
    width: min(100vw - 16px, 740px);
    padding-top: 8px;
  }

  .deck-header,
  .dashboard-grid,
  .header-metrics,
  .bio-strip {
    grid-template-columns: 1fr;
  }

  .deck-header {
    display: grid;
  }

  h1 {
    font-size: 1.55rem;
  }

  .dashboard-grid {
    min-height: 0;
  }

  .telemetry-output {
    height: 440px;
    min-height: 320px;
  }

  .terminal-panel {
    min-height: 430px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
