/* ============================================================
   Station Zero Scoring — app styles
   The design-system components from the Stepace kit, ported from the
   prototype's JSX to CSS classes so the app ships as static files with
   no React runtime. Values are taken from _ds_bundle.js verbatim.
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--sp-white);
  color: var(--sp-black);
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-md);
  -webkit-font-smoothing: antialiased;
}

/* The kit's global rule uppercases everything. Keep numerals and the few
   places where casing is data (an email, a raw key) legible by opting out. */
.no-caps,
.no-caps * { text-transform: none !important; }

button { font: inherit; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ------------------------------------------------------------
   Components — Button
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: auto;
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 12px 22px;
  font-size: var(--fs-sm);
  min-height: 44px;
  border: 2px solid var(--sp-black);
  background: var(--sp-black);
  color: var(--sp-white);
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--sm { padding: 8px 16px; font-size: var(--fs-xs); min-height: 34px; }
.btn--lg { padding: 16px 30px; font-size: var(--fs-md); min-height: 54px; }
.btn--full { width: 100%; }
.btn--pill { border-radius: var(--radius-pill); }

.btn--solid:hover:not(:disabled) { background: var(--sp-ink-soft); }

.btn--accent {
  background: var(--sp-orange);
  color: var(--sp-white);
  border-color: var(--sp-orange);
}
.btn--accent:hover:not(:disabled) {
  background: var(--sp-orange-deep);
  border-color: var(--sp-orange-deep);
}

.btn--outline {
  background: transparent;
  color: var(--sp-black);
  border-color: var(--sp-black);
}
.btn--outline:hover:not(:disabled) {
  background: var(--sp-black);
  color: var(--sp-white);
}

.btn--ghost {
  background: transparent;
  color: var(--sp-black);
  border-color: transparent;
}
.btn--ghost:hover:not(:disabled) { background: rgba(11, 11, 11, 0.06); }

.btn--inverse {
  background: var(--sp-white);
  color: var(--sp-black);
  border-color: var(--sp-white);
}
.btn--inverse:hover:not(:disabled) {
  background: var(--sp-paper-deep);
  border-color: var(--sp-paper-deep);
}

/* On the dark leaderboard the outline/ghost variants need reversed ink. */
.is-dark .btn--outline {
  color: var(--sp-white);
  border-color: var(--sp-white);
}
.is-dark .btn--outline:hover:not(:disabled) {
  background: var(--sp-white);
  color: var(--sp-black);
}
.is-dark .btn--ghost { color: var(--sp-white); }
.is-dark .btn--ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }

/* ------------------------------------------------------------
   Components — Tag
   ------------------------------------------------------------ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  line-height: 1;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sp-black);
  border: 1.5px solid var(--border-hairline);
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.tag:hover { background: var(--sp-paper-deep); }
.tag.is-active {
  background: var(--sp-black);
  color: var(--sp-white);
  border-color: var(--sp-black);
}
.tag--lg { padding: 10px 16px; font-size: var(--fs-sm); }

/* ------------------------------------------------------------
   Components — Eyebrow
   ------------------------------------------------------------ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  color: inherit;
}
.eyebrow--accent { color: var(--sp-orange); }
.eyebrow--rule::before {
  content: "";
  width: 1.8em;
  height: 2px;
  background: currentColor;
  display: inline-block;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------
   Components — Badge
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 4px 10px;
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  border-radius: var(--radius-pill);
  line-height: 1;
  background: var(--sp-black);
  color: var(--sp-white);
  border: none;
  white-space: nowrap;
}
.badge--accent { background: var(--sp-orange); color: var(--sp-white); }
.badge--paper { background: var(--sp-paper-deep); color: var(--sp-black); }
.badge--outline {
  background: transparent;
  color: var(--sp-black);
  border: 1.5px solid var(--sp-black);
}
.is-dark .badge--outline { color: var(--sp-white); border-color: var(--sp-white); }
.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------
   Components — Divider
   ------------------------------------------------------------ */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: none;
  margin: 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--sp-black);
}
.divider--rule::before,
.divider--rule::after { height: 2px; }
.divider__label {
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  color: var(--sp-black);
  white-space: nowrap;
}
.divider--bare::after { display: none; }
.divider--bare { gap: 0; }
.is-dark .divider::before,
.is-dark .divider::after { background: var(--sp-white); }
.is-dark .divider__label { color: var(--sp-white); }

/* ------------------------------------------------------------
   Components — Input
   ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  color: var(--sp-stone-500);
}
.field__input,
.field select {
  width: 100%;
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-md);
  color: var(--sp-black);
  background: transparent;
  padding: 12px 14px;
  border: 2px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.field__input:focus,
.field select:focus { border-color: var(--sp-orange); }
.field__hint {
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-xs);
  color: var(--sp-stone-400);
}
.field__hint--error { color: var(--sp-orange); }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; min-width: 0; }

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.screen--center {
  align-items: center;
  justify-content: flex-start;
  padding: 44px 24px 60px;
}
.screen--dark {
  background: var(--sp-black);
  color: var(--sp-white);
}
.pad { padding: 44px; }
.stack { display: flex; flex-direction: column; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 18px; }
.gap-4 { gap: 22px; }
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row--between { justify-content: space-between; }
.spacer { flex: 1; }
.w-420 { width: 100%; max-width: 420px; }
.w-480 { width: 100%; max-width: 480px; }
.w-520 { width: 100%; max-width: 520px; }
.w-960 { width: 100%; max-width: 960px; }
.w-1200 { width: 100%; max-width: 1200px; }

.display {
  font-family: var(--font-display);
  font-weight: var(--fw-heavy);
  text-transform: uppercase;
  letter-spacing: var(--ls-display);
  line-height: 1;
  margin: 0;
}
.display--xl { font-size: 40px; }
.display--lg { font-size: 34px; }
.display--md { font-size: 30px; }
.display--sm { font-size: 22px; }

.logistics {
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  color: var(--sp-stone-500);
}
.is-dark .logistics { color: var(--sp-stone-400); }
.micro {
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-eyebrow);
  color: var(--sp-stone-400);
}
.accent { color: var(--sp-orange); }
.muted { color: var(--sp-stone-400); }
.strong { font-weight: var(--fw-demi); color: var(--sp-black); }
.is-dark .strong { color: var(--sp-white); }

.card {
  border: 2px solid var(--sp-black);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
}
.card--hair {
  border: 1.5px solid var(--border-hairline);
  box-shadow: none;
  padding: 16px;
}
.card--accent { border-color: var(--sp-orange); }

.link {
  color: var(--sp-orange);
  cursor: pointer;
  text-decoration: none;
  font-weight: var(--fw-demi);
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  letter-spacing: var(--ls-caps);
}
.link:hover { color: var(--sp-orange-deep); }
.back {
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  color: var(--sp-stone-500);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}
.back:hover { color: var(--sp-black); }
.is-dark .back { color: var(--sp-stone-400); }
.is-dark .back:hover { color: var(--sp-white); }

/* ------------------------------------------------------------
   Brand header
   ------------------------------------------------------------ */
.brandbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-hairline);
  flex-wrap: wrap;
}
.is-dark .brandbar { border-color: var(--border-inverse); }
.brandbar__mark { height: 30px; width: auto; display: block; }
.brandbar__title {
  font-family: var(--font-display);
  font-weight: var(--fw-heavy);
  font-size: 18px;
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
}

/* ------------------------------------------------------------
   Lists / tables
   ------------------------------------------------------------ */
.lrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border-hairline);
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  text-align: left;
  width: 100%;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  color: inherit;
}
button.lrow { cursor: pointer; }
button.lrow:hover { background: var(--sp-paper-deep); }
.is-dark .lrow { border-color: rgba(255, 255, 255, 0.1); }
.is-dark button.lrow:hover { background: rgba(255, 255, 255, 0.06); }

.thead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 2px solid var(--sp-black);
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-2xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--sp-stone-400);
}
.is-dark .thead { border-color: rgba(255, 255, 255, 0.2); }

.col-rank { width: 70px; flex: 0 0 auto; }
.col-num { width: 44px; flex: 0 0 auto; }
.col-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-time { width: 110px; flex: 0 0 auto; text-align: right; }
.col-sm { width: 72px; flex: 0 0 auto; text-align: right; }
.col-xs { width: 56px; flex: 0 0 auto; text-align: right; }
.col-note { width: 170px; flex: 0 0 auto; text-align: right; }

.rank-num {
  font-family: var(--font-display);
  font-weight: var(--fw-heavy);
  font-size: 20px;
}
.rank-num--podium { color: var(--sp-orange); }

/* ------------------------------------------------------------
   Leaderboard (big screen)
   ------------------------------------------------------------ */
.board { padding: 48px; gap: 22px; display: flex; flex-direction: column; }
.board .display--xl { font-size: clamp(28px, 5vw, 48px); }
.board__row .col-name { font-weight: var(--fw-demi); font-size: var(--fs-md); }
.board__row .col-time { font-size: var(--fs-md); }

/* ------------------------------------------------------------
   Station input (tablet)
   ------------------------------------------------------------ */
.stopwatch {
  font-family: var(--font-display);
  font-weight: var(--fw-heavy);
  font-size: clamp(44px, 12vw, 58px);
  letter-spacing: var(--ls-tight);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.station-grid .tag { justify-content: flex-start; }
.tag.is-done {
  border-color: var(--sp-orange);
  color: var(--sp-orange);
}
.tag.is-done.is-active {
  background: var(--sp-orange);
  border-color: var(--sp-orange);
  color: var(--sp-white);
}

/* ------------------------------------------------------------
   Insight panels
   ------------------------------------------------------------ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 18px;
}
.stat__num {
  font-family: var(--font-display);
  font-weight: var(--fw-heavy);
  font-size: 28px;
  line-height: 1;
}
.locked-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
.locked-grid > div,
.rules-list > div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------
   Share card
   ------------------------------------------------------------ */
.sharecard {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
  border: 1.5px solid var(--border-hairline);
  border-radius: var(--radius-md);
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--sp-black);
  color: var(--sp-white);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  z-index: 50;
  max-width: min(92vw, 520px);
  text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--sp-orange); }

/* ------------------------------------------------------------
   Spinner / empty
   ------------------------------------------------------------ */
.loading {
  padding: 60px 24px;
  text-align: center;
  font-family: var(--font-body);
  font-weight: var(--fw-demi);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--sp-stone-400);
}
.empty {
  padding: 28px 4px;
  font-size: var(--fs-sm);
  color: var(--sp-stone-400);
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  .pad { padding: 24px 18px 40px; }
  .board { padding: 24px 18px 40px; }
  .two-col,
  .locked-grid { grid-template-columns: 1fr; }
  .col-note { display: none; }
  .col-time { width: 84px; }
  .col-rank { width: 44px; }
  .rank-num { font-size: 16px; }
  .display--xl { font-size: 28px; }
  .display--lg { font-size: 26px; }
  .display--md { font-size: 24px; }
  .brandbar { padding: 14px 18px; }
}

@media (max-width: 560px) {
  .field-row { flex-direction: column; }
  .col-sm { width: 58px; }
  .col-xs { width: 46px; }
  .st-eff { display: none; }
}
