  :root {
    --bg: #080d1a;
    --bg2: #0f1628;
    --bg3: #161f38;
    --bg4: #1d2845;
    --accent: #00e5a0;
    --accent2: #00b3ff;
    --warn: #ff6b2b;
    --danger: #ff3b5c;
    --text: #e8f0ff;
    --text2: #8a9bc4;
    --text3: #4a5a80;
    --card: rgba(22,31,56,0.9);
    --border: rgba(0,229,160,0.15);
    --border2: rgba(255,255,255,0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --font: 'Space Grotesk', sans-serif;
    --mono: 'JetBrains Mono', monospace;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
  html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); }

  /* ─── SPLASH ─── */
  #splash {
    position: fixed; inset: 0; background: var(--bg); display: flex;
    flex-direction: column; align-items: center; justify-content: center; z-index: 9999;
    transition: opacity 0.5s ease;
  }
  #splash .logo-wrap { text-align: center; }

 /* Animacion de carga */

  #splash .logo-icon {
    width: 110px;
    height: 160px;
    border-radius: 28px;

    background: transparent;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 20px;

    position: relative;
    overflow: hidden;
  }

  .splash-logo-img {
    position: absolute;

    width: 100%;
    height: 100%;

    object-fit: contain;

    opacity: 0;

    animation-duration: 2s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
  }

  /* LOGO 1 */
  .logo-1 {
    animation-name: logoFade1;
  }

  /* LOGO 2 */
  .logo-2 {
    animation-name: logoFade2;
  }

  @keyframes logoFade1 {
    0% {
      opacity: 1;
      transform: scale(1);
    }

    45% {
      opacity: 1;
      transform: scale(1.05);
    }

    50% {
      opacity: 0;
      transform: scale(0.95);
    }

    95% {
      opacity: 0;
      transform: scale(0.95);
    }

    100% {
      opacity: 1;
      transform: scale(1);
    }
  }

  @keyframes logoFade2 {
    0% {
      opacity: 0;
      transform: scale(0.95);
    }

    45% {
      opacity: 0;
      transform: scale(0.95);
    }

    50% {
      opacity: 1;
      transform: scale(1);
    }

    95% {
      opacity: 1;
      transform: scale(1.05);
    }

    100% {
      opacity: 0;
      transform: scale(0.95);
    }
  }


 

  #splash h1 { font-size: 42px; font-weight: 700; letter-spacing: -1px; }
  #splash h1 span { color: var(--accent); }
  #splash p { color: var(--text2); font-size: 14px; margin-top: 8px; letter-spacing: 2px; text-transform: uppercase; }
  #splash .loading-bar {
    width: 200px; height: 3px; background: var(--bg3); border-radius: 2px;
    margin-top: 48px; overflow: hidden;
  }
  #splash .loading-fill {
    height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 2px; animation: load 2s ease forwards;
  }
  @keyframes load { 0%{width:0%} 100%{width:100%} }

  /* ── VIDEO ANALYSIS OVERLAY ── */
  #video-progress {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
  }

  /* Logo animado reutilizado */
  #analysis-logo-icon {
    width: 80px;
    height: 116px;
    border-radius: 20px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin: 0 auto 20px;
  }
  #analysis-logo-icon .splash-logo-img {
    animation-duration: 2s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
  }

  /* ─── APP SHELL ─── */
  #app { position: fixed; inset: 0; display: flex; flex-direction: column; }

  /* ─── TOP BAR ─── */
  .topbar {
    padding: 14px 20px 10px;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(8,13,26,0.95); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border2); flex-shrink: 0; z-index: 100;
  }
  .topbar-logo { display: flex; align-items: center; gap: 10px; }
  .topbar-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    box-shadow: none;
  }

  .topbar-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }
  .topbar-logo h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
  .topbar-logo h2 span { color: var(--accent); }
  .topbar-actions { display: flex; gap: 10px; }
  .icon-btn {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--bg3); border: 1px solid var(--border2);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer; transition: all 0.2s;
  }
  .icon-btn:active { transform: scale(0.93); }

  /* ─── NAV TABS ─── */
  .nav {
    display: flex; background: var(--bg); border-bottom: 1px solid var(--border2);
    flex-shrink: 0;
  }
  .nav-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 10px 4px 8px; cursor: pointer; gap: 4px;
    border-bottom: 2px solid transparent; transition: all 0.2s; color: var(--text3);
  }
  .nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
  .nav-tab .tab-icon { font-size: 22px; }
  .nav-tab .tab-label { font-size: 10px; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; }

  /* ─── PAGES ─── */
  .page { flex: 1; overflow-y: auto; display: none; flex-direction: column; }
  .page.active { display: flex; }
  .page-scroll { flex: 1; overflow-y: auto; padding: 16px; }

  /* ─── HOME PAGE ─── */
  .hero {
    background: linear-gradient(180deg, var(--bg3) 0%, var(--bg) 100%);
    padding: 24px 20px 20px; position: relative; overflow: hidden;
  }
  .hero::before {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 200px; height: 200px; border-radius: 50%;
    background: radial-gradient(circle, rgba(0,229,160,0.1) 0%, transparent 70%);
  }
  .hero h1 { font-size: 26px; font-weight: 700; line-height: 1.2; margin-bottom: 8px; }
  .hero h1 .hi { color: var(--accent); }
  .hero p { color: var(--text2); font-size: 14px; line-height: 1.6; }
  .hero-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 20px; }
  .stat-card {
    background: var(--bg); border: 1px solid var(--border2);
    border-radius: var(--radius-sm); padding: 12px 10px; text-align: center;
  }
  .stat-val { font-size: 22px; font-weight: 700; color: var(--accent); font-family: var(--mono); }
  .stat-lbl { font-size: 10px; color: var(--text2); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

  .section-title {
    font-size: 12px; font-weight: 600; color: var(--text3);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin: 20px 0 10px;
  }
  .cta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .cta-card {
    border-radius: var(--radius); padding: 20px 16px; cursor: pointer;
    display: flex; flex-direction: column; gap: 10px;
    transition: all 0.2s; position: relative; overflow: hidden;
    border: 1px solid var(--border2);
  }
  .cta-card:active { transform: scale(0.97); }
  .cta-card.primary { background: linear-gradient(135deg, rgba(0,229,160,0.15), rgba(0,179,255,0.1)); border-color: rgba(0,229,160,0.3); }
  .cta-card.secondary { background: linear-gradient(135deg, rgba(255,107,43,0.12), rgba(255,59,92,0.08)); border-color: rgba(255,107,43,0.25); }
  .cta-icon { font-size: 28px; }
  .cta-title { font-weight: 600; font-size: 15px; }
  .cta-desc { font-size: 12px; color: var(--text2); line-height: 1.5; }

  /* ─── CAMERA PAGE ─── */
  #camera-page { position: relative; background: #000; }
  #camera-container {
    position: relative; flex: 1; background: #000; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
  }
  #video, #canvas-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
  }
  #canvas-overlay { z-index: 2; }
  .camera-ui { position: absolute; inset: 0; z-index: 10; pointer-events: none; display: flex; flex-direction: column; }

  /* ── CAMERA TUTORIAL OVERLAY ── */
  .camera-tutorial-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: #0a0f1a;
    overflow: hidden;
  }

  .tutorial-bg-img {
    position: absolute;
    inset: 0;
    z-index: 0;
  }

  .tutorial-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.18;
  }

  .tutorial-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 48px 24px 32px;
    height: 100%;
    overflow-y: auto;
  }

  .tutorial-badge {
    display: inline-flex;
    align-self: flex-start;
    background: rgba(0, 229, 160, 0.15);
    border: 1px solid rgba(0, 229, 160, 0.35);
    color: #00e5a0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 16px;
  }

  .tutorial-title {
    font-size: 34px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.15;
    margin: 0 0 28px;
    letter-spacing: -0.5px;
  }

  .tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
  }

  .tutorial-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
  }

  .step-num {
    font-size: 11px;
    font-weight: 700;
    font-family: var(--mono, 'JetBrains Mono', monospace);
    color: #00e5a0;
    letter-spacing: 1px;
    min-width: 24px;
    padding-top: 2px;
  }

  .step-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 3px;
  }

  .step-text p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
    line-height: 1.5;
  }

  .tutorial-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00e5a0, #00b3ff);
    color: #0a0f1a;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    padding: 16px 24px;
    cursor: pointer;
    width: 100%;
    letter-spacing: 0.2px;
    transition: opacity 0.2s, transform 0.15s;
  }

  .tutorial-btn:active {
    opacity: 0.88;
    transform: scale(0.98);
  }

  .tutorial-skip {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin: 12px 0 0;
    cursor: pointer;
    transition: color 0.2s;
  }

  .tutorial-skip:hover {
    color: rgba(255, 255, 255, 0.6);
  }

  .camera-tutorial-overlay.hidden {
    display: none;
  }

  /* ══ CAMERA TUTORIAL ══ */
  .cam-tutorial {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: #0a0f1a;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .cam-tutorial.hidden { display: none; }

  /* ── Pantalla genérica ── */
  .tut-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 40px 24px 28px;
    box-sizing: border-box;
  }

  /* ── Pantalla 1: texto ── */
  .tut-header { margin-bottom: 28px; }

  .tut-badge {
    display: inline-flex;
    background: rgba(0,229,160,.12);
    border: 1px solid rgba(0,229,160,.3);
    color: #00e5a0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
  }

  .tut-title {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
    margin: 0 0 8px;
    letter-spacing: -.5px;
  }

  .tut-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,.45);
    margin: 0;
    line-height: 1.5;
  }

  .tut-steps {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
    margin-bottom: 28px;
  }

  .tut-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 14px;
    padding: 14px 16px;
  }

  .tut-step-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
  }

  .tut-step-body strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
  }

  .tut-step-body p {
    font-size: 12px;
    color: rgba(255,255,255,.5);
    margin: 0;
    line-height: 1.5;
  }

  /* ── Pantalla 2: imagen ── */
  .tut-screen--img {
    padding: 0;
  }

  .tut-img-wrap {
    flex: 1;
    min-height: 0;          /* permite que shrink funcione */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tut-guide-img {
    width: 100%;
    height: 100%;
    object-fit: contain;    /* imagen completa, sin recortar */
    object-position: center;
    display: block;
  }

  .tut-img-footer {
    padding: 16px 24px 28px;
    background: rgba(10,15,26,.95);
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
  }

  .tut-img-hint {
    font-size: 13px;
    color: rgba(255,255,255,.65);
    text-align: center;
    margin: 0 0 14px;
    line-height: 1.5;
  }

  .tut-img-hint strong { color: #fff; }

  /* ── Botón compartido ── */
  .tut-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, #00e5a0, #00b3ff);
    color: #0a0f1a;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    padding: 16px 24px;
    cursor: pointer;
    box-sizing: border-box;
    transition: opacity .2s, transform .15s;
  }

  .tut-btn:active { opacity: .85; transform: scale(.98); }

  .tut-skip {
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,.3);
    margin: 10px 0 0;
    cursor: pointer;
    transition: color .2s;
  }
  .tut-skip:hover { color: rgba(255,255,255,.6); }

  /* Status banner */
  .status-banner {
    margin: 12px 12px 0; border-radius: var(--radius-sm);
    padding: 8px 14px; font-size: 12px; font-weight: 500;
    display: flex; align-items: center; gap: 8px; pointer-events: auto;
    background: rgba(8,13,26,0.85); border: 1px solid var(--border2); backdrop-filter: blur(10px);
  }
  .status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .status-dot.green { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1.5s infinite; }
  .status-dot.yellow { background: #ffd93d; box-shadow: 0 0 8px #ffd93d; animation: pulse 1s infinite; }
  .status-dot.red { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: pulse 0.5s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

  /* Alert overlay */
  .alert-overlay {
    position: absolute; bottom: 130px; left: 12px; right: 12px;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  }
  .alert-item {
    border-radius: var(--radius-sm); padding: 10px 14px;
    display: flex; align-items: center; gap: 10px;
    animation: slideUp 0.3s ease; backdrop-filter: blur(10px);
  }
  .alert-item.knee { background: rgba(255,107,43,0.9); border: 1px solid rgba(255,107,43,1); }
  .alert-item.back { background: rgba(255,59,92,0.9); border: 1px solid rgba(255,59,92,1); }
  .alert-item.ok { background: rgba(0,229,160,0.85); border: 1px solid rgba(0,229,160,1); }
  .alert-icon { font-size: 20px; }
  .alert-msg { flex: 1; }
  .alert-title { font-weight: 600; font-size: 13px; color: #fff; }
  .alert-sub { font-size: 11px; color: rgba(255,255,255,0.8); margin-top: 1px; }
  @keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

  /* Metrics bar */
  .metrics-bar {
    position: absolute; top: 52px; left: 12px; right: 12px;
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; pointer-events: none;
  }
  .metric-chip {
    background: rgba(8,13,26,0.85); border: 1px solid var(--border2);
    border-radius: 8px; padding: 6px 8px; text-align: center; backdrop-filter: blur(10px);
  }
  .metric-chip .val { font-size: 16px; font-weight: 700; font-family: var(--mono); }
  .metric-chip .lbl { font-size: 9px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
  .val.good { color: var(--accent); }
  .val.warn { color: var(--warn); }
  .val.bad { color: var(--danger); }

  /* Control bar */
  .control-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(8,13,26,0.92); backdrop-filter: blur(20px);
    border-top: 1px solid var(--border2); padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between; pointer-events: auto;
  }
  .ctrl-btn {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--bg3); border: 1px solid var(--border2);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; cursor: pointer; transition: all 0.2s;
  }
  .ctrl-btn:active { transform: scale(0.93); }
  .main-btn {
    width: 68px; height: 68px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; display: flex; align-items: center; justify-content: center;
    font-size: 28px; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 0 30px rgba(0,229,160,0.4);
  }
  .main-btn:active { transform: scale(0.93); }
  .main-btn.recording { background: linear-gradient(135deg, var(--danger), #ff6b2b); box-shadow: 0 0 30px rgba(255,59,92,0.5); }

  /* ─── VIDEO ANALYSIS PAGE ─── */
  .upload-zone {
    border: 2px dashed rgba(0,229,160,0.3); border-radius: var(--radius);
    padding: 40px 24px; text-align: center; cursor: pointer;
    background: rgba(0,229,160,0.03); transition: all 0.2s;
  }
  .upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: rgba(0,229,160,0.07); }
  .upload-icon { font-size: 48px; margin-bottom: 12px; }
  .upload-zone h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
  .upload-zone p { font-size: 13px; color: var(--text2); }

  .progress-wrap { margin-top: 16px; }
  .progress-bar { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
  .progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 2px; transition: width 0.3s; }

  /* Timeline */
  .timeline { margin-top: 16px; }
  .timeline-item {
    display: flex; gap: 12px; margin-bottom: 10px; cursor: pointer;
    background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm);
    padding: 12px; transition: all 0.2s; position: relative; overflow: hidden;
  }
  .timeline-item::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  }
  .timeline-item.knee::before { background: var(--warn); }
  .timeline-item.back::before { background: var(--danger); }
  .timeline-item:active { transform: scale(0.98); }
  .timeline-time {
    font-family: var(--mono); font-size: 13px; font-weight: 600;
    color: var(--accent); white-space: nowrap; padding-top: 2px;
  }
  .timeline-info { flex: 1; }
  .timeline-type { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
  .timeline-detail { font-size: 11px; color: var(--text2); line-height: 1.5; }
  .timeline-badge {
    padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; align-self: flex-start;
  }
  .badge-knee { background: rgba(255,107,43,0.2); color: var(--warn); }
  .badge-back { background: rgba(255,59,92,0.2); color: var(--danger); }

  /* Analysis summary */
  .analysis-summary {
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
  }
  .summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
  .summary-item { text-align: center; }
  .summary-val { font-size: 24px; font-weight: 700; font-family: var(--mono); }
  .summary-lbl { font-size: 11px; color: var(--text2); margin-top: 2px; }

  /* ─── HISTORY PAGE ─── */
  .history-item {
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
    cursor: pointer; transition: all 0.2s;
  }
  .history-item:active { transform: scale(0.98); }
  .history-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .history-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(0,229,160,0.2), rgba(0,179,255,0.1));
    display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
  }
  .history-title { font-weight: 600; font-size: 14px; }
  .history-date { font-size: 11px; color: var(--text2); margin-top: 2px; }
  .history-metrics { display: flex; gap: 8px; flex-wrap: wrap; }
  .history-tag {
    padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500;
    background: var(--bg4); border: 1px solid var(--border2);
  }
  .tag-good { color: var(--accent); border-color: rgba(0,229,160,0.2); }
  .tag-warn { color: var(--warn); border-color: rgba(255,107,43,0.2); }
  .tag-bad { color: var(--danger); border-color: rgba(255,59,92,0.2); }

  /* Score ring */
  .score-ring-wrap { display: flex; justify-content: center; margin: 20px 0; }
  .score-ring { position: relative; width: 140px; height: 140px; }
  .score-ring svg { transform: rotate(-90deg); }
  .score-ring .score-val {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
  }
  .score-val span:first-child { font-size: 36px; font-weight: 700; color: var(--accent); font-family: var(--mono); }
  .score-val span:last-child { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }

  /* ─── PROFILE / SETTINGS ─── */
  .profile-header {
    background: linear-gradient(180deg, var(--bg3) 0%, var(--bg) 100%);
    padding: 24px 20px 20px; text-align: center;
  }
  .avatar {
    width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 700; border: 3px solid rgba(0,229,160,0.3);
  }
  .profile-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
  .profile-sub { font-size: 13px; color: var(--text2); }
  .setting-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid var(--border2); cursor: pointer;
  }
  .setting-icon { font-size: 20px; width: 32px; text-align: center; color: var(--text2); }
  .setting-label { flex: 1; font-size: 14px; }
  .setting-arrow { color: var(--text3); font-size: 14px; }

    .btn-logout {
      padding: .4rem .875rem;
      background: transparent;
      border: transparent;
      border-radius: 8px;
      color: #e8f0ff;
      font-size: 14px;
      cursor: pointer;
      transition: border-color .15s, color .15s;
      font: 'Space Grotesk', sans-serif;
    }

    .btn-logout:hover { border-color: #ef4444; color: #fca5a5; }

  /* ─── MODAL ─── */
  .modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    z-index: 500; display: none; align-items: flex-end;
    backdrop-filter: blur(4px);
  }
  .modal-backdrop.open { display: flex; }
  .modal {
    background: var(--bg2); border-radius: 24px 24px 0 0;
    border: 1px solid var(--border2); width: 100%; max-height: 85vh;
    overflow-y: auto; padding: 0 20px 32px;
    animation: slideUp2 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
  }
  @keyframes slideUp2 { from{transform:translateY(100%)} to{transform:translateY(0)} }
  .modal-handle {
    width: 40px; height: 4px; background: var(--bg4); border-radius: 2px;
    margin: 12px auto 20px;
  }
  .modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
  .modal-close {
    position: absolute; right: 20px; top: 16px;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--bg3); border: none; color: var(--text); font-size: 18px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
  }

  /* Detail card in modal */
  .detail-card {
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  }
  .detail-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
  .detail-key { font-size: 13px; color: var(--text2); }
  .detail-val { font-size: 13px; font-weight: 600; font-family: var(--mono); }

  /* ─── CHART ─── */
  .mini-chart { background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
  .chart-title { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
  .chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 80px; }
  .chart-bar { flex: 1; border-radius: 4px 4px 0 0; transition: all 0.5s; min-width: 0; cursor: pointer; position: relative; }
  .chart-bar:hover::after {
    content: attr(data-val); position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    font-size: 10px; color: var(--text); background: var(--bg4); padding: 2px 6px; border-radius: 4px;
  }
  .chart-labels { display: flex; gap: 6px; margin-top: 6px; }
  .chart-lbl { flex: 1; text-align: center; font-size: 9px; color: var(--text3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ─── EXERCISE SELECTOR ─── */
  .exercise-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .exercise-card {
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--radius-sm); padding: 14px 12px; cursor: pointer;
    transition: all 0.2s; text-align: center;
  }
  .exercise-card.selected { border-color: var(--accent); background: rgba(0,229,160,0.08); }
  .exercise-card:active { transform: scale(0.96); }
  .exercise-icon { font-size: 28px; margin-bottom: 6px; }
  .exercise-name { font-size: 13px; font-weight: 600; }
  .exercise-desc { font-size: 11px; color: var(--text2); margin-top: 2px; }

  /* ─── SCROLLBAR ─── */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 2px; }

  /* ─── VIDEO PAGE layout ─── */
  #video-page .page-scroll { padding: 16px; }

  /* ─── Progress bars ─── */
  .prog-row { margin-bottom: 12px; }
  .prog-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
  .prog-head span:last-child { color: var(--text2); }
  .prog-track { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
  .prog-fill { height: 100%; border-radius: 3px; }

  .btn {
    display: block; width: 100%; padding: 14px; border-radius: var(--radius-sm);
    border: none; cursor: pointer; font-family: var(--font); font-size: 15px;
    font-weight: 600; transition: all 0.2s; text-align: center;
  }
  .btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #000; }
  .btn-primary:active { transform: scale(0.98); }
  .btn-ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }

  /* Achievement badge */
  .achievement {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px;
  }
  .ach-icon { font-size: 28px; }
  .ach-name { font-size: 14px; font-weight: 600; }
  .ach-desc { font-size: 11px; color: var(--text2); margin-top: 2px; }
  .ach-locked { opacity: 0.4; }

  /* Hidden file input */
  #file-input { display: none; }

  /* ─── REALTIME REPORT ─── */
  .rt-report {
    position: absolute; right: 12px; top: 52px;
    width: 140px; background: rgba(8,13,26,0.9); border: 1px solid var(--border2);
    border-radius: var(--radius-sm); padding: 10px; backdrop-filter: blur(10px);
    pointer-events: none;
  }
  .rt-report h4 { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
  .rt-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; }
  .rt-row span:last-child { font-family: var(--mono); font-weight: 600; }

  /* FPS counter */
  .fps-counter {
    position: absolute; top: 12px; right: 12px;
    font-family: var(--mono); font-size: 10px; color: var(--text3);
    background: rgba(0,0,0,0.5); padding: 2px 6px; border-radius: 4px; pointer-events: none;
  }

  /* Toast */
  .toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: var(--radius-sm); padding: 10px 20px;
    font-size: 13px; z-index: 9999; white-space: nowrap;
    animation: fadeInUp 0.3s ease, fadeOut 0.3s ease 2s forwards;
  }
  @keyframes fadeInUp { from{opacity:0;transform:translateX(-50%) translateY(10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }
  @keyframes fadeOut { to{opacity:0} }

 /* CONTADOR */
/* ── COUNTDOWN OVERLAY ── */
#countdown-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  z-index: 50;
  border-radius: inherit;
}
#countdown-overlay.active { display: flex; }

#countdown-ring {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 20px;
}
#countdown-ring svg {
  transform: rotate(-90deg);
  width: 140px;
  height: 140px;
}
#countdown-ring .ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 6;
}
#countdown-ring .ring-progress {
  fill: none;
  stroke: #00e5a0;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 376;   /* 2π × 59.87 ≈ circunferencia r=60 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.4s;
}
#countdown-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: 800;
  color: #fff;
  font-family: var(--mono, monospace);
  letter-spacing: -2px;
}
#countdown-label {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.5;
}
#countdown-skip {
  margin-top: 18px;
  padding: 8px 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#countdown-skip:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
} 

.navbar__avatar img {
    border-radius: 50%;
    object-fit: cover;
    background: #2d3148;
    border: 2px solid #6366f1;
}

    .navbar__info { display: flex; flex-direction: column; line-height: 1.3; }

    .navbar__name  { font-size: .875rem; font-weight: 600; }
    .navbar__email { font-size: .75rem;  color: #64748b; }
