/**
 * ============================================================================
 * WORD SAFARI — Phonics Bubble & Letter Tracks
 * Modern Safari Clay & Glassmorphic UI Design System
 * 
 * Built strictly with pure CSS3. Zero external frameworks, zero CDNs.
 * 100% Offline-safe. Strict Zero-Scroll architecture across all screens & modals.
 * Exact Hex Flow Mobile Sizing & Responsive Stage Architecture.
 * ============================================================================
 */

:root {
  /* Warm Safari & Earth Color Palette */
  --bg-deep: #140d07;
  --bg-surface: rgba(36, 23, 14, 0.88);
  --bg-surface-elevated: rgba(56, 36, 20, 0.92);
  --bg-card-glass: rgba(30, 19, 11, 0.76);

  --border-gold-subtle: rgba(251, 191, 36, 0.28);
  --border-gold-focus: #fbbf24;
  --border-wood: #78350f;

  --accent-gold: #fbbf24;
  --accent-amber: #f59e0b;
  --accent-orange: #d97706;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.4);
  --accent-sky: #38bdf8;

  --text-main: #ffffff;
  --text-cream: #fef3c7;
  --text-warm-sub: #fde68a;
  --text-muted: #d1d5db;
  --text-dim: #9ca3af;

  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
  background-color: var(--bg-deep);
  font-family: var(--font-main);
  color: var(--text-main);
  touch-action: manipulation;
}

#app-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 860px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

/* ==========================================================================
   SCREENS (STATE-DRIVEN FULL VIEWPORTS)
   ========================================================================== */

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 10;
}

.screen.active {
  display: flex;
}

/* ==========================================================================
   SCREEN 1: PRELOADER (WARM SAFARI SUNRISE)
   ========================================================================== */

#screen-loading {
  background: radial-gradient(circle at 50% 40%, #78350f 0%, #291508 55%, #140d07 100%);
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.35s ease;
}

#screen-loading.fade-out {
  opacity: 0;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.loading-logo-box {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  padding: 3px;
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.6);
  animation: pulse-glow 2s infinite ease-in-out;
}

.loading-logo-box-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo-box img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.loading-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

.loading-subtitle {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.loading-bar-wrap {
  width: 210px;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 6px;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.loading-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  animation: load-slide 1.0s ease-out;
}

@keyframes load-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.5)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 28px rgba(245, 158, 11, 0.85)); }
}

/* ==========================================================================
   SCREEN 2: MAIN MENU (SIMPLE, UNIQUE, ATTRACTIVE & MODERN)
   ========================================================================== */

#screen-menu {
  background: radial-gradient(circle at 50% 20%, #78350f 0%, #291508 55%, #140d07 100%);
  align-items: center;
  justify-content: space-between;
  padding: clamp(14px, 2.8vh, 26px) 18px clamp(12px, 2.2vh, 20px);
  overflow: hidden;
}

/* Hero Section */
.menu-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(8px, 1.4vh, 12px);
}

.menu-emblem-wrap {
  position: relative;
  width: clamp(82px, 11vh, 98px);
  height: clamp(82px, 11vh, 98px);
}

.menu-emblem-glow {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.55) 0%, rgba(245, 158, 11, 0) 70%);
  animation: emblem-breath 3s infinite ease-in-out;
}

@keyframes emblem-breath {
  0%, 100% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

.menu-logo-card {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  padding: 3.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), 0 0 30px rgba(245, 158, 11, 0.5);
}

.menu-logo-card img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #fef3c7;
}

.menu-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.menu-title {
  font-size: clamp(2.1rem, 4.8vh, 2.65rem);
  font-weight: 900;
  letter-spacing: 2.5px;
  color: #fff;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.75);
  background: linear-gradient(180deg, #ffffff 0%, #fef3c7 75%, #fde68a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.menu-tagline {
  font-size: clamp(0.84rem, 1.8vh, 0.98rem);
  font-weight: 900;
  color: var(--accent-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  margin-top: 2px;
}

.menu-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid var(--border-gold-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-warm-sub);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.badge-pill-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* ==========================================================================
   MENU ACTIONS (EXACTLY 5 BUTTONS: HERO PLAY + BALANCED 2x2 DECK)
   ========================================================================== */

.menu-action-container {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Common button base */
.menu-btn {
  border: none;
  cursor: pointer;
  outline: none;
  font-family: var(--font-main);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

/* 1. Hero Action: START SAFARI (ENLARGED & PROMINENT) */
.menu-btn-hero {
  width: 100%;
  height: clamp(60px, 8.2vh, 68px);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  border-radius: var(--radius-lg);
  border: 2.2px solid #fef3c7;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  box-shadow: 0 6px 0 #92400e, 0 14px 28px rgba(245, 158, 11, 0.5);
}

.menu-btn-hero:hover {
  filter: brightness(1.08);
}

.menu-btn-hero:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #92400e, 0 6px 14px rgba(245, 158, 11, 0.35);
}

.hero-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-icon-box .btn-icon-img {
  width: 26px;
  height: 26px;
}

.btn-hero-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.btn-hero-title {
  font-size: 1.32rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
  line-height: 1.15;
}

.btn-hero-sub {
  font-size: 0.78rem;
  font-weight: 800;
  color: #fffbeb;
  opacity: 0.95;
  letter-spacing: 0.2px;
}

.btn-hero-arrow-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-hero-arrow-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* 2x2 Modern Grid for Remaining 4 Buttons (ENLARGED & HIGH CONTRAST) */
.menu-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.menu-card-btn {
  height: clamp(56px, 7.5vh, 64px);
  background: var(--bg-surface);
  border: 2px solid var(--border-gold-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.menu-card-btn:hover {
  border-color: var(--accent-gold);
  background: var(--bg-surface-elevated);
}

.menu-card-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Styled icon box container behind icons on buttons (User Directive) */
.btn-icon-box {
  width: 38px;
  height: 38px;
  background: rgba(251, 191, 36, 0.15);
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.card-btn-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
}

.card-btn-title {
  font-size: 1.02rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.15;
  letter-spacing: 0.3px;
}

.card-btn-sub {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.menu-footer {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-cream);
  text-align: center;
  letter-spacing: 0.8px;
  opacity: 0.9;
}

/* ==========================================================================
   SCREEN 3: GAME STAGE & FLOATING HUD (HEX FLOW ALIGNED)
   ========================================================================== */

#screen-game {
  background: #0f172a;
}

/* Floating Glass Capsule HUD */
.game-hud {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  z-index: 30;
  pointer-events: auto;
}

.hud-capsule {
  height: 44px;
  background: rgba(20, 13, 7, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 6px;
}

.hud-left-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-level-pill {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid #fef3c7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.hud-chapter-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-cream);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.hud-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-circle-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1.2px solid rgba(251, 191, 36, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.hud-circle-btn:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: var(--accent-gold);
}

.hud-circle-btn:active {
  transform: scale(0.92);
}

.hud-circle-btn.hint-btn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(16, 185, 129, 0.3));
}

.hud-circle-btn.levels-btn {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.35), rgba(217, 119, 6, 0.35));
}

.hud-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* Stage Canvas Wrapper (Hex Flow Architecture) */
#canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

/* ==========================================================================
   MODAL OVERLAYS & FULL-HEIGHT SCREENS (STRICT ZERO-SCROLL ARCHITECTURE)
   ========================================================================== */

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(14, 9, 5, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 10px;
  overflow: hidden;
}

.modal-overlay.active {
  display: flex;
}

/* ==========================================================================
   FULL-HEIGHT IMMERSIVE PAGES: LEVEL / PASSPORT, SETTINGS, & GUIDE
   Matches full height of the game board stage architecture (100% Height & Width)
   ========================================================================== */

#modal-levels,
#modal-settings,
#modal-howto {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  background: var(--bg-deep);
}

#modal-levels .modal-card,
#modal-settings .modal-card,
#modal-howto .modal-card {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100%;
  margin: 0 auto;
  border-radius: 0;
  border: none;
  padding: clamp(14px, 2.5vh, 22px) 16px clamp(12px, 2vh, 18px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: none;
  background: radial-gradient(circle at 50% 15%, #5c280b 0%, #291508 55%, #140d07 100%);
  text-align: center;
  overflow: hidden;
}

/* Header row with title & close button */
.page-header-row,
.passport-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.modal-close-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.2px solid rgba(251, 191, 36, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
  flex-shrink: 0;
}

.modal-close-icon-btn:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: var(--accent-gold);
}

.modal-close-icon-btn:active {
  transform: scale(0.92);
}

.modal-close-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* Standard In-Game Centered Popups (Win, Pause, Hint) */
.modal-card {
  width: 100%;
  max-width: 380px;
  max-height: 94vh;
  background: linear-gradient(165deg, rgba(34, 21, 13, 0.95) 0%, rgba(18, 11, 6, 0.98) 100%);
  border: 2px solid rgba(251, 191, 36, 0.5);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(245, 158, 11, 0.25);
  display: flex;
  flex-direction: column;
  text-align: center;
  gap: 10px;
  overflow: hidden;
}

.modal-title {
  font-size: clamp(1.4rem, 3.2vh, 1.8rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: 1.5px;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-cream);
  line-height: 1.38;
}

/* Animal Preview Badge for Win & Hint Modals */
.modal-animal-preview {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  border-radius: 50%;
  background: #fef3c7;
  border: 3px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.4);
  overflow: hidden;
}

.modal-animal-preview img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.win-animal-preview {
  animation: bounce-win 0.8s infinite alternate ease-in-out;
}

@keyframes bounce-win {
  from { transform: translateY(0); }
  to { transform: translateY(-7px); }
}

.win-stars-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
}

.win-star-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.85));
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-btn {
  width: 100%;
  height: 46px;
  border-radius: var(--radius-md);
  font-size: 0.98rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid var(--border-gold-subtle);
  background: rgba(56, 36, 20, 0.85);
  color: #fff;
  transition: all 0.14s ease;
}

.modal-btn:hover {
  border-color: var(--accent-gold);
  background: rgba(78, 50, 28, 0.95);
}

.modal-btn.primary {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  border: 2px solid #fef3c7;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 5px 16px rgba(245, 158, 11, 0.45);
}

.modal-btn.primary:hover {
  filter: brightness(1.1);
}

/* ==========================================================================
   PAGE: EXPLORER GUIDE (FULL-HEIGHT 100% VIEWPORT)
   ========================================================================= */

#modal-howto .modal-title {
  color: var(--accent-gold);
  flex-shrink: 0;
}

#modal-howto .howto-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 8px;
  margin: 8px 0;
  text-align: left;
}

#modal-howto .howto-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(45, 29, 17, 0.9);
  padding: clamp(8px, 1.4vh, 12px) 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-gold-subtle);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

#modal-howto .howto-icon-box {
  width: 42px;
  height: 42px;
  background: rgba(251, 191, 36, 0.15);
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#modal-howto .howto-icon-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

#modal-howto .howto-text {
  font-size: clamp(0.82rem, 1.6vh, 0.92rem);
  line-height: 1.42;
  color: #f3f4f6;
}

#modal-howto .howto-text strong {
  color: var(--accent-gold);
}

#modal-howto .btn-close-modal {
  height: 48px;
  font-size: 1.05rem;
  font-weight: 900;
  flex-shrink: 0;
}

/* ==========================================================================
   PAGE: SAFARI PASSPORT (50 LEVELS FULL-HEIGHT VIEWPORT WITH PAGINATION)
   ========================================================================== */

#modal-levels .passport-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#modal-levels .passport-header .modal-title {
  color: var(--accent-gold);
}

#modal-levels .passport-counter {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-warm-sub);
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-gold-subtle);
}

/* Chapter Pagination Navigation Bar */
#modal-levels .chapter-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid var(--border-gold-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  gap: 10px;
  flex-shrink: 0;
}

#modal-levels .chapter-nav-btn {
  width: 36px;
  height: 36px;
  background: rgba(56, 36, 20, 0.95);
  border: 1.5px solid var(--border-gold-subtle);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.14s ease;
  flex-shrink: 0;
}

#modal-levels .chapter-nav-btn:hover:not(:disabled) {
  border-color: var(--accent-gold);
  background: rgba(80, 52, 28, 0.95);
}

#modal-levels .chapter-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#modal-levels .chapter-arrow-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

#modal-levels .chapter-info-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

#modal-levels .chapter-title-text {
  font-size: 0.96rem;
  font-weight: 900;
  color: var(--accent-gold);
}

#modal-levels .chapter-range-text {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Chapter Selector Quick Pills */
#modal-levels .chapter-pills-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}

#modal-levels .chapter-pill-btn {
  flex: 1;
  height: 32px;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(36, 23, 14, 0.85);
  border: 1.5px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.14s ease;
}

#modal-levels .chapter-pill-btn:hover {
  border-color: var(--accent-gold);
  color: #fff;
}

#modal-levels .chapter-pill-btn.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fef3c7;
  color: #fff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.55);
}

/* Compact 10-Level Cards Grid (Full-Height Flex Fit with ZERO Scrolling) */
#modal-levels .levels-grid-compact {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
  margin: 6px 0;
  align-content: stretch;
}

.compact-lvl-btn {
  width: 100%;
  height: 100%;
  max-height: 110px;
  min-height: 70px;
  background: rgba(45, 29, 17, 0.92);
  border: 1.8px solid var(--border-gold-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 3px 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.14s ease;
}

.compact-lvl-btn.unlocked:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.35);
}

.compact-lvl-btn.stamped {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(45, 29, 17, 0.95));
}

.compact-lvl-btn.locked {
  opacity: 0.38;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
}

.compact-lvl-badge {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-dim);
  line-height: 1;
}

.compact-lvl-img-box {
  width: clamp(34px, 5.5vh, 46px);
  height: clamp(34px, 5.5vh, 46px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  overflow: hidden;
}

.compact-lvl-img {
  width: clamp(30px, 4.8vh, 40px);
  height: clamp(30px, 4.8vh, 40px);
  object-fit: contain;
}

.compact-lvl-lock {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.7;
}

.compact-lvl-name {
  font-size: 0.68rem;
  font-weight: 900;
  color: #fef08a;
  letter-spacing: 0.3px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92%;
}

.compact-lvl-stars {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
  height: 10px;
}

.compact-lvl-star-img {
  width: 10px;
  height: 10px;
  object-fit: contain;
}

#modal-levels .btn-close-modal {
  height: 48px;
  font-size: 1.05rem;
  font-weight: 900;
  flex-shrink: 0;
}

.passport-actions-row {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;
}

.passport-actions-row .modal-btn {
  flex: 1;
  height: clamp(38px, 5.5vh, 46px);
  font-size: clamp(0.85rem, 1.8vh, 0.95rem);
}

/* ==========================================================================
   PAGE: SETTINGS (FULL-HEIGHT 100% VIEWPORT)
   ========================================================================== */

#modal-settings .modal-title {
  color: var(--accent-gold);
  flex-shrink: 0;
}

#modal-settings .settings-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(10px, 2vh, 16px);
  margin: 10px 0;
  text-align: left;
}

#modal-settings .setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(45, 29, 17, 0.9);
  padding: clamp(10px, 1.8vh, 14px) 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-gold-subtle);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

#modal-settings .setting-info {
  display: flex;
  flex-direction: column;
}

#modal-settings .setting-title {
  font-size: clamp(0.95rem, 1.8vh, 1.05rem);
  font-weight: 800;
  color: #fff;
}

#modal-settings .setting-desc {
  font-size: clamp(0.72rem, 1.4vh, 0.8rem);
  font-weight: 600;
  color: var(--text-warm-sub);
}

.toggle-switch {
  width: 50px;
  height: 28px;
  background: #475569;
  border-radius: var(--radius-pill);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-switch.active {
  background: var(--accent-gold);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle-switch.active .toggle-knob {
  transform: translateX(22px);
}

#modal-settings #btnResetProgress {
  height: 44px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

#modal-settings .btn-close-modal {
  height: 48px;
  font-size: 1.05rem;
  font-weight: 900;
  flex-shrink: 0;
}
