/* 
  KidsIsland UI/UX Pro Max Design System v2
  Style: Magical Island Adventure — Warm Dreamy Glassmorphism
  Typography: Plus Jakarta Sans (Headings), Quicksand (Body & Labels)
  Theme: Sunset coral × Island teal × Golden sand
*/

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;700;800&family=Quicksand:wght@500;600;700&display=swap');

:root {
  /* === Magical Island Color Palette === */
  --hue-primary: 172;     /* Island Teal  */
  --hue-secondary: 16;     /* Sunset Coral */
  --hue-tertiary: 42;      /* Golden Sand */
  --hue-success: 158;      /* Mint Green */
  --hue-danger: 350;       /* Rose Pink */

  /* Light Theme — Warm Cream Base */
  --bg-app: #fdf6ee;
  --bg-glass: rgba(255, 252, 247, 0.72);
  --bg-glass-strong: rgba(255, 252, 247, 0.90);
  --bg-card: rgba(255, 250, 243, 0.95);
  --accent-teal: hsl(172, 55%, 45%);
  --border-glass: rgba(255, 255, 255, 0.85);
  --border-subtle: rgba(215, 199, 175, 0.35);
  --border-glow: rgba(255, 180, 120, 0.25);

  --text-main: #3d2817;
  --text-muted: #8b6f57;
  --text-inverse: #ffffff;

  --color-primary: hsl(var(--hue-primary), 55%, 45%);
  --color-primary-hover: hsl(var(--hue-primary), 55%, 38%);
  --color-primary-light: hsl(var(--hue-primary), 70%, 94%);

  --color-secondary: hsl(var(--hue-secondary), 90%, 62%);
  --color-secondary-hover: hsl(var(--hue-secondary), 90%, 54%);
  --color-secondary-light: hsl(var(--hue-secondary), 100%, 95%);

  --color-tertiary: hsl(var(--hue-tertiary), 95%, 55%);
  --color-tertiary-light: hsl(var(--hue-tertiary), 100%, 93%);

  --color-success: hsl(var(--hue-success), 60%, 45%);
  --color-danger: hsl(var(--hue-danger), 75%, 60%);

  /* Accent Colors for Buttons & Highlights */
  --accent-coral: hsl(16, 90%, 62%);
  --accent-amber: hsl(42, 95%, 55%);

  /* Warm Island Ambient Shadows */
  --shadow-sm: 0 4px 8px -2px rgba(139, 90, 43, 0.08), 0 2px 4px -1px rgba(139, 90, 43, 0.04);
  --shadow-md: 0 14px 30px -8px rgba(180, 100, 50, 0.12), 0 6px 12px -4px rgba(180, 100, 50, 0.06);
  --shadow-lg: 0 28px 50px -12px rgba(180, 100, 50, 0.18), 0 12px 20px -6px rgba(180, 100, 50, 0.08);
  --shadow-glow: 0 0 30px rgba(255, 170, 100, 0.2), 0 0 60px rgba(255, 140, 80, 0.08);
  --shadow-3d-btn: 0 6px 0 0 hsl(var(--hue-primary), 55%, 32%), 0 14px 25px rgba(30, 120, 110, 0.25);
  --shadow-3d-sec: 0 6px 0 0 hsl(var(--hue-secondary), 85%, 45%), 0 14px 25px rgba(240, 110, 60, 0.28);

  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 36px;
  --radius-full: 9999px;

  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-soft: 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg-app: #1a1510;
  --bg-glass: rgba(40, 32, 28, 0.78);
  --bg-glass-strong: rgba(40, 32, 28, 0.92);
  --bg-card: rgba(50, 40, 35, 0.85);
  --accent-teal: hsl(172, 50%, 55%);
  --border-glass: rgba(80, 65, 55, 0.6);
  --border-subtle: rgba(80, 65, 55, 0.5);
  --border-glow: rgba(255, 150, 80, 0.2);

  --text-main: #f5ede3;
  --text-muted: #a89480;
  --text-inverse: #1a1510;

  --color-primary: hsl(172, 50%, 55%);
  --color-primary-hover: hsl(172, 50%, 48%);
  --color-primary-light: rgba(60, 160, 150, 0.18);
  --color-secondary: hsl(16, 85%, 68%);
  --color-secondary-hover: hsl(16, 85%, 60%);
  --color-secondary-light: rgba(250, 120, 70, 0.18);
  --color-tertiary-light: rgba(250, 200, 80, 0.18);

  /* Accent Colors for Buttons & Highlights */
  --accent-coral: hsl(16, 85%, 68%);
  --accent-amber: hsl(42, 90%, 60%);
}

/* Reset & Global Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* Remove grey flash box on iOS tap */
}

body {
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100dvh;
  line-height: 1.6;
  overflow: hidden;
  touch-action: manipulation; /* Eliminate 300ms tap delay on mobile devices */
  background-image: 
    radial-gradient(ellipse at 5% 0%, rgba(255, 140, 80, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 95% 10%, rgba(80, 180, 170, 0.15) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 200, 100, 0.12) 0%, transparent 55%),
    radial-gradient(circle at 20% 60%, rgba(255, 180, 120, 0.08) 0%, transparent 30%);
  background-attachment: fixed;
  position: relative;
}

/* Subtle grain texture overlay for tactile warmth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

button, .vocab-card, .level-filter-btn, .checkin-day-card {
  -webkit-user-select: none;
  user-select: none; /* Prevent text selection popups when long pressing buttons on mobile */
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ============ CHILDLIKE ENHANCEMENTS ============ */

/* Gentle bounce on nav buttons for playful feel */
.nav-tab-btn {
  transition: transform var(--transition-bounce), background var(--transition-fast), color var(--transition-fast);
}
.nav-tab-btn:active {
  transform: scale(0.92);
}

/* Softer, bouncier card hover — childlike delight */
.stat-card-pill,
.quick-action-card,
.level-filter-btn {
  transition: transform var(--transition-bounce), box-shadow var(--transition-fast);
}
.stat-card-pill:hover,
.quick-action-card:hover {
  transform: translateY(-3px) scale(1.02);
}
.stat-card-pill:active,
.quick-action-card:active {
  transform: translateY(0) scale(0.97);
}

/* Soften all cards with slightly more rounded corners */
.hero-banner,
.stat-card-pill,
.quick-action-card {
  border-radius: var(--radius-md);
}

/* Playful dotted borders on focus for accessibility */
.nav-tab-btn:focus-visible,
.quick-action-card:focus-visible {
  outline: 3px dashed var(--accent-coral);
  outline-offset: 3px;
}

/* App Container */
#app {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100dvh;
  box-sizing: border-box;
}

/* ============ PAGE-VIEWPORT ARCHITECTURE (non-scrolling page switch) ============ */
.page-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.tab-section {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: transform, opacity, filter;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.tab-section.page-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.tab-section.page-exiting {
  z-index: 1;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.page-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 4px 4px 24px;
  min-height: 100%;
  box-sizing: border-box;
}

.page-section-block {
  margin-top: 8px;
}

/* ============ PROFILE PAGE STYLES ============ */
.profile-hero-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px 28px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 30px rgba(180, 100, 50, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  gap: 8px;
}

.profile-avatar-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9a5c, #ffcf4a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 6px 20px rgba(255, 154, 92, 0.3);
  border: 3px solid white;
}

.profile-level-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2.5px dashed var(--accent-coral);
  opacity: 0.4;
  animation: spinRing 12s linear infinite;
}

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

.profile-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 4px 0 0;
}

.profile-subtitle {
  font-size: 0.82rem;
  color: var(--accent-coral);
  font-weight: 600;
  opacity: 0.85;
}

.profile-stats-row {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  width: 100%;
  justify-content: center;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.profile-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
}

.profile-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Profile Section Cards */
.profile-section-card {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 4px 16px rgba(180, 100, 50, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.profile-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Profile Auth */
.profile-auth-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.profile-btn-google {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  background: white;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  justify-content: center;
}

.profile-btn-google:hover {
  border-color: var(--accent-coral);
  box-shadow: 0 4px 12px rgba(255, 120, 50, 0.15);
  transform: translateY(-1px);
}

.profile-auth-loggedin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-auth-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-auth-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9a5c, #ffcf4a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.profile-auth-user-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.profile-auth-user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.profile-btn-logout {
  padding: 8px 14px;
  background: rgba(220, 60, 60, 0.08);
  border: 1px solid rgba(220, 60, 60, 0.2);
  border-radius: var(--radius-sm);
  color: #dc3c3c;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.profile-btn-logout:hover {
  background: rgba(220, 60, 60, 0.15);
  transform: translateY(-1px);
}

/* Profile Settings */
.profile-settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.profile-setting-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-setting-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.profile-setting-control {
  display: flex;
  gap: 6px;
  align-items: center;
}

.profile-name-input {
  padding: 6px 12px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  width: 120px;
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  transition: border-color 0.2s;
}

.profile-name-input:focus {
  outline: none;
  border-color: var(--accent-coral);
  box-shadow: 0 0 0 3px rgba(255, 120, 50, 0.1);
}

.profile-save-name-btn {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.profile-save-name-btn:hover {
  border-color: var(--accent-teal);
  background: rgba(80, 180, 170, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(80, 180, 170, 0.18);
  color: hsl(172, 55%, 32%);
}

.profile-save-name-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s ease;
}

.profile-save-name-btn:hover::before {
  left: 100%;
}

.profile-save-name-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(80, 180, 170, 0.2);
}

.profile-save-name-btn.saved-pulse {
  animation: savedPulse 0.5s ease;
}

@keyframes savedPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Dark mode for save button */
[data-theme="dark"] .profile-save-name-btn {
  background: rgba(40, 32, 28, 0.7);
  border-color: rgba(80, 65, 55, 0.5);
  color: var(--text-main);
}

[data-theme="dark"] .profile-save-name-btn:hover {
  background: rgba(80, 180, 170, 0.15);
  color: hsl(172, 55%, 65%);
}

.profile-lang-btn {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.profile-lang-btn:hover {
  border-color: var(--accent-teal);
  background: rgba(80, 180, 170, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(80, 180, 170, 0.18);
  color: hsl(172, 55%, 32%);
}

.profile-lang-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s ease;
}

.profile-lang-btn:hover::before {
  left: 100%;
}

.profile-lang-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(80, 180, 170, 0.2);
}

.profile-lang-btn.active {
  background: linear-gradient(135deg, var(--accent-teal), hsl(172, 50%, 50%));
  color: white;
  border-color: transparent;
  box-shadow: 
    0 6px 20px rgba(80, 180, 170, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.profile-lang-btn.active::before {
  display: none;
}

/* Dark mode adjustments for language buttons */
[data-theme="dark"] .profile-lang-btn {
  background: rgba(40, 32, 28, 0.7);
  border-color: rgba(80, 65, 55, 0.5);
  color: var(--text-main);
}

[data-theme="dark"] .profile-lang-btn:hover {
  background: rgba(80, 180, 170, 0.15);
  color: hsl(172, 55%, 65%);
}

/* Speech Speed & Theme buttons — same visual language as Language Base */
.profile-speed-btn,
.profile-theme-btn {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.profile-speed-btn:hover,
.profile-theme-btn:hover {
  border-color: var(--accent-teal);
  background: rgba(80, 180, 170, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(80, 180, 170, 0.18);
  color: hsl(172, 55%, 32%);
}

.profile-speed-btn::before,
.profile-theme-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s ease;
}

.profile-speed-btn:hover::before,
.profile-theme-btn:hover::before {
  left: 100%;
}

.profile-speed-btn:active,
.profile-theme-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(80, 180, 170, 0.2);
}

[data-theme="dark"] .profile-speed-btn,
[data-theme="dark"] .profile-theme-btn {
  background: rgba(40, 32, 28, 0.7);
  border-color: rgba(80, 65, 55, 0.5);
  color: var(--text-main);
}

[data-theme="dark"] .profile-speed-btn:hover,
[data-theme="dark"] .profile-theme-btn:hover {
  background: rgba(80, 180, 170, 0.15);
  color: hsl(172, 55%, 65%);
}

/* Profile Badges Grid */
.profile-badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.profile-badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  gap: 6px;
}

.profile-badge-item.unlocked {
  background: linear-gradient(135deg, rgba(255, 200, 100, 0.15), rgba(255, 154, 92, 0.1));
  border-color: rgba(255, 180, 80, 0.3);
  box-shadow: 0 3px 12px rgba(255, 154, 92, 0.12);
}

.profile-badge-item.locked {
  opacity: 0.55;
}

.profile-badge-emoji {
  font-size: 1.5rem;
}

.profile-badge-name {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
}

/* Profile Info Card */
.profile-info-card {
  text-align: center;
  padding: 16px;
}

.profile-info-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 3px 0;
}

/* Avatar Edit Badge */
.profile-avatar-edit-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-coral), var(--accent-amber));
  border: 2.5px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 120, 50, 0.35);
  transition: transform 0.2s ease;
  z-index: 3;
  line-height: 1;
}

.profile-avatar-edit-badge:hover {
  transform: scale(1.15) rotate(-10deg);
}

.profile-avatar {
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.profile-avatar:hover {
  transform: scale(1.08) rotate(-3deg);
}

.profile-avatar:active {
  transform: scale(0.95);
}

/* Avatar name shimmer on update */
.profile-name {
  background-image: linear-gradient(
    90deg,
    var(--text-main) 0%,
    var(--text-main) 40%,
    var(--accent-amber) 50%,
    var(--accent-coral) 60%,
    var(--text-main) 70%,
    var(--text-main) 100%
  );
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.profile-name.name-shimmer {
  animation: nameShimmerSweep 1.4s ease-in-out;
}

@keyframes nameShimmerSweep {
  0% { background-position: 150% 0; }
  100% { background-position: -150% 0; }
}

/* Avatar Picker Modal */
.avatar-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 9600;
  background: rgba(20, 15, 10, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.avatar-picker-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.avatar-picker-card {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(40, 20, 10, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transform: scale(0.8) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.avatar-picker-overlay.active .avatar-picker-card {
  transform: scale(1) translateY(0);
}

.avatar-picker-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(120, 80, 60, 0.1);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.avatar-picker-close:hover {
  background: rgba(220, 60, 60, 0.15);
  color: #dc3c3c;
  transform: rotate(90deg);
}

.avatar-picker-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.avatar-picker-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

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

.avatar-picker-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-picker-item:hover {
  transform: scale(1.15) rotate(8deg);
  border-color: var(--accent-coral);
  box-shadow: 0 4px 14px rgba(255, 120, 50, 0.25);
}

.avatar-picker-item.selected {
  background: linear-gradient(135deg, rgba(255, 154, 92, 0.2), rgba(255, 207, 74, 0.15));
  border-color: var(--accent-coral);
  box-shadow: 0 4px 14px rgba(255, 120, 50, 0.3);
  transform: scale(1.1);
}

.avatar-picker-item:active {
  transform: scale(0.9);
}

/* ============ CINEMATIC PAGE TRANSITION OVERLAY ============ */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  pointer-events: none;
  opacity: 0;
}

.pto-wipe {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  will-change: height, top;
}

.pto-wipe-1 {
  top: 0;
  background: linear-gradient(135deg, hsl(172, 55%, 45%), hsl(16, 90%, 62%));
  z-index: 1;
}

.pto-wipe-2 {
  bottom: 0;
  background: linear-gradient(135deg, hsl(42, 95%, 55%), hsl(172, 55%, 45%));
  z-index: 2;
}

.pto-mascot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 72px;
  z-index: 3;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.3));
  will-change: transform, opacity;
}

/* ============ HOME QUICK-ACTION CARDS ============ */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.quick-action-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 28px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.quick-action-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition-soft);
  z-index: 0;
}

.quick-action-card.qa-cards::before {
  background: linear-gradient(135deg, rgba(80, 180, 170, 0.12), rgba(80, 180, 170, 0.04));
}

.quick-action-card.qa-quiz::before {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(234, 179, 8, 0.06));
}

.quick-action-card:hover {
  transform: translateY(-6px) scale(1.01);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-lg);
}

.quick-action-card.qa-cards:hover { border-color: hsl(172, 55%, 45%); }
.quick-action-card.qa-quiz:hover { border-color: hsl(16, 90%, 62%); }

.quick-action-card:hover::before { opacity: 1; }

.quick-action-card:active {
  transform: translateY(-2px) scale(0.99);
}

.qa-emoji {
  font-size: 56px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.15));
  position: relative;
  z-index: 1;
  transition: transform var(--transition-bounce);
}

.quick-action-card:hover .qa-emoji {
  transform: scale(1.15) rotate(-8deg);
}

.qa-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.qa-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.qa-desc {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.5;
}

.qa-arrow {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-primary);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform var(--transition-bounce);
}

.quick-action-card.qa-quiz .qa-arrow { color: var(--color-secondary); }
.quick-action-card:hover .qa-arrow { transform: translateX(8px) scale(1.2); }

/* ============ VOCAB TOOLBAR ============ */
.vocab-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.vocab-search-input {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  border-radius: var(--radius-full);
}

.category-pills-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tab-section scrollbar styling */
.tab-section::-webkit-scrollbar {
  width: 6px;
}
.tab-section::-webkit-scrollbar-track {
  background: transparent;
}
.tab-section::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}
.tab-section::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Glassmorphism Navbar — Warm Island Edition */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 8px 30px rgba(180, 100, 50, 0.1),
    0 2px 6px rgba(180, 100, 50, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 46px;
  height: 46px;
  background: 
    linear-gradient(135deg, hsl(172, 55%, 50%) 0%, hsl(16, 90%, 62%) 100%);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 24px;
  box-shadow: 
    0 6px 16px rgba(240, 120, 60, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: rotate(-4deg);
  transition: transform var(--transition-bounce), box-shadow var(--transition-soft);
  position: relative;
  overflow: hidden;
}

.brand-icon::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: skewX(-15deg);
  transition: left 0.6s ease;
}

.brand-logo:hover .brand-icon {
  transform: rotate(6deg) scale(1.08);
  box-shadow: 0 8px 22px rgba(240, 120, 60, 0.4);
}

.brand-logo:hover .brand-icon::after {
  left: 120%;
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  font-family: 'Quicksand', 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, hsl(172, 55%, 42%), hsl(16, 85%, 50%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--color-tertiary-light);
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  -webkit-text-fill-color: initial;
}

/* Nav Actions & Version Toggle */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-selector-container {
  position: relative;
}

.version-pill-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.version-pill-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.checkin-btn-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: none;
  background: linear-gradient(135deg, #f97316, #eab308);
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  transition: transform var(--transition-bounce);
}

.checkin-btn-nav:hover {
  transform: scale(1.05);
}

.version-flag {
  font-size: 18px;
  line-height: 1;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--color-primary-light);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #eab308);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--transition-bounce);
}

.theme-toggle-btn:hover {
  transform: scale(1.1) rotate(15deg);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-glass);
  padding: 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
}

.nav-tab-btn {
  padding: 10px 22px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-bounce);
}

.nav-tab-btn.active {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(26, 88, 183, 0.3);
}

.nav-tab-btn:hover:not(.active) {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

/* LOGIN / WELCOME GATEWAY MODAL */
.gateway-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.gateway-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.gateway-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-glass-strong);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* C4: transform/transition removed - GSAP elastic handles modal animation */
  position: relative;
  overflow: hidden;
}

/* Modal Close Button */
.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-main);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all var(--transition-bounce);
  z-index: 10;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  transform: scale(1.15) rotate(90deg);
}

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

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-container.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-body {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  border: 2px solid var(--color-primary);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}


.gateway-overlay.active .gateway-card {
  /* C4: Removed transform rule - GSAP elastic.out handles entrance */
}

.gateway-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gateway-mascot {
  width: 84px;
  height: 84px;
  background: linear-gradient(135deg, #60a5fa, #f97316);
  border-radius: 28px;
  display: grid;
  place-items: center;
  font-size: 44px;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.35);
  animation: floatMascot 3s ease-in-out infinite;
}

@keyframes floatMascot {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}

.gateway-title {
  font-size: 28px;
  color: var(--text-main);
}

.gateway-subtitle {
  font-size: 15px;
  color: var(--text-muted);
}

/* Region / Language Version Cards inside Gateway */
.version-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.version-option-card {
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-glass);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: all var(--transition-bounce);
  position: relative;
}

.version-option-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-3px);
  background: var(--color-primary-light);
}

.version-option-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.version-option-card.selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: bold;
  font-size: 13px;
  display: grid;
  place-items: center;
}

.option-flag {
  font-size: 32px;
}

.option-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: var(--text-main);
}

.option-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Login Form Elements */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* GOOGLE AUTH BUTTON & DIVIDER */
.btn-google-3d {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-subtle);
  background: white;
  color: #1e293b;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 0 #cbd5e1, 0 10px 15px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-bounce), box-shadow var(--transition-bounce);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-google-3d:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 0 #cbd5e1, 0 14px 20px rgba(0, 0, 0, 0.12);
  background: #f8fafc;
}

.btn-google-3d:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 0 #cbd5e1, 0 4px 8px rgba(0, 0, 0, 0.05);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-field {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-app);
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.btn-primary-3d {
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-full);
  border: none;
  background: linear-gradient(135deg, hsl(16, 90%, 58%) 0%, hsl(16, 85%, 48%) 100%);
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 
    0 6px 0 0 hsl(16, 80%, 40%),
    0 12px 20px rgba(220, 90, 40, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform var(--transition-bounce), box-shadow var(--transition-bounce);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.btn-primary-3d::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-15deg);
  transition: left 0.7s ease;
}

.btn-primary-3d:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 0 0 hsl(16, 80%, 40%),
    0 18px 30px rgba(220, 90, 40, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary-3d:hover::after {
  left: 130%;
}

.btn-primary-3d:active {
  transform: translateY(4px);
  box-shadow: 
    0 2px 0 0 hsl(16, 80%, 40%),
    0 4px 10px rgba(220, 90, 40, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.guest-btn-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-align: center;
  transition: color var(--transition-fast);
}

.guest-btn-link:hover {
  color: var(--color-primary);
}

/* DAILY CHECK-IN REWARDS MODAL */
.checkin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.checkin-day-card {
  background: var(--bg-glass);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  position: relative;
  transition: all var(--transition-bounce);
}

.checkin-day-card.claimed {
  background: rgba(34, 197, 94, 0.12);
  border-color: var(--color-success);
}

.checkin-day-card.claimed::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-success);
  color: white;
  font-size: 11px;
  font-weight: bold;
  display: grid;
  place-items: center;
}

.checkin-day-card.big-reward {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(249, 115, 22, 0.2));
  border-color: var(--color-tertiary);
}

.day-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted);
}

.day-icon {
  font-size: 24px;
}

.day-reward {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--color-secondary);
}

/* LEVEL FILTER TABS */
.level-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.level-filter-btn {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-bounce);
}

.level-filter-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(26, 88, 183, 0.25);
}

.level-filter-btn:hover:not(.active) {
  background: var(--color-primary-light);
  color: var(--text-main);
}

/* LEVEL BADGES ON CARDS */
.level-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.level-badge-beginner {
  background: #dcfce7;
  color: #166534;
}

.level-badge-intermediate {
  background: #dbeafe;
  color: #1e40af;
}

.level-badge-advanced {
  background: #fef3c7;
  color: #92400e;
}

/* HERO SECTION / DASHBOARD — Magical Island Theme */
.hero-banner {
  background: 
    linear-gradient(135deg, rgba(255, 240, 220, 0.85) 0%, rgba(255, 200, 160, 0.7) 100%),
    url('assets/hero-island-panda.jpg');
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 220, 180, 0.6);
  border-radius: calc(var(--radius-lg) + 8px);
  padding: 44px 40px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: center;
  box-shadow: 
    0 25px 50px -15px rgba(200, 100, 50, 0.2),
    0 10px 20px -5px rgba(200, 100, 50, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

/* Warm glowing atmosphere layers */
.hero-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 180, 100, 0.35) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.hero-banner::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(80, 180, 170, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 2;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 13px;
  color: hsl(16, 80%, 45%);
  width: fit-content;
  box-shadow: 0 4px 12px rgba(200, 100, 50, 0.1);
}

.hero-title {
  font-size: 40px;
  line-height: 1.15;
  color: #3d2817;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.5);
}

.hero-subtitle {
  font-size: 17px;
  color: #6b4a30;
  max-width: 520px;
  font-weight: 600;
  line-height: 1.6;
}

.hero-stats-row {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.stat-card-pill {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(200, 100, 50, 0.12);
  transition: transform var(--transition-bounce), box-shadow var(--transition-soft);
}

.stat-card-pill:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(200, 100, 50, 0.18);
}

.stat-icon {
  font-size: 26px;
}

.stat-num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #3d2817;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: #8b6f57;
  font-weight: 600;
}

/* 3D Illustration Graphic Container */
.hero-graphic {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
  z-index: 2;
}

.island-3d-sphere {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: 
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 220, 180, 0.7) 30%, rgba(255, 160, 100, 0.4) 70%, rgba(200, 100, 60, 0.3) 100%);
  box-shadow: 
    0 25px 60px rgba(240, 120, 60, 0.35),
    inset -8px -12px 30px rgba(200, 80, 40, 0.25),
    inset 8px 8px 20px rgba(255, 255, 255, 0.6);
  position: relative;
  display: grid;
  place-items: center;
  animation: floatSphere 5s ease-in-out infinite;
  overflow: hidden;
}

/* Panda island inside the sphere — using the generated image */
.island-3d-sphere::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background-image: url('assets/hero-island-panda.jpg');
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.15);
}

.island-3d-sphere span {
  position: relative;
  z-index: 2;
  font-size: 56px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  opacity: 0;
}

@keyframes floatSphere {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-15px) rotate(1deg); }
}

.floating-badge-1, .floating-badge-2 {
  position: absolute;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-full);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(200, 100, 50, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.floating-badge-1 {
  top: 10px;
  left: -20px;
  color: hsl(16, 80%, 45%);
  animation: floatBadge 3.5s ease-in-out infinite 0.5s;
}

.floating-badge-2 {
  bottom: 10px;
  right: -10px;
  color: hsl(172, 55%, 38%);
  animation: floatBadge 3.8s ease-in-out infinite 1s;
}

@keyframes floatBadge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* SECTION HEADER */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  font-size: 26px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

/* VOCABULARY FLIP CARDS GRID — Enhanced Island Edition */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
}

.vocab-card {
  perspective: 1000px;
  height: 350px;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-bounce);
}

.vocab-card:hover {
  transform: translateY(-6px);
}

.vocab-card-inner, .card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  border-radius: var(--radius-lg);
  /* Fallback transition — provides smooth flip even before GSAP finishes loading.
     When GSAP is available, flipCard() sets transition:none inline to let GSAP
     take full control and avoid double-animation conflicts. */
  transition: transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
  -webkit-transition: transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.vocab-card.flipped .vocab-card-inner,
.vocab-card.flipped .card-inner {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.vocab-card-front, .vocab-card-back,
.card-front, .card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  background: var(--bg-glass-strong);
  border: 2px solid var(--border-glass);
  box-shadow: 
    0 12px 30px rgba(180, 100, 50, 0.1),
    0 4px 10px rgba(180, 100, 50, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
  transition: box-shadow var(--transition-soft), border-color var(--transition-fast);
}

.vocab-card:hover .vocab-card-front,
.vocab-card:hover .card-front {
  box-shadow: 
    0 20px 40px rgba(180, 100, 50, 0.18),
    0 8px 16px rgba(180, 100, 50, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 180, 120, 0.5);
}

.vocab-card-front, .card-front {
  background: linear-gradient(160deg, var(--bg-glass-strong) 0%, var(--bg-glass) 100%);
}

.vocab-card-back, .card-back {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  background: linear-gradient(160deg, var(--color-primary-light) 0%, var(--bg-glass-strong) 100%);
  border-color: var(--color-primary);
  box-shadow: 
    0 12px 30px rgba(30, 120, 110, 0.15),
    0 4px 10px rgba(30, 120, 110, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  flex-shrink: 0;
}

.category-tag {
  font-size: 12px;
  font-weight: 800;
  padding: 5px 13px;
  border-radius: var(--radius-full);
  background: rgba(240, 120, 60, 0.14);
  color: hsl(16, 85%, 45%);
  text-transform: uppercase;
  white-space: nowrap;
  letter-spacing: 0.03em;
  border: 1px solid rgba(240, 120, 60, 0.2);
}

.audio-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, hsl(16, 90%, 60%), hsl(16, 85%, 50%));
  color: white;
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 
    0 4px 12px rgba(240, 100, 50, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform var(--transition-bounce), box-shadow var(--transition-fast);
  flex-shrink: 0;
}

.audio-btn:hover {
  transform: scale(1.15);
  box-shadow: 
    0 6px 18px rgba(240, 100, 50, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.card-center-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: auto 0;
}

.card-emoji {
  font-size: 52px;
  line-height: 1.1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.12));
}

.card-word {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.card-phonetic {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.card-flip-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  margin-top: auto;
}

.card-translation {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-primary);
}

.card-example {
  font-size: 14px;
  color: var(--text-main);
  font-style: italic;
  line-height: 1.4;
  margin-top: 10px;
}

/* GAMIFIED QUIZ SECTION */
.quiz-box {
  background: var(--bg-glass-strong);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-progress-bar {
  flex: 1;
  max-width: 300px;
  height: 12px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.quiz-score-badge {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--color-secondary);
}

.quiz-question-card {
  text-align: center;
  padding: 24px;
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.quiz-emoji {
  font-size: 64px;
}

.quiz-prompt {
  font-size: 22px;
  color: var(--text-main);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quiz-option-btn {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  background: var(--bg-glass);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-bounce);
}

.quiz-option-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-2px);
}

.quiz-option-btn.correct {
  background: #dcfce7;
  border-color: var(--color-success);
  color: #166534;
}

.quiz-option-btn.wrong {
  background: #fee2e2;
  border-color: var(--color-danger);
  color: #991b1b;
}

/* DESIGN SYSTEM SPECIFICATION VISUALIZER */
.ds-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.ds-color-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.swatch-card {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.swatch-preview {
  height: 90px;
}

.swatch-info {
  padding: 12px;
  font-size: 13px;
}

.swatch-name {
  font-weight: 800;
  color: var(--text-main);
}

.swatch-code {
  color: var(--text-muted);
  font-family: monospace;
}

/* FOOTER */
.footer {
  text-align: center;
  padding: 24px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  border-top: 1px solid var(--border-subtle);
}

/* CHINESE LEARNING & TONE BADGES */
.hanzi-text {
  font-family: 'Noto Sans SC', 'Ma Shan Zheng', sans-serif;
  font-size: 42px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: 0.05em;
  margin: 4px 0;
}

.pinyin-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
}

.tone-badges-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.tone-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tone-badge-1 { background: #ef4444; } /* High Flat 阴平 */
.tone-badge-2 { background: #f97316; } /* Rising 阳平 */
.tone-badge-3 { background: #10b981; } /* Dip & Rise 上声 */
.tone-badge-4 { background: #3b82f6; } /* Falling 去声 */
.tone-badge-0 { background: #64748b; } /* Neutral 轻声 */

.audio-btn-circular {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--color-primary), #3b82f6);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.35);
  transition: transform var(--transition-bounce), box-shadow var(--transition-bounce);
}

.audio-btn-circular:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.audio-btn-circular:active {
  transform: scale(0.95);
}

.card-radical-hint {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.04);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-top: 6px;
}

/* STITCH MCP LIVE PANEL STYLES */
.stitch-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 13px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.stitch-live-card {
  background: var(--bg-glass-strong);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

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

.stitch-screen-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition-bounce), border-color var(--transition-fast);
}

.stitch-screen-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-primary);
}

.stitch-screen-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
}

.stitch-screen-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--text-main);
}

/* QUIZ MODE SWITCHER */
.btn-quiz-mode {
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-subtle);
  background: var(--bg-glass);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-bounce);
}

.btn-quiz-mode.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(26, 88, 183, 0.3);
}

/* MOBILE BOTTOM NAVIGATION BAR (Applies on viewports < 768px) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
  z-index: 990;
  justify-content: space-around;
  align-items: center;
  padding: 0 12px;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  min-width: 64px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-bounce);
}

.mobile-nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform var(--transition-bounce);
}

.mobile-nav-item.active {
  color: var(--color-primary);
  font-weight: 800;
}

.mobile-nav-item.active .mobile-nav-icon {
  transform: translateY(-2px) scale(1.15);
}

/* RESPONSIVE BREAKPOINTS & MOBILE OPTIMIZATION */
@media (max-width: 768px) {
  #app {
    padding: 10px 10px 82px;
    gap: 10px;
  }

  .page-viewport {
    border-radius: var(--radius-md);
  }

  .page-inner {
    gap: 16px;
    padding: 0 2px 20px;
  }

  .nav-tabs {
    display: none; /* Hide header tabs on mobile, use mobile bottom nav */
  }

  .mobile-bottom-nav {
    display: flex; /* Show mobile bottom navbar */
  }

  .hero-banner {
    grid-template-columns: 1fr;
    padding: 24px 20px;
    gap: 20px;
  }

  .hero-title {
    font-size: 26px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .version-options-grid {
    grid-template-columns: 1fr;
  }

  .quiz-options-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
  }

  .nav-actions {
    gap: 8px;
    width: 100%;
    justify-content: space-between;
  }

  .user-profile-badge span {
    display: none; /* Icon-only avatar on small screens */
  }

  .version-pill-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .version-pill-btn span:not(.version-flag) {
    display: none;
  }

  .checkin-btn-nav {
    padding: 6px 12px;
    font-size: 12px;
  }

  .checkin-btn-nav span:first-child {
    margin-right: 0;
  }

  .speed-pill-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .vocab-card {
    height: 340px;
  }

  /* Quick actions single column on mobile */
  .quick-actions-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .quick-action-card {
    padding: 20px;
    gap: 14px;
  }

  .qa-emoji {
    font-size: 42px;
  }

  .qa-title {
    font-size: 18px;
  }

  .qa-desc {
    font-size: 13px;
  }

  .qa-arrow {
    font-size: 22px;
  }

  /* Vocab toolbar mobile */
  .vocab-toolbar {
    padding: 14px;
    gap: 10px;
    margin-top: 14px;
  }

  .vocab-search-input {
    padding: 12px 16px;
    font-size: 15px;
  }

  /* Prevent hero graphic floating badges from covering title on mobile */
  .hero-graphic {
    min-height: 160px;
    margin-top: 8px;
  }

  .island-3d-sphere {
    width: 140px;
    height: 140px;
  }

  .island-3d-sphere span {
    opacity: 0 !important;
    display: none !important;
  }

  .floating-badge-1 {
    top: 0px;
    left: 0px;
    font-size: 11px;
    padding: 6px 12px;
  }

  .floating-badge-2 {
    bottom: 0px;
    right: 0px;
    font-size: 11px;
    padding: 6px 12px;
  }

  /* Phrases Grid Mobile Spacing & Non-overlapping text */
  .phrases-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .phrase-card {
    padding: 14px 16px !important;
    gap: 12px !important;
    align-items: center !important;
  }

  .phrase-badge-emoji {
    width: 44px !important;
    height: 44px !important;
    font-size: 24px !important;
    border-radius: var(--radius-sm) !important;
  }

  .phrase-content-col {
    min-width: 0 !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .phrase-hanzi-text {
    font-size: 17px !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
  }

  .phrase-pinyin-text {
    font-size: 12px !important;
    word-break: break-word !important;
  }

  .phrase-trans-text {
    font-size: 12px !important;
    word-break: break-word !important;
  }

  .phrase-audio-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
    flex-shrink: 0 !important;
  }

  /* Category Filter Bar Mobile Horizontal Touch Scroll */
  .level-filter-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    gap: 8px !important;
    margin-top: 0 !important;
  }

  .level-filter-btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
  }

  /* Category pills horizontal scroll on mobile */
  .category-pills-bar {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px;
    gap: 6px !important;
  }

  .category-pills-bar .level-filter-btn {
    flex-shrink: 0;
  }

  /* Daily word card mobile */
  .daily-word-card {
    flex-direction: column;
    text-align: center;
    padding: 20px;
    gap: 12px;
  }

  /* Hero stats wrap nicely */
  .hero-stats-row {
    gap: 10px;
  }

  .stat-card-pill {
    padding: 10px 14px;
    gap: 8px;
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
  }

  .stat-num {
    font-size: 16px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-icon {
    font-size: 20px;
  }

  .section-title {
    font-size: 20px;
  }

  /* Hide theme toggle on very small screens to save space if needed */
  /* but keep it accessible */
  .theme-toggle-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  /* PTO mascot smaller on mobile */
  .pto-mascot {
    font-size: 56px;
  }

  /* Gateway / Login modal mobile padding */
  .gateway-card {
    padding: 24px 16px;
    gap: 18px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Checkin grid 3-column on small screens */
  .checkin-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  /* Checkin reward claim button full-width */
  #claimRewardBtn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
  }

  /* Quiz options — larger touch targets on mobile */
  .quiz-option-btn {
    padding: 16px 18px;
    font-size: 15px;
    min-height: 52px;
  }

  /* Quiz feedback result card */
  .quiz-feedback {
    padding: 16px;
    font-size: 14px;
  }

  /* Badge grid responsive */
  .badges-panel {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
    gap: 8px !important;
  }

  /* Footer text smaller on mobile */
  .footer {
    font-size: 11px;
    padding: 16px 12px;
    line-height: 1.6;
  }

  /* Prevent horizontal overflow */
  #app {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .page-viewport {
    overflow-x: hidden;
  }
}

/* SMALL PHONES (≤ 480px) — tighter spacing */
@media (max-width: 480px) {
  #app {
    padding: 6px 6px 82px;
  }

  .hero-banner {
    padding: 18px 14px;
  }

  .hero-title {
    font-size: 22px;
  }

  .hero-subtitle {
    font-size: 13px;
  }

  .stat-card-pill {
    padding: 8px 10px;
    gap: 6px;
  }

  .stat-num { font-size: 15px; }
  .stat-label { font-size: 10px; }
  .stat-icon { font-size: 18px; }

  .section-title {
    font-size: 17px;
  }

  .section-subtitle {
    font-size: 12px;
  }

  .gateway-card {
    padding: 18px 12px;
  }

  .vocab-card {
    height: 300px;
  }

  .checkin-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }

  .mobile-bottom-nav {
    height: 60px;
  }

  .mobile-nav-label {
    font-size: 10px;
  }

  .mobile-nav-icon {
    font-size: 20px;
  }
}

/* GSAP APP PRELOADER SCREEN */
.app-preloader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
}

.preloader-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.preloader-mascot {
  width: 90px;
  height: 90px;
  border-radius: 30px;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  display: grid;
  place-items: center;
  font-size: 50px;
  box-shadow: 0 12px 25px rgba(59, 130, 246, 0.35);
}

.preloader-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #1e293b;
  margin-top: 4px;
}

.preloader-subtitle {
  font-size: 14px;
  color: #64748b;
  font-weight: 600;
}

.preloader-progress-container {
  width: 100%;
  height: 12px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 12px;
  position: relative;
}

.preloader-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #f97316);
  border-radius: var(--radius-full);
}

.preloader-counter {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #3b82f6;
  margin-top: 4px;
}

/* EVERYDAY PHRASES & GREETINGS CARDS */
.phrases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.phrase-card {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-bounce), box-shadow var(--transition-bounce), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.phrase-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.phrase-badge-emoji {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
}

.phrase-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phrase-situation-pill {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  background: rgba(26, 88, 183, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  align-self: flex-start;
}

.phrase-hanzi-text {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 900;
  font-size: 20px;
  color: var(--text-main);
  line-height: 1.3;
}

.phrase-pinyin-text {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
}

.phrase-trans-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.phrase-audio-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-tertiary);
  color: #1e293b;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 0 0 #d97706;
  flex-shrink: 0;
  transition: transform var(--transition-bounce), box-shadow var(--transition-bounce);
}

.phrase-audio-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 0 #d97706;
}

.phrase-audio-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 0 #d97706;
}

/* ===== B2: PREFERS-REDUCED-MOTION FALLBACK ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skeleton-card::after { display: none; }
  .gateway-mascot, .island-3d-sphere, .floating-badge-1, .floating-badge-2 { animation: none !important; }
}

/* ===== B3: PRESS-SCALE TOUCH FEEDBACK ===== */
.vocab-card:active,
.phrase-card:active,
.checkin-day-card:active,
.quiz-option-btn:active,
.level-filter-btn:active,
.btn-quiz-mode:active,
.suggestion-chip:active,
.badge-item:active,
.daily-word-card:active {
  transform: scale(0.97);
}

/* ===== A1: STAR/FAVORITE BUTTON ===== */
.star-btn {
  width: 36px; height: 36px;
  border: none; background: transparent;
  font-size: 18px; cursor: pointer;
  opacity: 0.4; transition: all var(--transition-bounce);
  flex-shrink: 0;
  display: grid; place-items: center;
}
.star-btn.active { opacity: 1; filter: drop-shadow(0 2px 4px rgba(234, 179, 8, 0.5)); }
.star-btn:active { transform: scale(0.8); }

/* ===== A2: DAILY WORD CARD — Golden Island Edition ===== */
.daily-word-card {
  display: flex; align-items: center; gap: 20px;
  background: 
    linear-gradient(135deg, rgba(255, 200, 100, 0.25) 0%, rgba(255, 140, 80, 0.2) 100%);
  border: 2px solid rgba(255, 180, 100, 0.5);
  border-radius: calc(var(--radius-lg) + 4px);
  padding: 24px; margin-top: 16px;
  box-shadow: 
    0 12px 30px rgba(220, 120, 50, 0.15),
    0 4px 10px rgba(220, 120, 50, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-bounce), box-shadow var(--transition-soft);
}

.daily-word-card::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 220, 120, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.daily-word-card:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 18px 40px rgba(220, 120, 50, 0.22),
    0 6px 14px rgba(220, 120, 50, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.daily-word-emoji { font-size: 56px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1)); }
.daily-word-center { flex: 1; display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.daily-word-right { display: flex; flex-direction: column; gap: 12px; align-items: center; position: relative; z-index: 1; }

/* ===== A3: ACHIEVEMENT BADGES ===== */
.badges-panel { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.badge-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px; border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle); background: var(--bg-glass);
  min-width: 80px; transition: all var(--transition-bounce);
}
.badge-item.unlocked {
  border-color: var(--color-tertiary);
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.08), rgba(249, 115, 22, 0.08));
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.15);
}
.badge-item.locked { opacity: 0.4; filter: grayscale(0.8); }
.badge-icon { font-size: 28px; }
.badge-name { font-size: 10px; font-weight: 700; text-align: center; color: var(--text-muted); }

/* ===== A4: PROGRESS RING ===== */
.progress-ring-container { position: relative; width: 56px; height: 56px; }
.progress-ring-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}
.progress-ring-fill { transition: stroke-dashoffset 0.3s ease; }

/* ===== A6: SPEECH SPEED PILL ===== */
.speed-pill-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--border-glass); background: var(--bg-glass);
  font-weight: 700; font-size: 13px; color: var(--text-main);
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  min-height: 36px;
}
.speed-pill-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); }
.speed-pill-btn:active { transform: scale(0.95); }

/* ===== A7: ENHANCED EMPTY STATE ===== */
.empty-state-container {
  grid-column: 1 / -1; text-align: center; padding: 48px 24px;
  background: var(--bg-glass-strong); border-radius: var(--radius-lg);
  border: 2px dashed var(--border-subtle); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state-icon { font-size: 56px; filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1)); }
.empty-state-title { font-size: 22px; color: var(--text-main); }
.empty-state-desc { color: var(--text-muted); font-size: 14px; max-width: 420px; }
.empty-state-suggestions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 8px 0; }
.suggestion-chip {
  padding: 8px 16px; border-radius: var(--radius-full);
  border: 1px solid var(--color-primary); background: var(--color-primary-light);
  color: var(--color-primary); font-weight: 700; font-size: 14px;
  cursor: pointer; transition: all var(--transition-bounce);
  min-height: 36px;
}
.suggestion-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.suggestion-chip:active { transform: scale(0.95); }
.empty-state-clear-btn { width: auto; padding: 10px 24px; font-size: 15px; }

/* ===== A8: SKELETON LOADING SHIMMER ===== */
.skeleton-card {
  background: var(--bg-glass-strong);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  height: 350px;
  overflow: hidden;
  position: relative;
}
.skeleton-card::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton-line {
  height: 16px; border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.06); margin: 12px 20px;
}
.skeleton-line.short { width: 40%; }
.skeleton-line.long { width: 80%; }
.skeleton-circle {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(0,0,0,0.06); margin: 20px auto;
}
[data-theme="dark"] .skeleton-line, [data-theme="dark"] .skeleton-circle {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .skeleton-card::after {
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
}

/* ═══════════════════════════════════════════════════════════════
   PAGE 5: VOICE AGENT — TALK WITH PANDA TEACHER
   Theme: Magical Island Adventure — Glassmorphism + Playful Motion
   ═══════════════════════════════════════════════════════════════ */

/* ── Quick Action Card (Dashboard entry) ─────────────────────── */
.quick-action-card.qa-voice {
  --qa-accent: hsl(280, 65%, 60%);
}
.quick-action-card.qa-voice::before {
  background: linear-gradient(135deg, hsla(280, 70%, 60%, 0.12), hsla(320, 80%, 65%, 0.08));
}
.quick-action-card.qa-voice:hover {
  border-color: var(--qa-accent);
}
.quick-action-card.qa-voice .qa-emoji {
  background: linear-gradient(135deg, hsla(280, 70%, 65%, 0.15), hsla(320, 80%, 70%, 0.1));
}
.quick-action-card.qa-voice .qa-arrow {
  color: var(--qa-accent);
}

/* ── Voice Page Layout ───────────────────────────────────────── */
#tab-voice .page-inner {
  display: flex;
  flex-direction: column;
  min-height: 600px;
  max-width: 540px;
  margin: 0 auto;
}

/* ── Voice Header ────────────────────────────────────────────── */
.voice-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  text-align: center;
  position: relative;
}

.voice-back-btn {
  position: absolute;
  top: 20px;
  left: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: all 0.2s ease;
}
.voice-back-btn:hover {
  background: var(--color-primary-light);
  transform: translateX(-2px);
}
.voice-back-btn:active {
  transform: scale(0.92);
}

.voice-avatar-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
}

.voice-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background-image: url('assets/hero-island-panda.jpg');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: transparent;
  box-shadow: var(--shadow-soft);
  border: 3px solid var(--border-glass);
  transition: transform 0.3s ease;
}
.voice-avatar.listening {
  animation: voicePulse 1.5s ease-in-out infinite;
}
.voice-avatar.connecting {
  animation: voiceRotate 1.2s linear infinite;
}
.voice-avatar.speaking {
  animation: voiceBounce 0.6s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { transform: scale(1); box-shadow: var(--shadow-soft); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 8px hsla(172, 55%, 45%, 0.15); }
}
@keyframes voiceRotate {
  to { transform: rotate(360deg); }
}
@keyframes voiceBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Status dot */
.voice-status-dot {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 3px solid var(--bg-app);
  opacity: 0.5;
  transition: all 0.3s ease;
}
.voice-status-dot.active {
  background: hsl(158, 60%, 45%);
  opacity: 1;
  box-shadow: 0 0 8px hsla(158, 60%, 45%, 0.5);
}
.voice-status-dot.connecting {
  background: var(--color-tertiary);
  opacity: 1;
  animation: voiceDotBlink 0.8s ease-in-out infinite;
}
.voice-status-dot.speaking {
  background: var(--color-secondary);
  opacity: 1;
  box-shadow: 0 0 8px hsla(16, 90%, 62%, 0.5);
}
.voice-status-dot.error {
  background: var(--color-danger);
  opacity: 1;
}
@keyframes voiceDotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.voice-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.voice-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0;
  min-height: 20px;
  transition: color 0.2s ease;
}

/* ── Conversation Transcript ─────────────────────────────────── */
.voice-conversation {
  flex: 1;
  min-height: 320px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: var(--bg-glass);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin: 8px 0;
}

/* Custom scrollbar */
.voice-conversation::-webkit-scrollbar {
  width: 6px;
}
.voice-conversation::-webkit-scrollbar-thumb {
  background: hsla(172, 30%, 50%, 0.3);
  border-radius: 3px;
}
.voice-conversation::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Empty State ─────────────────────────────────────────────── */
.voice-empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}
.voice-empty-state .voice-empty-emoji {
  font-size: 56px;
  margin-bottom: 16px;
  animation: voiceFloat 3s ease-in-out infinite;
}
@keyframes voiceFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.voice-empty-state p {
  font-size: 16px;
  font-weight: 700;
  margin: 6px 0;
}
.voice-empty-state .voice-empty-hint {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
}

/* ── Message Bubbles ─────────────────────────────────────────── */
.voice-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: voiceMsgIn 0.3s ease-out;
}
@keyframes voiceMsgIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.voice-msg-agent {
  align-self: flex-start;
  flex-direction: row;
}
.voice-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.voice-msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
  border: 2px solid var(--border-glass);
}
.voice-msg-agent .voice-msg-avatar {
  background-image: url('assets/hero-island-panda.jpg');
  background-size: cover;
  background-position: center;
  color: transparent;
}

.voice-msg-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.voice-msg-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 4px;
}
.voice-msg-user .voice-msg-name {
  text-align: right;
}

.voice-msg-text {
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: var(--shadow-soft);
}

/* Agent bubble — teal themed */
.voice-msg-agent .voice-msg-text {
  background: var(--bg-card);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-subtle);
}

/* User bubble — coral themed */
.voice-msg-user .voice-msg-text {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-hover));
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Error message */
.voice-msg-error .voice-msg-text {
  background: hsla(350, 75%, 95%, 0.9);
  color: hsl(350, 60%, 40%);
  border: 1px solid hsla(350, 60%, 70%, 0.5);
}
[data-theme="dark"] .voice-msg-error .voice-msg-text {
  background: hsla(350, 50%, 25%, 0.6);
  color: hsl(350, 60%, 75%);
}

/* ── Voice Controls ──────────────────────────────────────────── */
.voice-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 20px 32px;
  position: relative;
}

/* Waveform */
.voice-waveform {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}
.voice-waveform.wave-active {
  opacity: 1;
}

.wave-bar {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--color-primary);
  transition: height 0.15s ease;
}
.voice-waveform.wave-active .wave-bar {
  animation: waveBarAnim 0.6s ease-in-out infinite;
}
.voice-waveform.wave-active .wave-bar:nth-child(1) { animation-delay: 0s; }
.voice-waveform.wave-active .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-waveform.wave-active .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-waveform.wave-active .wave-bar:nth-child(4) { animation-delay: 0.15s; }
.voice-waveform.wave-active .wave-bar:nth-child(5) { animation-delay: 0.05s; }

@keyframes waveBarAnim {
  0%, 100% { height: 8px; }
  50% { height: 28px; }
}

/* Mic Button */
.voice-mic-btn {
  position: relative;
  width: 76px;
  height: 76px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px hsla(172, 55%, 40%, 0.4);
  transition: all 0.3s ease;
  z-index: 2;
}
.voice-mic-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 30px hsla(172, 55%, 40%, 0.5);
}
.voice-mic-btn:active {
  transform: scale(0.94);
}
.voice-mic-btn.active {
  background: linear-gradient(135deg, var(--color-danger), hsl(350, 70%, 50%));
  box-shadow: 0 8px 24px hsla(350, 70%, 45%, 0.4);
}
.voice-mic-btn.connecting {
  background: linear-gradient(135deg, var(--color-tertiary), hsl(42, 85%, 45%));
}
.voice-mic-btn.error {
  background: linear-gradient(135deg, hsl(350, 60%, 55%), hsl(350, 60%, 45%));
}

.mic-icon {
  font-size: 32px;
  z-index: 2;
  pointer-events: none;
}

/* Mic pulse rings */
.mic-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  animation: micPulseRing 1.5s ease-out infinite;
  pointer-events: none;
  display: none;
}
@keyframes micPulseRing {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Timer */
.voice-timer {
  font-family: 'Plus Jakarta Sans', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ── Hold-to-Talk Coach Hint ────────────────────────────────── */
.hold-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 18px 7px 9px;
  border-radius: 999px;
  background: hsl(42, 100%, 94%);
  border: 1.5px dashed hsl(42, 80%, 62%);
  box-shadow: 0 4px 14px rgba(215, 180, 120, 0.28);
  animation: holdHintFloat 3s ease-in-out infinite;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.hold-hint.hide {
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  pointer-events: none;
}

/* Mini animated mic demo */
.hold-demo {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.hold-demo-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  box-shadow: 0 3px 8px hsla(172, 55%, 40%, 0.35);
  animation: holdBtnPress 2.4s ease-in-out infinite;
}
.hold-demo-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--color-secondary);
  opacity: 0;
  animation: holdRingPulse 2.4s ease-out infinite;
}
.hold-demo-finger {
  position: absolute;
  top: -13px;
  right: -7px;
  font-size: 17px;
  filter: drop-shadow(0 2px 2px rgba(61, 40, 23, 0.25));
  animation: holdFingerTap 2.4s ease-in-out infinite;
}

/* Copy */
.hold-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.hold-copy strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.2px;
}
.hold-copy span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Gesture demo keyframes: press → hold → release */
@keyframes holdFingerTap {
  0%, 100% { transform: translateY(-7px) rotate(10deg); }
  16% { transform: translateY(1px) rotate(0deg); }
  62% { transform: translateY(1px) rotate(0deg); }
  82% { transform: translateY(-7px) rotate(10deg); }
}
@keyframes holdBtnPress {
  0%, 100% {
    transform: scale(1);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  }
  16%, 62% {
    transform: scale(0.88);
    background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-hover));
  }
}
@keyframes holdRingPulse {
  0%, 12% { transform: scale(0.8); opacity: 0; }
  22% { opacity: 0.7; }
  64% { transform: scale(1.75); opacity: 0; }
  100% { opacity: 0; }
}
@keyframes holdHintFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .hold-hint,
  .hold-hint * {
    animation: none !important;
  }
}

/* Hangup button */
.voice-hangup-btn {
  position: absolute;
  bottom: 8px;
  right: 20px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-danger), hsl(350, 70%, 50%));
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 6px 16px hsla(350, 60%, 45%, 0.35);
  transition: transform 0.2s ease;
}
.voice-hangup-btn:hover {
  transform: scale(1.1);
}
.voice-hangup-btn:active {
  transform: scale(0.9);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  #tab-voice .page-inner {
    min-height: calc(100vh - 180px);
    max-width: 100%;
  }
  .voice-conversation {
    max-height: 45vh;
    min-height: 260px;
  }
  .voice-avatar {
    width: 80px;
    height: 80px;
    font-size: 44px;
  }
  .voice-avatar-wrapper {
    width: 80px;
    height: 80px;
  }
  .voice-title {
    font-size: 24px;
  }
  .voice-mic-btn {
    width: 68px;
    height: 68px;
  }
  .mic-icon {
    font-size: 28px;
  }
}

@media (max-width: 480px) {
  .voice-header {
    padding: 16px 12px 12px;
  }
  .voice-conversation {
    padding: 12px 10px 6px;
  }
  .voice-controls {
    padding: 16px 12px 24px;
  }
  .voice-msg {
    max-width: 92%;
  }
  .voice-msg-text {
    font-size: 14px;
    padding: 8px 14px;
  }
}

/* Dark theme adjustments */
[data-theme="dark"] .voice-conversation {
  background: rgba(30, 25, 22, 0.5);
}
[data-theme="dark"] .voice-msg-agent .voice-msg-text {
  background: rgba(50, 40, 35, 0.85);
  color: var(--text-inverse);
}
[data-theme="dark"] .voice-msg-avatar {
  background: rgba(50, 40, 35, 0.85);
}
[data-theme="dark"] .voice-empty-state {
  color: rgba(255, 255, 255, 0.5);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .voice-avatar.listening,
  .voice-avatar.connecting,
  .voice-avatar.speaking,
  .voice-empty-state .voice-empty-emoji,
  .voice-waveform.wave-active .wave-bar,
  .mic-pulse,
  .voice-status-dot.connecting {
    animation: none !important;
  }
}

/* 3D Panda Mascot Image Uniformity System */
.mascot-img,
.msg-mascot-img,
.hero-sphere-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.brand-icon {
  overflow: hidden;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
}

.voice-avatar {
  overflow: hidden;
  border-radius: 50%;
  width: 96px;
  height: 96px;
  border: 3px solid var(--border-glass);
  box-shadow: var(--shadow-soft);
}

.gateway-mascot {
  overflow: hidden;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--border-glass);
}



