﻿    :root {
      --primary: #00D4AA;
      --primary-dark: #00B894;
      --primary-glow: rgba(0, 212, 170, 0.3);
      --secondary: #6C5CE7;
      --accent: #FD79A8;
      --warning: #FDCB6E;
      --success: #00B894;
      --danger: #E17055;
      --bg-dark: #0A0E17;
      --bg-card: #141B2D;
      --bg-card-hover: #1A2342;
      --text-primary: #FFFFFF;
      --text-secondary: #8B95A5;
      --text-muted: #5A6478;
      --border-subtle: rgba(255, 255, 255, 0.06);
      --border-glow: rgba(0, 212, 170, 0.5);
      --glass: rgba(20, 27, 45, 0.8);
      --glass-border: rgba(255, 255, 255, 0.1);
    }
    
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: var(--bg-dark);
      color: var(--text-primary);
      min-height: 100vh;
      overflow-x: hidden;
      overflow-y: auto;
      background-image: 
        radial-gradient(ellipse at 20% 20%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(253, 121, 168, 0.03) 0%, transparent 50%);
    }
    
    /* Selection Page */
    #selectionPage {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      overflow-x: hidden;
      overflow-y: auto;
      position: relative;
      opacity: 0;
      transition: opacity 0.4s ease;
    }
    #selectionPage.ready { opacity: 1; }
    
    .header {
      text-align: center;
      padding: 24px 30px;
      background: linear-gradient(180deg, rgba(10, 14, 23, 0.95) 0%, rgba(10, 14, 23, 0.7) 100%);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--border-subtle);
      position: relative;
      flex-shrink: 0;
      z-index: 10;
    }

    /* ============================================
       HERO BANNER
       ============================================ */
    .hero-banner {
      padding: 0;
      background: none;
      border-bottom: none;
      overflow: hidden;
      min-height: 140px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      background:
        radial-gradient(ellipse at 20% 30%, rgba(0, 212, 170, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 60%, rgba(108, 92, 231, 0.10) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 80%, rgba(253, 121, 168, 0.06) 0%, transparent 50%),
        linear-gradient(180deg, #0A0E17 0%, #0F1525 50%, #0A0E17 100%);
    }
    .hero-banner::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent 5%, rgba(0,212,170,0.3) 30%, rgba(108,92,231,0.3) 70%, transparent 95%);
    }

    /* Floating orbs */
    .banner-orb {
      position: absolute;
      border-radius: 50%;
      filter: blur(60px);
      opacity: 0.4;
      pointer-events: none;
      animation: orbFloat 12s ease-in-out infinite;
    }
    .banner-orb-1 {
      width: 200px; height: 200px;
      background: radial-gradient(circle, rgba(0,212,170,0.35), transparent 70%);
      top: -40px; left: 5%;
      animation-duration: 14s;
    }
    .banner-orb-2 {
      width: 160px; height: 160px;
      background: radial-gradient(circle, rgba(108,92,231,0.30), transparent 70%);
      top: 10px; right: 10%;
      animation-duration: 18s;
      animation-delay: -4s;
    }
    .banner-orb-3 {
      width: 120px; height: 120px;
      background: radial-gradient(circle, rgba(253,121,168,0.20), transparent 70%);
      bottom: -20px; left: 40%;
      animation-duration: 16s;
      animation-delay: -8s;
    }
    @keyframes orbFloat {
      0%, 100% { transform: translate(0, 0) scale(1); }
      25%      { transform: translate(15px, -10px) scale(1.05); }
      50%      { transform: translate(-10px, 8px) scale(0.95); }
      75%      { transform: translate(8px, 12px) scale(1.02); }
    }

    .banner-content {
      position: relative;
      z-index: 2;
      padding: 8px 30px 12px;
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    .banner-content .logo,
    .banner-content .banner-tagline,
    .banner-content .privacy-pill,
    .banner-content .streak-display {
      position: relative;
      z-index: 2;
    }
    /* Frosted card behind logo area to separate from scene */
    .banner-content::before {
      content: '';
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      width: min(420px, 90%);
      height: 100%;
      background: radial-gradient(ellipse at center, rgba(10,14,23,0.85) 0%, rgba(10,14,23,0.5) 60%, transparent 100%);
      border-radius: 16px;
      pointer-events: none;
      z-index: 1;
    }
    .banner-tagline {
      display: none;
    }
    .privacy-pill {
      display: none;
    }

    .banner-illustration {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 0;
    }
    .banner-illustration svg {
      width: 100%;
      height: 100%;
      display: block;
    }

    .banner-tagline {
      color: var(--text-secondary);
      font-size: 0.92rem;
      font-weight: 400;
      margin-top: 4px;
      letter-spacing: 0.2px;
    }
    
    .header::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      width: 200px;
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--primary), transparent);
    }

    .header-top-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 4px;
      position: relative;
      z-index: 3;
    }

    .header-top-left {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .header-top-right {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    
    .logo {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      margin-bottom: 8px;
    }
    
    .logo-icon {
      width: 40px;
      height: 40px;
      background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.4rem;
      box-shadow: 0 4px 20px var(--primary-glow);
    }
    
    .header h1 {
      font-size: 1.6rem;
      font-weight: 700;
      letter-spacing: -0.5px;
      background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    
    .header p {
      color: var(--text-secondary);
      font-size: 0.9rem;
      font-weight: 400;
      margin-top: 4px;
    }
    
    .history-btn {
      position: absolute;
      top: 50%;
      right: 30px;
      transform: translateY(-50%);
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      padding: 10px 18px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 500;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .history-btn:hover {
      background: var(--bg-card-hover);
      border-color: var(--primary);
      box-shadow: 0 4px 20px var(--primary-glow);
      transform: translateY(-50%) translateY(-2px);
    }
    
    .header-buttons {
      position: absolute;
      top: 50%;
      right: 30px;
      transform: translateY(-50%);
      display: flex;
      gap: 10px;
      align-items: center;
    }
    
    .header-buttons .history-btn,
    .header-buttons .settings-btn {
      position: static;
      transform: none;
    }
    
    .settings-btn {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      padding: 10px 18px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 500;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .settings-btn:hover {
      background: var(--bg-card-hover);
      border-color: var(--secondary);
      box-shadow: 0 4px 20px rgba(108, 92, 231, 0.2);
    }
    
    /* Exercise Grid */
    .exercise-grid,
    .meditation-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 20px;
      padding: 24px 40px;
      flex: 1;
      max-width: 1400px;
      margin: 0 auto;
      width: 100%;
      overflow-y: auto;
      align-content: start;
      padding-bottom: 30px;
    }
    
    .exercise-grid::-webkit-scrollbar {
      width: 8px;
    }
    
    .exercise-grid::-webkit-scrollbar-track {
      background: var(--bg-dark);
      border-radius: 4px;
    }
    
    .exercise-grid::-webkit-scrollbar-thumb {
      background: var(--text-muted);
      border-radius: 4px;
    }
    
    .exercise-grid::-webkit-scrollbar-thumb:hover {
      background: var(--text-secondary);
    }
    
    .exercise-tile {
      background: var(--bg-card);
      border-radius: 20px;
      padding: 24px;
      cursor: pointer;
      transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      border: 1px solid var(--border-subtle);
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      min-height: 200px;
    }
    
    .exercise-tile::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: linear-gradient(90deg, var(--primary), var(--secondary));
      opacity: 0;
      transition: opacity 0.3s;
    }
    
    .exercise-tile::after {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
      opacity: 0;
      transition: opacity 0.5s;
      pointer-events: none;
    }
    
    .exercise-tile:hover {
      transform: translateY(-6px);
      border-color: var(--border-glow);
      box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 40px var(--primary-glow);
    }
    
    .exercise-tile:hover::before {
      opacity: 1;
    }
    
    .exercise-tile:hover::after {
      opacity: 0.15;
    }
    
    .tile-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      margin-bottom: 14px;
    }
    
    .exercise-tile .icon {
      width: 56px;
      height: 56px;
      background: linear-gradient(135deg, rgba(0, 212, 170, 0.15) 0%, rgba(108, 92, 231, 0.15) 100%);
      border-radius: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.8rem;
      border: 1px solid var(--border-subtle);
    }
    
    .tile-badge {
      background: rgba(0, 212, 170, 0.1);
      color: var(--primary);
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 0.7rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    
    .exercise-tile h3 {
      font-size: 1.15rem;
      font-weight: 600;
      margin-bottom: 10px;
      color: var(--text-primary);
      letter-spacing: -0.3px;
    }
    
    .exercise-tile p {
      color: var(--text-secondary);
      font-size: 0.85rem;
      line-height: 1.55;
      flex: 1;
      font-weight: 400;
    }
    
    .tile-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 18px;
      padding-top: 16px;
      border-top: 1px solid var(--border-subtle);
    }
    
    .exercise-tile .reps {
      display: flex;
      align-items: center;
      gap: 6px;
      color: var(--primary);
      font-size: 0.8rem;
      font-weight: 600;
    }
    
    .tile-arrow {
      width: 32px;
      height: 32px;
      background: var(--bg-card-hover);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
      transition: all 0.3s;
    }
    
    .exercise-tile:hover .tile-arrow {
      background: var(--primary);
      color: var(--bg-dark);
      transform: translateX(4px);
    }
    
    @media (max-width: 1100px) {
      .exercise-grid,
      .meditation-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 20px 30px;
        gap: 18px;
      }
    }
    
    @media (max-width: 700px) {
      .exercise-grid,
      .meditation-grid {
        grid-template-columns: 1fr;
        padding: 16px 20px;
        gap: 14px;
      }
      .header { padding: 16px 20px; }
      .hero-banner { min-height: 110px; }
      .hero-banner .banner-content { padding: 6px 20px 10px; }
      .banner-tagline { font-size: 0.82rem; }
      .banner-orb-1 { width: 140px; height: 140px; }
      .banner-orb-2 { width: 110px; height: 110px; }
      .banner-orb-3 { width: 80px; height: 80px; }
      .header h1 { font-size: 1.3rem; }
      .logo-icon { width: 32px; height: 32px; font-size: 1.1rem; }
      .header-buttons { position: static; transform: none; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
      .history-btn, .settings-btn { position: static; transform: none; }
      .exercise-tile { 
        padding: 20px;
        min-height: 180px;
      }
      .exercise-tile .icon { width: 48px; height: 48px; font-size: 1.5rem; }
      .exercise-tile h3 { font-size: 1.05rem; }
      .exercise-tile p { font-size: 0.82rem; }
      .tile-footer { margin-top: 14px; padding-top: 14px; }
    }
    
    /* Exercise Page */
    .exercise-page {
      display: none;
      height: 100vh;
      flex-direction: column;
      background: var(--bg-dark);
      overflow: hidden;
    }
    
    .exercise-page.active {
      display: flex;
      animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    
    .exercise-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 30px;
      background: var(--glass);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .back-btn {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      padding: 10px 20px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 0.9rem;
      font-weight: 500;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    
    .back-btn:hover {
      background: var(--bg-card-hover);
      border-color: var(--primary);
      transform: translateX(-4px);
    }
    
    .exercise-title {
      font-size: 1.3rem;
      font-weight: 600;
      letter-spacing: -0.3px;
    }
    
    .score-display {
      text-align: right;
      background: var(--bg-card);
      padding: 12px 24px;
      border-radius: 14px;
      border: 1px solid var(--border-subtle);
    }
    
    .score-display .score {
      font-size: 2rem;
      font-weight: 700;
      background: linear-gradient(135deg, var(--primary), var(--warning));
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    
    .score-display .label {
      font-size: 0.75rem;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      font-weight: 500;
    }
    
    .exercise-content {
      flex: 1;
      display: flex;
      gap: 24px;
      padding: 24px;
      min-height: 0;
      overflow: hidden;
    }
    
    .video-container {
      flex: 2;
      position: relative;
      background: linear-gradient(135deg, #0D1117 0%, #161B22 100%);
      border-radius: 20px;
      overflow: hidden;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
      min-width: 0;
    }
    
    .video-container video {
      width: 100%;
      height: 100%;
      object-fit: contain;
      transform: scaleX(-1);
    }
    
    .video-container canvas {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      transform: scaleX(-1);
    }

    .smile-float {
      position: absolute;
      font-size: 2rem;
      pointer-events: none;
      z-index: 20;
      animation: smileFloat 2.5s ease-out forwards;
      opacity: 0;
    }
    @keyframes smileFloat {
      0%   { opacity: 0; transform: translateY(0) scale(0.5) rotate(0deg); }
      15%  { opacity: 1; transform: translateY(-20px) scale(1) rotate(-10deg); }
      50%  { opacity: 0.9; transform: translateY(-80px) scale(1.1) rotate(10deg); }
      100% { opacity: 0; transform: translateY(-160px) scale(0.6) rotate(-5deg); }
    }

    .video-container #breathChart {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 35%;
      transform: none;
      pointer-events: none;
      z-index: 15;
    }
    
    .instruction-overlay {
      position: absolute;
      top: 24px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--glass);
      backdrop-filter: blur(20px);
      padding: 16px 32px;
      border-radius: 16px;
      text-align: center;
      z-index: 10;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
    
    .instruction-overlay .instruction {
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--warning);
      letter-spacing: -0.3px;
    }
    
    .instruction-overlay .sub-instruction {
      font-size: 0.85rem;
      color: var(--text-secondary);
      margin-top: 6px;
    }
    
    .rep-counter {
      position: absolute;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      color: var(--bg-dark);
      padding: 16px 48px;
      border-radius: 50px;
      font-size: 1.4rem;
      font-weight: 700;
      z-index: 10;
      box-shadow: 0 8px 32px var(--primary-glow);
      letter-spacing: -0.5px;
    }
    
    .progress-ring {
      position: absolute;
      top: 24px;
      right: 24px;
      z-index: 10;
    }
    
    .side-panel {
      flex: 1;
      background: var(--bg-card);
      border-radius: 16px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-width: 320px;
      border: 1px solid var(--border-subtle);
      overflow-y: auto;
    }
    
    .panel-section {
      background: rgba(0, 0, 0, 0.3);
      border-radius: 10px;
      padding: 12px;
      border: 1px solid var(--border-subtle);
      flex-shrink: 0;
    }
    
    .panel-section h4 {
      color: var(--primary);
      margin-bottom: 8px;
      font-size: 0.7rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    
    .panel-section h4::before {
      content: '';
      width: 3px;
      height: 14px;
      background: var(--primary);
      border-radius: 3px;
    }
    
    .metric {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 4px 0;
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .metric:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }
    
    .metric .label {
      color: var(--text-secondary);
      font-size: 0.8rem;
      font-weight: 400;
    }
    
    .metric .value {
      font-weight: 600;
      color: var(--text-primary);
      font-size: 0.85rem;
    }
    
    .calibrate-btn {
      background: linear-gradient(135deg, #FFD700, #FFA500);
      border: none;
      color: #000;
      padding: 10px 16px;
      border-radius: 10px;
      font-size: 0.8rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      letter-spacing: 0.3px;
      flex-shrink: 0;
      display: none;
    }
    .calibrate-btn:hover {
      transform: scale(1.04);
      box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
    }
    .calibrate-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
    .calibration-status {
      font-size: 0.7rem;
      color: var(--text-muted);
      text-align: center;
      flex-shrink: 0;
      display: none;
    }
    .calibration-status.calibrated {
      color: #00D4AA;
    }

    .start-btn {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      border: none;
      color: var(--bg-dark);
      padding: 12px 20px;
      border-radius: 10px;
      font-size: 0.9rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      position: relative;
      overflow: hidden;
      flex-shrink: 0;
    }
    
    .start-btn::before {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
      transition: left 0.5s;
    }
    
    .start-btn:hover::before {
      left: 100%;
    }
    
    .start-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 32px var(--primary-glow);
    }
    
    .start-btn:disabled {
      background: var(--bg-card-hover);
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
      color: var(--text-muted);
    }
    
    .voice-toggle {
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      padding: 8px 14px;
      border-radius: 8px;
      font-size: 0.8rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      flex-shrink: 0;
    }
    
    .voice-toggle:hover {
      background: rgba(108, 92, 231, 0.2);
      border-color: var(--secondary);
    }
    
    /* Results Modal */
    .results-modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 14, 23, 0.95);
      backdrop-filter: blur(10px);
      z-index: 100;
      justify-content: center;
      align-items: center;
    }
    
    .results-modal.active {
      display: flex;
      animation: modalFadeIn 0.3s ease;
    }
    
    @keyframes modalFadeIn {
      from { opacity: 0; transform: scale(0.95); }
      to { opacity: 1; transform: scale(1); }
    }
    
    .results-content {
      background: var(--bg-card);
      border-radius: 28px;
      padding: 48px;
      text-align: center;
      max-width: 520px;
      width: 90%;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
      position: relative;
      overflow: hidden;
    }
    
    .results-content::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    }
    
    .results-content h2 {
      font-size: 1.8rem;
      margin-bottom: 8px;
      font-weight: 700;
      letter-spacing: -0.5px;
    }
    
    .results-content .subtitle {
      color: var(--text-secondary);
      font-size: 0.9rem;
      margin-bottom: 24px;
    }
    
    .final-score {
      font-size: 5rem;
      font-weight: 800;
      background: linear-gradient(135deg, var(--primary), var(--warning));
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      margin: 24px 0;
      line-height: 1;
    }
    
    .score-breakdown {
      text-align: left;
      margin: 32px 0;
      background: rgba(0, 0, 0, 0.3);
      border-radius: 16px;
      padding: 20px;
      border: 1px solid var(--border-subtle);
    }
    
    .breakdown-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .breakdown-item:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }
    
    .breakdown-item .label {
      color: var(--text-secondary);
      font-size: 0.9rem;
    }
    
    .breakdown-item .value {
      font-weight: 600;
      color: var(--primary);
    }
    
    .results-buttons {
      display: flex;
      gap: 16px;
      margin-top: 32px;
    }
    
    .results-buttons button {
      flex: 1;
      padding: 16px;
      border-radius: 14px;
      font-size: 0.95rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .retry-btn {
      background: transparent;
      border: 2px solid var(--primary);
      color: var(--primary);
    }
    
    .retry-btn:hover {
      background: rgba(0, 212, 170, 0.1);
      transform: translateY(-2px);
    }
    
    .done-btn {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      border: none;
      color: var(--bg-dark);
    }
    
    .done-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 32px var(--primary-glow);
    }
    
    .loading-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 14, 23, 0.95);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      z-index: 20;
      border-radius: 20px;
    }
    
    .loading-overlay.hidden {
      display: none;
    }
    
    .spinner {
      width: 56px;
      height: 56px;
      border: 3px solid var(--border-subtle);
      border-top-color: var(--primary);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
    
    @keyframes pulseGlow {
      0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
      50% { box-shadow: 0 0 40px var(--primary-glow), 0 0 60px rgba(0, 212, 170, 0.15); }
    }
    
    @keyframes slideUp {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
    }
    
    @keyframes shimmer {
      0% { background-position: -200% center; }
      100% { background-position: 200% center; }
    }
    
    .exercise-grid .exercise-tile {
      animation: slideUp 0.4s ease backwards;
    }
    .exercise-grid .exercise-tile:nth-child(1) { animation-delay: 0.05s; }
    .exercise-grid .exercise-tile:nth-child(2) { animation-delay: 0.1s; }
    .exercise-grid .exercise-tile:nth-child(3) { animation-delay: 0.15s; }
    .exercise-grid .exercise-tile:nth-child(4) { animation-delay: 0.2s; }
    .exercise-grid .exercise-tile:nth-child(5) { animation-delay: 0.25s; }
    .exercise-grid .exercise-tile:nth-child(6) { animation-delay: 0.3s; }
    
    .start-btn:not(:disabled) {
      animation: pulseGlow 2s ease-in-out infinite;
    }
    
    .position-confirmed {
      background: rgba(0, 184, 148, 0.15) !important;
      border-color: var(--success) !important;
    }
    
    .position-confirmed .instruction {
      color: var(--success) !important;
    }
    
    .loading-text {
      margin-top: 20px;
      color: var(--text-secondary);
      font-size: 0.95rem;
      font-weight: 500;
    }
    
    .status-indicator {
      position: absolute;
      bottom: 90px;
      left: 50%;
      transform: translateX(-50%);
      padding: 10px 24px;
      border-radius: 50px;
      font-size: 0.85rem;
      font-weight: 600;
      z-index: 10;
      backdrop-filter: blur(10px);
    }
    
    .status-indicator.good {
      background: rgba(0, 184, 148, 0.9);
      color: var(--bg-dark);
      box-shadow: 0 4px 20px rgba(0, 184, 148, 0.4);
    }
    
    .status-indicator.warning {
      background: rgba(253, 203, 110, 0.9);
      color: var(--bg-dark);
      box-shadow: 0 4px 20px rgba(253, 203, 110, 0.4);
    }
    
    .status-indicator.bad {
      background: rgba(225, 112, 85, 0.9);
      color: #fff;
      box-shadow: 0 4px 20px rgba(225, 112, 85, 0.4);
    }

    /* History Modal */
    .history-modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 14, 23, 0.95);
      backdrop-filter: blur(10px);
      z-index: 9995;
      justify-content: center;
      align-items: center;
      overflow-y: auto;
      scrollbar-width: none;
      padding: 24px;
      padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .history-modal::-webkit-scrollbar {
      display: none;
    }
    
    .history-modal.active {
      display: block;
    }
    
    .history-content {
      background: var(--bg-card);
      border-radius: 24px;
      padding: 32px;
      padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
      max-width: 1000px;
      width: 100%;
      margin: 0 auto;
      max-height: calc(90vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
      overflow: hidden;
      display: flex;
      flex-direction: column;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
    }
    
    .history-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 24px;
      flex-shrink: 0;
    }
    
    .history-header h2 {
      font-size: 1.5rem;
      font-weight: 700;
      background: linear-gradient(135deg, var(--text-primary), var(--primary));
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      display: flex;
      align-items: center;
      gap: 12px;
    }
    
    .close-history-btn {
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      padding: 10px 20px;
      border-radius: 10px;
      cursor: pointer;
      font-weight: 500;
      transition: all 0.3s;
    }
    
    .close-history-btn:hover {
      background: rgba(225, 112, 85, 0.2);
      border-color: var(--danger);
      color: var(--danger);
    }
    
    .history-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 24px;
      flex-shrink: 0;
      flex-wrap: wrap;
      background: rgba(0, 0, 0, 0.2);
      padding: 6px;
      border-radius: 14px;
    }
    
    .history-tab {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      padding: 10px 18px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 500;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .history-tab:hover {
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-primary);
    }
    
    .history-tab.active {
      background: var(--primary);
      color: var(--bg-dark);
      font-weight: 600;
    }
    
    .history-list {
      flex: 1 1 0%;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior-y: contain;
      padding-right: 8px;
      padding-bottom: env(safe-area-inset-bottom, 0px);
      min-height: 0;
      position: relative;
      touch-action: pan-y;
    }
    
    .history-list::-webkit-scrollbar {
      width: 6px;
    }
    
    .history-list::-webkit-scrollbar-track {
      background: transparent;
      border-radius: 3px;
    }
    
    .history-list::-webkit-scrollbar-thumb {
      background: transparent;
      border-radius: 3px;
    }

    .history-list:hover::-webkit-scrollbar-thumb {
      background: var(--text-muted);
    }
    
    .history-item {
      background: rgba(0, 0, 0, 0.2);
      border-radius: 14px;
      padding: 18px 20px;
      margin-bottom: 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border: 1px solid var(--border-subtle);
      transition: all 0.3s;
    }
    
    .history-item:hover {
      background: rgba(0, 0, 0, 0.3);
      border-color: rgba(0, 212, 170, 0.3);
    }
    
    .history-item-info {
      flex: 1;
    }
    
    .history-item-title {
      font-weight: 600;
      margin-bottom: 6px;
      font-size: 0.95rem;
    }
    
    .history-item-date {
      color: var(--text-muted);
      font-size: 0.8rem;
    }
    
    .history-item-stats {
      display: flex;
      gap: 24px;
      align-items: center;
    }
    
    .history-stat {
      text-align: center;
      padding: 8px 16px;
      background: rgba(0, 0, 0, 0.2);
      border-radius: 10px;
    }
    
    .history-stat-value {
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--primary);
    }
    
    .history-stat-label {
      font-size: 0.7rem;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    
    .history-summary {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 16px;
      margin-bottom: 24px;
      flex-shrink: 0;
    }
    
    .summary-card {
      background: linear-gradient(135deg, rgba(0, 212, 170, 0.1) 0%, rgba(108, 92, 231, 0.1) 100%);
      border-radius: 16px;
      padding: 20px;
      text-align: center;
      border: 1px solid var(--border-subtle);
      transition: all 0.3s;
    }
    
    .summary-card:hover {
      transform: translateY(-2px);
      border-color: var(--primary-glow);
    }
    
    .summary-value {
      font-size: 2rem;
      font-weight: 700;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    
    .summary-label {
      font-size: 0.75rem;
      color: var(--text-secondary);
      margin-top: 6px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      font-weight: 500;
    }
    
    .no-history {
      text-align: center;
      padding: 60px 40px;
      color: var(--text-secondary);
    }
    
    .no-history-icon {
      font-size: 3rem;
      margin-bottom: 16px;
      opacity: 0.5;
    }
    
    /* History Upgrade Prompt */
    .history-upgrade-prompt {
      display: flex;
      align-items: center;
      gap: 16px;
      padding: 20px 24px;
      background: linear-gradient(135deg, rgba(245, 189, 65, 0.1) 0%, rgba(108, 92, 231, 0.1) 100%);
      border: 1px dashed var(--gold);
      border-radius: 16px;
      margin-top: 16px;
    }
    
    .history-upgrade-icon {
      font-size: 2rem;
      opacity: 0.9;
    }
    
    .history-upgrade-text {
      flex: 1;
    }
    
    .history-upgrade-text strong {
      color: var(--gold);
      font-size: 0.95rem;
    }
    
    .history-upgrade-text p {
      margin: 4px 0 0;
      color: var(--text-secondary);
      font-size: 0.85rem;
    }
    
    .history-upgrade-btn {
      background: linear-gradient(135deg, var(--gold) 0%, #e6a817 100%);
      color: #1a1a2e;
      border: none;
      padding: 10px 20px;
      border-radius: 10px;
      font-weight: 600;
      font-size: 0.85rem;
      cursor: pointer;
      transition: all 0.3s;
      white-space: nowrap;
    }
    
    .history-upgrade-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 15px rgba(245, 189, 65, 0.3);
    }
    
    .clear-history-btn {
      background: rgba(225, 112, 85, 0.15);
      border: 1px solid var(--danger);
      color: var(--danger);
      padding: 10px 20px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 500;
      margin-left: 12px;
      transition: all 0.3s;
    }
    
    .clear-history-btn:hover {
      background: rgba(225, 112, 85, 0.3);
      transform: translateY(-1px);
    }
    
    @media (max-width: 700px) {
      .history-summary {
        grid-template-columns: repeat(2, 1fr);
      }
      .history-item-stats {
        flex-direction: column;
        gap: 8px;
      }
      .exercise-content {
        flex-direction: column;
      }
      .side-panel {
        max-width: 100%;
      }
    }
    
    /* Premium/Subscription Styles */
    .premium-badge {
      position: absolute;
      top: 12px;
      right: 12px;
      background: linear-gradient(135deg, #FFD700, #FFA500);
      color: #000;
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 0.65rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 4px;
      z-index: 5;
    }
    
    .exercise-tile.locked .tile-badge {
      display: none;
    }
    
    .exercise-tile.locked {
      opacity: 0.7;
      position: relative;
    }
    
    .exercise-tile.locked::after {
      content: '🔒';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-size: 2.5rem;
      z-index: 10;
      filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    }
    
    .exercise-tile.locked:hover {
      transform: none;
      box-shadow: none;
      border-color: var(--border-subtle);
    }
    
    .exercise-tile.locked:hover::before {
      opacity: 0;
    }
    
    .upgrade-btn {
      position: absolute;
      top: 50%;
      left: 30px;
      transform: translateY(-50%);
      background: linear-gradient(135deg, #FFD700, #FFA500);
      border: none;
      color: #000;
      padding: 10px 18px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 0.85rem;
      font-weight: 600;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    
    .upgrade-btn:hover {
      transform: translateY(-50%) scale(1.05);
      box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
    }
    
    .user-tier {
      display: flex;
      align-items: center;
      gap: 8px;
      background: var(--bg-card);
      padding: 8px 14px;
      border-radius: 20px;
      border: 1px solid var(--border-subtle);
    }
    
    .tier-badge {
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 0.7rem;
      font-weight: 700;
      text-transform: uppercase;
    }
    
    .tier-badge.free {
      background: var(--bg-card-hover);
      color: var(--text-secondary);
    }
    
    .tier-badge.premium {
      background: linear-gradient(135deg, #FFD700, #FFA500);
      color: #000;
    }
    
    /* Subscription Modal */
    .subscription-modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 14, 23, 0.95);
      backdrop-filter: blur(10px);
      z-index: 200;
      overflow-y: auto;
      scrollbar-width: none;
      padding: 20px;
    }

    .subscription-modal::-webkit-scrollbar {
      display: none;
    }
    
    .subscription-modal.active {
      display: block;
    }
    
    .subscription-content {
      background: var(--bg-card);
      border-radius: 28px;
      padding: 40px;
      max-width: 800px;
      width: 100%;
      margin: 0 auto;
      border: 1px solid var(--border-subtle);
      box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
      position: relative;
      overflow: hidden;
    }
    
    .subscription-content::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 4px;
      background: linear-gradient(90deg, #FFD700, #FFA500, var(--primary));
    }
    
    .subscription-header {
      text-align: center;
      margin-bottom: 32px;
    }
    
    .subscription-header h2 {
      font-size: 2rem;
      font-weight: 700;
      margin-bottom: 8px;
      background: linear-gradient(135deg, #FFD700, #FFA500);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    
    .subscription-header p {
      color: var(--text-secondary);
      font-size: 1rem;
    }
    
    .pricing-cards {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 24px;
      margin-bottom: 24px;
    }
    
    .pricing-card {
      background: rgba(0, 0, 0, 0.3);
      border-radius: 20px;
      padding: 28px;
      border: 2px solid var(--border-subtle);
      position: relative;
      transition: all 0.3s;
    }
    
    .pricing-card.featured {
      border-color: #FFD700;
      background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 165, 0, 0.05) 100%);
    }
    
    .pricing-card.featured::before {
      content: 'BEST VALUE';
      position: absolute;
      top: -12px;
      left: 50%;
      transform: translateX(-50%);
      background: linear-gradient(135deg, #FFD700, #FFA500);
      color: #000;
      padding: 4px 16px;
      border-radius: 12px;
      font-size: 0.7rem;
      font-weight: 700;
    }
    
    .pricing-card h3 {
      font-size: 1.3rem;
      font-weight: 600;
      margin-bottom: 8px;
    }
    
    .pricing-card .price {
      font-size: 2.5rem;
      font-weight: 800;
      color: var(--primary);
      margin-bottom: 4px;
    }
    
    .pricing-card.featured .price {
      background: linear-gradient(135deg, #FFD700, #FFA500);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    
    .pricing-card .price span {
      font-size: 1rem;
      font-weight: 400;
      color: var(--text-muted);
      -webkit-text-fill-color: var(--text-muted);
    }
    
    .pricing-card .billing {
      color: var(--text-muted);
      font-size: 0.85rem;
      margin-bottom: 20px;
    }
    
    .pricing-features {
      list-style: none;
      margin-bottom: 24px;
    }
    
    .pricing-features li {
      padding: 8px 0;
      color: var(--text-secondary);
      font-size: 0.9rem;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    
    .pricing-features li::before {
      content: '✓';
      color: var(--primary);
      font-weight: 700;
    }
    
    .pricing-features li.disabled {
      color: var(--text-muted);
      text-decoration: line-through;
    }
    
    .pricing-features li.disabled::before {
      content: '✗';
      color: var(--text-muted);
    }
    
    .pricing-btn {
      width: 100%;
      padding: 14px;
      border-radius: 12px;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
    }
    
    .pricing-btn.secondary {
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
    }
    
    .pricing-btn.primary {
      background: linear-gradient(135deg, #FFD700, #FFA500);
      border: none;
      color: #000;
    }
    
    .pricing-btn.primary:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(255, 215, 0, 0.4);
    }
    
    .close-subscription-btn {
      position: absolute;
      top: 20px;
      right: 20px;
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      width: 40px;
      height: 40px;
      border-radius: 50%;
      cursor: pointer;
      font-size: 1.2rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s;
    }
    
    .close-subscription-btn:hover {
      background: rgba(225, 112, 85, 0.2);
      border-color: var(--danger);
      color: var(--danger);
    }
    
    .guarantee {
      text-align: center;
      color: var(--text-muted);
      font-size: 0.85rem;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    
    @media (max-width: 700px) {
      .pricing-cards {
        grid-template-columns: 1fr;
      }
      .subscription-content {
        padding: 24px;
      }
      .upgrade-btn, .user-tier {
        position: static;
        transform: none;
        margin: 0;
        display: inline-flex;
        justify-content: center;
        width: auto;
      }
      .header-top-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
      }
      .header-top-left {
        justify-content: flex-start;
      }
    }
    
    /* Settings Modal */
    .settings-modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 14, 23, 0.95);
      backdrop-filter: blur(10px);
      z-index: 200;
      overflow-y: auto;
      scrollbar-width: none;
      padding: 40px 20px;
    }

    .settings-modal::-webkit-scrollbar {
      display: none;
    }
    
    .settings-modal.active {
      display: block;
    }
    
    .settings-content {
      max-width: 500px;
      margin: 0 auto;
      background: var(--bg-card);
      border-radius: 20px;
      border: 1px solid var(--border-subtle);
      overflow: hidden;
    }
    
    .settings-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px 24px;
      border-bottom: 1px solid var(--border-subtle);
      background: linear-gradient(135deg, rgba(108, 92, 231, 0.1) 0%, rgba(0, 212, 170, 0.1) 100%);
    }
    
    .settings-header h2 {
      font-size: 1.3rem;
      font-weight: 600;
    }
    
    .close-settings-btn {
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      width: 36px;
      height: 36px;
      border-radius: 50%;
      cursor: pointer;
      font-size: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s;
    }
    
    .close-settings-btn:hover {
      background: rgba(225, 112, 85, 0.2);
      border-color: var(--danger);
      color: var(--danger);
    }
    
    .settings-section {
      padding: 20px 24px;
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .settings-section:last-of-type {
      border-bottom: none;
    }
    
    .settings-section h3 {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text-secondary);
      margin-bottom: 16px;
    }
    
    .settings-field {
      margin-bottom: 16px;
    }
    
    .settings-field:last-child {
      margin-bottom: 0;
    }
    
    .settings-field label {
      display: block;
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-bottom: 6px;
    }
    
    .settings-field input {
      width: 100%;
      padding: 12px 14px;
      background: var(--bg-dark);
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      color: var(--text-primary);
      font-size: 0.95rem;
      transition: all 0.3s;
    }
    
    .settings-field input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px var(--primary-glow);
    }
    
    .settings-toggle {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
    }
    
    .settings-toggle span {
      color: var(--text-primary);
      font-size: 0.95rem;
    }
    
    .toggle-switch {
      position: relative;
      width: 50px;
      height: 26px;
    }
    
    .toggle-switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    
    .toggle-slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: var(--bg-dark);
      border: 1px solid var(--border-subtle);
      border-radius: 26px;
      transition: all 0.3s;
    }
    
    .toggle-slider:before {
      position: absolute;
      content: "";
      height: 20px;
      width: 20px;
      left: 2px;
      bottom: 2px;
      background: var(--text-muted);
      border-radius: 50%;
      transition: all 0.3s;
    }
    
    .toggle-switch input:checked + .toggle-slider {
      background: var(--primary);
      border-color: var(--primary);
    }
    
    .toggle-switch input:checked + .toggle-slider:before {
      transform: translateX(24px);
      background: #fff;
    }
    
    .subscription-status {
      background: var(--bg-dark);
      border-radius: 12px;
      padding: 16px;
    }
    
    .sub-tier {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
    }
    
    .sub-tier-badge {
      padding: 4px 12px;
      border-radius: 8px;
      font-size: 0.75rem;
      font-weight: 700;
    }
    
    .sub-tier-badge.free {
      background: var(--bg-card-hover);
      color: var(--text-muted);
    }
    
    .sub-tier-badge.pro {
      background: linear-gradient(135deg, #FFD700, #FFA500);
      color: #000;
    }
    
    .sub-expires {
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-bottom: 12px;
    }
    
    .upgrade-btn {
      width: 100%;
      padding: 12px;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      border: none;
      border-radius: 10px;
      color: #fff;
      font-size: 0.9rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
    }
    
    .upgrade-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 15px var(--primary-glow);
    }
    
    .cancel-sub-btn {
      width: 100%;
      padding: 12px;
      background: transparent;
      border: 1px solid var(--danger);
      border-radius: 10px;
      color: var(--danger);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s;
    }
    
    .cancel-sub-btn:hover {
      background: rgba(225, 112, 85, 0.15);
    }
    
    .legal-links {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    
    .legal-links a {
      color: var(--text-secondary);
      text-decoration: none;
      font-size: 0.9rem;
      padding: 10px 0;
      border-bottom: 1px solid var(--border-subtle);
      display: flex;
      justify-content: space-between;
      align-items: center;
      transition: color 0.3s;
    }
    
    .legal-links a:hover {
      color: var(--primary);
    }
    
    .legal-links a::after {
      content: '→';
      color: var(--text-muted);
    }
    
    .settings-footer {
      padding: 16px 24px;
      text-align: center;
      background: var(--bg-dark);
    }
    
    .settings-footer p {
      color: var(--text-muted);
      font-size: 0.8rem;
    }
    
    /* Legal Modal */
    .legal-modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 14, 23, 0.95);
      backdrop-filter: blur(10px);
      z-index: 250;
      overflow-y: auto;
      padding: 40px 20px;
    }
    
    .legal-modal.active {
      display: block;
    }
    
    .legal-content {
      max-width: 700px;
      margin: 0 auto;
      background: var(--bg-card);
      border-radius: 20px;
      border: 1px solid var(--border-subtle);
      overflow: hidden;
    }
    
    .legal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 20px 24px;
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .legal-header h2 {
      font-size: 1.2rem;
      font-weight: 600;
    }
    
    .close-legal-btn {
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      color: var(--text-primary);
      width: 36px;
      height: 36px;
      border-radius: 50%;
      cursor: pointer;
      font-size: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s;
    }
    
    .close-legal-btn:hover {
      background: rgba(225, 112, 85, 0.2);
      border-color: var(--danger);
      color: var(--danger);
    }
    
    .legal-body {
      padding: 24px;
      color: var(--text-secondary);
      font-size: 0.9rem;
      line-height: 1.7;
      max-height: 60vh;
      overflow-y: auto;
    }
    
    .legal-body h3 {
      color: var(--text-primary);
      font-size: 1rem;
      margin: 20px 0 10px;
    }
    
    .legal-body h3:first-child {
      margin-top: 0;
    }
    
    .legal-body p {
      margin-bottom: 12px;
    }
    
    .legal-body ul {
      margin: 10px 0 10px 20px;
    }
    
    .legal-body ul li {
      margin-bottom: 6px;
    }
    
    .legal-footer {
      padding: 16px 24px;
      border-top: 1px solid var(--border-subtle);
      display: flex;
      justify-content: center;
    }
    
    .legal-close-btn {
      padding: 12px 32px;
      background: var(--primary);
      border: none;
      border-radius: 10px;
      color: #fff;
      font-size: 0.9rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
    }
    
    .legal-close-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 15px var(--primary-glow);
    }
    
    /* Auth Modal Styles */
    .auth-modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 14, 23, 0.98);
      backdrop-filter: blur(10px);
      z-index: 300;
      overflow-y: auto;
      scrollbar-width: none;
      padding: 20px;
    }

    .auth-modal::-webkit-scrollbar {
      display: none;
    }
    
    .auth-modal.active {
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    
    .auth-content {
      max-width: 380px;
      width: 100%;
      background: var(--bg-card);
      border-radius: 20px;
      border: 1px solid var(--border-subtle);
      overflow: hidden;
      flex-shrink: 0;
      margin: auto 0;
    }
    
    .auth-header {
      text-align: center;
      padding: 20px 20px 14px;
      background: linear-gradient(135deg, rgba(0, 212, 170, 0.1) 0%, rgba(108, 92, 231, 0.1) 100%);
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .auth-header .logo-icon {
      width: 48px;
      height: 48px;
      margin: 0 auto 10px;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
    }
    
    .auth-header h2 {
      font-size: 1.25rem;
      margin-bottom: 6px;
    }
    
    .auth-header p {
      color: var(--text-secondary);
      font-size: 0.82rem;
    }
    
    .auth-tabs {
      display: flex;
      border-bottom: 1px solid var(--border-subtle);
    }
    
    .auth-tab {
      flex: 1;
      padding: 10px;
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s;
      border-bottom: 2px solid transparent;
    }
    
    .auth-tab:hover {
      color: var(--text-secondary);
    }
    
    .auth-tab.active {
      color: var(--primary);
      border-bottom-color: var(--primary);
    }
    
    .auth-form {
      padding: 18px 20px;
      display: none;
    }
    
    .auth-form.active {
      display: block;
    }
    
    .auth-field {
      margin-bottom: 12px;
    }
    
    .auth-field label {
      display: block;
      font-size: 0.85rem;
      color: var(--text-secondary);
      margin-bottom: 6px;
    }
    
    .auth-field input {
      width: 100%;
      padding: 10px 12px;
      background: var(--bg-dark);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      color: var(--text-primary);
      font-size: 0.9rem;
      transition: all 0.3s;
    }
    
    .auth-field input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px var(--primary-glow);
    }
    
    .auth-error {
      color: var(--danger);
      font-size: 0.85rem;
      margin-top: 6px;
      display: none;
    }
    
    .auth-error.show {
      display: block;
    }
    
    .auth-submit {
      width: 100%;
      padding: 11px;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      border: none;
      border-radius: 8px;
      color: #fff;
      font-size: 0.92rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s;
      margin-top: 6px;
    }
    
    .auth-submit:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 20px var(--primary-glow);
    }
    
    .auth-submit:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }
    
    .auth-divider {
      display: flex;
      align-items: center;
      margin: 14px 0;
      color: var(--text-muted);
      font-size: 0.85rem;
    }
    
    .auth-divider::before,
    .auth-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border-subtle);
    }
    
    .auth-divider span {
      padding: 0 12px;
    }
    
    .guest-btn {
      width: 100%;
      padding: 10px;
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      color: var(--text-primary);
      font-size: 0.88rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    
    .guest-btn:hover {
      background: var(--bg-card);
      border-color: var(--text-muted);
    }
    
    .auth-footer {
      padding: 12px 20px;
      text-align: center;
      background: var(--bg-dark);
      font-size: 0.8rem;
      color: var(--text-muted);
    }
    
    .auth-footer a {
      color: var(--primary);
      text-decoration: none;
    }
    
    /* Payment Form Styles */
    .payment-form {
      display: none;
      padding: 24px;
    }
    
    .payment-form.active {
      display: block;
    }
    
    .payment-summary {
      background: var(--bg-dark);
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 20px;
    }
    
    .payment-summary-row {
      display: flex;
      justify-content: space-between;
      padding: 8px 0;
      color: var(--text-secondary);
      font-size: 0.9rem;
    }
    
    .payment-summary-row.total {
      border-top: 1px solid var(--border-subtle);
      margin-top: 8px;
      padding-top: 12px;
      color: var(--text-primary);
      font-weight: 600;
      font-size: 1.1rem;
    }
    
    .payment-summary-row .discount {
      color: var(--success);
    }
    
    .coupon-field {
      display: flex;
      gap: 10px;
      margin-bottom: 16px;
    }
    
    .coupon-field input {
      flex: 1;
      padding: 12px 14px;
      background: var(--bg-dark);
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      color: var(--text-primary);
      font-size: 0.9rem;
      text-transform: uppercase;
    }
    
    .coupon-field input:focus {
      outline: none;
      border-color: var(--primary);
    }
    
    .coupon-apply-btn {
      padding: 12px 20px;
      background: var(--bg-card-hover);
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      color: var(--text-primary);
      font-size: 0.9rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s;
    }
    
    .coupon-apply-btn:hover {
      border-color: var(--primary);
    }
    
    .coupon-message {
      font-size: 0.85rem;
      margin-top: 8px;
      display: none;
    }
    
    .coupon-message.success {
      color: var(--success);
      display: block;
    }
    
    .coupon-message.error {
      color: var(--danger);
      display: block;
    }
    
    .payment-btn {
      width: 100%;
      padding: 16px;
      background: linear-gradient(135deg, #FFD700, #FFA500);
      border: none;
      border-radius: 12px;
      color: #000;
      font-size: 1rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.3s;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }
    
    .payment-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(255, 215, 0, 0.4);
    }
    
    .payment-btn:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }
    
    .payment-secure {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      margin-top: 16px;
      color: var(--text-muted);
      font-size: 0.8rem;
    }
    
    .back-to-plans {
      background: none;
      border: none;
      color: var(--text-secondary);
      font-size: 0.9rem;
      cursor: pointer;
      padding: 10px;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: color 0.3s;
    }
    
    .back-to-plans:hover {
      color: var(--primary);
    }
    
    /* Account info in header */
    .user-account {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    
    .user-avatar {
      width: 36px;
      height: 36px;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      font-weight: 600;
      color: #fff;
    }
    
    .user-info {
      text-align: left;
    }
    
    .user-name {
      font-size: 0.85rem;
      font-weight: 500;
      color: var(--text-primary);
    }
    
    .user-email {
      font-size: 0.75rem;
      color: var(--text-muted);
    }
    
    .user-guest {
      color: var(--text-secondary);
      font-size: 0.85rem;
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      padding: 8px 14px;
      background: var(--bg-card);
      border-radius: 8px;
      border: 1px solid var(--border-subtle);
      transition: all 0.3s;
    }
    
    .user-guest:hover {
      border-color: var(--primary);
    }
    
    @media (max-width: 700px) {
      .user-account {
        justify-content: center;
        margin-bottom: 0;
      }
    }
    
    /* ============================================
       COMPREHENSIVE MOBILE RESPONSIVE STYLES
       ============================================ */

    /* Small screens - phones */
    @media screen and (max-width: 768px) {
      html, body {
        overflow-x: hidden;
        overflow-y: auto;
        width: 100%;
        max-width: 100vw;
      }
      
      #selectionPage {
        min-height: auto;
        height: auto;
        overflow-y: auto;
      }
      
      .header {
        padding: 14px 12px;
      }
      
      .header h1 {
        font-size: 1.2rem;
      }
      
      .header p {
        font-size: 0.8rem;
      }
      
      .header-buttons {
        gap: 8px;
      }
      
      .header-buttons button {
        padding: 8px 12px;
        font-size: 0.8rem;
      }
      
      .exercise-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
      }
      
      .exercise-tile {
        padding: 16px;
      }
      
      .exercise-tile h3 {
        font-size: 1rem;
      }
      
      .exercise-tile p {
        font-size: 0.85rem;
      }
      
      /* Exercise Page - Critical for camera view */
      .exercise-page {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
      }
      
      .exercise-header {
        padding: 6px 10px;
        flex-wrap: nowrap;
        gap: 6px;
      }
      
      .exercise-header h2 {
        font-size: 0.9rem;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      
      .back-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 8px;
      }
      
      .back-btn span { display: none; }
      .back-btn::before { content: '←'; }
      
      .score-display {
        padding: 4px 10px;
        border-radius: 10px;
      }
      
      .score-display .score {
        font-size: 1.1rem;
      }
      
      .score-display .label {
        font-size: 0.6rem;
      }
      
      .exercise-content {
        flex-direction: column !important;
        gap: 0;
        padding: 4px;
        flex: 1;
        min-height: 0;
        overflow: hidden;
      }
      
      .video-container {
        flex: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        border-radius: 12px;
      }
      
      .video-container video,
      .video-container canvas {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
      
      /* Hide only the data panels, keep action buttons */
      .side-panel {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        height: auto !important;
        padding: 6px 8px !important;
        overflow: visible !important;
        border-radius: 10px !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px !important;
      }

      .side-panel .panel-section {
        display: none !important;
      }

      .side-panel .calibration-status {
        display: none !important;
      }

      .side-panel .voice-toggle {
        flex: 1;
        min-width: 0;
        padding: 8px 10px;
        font-size: 0.8rem;
        margin: 0;
        order: 1;
      }

      .side-panel .calibrate-btn {
        flex: none;
        padding: 8px 10px;
        font-size: 0.8rem;
        margin: 0;
        order: 2;
      }

      .side-panel .start-btn {
        flex: 1 1 100%;
        padding: 10px 16px;
        font-size: 0.9rem;
        margin: 0;
        order: 3;
      }
      
      .instruction-overlay {
        padding: 8px 14px;
        top: 6px;
        max-width: 85%;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
      }
      
      .instruction-overlay .instruction {
        font-size: 0.85rem;
        line-height: 1.2;
      }
      
      .instruction-overlay .sub-instruction {
        font-size: 0.7rem;
        margin-top: 3px;
      }
      
      .rep-counter {
        padding: 6px 18px;
        font-size: 0.85rem;
        bottom: 8px;
        border-radius: 30px;
        box-shadow: 0 4px 16px var(--primary-glow);
      }
      
      .status-indicator {
        bottom: 48px;
        padding: 6px 14px;
        font-size: 0.75rem;
        border-radius: 30px;
      }
      
      .voice-toggle {
        padding: 8px 14px;
        font-size: 0.8rem;
      }
      
      .start-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
      }
      
      /* Modals */
      .results-modal,
      .history-modal,
      .subscription-modal,
      .settings-modal,
      .auth-modal,
      .legal-modal {
        padding: 8px;
      }
      
      .results-content,
      .history-content,
      .subscription-content,
      .settings-content,
      .auth-content,
      .legal-content {
        max-width: 100%;
        width: 100%;
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 16px;
        max-height: calc(95vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
      }

      /* Auth modal: let the modal scroll the card on small screens */
      .auth-modal.active {
        align-items: flex-start;
      }
      .auth-content {
        max-height: none;
        overflow: visible;
        flex-shrink: 0;
        margin: auto 0;
      }

      /* Settings modal: remove max-height so outer modal scrolls the card */
      .settings-content {
        max-height: none;
        overflow: visible;
      }

      /* Subscription / Legal modals: same scroll fix */
      .subscription-content,
      .legal-content {
        max-height: none;
        overflow: visible;
      }

      /* History modal: same scroll fix - let outer modal scroll the card */
      .history-content {
        max-height: none;
        overflow: visible;
      }

      .history-header {
        flex-shrink: 0;
        margin-bottom: 12px;
        flex-wrap: wrap;
        gap: 8px;
      }

      .history-header h2 {
        font-size: 1.15rem;
      }

      .history-summary {
        flex-shrink: 0;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
      }

      .summary-card {
        padding: 12px 8px;
      }

      .summary-value {
        font-size: 1.3rem;
      }

      .history-tabs {
        flex-shrink: 0;
        margin-bottom: 12px;
        gap: 4px;
        padding: 4px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
      }

      .history-tab {
        padding: 8px 12px;
        font-size: 0.78rem;
        white-space: nowrap;
        flex-shrink: 0;
      }

      .history-list {
        flex: 1 1 0%;
        min-height: 120px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        position: relative;
      }

      .history-item {
        padding: 12px 14px;
        margin-bottom: 8px;
      }

      .history-item-stats {
        flex-direction: column;
        gap: 6px;
      }

      .pricing-cards {
        flex-direction: column;
        gap: 16px;
      }

      .pricing-card {
        padding: 20px;
      }
    }
    
    /* Very small screens - small phones (iPhone SE, Galaxy S) */
    @media screen and (max-width: 400px) {
      .header {
        padding: 10px 8px;
      }
      
      .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 1rem;
      }
      
      .header h1 {
        font-size: 1rem;
      }
      
      .exercise-header {
        padding: 4px 8px;
      }
      
      .exercise-header h2 {
        font-size: 0.8rem;
      }
      
      .score-display .score {
        font-size: 1rem;
      }
      
      .instruction-overlay {
        padding: 6px 10px;
        top: 4px;
        max-width: 80%;
      }
      
      .instruction-overlay .instruction {
        font-size: 0.78rem;
      }
      
      .instruction-overlay .sub-instruction {
        font-size: 0.65rem;
      }
      
      .rep-counter {
        padding: 5px 14px;
        font-size: 0.78rem;
        bottom: 6px;
      }
      
      .status-indicator {
        bottom: 40px;
        padding: 5px 12px;
        font-size: 0.7rem;
      }
      
      .exercise-tile {
        padding: 12px;
      }
    }
    
    /* Landscape orientation on phones */
    @media screen and (max-width: 900px) and (orientation: landscape) {
      .exercise-page {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
      }
      
      .exercise-header {
        padding: 4px 10px;
      }
      
      .exercise-header h2 {
        font-size: 0.85rem;
      }
      
      .score-display .score {
        font-size: 1rem;
      }
      
      .score-display .label {
        font-size: 0.55rem;
      }
      
      .exercise-content {
        flex-direction: row !important;
        flex: 1;
        min-height: 0;
        padding: 4px;
        gap: 6px;
      }
      
      .video-container {
        flex: 2 !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        border-radius: 10px;
      }
      
      .side-panel {
        flex: 1 !important;
        max-width: 240px !important;
        max-height: none !important;
        overflow-y: auto;
        padding: 6px;
        gap: 4px;
      }
      
      .panel-section {
        padding: 6px 8px;
      }
      
      .panel-section h4 {
        font-size: 0.6rem;
        margin-bottom: 2px;
      }
      
      .metric {
        padding: 2px 0;
      }
      
      .metric .label,
      .metric .value {
        font-size: 0.7rem;
      }
      
      .start-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
      }
      
      .voice-toggle {
        padding: 6px 10px;
        font-size: 0.7rem;
      }
      
      .instruction-overlay {
        padding: 6px 12px;
        top: 4px;
      }
      
      .instruction-overlay .instruction {
        font-size: 0.8rem;
      }
      
      .instruction-overlay .sub-instruction {
        font-size: 0.65rem;
        margin-top: 2px;
      }
      
      .rep-counter {
        padding: 5px 14px;
        font-size: 0.8rem;
        bottom: 6px;
      }
      
      .status-indicator {
        bottom: 38px;
        padding: 5px 12px;
        font-size: 0.7rem;
      }
    }
    
    /* Tablet styles */
    @media screen and (min-width: 769px) and (max-width: 1024px) {
      .exercise-grid {
        grid-template-columns: repeat(2, 1fr);
      }
      
      .exercise-content {
        gap: 16px;
      }
      
      .side-panel {
        max-width: 280px;
      }
    }

    /* ============================================
       ONBOARDING OVERLAY
       ============================================ */
    .onboarding-overlay {
      position: fixed;
      inset: 0;
      background: rgba(10, 14, 23, 0.97);
      backdrop-filter: blur(20px);
      z-index: 500;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 20px;
    }
    .onboarding-overlay.hidden { display: none; }
    .onboarding-card {
      background: var(--bg-card);
      border-radius: 24px;
      border: 1px solid var(--border-subtle);
      max-width: 480px;
      width: 100%;
      padding: 36px 32px;
      text-align: center;
      position: relative;
      overflow: hidden;
    }
    .onboarding-card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 4px;
      background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    }
    .onboarding-hero { font-size: 3.5rem; margin-bottom: 16px; }
    .onboarding-card h2 {
      font-size: 1.5rem; font-weight: 700; margin-bottom: 8px;
    }
    .onboarding-card .subtitle {
      color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 24px;
    }
    .onboarding-steps {
      text-align: left; margin-bottom: 28px;
      display: flex; flex-direction: column; gap: 14px;
    }
    .onboarding-step {
      display: flex; align-items: flex-start; gap: 12px;
      background: rgba(0,0,0,0.2); border-radius: 12px; padding: 12px 14px;
      border: 1px solid var(--border-subtle);
    }
    .onboarding-step .step-icon {
      font-size: 1.5rem; flex-shrink: 0; margin-top: 2px;
    }
    .onboarding-step .step-text h4 {
      font-size: 0.85rem; font-weight: 600; margin-bottom: 2px;
    }
    .onboarding-step .step-text p {
      font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4;
    }
    .onboarding-dots {
      display: flex; justify-content: center; gap: 8px; margin-bottom: 20px;
    }
    .onboarding-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--text-muted); transition: all 0.3s;
    }
    .onboarding-dot.active {
      background: var(--primary); width: 24px; border-radius: 4px;
    }
    .onboarding-btn {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      border: none; color: var(--bg-dark);
      padding: 14px 32px; border-radius: 12px;
      font-size: 1rem; font-weight: 700; cursor: pointer;
      width: 100%; text-transform: uppercase; letter-spacing: 0.5px;
      transition: all 0.3s;
    }
    .onboarding-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 32px var(--primary-glow); }
    .onboarding-skip {
      background: none; border: none; color: var(--text-muted);
      font-size: 0.8rem; cursor: pointer; margin-top: 12px;
      padding: 8px; transition: color 0.3s;
    }
    .onboarding-skip:hover { color: var(--text-secondary); }

    /* ============================================
       STREAK DISPLAY
       ============================================ */
    .streak-display {
      display: inline-flex; align-items: center; gap: 6px;
      background: linear-gradient(135deg, rgba(253,203,110,0.15), rgba(225,112,85,0.15));
      border: 1px solid rgba(253,203,110,0.3);
      padding: 6px 14px; border-radius: 20px;
      font-size: 0.85rem; font-weight: 600; margin-top: 10px;
    }
    .streak-display .streak-fire { font-size: 1.1rem; }
    .streak-display .streak-count { color: var(--warning); }
    .streak-display .streak-label { color: var(--text-secondary); font-weight: 400; font-size: 0.75rem; }

    /* ============================================
       SHARE BUTTON ON RESULTS
       ============================================ */
    .share-btn {
      background: linear-gradient(135deg, #6C5CE7, #A29BFE);
      border: none; color: #fff;
      padding: 12px 24px; border-radius: 12px;
      font-size: 0.9rem; font-weight: 600; cursor: pointer;
      display: flex; align-items: center; justify-content: center; gap: 8px;
      transition: all 0.3s; width: 100%; margin-top: 8px;
    }
    .share-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108,92,231,0.4); }
    .share-copied {
      font-size: 0.75rem; color: var(--success);
      margin-top: 4px; min-height: 1.2em;
    }

    /* ============================================
       CAMERA ERROR OVERLAY
       ============================================ */
    .camera-error-overlay {
      position: absolute; inset: 0;
      background: var(--bg-card);
      display: flex; flex-direction: column;
      justify-content: center; align-items: center;
      z-index: 30; border-radius: 20px; padding: 24px;
      text-align: center;
    }
    .camera-error-overlay .error-icon { font-size: 3rem; margin-bottom: 16px; }
    .camera-error-overlay h3 { font-size: 1.1rem; margin-bottom: 8px; }
    .camera-error-overlay p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; max-width: 320px; }
    .camera-error-overlay .retry-camera-btn {
      background: var(--primary); border: none; color: var(--bg-dark);
      padding: 10px 24px; border-radius: 10px; font-weight: 600;
      cursor: pointer; margin-top: 16px; font-size: 0.9rem;
    }
    .camera-error-overlay .error-tips {
      text-align: left; margin-top: 16px; font-size: 0.78rem;
      color: var(--text-muted); line-height: 1.6;
    }

    /* ============================================
       CONFETTI BURST ON COMPLETION
       ============================================ */
    .confetti-piece {
      position: fixed; z-index: 600; pointer-events: none;
      width: 10px; height: 10px; border-radius: 2px;
      animation: confettiFall 2.5s ease-out forwards;
    }
    @keyframes confettiFall {
      0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
      100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.3); }
    }

    /* ============================================
       TILE PRIVACY BADGE
       ============================================ */
    .tile-privacy {
      font-size: 0.65rem;
      color: var(--text-muted);
      background: rgba(0, 0, 0, 0.25);
      padding: 2px 8px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      white-space: nowrap;
      font-weight: 500;
      letter-spacing: 0.2px;
    }

    /* ============================================
       CAMERA OPTIONAL BADGE
       ============================================ */
    .camera-optional-badge {
      font-size: 0.65rem;
      color: var(--primary);
      background: rgba(0, 213, 190, 0.1);
      border: 1px solid rgba(0, 213, 190, 0.2);
      padding: 3px 10px;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      white-space: nowrap;
      font-weight: 600;
      margin-top: 4px;
    }

    /* ============================================
       HEADER CREDIBILITY + PRIVACY
       ============================================ */
    .credibility-line {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin: 4px 0 0;
      font-style: italic;
      font-weight: 400;
    }

    .privacy-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(0, 213, 190, 0.08);
      border: 1px solid rgba(0, 213, 190, 0.2);
      padding: 6px 16px;
      border-radius: 20px;
      font-size: 0.75rem;
      color: var(--primary);
      font-weight: 600;
      margin-top: 10px;
    }

    /* ============================================
       DISCLAIMER FOOTER
       ============================================ */
    .disclaimer-footer {
      text-align: center;
      padding: 16px 20px;
      font-size: 0.7rem;
      color: var(--text-muted);
      line-height: 1.5;
      border-top: 1px solid var(--border-subtle);
      margin-top: 8px;
    }
    .disclaimer-footer a {
      color: var(--primary);
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 2px;
    }
    .disclaimer-footer a:hover {
      color: var(--secondary);
    }

    /* ============================================
       CAMERA PRIVACY BANNER (exercise page)
       ============================================ */
    .privacy-camera-banner {
      text-align: center;
      font-size: 0.72rem;
      color: var(--text-muted);
      padding: 6px 12px;
      background: rgba(0, 213, 190, 0.06);
      border-radius: 8px;
      margin: 4px 0 8px;
    }

    /* ============================================
       GUIDED TIMER VISUAL (camera-optional mode)
       ============================================ */
    .guided-timer-visual {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      background: var(--bg-dark);
      border-radius: 20px;
      z-index: 25;
      gap: 16px;
    }

    .guided-icon {
      font-size: 4rem;
      line-height: 1;
      animation: guidedPulse 2s ease-in-out infinite;
    }

    .guided-label {
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--text-primary);
      letter-spacing: 0.5px;
    }

    .guided-timer-ring {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 140px;
      height: 140px;
    }

    .guided-timer-ring svg {
      width: 100%;
      height: 100%;
    }

    .guided-countdown {
      position: absolute;
      font-size: 2rem;
      font-weight: 800;
      color: var(--primary);
      font-variant-numeric: tabular-nums;
    }

    .guided-rep-info {
      font-size: 0.85rem;
      color: var(--text-muted);
      font-weight: 500;
    }

    @keyframes guidedPulse {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.08); }
    }

    /* ============================================
       IMPROVEMENT TIPS (post-exercise results)
       ============================================ */
    .improvement-tips {
      text-align: left;
      margin-top: 16px;
      padding: 14px 16px;
      background: rgba(0, 0, 0, 0.2);
      border-radius: 12px;
      border: 1px solid var(--border-subtle);
    }

    .improvement-tips h4 {
      font-size: 0.85rem;
      font-weight: 700;
      margin-bottom: 10px;
      color: var(--text-primary);
    }

    .tip-item {
      font-size: 0.78rem;
      color: var(--text-secondary);
      padding: 6px 0;
      line-height: 1.5;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .tip-item:last-child {
      border-bottom: none;
      padding-bottom: 0;
    }

    /* ============================================
       ONBOARDING TIPS LINE
       ============================================ */
    .onboarding-tips {
      font-size: 0.75rem;
      color: var(--text-muted);
      background: rgba(0, 0, 0, 0.15);
      border: 1px solid var(--border-subtle);
      border-radius: 10px;
      padding: 10px 14px;
      margin-bottom: 24px;
      line-height: 1.5;
      text-align: left;
    }

    /* ============================================
       ACCESSIBILITY: REDUCED MOTION
       ============================================ */
    @media (prefers-reduced-motion: reduce) {
      .confetti-piece,
      .guided-icon {
        animation: none !important;
      }

      .tile-shimmer::before,
      .floating-emoji {
        animation: none !important;
        display: none !important;
      }

      .onboarding-btn:hover,
      .share-btn:hover,
      .exercise-tile:hover {
        transform: none !important;
      }

      * {
        transition-duration: 0.01ms !important;
      }
    }

    /* ============================================
       FOCUS VISIBLE (keyboard navigation)
       ============================================ */
    /* ============================================
       CAMERA CHOICE MODAL
       ============================================ */
    .camera-choice-modal {
      position: fixed;
      inset: 0;
      z-index: 1000;
      display: none;
      justify-content: center;
      align-items: center;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(8px);
      padding: 20px;
    }
    .camera-choice-modal.active {
      display: flex;
    }
    .camera-choice-content {
      background: var(--bg-card);
      border: 1px solid var(--glass-border);
      border-radius: 20px;
      padding: 32px 28px;
      max-width: 420px;
      width: 100%;
      text-align: center;
      position: relative;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
      animation: cameraChoiceIn 0.3s ease;
    }
    @keyframes cameraChoiceIn {
      from { opacity: 0; transform: scale(0.92) translateY(16px); }
      to { opacity: 1; transform: scale(1) translateY(0); }
    }
    .camera-choice-close {
      position: absolute;
      top: 14px;
      right: 14px;
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 1.2rem;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
      transition: all 0.2s;
    }
    .camera-choice-close:hover {
      background: rgba(255,255,255,0.08);
      color: var(--text-primary);
    }
    .camera-choice-icon {
      font-size: 3rem;
      margin-bottom: 8px;
    }
    .camera-choice-content h2 {
      font-size: 1.3rem;
      font-weight: 700;
      margin-bottom: 6px;
      color: var(--text-primary);
    }
    .camera-choice-desc {
      font-size: 0.88rem;
      color: var(--text-secondary);
      margin-bottom: 24px;
      line-height: 1.5;
    }
    .camera-choice-options {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-bottom: 20px;
    }
    .camera-choice-btn {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 16px 18px;
      border-radius: 14px;
      border: 1px solid var(--border-subtle);
      background: var(--bg-dark);
      cursor: pointer;
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
      text-align: left;
    }
    .camera-choice-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }
    .camera-choice-with:hover {
      border-color: var(--secondary);
      background: rgba(108, 92, 231, 0.08);
    }
    .camera-choice-without:hover {
      border-color: var(--primary);
      background: rgba(0, 212, 170, 0.08);
    }
    .camera-choice-btn-icon {
      font-size: 1.8rem;
      flex-shrink: 0;
    }
    .camera-choice-btn-label {
      display: block;
      font-size: 1rem;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 2px;
    }
    .camera-choice-btn-desc {
      display: block;
      font-size: 0.78rem;
      color: var(--text-muted);
      line-height: 1.4;
    }
    .camera-choice-privacy {
      font-size: 0.72rem;
      color: var(--text-muted);
    }

    .exercise-tile:focus-visible {
      outline: 2px solid var(--primary);
      outline-offset: 3px;
      box-shadow: 0 0 0 4px var(--primary-glow);
    }

    .onboarding-btn:focus-visible,
    .onboarding-skip:focus-visible,
    .retry-camera-btn:focus-visible,
    .share-btn:focus-visible,
    .modal-close:focus-visible,
    .back-btn:focus-visible {
      outline: 2px solid var(--primary);
      outline-offset: 2px;
    }

    /* ============================================
       MAIN TAB NAVIGATION
       ============================================ */
    .main-tabs {
      display: flex;
      gap: 6px;
      padding: 6px;
      margin: 0 auto;
      max-width: 480px;
      width: calc(100% - 40px);
      background: rgba(0, 0, 0, 0.25);
      border-radius: 16px;
      border: 1px solid var(--border-subtle);
      margin-top: -8px;
      margin-bottom: 4px;
      position: relative;
      z-index: 5;
    }
    .main-tab {
      flex: 1;
      padding: 11px 8px;
      border: none;
      border-radius: 12px;
      background: transparent;
      color: var(--text-muted);
      font-size: 0.88rem;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      white-space: nowrap;
    }
    .main-tab:hover {
      color: var(--text-secondary);
      background: rgba(255, 255, 255, 0.04);
    }
    .main-tab.active {
      background: var(--primary);
      color: var(--bg-dark);
      box-shadow: 0 4px 16px rgba(0, 212, 170, 0.3);
    }
    .main-tab-icon {
      font-size: 1rem;
    }
    .tab-content {
      display: none;
      flex: 1;
      min-height: 0;
    }
    .tab-content.active {
      display: flex;
      flex-direction: column;
    }
    @media (max-width: 700px) {
      .main-tabs {
        width: calc(100% - 32px);
        margin-top: -4px;
      }
      .main-tab {
        padding: 10px 6px;
        font-size: 0.82rem;
        gap: 4px;
      }
      .main-tab-icon { font-size: 0.9rem; }
    }

    /* ============================================
       MEDITATION BADGE & ICON COLORS
       ============================================ */
    .meditation-badge {
      background: rgba(108, 92, 231, 0.15) !important;
      color: var(--secondary) !important;
      border-color: rgba(108, 92, 231, 0.3) !important;
    }
    .meditation-icon {
      background: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(253, 121, 168, 0.15) 100%) !important;
    }
    .meditation-tile:hover {
      border-color: rgba(108, 92, 231, 0.5) !important;
      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 40px rgba(108, 92, 231, 0.2) !important;
    }
    .meditation-tile::before {
      background: linear-gradient(90deg, var(--secondary), var(--accent)) !important;
    }

    /* ============================================
       MEDITATION PLAYER PAGE
       ============================================ */
    .meditation-page {
      position: fixed;
      inset: 0;
      background: var(--bg-dark);
      z-index: 100;
      display: none;
      flex-direction: column;
      overflow: hidden;
    }
    .meditation-page.active {
      display: flex;
    }
    .meditation-player-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 24px;
      border-bottom: 1px solid var(--border-subtle);
      flex-shrink: 0;
    }
    .meditation-player-title {
      font-size: 1.2rem;
      font-weight: 700;
      color: var(--text-primary);
    }
    .meditation-player-body {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      padding: 24px;
      gap: 32px;
    }
    .meditation-visual {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 20px;
    }
    .meditation-ring-container {
      position: relative;
      width: 220px;
      height: 220px;
    }
    .meditation-ring-svg {
      width: 100%;
      height: 100%;
    }
    .meditation-center-content {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 4px;
    }
    .meditation-phase-icon {
      font-size: 3rem;
      animation: meditationPulse 3s ease-in-out infinite;
    }
    .meditation-phase-timer {
      font-size: 1.8rem;
      font-weight: 800;
      color: var(--primary);
      font-variant-numeric: tabular-nums;
    }
    .meditation-phase-label {
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--text-primary);
      text-align: center;
      max-width: 320px;
    }
    .meditation-progress-text {
      font-size: 0.85rem;
      color: var(--text-muted);
    }
    @keyframes meditationPulse {
      0%, 100% { transform: scale(1); opacity: 0.9; }
      50% { transform: scale(1.08); opacity: 1; }
    }
    .meditation-controls {
      display: flex;
      gap: 12px;
      align-items: center;
    }
    .meditation-start-btn {
      padding: 14px 36px;
      border-radius: 14px;
      border: none;
      background: var(--primary);
      color: var(--bg-dark);
      font-size: 1rem;
      font-weight: 700;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.3s;
    }
    .meditation-start-btn:hover {
      box-shadow: 0 8px 24px rgba(0, 212, 170, 0.3);
      transform: translateY(-2px);
    }
    .meditation-start-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }
    .meditation-voice-btn {
      padding: 14px 20px;
      border-radius: 14px;
      border: 1px solid var(--border-subtle);
      background: var(--bg-card);
      color: var(--text-primary);
      font-size: 0.9rem;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.3s;
    }
    .meditation-voice-btn:hover {
      border-color: var(--primary);
    }

    /* ============================================
       STORIES TAB
       ============================================ */
    .stories-container {
      padding: 24px 40px;
      max-width: 900px;
      margin: 0 auto;
      width: 100%;
    }
    .story-featured {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 20px;
      overflow: hidden;
      margin-bottom: 28px;
      transition: all 0.3s;
    }
    .story-featured:hover {
      border-color: rgba(253, 121, 168, 0.4);
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    }
    .story-loading {
      text-align: center;
      padding: 60px 24px;
    }
    .story-featured-image {
      width: 100%;
      height: 240px;
      object-fit: cover;
      display: block;
    }
    .story-featured-body {
      padding: 24px;
    }
    .story-featured-meta {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 12px;
      flex-wrap: wrap;
    }
    .story-theme-badge {
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      padding: 4px 12px;
      border-radius: 8px;
      background: rgba(253, 121, 168, 0.12);
      color: var(--accent);
      border: 1px solid rgba(253, 121, 168, 0.25);
    }
    .story-date {
      font-size: 0.78rem;
      color: var(--text-muted);
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .story-date::before {
      content: '';
      display: inline-block;
      width: 14px;
      height: 14px;
      background: currentColor;
      -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") center/contain no-repeat;
      mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") center/contain no-repeat;
      flex-shrink: 0;
    }
    .story-read-time {
      font-size: 0.78rem;
      color: var(--text-muted);
    }
    .story-featured-body h3 {
      font-size: 1.3rem;
      font-weight: 700;
      margin-bottom: 8px;
      color: var(--text-primary);
    }
    .story-featured-body p {
      font-size: 0.9rem;
      color: var(--text-secondary);
      line-height: 1.6;
      margin-bottom: 16px;
    }
    .story-read-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 22px;
      border-radius: 12px;
      border: none;
      background: var(--accent);
      color: #fff;
      font-size: 0.9rem;
      font-weight: 700;
      font-family: inherit;
      cursor: pointer;
      transition: all 0.3s;
    }
    .story-read-btn:hover {
      box-shadow: 0 6px 20px rgba(253, 121, 168, 0.3);
      transform: translateY(-2px);
    }
    .story-archive-header {
      padding: 0 0 12px;
    }
    .story-archive-header h3 {
      font-size: 1rem;
      font-weight: 700;
      color: var(--text-secondary);
    }
    .stories-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
      padding-bottom: 30px;
    }
    .story-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 16px;
      overflow: hidden;
      cursor: pointer;
      transition: all 0.3s;
    }
    .story-card:hover {
      transform: translateY(-4px);
      border-color: rgba(253, 121, 168, 0.3);
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    }
    .story-card-image {
      width: 100%;
      height: 140px;
      object-fit: cover;
      display: block;
    }
    .story-card-body {
      padding: 14px;
    }
    .story-card-body h4 {
      font-size: 0.95rem;
      font-weight: 700;
      margin-bottom: 6px;
      color: var(--text-primary);
      line-height: 1.3;
    }
    .story-card-meta {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }
    .story-card-meta .story-theme-badge {
      font-size: 0.65rem;
      padding: 2px 8px;
    }
    @media (max-width: 700px) {
      .stories-container { padding: 16px 20px; }
      .story-featured-image { height: 180px; }
      .story-featured-body { padding: 18px; }
      .story-featured-body h3 { font-size: 1.1rem; }
      .stories-grid { grid-template-columns: 1fr; }
    }

    /* ============================================
       STORY READER MODAL
       ============================================ */
    .story-reader-modal {
      position: fixed;
      inset: 0;
      z-index: 1000;
      background: rgba(0, 0, 0, 0.8);
      backdrop-filter: blur(10px);
      display: none;
      justify-content: center;
      align-items: flex-start;
      padding: 20px;
      overflow-y: auto;
    }
    .story-reader-modal.active {
      display: flex;
    }
    .story-reader-content {
      background: var(--bg-card);
      border: 1px solid var(--glass-border);
      border-radius: 20px;
      max-width: 700px;
      width: 100%;
      position: relative;
      margin: 40px auto;
      animation: cameraChoiceIn 0.3s ease;
    }
    .story-reader-close {
      position: absolute;
      top: 16px;
      right: 16px;
      background: rgba(0,0,0,0.4);
      border: none;
      color: #fff;
      font-size: 1.2rem;
      cursor: pointer;
      padding: 6px 10px;
      border-radius: 10px;
      z-index: 2;
      transition: all 0.2s;
    }
    .story-reader-close:hover {
      background: rgba(0,0,0,0.6);
    }
    .story-reader-header img {
      width: 100%;
      height: 280px;
      object-fit: cover;
      border-radius: 20px 20px 0 0;
      display: block;
    }
    .story-reader-body {
      padding: 28px 28px 16px;
    }
    .story-reader-body h2 {
      font-size: 1.4rem;
      font-weight: 800;
      margin-bottom: 8px;
      color: var(--text-primary);
    }
    .story-reader-body .story-reader-meta {
      display: flex;
      gap: 10px;
      align-items: center;
      margin-bottom: 20px;
      flex-wrap: wrap;
    }
    .story-reader-body .story-text {
      font-size: 0.95rem;
      color: var(--text-secondary);
      line-height: 1.8;
      white-space: pre-wrap;
    }
    .story-reader-body .story-text p {
      margin-bottom: 16px;
    }
    .story-reader-body .story-inline-image {
      width: 100%;
      border-radius: 12px;
      margin: 16px 0;
    }
    .story-reader-footer {
      padding: 16px 28px 28px;
      text-align: center;
    }
    @media (max-width: 700px) {
      .story-reader-content { margin: 10px auto; }
      .story-reader-header img { height: 200px; }
      .story-reader-body { padding: 20px; }
    }

    /* ============================================
       HOW TO / DEMO VIDEO BUTTON
       ============================================ */
    .how-to-btn {
      padding: 4px 10px;
      border-radius: 6px;
      border: 1px solid rgba(0,212,170,0.25);
      background: rgba(0,212,170,0.06);
      color: #00D4AA;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      white-space: nowrap;
      font-family: inherit;
    }
    .how-to-btn:hover {
      background: rgba(0,212,170,0.15);
      border-color: rgba(0,212,170,0.4);
      transform: scale(1.05);
    }

    /* ============================================
       HAMBURGER MENU & SIDE MENU
       ============================================ */
    .hamburger-btn {
      background: none;
      border: none;
      cursor: pointer;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      z-index: 10;
    }
    .hamburger-line {
      display: block;
      width: 22px;
      height: 2px;
      background: var(--text-primary);
      border-radius: 2px;
      transition: all 0.3s ease;
    }
    .hamburger-btn:hover .hamburger-line {
      background: var(--primary);
    }
    /* Animate to X when menu open */
    .hamburger-btn.open .hamburger-line:nth-child(1) {
      transform: translateY(7px) rotate(45deg);
    }
    .hamburger-btn.open .hamburger-line:nth-child(2) {
      opacity: 0;
    }
    .hamburger-btn.open .hamburger-line:nth-child(3) {
      transform: translateY(-7px) rotate(-45deg);
    }

    /* Overlay */
    .side-menu-overlay {
      display: none;
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0,0,0,0.5);
      z-index: 9990;
      opacity: 0;
      transition: opacity 0.3s ease;
    }
    .side-menu-overlay.visible {
      display: block;
      opacity: 1;
    }

    /* Side panel */
    .side-menu {
      position: fixed;
      top: 0;
      left: -280px;
      width: 270px;
      height: 100%;
      background: rgba(10, 14, 23, 0.95);
      backdrop-filter: blur(20px);
      border-right: 1px solid var(--border-subtle);
      z-index: 9991;
      display: flex;
      flex-direction: column;
      transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 4px 0 30px rgba(0,0,0,0.4);
    }
    .side-menu.open {
      left: 0;
    }
    .side-menu-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 20px 20px 16px;
      border-bottom: 1px solid var(--border-subtle);
    }
    .side-menu-title {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text-primary);
    }
    .side-menu-close {
      background: none;
      border: none;
      color: var(--text-muted);
      font-size: 1.2rem;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
      transition: all 0.2s;
    }
    .side-menu-close:hover {
      background: rgba(255,255,255,0.08);
      color: var(--text-primary);
    }
    .side-menu-nav {
      flex: 1;
      padding: 12px 0;
      display: flex;
      flex-direction: column;
    }
    .side-menu-item {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px 24px;
      background: none;
      border: none;
      color: var(--text-primary);
      font-size: 0.95rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
      text-align: left;
      font-family: inherit;
      width: 100%;
    }
    .side-menu-item:hover {
      background: rgba(255,255,255,0.05);
      color: var(--primary);
    }
    .side-menu-icon {
      font-size: 1.15rem;
      width: 28px;
      text-align: center;
    }
    .side-menu-upgrade {
      margin-top: 4px;
      color: #FFD700;
    }
    .side-menu-upgrade:hover {
      background: rgba(255,215,0,0.08);
      color: #FFD700;
    }
    .side-menu-footer {
      padding: 16px 24px;
      border-top: 1px solid var(--border-subtle);
      font-size: 0.72rem;
      color: var(--text-muted);
      text-align: center;
    }
    .side-menu-footer a {
      color: var(--text-muted);
      text-decoration: none;
      transition: color 0.2s;
    }
    .side-menu-footer a:hover {
      color: var(--primary);
    }

    /* ============================================
       BOTTOM MOBILE NAV
       ============================================ */
    .bottom-nav {
      display: none;
    }
    @media (max-width: 700px) {
      .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9980;
        background: rgba(10, 14, 23, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
        align-items: center;
      }
      .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-family: inherit;
        font-size: 0.68rem;
        font-weight: 500;
        padding: 6px 16px;
        cursor: pointer;
        transition: all 0.25s ease;
        position: relative;
        -webkit-tap-highlight-color: transparent;
      }
      .bottom-nav-item::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%) scaleX(0);
        width: 32px;
        height: 2.5px;
        border-radius: 0 0 2px 2px;
        background: var(--primary);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      }
      .bottom-nav-item.active::before {
        transform: translateX(-50%) scaleX(1);
      }
      .bottom-nav-icon {
        font-size: 1.35rem;
        line-height: 1;
        transition: transform 0.25s ease;
      }
      .bottom-nav-item.active .bottom-nav-icon {
        transform: scale(1.15);
      }
      .bottom-nav-label {
        letter-spacing: 0.01em;
        transition: color 0.25s ease;
      }
      .bottom-nav-item.active {
        color: var(--primary);
      }
      .bottom-nav-item:active {
        transform: scale(0.92);
      }
      /* Hide top tabs on mobile when bottom nav is visible */
      .main-tabs {
        display: none !important;
      }
      /* Add bottom padding so content isn't hidden behind bottom nav */
      #selectionPage {
        padding-bottom: 72px;
      }
      .disclaimer-footer {
        margin-bottom: 0;
      }
    }
