:root {
  --bg-dark: #070a12;
  --card-bg: #090d16;
  --panel-bg: #0f172a;
  --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;
}

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: center;
  padding: 14px;
}

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

/* Top Roblox HUD Bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 10px 14px;
}

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

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--neon-lime);
  color: #050811;
  font-weight: 900;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(163, 230, 53, 0.6);
}

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

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

.pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
}

.city-pill {
  background: rgba(34, 211, 238, 0.16);
  color: #67e8f9;
  border: 1px solid rgba(34, 211, 238, 0.35);
}

.rank-pill {
  background: rgba(232, 121, 249, 0.16);
  color: #f0abfc;
  border: 1px solid rgba(232, 121, 249, 0.35);
}

.track-sub {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #bef264;
  margin-top: 2px;
}

/* Scoreboard & Navigation Controls */
.hud-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

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

.stat-box--score {
  border-color: rgba(34, 211, 238, 0.45);
}

.stat-box--best {
  border-color: rgba(251, 191, 36, 0.45);
}

.stat-box--streak {
  border-color: rgba(244, 63, 94, 0.45);
}

.stat-box--bux {
  border-color: rgba(163, 230, 53, 0.45);
}

.combo-badge {
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 900;
}

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

select:hover, .tab-btn:hover {
  border-color: var(--neon-lime);
}

.tab-btn.active {
  background: var(--neon-lime);
  color: #050811;
  border-color: var(--neon-lime);
}

/* Main Stage Viewport */
.stage-wrap {
  position: relative;
  width: 100%;
  height: 440px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #05070e;
}

#obby-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.stage-top-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}

.question-card, .culture-card {
  pointer-events: auto;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 12px 15px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.question-card {
  border: 1px solid rgba(163, 230, 53, 0.45);
}

.culture-card {
  border: 1px solid rgba(34, 211, 238, 0.35);
  max-width: 340px;
  font-size: 12px;
  line-height: 1.45;
}

.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #bef264;
}

.q-main {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0;
}

.q-equation {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.hint-btn {
  background: rgba(99, 102, 241, 0.25);
  color: #e0e7ff;
  border: 1px solid rgba(129, 140, 248, 0.5);
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.hint-btn:hover {
  background: rgba(99, 102, 241, 0.4);
}

/* Visual Beat Matrix Modal */
.beat-modal {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 68px;
  background: rgba(2, 6, 23, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--neon-lime);
  border-radius: 14px;
  padding: 14px;
  z-index: 30;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
}

.beat-dot-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.beat-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.beat-dot--lime {
  background: var(--neon-lime);
  box-shadow: 0 0 6px rgba(163, 230, 53, 0.7);
}

.beat-dot--cyan {
  background: var(--neon-cyan);
  box-shadow: 0 0 6px rgba(34, 211, 238, 0.7);
}

/* Bottom Answer Beat Pads */
.pad-bar {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.pad-btn {
  flex: 1;
  max-width: 200px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border: 2px solid var(--neon-lime);
  border-radius: 14px;
  padding: 11px 15px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.pad-btn:hover {
  transform: translateY(-3px);
  background: var(--neon-lime);
  color: #020617;
}

.pad-btn--cyan {
  border-color: var(--neon-cyan);
}
.pad-btn--cyan:hover {
  background: var(--neon-cyan);
}

.pad-btn--pink {
  border-color: var(--neon-pink);
}
.pad-btn--pink:hover {
  background: var(--neon-pink);
}

/* Locker Shop & World Passport Panels */
.panel-view {
  width: 100%;
  height: 440px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  padding: 16px;
  overflow-y: auto;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.shop-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.shop-card.equipped {
  border-color: var(--neon-lime);
  background: rgba(163, 230, 53, 0.08);
}

.passport-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mastery-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  margin-top: 8px;
}

.mastery-cell {
  padding: 6px 2px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid #1e293b;
  color: #64748b;
}

.mastery-cell.mastered {
  background: rgba(163, 230, 53, 0.22);
  border-color: var(--neon-lime);
  color: #ecfccb;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .passport-layout {
    grid-template-columns: 1fr;
  }
  .stage-wrap {
    height: 490px;
  }
}
