/* ===================================================================
   Venture 2026 - Clean Product Demo Styles
   
   Two Views Only:
   1. Landing Page: Full-Screen 3D Device Viewer (Three.js GLB)
   2. Device Emulator: Real Device Image (base.png) with Dynamic Screen
      Overlay and Invisible Clickable Button Hit Areas
   =================================================================== */

/* ── Reset & CSS Variables ──────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Reference Palette: Dark Plum / Crimson / Violet Sunset */
  --bg-dark: #0d0310;
  --bg-plum-deep: #16041c;
  --bg-plum-mid: #2e0838;
  --bg-plum-glow: #4d0e52;
  --plum-accent: #e040fb;
  --plum-pink: #ff4081;
  --purple-dark: #320a40;
  --purple: #6a1b9a;
  --purple-light: #9c27b0;
  --purple-accent: #ba68c8;
  --white: #ffffff;
  --gray-100: #f8f1fa;
  --gray-200: #e7d8ec;
  --gray-300: #c1aec8;
  --gray-500: #8b7394;
  --gray-700: #442d4c;
  --gray-800: #231229;
  --lcd-bg: #dbe9fd;
  --lcd-text: #0d1b2a;
  --lcd-subtle: #415a77;
  --green: #2ecc71;
  --green-dark: #1e824c;
  --yellow: #f1c40f;
  --red: #e74c3c;
  --blue: #2980b9;
  --font-main: 'Helvetica Neue', Helvetica, Arial, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --font-lcd: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
  --space-2xs: 3px;
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-lcd);
  background: #110e17;
  color: var(--gray-100);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ── Venture 2026 Header Text (Text only, no pill container) ── */
.venture-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  pointer-events: none;
  user-select: none;
}

.venture-tag {
  font-family: var(--font-lcd);
  font-weight: 800;
  color: #ffffff;
  font-size: 14.5px;
  letter-spacing: 0.4px;
}

.banner-sep {
  color: rgba(186, 104, 200, 0.85);
  font-weight: 700;
  font-size: 14px;
  user-select: none;
}

.venture-school {
  font-family: var(--font-lcd);
  color: #d8c8ec;
  font-size: 14px;
  font-weight: 600;
}

/* ── Bottom Prototype Emulator Notice ────────────────────────── */
.emulator-prototype-notice {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  font-family: var(--font-lcd);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: #ffffff;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  text-align: center;
}

/* ── Top Right Boxy Navigation Buttons (Flat, No Glow) ─────── */
.top-nav-actions {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.top-nav-btn,
.boxy-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  background: #251b36;
  border: 1.5px solid rgba(164, 111, 235, 0.5);
  border-radius: 4px; /* Crisp boxy shape */
  color: #ffffff;
  font-family: var(--font-lcd);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
  box-shadow: none;
  user-select: none;
}

#blender-btn-return {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 1000;
}

.top-nav-btn:hover,
.boxy-btn:hover {
  background: #3c255c;
  border-color: #ba68c8;
  color: #ffffff;
  box-shadow: none;
  transform: translateY(-1px);
}

#btn-reset-setup:hover {
  border-color: #e57373;
}

.top-nav-btn:active,
.boxy-btn:active {
  transform: translateY(1px);
  background: #4a2d72;
  box-shadow: none;
}

/* ── App View Containers ────────────────────────────────── */
.app-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  overflow: hidden;
}

.app-view.active {
  display: flex;
}

/* ── 1. Simplistic 3D Physical Model Viewport ─────────────── */
#view-3d.blender-theme {
  background-color: #1e1e24;
  position: absolute;
  inset: 0;
  overflow: hidden;
  font-family: var(--font-lcd);
  user-select: none;
}

#viewer-container {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
}

#viewer-container:active {
  cursor: grabbing;
}


.viewer-loading, .viewer-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  color: var(--gray-200);
  font-size: 0.95rem;
  background: #282828;
  z-index: 60;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(164, 111, 235, 0.2);
  border-top-color: var(--purple-accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.viewer-error {
  color: var(--red);
}

/* ── 2. Full-Screen Centered Emulator Stage ─────────────── */
#view-emulator {
  background-color: #110e17;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.emulator-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#simulator-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Physical Device Container (base_transparent.png foundation) ── */
.device-emulator {
  position: relative;
  aspect-ratio: 1026 / 1533;
  height: min(84vh, 920px);
  max-height: 90vh;
  width: auto;
  max-width: min(92vw, calc(90vh * 1026 / 1533));
  margin: auto;
  user-select: none;
  filter: none;
}

.device-base-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* ── Dynamic Screen Overlay (matching base_transparent.png LCD area) ── */
.device-screen-overlay,
.device-screen-overlay * {
  font-family: var(--font-lcd) !important;
  box-sizing: border-box;
}

.device-screen-overlay {
  position: absolute;
  left: 17.54%;
  top: 14.02%;
  width: 64.81%;
  height: 23.74%;
  background-color: #aacbfa;
  border-radius: 6px;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 3px 8px 3px 8px;
  color: var(--lcd-text);
  container-type: size;
}

/* ═══════════════════════════════════════════════════════════
   REGION 1: HEADER (Small title / status / battery)
   ═══════════════════════════════════════════════════════════ */
.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(11.5px, 6cqh, 15.5px);
  color: #1d2d44;
  padding-bottom: 2px;
  border-bottom: 1.5px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  height: clamp(18px, 9cqh, 22px);
  min-height: 18px;
  max-height: 22px;
  line-height: 1.2;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
}

.screen-skill {
  color: #122138;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen-sep {
  color: #617796;
  flex-shrink: 0;
}

.screen-level {
  color: #384e6d;
  font-weight: 700;
  white-space: nowrap;
}

.screen-battery {
  display: flex;
  align-items: center;
}

.battery-shell {
  width: clamp(20px, 7cqw, 26px);
  height: clamp(10px, 5cqh, 13px);
  border: 1.5px solid #16263b;
  border-radius: 3px;
  padding: 1px;
  background: #ffffff;
}

.battery-level {
  width: 82%;
  height: 100%;
  background: #27ae60;
  border-radius: 1.5px;
}

.battery-terminal {
  width: 2px;
  height: 5px;
  background: #16263b;
  border-radius: 0 1px 1px 0;
}

/* ═══════════════════════════════════════════════════════════
   REGION 2: MAIN CONTENT (Question / lesson / feedback / scrollable)
   ═══════════════════════════════════════════════════════════ */
.screen-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 20, 60, 0.35) transparent;
  padding: 2px 2px 4px 2px;
  width: 100%;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.screen-body::-webkit-scrollbar {
  width: 3px;
  display: block;
}

.screen-body::-webkit-scrollbar-track {
  background: transparent;
}

.screen-body::-webkit-scrollbar-thumb {
  background: rgba(30, 20, 60, 0.35);
  border-radius: 3px;
}

.screen-body::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 20, 60, 0.6);
}

.screen-question {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto 0;
}

.screen-body.feedback-active .screen-question {
  margin: 0 0 2px 0;
}

.question-text {
  font-size: clamp(18px, 11cqh, 32px);
  font-weight: 800;
  text-align: center;
  padding: 3px 2px 4px 2px;
  line-height: 1.28;
  color: #0b1523;
  letter-spacing: -0.2px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.question-text.question-compact {
  font-size: clamp(12.5px, 6.2cqh, 16px);
  line-height: 1.22;
  padding: 1px 2px 2px 2px;
}

.screen-input-row {
  display: flex;
  justify-content: center;
  margin: var(--space-2xs) 0;
  flex-shrink: 0;
}

.screen-input {
  min-width: clamp(100px, 34cqw, 140px);
  height: clamp(34px, 18cqh, 48px);
  padding: 2px 10px;
  background: #ffffff;
  border: 2px solid #58248c;
  border-radius: 6px;
  text-align: center;
  font-size: clamp(22px, 13cqh, 32px);
  font-weight: 800;
  font-family: var(--font-lcd) !important;
  color: #170d2b;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Choice Options */
.screen-options {
  margin: 2px 0;
  width: 100%;
  flex-shrink: 0;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  width: 100%;
}

.options-container.options-grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xs) var(--space-xs);
}

.option-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(88, 36, 140, 0.22);
  border-radius: 6px;
  cursor: pointer;
  font-size: clamp(12.5px, 6.8cqh, 16px);
  line-height: 1.25;
  transition: all 0.12s;
  min-height: clamp(22px, 11cqh, 30px);
}

.option-row:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: #58248c;
}

.option-row.selected {
  background: #58248c;
  color: var(--white);
  border-color: #37145a;
}

.option-row.selected .opt-text {
  color: var(--white);
}

.option-row.selected .opt-key-badge {
  background: #ffffff;
  color: #58248c;
}

.opt-key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(16px, 5cqh, 20px);
  height: clamp(16px, 5cqh, 20px);
  background: #58248c;
  color: var(--white);
  border-radius: 4px;
  font-size: clamp(10px, 4.2cqh, 12.5px);
  font-weight: 800;
  flex-shrink: 0;
}

.opt-letter-badge {
  display: none !important;
}

.opt-text {
  color: #0b1523;
  font-weight: 700;
  font-size: inherit;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.2;
}

.options-guide {
  display: none;
}

/* Mini-Lesson Card */
.lesson-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 2px;
  width: 100%;
}

.lesson-headline {
  font-size: clamp(14px, 7.5cqh, 18px);
  font-weight: 800;
  color: #0e1a2d;
  margin-bottom: var(--space-2xs);
  line-height: 1.2;
}

.lesson-display {
  font-size: clamp(16px, 9cqh, 22px);
  font-weight: 800;
  color: #58248c;
  background: #ffffff;
  border: 2px solid #a46feb;
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: var(--space-2xs);
}

.lesson-text {
  font-size: clamp(12.5px, 6.5cqh, 16px);
  color: #1c2b3e;
  line-height: 1.3;
  max-width: 96%;
  margin-bottom: var(--space-2xs);
  font-weight: 600;
}

.lesson-prompt {
  font-size: clamp(12px, 6.2cqh, 15px);
  color: #58248c;
  font-weight: 800;
  margin-top: var(--space-2xs);
}

.lesson-q-label {
  font-size: clamp(10px, 5cqh, 13px);
  font-weight: 800;
  color: #58248c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  background: rgba(88, 36, 140, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin: 0 auto 3px;
}

/* Feedback Banner & Dynamic Question Font Reduction */
.screen-body.feedback-active .question-text {
  font-size: clamp(12px, 5.5cqh, 15px) !important;
  line-height: 1.2 !important;
  padding: 1px 2px 2px 2px !important;
  opacity: 0.88;
  transition: font-size 0.15s ease;
}

.screen-feedback {
  margin-top: 3px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: clamp(11.5px, 6cqh, 14.5px);
  line-height: 1.25;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.feedback-correct {
  background: rgba(235, 252, 242, 0.96);
  border: 2px solid #27ae60;
  box-shadow: 0 2px 6px rgba(39, 174, 96, 0.15);
}

.feedback-wrong {
  background: rgba(255, 245, 238, 0.98);
  border: 2px solid #e67e22;
  box-shadow: 0 2px 6px rgba(230, 126, 34, 0.15);
}

.feedback-hint {
  background: rgba(254, 250, 230, 0.98);
  border: 2px solid #f1c40f;
  box-shadow: 0 2px 6px rgba(241, 196, 15, 0.15);
  margin-top: 2px;
  padding: 3px 6px;
}

.feedback-icon {
  font-size: clamp(16px, 9cqh, 22px);
  text-align: center;
  line-height: 1;
  margin-bottom: 2px;
  font-weight: 800;
}

.feedback-correct .feedback-icon { color: var(--green-dark); }
.feedback-wrong .feedback-icon { color: #d35400; }

.feedback-msg {
  font-weight: 800;
  text-align: center;
  font-size: clamp(13px, 6.8cqh, 16.5px);
  color: #111d2e;
  line-height: 1.25;
  margin-bottom: 2px;
}

.feedback-explanation {
  color: #162232;
  font-size: clamp(11px, 5.2cqh, 13.5px);
  padding: 3px 6px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 2px;
  line-height: 1.3;
  font-weight: 600;
  text-align: left;
}

.feedback-next {
  text-align: center;
  color: #3e5676;
  font-size: clamp(11px, 5.5cqh, 14px);
  margin-top: var(--space-2xs);
  font-weight: 700;
}

.feedback-hint-text {
  color: #4d3800;
  font-size: clamp(11px, 5.4cqh, 13.5px);
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
}

/* Onboarding Flow on Screen */
.onboard-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  padding: 1px 2px 0 2px;
}

.onboard-title {
  font-size: clamp(22px, 13cqh, 30px);
  font-weight: 800;
  color: #0e1a2d;
  margin-bottom: 2px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.onboard-sub {
  font-size: clamp(13px, 7cqh, 17px);
  color: #2b4160;
  margin-bottom: 3px;
  font-weight: 700;
  line-height: 1.25;
}

.onboard-label {
  font-size: clamp(15px, 8cqh, 20px);
  font-weight: 800;
  color: #0e1a2d;
  margin-bottom: 2px;
  line-height: 1.2;
}

.onboard-body {
  font-size: clamp(12.5px, 6.5cqh, 16px);
  color: #22344d;
  line-height: 1.25;
  max-width: 95%;
  margin-bottom: 2px;
  font-weight: 600;
}

.onboard-tips-box {
  width: 98%;
  max-width: 280px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(88, 36, 140, 0.28);
  border-radius: 6px;
  padding: 4px 6px;
  margin: 2px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 1px 4px rgba(88, 36, 140, 0.08);
}

.onboard-tips-box.compact {
  padding: 3px 6px;
  gap: 2px;
  margin-top: 4px;
}

.onboard-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-lcd) !important;
  font-size: clamp(10px, 4.8cqh, 12px);
  color: #17243b;
  text-align: left;
}

.onboard-tip-key {
  background: #58248c;
  color: #ffffff;
  font-weight: 800;
  font-size: clamp(9px, 4.2cqh, 10.5px);
  padding: 1px 5px;
  border-radius: 3px;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
  display: inline-block;
  line-height: 1.25;
}

.onboard-tip-key.hint-key {
  background: #b45309;
}

.onboard-tip-key.dpad-key {
  background: #334155;
}

.onboard-tip-desc {
  font-weight: 700;
  color: #1e293b;
  line-height: 1.18;
}

.onboard-grades-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px 6px;
  width: 100%;
  max-width: 260px;
  margin-bottom: 2px;
}

.grade-item {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(88, 36, 140, 0.22);
  border-radius: 5px;
  font-size: clamp(12px, 6.2cqh, 15px);
  font-weight: 700;
  color: #142136;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}

.grade-item:hover {
  background: #ffffff;
  border-color: #58248c;
}

.grade-item.selected {
  background: #58248c;
  color: var(--white);
  border-color: #37145a;
}

.onboard-grades-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px 5px;
  width: 100%;
  max-width: 220px;
  margin: 2px auto;
}

.grade-grid-item {
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid rgba(88, 36, 140, 0.25);
  border-radius: 6px;
  font-size: clamp(13px, 7cqh, 17px);
  font-weight: 800;
  color: #142136;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
  min-height: clamp(18px, 9cqh, 24px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.grade-grid-item:hover {
  background: #ffffff;
  border-color: #58248c;
}

.grade-grid-item.selected {
  background: #58248c;
  color: #ffffff;
  border-color: #37145a;
}

.onboard-langs-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px 6px;
  width: 100%;
  max-width: 250px;
  margin: 2px auto;
}

.lang-item {
  padding: 2px 6px;
  font-size: clamp(12.5px, 6.5cqh, 16px);
  font-weight: 700;
  text-align: left;
  border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════
   REGION 3: FOOTER (Removed to reclaim valuable LCD space)
   ═══════════════════════════════════════════════════════════ */
.screen-footer,
.screen-c-hint {
  display: none !important;
}

.onboard-prompt {
  font-size: clamp(14px, 7.5cqh, 19px);
  color: #58248c;
  font-weight: 800;
  margin-top: 3px;
  line-height: 1.2;
}

.prompt-arrow {
  color: #58248c;
  animation: pulse-arrow 1s infinite alternate;
}

@keyframes pulse-arrow {
  0% { opacity: 0.4; transform: translateX(0); }
  100% { opacity: 1; transform: translateX(2px); }
}

.onboard-star {
  font-size: clamp(18px, 11cqh, 24px);
  color: #f39c12;
  line-height: 1;
  margin-bottom: var(--space-2xs);
}

/* ── Status LEDs Overlay (Aligned precisely over base.png LEDs) ── */
.device-leds-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.led-overlay {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.led-overlay.on {
  opacity: 1;
}

.led-overlay-status {
  left: 20.90%;
  top: 43.03%;
  width: 2.84%;
  height: 1.90%;
  background-color: #2ecc71;
}

.led-overlay-hint {
  left: 33.98%;
  top: 43.03%;
  width: 2.84%;
  height: 1.90%;
  background-color: #f1c40f;
}

.led-overlay-power {
  left: 47.82%;
  top: 43.03%;
  width: 2.84%;
  height: 1.90%;
  background-color: #2ecc71;
}

/* ── Invisible Interactive Hotspots (Hit Areas over base.png) ── */
.device-hotspots {
  position: absolute;
  inset: 0;
}

.hotspot {
  position: absolute;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.hotspot:hover,
.hotspot:active,
.hotspot:focus {
  background: transparent !important;
  outline: none;
  box-shadow: none;
}

/* Navigation Row Buttons */
.hotspot-home {
  left: 20.47%;
  top: 51.53%;
  width: 9.84%;
  height: 6.07%;
  border-radius: 8px;
}

.hotspot-hint {
  left: 30.70%;
  top: 51.53%;
  width: 9.06%;
  height: 6.00%;
  border-radius: 8px;
}

.hotspot-back {
  left: 60.23%;
  top: 51.53%;
  width: 9.55%;
  height: 5.94%;
  border-radius: 8px;
}

.hotspot-next {
  left: 70.18%;
  top: 51.53%;
  width: 10.33%;
  height: 6.00%;
  border-radius: 8px;
}

/* D-Pad Buttons (Centered around 513, 845) */
.hotspot-dpad-up {
  left: 45.00%;
  top: 48.92%;
  width: 10.00%;
  height: 4.20%;
  border-radius: 6px 6px 2px 2px;
}

.hotspot-dpad-down {
  left: 45.00%;
  top: 57.00%;
  width: 10.00%;
  height: 4.50%;
  border-radius: 2px 2px 6px 6px;
}

.hotspot-dpad-left {
  left: 41.33%;
  top: 52.19%;
  width: 5.50%;
  height: 5.30%;
  border-radius: 6px 2px 2px 6px;
}

.hotspot-dpad-right {
  left: 53.50%;
  top: 52.19%;
  width: 5.50%;
  height: 5.30%;
  border-radius: 2px 6px 6px 2px;
}

.hotspot-dpad-center {
  left: 47.00%;
  top: 52.50%;
  width: 6.00%;
  height: 4.80%;
  border-radius: 50%;
}

/* Keypad (3 columns x 4 rows) */
/* Column Left Positions */
.hotspot-k1, .hotspot-k4, .hotspot-k7, .hotspot-kC {
  left: 23.39%;
  width: 15.69%;
  border-radius: 8px;
}

.hotspot-k2, .hotspot-k5, .hotspot-k8, .hotspot-k0 {
  left: 41.91%;
  width: 15.69%;
  border-radius: 8px;
}

.hotspot-k3, .hotspot-k6, .hotspot-k9, .hotspot-kEnter {
  left: 60.92%;
  width: 16.67%;
  border-radius: 8px;
}

/* Row Top & Height Positions */
.hotspot-k1, .hotspot-k2, .hotspot-k3 {
  top: 61.32%;
  height: 6.80%;
}

.hotspot-k4, .hotspot-k5, .hotspot-k6 {
  top: 68.49%;
  height: 6.60%;
}

.hotspot-k7, .hotspot-k8, .hotspot-k9 {
  top: 75.02%;
  height: 6.50%;
}

.hotspot-kC, .hotspot-k0, .hotspot-kEnter {
  top: 81.54%;
  height: 7.00%;
}

/* ── Accessible Focus States ─────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--purple-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: rgba(164, 111, 235, 0.35);
  color: var(--white);
}

/* ── Reduced Motion Preference ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .loading-spinner {
    animation: none !important;
    border-top-color: var(--purple-accent);
  }
  .prompt-arrow {
    animation: none !important;
  }
}

/* ── Device Dashboard Overlay (Accessible via HOME button) ── */
.device-dashboard {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  padding: 2px 4px;
  box-sizing: border-box;
  font-family: var(--font-lcd) !important;
}

.dash-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2px;
  border-bottom: 1.5px solid rgba(88, 36, 140, 0.18);
  flex-shrink: 0;
}

.dash-grade-pill {
  font-size: clamp(10px, 4.8cqh, 12px);
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  background: #58248c;
  color: #ffffff;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.dash-stats-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-badge {
  font-size: clamp(9.5px, 4.5cqh, 11.5px);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(88, 36, 140, 0.12);
  color: #58248c;
  line-height: 1.2;
}

.dash-badge.active {
  background: rgba(39, 174, 96, 0.18);
  color: #1e8449;
  font-weight: 800;
  border: 1px solid rgba(39, 174, 96, 0.35);
}

.dash-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 2px;
}

.dash-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid rgba(88, 36, 140, 0.25);
  border-radius: 5px;
  font-family: var(--font-lcd) !important;
  font-size: clamp(10px, 4.8cqh, 12px);
  font-weight: 700;
  color: #17243b;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
  min-height: 22px;
  line-height: 1.15;
}

.dash-action-btn:hover,
.dash-action-btn.focused {
  background: #ffffff;
  border-color: #58248c;
  outline: 2px solid #58248c;
  outline-offset: 1px;
  box-shadow: 0 0 5px rgba(88, 36, 140, 0.4);
}

.dash-action-btn.primary {
  grid-column: 1 / -1;
  background: #58248c;
  color: #ffffff;
  border-color: #37145a;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(10.5px, 5cqh, 12.5px);
  padding: 3px 8px;
}

.dash-action-btn.primary:hover,
.dash-action-btn.primary.focused {
  background: #471d70;
  border-color: #2b0f47;
  outline: 2px solid #ffffff;
  outline-offset: 1px;
  box-shadow: 0 0 7px rgba(88, 36, 140, 0.6);
}

.dash-action-btn.primary .dash-key-pill {
  background: #ffffff;
  color: #58248c;
}

.dash-action-btn.full-width {
  grid-column: 1 / -1;
  justify-content: center;
}

.dash-key-pill {
  width: clamp(14px, 4.4cqh, 16px);
  height: clamp(14px, 4.4cqh, 16px);
  border-radius: 3px;
  background: #58248c;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 4cqh, 11px);
  font-weight: 800;
  flex-shrink: 0;
}

.dash-nav-hint {
  font-size: clamp(9px, 4.2cqh, 11px);
  color: #58248c;
  text-align: center;
  font-weight: 700;
  padding-top: 2px;
  border-top: 1px dashed rgba(88, 36, 140, 0.2);
  margin-top: auto;
  opacity: 0.9;
  line-height: 1.1;
}

/* ── Mathematical Formatting (Stacked Fractions & Operators) ── */
.math-fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  font-size: 0.88em;
  line-height: 1;
  margin: 0 3px;
}

.frac-num {
  border-bottom: 1.5px solid currentColor;
  padding: 0 2px 1px 2px;
  font-weight: 800;
}

.frac-den {
  padding: 1px 2px 0 2px;
  font-weight: 800;
}

/* ── Visual Concrete Mini-Lesson Representations ─────────── */
.visual-model {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1.5px solid #a46feb;
  border-radius: 6px;
  padding: 3px 8px;
  margin: 2px auto;
  width: 96%;
  max-width: 270px;
  font-family: var(--font-lcd) !important;
}

.visual-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
  font-size: clamp(11.5px, 6cqh, 14.5px);
  line-height: 1.25;
}

.pv-block-ten {
  background: #58248c;
  color: #ffffff;
  font-size: clamp(10px, 5cqh, 12px);
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.pv-block-ones {
  letter-spacing: 2px;
  color: #2980b9;
  font-size: clamp(12px, 6cqh, 15px);
  font-weight: 800;
}

.fraction-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
}

.fraction-bar {
  display: flex;
  width: 120px;
  height: clamp(14px, 7cqh, 18px);
  border: 1.5px solid #16263b;
  border-radius: 3px;
  overflow: hidden;
  background: #ffffff;
}

.frac-part {
  flex: 1;
  border-right: 1px solid #16263b;
}

.frac-part:last-child {
  border-right: none;
}

.frac-part.filled {
  background: #58248c;
}

.visual-array-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 2px 0;
}

.array-dots {
  letter-spacing: 4px;
  font-size: clamp(12px, 6.5cqh, 16px);
  color: #58248c;
  line-height: 1;
}

.state-diagram {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(10.5px, 5.2cqh, 13px);
  font-weight: 800;
}

.state-box {
  background: rgba(88, 36, 140, 0.12);
  border: 1px solid #58248c;
  border-radius: 4px;
  padding: 2px 5px;
  color: #17243b;
}

.bracket-highlight {
  display: inline-block;
  background: rgba(88, 36, 140, 0.15);
  border: 1px solid #58248c;
  border-radius: 4px;
  padding: 0 4px;
  font-weight: 800;
  color: #58248c;
}

.gram-phrase-dim {
  color: #5a6a80;
  font-style: italic;
  font-weight: 600;
  opacity: 0.88;
}

.verb-target {
  display: inline-block;
  background: rgba(39, 174, 96, 0.15);
  border: 1.5px solid #27ae60;
  color: #1e8449;
  border-radius: 4px;
  padding: 0 5px;
  font-weight: 800;
}

/* ── Paper-Style Vertical Column Math ─────────────────────── */
.visual-math-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 3px auto;
  padding: 3px 6px;
  background: #ffffff;
  border: 1.5px solid #d0d7de;
  border-radius: 6px;
  max-width: 95%;
  box-sizing: border-box;
}

.math-col-grid {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'SF Mono', 'Roboto Mono', 'Courier New', monospace;
  font-weight: 800;
  font-size: clamp(13px, 6.5cqh, 17px);
  color: #111d2e;
  line-height: 1.2;
}

.col-carry-row, .col-borrow-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  font-size: clamp(10px, 4.8cqh, 12px);
  color: #9333ea;
  margin-bottom: -1px;
}

.carry-mark, .borrow-mark {
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid #9333ea;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 800;
}

.col-num-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  letter-spacing: 2px;
}

.col-op {
  margin-right: 4px;
  color: #58248c;
}

.col-divider {
  width: 100%;
  height: 2px;
  background: #111d2e;
  margin: 1px 0;
}

.col-ans-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  letter-spacing: 2px;
  color: #16a34a;
  font-weight: 900;
}

.col-note {
  font-size: clamp(10.5px, 5cqh, 13px);
  color: #374151;
  font-weight: 700;
  margin-top: 2px;
  text-align: center;
  font-family: inherit;
}

/* ── Long Division Bracket ────────────────────────────────── */
.long-div-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'SF Mono', 'Roboto Mono', 'Courier New', monospace;
  font-weight: 800;
  font-size: clamp(13px, 6.5cqh, 17px);
  color: #111d2e;
  margin: 2px auto;
}

.div-top {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding-right: 4px;
  color: #16a34a;
}

.div-middle {
  display: flex;
  align-items: center;
}

.div-divisor {
  color: #58248c;
  padding-right: 4px;
}

.div-bracket-wrap {
  border-top: 2px solid #111d2e;
  border-left: 2px solid #111d2e;
  border-top-left-radius: 6px;
  padding: 1px 6px 1px 4px;
}

.div-dividend {
  letter-spacing: 2px;
}

/* ── Streak & Milestone Badges ────────────────────────────── */
.streak-pill {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: clamp(9.5px, 4.8cqh, 12px);
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-left: 4px;
}

/* ── Topic / Concept Selector LCD View ─────────────────────── */
.topic-select-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 2px 4px;
  box-sizing: border-box;
}

.topic-select-header {
  font-size: clamp(12.5px, 6cqh, 15px);
  font-weight: 800;
  color: #111d2e;
  margin-bottom: 3px;
  text-align: center;
}

.topic-list-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  width: 100%;
}

.topic-item-btn {
  background: #ffffff;
  border: 1.5px solid #c7d2fe;
  border-radius: 5px;
  padding: 4px 6px;
  font-size: clamp(10.5px, 5cqh, 13px);
  font-weight: 700;
  color: #1e1b4b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  text-align: left;
}

.topic-item-btn:hover,
.topic-item-btn.selected,
.topic-item-btn.focused {
  border-color: #6366f1;
  background: #eef2ff;
  outline: 2px solid #6366f1;
  outline-offset: 1px;
}

.topic-key-pill {
  background: #4f46e5;
  color: #ffffff;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  font-weight: 900;
}

/* ── Show Steps Walkthrough Mode ──────────────────────────── */
.walkthrough-badge {
  background: #0284c7;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

