:root {
  /* Typography source: Playfair Display" (Google Fonts), Source Serif 4" (Google Fonts) */
  --amber: #CC6600;
  --charcoal: #1C1A17;
  --cream: #F5F0E8;
  --copper: #B8733D;
  --sage: #7A8C6E;
  --warm-gray: #A89B8C;
  --glass: rgba(204, 102, 0, 0.08);
  --panel: rgba(28, 26, 23, 0.75);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overflow: hidden; }

body {
  background: var(--charcoal);
  color: var(--cream);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  line-height: 1.65;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(245, 240, 232, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245, 240, 232, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 70% 25%, rgba(204, 102, 0, 0.2), transparent 34%),
    radial-gradient(circle at 18% 82%, rgba(184, 115, 61, 0.18), transparent 32%),
    var(--charcoal);
  background-size: 32px 32px, 32px 32px, auto, auto, auto;
  pointer-events: none;
}

.console-shell { position: fixed; inset: 0; overflow: hidden; padding: 72px 24px 24px 88px; }

.top-bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid rgba(204, 102, 0, 0.3);
  background: rgba(28, 26, 23, 0.72);
  backdrop-filter: blur(20px) saturate(1.1);
  z-index: 10;
}

.wordmark {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--cream);
  text-transform: lowercase;
  line-height: 1;
}

.wordmark span { display: inline-block; min-width: 0.54em; color: var(--amber); animation: glyphSettle 0.6s var(--spring) both; }
.wordmark span:nth-child(2) { animation-delay: 0.05s; }
.wordmark span:nth-child(3) { animation-delay: 0.1s; }
.wordmark span:nth-child(4) { animation-delay: 0.15s; }
.wordmark span:nth-child(5) { animation-delay: 0.2s; }
.wordmark span:nth-child(6) { animation-delay: 0.25s; }
.wordmark span:nth-child(7) { animation-delay: 0.3s; }
.wordmark span:nth-child(8) { animation-delay: 0.35s; }
.wordmark span:nth-child(9) { animation-delay: 0.4s; }
.wordmark span:nth-child(10) { animation-delay: 0.45s; }
.wordmark span:nth-child(11) { animation-delay: 0.5s; }
.wordmark span:nth-child(12) { animation-delay: 0.55s; }
.wordmark em { color: var(--warm-gray); font-style: normal; font-size: 0.72em; }

.status-cluster { display: flex; gap: 12px; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 4px rgba(204, 102, 0, 0.3); animation: lampPulse 2.5s ease-in-out infinite; }
.status-dot:nth-child(2) { animation-delay: 0.8s; background: var(--copper); }
.status-dot:nth-child(3) { animation-delay: 1.6s; }
.status-dot.sage { background: var(--sage); box-shadow: 0 0 8px rgba(122, 140, 110, 0.55); }

.shape-nav { position: fixed; left: 0; top: 48px; bottom: 0; width: 64px; border-right: 1px solid rgba(204, 102, 0, 0.22); background: rgba(28, 26, 23, 0.62); backdrop-filter: blur(16px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; z-index: 8; }
.shape-button { position: relative; width: 56px; height: 56px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; opacity: 0; transform: translateX(-20px) scale(0.5); animation: navEnter 0.5s var(--spring) forwards; }
.shape-button:nth-child(2) { animation-delay: 0.12s; }
.shape-button:nth-child(3) { animation-delay: 0.24s; }
.shape-button:nth-child(4) { animation-delay: 0.36s; }
.shape-button::after { content: attr(data-label); position: absolute; left: 54px; top: 50%; transform: translateY(-50%) scaleX(0); transform-origin: left; color: var(--warm-gray); font-family: "DM Mono", monospace; font-size: 0.62rem; letter-spacing: 0.12em; background: rgba(28, 26, 23, 0.86); border: 1px solid rgba(184, 115, 61, 0.25); padding: 3px 8px; opacity: 0; transition: 0.25s ease-out; }
.shape-button:hover::after { opacity: 1; transform: translateY(-50%) scaleX(1); }
.shape { display: block; transition: 0.3s var(--spring); }
.circle-shape { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--amber); }
.triangle-shape { width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 32px solid transparent; filter: drop-shadow(0 0 0 var(--amber)); position: relative; }
.triangle-shape::before { content: ""; position: absolute; left: -18px; top: 2px; width: 36px; height: 31px; background: var(--charcoal); clip-path: polygon(50% 8%, 0 100%, 100% 100%); border: 1px solid var(--amber); }
.square-shape { width: 40px; height: 40px; border: 1px solid var(--amber); border-radius: 4px; transform: rotate(45deg); }
.hex-shape { width: 50px; height: 44px; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: linear-gradient(var(--charcoal), var(--charcoal)) padding-box, linear-gradient(135deg, var(--amber), var(--copper)) border-box; border: 1px solid transparent; }
.shape-button.active .circle-shape, .shape-button.active .square-shape { background: var(--amber); box-shadow: 0 0 16px rgba(204, 102, 0, 0.7); animation: lampPulse 2.5s ease-in-out infinite; }
.shape-button.active .triangle-shape::before { background: var(--amber); box-shadow: 0 0 16px rgba(204, 102, 0, 0.7); }
.shape-button.active .hex-shape { background: radial-gradient(circle, var(--amber), var(--copper) 54%, rgba(204, 102, 0, 0.2)); box-shadow: 0 0 16px rgba(204, 102, 0, 0.7); }

.hud-grid { height: 100%; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 24px; position: relative; z-index: 2; }
.instrument-card { position: relative; min-height: 0; overflow: auto; padding: 34px; border-radius: 12px; border: 1px solid rgba(184, 115, 61, 0.25); background: linear-gradient(rgba(204, 102, 0, 0.08), rgba(204, 102, 0, 0.08)), rgba(28, 26, 23, 0.75); backdrop-filter: blur(20px) saturate(1.1); box-shadow: inset 0 1px 0 rgba(245, 240, 232, 0.08), 0 8px 32px rgba(0, 0, 0, 0.4); opacity: 0; transform: translateY(30px) scale(0.85); animation: panelEnter 0.5s var(--spring) 0.65s forwards; transition: opacity 0.3s ease-out, transform 0.3s ease-out, border-color 0.3s ease-out; }
.instrument-card:nth-child(n+2) { animation-delay: 0.85s; }
.instrument-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--amber), var(--copper), transparent); border-radius: 12px 12px 0 0; }
.quadrant-a { margin-right: -8px; margin-bottom: -8px; }
.quadrant-b { margin-left: -8px; margin-bottom: -8px; }
.quadrant-c { margin-right: -8px; margin-top: -8px; }
.quadrant-d { margin-left: -8px; margin-top: -8px; }
.instrument-card.dimmed { opacity: 0.4 !important; transform: scale(0.95) !important; }
.instrument-card.active { opacity: 1; border-color: rgba(204, 102, 0, 0.52); }
.instrument-card.bounce { animation: panelSwitch 0.5s var(--spring) forwards; }
.panel-screw { position: absolute; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--cream), var(--warm-gray) 38%, var(--charcoal) 70%); opacity: 0.75; }
.panel-screw.left { left: 16px; } .panel-screw.right { right: 16px; }
.panel-kicker { font-family: "DM Mono", monospace; color: var(--warm-gray); font-size: clamp(0.72rem, 1vw, 0.86rem); letter-spacing: 0.12em; margin-bottom: 14px; }
h1, h2 { font-family: "Playfair Display", Georgia, serif; font-weight: 700; font-size: clamp(1.5rem, 3.5vw, 2.8rem); line-height: 1.02; letter-spacing: 0.04em; margin: 0 0 18px; color: var(--cream); }
p { margin: 0; color: var(--warm-gray); max-width: 64ch; }
.nixie-line { display: flex; gap: 8px; margin-top: 26px; }
.nixie-line span, .status-readouts strong, .tick-tape b { font-family: "DM Mono", monospace; letter-spacing: 0.12em; color: var(--amber); text-shadow: 0 0 12px rgba(204, 102, 0, 0.72); }
.nixie-line span { min-width: 38px; text-align: center; padding: 8px 10px; border-radius: 8px; background: rgba(204, 102, 0, 0.12); border: 1px solid rgba(184, 115, 61, 0.35); box-shadow: inset 0 0 18px rgba(204, 102, 0, 0.16); }
.routing-board { position: relative; margin-top: 28px; height: 86px; border: 1px solid rgba(184, 115, 61, 0.25); border-radius: 10px; background: repeating-linear-gradient(90deg, transparent, transparent 33px, rgba(204, 102, 0, 0.12) 34px); }
.routing-board span { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 14px rgba(204,102,0,.7); top: 18px; }
.routing-board span:nth-child(1) { left: 12%; } .routing-board span:nth-child(2) { left: 38%; top: 54px; } .routing-board span:nth-child(3) { left: 64%; } .routing-board span:nth-child(4) { left: 86%; top: 54px; background: var(--sage); }
.routing-board i { position: absolute; left: 14%; right: 12%; height: 1px; top: 43px; background: linear-gradient(90deg, var(--amber), var(--copper), var(--sage)); opacity: .65; }
.tick-tape { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.tick-tape b { padding: 7px 10px; border: 1px solid rgba(184, 115, 61, 0.3); border-radius: 7px; background: rgba(28, 26, 23, 0.56); font-size: 0.8rem; }
.status-readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.status-readouts div { padding: 14px; border: 1px solid rgba(184, 115, 61, 0.26); border-radius: 9px; background: rgba(204, 102, 0, 0.08); }
.status-readouts span { display: block; font-family: "DM Mono", monospace; font-size: 0.65rem; letter-spacing: 0.12em; color: var(--warm-gray); }
.status-readouts strong { font-size: clamp(1rem, 2.4vw, 1.6rem); }
.decor { position: fixed; pointer-events: none; z-index: 1; }
.hex-anchor { width: 56px; height: 50px; left: calc(50% + 24px); top: calc(50% + 18px); clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); background: radial-gradient(circle, rgba(204,102,0,.45), transparent 70%); }
.diamond-anchor { width: 40px; height: 40px; right: 28px; bottom: 28px; border: 1px solid var(--copper); border-radius: 4px; transform: rotate(45deg); opacity: .5; }
.triangle-anchor { width: 0; height: 0; left: 92px; top: 68px; border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 32px solid rgba(204,102,0,.28); transform: rotate(90deg); }

@keyframes lampPulse { 0%,100% { box-shadow: 0 0 4px rgba(204, 102, 0, 0.3); } 50% { box-shadow: 0 0 16px rgba(204, 102, 0, 0.7); } }
@keyframes navEnter { 0% { opacity: 0; transform: translateX(-20px) scale(0.5); } 70% { opacity: 1; transform: translateX(2px) scale(1.08); } 100% { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes panelEnter { 0% { opacity: 0; transform: translateY(30px) scale(0.85); } 72% { opacity: 1; transform: translateY(-4px) scale(1.02); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes panelSwitch { 0% { opacity: .55; transform: translateY(30px) scale(0.85); } 72% { opacity: 1; transform: translateY(-4px) scale(1.02); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes glyphSettle { 0% { opacity: 0; transform: translateY(-8px) rotateX(90deg); color: var(--cream); } 35% { content: "§"; color: var(--copper); } 70% { opacity: 1; transform: translateY(2px) rotateX(-18deg); } 100% { opacity: 1; transform: translateY(0) rotateX(0); color: var(--amber); } }

@media (max-width: 768px) {
  html, body { overflow: auto; }
  .console-shell { position: relative; min-height: 100vh; padding: 72px 16px 88px 16px; overflow: visible; }
  .shape-nav { top: auto; right: 0; bottom: 0; width: auto; height: 64px; flex-direction: row; border-right: 0; border-top: 1px solid rgba(204,102,0,.3); gap: 22px; }
  .shape-button::after { display: none; }
  .hud-grid { height: auto; grid-template-columns: 1fr; grid-template-rows: none; }
  .instrument-card { min-height: 290px; margin: 0; padding: 28px; overflow: visible; }
  .instrument-card.dimmed { opacity: 0.55 !important; transform: translateY(10px) scale(0.98) !important; }
  .status-readouts { grid-template-columns: 1fr; }
  .wordmark { font-size: 0.9rem; }
}
