/* ==========================================================================
   THE PRECISION INSTRUMENT — DESIGN SYSTEM REV 4.1
   Vintage Analog Hardware / Utilitarian Synthesis / Mechanical UI Physics
   ========================================================================== */

:root {
  /* Chassis & Housing */
  --casing-bg: #d4ccbd;
  --casing-rim: #b8af9e;
  --casing-highlight: #ece6da;
  --chassis-border: #1e1e1e;

  /* Display Wells (Recessed Charcoal) */
  --display-well: #131517;
  --display-inner: #0f1012;
  --display-bezel: #24272a;
  --display-border: #1a1a1a;

  /* Typography */
  --text-readout: #eee7db;
  --text-muted: #8e877c;
  --text-casing: #262624;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "Space Mono", "Consolas", monospace;

  /* Accents */
  --accent-blue: #4a6b82;
  --accent-coral: #d95f47;
  --accent-amber: #d49b3d;

  /* Status Indicators */
  --led-green: #3cd070;
  --led-amber: #e5a93c;
  --led-red: #e04f43;
  --led-off: #2e3831;
}

/* Reset & Mechanical Rigidity */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: none !important;
  animation: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden; /* Prevent window bouncing or page scrolling on mobile */
  position: fixed;
  inset: 0;
}

body {
  background-color: #212325;
  background-image: 
    radial-gradient(#2d3034 1px, transparent 1px),
    linear-gradient(to bottom, #1d1f21, #18191b);
  background-size: 20px 20px, 100% 100%;
  color: var(--text-casing);
  font-family: var(--font-mono);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 12px;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   OPERATOR IDENTIFICATION MODAL
   ========================================================================== */
.operator-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 15, 17, 0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.operator-modal-housing {
  width: 100%;
  max-width: 440px;
  background: var(--casing-bg);
  border: 4px solid var(--chassis-border);
  border-radius: 8px;
  box-shadow: 
    0 16px 0 #0d0e0f,
    0 24px 36px rgba(0,0,0,0.85),
    inset 1px 1px 0 var(--casing-highlight),
    inset -2px -2px 0 var(--casing-rim);
  padding: 24px 20px;
  position: relative;
}

.modal-screw {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #a39c8e;
  border: 1px solid #1a1a1a;
  border-radius: 50%;
}
.modal-screw.screw-tl { top: 6px; left: 6px; }
.modal-screw.screw-tr { top: 6px; right: 6px; }
.modal-screw.screw-bl { bottom: 6px; left: 6px; }
.modal-screw.screw-br { bottom: 6px; right: 6px; }

.modal-header {
  border-bottom: 2px solid var(--chassis-border);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #1a1a1a;
  text-transform: uppercase;
}

.modal-sub {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #555148;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #242422;
}

.modal-input-well {
  background: var(--display-inner);
  border: 2px solid var(--chassis-border);
  border-radius: 4px;
  padding: 8px 12px;
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.8);
}

.modal-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-readout);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.modal-input::placeholder {
  color: #5a5f67;
  font-size: 0.85rem;
}

.modal-btn {
  width: 100%;
  padding: 10px;
  font-size: 0.85rem;
}

/* ==========================================================================
   CHASSIS (MAIN CASING)
   ========================================================================== */
.instrument-rack {
  width: 100%;
  max-width: 1200px;
  height: 100%;
  max-height: 940px;
  background-color: var(--casing-bg);
  border: 4px solid var(--chassis-border);
  border-radius: 8px;
  box-shadow:
    0 12px 0 #0d0e0f,
    0 24px 32px rgba(0, 0, 0, 0.7),
    inset 1px 1px 0 var(--casing-highlight),
    inset -2px -2px 0 var(--casing-rim);
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chassis-screw {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #a39c8e;
  border: 1px solid #1a1a1a;
  border-radius: 50%;
  box-shadow: inset 1px 1px 1px rgba(255,255,255,0.4), inset -1px -1px 1px rgba(0,0,0,0.6);
}
.chassis-screw::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 2px;
  width: 6px;
  height: 1px;
  background: #2b2b2b;
}
.screw-tl { top: 8px; left: 8px; }
.screw-tr { top: 8px; right: 8px; }
.screw-bl { bottom: 8px; left: 8px; }
.screw-br { bottom: 8px; right: 8px; }

/* ==========================================================================
   TOP BAR / HEADER PANEL
   ========================================================================== */
.header-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--chassis-border);
  padding-bottom: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.header-left-cluster, .header-right-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.model-plate {
  display: flex;
  flex-direction: column;
}

.model-title {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #1a1a1a;
}

.model-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #555148;
}

.patch-bay {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--display-inner);
  border: 2px solid var(--chassis-border);
  border-radius: 4px;
  padding: 3px 6px;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.9);
}

.patch-label {
  color: var(--accent-amber);
  font-size: 0.7rem;
  font-weight: 800;
}

.patch-input {
  background: transparent;
  border: none;
  color: var(--text-readout);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  width: 82px;
  outline: none;
}

.operator-badge-btn {
  font-size: 0.7rem;
  padding: 5px 8px;
  background: #2a2d31;
  color: var(--accent-amber);
}

.telemetry-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--casing-rim);
  border: 2px solid var(--chassis-border);
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.3);
}

.led-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hardware-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #111;
  background: var(--led-off);
}
.hardware-led.active-green {
  background: var(--led-green);
  box-shadow: 0 0 5px var(--led-green);
}
.hardware-led.active-amber {
  background: var(--led-amber);
  box-shadow: 0 0 5px var(--led-amber);
}
.hardware-led.active-red {
  background: var(--led-red);
  box-shadow: 0 0 5px var(--led-red);
}

.led-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #2b2b28;
}

/* ==========================================================================
   MECHANICAL SWITCHES (TACTILE DEPRESSION PHYSICS)
   ========================================================================== */
.btn-mech {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 2px solid var(--chassis-border);
  cursor: pointer;
  user-select: none;
  background: var(--casing-rim);
  color: #1a1a1a;
  box-shadow: 0 3px 0 var(--chassis-border);
  transform: translateY(0);
}

.btn-mech:hover {
  filter: brightness(1.05);
}

.btn-mech:active, .btn-mech.is-depressed {
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 var(--chassis-border) !important;
}

.btn-mech-blue {
  background: var(--accent-blue);
  color: #fff;
  border-color: #15222d;
  box-shadow: 0 3px 0 #15222d;
}
.btn-mech-blue:active, .btn-mech-blue.is-depressed {
  box-shadow: 0 1px 0 #15222d !important;
}

.btn-mech-coral {
  background: var(--accent-coral);
  color: #fff;
  border-color: #2b110b;
  box-shadow: 0 3px 0 #2b110b;
}
.btn-mech-coral:active, .btn-mech-coral.is-depressed {
  box-shadow: 0 1px 0 #2b110b !important;
}

.btn-mech-close-room {
  padding: 3px 7px;
  font-size: 0.72rem;
  font-weight: 900;
  background: #2b2e32;
  color: #e04f43;
  border: 2px solid var(--chassis-border);
  border-radius: 4px;
  box-shadow: 0 2px 0 var(--chassis-border);
  line-height: 1;
}
.btn-mech-close-room:hover {
  background: #3c4046;
  color: #ff6b5e;
}
.btn-mech-close-room:active {
  transform: translateY(2px) !important;
  box-shadow: 0 0 0 var(--chassis-border) !important;
}

.btn-mech-dark {
  background: #2c2f33;
  color: var(--text-readout);
  border-color: #111;
  box-shadow: 0 3px 0 #111;
}
.btn-mech-dark:active, .btn-mech-dark.is-depressed {
  box-shadow: 0 1px 0 #111 !important;
}

/* ==========================================================================
   FEED LOADER PANEL
   ========================================================================== */
.feed-loader-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--casing-rim);
  border: 2px solid var(--chassis-border);
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 10px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.feed-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.feed-input-well {
  flex: 1;
  background: var(--display-inner);
  border: 2px solid var(--chassis-border);
  border-radius: 3px;
  padding: 5px 8px;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
}

.feed-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-readout);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}
.feed-input::placeholder {
  color: #5d6168;
}

/* ==========================================================================
   WORKSPACE GRID (SCOPE DISPLAY + TELETYPE DECK)
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ==========================================================================
   PRIMARY SCOPE (VIDEO DISPLAY BEZEL)
   ========================================================================== */
.scope-housing {
  background: var(--display-well);
  border: 3px solid var(--chassis-border);
  border-radius: 6px;
  padding: 8px;
  box-shadow: 
    inset 4px 4px 10px rgba(0,0,0,0.9),
    inset -2px -2px 4px rgba(255,255,255,0.06),
    0 4px 0 var(--chassis-border);
  display: flex;
  flex-direction: column;
}

.scope-header-readout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--display-bezel);
  font-size: 0.68rem;
  gap: 8px;
  flex-shrink: 0;
}

#scopeFeedId {
  color: var(--accent-amber);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 45%;
}

.hardware-ticker {
  color: #3cd070;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

.video-screen-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 200px;
  background: #000;
  border: 2px solid #000;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 16px rgba(0,0,0,0.9);
}

.video-screen-wrapper iframe,
.video-screen-wrapper #player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   PRECISION ANALOG SCRUBBER
   Mechanical recessed timeline well with amber/green position needle
   ========================================================================== */
.analog-scrubber-well {
  position: relative;
  width: 100%;
  margin: 6px 0 2px 0;
  padding: 5px 0;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

.scrubber-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--display-inner);
  border: 1px solid #282c31;
  border-radius: 4px;
  overflow: visible;
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.95);
}

.scrubber-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #996c22, #e5a93c);
  border-radius: 3px 0 0 3px;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(229, 169, 60, 0.4);
}

.scrubber-needle {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 16px;
  background: #3cd070;
  border: 1px solid #141618;
  border-radius: 2px;
  box-shadow: 
    0 0 5px rgba(60, 208, 112, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 2;
}

.scrubber-tooltip {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #111315;
  color: #3cd070;
  border: 1px solid #2b3036;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.analog-scrubber-well:hover .scrubber-tooltip,
.analog-scrubber-well.is-dragging .scrubber-tooltip {
  opacity: 1;
}

/* Scope Controls Rack (Below Video) */
.scope-control-strip {
  margin-top: 8px;
  background: #191c1f;
  border: 2px solid #282c30;
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.transport-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-gauge {
  background: #0c0d0f;
  border: 2px solid #26292d;
  padding: 4px 8px;
  border-radius: 3px;
  box-shadow: inset 1px 1px 4px rgba(0,0,0,0.9);
  color: var(--text-readout);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-gauge .dim-text {
  color: #666055;
}

/* ==========================================================================
   COMMUNICATIONS DECK (TELETYPE CHAT)
   ========================================================================== */
.comms-housing {
  background: var(--display-well);
  border: 3px solid var(--chassis-border);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 
    inset 4px 4px 10px rgba(0,0,0,0.9),
    inset -2px -2px 4px rgba(255,255,255,0.06),
    0 4px 0 var(--chassis-border);
  overflow: hidden;
}

.comms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--display-bezel);
  gap: 8px;
  flex-shrink: 0;
}

.comms-title {
  color: var(--text-readout);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.active-callsign-tag {
  color: var(--accent-amber);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.teletype-screen {
  flex: 1;
  background: var(--display-inner);
  border: 2px solid #202428;
  border-radius: 4px;
  padding: 8px;
  overflow-y: auto;
  box-shadow: inset 2px 2px 6px rgba(0,0,0,0.95);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-readout);
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: #333 #111;
}

.teletype-line {
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
}

.teletype-meta {
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  margin-bottom: 1px;
}

.meta-time {
  color: #555b63;
}

.meta-sender-self {
  color: #589bcf;
  font-weight: 800;
}

.meta-sender-peer {
  color: #d95f47;
  font-weight: 800;
}

.teletype-body {
  color: var(--text-readout);
  padding-left: 2px;
}

.comms-input-bay {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-shrink: 0;
}

.comms-input {
  flex: 1;
  background: var(--display-inner);
  border: 2px solid var(--chassis-border);
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--text-readout);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  outline: none;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.8);
}
.comms-textarea {
  resize: none;
  min-height: 38px;
  max-height: 60px;
  height: 38px;
  line-height: 1.3;
  padding: 8px 10px;
  box-sizing: border-box;
}
.comms-input::placeholder {
  color: #494e55;
}

/* ==========================================================================
   DESKTOP UNMUTE BADGE & AUDIO CONTROLS
   ========================================================================== */
.unmute-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 16, 19, 0.92);
  backdrop-filter: blur(6px);
  border: 2px solid var(--accent-amber);
  border-radius: 4px;
  padding: 8px 16px;
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.8), 0 0 10px rgba(212, 143, 56, 0.3);
  animation: badge-glow 1.5s infinite alternate;
  user-select: none;
}
.unmute-badge:hover {
  background: rgba(24, 28, 33, 0.98);
  color: #fff;
  border-color: #ffd166;
}
.unmute-icon {
  font-size: 0.95rem;
}
.unmute-text {
  text-transform: uppercase;
}

@keyframes badge-glow {
  from { box-shadow: 0 4px 16px rgba(0,0,0,0.8), 0 0 6px rgba(212, 143, 56, 0.2); }
  to { box-shadow: 0 4px 16px rgba(0,0,0,0.8), 0 0 16px rgba(212, 143, 56, 0.6); }
}

/* ==========================================================================
   DYNAMIC 1:1 MERGED ACTION BUTTON (MIC / SEND)
   ========================================================================== */
.btn-mech-action {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  border: 2px solid var(--chassis-border);
  box-shadow: 0 3px 0 var(--chassis-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn-mech-action .action-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  pointer-events: none;
  transition: transform 0.15s ease;
}

/* MIC STATE (Default when typing box is empty) */
.btn-mech-action.is-mic {
  background: var(--display-inner);
  border-color: var(--chassis-border);
  color: var(--accent-amber);
  box-shadow: 0 3px 0 var(--chassis-border);
}
.btn-mech-action.is-mic .icon-mic {
  display: block;
}
.btn-mech-action.is-mic .icon-send {
  display: none;
}
.btn-mech-action.is-mic:hover {
  filter: brightness(1.15);
  color: #fff;
}
.btn-mech-action.is-mic.is-recording {
  background: #d93838 !important;
  color: #fff !important;
  border-color: #5c1414 !important;
  box-shadow: 0 0 14px rgba(217, 56, 56, 0.9), 0 1px 0 #5c1414 !important;
  transform: translateY(2px) !important;
  animation: pulse-mic 0.7s infinite alternate !important;
}

/* SEND STATE (Active when user types any character) */
.btn-mech-action.is-send {
  background: var(--accent-coral);
  border-color: #2b110b;
  color: #fff;
  box-shadow: 0 3px 0 #2b110b;
}
.btn-mech-action.is-send .icon-mic {
  display: none;
}
.btn-mech-action.is-send .icon-send {
  display: block;
  transform: translate(1px, -1px);
}
.btn-mech-action.is-send:hover {
  filter: brightness(1.1);
}
.btn-mech-action.is-send:active,
.btn-mech-action.is-send.is-depressed {
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 #2b110b !important;
}

@keyframes pulse-mic {
  from { filter: brightness(1); }
  to { filter: brightness(1.35); }
}

/* ==========================================================================
   PARTNER LIVE RECORDING NOTIFICATION STRIP
   ========================================================================== */
.teletype-recording-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 6px 0;
  background: rgba(30, 22, 16, 0.88);
  border: 1px dashed var(--accent-amber);
  border-radius: 4px;
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: inset 1px 1px 4px rgba(0,0,0,0.8);
  animation: rec-strip-glow 1.2s infinite alternate;
  user-select: none;
}

.rec-strip-sender {
  color: #ff9e42;
  font-weight: 800;
}

.rec-strip-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rec-waveform {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  padding: 0 2px;
}
.rec-waveform span {
  display: inline-block;
  width: 3px;
  background: var(--accent-amber);
  border-radius: 1px;
  animation: wave-bounce 0.8s infinite ease-in-out;
}
.rec-waveform span:nth-child(1) { height: 4px; animation-delay: 0s; }
.rec-waveform span:nth-child(2) { height: 10px; animation-delay: 0.2s; }
.rec-waveform span:nth-child(3) { height: 6px; animation-delay: 0.4s; }
.rec-waveform span:nth-child(4) { height: 12px; animation-delay: 0.15s; }

.rec-cursor {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent-coral);
  animation: rec-blink 0.7s infinite;
}

@keyframes wave-bounce {
  0%, 100% { height: 3px; }
  50% { height: 12px; }
}

@keyframes rec-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes rec-strip-glow {
  from { box-shadow: 0 0 4px rgba(212, 143, 56, 0.2); }
  to { box-shadow: 0 0 10px rgba(212, 143, 56, 0.6); }
}

/* ==========================================================================
   TELETYPE VOICE MESSAGE TAPE CASSETTE
   ========================================================================== */
.teletype-voice-tape {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #14171a;
  border: 1px solid #2e343b;
  border-radius: 4px;
  padding: 6px 12px;
  margin-top: 4px;
  cursor: pointer;
  user-select: none;
  max-width: 270px;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.8);
  transition: background 0.15s, border-color 0.15s;
}

.teletype-voice-tape:hover {
  background: #1c2126;
  border-color: var(--accent-amber);
}

.voice-play-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #252b33;
  border: 1px solid #3d4550;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--accent-amber);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.teletype-voice-tape.is-playing .voice-play-icon {
  background: var(--accent-coral);
  border-color: #fff;
  color: #fff;
  box-shadow: 0 0 8px rgba(217, 95, 71, 0.6);
}

.voice-meta {
  display: flex;
  flex-direction: column;
}

.voice-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-readout);
}

.voice-duration {
  font-size: 0.62rem;
  color: #727a85;
  font-family: var(--font-mono);
}

/* ==========================================================================
   FOOTER CHASSIS DETAILS & STATUS STRIP
   ========================================================================== */
.footer-panel {
  margin-top: 10px;
  border-top: 2px solid var(--chassis-border);
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #4a473f;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.footer-serial {
  text-transform: uppercase;
}

.footer-clock {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   MOBILE ARCHITECTURE: DUAL PANE (VIDEO PERMANENTLY AT TOP + CHAT BELOW)
   ========================================================================== */
@media (max-width: 768px) {
  html, body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body {
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
  }

  .chassis-screw {
    display: none;
  }

  .instrument-rack {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Compact Header on Mobile */
  .header-panel {
    padding-bottom: 2px;
    margin-bottom: 3px;
    border-bottom-width: 2px;
    flex-wrap: nowrap;
    gap: 4px;
    flex-shrink: 0;
  }

  .model-plate {
    display: none;
  }

  .header-left-cluster {
    flex: 1;
    gap: 4px;
  }

  .patch-bay {
    padding: 2px 4px;
    gap: 3px;
  }

  .patch-input {
    width: 58px;
    font-size: 0.70rem;
  }

  .btn-mech-close-room {
    padding: 2px 5px !important;
    font-size: 0.62rem !important;
  }

  .header-right-cluster {
    gap: 4px;
  }

  .operator-badge-btn {
    padding: 2px 5px;
    font-size: 0.65rem;
  }

  .telemetry-cluster {
    padding: 2px 5px;
    gap: 5px;
  }

  .led-label {
    font-size: 0.58rem;
  }

  /* Compact Feed Loader on Mobile */
  .feed-loader-strip {
    padding: 2px 4px;
    margin-bottom: 3px;
    border-width: 2px;
    gap: 4px;
    flex-shrink: 0;
  }

  .feed-label {
    display: none;
  }

  .feed-input-well {
    padding: 3px 6px;
  }

  .feed-input {
    font-size: 0.72rem;
  }

  /* Vertical Layout on Mobile */
  .workspace-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 4px;
    overflow: hidden;
  }

  /* Video scope is FIXED at top, NEVER scrolls away */
  .scope-housing {
    flex-shrink: 0;
    padding: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
    margin-left: -4px !important;
    margin-right: -4px !important;
    width: calc(100% + 8px) !important;
  }

  .scope-header-readout {
    padding: 2px 4px;
    margin-bottom: 2px;
    font-size: 0.62rem;
  }

  /* Stable full-width 16:9 video screen without black pillarboxes */
  .video-screen-wrapper {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: none !important;
    padding-top: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important;
  }

  .scope-control-strip {
    margin-top: 3px;
    padding: 3px 4px;
    flex-shrink: 0;
  }

  .transport-buttons {
    gap: 2px;
  }

  .btn-mech {
    padding: 4px 6px;
    font-size: 0.68rem;
  }

  .time-gauge {
    padding: 2px 4px;
    font-size: 0.68rem;
  }

  /* Scrubber mobile sizing */
  .analog-scrubber-well {
    margin: 3px 0 1px 0;
    padding: 6px 0;
  }
  .scrubber-track {
    height: 7px;
  }
  .scrubber-needle {
    width: 10px;
    height: 16px;
  }

  /* Communications deck takes remaining height */
  .comms-housing {
    flex: 1;
    min-height: 0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    border-width: 2px;
    overflow: hidden;
  }

  .comms-header {
    padding-bottom: 2px;
    margin-bottom: 2px;
    flex-shrink: 0;
  }

  .comms-title {
    font-size: 0.68rem;
  }

  .teletype-screen {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    font-size: 0.72rem;
  }

  .comms-input-bay {
    flex-shrink: 0;
    margin-top: 4px;
    padding-bottom: 1px;
    display: flex;
    gap: 4px;
  }

  .comms-textarea {
    min-height: 36px;
    height: 36px;
    padding: 6px 8px;
    font-size: 0.74rem;
  }

  .footer-panel {
    display: none;
  }

  /* ==========================================================================
     TYPING MODE: ACTIVATED WHEN USER TYPES IN COMMS DECK
     Hides non-essential controls so both VIDEO and CHAT fit cleanly on screen
     ========================================================================== */
  body.typing-mode .header-panel,
  body.typing-mode .feed-loader-strip,
  body.typing-mode .scope-control-strip,
  body.typing-mode .analog-scrubber-well,
  body.typing-mode .scope-header-readout,
  body.typing-mode .comms-header,
  body.typing-mode .footer-panel {
    display: none !important;
  }

  body.typing-mode .workspace-grid {
    gap: 2px !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  body.typing-mode .scope-housing {
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    border-width: 0 0 2px 0 !important;
  }

  body.typing-mode .video-screen-wrapper {
    width: 100% !important;
    height: 155px !important;
    max-height: 155px !important;
    aspect-ratio: auto !important;
  }

  body.typing-mode .comms-housing {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    padding: 2px 4px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body.typing-mode .teletype-screen {
    flex: 1 1 0% !important;
    min-height: 40px !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  body.typing-mode .comms-input-bay {
    flex: 0 0 auto !important;
    margin-top: 2px !important;
    padding-bottom: 2px !important;
  }
}
