:root {
  --bg-dark: #060911;
  --card-bg: #0b101e;
  --panel-bg: #11192e;
  --neon-lime: #a3e635;
  --neon-cyan: #22d3ee;
  --neon-pink: #e879f9;
  --neon-gold: #fbbf24;
  --neon-rose: #f43f5e;
  --text-white: #f8fafc;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-dark);
  color: var(--text-white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 12px;
  touch-action: manipulation;
}

.studio-shell {
  width: 100%;
  max-width: 1080px;
  background: var(--card-bg);
  border: 2px solid rgba(163, 230, 53, 0.38);
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Top HUD & Jukebox Bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(17, 25, 46, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  padding: 10px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #a3e635, #22d3ee, #e879f9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 16px rgba(163, 230, 53, 0.55);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-title {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.rank-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(232, 121, 249, 0.16);
  color: #f0abfc;
  border: 1px solid rgba(232, 121, 249, 0.35);
}

.jukebox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.btn, select {
  appearance: none;
  background: #1e293b;
  color: var(--text-white);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn--music {
  background: rgba(163, 230, 53, 0.18);
  color: #bef264;
  border-color: rgba(163, 230, 53, 0.45);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.btn--mp3 {
  background: rgba(34, 211, 238, 0.16);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.4);
}

.btn--homework {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  border-color: rgba(129, 140, 248, 0.5);
}

.btn--lime {
  background: var(--neon-lime);
  color: #050811;
  border-color: var(--neon-lime);
  font-weight: 900;
}

.hud-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-box {
  background: #050811;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 7px 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Custom Homework Bar */
.custom-bar {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(129, 140, 248, 0.5);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.num-input {
  width: 72px;
  background: #050811;
  color: #fff;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  user-select: text;
  -webkit-user-select: text;
}

/* Step Prompt Banner */
.prompt-banner {
  background: rgba(5, 8, 17, 0.92);
  border: 1px solid rgba(163, 230, 53, 0.35);
  border-radius: 14px;
  padding: 11px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.phase-badge {
  background: var(--neon-lime);
  color: #050811;
  font-weight: 900;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: 0.03em;
}

.prompt-text {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

/* Dual Rainbow Grid */
.rainbow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rainbow-card {
  background: #050811;
  border: 2px solid #1e293b;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rainbow-card.active-a {
  border-color: var(--neon-lime);
  box-shadow: 0 0 22px rgba(163, 230, 53, 0.15);
}

.rainbow-card.active-b {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.15);
}

.card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
}

.rainbow-canvas {
  width: 100%;
  height: 195px;
  display: block;
}

.factor-row {
  width: 100%;
  min-height: 44px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  margin-top: 6px;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.factor-pill {
  min-width: 42px;
  min-height: 38px;
  padding: 6px 11px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 900;
  background: #1e293b;
  color: #e2e8f0;
  border: 2px solid #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.factor-pill.common {
  background: var(--neon-lime);
  color: #050811;
  border-color: #d9f99d;
  box-shadow: 0 0 12px rgba(163, 230, 53, 0.7);
}

.factor-pill.gcf {
  background: var(--neon-gold);
  color: #050811;
  border-color: #fef08a;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.95);
  transform: scale(1.12);
}

/* iPad Touch Action Deck */
.action-deck {
  background: rgba(17, 25, 46, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  padding: 14px;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.deck-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.choice-btn {
  min-width: 104px;
  min-height: 50px;
  padding: 10px 18px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 900;
  background: #0f172a;
  color: #fff;
  border: 2px solid rgba(163, 230, 53, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.choice-btn:hover, .choice-btn:active {
  background: var(--neon-lime);
  color: #050811;
  transform: translateY(-2px);
}

.choice-btn--amber {
  border-color: var(--neon-gold);
  color: #fde68a;
}
.choice-btn--amber:hover, .choice-btn--amber:active {
  background: var(--neon-gold);
  color: #050811;
}

.hidden {
  display: none !important;
}

@media (max-width: 740px) {
  .rainbow-grid {
    grid-template-columns: 1fr;
  }
}
