/* BJJ Coach — Tactical Analysis Room */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  /* Paleta basada en el logo: cinto negro, divisas rojas, texto dorado */
  --bg: #f5f0e8;
  --bg2: #ebe5d9;
  --bg3: #e0d8c8;
  --bg4: #d4cbb8;
  --border: #c4b99a;
  --border2: #a89878;
  --accent: #8b0e0e;
  --accent2: #6b0a0a;
  --gold: #d9b66a;
  --dark: #241712;
  --red: #c62828;
  --green: #2e7d32;
  --amber: #e65100;
  --text: #241712;
  --text2: #5a4030;
  --text3: #8a7560;

  --accent-dim: rgba(139, 14, 14, 0.10);
  --accent-glow: rgba(139, 14, 14, 0.45);
  --green-dim: rgba(46, 125, 50, 0.12);
  --amber-dim: rgba(230, 81, 0, 0.12);
  --red-dim: rgba(198, 40, 40, 0.10);

  /* Aliases retro-compatibles: nombres viejos resuelven a la nueva paleta. */
  --bg-0: var(--bg);
  --bg-1: var(--bg2);
  --bg-2: var(--bg3);
  --bg-3: var(--bg4);
  --line: var(--border);
  --line-2: var(--border2);
  --ink-0: var(--text);
  --ink-1: var(--text);
  --ink-2: var(--text2);
  --ink-3: var(--text3);
  --ink-4: var(--border);
  --ok: var(--green);
  --warn: var(--amber);
  --err: var(--red);
  --ok-dim: var(--green-dim);
  --warn-dim: var(--amber-dim);
  --err-dim: var(--red-dim);

  --font-display: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Background grid sutil sobre crema */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(36, 23, 18, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 23, 18, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(139, 14, 14, 0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; }

/* ==== typography ==== */
.mono { font-family: var(--font-mono); }
.label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.label-accent { color: var(--accent); }
.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-0);
}
.h-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-0);
}

/* ==== topbar (fondo claro, logo negro contrasta, línea roja de identidad) ==== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  background: #faf8f3;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
}
.topbar-left { display: flex; align-items: center; gap: 18px; }
.topbar-right { display: flex; align-items: center; gap: 14px; justify-content: flex-end; }
.brand-mark {
  display: flex; align-items: center; gap: 10px;
}
.brand-mark img {
  display: block;
  height: 40px;
  width: auto;
}
.crumbs {
  display: flex; gap: 8px;
  color: var(--text3);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
}
.crumbs span.active { color: var(--text); }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--border);
}
.status-pill .dot {
  width: 6px; height: 6px;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.status-pill .dot.idle { background: var(--text3); box-shadow: none; }
.status-pill .dot.busy { background: var(--amber); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.topbar-meta {
  display: flex; gap: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text2);
}
.topbar-meta b { color: var(--text); font-weight: 500; }

/* ==== nav links (sobre topbar claro) ==== */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
/* base: 2px de border-bottom transparente para que el active no shiftee layout */
.nav-links a {
  color: var(--text);
  text-decoration: none;
  padding: 6px 10px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.nav-links a:hover {
  color: var(--accent);
}
.nav-links a.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.nav-links a.logout {
  margin-left: 6px;
  color: var(--text3);
}
.nav-links a.logout:hover { color: var(--red); border-bottom-color: var(--red); }
.nav-links .nav-user {
  margin-left: 8px; padding: 4px 10px;
  border: 1px solid var(--border);
  color: var(--text2);
  background: var(--bg2);
}

.flash-row {
  margin: 14px auto 0; max-width: 1280px; padding: 0 24px;
  display: flex; flex-direction: column; gap: 6px;
}
.flash {
  padding: 8px 12px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
}
.flash.ok { color: var(--green); border-color: var(--green); background: var(--green-dim); }
.flash.error { color: var(--red); border-color: var(--red); background: var(--red-dim); }

/* ==== feedback buttons (results.jsx + history_detail.html) ==== */
.fb {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: grid; gap: 8px;
}
.fb-row { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.fb-btn:hover:not(:disabled) {
  color: var(--text); border-color: var(--text2);
}
.fb-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fb-btn.confirm.active { color: var(--green); border-color: var(--green); background: var(--green-dim); }
.fb-btn.reject.active { color: var(--red); border-color: var(--red); background: var(--red-dim); }
.fb-btn.correct.active { color: var(--amber); border-color: var(--amber); background: var(--amber-dim); }
.fb-btn.submit { background: var(--accent); color: var(--gold); border-color: var(--accent); }
.fb-btn.submit:hover:not(:disabled) { background: var(--accent2); color: var(--gold); }
.fb-input { display: grid; gap: 6px; }
.fb-textarea {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-mono); font-size: 11px;
  padding: 7px 9px; min-height: 60px; resize: vertical;
}
.fb-textarea:focus { outline: none; border-color: var(--accent); }
.fb-state {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text3);
}
.fb-state b { color: var(--text2); letter-spacing: 0.14em; }

.page-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: #faf8f3;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
}

/* ==== layout ==== */
.shell {
  display: grid;
  grid-template-columns: minmax(420px, 460px) 1fr;
  gap: 0;
  min-height: calc(100vh - 56px);
}
.col-left {
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  padding: 0;
}
.col-right { padding: 0; }

.panel {
  border-bottom: 1px solid var(--line);
  padding: 20px 24px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head .left { display: flex; align-items: center; gap: 10px; }
.panel-head .idx {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.14em;
}

.tick-row {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}
.tick-row .tick { width: 8px; height: 1px; background: var(--ink-4); }
.tick-row .tick.on { background: var(--accent); }

/* ==== form controls ==== */
.field { display: block; margin-bottom: 12px; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.field-label .req { color: var(--accent); }
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-0);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
                    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 10px) 14px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* segmented control */
.seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg-2);
  border: 1px solid var(--line);
  width: 100%;
}
.seg button {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink-2);
  padding: 8px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 120ms;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink-0); background: var(--bg-3); }
.seg button.active {
  background: var(--accent);
  color: var(--gold);
  font-weight: 600;
}

/* fighter cards */
.fighter-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fighter-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 14px;
  cursor: pointer;
  transition: all 140ms;
  display: flex; flex-direction: column; gap: 8px;
}
.fighter-card:hover { border-color: var(--line-2); }
.fighter-card.active {
  border-color: var(--accent);
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 0 0 1px var(--accent-dim),
    0 0 24px -8px var(--accent-glow);
}
.fighter-card .corner {
  position: absolute; width: 8px; height: 8px;
  border: 1px solid var(--accent);
  opacity: 0;
  transition: opacity 140ms;
}
.fighter-card.active .corner { opacity: 1; }
.fighter-card .corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.fighter-card .corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.fighter-card .corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.fighter-card .corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.fighter-card .tag {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}
.fighter-card.active .tag .id { color: var(--accent); }
.fighter-card .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink-0);
  letter-spacing: 0.01em;
}
.fighter-card .belt {
  height: 6px;
  background: var(--bg-3);
  position: relative;
}
.fighter-card .belt-fill { position: absolute; inset: 0; }

/* belt selector */
.belt-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.belt-grid.youth { grid-template-columns: repeat(7, 1fr); }
.belt-chip {
  position: relative;
  height: 28px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 120ms;
  overflow: hidden;
}
.belt-chip:hover { border-color: var(--line-2); }
.belt-chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px -4px var(--accent-glow);
}
.belt-chip .swatch {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 10px;
}
.belt-chip .belt-label {
  position: absolute;
  top: 3px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.belt-chip.active .belt-label { color: var(--ink-0); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 120ms;
}
.chip:hover { color: var(--ink-0); border-color: var(--line-2); }
.chip.active {
  background: var(--accent);
  color: var(--gold);
  border-color: var(--accent);
  font-weight: 600;
}

/* upload */
.upload {
  position: relative;
  border: 1px dashed var(--line-2);
  background: var(--bg-2);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 140ms;
  overflow: hidden;
}
.upload:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload.has-file {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload .upload-icon {
  width: 36px; height: 36px;
  margin: 0 auto 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 18px;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}
.upload .upload-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-0);
  letter-spacing: 0.04em;
}
.upload .upload-sub {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.upload .corners-frame { position: absolute; inset: 0; pointer-events: none; }
.upload .corners-frame span {
  position: absolute; width: 10px; height: 10px;
  border: 1px solid var(--accent);
}
.upload .corners-frame .c1 { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.upload .corners-frame .c2 { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.upload .corners-frame .c3 { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.upload .corners-frame .c4 { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.file-meta {
  margin-top: 10px;
  display: flex; gap: 14px; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.file-meta b { color: var(--ink-0); font-weight: 500; }

/* main CTA */
.cta {
  width: 100%;
  background: var(--accent);
  color: var(--gold);
  border: 0;
  padding: 16px 18px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms;
  display: flex; align-items: center; justify-content: space-between;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.cta:hover { background: var(--accent2); }
.cta:disabled {
  background: var(--bg4);
  color: var(--text3);
  cursor: not-allowed;
}
.cta .arrow {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
}

.cta-row { display: flex; gap: 8px; align-items: stretch; }
.cta-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-1);
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  cursor: pointer;
  text-transform: uppercase;
}
.cta-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ==== collapsible group ==== */
.group { border-top: 1px solid var(--line); }
.group:first-child { border-top: 0; }
.group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-1);
  transition: background 120ms;
}
.group-head:hover { background: var(--bg-2); }
.group-head .left { display: flex; align-items: center; gap: 12px; }
.group-head .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.14em;
}
.group-head .title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-0);
}
.group-head .chev {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: 11px;
  transition: transform 200ms;
}
.group.open .group-head .chev { transform: rotate(90deg); color: var(--accent); }
.group-body {
  padding: 4px 24px 20px;
  display: none;
  background: var(--bg-1);
}
.group.open .group-body { display: block; }

/* ==== results column ==== */
.results-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 40px;
  position: relative;
}
.empty-card {
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  padding: 32px;
  text-align: center;
  position: relative;
}
.empty-card::before, .empty-card::after,
.empty-card .e-c1, .empty-card .e-c2 {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 1px solid var(--accent);
}
.empty-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.empty-card::after { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.empty-card .e-c1 { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.empty-card .e-c2 { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 22px;
  clip-path: polygon(0 0, 100% 0, 100% 75%, 75% 100%, 0 100%);
}
.empty-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 700; font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-0);
}
.empty-card p {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}
.empty-checklist {
  text-align: left;
  display: grid; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.empty-checklist .ck {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.empty-checklist .ck.ok { color: var(--ink-0); border-color: var(--line-2); }
.empty-checklist .ck.ok .mk { color: var(--accent); }
.empty-checklist .mk { font-family: var(--font-mono); width: 14px; }

/* ==== results filled ==== */
.results-meta-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 56px;
  z-index: 10;
}
.results-meta-bar .left { display: flex; align-items: center; gap: 18px; }
.results-meta-bar .right { display: flex; align-items: center; gap: 10px; }
.meta-item {
  display: flex; flex-direction: column; gap: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
}
.meta-item .k { color: var(--ink-3); }
.meta-item .v { color: var(--ink-0); }
.meta-divider { width: 1px; height: 22px; background: var(--line); }

/* summary block */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
}
.summary-text {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-1);
  text-wrap: pretty;
}
.summary-text + .summary-text { margin-top: 12px; }

.overall-score {
  display: flex; flex-direction: column; align-items: center;
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 18px;
  position: relative;
}
.overall-score .corner-ix { position: absolute; width: 10px; height: 10px; border: 1px solid var(--accent); }
.overall-score .corner-ix.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.overall-score .corner-ix.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.overall-score .corner-ix.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.overall-score .corner-ix.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.score-ring {
  position: relative;
  width: 180px; height: 180px;
  margin: 4px 0 8px;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .ring-track { stroke: var(--bg-3); }
.score-ring .ring-fill { stroke: var(--accent); transition: stroke-dashoffset 800ms cubic-bezier(0.2,0.7,0.2,1); }
.score-ring .center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-ring .big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  color: var(--ink-0);
  letter-spacing: -0.02em;
}
.score-ring .big .pct {
  font-size: 18px;
  color: var(--ink-3);
  margin-left: 2px;
  vertical-align: super;
}
.score-ring .sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-2);
  margin-top: 4px;
  text-transform: uppercase;
}

.score-grade {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.score-grade b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}

/* ruleset note */
.ruleset-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-left: 2px solid var(--accent);
  position: relative;
}
.ruleset-note .icon {
  width: 28px; height: 28px;
  background: var(--accent-dim);
  color: var(--accent);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.ruleset-note .note-body {
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-1);
}
.ruleset-note .note-body strong { color: var(--ink-0); font-weight: 600; }

/* score bars */
.scores-grid { display: grid; gap: 12px; }
.score-row { display: grid; grid-template-columns: 200px 1fr 50px; gap: 14px; align-items: center; }
.score-row .name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-1);
}
.score-row .num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-0);
  text-align: right;
  font-weight: 500;
}
.score-track {
  position: relative;
  height: 14px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  overflow: hidden;
}
.score-fill {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  background: var(--accent);
  transition: width 700ms cubic-bezier(0.2,0.7,0.2,1);
}
.score-fill.ok { background: var(--ok); box-shadow: 0 0 10px -2px var(--ok); }
.score-fill.warn { background: var(--warn); box-shadow: 0 0 10px -2px var(--warn); }
.score-fill.err { background: var(--err); box-shadow: 0 0 10px -2px var(--err); }
.score-track .ticks {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(10, 1fr);
  pointer-events: none;
}
.score-track .ticks span { border-right: 1px solid rgba(36, 23, 18, 0.06); }
.score-row .num.ok { color: var(--ok); }
.score-row .num.warn { color: var(--warn); }
.score-row .num.err { color: var(--err); }

/* timeline */
.timeline {
  position: relative;
  height: 44px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.timeline .axis {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 14px;
  display: flex; justify-content: space-between;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}
.timeline .marker {
  position: absolute;
  top: 4px; bottom: 16px;
  width: 2px;
  cursor: pointer;
  transition: transform 120ms;
}
.timeline .marker::after {
  content: ""; position: absolute;
  left: 50%; transform: translateX(-50%);
  top: -3px;
  width: 8px; height: 8px;
  background: inherit;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.timeline .marker.strength { background: var(--ok); }
.timeline .marker.warning { background: var(--warn); }
.timeline .marker.error { background: var(--err); }
.timeline .marker:hover { transform: scaleY(1.15); }
.timeline .playhead {
  position: absolute; top: 0; bottom: 14px;
  width: 1px; background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* highlights */
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}
.hl-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  display: grid;
  grid-template-columns: 160px 1fr;
  overflow: hidden;
  position: relative;
}
.hl-card.strength { border-left-color: var(--ok); }
.hl-card.warning { border-left-color: var(--warn); }
.hl-card.error { border-left-color: var(--err); }

.hl-thumb {
  position: relative;
  background: var(--bg-3);
  aspect-ratio: 16/10;
  overflow: hidden;
  background-image:
    repeating-linear-gradient(45deg, rgba(36, 23, 18, 0.04) 0 10px, transparent 10px 20px);
}
.hl-thumb::before {
  content: ""; position: absolute; inset: 8px;
  border: 1px solid rgba(36, 23, 18, 0.08);
}
.hl-thumb .scan {
  position: absolute; top: 0; bottom: 0; left: 40%;
  width: 1px; background: var(--accent);
  opacity: 0.6;
}
.hl-thumb .play {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  border: 1px solid var(--ink-0);
  background: rgba(0,0,0,0.4);
  color: var(--ink-0);
  display: grid; place-items: center;
  font-size: 11px;
  cursor: pointer;
  transition: all 120ms;
}
.hl-thumb .play:hover { border-color: var(--accent); color: var(--accent); }
.hl-thumb .tc {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.7);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 2px 5px;
  border: 1px solid var(--accent-dim);
}
.hl-thumb .tag-type {
  position: absolute; top: 6px; left: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  padding: 2px 6px;
  background: rgba(0,0,0,0.7);
}
.hl-card.strength .tag-type { color: var(--ok); border: 1px solid var(--ok); }
.hl-card.warning .tag-type { color: var(--warn); border: 1px solid var(--warn); }
.hl-card.error .tag-type { color: var(--err); border: 1px solid var(--err); }
.hl-thumb .scrub {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(36, 23, 18, 0.12);
}
.hl-thumb .scrub-fill {
  position: absolute; inset: 0; right: auto;
  width: 40%;
  background: var(--accent);
}
.hl-thumb .crosshair {
  position: absolute; inset: 0;
  pointer-events: none;
}
.hl-thumb .crosshair::before,
.hl-thumb .crosshair::after {
  content: ""; position: absolute;
  background: var(--accent);
  opacity: 0.4;
}
.hl-thumb .crosshair::before {
  left: 50%; top: 30%; bottom: 30%;
  width: 1px;
}
.hl-thumb .crosshair::after {
  top: 50%; left: 30%; right: 30%;
  height: 1px;
}

.hl-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.hl-body .hl-meta {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.hl-body .hl-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-0);
  margin: 0;
  letter-spacing: 0.01em;
}
.hl-body .hl-desc {
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-1);
  margin: 0;
}
.hl-detail {
  margin-top: 4px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  display: grid; gap: 6px;
  font-family: var(--font-display);
  font-size: 11px;
  line-height: 1.5;
}
.hl-detail .k {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.hl-detail .v { color: var(--ink-1); }

/* recommendations */
.recs { display: grid; gap: 8px; }
.rec {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  align-items: start;
}
.rec .n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
}
.rec .body {
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-1);
}

/* next session */
.next-session {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 1px solid var(--accent);
  position: relative;
}
.next-session::before,
.next-session::after {
  content: ""; position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--accent);
  background: var(--bg-0);
}
.next-session::before { top: -6px; left: -6px; }
.next-session::after { bottom: -6px; right: -6px; }
.next-session .badge {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 8px;
}
.next-session .focus {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink-0);
  letter-spacing: 0.01em;
}
.next-session .focus span { color: var(--accent); }
.next-session .meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}

/* ==== loading state ==== */
.loading-overlay {
  position: relative;
  min-height: calc(100vh - 56px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: var(--bg-0);
}
.loading-card {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  padding: 32px;
  position: relative;
}
.loading-card::before,
.loading-card::after,
.loading-card .lc1,
.loading-card .lc2 {
  content: ""; position: absolute; width: 14px; height: 14px;
  border: 1px solid var(--accent);
}
.loading-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.loading-card::after { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.loading-card .lc1 { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.loading-card .lc2 { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.loading-card .head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px;
}
.loading-card .head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-0);
}
.loading-card .head .pct {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.loading-bar {
  height: 4px;
  background: var(--bg-3);
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
}
.loading-bar .fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 200ms linear;
}

.loading-steps { display: grid; gap: 8px; }
.lstep {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.lstep .mk {
  width: 18px; height: 18px;
  border: 1px solid var(--ink-4);
  display: grid; place-items: center;
  font-size: 9px;
  color: var(--ink-3);
}
.lstep .t { color: var(--ink-2); }
.lstep .dur { color: var(--ink-4); }
.lstep.done { border-color: var(--line-2); color: var(--ok); }
.lstep.done .mk { border-color: var(--ok); color: var(--ok); }
.lstep.done .t { color: var(--ink-0); }
.lstep.active { border-color: var(--accent); }
.lstep.active .mk {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--gold);
  animation: pulse-mk 1s ease-in-out infinite;
}
.lstep.active .t { color: var(--ink-0); }
@keyframes pulse-mk {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.loading-log {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  max-height: 120px;
  overflow: hidden;
  position: relative;
}
.loading-log .log-line { display: flex; gap: 8px; }
.loading-log .log-line .ts { color: var(--ink-4); }
.loading-log .log-line .cy { color: var(--accent); }
.loading-log .log-line .gn { color: var(--ok); }

/* misc */
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.kbd {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 2px 5px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--bg-2);
}

.scroll-results { padding: 24px; display: grid; gap: 24px; }
.subsection { display: grid; gap: 12px; }
.subsection-head { display: flex; justify-content: space-between; align-items: baseline; }
.subsection-head .right { display: flex; gap: 6px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--line-2); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ==== highlight card con video clip real ==== */
.hl-card.with-clip {
  display: flex;
  flex-direction: column;
  grid-template-columns: unset;
}

.hl-video-wrap {
  position: relative;
  display: block;
  background: #000;
  overflow: hidden;
  line-height: 0;
}

.hl-vid {
  display: block;
  width: 100%;
  max-height: 320px;
  background: #000;
  will-change: transform;
  transform-origin: 50% 50%;
}

.hl-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.hl-speed {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hl-speed-label {
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.hl-speed-btn {
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color 120ms, color 120ms, border-color 120ms;
}

.hl-speed-btn:hover:not(.active) {
  color: var(--ink-0);
  border-color: var(--accent);
}

.hl-speed-btn.active {
  background: var(--accent);
  color: var(--gold);
  border-color: var(--accent);
}

/* badges absolutos sobre el video */
.hl-card.with-clip .tag-type {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  padding: 2px 6px;
  background: rgba(0,0,0,0.75);
}
.hl-card.with-clip.strength .tag-type { color: var(--ok); border: 1px solid var(--ok); }
.hl-card.with-clip.warning .tag-type { color: var(--warn); border: 1px solid var(--warn); }
.hl-card.with-clip.error .tag-type { color: var(--err); border: 1px solid var(--err); }
.hl-card.with-clip .tc {
  background: rgba(0,0,0,0.75);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 2px 5px;
  border: 1px solid var(--accent-dim);
}

/* error banner (analysis failure) */
.error-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  background: var(--err-dim);
  border-top: 1px solid var(--err);
  border-bottom: 1px solid var(--err);
  color: var(--err);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.error-banner button {
  width: auto;
  background: transparent;
  border: 1px solid var(--err);
  color: var(--err);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
}
