/* DIEPXD Gear Control Terminal Stylesheet - v0.6 */

:root {
  color-scheme: dark;
  --bg: #07080a;
  --ink: #f4f0e7;
  --soft: #d6d2c8;
  --muted: #979b9e;
  --faint: #5f676d;
  --line: rgba(244, 240, 231, 0.12);
  --line-strong: rgba(244, 240, 231, 0.23);
  --panel: rgba(15, 17, 20, 0.72);
  --panel-strong: rgba(22, 25, 29, 0.92);
  
  /* Cyber Tech Highlights */
  --acid: #ff7a1a;
  --acid-soft: #ffb36d;
  --cyan: #00e5ff;
  --cyan-soft: #80f2ff;
  --gold: #ffb300;
  
  --shadow: rgba(0, 0, 0, 0.45);
  
  /* Typography */
  --display: "Space Grotesk", "Pretendard Variable", Pretendard, "Segoe UI", sans-serif;
  --sans: "Pretendard Variable", Pretendard, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    linear-gradient(90deg, rgba(244, 240, 231, 0.015) 1px, transparent 1px),
    linear-gradient(rgba(244, 240, 231, 0.015) 1px, transparent 1px),
    linear-gradient(135deg, rgba(0, 229, 255, 0.04), transparent 520px),
    linear-gradient(225deg, rgba(255, 122, 26, 0.02), transparent 560px),
    #07080a;
  background-size: 64px 64px, 64px 64px, auto, auto, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(244, 240, 231, 0.04);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Shell Layout */
.terminal-shell {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 30px;
  width: min(1440px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 0;
}

/* Side Rail */
.side-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 24px 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
}

.side-rail .mark {
  font-weight: 700;
  font-family: var(--display);
  font-size: 20px;
  color: var(--cyan);
  margin-bottom: 24px;
}

.side-rail span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-transform: uppercase;
  color: var(--faint);
  letter-spacing: 2px;
  cursor: pointer;
  transition: color 150ms ease;
}

.side-rail span:hover,
.side-rail span.active {
  color: var(--cyan);
}

/* Workspace */
.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  gap: 20px;
}

.topbar .kicker {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.topbar h1 {
  margin: 4px 0 0 0;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -1px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border: 1px solid var(--line);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 160ms ease;
}

.tab-btn:hover {
  color: var(--ink);
  background: rgba(244, 240, 231, 0.05);
}

.tab-btn.active {
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.1);
  font-weight: 500;
  border-bottom: 2px solid var(--cyan);
}

.tab-btn.highlight:hover {
  background: rgba(255, 179, 0, 0.05);
}

.tab-btn.highlight.active {
  color: var(--gold);
  background: rgba(255, 179, 0, 0.1);
  border-bottom-color: var(--gold);
}

.session-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--mono);
  font-size: 11px;
  min-width: 90px;
}

.session-state span {
  color: var(--faint);
  text-transform: uppercase;
}

.session-state strong.ok {
  color: var(--cyan);
  font-size: 15px;
}

/* Metrics Strip */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  min-height: 80px;
}

.metric {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 20, 0.45);
  animation: fadeLift 350ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.metric span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.metric strong {
  display: block;
  font-size: 20px;
  font-family: var(--mono);
  color: var(--ink);
  font-weight: 600;
}

.metric strong.ok {
  color: var(--cyan);
}

.metric em {
  display: block;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
}

.metric em.ok {
  color: rgba(0, 229, 255, 0.85);
}

/* Viewport Stage and Tabs */
.viewport-stage {
  min-height: 480px;
  display: grid;
}

.tab-content {
  display: none;
  animation: tabReveal 300ms ease;
}

.tab-content.active {
  display: grid;
}

/* Generic Panel styles */
.panel {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  text-transform: uppercase;
}

.panel-head h2 {
  margin: 2px 0 0 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
}

.panel-head.compact {
  padding: 10px 16px;
}

.panel-head .table-note {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  background: rgba(244, 240, 231, 0.05);
  border: 1px solid var(--line);
}

.panel-head .table-note.ok {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.04);
}

.panel-head .table-note.error {
  color: #ff5252;
  border-color: rgba(255, 82, 82, 0.35);
  background: rgba(255, 82, 82, 0.04);
}

/* ==========================================
   TAB 1: ELECTRONICS & DANAWA CONFIGURATOR
   ========================================== */
.electronics-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 18px;
}

.search-bar input {
  background: #0d0f12;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 12px;
  outline: none;
  width: 220px;
  transition: border-color 150ms ease;
}

.search-bar input:focus {
  border-color: var(--cyan);
}

.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 150ms ease;
}

.filter-btn:hover {
  color: var(--ink);
  background: rgba(244, 240, 231, 0.03);
}

.filter-btn.active {
  background: rgba(0, 229, 255, 0.06);
  border-color: var(--cyan);
  color: var(--cyan);
}

.inventory-list {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  height: 520px;
  overflow-y: auto;
}

.inventory-card {
  border: 1px solid var(--line);
  background: rgba(244, 240, 231, 0.015);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 160ms ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.inventory-card:hover {
  background: rgba(0, 229, 255, 0.04);
  border-color: rgba(0, 229, 255, 0.35);
}

.inventory-card.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--cyan);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.category-badge {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
  background: rgba(244, 240, 231, 0.05);
  padding: 2px 4px;
}

.power-badge {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gold);
}

.inventory-card h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.25;
}

.inventory-card p {
  margin: 0 0 8px 0;
  font-size: 11px;
  color: var(--muted);
}

.card-price-tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  text-align: right;
  border-top: 1px dashed rgba(244, 240, 231, 0.05);
  padding-top: 4px;
}

/* Danawa Table styles */
.danawa-stage {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

.danawa-table {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.table-row-head,
.table-row-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 110px 42px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.table-row-head {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  background: rgba(244, 240, 231, 0.02);
}

.table-row-item .category {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.table-row-item .name {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-row-item .price {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--faint);
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms ease;
}

.btn-clear:hover {
  color: #ff5252;
}

.danawa-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 179, 0, 0.05);
  border: 1px solid rgba(255, 179, 0, 0.25);
  font-family: var(--display);
  font-size: 16px;
}

.gold-text {
  color: var(--gold);
  font-weight: 700;
  font-family: var(--mono);
}

.schematic-viewer-compact {
  height: 150px;
  background: 
    radial-gradient(circle, rgba(244, 240, 231, 0.02) 1px, transparent 1px),
    #0c0e12;
  background-size: 12px 12px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.chassis-diagram-expanded {
  width: 95%;
  height: 95%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}

.sch-part {
  border: 1px dashed var(--line);
  background: rgba(244, 240, 231, 0.015);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
  transition: all 250ms ease;
  user-select: none;
}

.sch-part.active {
  border-style: solid;
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.05);
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.15);
}

.sch-part.cpu { grid-column: 3; grid-row: 1 / 3; }
.sch-part.cooler { grid-column: 1 / 3; grid-row: 1; }
.sch-part.ram { grid-column: 4; grid-row: 1 / 3; }
.sch-part.gpu { grid-column: 1 / 4; grid-row: 3; }
.sch-part.psu { grid-column: 4; grid-row: 3; }
.sch-part.motherboard { grid-column: 1 / 3; grid-row: 2; }


/* ==========================================
   TAB 2: DESK SETUP PLANNER & SPACING FIX
   ========================================== */
.desk-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.desk-canvas-expanded {
  background: 
    radial-gradient(circle, rgba(0, 229, 255, 0.02) 1px, transparent 1px),
    #0a0b0e;
  background-size: 16px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 36px 24px;
  flex-grow: 1;
  min-height: 400px;
}

.desk-surface-proportional {
  width: 88%;
  height: 250px;
  border: 2px solid var(--line-strong);
  background: #2c1e14; /* Walnut */
  border-radius: 8px;
  position: relative;
  box-shadow: 0 20px 50px var(--shadow);
  transition: all 450ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Desk Blueprint Elements Base */
.desk-element {
  position: absolute;
  transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.desk-element.active,
.desk-element.on-desk {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Always Visible Essential Elements Override */
.monitors-proportional,
.pc-tower-proportional.on-desk,
.keyboard-proportional,
.mouse {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: scale(1) !important;
}

.keyboard-proportional {
  transform: translateX(-50%) scale(1) !important;
}

.monitors-proportional {
  transform: translateX(-50%) scale(1) !important;
}


/* Studio Speakers */
.speaker {
  width: 28px;
  height: 28px;
  background: #1a1c23;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speaker .spk-cone {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  background: #090a0d;
  display: block;
}

.speaker.active {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
}

.speaker.active .spk-cone {
  border-color: var(--cyan);
  animation: spkPulse 1.5s ease-in-out infinite alternate;
}

/* Audio DAC / Stack */
.audio-stack {
  width: 42px;
  height: 26px;
  background: #181c24;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  bottom: 35px;
  left: 22%; /* Positioned to the left of the keyboard */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 3px;
}

.audio-stack.active {
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.1);
}

.audio-stack .led-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  position: absolute;
  top: 4px;
  right: 4px;
}

.audio-stack .label {
  font-family: var(--mono);
  font-size: 7px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

/* Keyboard styling */
.keyboard-proportional .keys {
  display: block;
  width: 80%;
  height: 60%;
  background: repeating-linear-gradient(90deg, rgba(244, 240, 231, 0.1) 0px, rgba(244, 240, 231, 0.1) 2px, transparent 2px, transparent 6px);
}

/* Mouse */
.mouse {
  width: 14px;
  height: 24px;
  background: #14161c;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  bottom: 39px;
  left: calc(50% + 56px); /* Positioned to the right of the keyboard */
}

.mouse.wireless {
  border-color: var(--cyan);
}

.mouse .wheel {
  width: 2px;
  height: 6px;
  background: var(--cyan);
  border-radius: 1px;
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

/* Pegboard Decor */
.pegboard {
  width: 90%;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--line) 0px, var(--line) 4px, transparent 4px, transparent 12px);
  border: 1px solid var(--line-strong);
  top: -3px;
  left: 5%;
  opacity: 0;
  transition: opacity 300ms ease;
}

.pegboard.active {
  opacity: 0.6;
}

/* Desk Plant */
.desk-plant {
  top: 20px;
  left: 100px;
  font-size: 16px;
  line-height: 1;
  z-index: 2;
  transition: all 400ms ease;
}

/* Monitor Screen inner grid spacing */
.monitor-screen {
  height: 10px;
  background: #111215;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1px;
  transition: all 300ms ease;
}

.monitor-screen.main-screen {
  width: 150px;
  border-color: var(--cyan);
}

.monitor-screen.side-screen {
  width: 75px;
  display: none;
}

.monitor-screen.side-screen.active {
  display: flex;
  border-color: var(--gold);
}

.monitors-proportional.dual .monitor-screen.side-screen {
  display: flex;
}

.monitors-proportional.triple .monitor-screen.side-screen {
  display: flex;
  width: 75px;
}

.monitor-screen .screen-content {
  font-family: var(--mono);
  font-size: 7px;
  color: var(--muted);
  white-space: nowrap;
}

/* Proportional elements spacing */
.monitors-proportional {
  width: 290px;
  height: 12px;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pc-tower-proportional {
  width: 36px;
  height: 80px;
  background: #15181e;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  opacity: 0;
  transform: translateY(20px);
}

.pc-tower-proportional.on-desk {
  top: 20px;
  right: 32px;
  opacity: 1;
  transform: translateY(0);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
}

.keyboard-proportional {
  width: 90px;
  height: 32px;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #181a20;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 4px;
  display: flex;
  align-items: center;
}

.keyboard-proportional.hhkb {
  width: 80px;
  border-color: var(--cyan);
}

.keyboard-proportional.split {
  width: 100px;
  border-color: var(--gold);
  clip-path: polygon(0 0, 48% 0, 50% 10%, 52% 0, 100% 0, 100% 100%, 0 100%);
}

.keyboard-proportional.full-size {
  width: 136px;
  border-color: var(--faint);
}

/* Adjust layout positions of speakers to look roomy */
.speaker.speaker-left {
  left: 45px !important;
  right: auto !important;
}
.speaker.speaker-right {
  right: 45px !important;
  left: auto !important;
}


/* Desk Plant spacing */
.desk-plant {
  top: 25px;
  left: 110px;
  font-size: 16px;
}


/* ==========================================
   TAB 3: AUDIO & SIGNALS (INTERACTIVE KNOWLEDGE DB)
   ========================================== */
.audio-decoder-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 18px;
}

.audio-left-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Roadmap Stage */
.roadmap-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

.step-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(244, 240, 231, 0.015);
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.step-card:hover {
  background: rgba(0, 229, 255, 0.03);
  border-color: var(--line-strong);
}

.step-card.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
}

.step-card .step-num {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
  transition: color 200ms ease, text-shadow 200ms ease;
}

.step-card.active .step-num {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.step-card .step-meta {
  display: flex;
  flex-direction: column;
}

.step-card .step-meta strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}

.step-card .step-meta span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Selector Menu & Chips */
.decoder-menu {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu-section h3 {
  margin: 0 0 8px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 8px 6px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 160ms ease;
  outline: none;
}

.chip:hover {
  color: var(--ink);
  background: rgba(244, 240, 231, 0.03);
  border-color: var(--line-strong);
}

.chip.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
}

/* Details Panel Stage */
.decoder-details-stage {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

.spec-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spec-highlight {
  font-size: 15px;
  color: var(--cyan);
  font-weight: 600;
  line-height: 1.4;
}

.spec-text {
  margin: 0;
  font-size: 13px;
  color: var(--soft);
  line-height: 1.5;
}

.spec-double-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.text-ok {
  color: var(--cyan-soft) !important;
}

.text-warn {
  color: var(--acid-soft) !important;
}

/* Spectrum Analyzer */
.audio-spectrum-box {
  height: 80px;
  background: 
    radial-gradient(circle, rgba(244, 240, 231, 0.015) 1px, transparent 1px),
    #0c0e12;
  background-size: 12px 12px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  margin-top: auto;
}

.spectrum-analyzer-mini {
  width: 100%;
  height: 100%;
}

.spectrum-bars {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.spectrum-bars .bar {
  width: 6%;
  height: var(--h, 20%);
  background: var(--cyan);
  opacity: 0.85;
  transform-origin: bottom;
  animation: spectrumPulse 1.2s ease-in-out infinite alternate;
}

.spectrum-bars .bar:nth-child(2n) {
  background: var(--gold);
  animation-delay: 0.15s;
}

.spectrum-bars .bar:nth-child(3n) {
  animation-delay: 0.3s;
}

.spectrum-bars .bar:nth-child(4n) {
  animation-delay: 0.45s;
}



/* ==========================================
   TAB 4: 3D COZY ROOM VIEWPORT STYLING
   ========================================== */
.three-stage-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 0;
  background: #0a0b0e;
  border: 1px solid var(--line);
}

.three-canvas-panel {
  position: relative;
  height: 520px;
  background: #090a0d;
}

#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Loading overlay */
.three-loading {
  position: absolute;
  inset: 0;
  background: rgba(7, 8, 10, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
}

.loader-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: fanSpin 1s linear infinite;
}

.three-loading span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
}

/* Controls Panel */
.three-controls-panel {
  border: none;
  border-left: 1px solid var(--line);
  background: rgba(15, 17, 20, 0.4);
}

.three-controls {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.color-picker-grid {
  display: flex;
  gap: 10px;
}

.color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}

.color-btn:hover {
  transform: scale(1.15);
}

.color-btn.active {
  border-color: var(--ink);
  transform: scale(1.1);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--soft);
}

/* Keyframe Animations */
@keyframes fanSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spkPulse {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.08); opacity: 1; }
}

@keyframes spectrumPulse {
  0% { transform: scaleY(0.35); }
  100% { transform: scaleY(1); }
}

@keyframes tabReveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeLift {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsiveness */
@media (max-width: 980px) {
  .terminal-shell {
    grid-template-columns: 1fr;
    width: min(100% - 24px, 1220px);
    padding-top: 24px;
  }

  .side-rail {
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-left: none;
    border-right: none;
  }

  .side-rail .mark {
    margin-bottom: 0;
  }

  .side-rail span {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .electronics-grid,
  .desk-grid,
  .audio-decoder-grid,
  .three-stage-grid {
    grid-template-columns: 1fr;
  }
  
  .three-controls-panel {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .session-state {
    align-items: flex-start;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .inventory-list {
    grid-template-columns: 1fr;
  }

  .chip-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-row-head,
  .table-row-item {
    grid-template-columns: 80px minmax(0, 1fr) 90px 30px;
    font-size: 11px;
  }
}
