:root {
  --red: #e30613;
  --red-dark: #a90009;
  --black: #0b0b0d;
  --panel: #151519;
  --panel-2: #1d1d22;
  --line: #303036;
  --white: #f7f7f8;
  --muted: #9c9ca5;
  --green: #22c55e;
  --blue: #0878bd;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--black);
  background: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; background: #fff; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 3vw; border-bottom: 1px solid #e5e5e5; background: #fff; box-shadow: 0 4px 24px #0000000a; }
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-logo { display: block; width: 190px; height: 64px; object-fit: contain; }
.brand-copy { display: flex; flex-direction: column; line-height: .9; letter-spacing: .08em; }
.brand-copy small { color: #555; letter-spacing: .22em; white-space: nowrap; }
.connection { display: flex; gap: 9px; align-items: center; color: #555; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.connection-dot { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 12px currentColor; }
.connection[data-state="online"] .connection-dot { background: var(--green); }
.connection[data-state="offline"] .connection-dot { background: var(--red); }
main { width: min(1500px, 94vw); margin: 0 auto; }
.hero { min-height: 190px; display: flex; justify-content: space-between; align-items: center; gap: 40px; }
.eyebrow { margin: 0 0 8px; color: var(--red); font-weight: 800; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(32px, 4vw, 62px); text-transform: uppercase; letter-spacing: -.04em; }
.hero p:last-child { color: #666; }
.race-state { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; padding: 20px 26px; background: var(--panel); border-left: 4px solid var(--red); }
.race-state div { display: flex; flex-direction: column; min-width: 105px; }
.race-state small { color: #f1f1f3; font-size: 11px; font-weight: 800; letter-spacing: .15em; }
.race-state strong { margin-top: 6px; color: #fff; font-size: 20px; font-weight: 900; }
.race-state .best-lap { flex-basis: 100%; margin: -8px 0 0 42px; color: #d9dc58; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.flag { box-sizing: border-box; width: 20px; height: 52px; border: 1px solid #fff; background: var(--blue); box-shadow: 0 0 18px #0878bd55; }
.flag[data-flag="live"] { background: var(--blue); box-shadow: 0 0 18px #0878bd55; }
.flag[data-flag="green"] { background: var(--green); box-shadow: 0 0 18px #22c55e66; }
.flag[data-flag="warmup"] { background: var(--blue); box-shadow: 0 0 18px #0878bd55; }
.flag[data-flag="yellow"] { background: #facc15; }
.flag[data-flag="red"] { background: var(--red); }
.flag[data-flag="stop"] { background: var(--black); box-shadow: 0 0 18px #0008; }
.flag[data-flag="finish"] { background: repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0/12px 12px; }
.notice { margin-bottom: 12px; padding: 14px 18px; color: #fff; background: var(--red-dark); }
.timing-card { overflow-x: auto; color: var(--white); border: 1px solid var(--line); background: var(--panel); box-shadow: 0 20px 45px #0003; }
.timing-toolbar { position: relative; display: grid; min-height: 48px; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 0 14px 0 16px; border-bottom: 1px solid var(--line); background: #09090b; }
.timing-toolbar > strong { color: #fff; font-size: 11px; letter-spacing: .14em; }
.timing-message { min-width: 0; overflow: hidden; padding: 7px 10px; color: #16130a; background: #facc15; font-size: 11px; font-weight: 800; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.timing-message[hidden] { display: none; }
.class-filter { position: relative; display: flex; grid-column: 3; align-items: center; gap: 12px; }
.active-toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; }
.active-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.active-toggle > span { position: relative; width: 30px; height: 16px; border: 1px solid #4b4b53; border-radius: 999px; background: #26262c; transition: background .2s, border-color .2s; }
.active-toggle > span::after { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #8b8b94; content: ""; transition: transform .2s, background .2s; }
.active-toggle input:checked + span { border-color: var(--green); background: #123b22; }
.active-toggle input:checked + span::after { background: var(--green); transform: translateX(14px); }
.active-toggle input:focus-visible + span { outline: 2px solid #fff; outline-offset: 2px; }
.active-toggle b { font-size: 9px; letter-spacing: .1em; }
.class-filter > span { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.class-filter-button { display: grid; width: 34px; height: 34px; place-content: center; gap: 4px; padding: 0; border: 1px solid #3d3d44; background: #1d1d22; cursor: pointer; }
.class-filter-button i { display: block; width: 16px; height: 2px; background: #fff; }
.class-filter-button:hover, .class-filter-button:focus-visible { border-color: var(--red); background: #292930; }
.class-filter-menu { position: absolute; top: calc(100% + 7px); right: 0; z-index: 20; overflow-y: auto; width: max-content; min-width: 190px; max-height: 300px; padding: 6px; border: 1px solid var(--line); background: #111114; box-shadow: 0 14px 34px #0008; }
.class-filter-menu[hidden] { display: none; }
.class-filter-menu button { display: block; width: 100%; padding: 10px 12px; border: 0; color: #ddd; background: transparent; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.class-filter-menu button:hover, .class-filter-menu button:focus-visible { background: #25252b; color: #fff; }
.class-filter-menu button[aria-checked="true"] { color: #fff; background: var(--red); font-weight: 800; }
.table-head, .result-row { display: grid; grid-template-columns: 65px 65px 62px minmax(220px, 2fr) minmax(130px, 1fr) 130px 130px 75px 110px; align-items: center; }
.table-head, .result-row, .empty-state { min-width: 1000px; }
.table-head { min-height: 46px; padding: 0 16px; color: var(--muted); background: #09090b; font-size: 10px; font-weight: bold; letter-spacing: .12em; }
.result-row { min-height: 65px; padding: 0 16px; border-top: 1px solid var(--line); }
.result-row:nth-child(even) { background: var(--panel-2); }
.position { font-size: 24px; font-weight: 900; color: var(--red); }
.number { font-weight: 800; }
.track-status { color: #62626b; font-size: 13px; }
.track-status b { display: inline-grid; place-items: center; width: 40px; min-height: 24px; color: #fff; background: #555; border-radius: 999px; font-size: 10px; letter-spacing: .06em; }
.track-status.in-pit b { background: var(--blue); box-shadow: 0 0 12px #0878bd55; }
.track-status.pit-out b { background: var(--green); }
.track-status.position-up b, .track-status.position-down b { width: 25px; min-height: 25px; border-radius: 50%; font-size: 18px; line-height: 1; }
.track-status.position-up b { background: var(--green); }
.track-status.position-down b { background: var(--red); }
.track-status.lap-complete b { width: 20px; min-height: 20px; border-radius: 50%; background: var(--green); font-size: 0; box-shadow: 0 0 10px #22c55e55; }
.track-status.race-finish b { width: 24px; min-height: 24px; border: 1px solid #777; border-radius: 2px; background: repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0 / 8px 8px; font-size: 0; }
.driver { position: relative; display: flex; align-self: stretch; justify-content: center; flex-direction: column; padding-bottom: 4px; font-weight: 800; text-transform: uppercase; }
.driver small { margin-top: 4px; color: var(--muted); font-weight: normal; text-transform: none; }
.lap-progress { position: absolute; right: 8px; bottom: 0; left: 0; display: block; overflow: hidden; height: 1px; pointer-events: none; }
.lap-progress i { display: block; width: 100%; height: 100%; background: #6fcf86; opacity: .72; transform: scaleX(var(--lap-start)); transform-origin: left; }
.lap-progress.moving i { animation: lap-fill var(--lap-duration) linear forwards; }
.lap-progress.complete { opacity: 0; }
.best { font-size: 18px; font-weight: 900; }
.last-lap { color: #d8d8dc; }
.pit { color: #facc15; font-weight: bold; }
.empty-state { min-height: 300px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 9px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--white); font-size: 20px; }
.loader { width: 32px; height: 32px; margin-bottom: 12px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .9s linear infinite; }
footer { display: flex; justify-content: space-between; padding: 20px 3vw 35px; color: #666; font-size: 12px; border-top: 1px solid #eee; }
.development-credit { color: #111217; font-weight: 700; }
.sponsors { padding: 34px 0 18px; }
.sponsors-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.sponsors h2 { margin: 0; font-size: 20px; text-transform: uppercase; letter-spacing: .04em; }
.sponsors .eyebrow { margin-bottom: 2px; font-size: 9px; letter-spacing: .18em; }
.event-link { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; color: #fff; background: var(--red); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-decoration: none; text-transform: uppercase; transition: background .2s, transform .2s; }
.event-link:hover, .event-link:focus-visible { background: var(--red-dark); transform: translateY(-2px); }
.sponsor-grid { display: grid; grid-template-columns: repeat(10, 1fr); border-top: 1px solid #e4e4e4; border-left: 1px solid #e4e4e4; background: #fff; box-shadow: 0 8px 24px #00000009; }
.sponsor-grid a { display: grid; place-items: center; min-height: 70px; padding: 10px; border-right: 1px solid #e4e4e4; border-bottom: 1px solid #e4e4e4; transition: background .2s; }
.sponsor-grid a:hover, .sponsor-grid a:focus-visible { background: #ececee; }
.sponsor-grid img { display: block; width: 100%; height: 38px; object-fit: contain; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes lap-fill {
  0% { opacity: .72; transform: scaleX(var(--lap-start)); }
  99% { opacity: .72; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1); }
}
[data-embed="true"] body { background: #fff; }
[data-embed="true"] .topbar,
[data-embed="true"] .sponsors,
[data-embed="true"] footer { display: none; }
[data-embed="true"] main { width: 100%; padding: 0 12px 12px; }
[data-embed="true"] .hero { min-height: 142px; }
[data-embed="true"] h1 { font-size: clamp(25px, 3vw, 42px); }
@media (max-width: 1000px) { .hero { align-items: flex-start; flex-direction: column; padding: 40px 0 25px; } .race-state { width: 100%; } }
@media (max-width: 1200px) { .sponsor-grid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 640px) {
  .topbar { height: 68px; padding: 0 4vw; }
  .brand { gap: 8px; }
  .brand-logo { width: 135px; height: 52px; }
  .brand-copy { display: none; }
  .connection { font-size: 0; }
  .connection-dot { width: 11px; height: 11px; }
  main { width: 96vw; }
  .hero { min-height: 0; gap: 24px; padding-top: 30px; }
  h1 { font-size: 32px; }
  .race-state { gap: 14px; padding: 16px; }
  .race-state div { min-width: 0; flex: 1; }
  .race-state strong { font-size: 16px; }
  .race-state .best-lap { margin: -5px 0 0 34px; font-size: 10px; }
  .timing-card { overflow: hidden; box-shadow: 0 10px 28px #0002; }
  .timing-toolbar { min-height: 42px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; padding: 5px 8px; }
  .timing-toolbar > strong { font-size: 9px; }
  .timing-message { grid-row: 2; grid-column: 1 / -1; padding: 6px 8px; font-size: 9px; }
  .class-filter { gap: 7px; }
  .active-toggle { gap: 4px; }
  .active-toggle > span { width: 26px; height: 14px; }
  .active-toggle > span::after { top: 2px; width: 8px; height: 8px; }
  .active-toggle input:checked + span::after { transform: translateX(12px); }
  .active-toggle b { display: inline; font-size: 7px; letter-spacing: .05em; white-space: nowrap; }
  .class-filter > span { max-width: 82px; font-size: 8px; }
  .class-filter-button { width: 30px; height: 30px; }
  .class-filter-menu { right: 0; width: min(250px, 88vw); max-height: 55vh; }
  .table-head, .result-row { width: 100%; min-width: 0; grid-template-columns: 26px 38px 32px minmax(64px, 1fr) 44px 62px 30px; column-gap: 2px; }
  .table-head { display: grid; min-height: 34px; padding: 0 4px; font-size: 7px; letter-spacing: .04em; }
  .result-row { min-height: 54px; padding: 0 4px; }
  .table-head > span:nth-child(7), .table-head > span:nth-child(9),
  .result-row > span:nth-child(7), .result-row > span:nth-child(9) { display: none; }
  .result-row > span { min-width: 0; font-size: 11px; }
  .result-row > span::before { display: none; }
  .result-row .position { color: var(--red); font-size: 15px; }
  .result-row .number { font-size: 14px; }
  .result-row .track-status { overflow: hidden; font-size: 8px; }
  .result-row .track-status b { width: 28px; min-height: 20px; font-size: 8px; }
  .result-row .track-status.position-up b, .result-row .track-status.position-down b { width: 20px; min-height: 20px; font-size: 14px; }
  .result-row .track-status.lap-complete b { width: 16px; min-height: 16px; }
  .result-row .track-status.race-finish b { width: 19px; min-height: 19px; background-size: 6px 6px; }
  .result-row .driver { overflow: hidden; padding-bottom: 3px; font-size: 11px; line-height: 1.05; }
  .result-row .driver small { margin-top: 3px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
  .result-row .lap-progress { right: 4px; height: 1px; }
  .result-row .best { color: #fff; font-size: 11px; }
  .result-row .pit { color: #facc15; }
  .empty-state { min-width: 0; min-height: 230px; padding: 24px; border: 1px solid var(--line); background: var(--panel); }
  footer { gap: 8px; flex-direction: column; }
  .sponsors { padding-top: 28px; }
  .sponsors-head { align-items: flex-start; flex-direction: column; }
  .sponsor-grid { grid-template-columns: repeat(2, 1fr); }
  .sponsor-grid a { min-height: 64px; padding: 9px; }
  .sponsor-grid img { height: 34px; }
}
