@font-face {
  font-family: 'Geist';
  src: url('https://musechain.io/fonts/geist/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-deep: #080a0f;
  --bg-card: #0d121c;
  --bg-panel: #131926;
  --border-arcade: #242e42;
  --border-glow: #38bdf844;
  --text-main: #e2e8f0;
  --text-dim: #8492a6;
  --lime: #ccff00;
  --cyan: #38bdf8;
  --amber: #fbbf24;
  --magenta: #f43f5e;
  --purple: #c084fc;
  --scanline: rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.arcade-shell {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: 'Geist', monospace, system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(circle at 15% 20%, #1e1b4b 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, #064e3b 0%, transparent 45%),
    linear-gradient(to bottom, #07090e, #0a0d14);
  background-attachment: fixed;
}

/* TOP NAV */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border-arcade);
  background: rgba(13, 18, 28, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pixel-badge {
  background: var(--lime);
  color: #000;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.05em;
}

.glitch-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff;
  text-shadow: 0 0 10px rgba(204, 255, 0, 0.3);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--lime);
  background: rgba(204, 255, 0, 0.08);
}

.muse-link {
  color: var(--cyan);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid #0284c7;
  padding: 4px 10px;
  border-radius: 3px;
  transition: 0.2s;
}
.muse-link:hover {
  background: #0284c722;
  box-shadow: 0 0 10px #38bdf888;
}

/* PAGE CONTAINER */
.page-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  flex: 1;
  width: 100%;
}

/* HERO SECTION */
.hero-screen {
  margin-bottom: 2.5rem;
}

.crt-frame {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border-arcade);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.15);
  background: #000;
}

.hero-art {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  display: block;
  filter: contrast(1.05) brightness(0.9);
}

.crt-scanlines {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0) 2px,
    rgba(0, 0, 0, 0.3) 3px,
    rgba(0, 0, 0, 0.3) 4px
  );
  pointer-events: none;
}

.crt-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.7) 100%);
  pointer-events: none;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(to top, rgba(8, 10, 15, 0.95) 40%, transparent 100%);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--lime);
  color: var(--lime);
  font-size: 0.75rem;
  padding: 3px 8px;
  margin-bottom: 0.75rem;
  border-radius: 2px;
  letter-spacing: 0.05em;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
}
.dot.live {
  animation: pulse-dot 1.4s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

.hero-overlay h2 {
  font-size: 1.85rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}

.hero-overlay p {
  max-width: 680px;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.action-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* BUTTONS */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
}

.btn-primary {
  background: var(--lime);
  color: #0b0f19;
  border: 1px solid var(--lime);
}
.btn-primary:hover {
  background: #bbf000;
  box-shadow: 0 0 14px rgba(204, 255, 0, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text-main);
  border: 1px solid var(--border-arcade);
}
.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--cyan);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-arcade);
}
.btn-ghost:hover {
  color: #fff;
  border-color: var(--text-dim);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}
.btn-icon:hover { color: #fff; }

.full-width { width: 100%; }

/* SECTION HEADS */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-arcade);
  padding-bottom: 0.75rem;
}

.section-tag {
  color: var(--cyan);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  display: block;
  margin-bottom: 0.25rem;
}

.section-head h3 {
  font-size: 1.35rem;
  color: #fff;
}

.synth-toggle {
  background: #111827;
  border: 1px solid var(--border-arcade);
  color: var(--lime);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 3px;
}
.synth-toggle:hover { border-color: var(--lime); }

/* CABINET GRID */
.machines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.machine-card {
  background: var(--bg-card);
  border: 1px solid var(--border-arcade);
  border-radius: 6px;
  padding: 1.25rem;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.machine-card:hover {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.15);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.cabinet-no {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.state-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  font-weight: 700;
}
.state-badge.dreaming { background: rgba(56, 189, 248, 0.2); color: var(--cyan); border: 1px solid var(--cyan); }
.state-badge.cooling { background: rgba(251, 191, 36, 0.2); color: var(--amber); border: 1px solid var(--amber); }

.pixel-viewport {
  width: 100%;
  height: 160px;
  background: #000;
  border: 1px solid #1e293b;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.pixel-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.machine-info h4 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.machine-info p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.machine-meters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  border-left: 2px solid var(--lime);
}

.meter-col {
  flex: 1;
}

.meter-col span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.meter-col strong {
  font-size: 0.85rem;
  color: #fff;
}

.card-foot {
  margin-top: auto;
  display: flex;
  gap: 0.5rem;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-panel);
  border: 2px solid var(--cyan);
  border-radius: 6px;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: #090e17;
  border-bottom: 1px solid var(--border-arcade);
  color: var(--lime);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.modal-canvas-wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  padding: 1.5rem;
  gap: 1.5rem;
}

#dream-card-canvas {
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  border: 1px solid var(--border-arcade);
  image-rendering: pixelated;
  border-radius: 4px;
}

.card-details h4 {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.card-details p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.spec-grid span {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
}

.spec-grid strong {
  font-size: 0.8rem;
  color: var(--cyan);
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* WORKSHOP LAYOUT */
.workshop-intro {
  margin-bottom: 1.5rem;
}

.workbench-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--border-arcade);
  border-radius: 6px;
  padding: 1.25rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-arcade);
  padding-bottom: 0.6rem;
  margin-bottom: 1.2rem;
  font-size: 0.85rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.chip-code {
  font-size: 0.75rem;
  color: var(--lime);
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 2px;
}

.status-live {
  font-size: 0.75rem;
  color: var(--cyan);
}
.blink { animation: blink-anim 1s infinite; }

@keyframes blink-anim { 50% { opacity: 0.4; } }

.control-group {
  margin-bottom: 1.2rem;
}

.control-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.label-row {
  display: flex;
  justify-content: space-between;
}

.slider-val {
  font-size: 0.8rem;
  color: var(--lime);
}

.retro-select {
  width: 100%;
  background: #090e17;
  color: #fff;
  border: 1px solid var(--border-arcade);
  padding: 0.6rem;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 4px;
}

.retro-range {
  width: 100%;
  accent-color: var(--lime);
}

.mood-radios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.mood-radios label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0,0,0,0.3);
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-arcade);
  cursor: pointer;
  color: #cbd5e1;
  font-size: 0.8rem;
}

.mood-radios input[type="radio"]:checked + span {
  color: var(--lime);
  font-weight: 600;
}

.patch-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.patch-btn {
  background: #090e17;
  color: var(--text-dim);
  border: 1px solid var(--border-arcade);
  padding: 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.patch-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.wire-action {
  margin-top: 1.5rem;
}

/* OSCILLOSCOPE */
.oscilloscope-container {
  margin-bottom: 1.25rem;
}

.scope-screen {
  width: 100%;
  height: 120px;
  background: #04090e;
  border: 1px solid #1e293b;
  border-radius: 4px;
  display: block;
}

.card-staging {
  display: flex;
  gap: 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 4px;
  border: 1px dashed var(--border-arcade);
}

.pixel-display {
  width: 140px;
  height: 140px;
  background: #000;
  border: 1px solid var(--border-arcade);
  image-rendering: pixelated;
  border-radius: 4px;
  flex-shrink: 0;
}

.staging-info {
  display: flex;
  flex-direction: column;
}

.staging-info h3 {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.staging-info p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: auto;
  line-height: 1.35;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ARCHIVE */
.archive-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--border-arcade);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
}

.vault-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-cell {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border-arcade);
  padding: 4px 12px;
  border-radius: 4px;
  text-align: center;
}

.stat-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--lime);
  display: block;
}

.stat-lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.vault-item {
  background: var(--bg-card);
  border: 1px solid var(--border-arcade);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.vault-item:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
}

.vault-canvas {
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  image-rendering: pixelated;
  border: 1px solid #1e293b;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.vault-title {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.vault-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* CHALLENGE */
.challenge-cabinet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  margin-top: 1.5rem;
}

.mission-brief {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-arcade);
  padding: 1.25rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.lime-txt { color: var(--lime); }

.mission-brief h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.mission-brief p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.spec-target-box {
  background: rgba(204, 255, 0, 0.05);
  border: 1px dashed var(--lime);
  padding: 0.75rem;
  border-radius: 4px;
}

.tgt-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.tgt-row:last-child { margin-bottom: 0; }
.tgt-row span { color: var(--text-dim); }
.tgt-row strong { color: #fff; }

.screen-title {
  font-size: 0.8rem;
  color: var(--cyan);
  margin-bottom: 0.5rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.verdict-box {
  padding: 0.85rem;
  margin-top: 1rem;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.05em;
}

.verdict-box.uncalibrated {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--magenta);
  color: #fca5a5;
}

.verdict-box.matched {
  background: rgba(204, 255, 0, 0.15);
  border: 1px solid var(--lime);
  color: var(--lime);
}

.reward-box {
  margin-top: 1.25rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--cyan);
  padding: 1rem;
  border-radius: 6px;
}
.reward-box.hidden { display: none; }
.reward-box h4 { color: #fff; margin-bottom: 0.35rem; }
.reward-box p { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.8rem; }

/* FOOTER */
.arcade-footer {
  border-top: 1px solid var(--border-arcade);
  background: #06080d;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: auto;
}

.arcade-footer p { font-size: 0.75rem; margin-top: 0.25rem; }

.arcade-footer a {
  color: var(--cyan);
  text-decoration: none;
  margin-left: 1.25rem;
}
.arcade-footer a:hover { text-decoration: underline; }

/* RESPONSIVE */
@media (max-width: 840px) {
  .top-nav { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
  .workbench-grid, .challenge-cabinet, .modal-canvas-wrap { grid-template-columns: 1fr; }
  .hero-overlay { position: static; background: var(--bg-card); padding: 1.25rem; }
  .card-staging { flex-direction: column; align-items: center; text-align: center; }
  .arcade-footer { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
  .arcade-footer a { margin-left: 0; margin-right: 1rem; }
}