/* Cockpit HUD bridge terminal — ASCII crest · glass panel · inside the 3D windshield */

.hud-bridge-terminal {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 48px));
  max-height: 34vh;
  z-index: 48;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #c8e6ff;
  background:
    linear-gradient(180deg, rgba(6, 6, 14, 0.15) 0%, rgba(6, 6, 14, 0.88) 28%, rgba(3, 3, 8, 0.96) 100%);
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow:
    0 -12px 48px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(110, 200, 255, 0.12),
    0 0 40px rgba(110, 200, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}

.hud-bridge-terminal::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(110, 200, 255, 0.025) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
  z-index: 0;
}

.hbt-frame-top,
.hbt-frame-bot {
  position: relative;
  z-index: 1;
  padding: 4px 12px;
  letter-spacing: 0.12em;
  font-size: 9px;
  color: rgba(212, 175, 55, 0.85);
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
  white-space: pre;
  overflow: hidden;
  user-select: none;
}

.hbt-frame-top {
  border-bottom: 1px solid rgba(110, 200, 255, 0.12);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.08), transparent 40%, rgba(110, 200, 255, 0.06));
}

.hbt-crest {
  position: relative;
  z-index: 1;
  max-height: 72px;
  overflow: hidden;
  padding: 2px 10px 0;
  opacity: 0.92;
}

.hbt-crest pre {
  margin: 0;
  font-size: 5px;
  line-height: 1.05;
  color: rgba(110, 200, 255, 0.75);
  text-shadow: 0 0 6px rgba(110, 200, 255, 0.35);
  white-space: pre;
}

.hbt-crest.collapsed {
  max-height: 0;
  padding: 0;
  opacity: 0;
}

.hbt-log {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 88px;
  max-height: 18vh;
  overflow-y: auto;
  padding: 6px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.hbt-log .ln { margin: 0; }
.hbt-log .ln.sys { color: rgba(212, 175, 55, 0.9); }
.hbt-log .ln.cmd { color: #6ec8ff; }
.hbt-log .ln.ritual { color: rgba(255, 215, 0, 0.85); font-style: italic; }
.hbt-log .ln.err { color: #ff6b8a; }

.hbt-input-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(0, 0, 0, 0.35);
}

.hbt-prompt {
  color: #d4af37;
  font-weight: 600;
  flex-shrink: 0;
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
}

.hbt-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #6ec8ff;
  font: inherit;
  caret-color: #ffd700;
}

.hbt-shell-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.hbt-shell-tabs button {
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(12, 16, 32, 0.6);
  color: rgba(139, 155, 180, 0.9);
  font: 600 8px/1 'Orbitron', sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.hbt-shell-tabs button.active {
  color: #d4af37;
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.12);
}

.hbt-toggle-crest {
  position: absolute;
  top: 6px;
  right: 10px;
  z-index: 2;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(139, 155, 180, 0.8);
  font-size: 8px;
  cursor: pointer;
}

/* Cockpit embed — arena owns the terminal; parent shell stays clean */
body.cockpit-embed .hud-bridge-terminal {
  bottom: 8px;
  border-radius: 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.28);
}

body.cockpit-embed.hud-min #telemetryHUD,
body.cockpit-embed.hud-min #daily-streak-mount,
body.cockpit-embed.hud-min #nationBadge,
body.cockpit-embed.hud-min #rivalHUD,
body.cockpit-embed.hud-min #loadoutChip,
body.cockpit-embed.hud-min #masteryChip,
body.cockpit-embed.hud-min #oodaStrip,
body.cockpit-embed.hud-min #rankBadge,
body.cockpit-embed.hud-min #fpsChip,
body.cockpit-embed.hud-min #contractChip,
body.cockpit-embed.hud-min #walletChip,
body.cockpit-embed.hud-min #comboHud {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.cockpit-parent-integrated #term {
  display: none !important;
}

body.cockpit-parent-integrated #cockpit {
  grid-template-rows: 48px 1fr 0;
  grid-template-areas:
    "hud hud hud"
    "arena arena arena"
    "arena arena arena";
}

body.cockpit-parent-integrated #rail,
body.cockpit-parent-integrated #tv,
body.cockpit-parent-integrated #ledger,
body.cockpit-parent-integrated #bladerunner-gauges {
  display: none !important;
}

body.cockpit-parent-integrated #hud .stats {
  display: none !important;
}

@media (max-width: 768px) {
  .hud-bridge-terminal {
    width: calc(100vw - 16px);
    max-height: 38vh;
  }
  .hbt-crest { display: none; }
}
