/**
 * MALIK MATH ACADEMY — PRODUCTION DESIGN SYSTEM
 * Highly tactile, accessible, child-friendly CSS architecture for touch and desktop.
 */

:root {
  /* Color Palette Tokens (WCAG AAA >= 7:1 for text, AA >= 4.5:1 for UI) */
  --color-brand-primary: #0D9488;       /* Academy Teal */
  --color-brand-primary-dark: #0F766E;
  --color-brand-primary-light: #CCFBF1;
  --color-brand-accent: #F59E0B;        /* Sunburst Amber */
  --color-brand-accent-dark: #D97706;
  --color-brand-success: #10B981;       /* Meadow Emerald */
  --color-brand-success-dark: #059669;
  --color-brand-danger: #EF4444;        /* Warm Coral */
  --color-brand-info: #0284C7;          /* Sky Blue */
  --color-brand-purple: #8B5CF6;        /* Crystal Violet */
  --color-brand-purple-dark: #6D28D9;

  /* Neutral Surface & Canvas Tokens */
  --color-canvas-bg: #F8FAFC;
  --color-surface-card: #FFFFFF;
  --color-surface-elevated: #FFFFFF;
  --color-text-main: #0F172A;
  --color-text-muted: #475569;
  --color-text-inverse: #FFFFFF;
  --color-border-subtle: #E2E8F0;
  --color-border-bold: #CBD5E1;

  /* Typography Scales */
  --font-family-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 'Outfit', 'Plus Jakarta Sans', sans-serif;
  --font-size-hero: 28px;
  --font-size-title: 22px;
  --font-size-subtitle: 18px;
  --font-size-body: 16px;
  --font-size-small: 14px;
  --font-size-equation: 36px;

  /* Elevation Shadows (Tactile 3D physical feel) */
  --shadow-tactile-card: 0 8px 0 #CBD5E1, 0 12px 20px rgba(15, 23, 42, 0.08);
  --shadow-tactile-btn-primary: 0 6px 0 #0F766E, 0 10px 16px rgba(13, 148, 136, 0.25);
  --shadow-tactile-btn-accent: 0 6px 0 #D97706, 0 10px 16px rgba(245, 158, 11, 0.25);
  --shadow-tactile-btn-success: 0 6px 0 #059669, 0 10px 16px rgba(16, 185, 129, 0.25);
  --shadow-tactile-btn-purple: 0 6px 0 #6D28D9, 0 10px 16px rgba(139, 92, 246, 0.25);

  /* Touch Boundaries & Radius */
  --touch-target-min: 48px;
  --radius-card: 24px;
  --radius-btn: 18px;
  --radius-pill: 9999px;
  --transition-tactile: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.1s ease;
}

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

body {
  font-family: var(--font-family-main);
  background-color: var(--color-canvas-bg);
  color: var(--color-text-main);
  font-size: var(--font-size-body);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

#academy-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   APP HEADER & TOP BAR
   ========================================================================== */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--color-surface-card);
  border-bottom: 2px solid var(--color-border-subtle);
  height: 68px;
  flex-shrink: 0;
  z-index: 50;
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-brand-primary-light);
  padding: 4px 14px 4px 6px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-brand-primary);
  cursor: pointer;
}

.avatar-frame {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #FFF;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-brand-primary);
  flex-shrink: 0;
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

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

.profile-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--color-brand-primary-dark);
}

.profile-level {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
}

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

.currency-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 800;
  border: 2px solid var(--color-border-subtle);
}

.currency-badge.stars { color: #D97706; background: #FEF3C7; border-color: #FDE68A; }
.currency-badge.coins { color: #B45309; background: #FFFBEB; border-color: #FCD34D; }
.currency-badge.crystals { color: #6D28D9; background: #EDE9FE; border-color: #DDD6FE; }

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

.parent-gate-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  border: 2px solid var(--color-border-bold);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.parent-gate-btn:hover {
  background: #E2E8F0;
  border-color: var(--color-brand-primary);
}

/* ==========================================================================
   APP BOTTOM DOCK NAVIGATION
   ========================================================================== */
.app-dock {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 16px;
  background: var(--color-surface-card);
  border-top: 2px solid var(--color-border-subtle);
  height: 74px;
  flex-shrink: 0;
  z-index: 50;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 18px;
  border-radius: var(--radius-btn);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-weight: 800;
  font-size: 12px;
  transition: var(--transition-tactile);
}

.dock-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2.2;
}

.dock-item.active {
  color: var(--color-brand-primary);
  background: var(--color-brand-primary-light);
  transform: translateY(-2px);
}

.dock-item:active {
  transform: translateY(2px);
}

/* ==========================================================================
   CONTENT VIEW CONTAINER
   ========================================================================== */
.screen-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Tactile Buttons */
.btn-tactile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--touch-target-min);
  padding: 10px 22px;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: var(--transition-tactile);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-brand-primary);
  color: #FFF;
  box-shadow: var(--shadow-tactile-btn-primary);
}

.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #0F766E, 0 4px 8px rgba(13, 148, 136, 0.25);
}

.btn-accent {
  background: var(--color-brand-accent);
  color: #FFF;
  box-shadow: var(--shadow-tactile-btn-accent);
}

.btn-accent:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #D97706;
}

.btn-success {
  background: var(--color-brand-success);
  color: #FFF;
  box-shadow: var(--shadow-tactile-btn-success);
}

.btn-success:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #059669;
}

.btn-purple {
  background: var(--color-brand-purple);
  color: #FFF;
  box-shadow: var(--shadow-tactile-btn-purple);
}

.btn-purple:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #6D28D9;
}

.btn-outline {
  background: #FFF;
  color: var(--color-text-main);
  border: 2px solid var(--color-border-bold);
  box-shadow: 0 4px 0 var(--color-border-bold);
}

.btn-outline:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--color-border-bold);
}

/* Cards */
.card-tactile {
  background: var(--color-surface-card);
  border: 2px solid var(--color-border-subtle);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow-tactile-card);
}

/* Speech Bubble (Teacher Miss Sarah) */
.speech-bubble {
  background: #FFFFFF;
  border: 2px solid #BAE6FD;
  border-radius: 20px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 6px 0 #E0F2FE, 0 10px 15px -3px rgba(2, 132, 199, 0.08);
}

.audio-pulse-indicator {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #E0F2FE;
  color: #0284C7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.15s;
}

.audio-pulse-indicator:hover {
  transform: scale(1.08);
}

/* ==========================================================================
   ACADEMY HOME SPECIFICS
   ========================================================================== */
.home-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.hero-welcome-card {
  background: linear-gradient(135deg, #0D9488 0%, #0F766E 100%);
  color: #FFF;
  border-radius: var(--radius-card);
  padding: 26px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 0 #042F2E, 0 16px 24px rgba(13, 148, 136, 0.2);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 65%;
}

.hero-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 15px;
  opacity: 0.95;
  margin-bottom: 22px;
}

.hero-malik-img {
  position: absolute;
  right: 18px;
  bottom: 14px;
  width: 160px;
  height: 160px;
  border-radius: 24px;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.quest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F8FAFC;
  border: 2px solid var(--color-border-subtle);
  border-radius: 16px;
  padding: 12px 14px;
  transition: all 0.2s;
}

.quest-item:hover {
  border-color: var(--color-brand-primary);
  background: #F0FDFA;
}

.quest-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #FEF3C7;
  color: #D97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.quest-details {
  flex: 1;
}

.quest-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-main);
}

.quest-bar {
  height: 8px;
  background: #E2E8F0;
  border-radius: var(--radius-pill);
  margin-top: 5px;
  overflow: hidden;
}

.quest-progress {
  height: 100%;
  background: var(--color-brand-success);
  border-radius: var(--radius-pill);
}

.math-lab-banner {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  color: #FFF;
  border-radius: var(--radius-card);
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  box-shadow: 0 8px 0 #4C1D95;
}

/* ==========================================================================
   WORLDS MAP SPECIFICS
   ========================================================================== */
.worlds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.world-card {
  background: #FFFFFF;
  border: 3px solid var(--color-border-subtle);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 0 #CBD5E1;
  transition: var(--transition-tactile);
}

.world-card.active {
  border-color: #F59E0B;
  box-shadow: 0 8px 0 #D97706, 0 12px 20px rgba(245, 158, 11, 0.2);
  transform: translateY(-4px);
}

.world-thumbnail {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 48px;
}

.w1-bg { background: linear-gradient(135deg, #A7F3D0 0%, #34D399 100%); }
.w2-bg { background: linear-gradient(135deg, #FDE68A 0%, #F59E0B 100%); }
.w3-bg { background: linear-gradient(135deg, #99F6E4 0%, #2DD4BF 100%); }
.w4-bg { background: linear-gradient(135deg, #FECDD3 0%, #FB7185 100%); }
.w5-bg { background: linear-gradient(135deg, #DDD6FE 0%, #A78BFA 100%); }
.w6-bg { background: linear-gradient(135deg, #BAE6FD 0%, #38BDF8 100%); }

.world-badge-status {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #0F172A;
  color: #FFF;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
}

.world-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  gap: 12px;
}

.world-number {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 0.5px;
}

.world-title {
  font-size: 19px;
  font-weight: 800;
  color: #0F172A;
  margin-top: 2px;
}

.world-desc {
  font-size: 13px;
  color: #64748B;
  margin-top: 4px;
}

.world-progress-bar {
  height: 8px;
  background: #E2E8F0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 10px;
}

/* ==========================================================================
   WORLD OVERVIEW & PATHWAY
   ========================================================================== */
.world-hero-banner {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFF;
  border-radius: var(--radius-card);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto 24px auto;
  width: 100%;
  box-shadow: 0 8px 0 #B45309;
}

.pathway-container {
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-bottom: 30px;
}

.pathway-node {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: #FFFFFF;
  border: 3px solid var(--color-border-subtle);
  border-radius: 20px;
  padding: 14px 20px;
  box-shadow: 0 6px 0 #CBD5E1;
  text-decoration: none;
  color: var(--color-text-main);
  transition: all 0.2s;
  cursor: pointer;
}

.pathway-node.completed {
  border-color: var(--color-brand-success);
  box-shadow: 0 6px 0 #059669;
}

.pathway-node.active {
  border-color: var(--color-brand-accent);
  box-shadow: 0 8px 0 #D97706, 0 12px 20px rgba(245, 158, 11, 0.25);
  transform: scale(1.02);
  background: #FFFBEB;
}

.pathway-node.locked {
  opacity: 0.6;
  background: #F1F5F9;
  box-shadow: 0 4px 0 #CBD5E1;
  pointer-events: none;
}

.node-icon-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #FFF;
  flex-shrink: 0;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2);
}

.node-details {
  flex: 1;
}

.node-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748B;
}

.node-title {
  font-size: 16px;
  font-weight: 800;
  margin-top: 2px;
}

/* ==========================================================================
   LESSON EXPERIENCE SPECIFICS
   ========================================================================== */
.lesson-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #FFFFFF;
  border-bottom: 2px solid var(--color-border-subtle);
  height: 64px;
  flex-shrink: 0;
}

.stage-pill-track {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F1F5F9;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}

.stage-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #CBD5E1;
  transition: all 0.3s;
}

.stage-dot.completed {
  background: var(--color-brand-success);
}

.stage-dot.current {
  background: var(--color-brand-accent);
  transform: scale(1.3);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

.lesson-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 10px;
}

.malik-companion-widget {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-bottom: 16px;
}

.malik-figure {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  object-fit: cover;
  border: 3px solid #0284C7;
  box-shadow: 0 6px 12px rgba(2, 132, 199, 0.25);
  flex-shrink: 0;
}

.target-equation-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: var(--font-size-equation);
  font-weight: 800;
  background: #FFFFFF;
  padding: 16px 40px;
  border-radius: var(--radius-card);
  border: 3px solid var(--color-border-bold);
  box-shadow: var(--shadow-tactile-card);
  margin-bottom: 24px;
}

.missing-box {
  min-width: 60px;
  height: 60px;
  border-radius: 16px;
  border: 3px dashed #F59E0B;
  background: #FFFBEB;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #D97706;
  font-size: 32px;
  font-weight: 800;
  padding: 0 10px;
}

.missing-box.filled {
  border-style: solid;
  border-color: #0D9488;
  background: #CCFBF1;
  color: #0F766E;
}

/* Ten-Frame Interactive Grid */
.ten-frame-grid {
  display: grid;
  grid-template-columns: repeat(5, 76px);
  grid-template-rows: repeat(2, 76px);
  gap: 10px;
  background: #FFFFFF;
  padding: 16px;
  border-radius: 24px;
  border: 4px solid #0F172A;
  box-shadow: 0 10px 0 #0F172A;
  margin-bottom: 20px;
}

.ten-frame-slot {
  border: 2px dashed #CBD5E1;
  border-radius: 16px;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.ten-frame-slot.highlight {
  border-color: #38BDF8;
  background: #F0F9FF;
}

.counter-token {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 4px 6px rgba(0,0,0,0.15);
  animation: popIn 0.2s ease;
}

.counter-token.red {
  background: radial-gradient(circle at 30% 30%, #FB7185 0%, #E11D48 100%);
}

.counter-token.blue {
  background: radial-gradient(circle at 30% 30%, #38BDF8 0%, #0284C7 100%);
}

@keyframes popIn {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Number Line Interactive Engine */
.number-line-container {
  width: 100%;
  max-width: 720px;
  background: #FFF;
  border-radius: 20px;
  border: 3px solid var(--color-border-bold);
  box-shadow: var(--shadow-tactile-card);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.nl-track {
  position: relative;
  width: 100%;
  height: 12px;
  background: #0F172A;
  border-radius: 6px;
  margin: 40px 0 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nl-tick {
  position: relative;
  width: 3px;
  height: 24px;
  background: #0F172A;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.nl-label {
  position: absolute;
  top: 28px;
  font-weight: 800;
  font-size: 15px;
  color: #0F172A;
}

.nl-frog {
  position: absolute;
  top: -46px;
  font-size: 32px;
  transform: translateX(-50%);
  transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

/* ==========================================================================
   MATH LAB SANDBOX & BALANCE SCALE
   ========================================================================== */
.lab-toolbar {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  overflow-x: auto;
  max-width: 900px;
  margin: 0 auto 16px auto;
  width: 100%;
}

.tool-tab {
  background: #FFFFFF;
  border: 2px solid var(--color-border-bold);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.tool-tab.active {
  background: #8B5CF6;
  color: #FFF;
  border-color: #6D28D9;
  box-shadow: 0 4px 0 #6D28D9;
}

.sandbox-stage {
  flex: 1;
  background: #FFFFFF;
  border-radius: 28px;
  border: 3px solid var(--color-border-bold);
  box-shadow: var(--shadow-tactile-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

.scale-structure {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 20px 0;
  position: relative;
}

.scale-beam {
  width: 440px;
  height: 16px;
  background: #0F172A;
  border-radius: 8px;
  position: relative;
  display: flex;
  justify-content: space-between;
  transform-origin: center center;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 0 #334155;
}

.scale-fulcrum {
  width: 0;
  height: 0;
  border-left: 28px solid transparent;
  border-right: 28px solid transparent;
  border-bottom: 56px solid #475569;
  margin-top: -8px;
}

.scale-pan-container {
  position: absolute;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scale-pan-left { left: 16px; }
.scale-pan-right { right: 16px; }

.scale-string {
  width: 3px;
  height: 50px;
  background: #94A3B8;
}

.scale-tray {
  width: 110px;
  min-height: 48px;
  background: #FFFFFF;
  border: 3px solid #0F172A;
  border-radius: 12px 12px 24px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.weight-block {
  background: #8B5CF6;
  color: #FFF;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 2px 0 #6D28D9;
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal-card {
  background: #FFF;
  border-radius: 28px;
  padding: 28px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: scaleUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE LAYOUTS & ACCESSIBILITY
   ========================================================================== */
@media (max-width: 900px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
  .hero-content {
    max-width: 68%;
  }
  .hero-malik-img {
    width: 130px;
    height: 130px;
    right: 12px;
    bottom: 12px;
  }
  .worlds-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .app-topbar {
    padding: 8px 12px;
  }
  .profile-level {
    display: none;
  }
  .currencies-group {
    gap: 6px;
  }
  .currency-badge {
    padding: 4px 10px;
    font-size: 13px;
  }
  .worlds-grid {
    grid-template-columns: 1fr;
  }
  .hero-content {
    max-width: 100%;
  }
  .hero-malik-img {
    display: none;
  }
  .ten-frame-grid {
    grid-template-columns: repeat(5, 54px);
    grid-template-rows: repeat(2, 54px);
  }
  .counter-token {
    width: 40px;
    height: 40px;
  }
  .scale-beam {
    width: 320px;
  }
}

/* High Contrast Mode */
body.high-contrast {
  --color-canvas-bg: #000000;
  --color-surface-card: #121212;
  --color-text-main: #FFFFFF;
  --color-text-muted: #E2E8F0;
  --color-border-subtle: #475569;
  --color-border-bold: #94A3B8;
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body.reduced-motion * {
  animation: none !important;
  transition: none !important;
}
