:root {
  --ink: #0b0e10;
  --ink-soft: #101518;
  --panel: #151c20;
  --panel-raised: #1c252a;
  --panel-deep: #11171a;
  --line: #354249;
  --line-soft: rgba(219, 231, 228, .12);
  --chalk: #f4f1e9;
  --muted: #94a0a4;
  --green: #39de75;
  --pink: #ff2d92;
  --amber: #f4c84a;
  --exit: #ff6b5f;
  --display: "Arial Narrow", "Avenir Next Condensed", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--ink); }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 8% -12%, rgba(57, 222, 117, .09), transparent 32rem),
    radial-gradient(circle at 100% 14%, rgba(255, 45, 146, .08), transparent 30rem),
    linear-gradient(160deg, #0b0e10 0%, #101518 55%, #0b0e10 100%);
  color: var(--chalk);
  font-family: var(--display);
  letter-spacing: .01em;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

button, select { font: inherit; }

.live-controls {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 70;
  display: flex;
  gap: 7px;
}

.live-controls button,
.qr-overlay button {
  min-width: 42px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(21, 28, 32, .96);
  color: var(--chalk);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
}

.live-controls button:hover,
.live-controls button:focus-visible,
.qr-overlay button:hover,
.qr-overlay button:focus-visible { border-color: var(--green); color: var(--green); }

[data-live-root] .live-shell { padding-top: 70px; }

.network-banner {
  position: fixed;
  top: 62px;
  left: 50%;
  z-index: 90;
  max-width: min(92vw, 680px);
  transform: translateX(-50%);
  padding: 8px 13px;
  border: 1px solid var(--exit);
  background: rgba(45, 18, 20, .97);
  color: var(--exit);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
}

.boot-state {
  width: min(100% - 28px, 760px);
  margin: 18vh auto;
  padding: 28px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: var(--panel);
  font-family: var(--mono);
  text-align: center;
}

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.live-shell {
  width: min(100% - 28px, 1540px);
  margin: 0 auto;
  padding: 24px 0 42px;
}

.live-shell.tv-layout {
  width: min(100% - 72px, 1820px);
  padding-top: 30px;
}

.masthead,
.track-head,
.board-heading,
.surface-head,
.surface-foot,
.detail-head,
.live-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.masthead { min-height: 36px; }

.masthead-brand {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  font-weight: 900;
  letter-spacing: .15em;
  line-height: 1;
}

.brand-alfa,
.brand-slot { font-size: 1.04rem; }

.brand-slot { color: var(--green); }

.brand-dot {
  width: 8px;
  height: 8px;
  margin-left: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 18px rgba(57, 222, 117, .85);
}

.brand-live {
  margin-left: 12px;
  padding: 4px 8px 3px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .66rem;
  letter-spacing: .2em;
  white-space: nowrap;
}

.masthead-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.status--ok { color: var(--green); }
.status--ok .status-dot { background: var(--green); box-shadow: 0 0 14px rgba(57, 222, 117, .78); }
.status--error { color: var(--exit); }
.status--error .status-dot { background: var(--exit); }

.start-line {
  height: 8px;
  margin: 17px 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  opacity: .9;
  background:
    linear-gradient(45deg, rgba(244, 241, 233, .5) 25%, transparent 25%, transparent 75%, rgba(244, 241, 233, .5) 75%),
    linear-gradient(45deg, rgba(244, 241, 233, .5) 25%, transparent 25%, transparent 75%, rgba(244, 241, 233, .5) 75%);
  background-position: 0 0, 4px 4px;
  background-size: 8px 8px;
}

.track-head { align-items: flex-end; }

.eyebrow,
.section-title,
.event-kicker,
.surface-reference span,
.session-stamp span,
.detail-badge,
.sticky-lap span {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1.25;
  text-transform: uppercase;
}

.track-head h1 {
  max-width: 100%;
  margin: 4px 0 6px;
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 5vw, 4.7rem);
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: .88;
  text-transform: uppercase;
}

.session-meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .77rem;
}

.session-stamp {
  min-width: 170px;
  padding: 11px 14px;
  border-left: 3px solid var(--amber);
  background: rgba(244, 200, 74, .07);
  text-align: right;
}

.session-stamp strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--chalk);
  font-family: var(--mono);
  font-size: .78rem;
}

.record-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0 18px;
  padding: 16px 20px;
  border: 1px solid rgba(255, 45, 146, .52);
  border-left: 7px solid var(--pink);
  background: linear-gradient(100deg, rgba(255, 45, 146, .14), rgba(255, 45, 146, .035) 46%, rgba(0, 0, 0, 0));
  box-shadow: inset 0 -1px rgba(255, 255, 255, .04);
}

.record-strip h2 {
  margin: 3px 0 5px;
  font-size: clamp(.98rem, 2vw, 1.35rem);
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
}

.record-strip p { margin: 0; color: var(--muted); font-size: .86rem; }
.record-strip p span { color: var(--chalk); }

.record-strip > strong {
  flex: 0 0 auto;
  color: var(--pink);
  font-family: var(--mono);
  font-size: clamp(2.3rem, 6vw, 5.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.08em;
  line-height: .92;
  text-shadow: 0 0 28px rgba(255, 45, 146, .3);
}

.record-strip--empty { border-color: var(--line); border-left-color: var(--muted); background: rgba(255, 255, 255, .025); }
.record-strip--empty > strong { color: var(--muted); text-shadow: none; }

.live-board,
.detail-panel {
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(28, 37, 42, .84), rgba(15, 21, 24, .96));
  box-shadow: 0 22px 55px rgba(0, 0, 0, .22);
}

.live-board { padding: 18px; }

.board-heading { align-items: flex-end; margin-bottom: 14px; }

.board-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(1.25rem, 2vw, 2rem);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.mode-tag {
  padding: 6px 9px;
  border: 1px solid var(--line);
  color: var(--amber);
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.surface-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 13px;
  align-items: start;
}

.surface-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  background: var(--panel);
}

.surface-card--barrier {
  grid-column: 1 / -1;
  border-top-color: var(--amber);
}

.surface-head {
  align-items: flex-start;
  min-height: 87px;
  padding: 14px 15px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(120deg, rgba(255, 255, 255, .035), transparent 64%);
}

.surface-head-copy { min-width: 0; }

.surface-head h2 {
  max-width: 19ch;
  margin: 4px 0 5px;
  overflow-wrap: anywhere;
  font-size: clamp(1.1rem, 2.2vw, 1.55rem);
  letter-spacing: .025em;
  line-height: .98;
  text-transform: uppercase;
}

.surface-context {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .65rem;
  line-height: 1.35;
}

.surface-select,
.board-clear,
.detail-close {
  min-height: 29px;
  margin-top: 9px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.surface-select:hover,
.surface-select:focus-visible,
.board-clear:hover,
.board-clear:focus-visible,
.detail-close:hover,
.detail-close:focus-visible {
  border-color: var(--green);
  color: var(--green);
}

.surface-reference {
  flex: 0 0 auto;
  min-width: 95px;
  text-align: right;
}

.surface-reference strong {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 1.22rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
}

.surface-card--barrier .surface-reference strong { color: var(--pink); }
.surface-reference--record strong { color: var(--pink); }
.surface-reference--compact { display: none; }

.surface-reference small {
  display: block;
  max-width: 16ch;
  margin-top: 3px;
  color: var(--muted);
  font-size: .67rem;
  line-height: 1.2;
}

.latest-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
}

.latest-grid--barrier {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lap-stack {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.lap-feature { min-width: 0; }
.lap-feature-gap {
  display: block;
  padding: 5px 12px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .63rem;
  text-align: right;
}

.event-readout {
  min-width: 0;
  min-height: 152px;
  padding: 12px 13px 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  background: var(--panel-raised);
}

.event-readout--record { border-color: rgba(255, 45, 146, .7); border-left-color: var(--pink); background: linear-gradient(145deg, rgba(255, 45, 146, .14), var(--panel-raised)); }
.event-readout--best { border-color: rgba(57, 222, 117, .55); border-left-color: var(--green); }
.event-readout--exit { border-color: rgba(255, 107, 95, .68); border-left-color: var(--exit); background: linear-gradient(145deg, rgba(255, 107, 95, .14), var(--panel-raised)); }
.event-readout--inferred { border-color: rgba(244, 200, 74, .66); border-left-color: var(--amber); background: linear-gradient(145deg, rgba(244, 200, 74, .11), var(--panel-raised)); }
.event-readout--waiting { border-style: dashed; border-left-color: var(--muted); }

.event-topline,
.event-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
}

.event-age,
.event-meta,
.event-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .69rem;
  line-height: 1.25;
}

.event-time {
  display: block;
  min-width: 0;
  margin: 16px 0 8px;
  overflow-wrap: anywhere;
  color: var(--chalk);
  font-family: var(--mono);
  font-size: clamp(1.45rem, 3.8vw, 2.9rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.08em;
  line-height: .96;
}

.surface-card--barrier .event-time { font-size: clamp(1.35rem, 3.2vw, 2.75rem); }
.event-readout--record .event-time { color: var(--pink); }
.event-readout--best .event-time { color: var(--green); }
.event-readout--exit .event-time { color: var(--exit); font-size: clamp(1.1rem, 2.5vw, 2rem); letter-spacing: -.07em; }
.event-readout--inferred .event-time { color: var(--amber); }
.event-readout--waiting .event-time { color: var(--muted); }

.event-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.event-delta { margin-left: auto; color: var(--chalk); font-weight: 700; }
.event-readout--exit .event-delta { color: var(--exit); }
.event-readout--inferred .event-delta { color: var(--amber); }
.event-lane { color: var(--muted); }

.event-status {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.event-readout--record .event-status { color: var(--pink); }
.event-readout--best .event-status { color: var(--green); }
.event-readout--exit .event-status { color: var(--exit); }
.event-readout--inferred .event-status { color: var(--amber); }

.event-sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 5px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}

.event-sector {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .025);
  color: var(--chalk);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.event-sector small { color: var(--muted); font-size: .55rem; font-weight: 700; }
.event-sector strong { overflow-wrap: anywhere; font-size: .75rem; letter-spacing: -.05em; }
.event-sector--global { border-color: rgba(255, 45, 146, .56); color: var(--pink); background: rgba(255, 45, 146, .08); }
.event-sector--personal { border-color: rgba(57, 222, 117, .48); color: var(--green); background: rgba(57, 222, 117, .06); }

.trend-section,
.recent-section {
  min-width: 0;
  padding: 4px 10px 12px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.section-title span {
  color: var(--muted);
  font-family: var(--display);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: none;
}

.trend-svg,
.trend-empty {
  display: block;
  width: 100%;
  min-height: 104px;
  margin-top: 5px;
  border-bottom: 1px solid var(--line-soft);
}

.trend-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .74rem;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.recent-cell {
  min-width: 0;
  padding: 8px 5px 7px;
  border: 1px solid var(--line);
  background: var(--panel-deep);
  text-align: center;
}

.recent-cell strong,
.recent-delta {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.recent-cell strong { margin-top: 3px; color: var(--chalk); font-size: clamp(.67rem, 1.3vw, .95rem); letter-spacing: -.08em; }
.recent-delta { margin-top: 4px; color: var(--muted); font-size: clamp(.58rem, 1.2vw, .72rem); }
.recent-number { color: var(--muted); font-family: var(--mono); font-size: .58rem; }
.recent-state { min-height: .7em; margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: .52rem; letter-spacing: .02em; }
.recent-cell--record { border-color: rgba(255, 45, 146, .56); }
.recent-cell--record strong { color: var(--pink); }
.recent-cell--record .recent-state { color: var(--pink); }
.recent-cell--best strong { color: var(--green); }
.recent-cell--exit { border-color: rgba(255, 107, 95, .62); }
.recent-cell--exit strong { color: var(--exit); font-size: clamp(.56rem, 1.05vw, .78rem); }
.recent-cell--exit .recent-state { color: var(--exit); }
.recent-cell--inferred { border-color: rgba(244, 200, 74, .62); }
.recent-cell--inferred strong { color: var(--amber); }
.recent-cell--inferred .recent-state { color: var(--amber); }

.recent-empty { min-height: 46px; margin: 10px 0 0; color: var(--muted); font-family: var(--mono); font-size: .74rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 10px 12px;
}

.stat-cell {
  min-width: 0;
  padding: 8px 5px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .025);
  text-align: center;
}

.stat-cell dt { color: var(--muted); font-family: var(--mono); font-size: .58rem; letter-spacing: .04em; }
.stat-cell dd { margin: 5px 0 0; overflow-wrap: anywhere; color: var(--chalk); font-family: var(--mono); font-size: clamp(.73rem, 1.7vw, 1.1rem); font-variant-numeric: tabular-nums; letter-spacing: -.08em; }
/* La primera celda es MEJOR: verde por ser la mejor propia, salvo cuando ademas es el record
   de la sesion. El :not() es necesario: sin el, :first-child gana en especificidad al rosa. */
.stat-cell:first-child:not(.stat-cell--record) dd { color: var(--green); }
.stat-cell--record dd { color: var(--pink); }

.sector-summary {
  margin: 0 10px 12px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.sector-lap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 8px;
  padding: 8px 0 2px;
}

.sector-lap > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .04em;
}

.sector-lap > strong {
  justify-self: end;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.sector-lap .event-sector-grid {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 0;
  border-top: 0;
}

.sector-ideal {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .62rem;
}

/* La ideal es un calculo, no un tiempo cronometrado: fuera del vocabulario rosa/verde de records. */
.sector-ideal strong { margin-left: auto; color: var(--chalk); font-size: 1rem; letter-spacing: -.06em; }
.sector-ideal small { white-space: nowrap; }
.sector-best > span { display: block; margin-top: 5px; color: var(--muted); font-family: var(--mono); font-size: .58rem; letter-spacing: .04em; }

.surface-foot {
  align-items: baseline;
  min-height: 34px;
  padding: 7px 12px 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: .63rem;
}

.surface-activity { margin-left: auto; text-align: right; }
.surface-card.is-delayed { border-top-color: var(--amber); }
.surface-card.is-delayed .surface-activity { color: var(--amber); }
.surface-card.is-inactive { opacity: .62; }
.surface-card.is-inactive .surface-activity { color: var(--exit); }

.waiting-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 230px;
  padding: 28px;
  border: 1px dashed var(--line);
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .025) 0 12px, transparent 12px 24px);
}

.waiting-mark {
  color: var(--amber);
  font-family: var(--mono);
  font-size: clamp(2.7rem, 10vw, 6rem);
  font-weight: 700;
  letter-spacing: -.13em;
}

.waiting-panel h2 { margin: 5px 0 8px; font-size: clamp(1.35rem, 4vw, 2.5rem); text-transform: uppercase; }
.waiting-panel p:last-child { max-width: 56ch; margin: 0; color: var(--muted); line-height: 1.45; }

.detail-panel {
  margin-top: 18px;
  padding: 18px;
}

.detail-head { align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.detail-head h2 { margin: 4px 0 0; font-size: clamp(1.3rem, 3vw, 2.2rem); text-transform: uppercase; }
.detail-badge { padding: 6px 8px; border: 1px solid rgba(57, 222, 117, .48); color: var(--green); white-space: nowrap; }
.detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.detail-close { margin-top: 0; }
.detail-latest { max-width: 560px; margin: 14px 0; }
.detail-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr); gap: 20px; align-items: start; }
.detail-columns .stats-grid { margin: 7px 0 0; }

.history-table-wrap { overflow-x: auto; margin-top: 16px; border-top: 1px solid var(--line-soft); }
.history-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .73rem; }
.history-table caption { padding: 10px 0; color: var(--muted); text-align: left; font-family: var(--display); font-size: .8rem; }
.history-table th,
.history-table td { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.history-table thead th { color: var(--muted); font-size: .61rem; letter-spacing: .08em; }
.history-table tbody th { color: var(--muted); font-weight: 400; }
.history-time { font-weight: 700; }
.history-time--record { color: var(--pink); }
.history-time--best { color: var(--green); }
.history-time--exit { color: var(--exit); }
.history-time--inferred { color: var(--amber); }
.history-sector { color: var(--chalk); font-weight: 700; font-variant-numeric: tabular-nums; }
.history-sector--global { color: var(--pink); background: rgba(255, 45, 146, .06); }
.history-sector--personal { color: var(--green); background: rgba(57, 222, 117, .05); }

.sticky-lap {
  position: relative;
  bottom: auto;
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin: 18px 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  background: rgba(11, 14, 16, .93);
  box-shadow: 0 9px 28px rgba(0, 0, 0, .3);
}

.sticky-lap strong { color: var(--chalk); font-family: var(--mono); font-size: 1.1rem; letter-spacing: -.06em; }
.sticky-lap small { color: var(--muted); font-family: var(--mono); font-size: .7rem; }

/* Mismo vocabulario que el resto: record de sesion, mejor propia o vuelta corriente. */
.sticky-lap--record { border-color: rgba(255, 45, 146, .42); border-left-color: var(--pink); }
.sticky-lap.sticky-lap--record strong { color: var(--pink); }
.sticky-lap--best { border-color: rgba(57, 222, 117, .42); border-left-color: var(--green); }
.sticky-lap.sticky-lap--best strong { color: var(--green); }

.sticky-lap.is-fixed {
  position: fixed;
  right: max(14px, calc((100vw - 1540px) / 2));
  bottom: 12px;
  z-index: 40;
  margin: 0;
}

.live-shell.has-fixed-sticky { padding-bottom: 92px; }

[data-event-id].is-fresh { animation: live-pulse .85s ease-out; }

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(57, 222, 117, .72); filter: brightness(1.28); }
  55% { box-shadow: 0 0 0 8px rgba(57, 222, 117, .12); }
  100% { box-shadow: 0 0 0 14px rgba(57, 222, 117, 0); filter: brightness(1); }
}

.live-shell.is-offline .masthead-status { color: var(--exit); }

[data-live-record-overlay],
[data-live-qr-overlay] {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 11, .94);
}

[data-live-record-overlay].show,
[data-live-qr-overlay].show { display: grid; }

.record-overlay__card,
.qr-overlay__card {
  width: min(94vw, 720px);
  padding: clamp(24px, 6vw, 56px);
  border: 1px solid var(--pink);
  background: linear-gradient(145deg, rgba(255,45,146,.14), #110d10 72%);
  box-shadow: 0 24px 90px rgba(0,0,0,.55);
  text-align: center;
}

.record-overlay__card > span { color: var(--muted); font-family: var(--mono); font-size: .8rem; font-weight: 700; letter-spacing: .14em; }
.record-overlay__card > strong { display: block; margin-top: 12px; color: var(--pink); font-family: var(--mono); font-size: clamp(4rem, 16vw, 10rem); letter-spacing: -.09em; line-height: .9; }

.qr-overlay__card { border-color: var(--green); background: #101518; }
.qr-overlay__box { display: grid; place-items: center; min-height: 110px; margin: 18px auto; padding: 14px; background: #fff; color: #111; }
.qr-overlay__box img { display: block; max-width: min(70vw, 320px); height: auto; }
.qr-overlay__card [data-live-qr-url] { overflow-wrap: anywhere; color: var(--chalk); font-family: var(--mono); font-size: .78rem; }
.qr-overlay__card button { margin-top: 12px; padding: 6px 14px; }

.live-tv .live-controls { opacity: .24; transition: opacity .2s ease; }
.live-tv .live-controls:hover, .live-tv .live-controls:focus-within { opacity: 1; }

.live-footer {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 18px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .65rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.footer-check { color: var(--amber); font-size: 1.15rem; }

.board-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.board-clear { margin-top: 0; }

.tv-layout .track-head h1 { font-size: clamp(3.4rem, 8vw, 7rem); }
.tv-layout .session-meta { font-size: 1rem; }
.tv-layout .record-strip { padding: 20px 25px; }
.tv-layout .record-strip > strong { font-size: clamp(4.4rem, 10vw, 8rem); }
.tv-layout .surface-head h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); }
.tv-layout .surface-select,
.tv-layout .board-clear,
.tv-layout .detail-panel,
.tv-layout .trend-section,
.tv-layout .recent-section,
.tv-layout .stats-grid,
.tv-layout .sector-strip,
.tv-layout .sector-summary,
.tv-layout .lap-feature--best,
.tv-layout .event-sector-grid,
.tv-layout .lap-feature-gap,
.tv-layout .surface-foot,
.tv-layout .sticky-lap,
.tv-layout .live-footer { display: none; }
.tv-layout .surface-grid { align-items: stretch; }
.tv-layout .surface-card { height: fit-content; }
.tv-layout .surface-reference--compact { display: block; }
.tv-layout .surface-head { min-height: 78px; padding: 12px; }
.tv-layout .surface-head h2 { font-size: clamp(1.2rem, 2.1vw, 2rem); }
.tv-layout .event-time { overflow-wrap: normal; white-space: nowrap; font-size: clamp(2rem, 2.8vw, 3.4rem); }
.tv-layout .event-readout--exit .event-time { font-size: clamp(1rem, 1.45vw, 1.7rem); }
.tv-layout .surface-card--barrier .event-time { font-size: clamp(1.8rem, 2.5vw, 3rem); }
.tv-layout .event-meta,
.tv-layout .event-status { font-size: .85rem; }

@media (max-width: 760px) {
  .live-controls { top: 10px; right: 10px; }
  [data-live-root] .live-shell { padding-top: 62px; }
  .live-shell { width: min(100% - 20px, 620px); padding-top: 16px; }
  .live-shell.tv-layout { width: min(100% - 20px, 620px); }
  .masthead { align-items: flex-start; }
  .brand-live { display: none; }
  .track-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .track-head h1 { font-size: clamp(2.25rem, 12vw, 4.2rem); }
  .session-stamp { align-self: stretch; min-width: 0; text-align: left; }
  .record-strip { align-items: flex-start; padding: 13px 14px; }
  .record-strip > strong { font-size: clamp(1.9rem, 10vw, 3.4rem); }
  .live-board,
  .detail-panel { padding: 11px; }
  .surface-grid { grid-template-columns: minmax(0, 1fr); }
  .surface-card--barrier { grid-column: auto; }
  .surface-head { min-height: 0; padding: 12px 11px 10px; }
  .surface-reference { min-width: 82px; }
  .surface-reference strong { font-size: .98rem; }
  .surface-reference small { font-size: .57rem; }
  .event-readout { min-height: 144px; padding: 10px 9px; }
  .event-age,
  .event-meta,
  .event-status { font-size: .61rem; }
  .surface-card--barrier .event-time { font-size: clamp(1.08rem, 5vw, 2.1rem); }
  .event-readout--exit .event-time { font-size: clamp(.92rem, 4.1vw, 1.6rem); }
  .section-title { align-items: flex-start; flex-direction: column; gap: 3px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-columns { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .waiting-panel { min-height: 190px; padding: 18px; }
  .waiting-mark { font-size: 3rem; }
  .live-footer { gap: 7px 10px; }
  .sticky-lap.is-fixed { right: 10px; left: 10px; width: auto; justify-content: space-between; }
}

@media (max-width: 430px) {
  .live-shell { width: calc(100% - 16px); }
  .live-board,
  .detail-panel { border-left: 0; border-right: 0; }
  .latest-grid--barrier { gap: 5px; padding: 7px; }
  .event-readout { min-height: 132px; }
  .event-kicker { font-size: .57rem; letter-spacing: .07em; }
  .event-time { margin-top: 13px; }
  .event-meta { gap: 3px 6px; }
  .event-delta { width: 100%; margin-left: 0; }
  .recent-grid { gap: 3px; }
  .recent-cell { padding: 6px 2px; }
  .recent-cell strong { font-size: .59rem; }
  .recent-delta { font-size: .54rem; }
  .recent-state { font-size: .45rem; }
  .record-strip { gap: 8px; }
  .record-strip h2 { font-size: .85rem; }
  .record-strip p { font-size: .71rem; }
  .record-strip > strong { font-size: 1.55rem; }
  .sticky-lap { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
