/* ══════════════════════════════════════════
   BULLS — BNB Bull Racing
   Brutal editorial · zero rounded-pill soup
   ══════════════════════════════════════════ */

:root {
  --bg:     #070707;
  --s1:     #0c0c0e;
  --s2:     #101013;
  --s3:     #141418;
  --line:   rgba(255,255,255,.06);
  --line2:  rgba(255,255,255,.11);
  --ink:    #ede9e3;
  --ink2:   #7a756e;
  --ink3:   #3a3732;

  --gold:   #f0b90b;
  --gold2:  #ffd84d;
  --amber:  #ff6b00;
  --green:  #00e87a;
  --red:    #ff3b3b;

  --f-disp: 'Bebas Neue', impact, sans-serif;
  --f-body: 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  --bar-h: 52px;
  --strip-h: 44px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--f-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ── grain canvas ── */
#grain {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
}

/* ══ TOP BAR ══ */
.bar {
  position: sticky; top: 0; z-index: 200;
  height: var(--bar-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0;
  background: rgba(7,7,7,.94);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line2);
}

.bar-brand {
  display: flex; align-items: baseline; gap: 8px;
  padding: 0 20px;
  border-right: 1px solid var(--line);
}
.wordmark {
  font-family: var(--f-disp);
  font-size: 28px;
  letter-spacing: .06em;
  color: var(--gold);
  line-height: 1;
  text-shadow: 0 0 32px rgba(240,185,11,.3);
}
.net-tag {
  font-family: var(--f-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em;
  color: var(--ink3);
  text-transform: uppercase;
}

/* round nav */
.round-nav {
  display: flex; align-items: center; gap: 0;
  padding: 0 20px;
  justify-content: center;
}
.rnav-sep {
  color: var(--ink3);
  font-size: 11px;
  padding: 0 8px;
}
.rnav-btn {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em;
  color: var(--ink3);
  padding: 6px 10px;
  transition: color .12s;
  position: relative;
}
.rnav-btn:hover { color: var(--ink2); }
.rnav-btn[aria-selected="true"] { color: var(--gold); }
.rnav-btn[aria-selected="true"]::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 2px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}
.rnav-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(240,185,11,.8);
  animation: bpulse 1.3s ease-in-out infinite;
}
@keyframes bpulse { 0%,100%{opacity:.6;transform:scale(.8)} 50%{opacity:1;transform:scale(1.2)} }

/* bar right */
.bar-right {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  border-left: 1px solid var(--line);
}

.w-chip {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  color: var(--ink3);
  padding: 4px 10px;
  background: var(--s2);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: all .15s;
  white-space: nowrap;
}
.w-chip[data-mode="online"] {
  color: var(--green);
  border-color: rgba(0,232,122,.25);
  background: rgba(0,232,122,.06);
}
.w-chip[data-mode="warn"] {
  color: var(--gold);
  border-color: rgba(240,185,11,.3);
  background: rgba(240,185,11,.06);
}
.w-chip[data-mode="error"] {
  color: var(--red);
  border-color: rgba(255,59,59,.25);
}
.w-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.w-chip[data-mode="online"] .w-dot { animation: bpulse 1.6s ease-in-out infinite; }

.w-btn {
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em;
  padding: 6px 14px;
  background: var(--gold);
  color: #07060a;
  border-radius: 4px;
  transition: filter .12s, transform .1s;
}
.w-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.w-btn:active { transform: none; }

.ico-link {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink3);
  padding: 4px 6px;
  transition: color .12s;
  display: flex; align-items: center;
}
.ico-link:hover { color: var(--ink2); }

/* ══ LIVE STRIP ══ */
.live-strip {
  position: relative; z-index: 1;
  height: var(--strip-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: var(--s1);
  border-bottom: 1px solid var(--line);
  gap: 16px;
  overflow: hidden;
}
.live-strip::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--amber);
  box-shadow: 0 0 20px var(--amber);
}

.ls-left { display: flex; align-items: center; gap: 12px; }
.ls-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.ls-live {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--f-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: .15em;
  color: var(--amber);
}
.ls-live.sm { font-size: 9px; }

.blink-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--amber);
  animation: bpulse .9s ease-in-out infinite;
}

.ls-caption {
  font-size: 13px; font-weight: 500;
  color: var(--ink);
}

.ls-dim {
  font-size: 11px; color: var(--ink3);
  font-family: var(--f-mono);
}

.thin-bar {
  height: 3px;
  width: 160px;
  background: var(--s3);
  border-radius: 999px;
  overflow: visible;
  position: relative;
  flex-shrink: 0;
}
.thin-bar.w240 { width: 240px; }

.thin-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--amber));
  border-radius: 999px;
  position: relative;
  transition: width .3s linear;
}
.thin-fill::after {
  content: '';
  position: absolute; right: -3px; top: -3px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold2);
  box-shadow: 0 0 10px rgba(240,185,11,.8);
}

.ls-ct {
  font-family: var(--f-mono);
  font-size: 14px; font-weight: 700;
  color: var(--gold);
  min-width: 46px;
}

.ls-watch {
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .05em;
  padding: 5px 12px;
  border: 1px solid var(--line2);
  border-radius: 4px;
  color: var(--ink2);
  transition: color .12s, border-color .12s;
}
.ls-watch:hover:not(:disabled) { color: var(--gold); border-color: rgba(240,185,11,.3); }
.ls-watch:disabled { opacity: .3; cursor: not-allowed; }

/* ══ MAIN STAGE ══ */
.stage {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 1fr 280px;
  min-height: calc(100vh - var(--bar-h) - var(--strip-h));
}
@media (max-width: 960px) {
  .stage { grid-template-columns: 1fr; }
}

/* ── Heats column ── */
.heats-col {
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}

.col-head {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--s1);
  flex-wrap: wrap;
}

.ph-val {
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .12em;
  color: var(--gold);
}

.ph-note {
  font-size: 11px;
  color: var(--ink3);
  padding: 3px 8px;
  background: rgba(240,185,11,.05);
  border: 1px solid rgba(240,185,11,.12);
  border-radius: 3px;
}

.heats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  flex: 1;
}

/* Heat card */
.heat {
  background: var(--s1);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  transition: background .12s;
  cursor: default;
}
.heat:hover { background: var(--s2); }
.heat:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: -1px;
  background: var(--s2);
}

.hhead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px;
}
.hhead b {
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink2);
  line-height: 1.2;
}

.tag {
  font-family: var(--f-mono);
  font-size: 9px; font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--s3);
  color: var(--ink3);
  flex-shrink: 0;
}
.tag.running { background: rgba(255,107,0,.12); color: var(--amber); }
.tag.finished { background: rgba(0,232,122,.08); color: var(--green); }

.slots { display: flex; flex-direction: column; gap: 4px; }

.slot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 8px;
  background: var(--s2);
  border-left: 2px solid transparent;
  font-size: 11px;
  transition: border-color .1s;
}
.slot:hover { border-left-color: var(--gold); }

.slot code {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink2);
}
.slot .muted { color: var(--ink3); font-size: 10px; }

.btn-watch-heat {
  font-family: var(--f-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  color: var(--ink3);
  text-align: center;
  width: 100%;
  transition: color .12s, background .12s;
  margin-top: 2px;
}
.btn-watch-heat:hover { color: var(--gold); background: rgba(240,185,11,.04); }

/* ══ LEADERBOARD ══ */
.lb-col {
  display: flex; flex-direction: column;
  position: sticky; top: calc(var(--bar-h) + var(--strip-h));
  max-height: calc(100vh - var(--bar-h) - var(--strip-h));
  overflow: hidden;
}
@media (max-width: 960px) {
  .lb-col {
    position: static; max-height: none;
    border-top: 1px solid var(--line);
  }
}

.lb-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--s1);
  flex-shrink: 0;
}
.lb-heading {
  font-family: var(--f-disp);
  font-size: 20px;
  letter-spacing: .08em;
  color: var(--ink);
}
.lb-count {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink3);
}

.lb-skeleton { padding: 10px 14px; flex-shrink: 0; }
.sk {
  height: 28px;
  background: linear-gradient(90deg, var(--s2) 0%, var(--s3) 50%, var(--s2) 100%);
  background-size: 300% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  margin-bottom: 5px;
  border-radius: 2px;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.sk-msg {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink3);
  padding: 4px 0;
}

.lb-search {
  display: flex;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.lb-search input {
  flex: 1;
  padding: 9px 12px;
  background: var(--s1);
  border: none;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 11px;
  outline: none;
}
.lb-search input::placeholder { color: var(--ink3); }
.lb-search input:focus { background: var(--s2); }
.lb-search button {
  padding: 9px 14px;
  background: var(--s1);
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--ink3);
  transition: color .12s, background .12s;
}
.lb-search button:hover { color: var(--gold); background: rgba(240,185,11,.05); }

.lb-list {
  flex: 1; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--s3) transparent;
}

.row {
  display: flex; align-items: center;
  padding: 7px 14px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  transition: background .1s;
}
.row:hover { background: var(--s2); }
.row-rank {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink3);
  min-width: 28px;
  flex-shrink: 0;
}
.row code {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-pts {
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

/* ══ VEIL (overlay) ══ */
.veil {
  position: fixed; inset: 0; z-index: 9000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.veil[aria-hidden="false"] { display: flex; }

.veil-bg {
  position: absolute; inset: 0;
  background: rgba(3,3,4,.85);
  backdrop-filter: blur(18px) saturate(1.1);
}

/* ══ INTRO CARD ══ */
.intro-card {
  position: relative; z-index: 1;
  width: min(880px, 100%);
  background: var(--s1);
  border: 1px solid var(--line2);
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.04) inset;
}
@media (max-width: 640px) {
  .intro-card { grid-template-columns: 1fr; }
}

.ic-media {
  position: relative;
  overflow: hidden;
  background: #050507;
  min-height: 300px;
}
.ic-banner {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(.6) saturate(1.3);
}
.ic-lines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent 0, transparent 3px,
    rgba(0,0,0,.25) 3px, rgba(0,0,0,.25) 4px
  );
  pointer-events: none;
}
.ic-over {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-end;
  padding: 24px;
  background: linear-gradient(to top, rgba(5,5,7,.92) 0%, transparent 60%);
}
.ic-title {
  font-family: var(--f-disp);
  font-size: clamp(56px, 10vw, 88px);
  letter-spacing: .04em;
  line-height: .95;
  color: var(--gold);
  text-shadow: 0 0 60px rgba(240,185,11,.5), 0 0 120px rgba(240,185,11,.2);
}
.ic-sub {
  font-family: var(--f-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-top: 6px;
}

.ic-body {
  padding: 28px 24px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
}

.ic-lead {
  font-size: 14px; line-height: 1.65;
  color: var(--ink2);
}
.ic-lead strong { color: var(--ink); }

.ic-rules { display: flex; flex-direction: column; gap: 10px; }
.ir {
  display: flex; gap: 12px;
  align-items: flex-start;
  font-size: 12px; line-height: 1.55;
  color: var(--ink2);
}
.ir-n {
  font-family: var(--f-disp);
  font-size: 22px;
  line-height: 1;
  color: var(--s3);
  flex-shrink: 0;
  width: 26px;
  padding-top: 1px;
}
.ir strong { color: var(--ink); }

.ca-strip {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px;
  background: rgba(240,185,11,.05);
  border-left: 2px solid var(--gold);
  font-size: 12px; line-height: 1.5;
  color: var(--ink2);
}
.ca-glyph { flex-shrink: 0; color: var(--gold); }

.ic-cta { display: flex; gap: 8px; margin-top: 4px; }

.cta-enter {
  flex: 1;
  padding: 12px 20px;
  background: var(--gold);
  color: #060508;
  font-family: var(--f-mono);
  font-size: 12px; font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 3px;
  transition: filter .12s, transform .1s;
  box-shadow: 0 8px 30px rgba(240,185,11,.2);
}
.cta-enter:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cta-enter:active { transform: none; }

.cta-skip {
  padding: 12px 16px;
  border: 1px solid var(--line2);
  border-radius: 3px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink3);
  transition: color .12s, border-color .12s;
}
.cta-skip:hover { color: var(--ink2); border-color: var(--line2); }

/* ══ VIEWER CARD ══ */
.viewer-card {
  position: relative; z-index: 1;
  width: min(1060px, 100%);
  background: var(--s1);
  border: 1px solid var(--line2);
  box-shadow: 0 40px 100px rgba(0,0,0,.8);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px);
  overflow: hidden;
}

.vc-close {
  position: absolute; right: 12px; top: 10px; z-index: 2;
  width: 32px; height: 32px;
  background: var(--s2);
  border: 1px solid var(--line2);
  border-radius: 3px;
  font-size: 13px;
  color: var(--ink3);
  display: flex; align-items: center; justify-content: center;
  transition: color .12s, border-color .12s;
}
.vc-close:hover { color: var(--ink); border-color: var(--line2); }

.vc-head {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--s2);
  flex-shrink: 0;
}
.vc-head b {
  font-family: var(--f-mono);
  font-size: 13px; font-weight: 700;
}
.viewer-progress { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.vc-time {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink3);
  min-width: 50px; text-align: right;
}

/* race track */
.race-track {
  position: relative;
  width: 100%; height: min(54vw, 500px);
  background:
    radial-gradient(circle at 50% 50%, rgba(240,185,11,.06), transparent 38%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 24px),
    linear-gradient(135deg, #101109, #050506 62%);
  border: 1px solid var(--line2);
  overflow: hidden;
  flex-shrink: 0;
}
.race-track::before {
  content: ''; position: absolute; inset: 12% 8%;
  background:
    radial-gradient(circle at 50% 50%, rgba(0,0,0,.72), rgba(0,0,0,.38) 58%, transparent 59%),
    repeating-linear-gradient(90deg, rgba(240,185,11,.07) 0 2px, transparent 2px 42px);
  border: 1px solid rgba(240,185,11,.22);
  border-radius: 10px;
}
.startline {
  position: absolute; left: 12%; top: 10%;
  width: 8px; height: 80%;
  background: repeating-linear-gradient(45deg, #000 0px, #000 5px, #fff8 5px, #fff8 10px);
  border-radius: 2px; z-index: 2; opacity: .65;
}
.track-tree {
  display: none;
}

.vc-legend {
  padding: 8px 12px;
  display: grid; gap: 4px;
  background: var(--s2);
  border-top: 1px solid var(--line);
  max-height: 180px; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--s3) transparent;
}
.vc-legend .row { background: var(--s1); }

/* ══ BULL SPRITES ══ */
.bull {
  position: absolute; transform: translate(-50%,-50%); z-index: 3;
  width: 34px; height: 22px;
  border-radius: 45% 50% 42% 42%;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  box-shadow: inset -8px -5px 0 rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.55);
  filter: drop-shadow(0 0 8px rgba(240,185,11,.45)) saturate(1.3);
}
.bull::before, .bull::after {
  content: '';
  position: absolute; top: -3px;
  width: 10px; height: 10px;
  border-top: 2px solid rgba(255,255,255,.9);
  border-radius: 50%; z-index: 4;
}
.bull::before { left: 21px; transform: rotate(-26deg); }
.bull::after  { left: 28px; transform: rotate(26deg); }
.bull .rider { display: none; }

.bull.runRight { animation:br .36s infinite; }
@keyframes br {
  0%,100%{ transform:translate(-50%,-50%) rotate(-.6deg); }
  50%    { transform:translate(-50%,-56%) rotate(.6deg); }
}

.bull.runLeft { animation:bl .36s infinite; }
@keyframes bl {
  0%,100%{ transform:translate(-50%,-50%) rotate(.6deg) scaleX(-1); }
  50%    { transform:translate(-50%,-56%) rotate(-.6deg) scaleX(-1); }
}

.bull.runDown { animation:bd .52s infinite; }
@keyframes bd {
  0%,100%{ transform:translate(-50%,-50%) rotate(90deg); }
  50%    { transform:translate(-50%,-56%) rotate(90deg); }
}

.bull.runUp { animation:bu .52s infinite; }
@keyframes bu {
  0%,100%{ transform:translate(-50%,-50%) rotate(-90deg); }
  50%    { transform:translate(-50%,-56%) rotate(-90deg); }
}

/* ══ UTILS ══ */
.muted { color: var(--ink2); }
.tiny  { font-size: 10px; }

@media (max-width: 520px) {
  .round-nav { display: none; }
  .bar-right .ico-link { display: none; }
}
