:root {
  --navy: #070037;
  --navy-soft: #151d4a;
  --red: #f21c32;
  --white: #ffffff;
  --muted: #b9c3e6;
  --line: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--navy); }

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% -8%, rgba(242, 28, 50, 0.28), transparent 31rem),
    radial-gradient(circle at 88% 28%, rgba(80, 97, 191, 0.2), transparent 28rem),
    linear-gradient(180deg, var(--navy) 0%, #0b1038 56%, var(--navy-soft) 100%);
  color: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.site-shell { min-height: 100vh; min-height: 100dvh; overflow: hidden; position: relative; }
.race-stripe { height: 7px; background: repeating-linear-gradient(90deg, var(--red) 0 42px, var(--white) 42px 84px); }

.site-header {
  width: min(1120px, calc(100% - 44px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-lockup { display: flex; align-items: center; gap: 12px; font-size: .78rem; font-weight: 850; letter-spacing: .025em; }
.brand-lockup img { width: 49px; height: 49px; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0,0,0,.22)); }
.live-pill { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: rgba(255,255,255,.06); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px rgba(242,28,50,.15); }

.hero { width: min(1120px, calc(100% - 44px)); margin: 52px auto 42px; }
.eyebrow, .section-label { margin: 0 0 12px; color: var(--red); font-size: .72rem; font-weight: 950; letter-spacing: .15em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 820px; font-size: clamp(3.5rem, 10vw, 8.5rem); font-weight: 950; letter-spacing: -.075em; line-height: .78; text-transform: uppercase; }
.hero h1 em { color: transparent; font-style: normal; -webkit-text-stroke: 2px var(--red); text-shadow: 0 0 34px rgba(242,28,50,.17); }
.hero-copy { max-width: 500px; margin: 28px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.55; }

.leaderboard-card {
  width: min(1120px, calc(100% - 44px));
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.075);
  box-shadow: 0 28px 70px rgba(0,0,0,.34);
  backdrop-filter: blur(18px);
}

.card-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 24px 28px 22px; border-bottom: 1px solid var(--line); }
.card-heading h2, .drawer-heading h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -.045em; }
.results-count { display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
.results-count strong { color: var(--white); font-size: 1.8rem; }
.results-count span { font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 15px 28px; color: var(--muted); font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
th:first-child { width: 126px; }
.time-column, .time-cell { text-align: right; }
td { padding: 18px 28px; border-top: 1px solid rgba(255,255,255,.09); }
.name-cell { font-size: 1.03rem; font-weight: 800; }
.editable-name-button { border: 0; padding: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(242,28,50,.55); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.editable-name-button:hover, .editable-name-button:focus-visible { color: #ff6a78; text-decoration-color: var(--red); }
.time-cell { color: var(--white); font-variant-numeric: tabular-nums; font-size: 1.12rem; font-weight: 900; letter-spacing: .025em; }
.position-badge { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; background: rgba(7,0,55,.42); font-size: .82rem; font-weight: 950; }
.podium-row { background: linear-gradient(90deg, rgba(242,28,50,.13), transparent 58%); }
.podium-1 .position-badge { border-color: var(--red); background: var(--red); box-shadow: 0 8px 22px rgba(242,28,50,.3); }
.empty-state { padding: 56px 24px 62px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-top: 12px; color: var(--white); font-size: 1.08rem; }
.empty-state p { margin: 7px 0 0; font-size: .88rem; }
.empty-flag { display: grid; width: 38px; height: 38px; margin: 0 auto; place-items: center; color: var(--red); border: 1px solid rgba(242,28,50,.42); border-radius: 50%; background: rgba(242,28,50,.1); }

.site-footer { position: relative; width: min(1120px, calc(100% - 44px)); min-height: 108px; margin: 0 auto; padding: 31px 0 42px; display: flex; justify-content: space-between; gap: 20px; color: rgba(255,255,255,.46); font-size: .72rem; font-weight: 700; }
.site-footer p { margin: 0; }
.site-footer span { color: var(--red); }
.footer-admin-link { align-self: start; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; cursor: pointer; }
.footer-admin-link:hover, .footer-admin-link:focus-visible { color: var(--white); }
.secret-admin-trigger { position: absolute; left: -22px; bottom: 0; width: 52px; height: 52px; border: 0; padding: 0; background: transparent; opacity: 0; cursor: default; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(2,0,24,.66); opacity: 0; visibility: hidden; transition: opacity .24s ease, visibility .24s ease; }
.drawer-backdrop.is-open { opacity: 1; visibility: visible; }
.admin-drawer { position: fixed; inset: 0 0 0 auto; z-index: 30; width: min(530px, 100%); overflow-y: auto; padding: 28px; border-left: 1px solid rgba(255,255,255,.18); background: linear-gradient(180deg, #11184a, var(--navy)); box-shadow: -24px 0 70px rgba(0,0,0,.5); transform: translateX(102%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility .28s ease; }
.admin-drawer.is-open { transform: translateX(0); visibility: visible; }
.drawer-handle { display: none; }
.drawer-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.close-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.06); color: var(--white); font-size: 1.65rem; line-height: 1; cursor: pointer; }
.result-form { display: grid; gap: 18px; margin: 28px 0 34px; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.07); }
.result-form label { display: grid; gap: 8px; }
.result-form label > span { font-size: .74rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.result-form input { width: 100%; height: 50px; border: 1px solid rgba(255,255,255,.22); border-radius: 7px; outline: none; padding: 0 14px; background: rgba(7,0,55,.58); color: var(--white); }
.result-form input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(242,28,50,.15); }
.result-form input::placeholder { color: rgba(185,195,230,.58); }
.result-form small { color: var(--muted); font-size: .72rem; }
.time-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.time-fieldset legend { margin-bottom: 10px; padding: 0; font-size: .74rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.time-fields { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: end; gap: 8px; }
.time-fields label { min-width: 0; }
.time-fields label > span { color: var(--muted); text-align: center; }
.time-fields input { padding: 0 8px; text-align: center; font-variant-numeric: tabular-nums; font-size: 1.08rem; font-weight: 850; }
.time-separator { padding-bottom: 12px; color: var(--red); font-size: 1.4rem; font-weight: 950; }
.submit-button { min-height: 52px; border: 0; border-radius: 7px; background: var(--red); color: var(--white); font-weight: 950; cursor: pointer; box-shadow: 0 13px 30px rgba(242,28,50,.25); }
.submit-button:hover { background: #ff3045; }
.submit-button:disabled { opacity: .65; cursor: wait; }
.form-status { margin: -4px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.edit-modal-layer { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; }
.edit-modal-backdrop { position: absolute; inset: 0; background: rgba(2,0,24,.78); backdrop-filter: blur(7px); }
.edit-modal { position: relative; z-index: 1; width: min(460px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 26px; border: 1px solid rgba(255,255,255,.2); border-radius: 13px; background: linear-gradient(180deg, #151d4a, #09043a); box-shadow: 0 34px 90px rgba(0,0,0,.6); }
.edit-result-form { margin-bottom: 0; }
.delete-button { min-height: 48px; border: 1px solid rgba(242,28,50,.55); border-radius: 7px; background: rgba(242,28,50,.08); color: #ff7582; font-weight: 900; cursor: pointer; }
.delete-button:hover { background: rgba(242,28,50,.16); }
.delete-button.is-armed { border-color: var(--red); background: var(--red); color: var(--white); box-shadow: 0 12px 26px rgba(242,28,50,.25); }
.delete-button:disabled { opacity: .6; cursor: wait; }
.drawer-board { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.055); }
.drawer-board-title { display: flex; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: .74rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.drawer-board .empty-state { padding: 34px 18px 40px; }
.drawer-board th, .drawer-board td { padding-left: 18px; padding-right: 18px; }

@media (max-width: 650px) {
  .site-header { width: min(100% - 30px, 1120px); padding: 17px 0; }
  .brand-lockup span { display: none; }
  .brand-lockup img { width: 44px; height: 44px; }
  .live-pill { font-size: .61rem; }
  .hero { width: calc(100% - 30px); margin: 38px auto 30px; }
  .hero h1 { font-size: clamp(3.45rem, 20vw, 5.7rem); line-height: .8; }
  .hero h1 em { -webkit-text-stroke-width: 1.5px; }
  .hero-copy { margin-top: 22px; font-size: .96rem; }
  .leaderboard-card { width: calc(100% - 30px); border-radius: 10px; }
  .card-heading { padding: 20px 18px; }
  .results-count { display: grid; justify-items: end; gap: 0; }
  .results-count strong { font-size: 1.5rem; }
  th { padding: 13px 16px; }
  th:first-child { width: 80px; }
  td { padding: 15px 16px; }
  .site-footer { width: calc(100% - 30px); padding-top: 25px; }
  .site-footer p:last-of-type { display: none; }
  .secret-admin-trigger { left: -15px; }
  .admin-drawer { inset: auto 0 0; width: 100%; max-height: 92dvh; padding: 16px 18px 28px; border-top: 1px solid var(--line); border-left: 0; border-radius: 16px 16px 0 0; transform: translateY(102%); }
  .admin-drawer.is-open { transform: translateY(0); }
  .drawer-handle { display: block; width: 38px; height: 4px; margin: 0 auto 18px; border-radius: 99px; background: rgba(255,255,255,.24); }
  .result-form { margin-top: 22px; padding: 18px; }
  .drawer-board th, .drawer-board td { padding-left: 13px; padding-right: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
