/* Layout: timing-sheet column — title, track picker, direction switch, podium strip, full results table; editor bar pinned to the bottom */
:root {
  --bg: #eef0ee;
  --surface: #ffffff;
  --ink: #16201c;
  --muted: #5d6a64;
  --line: #d3d9d5;
  --accent: #d9480f;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --gold: #b8860b; --silver: #7d8a92; --bronze: #a0522d;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", system-ui, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111715; --surface: #19211e; --ink: #e7ece9; --muted: #92a199; --line: #2b3632;
    --accent: #ff7a3d; --accent-ink: #160b04; --danger: #ff8a7a;
    --gold: #e0b33c; --silver: #b4c0c7; --bronze: #d38a5c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111715; --surface: #19211e; --ink: #e7ece9; --muted: #92a199; --line: #2b3632;
  --accent: #ff7a3d; --accent-ink: #160b04; --danger: #ff8a7a;
  --gold: #e0b33c; --silver: #b4c0c7; --bronze: #d38a5c;
  color-scheme: dark;
}
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
.wrap {
  max-width: 880px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px 120px;
  display: grid; gap: 24px;
}
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; }
.top > div { display: grid; gap: 6px; min-width: 0; }
.eyebrow, .label { font-family: var(--font-data); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1 {
  font-family: var(--font-display); font-weight: 800; font-style: italic;
  font-size: clamp(2.4rem, 8vw, 4.2rem); line-height: .9; margin: 0;
  text-transform: uppercase; letter-spacing: -.01em; text-wrap: balance;
}
h1 span { color: var(--accent); }
h2 { font: 800 italic clamp(1.8rem, 5vw, 2.4rem)/1 var(--font-display); text-transform: uppercase; margin: 0; text-wrap: balance; }
.sub { color: var(--muted); }

button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn {
  font: 600 .9rem/1 var(--font-body); padding: 10px 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn.small { padding: 6px 9px; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: default; }

.tracks { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.track-tab {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 10px 14px; text-align: left; display: grid; gap: 2px; flex: 0 0 auto;
}
.track-tab strong { font: 800 1.05rem/1.1 var(--font-display); text-transform: uppercase; }
.track-tab small { font-family: var(--font-data); font-size: 11px; color: var(--muted); }
.track-tab[aria-selected="true"] { border-color: var(--ink); box-shadow: inset 0 -4px 0 var(--accent); }
.track-tab.add { border-style: dashed; color: var(--muted); display: flex; align-items: center; }

.track-head { display: grid; gap: 4px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
.field { display: grid; gap: 4px; min-width: 0; }
.field input {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box;
}

.board-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.switch { display: flex; flex-wrap: wrap; border: 2px solid var(--ink); width: fit-content; max-width: 100%; }
.switch button {
  font: 800 1.1rem/1 var(--font-display); text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 20px; border: 0; background: transparent; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.switch button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.switch svg { width: 16px; height: 16px; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.step { background: var(--surface); border: 1px solid var(--line); padding: 14px 14px 12px; display: grid; gap: 2px; min-width: 0; }
.step.p1 { border-top: 5px solid var(--gold); padding-top: 22px; order: 2; }
.step.p2 { border-top: 5px solid var(--silver); order: 1; }
.step.p3 { border-top: 5px solid var(--bronze); order: 3; }
.step .pos { font: 800 italic 2rem/1 var(--font-display); }
.step.p1 .pos { color: var(--gold); } .step.p2 .pos { color: var(--silver); } .step.p3 .pos { color: var(--bronze); }
.step .name { font: 800 1.35rem/1.1 var(--font-display); text-transform: uppercase; overflow-wrap: anywhere; }
.step .car { color: var(--muted); font-size: .9rem; }
.step .time { font: 700 1.25rem/1.2 var(--font-data); font-variant-numeric: tabular-nums; margin-top: 6px; }
.step .gap { font: 500 .8rem var(--font-data); color: var(--muted); }

.panel { background: var(--surface); border: 1px dashed var(--accent); padding: 14px; display: grid; gap: 10px; }
.panel .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.msg { color: var(--danger); font-size: .9rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.toolbar input {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: min(100%, 280px);
}
.count { font-family: var(--font-data); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.table-box { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th { font: 600 11px var(--font-data); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--ink); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.editing-row td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.num { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.rank { font: 800 italic 1.3rem/1 var(--font-display); width: 3ch; }
tr.r1 td.rank { color: var(--gold); } tr.r2 td.rank { color: var(--silver); } tr.r3 td.rank { color: var(--bronze); }
td.driver strong { font: 800 1.1rem/1.1 var(--font-display); text-transform: uppercase; }
td.driver span { display: block; color: var(--muted); font-size: .88rem; }
td.time { font-weight: 700; }
td.gap { color: var(--muted); font-size: .85rem; }
td.acts { text-align: right; white-space: nowrap; }
td.acts .btn + .btn { margin-left: 6px; }
.bar { height: 4px; background: var(--line); margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.unknown { color: var(--muted); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
footer { color: var(--muted); font-size: .85rem; }

.editbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--ink); color: var(--bg);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
.editbar .in { max-width: 880px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.editbar .status { font-family: var(--font-data); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.editbar .status b { color: var(--accent); }
.editbar .row { display: flex; gap: 8px; flex-wrap: wrap; }
.editbar .btn { border-color: transparent; }

@media (max-width: 560px) {
  .podium { grid-template-columns: 1fr; }
  .step.p1, .step.p2, .step.p3 { order: 0; }
  .step.p1 { padding-top: 14px; }
  .switch button { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Base reset for the standalone site */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
[hidden] { display: none !important; }

/* Owner sign-in */
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font-size: .85rem; }
.login { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.login input { font: inherit; padding: 9px 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: min(100%, 240px); }
.notice { color: var(--muted); font-size: .9rem; }

/* Site header */
.site { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.brand { font: 800 italic 1.4rem/1 var(--font-display); text-transform: uppercase; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.brand span { color: var(--accent); }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a { font: 600 .95rem/1 var(--font-body); color: var(--muted); text-decoration: none; padding: 8px 10px; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
a { color: inherit; }
a.step { text-decoration: none; color: inherit; }
a.step:hover { border-color: var(--ink); }
td.driver a { text-decoration: none; display: block; }
td.driver a:hover strong { color: var(--accent); }
.notice a, .empty a { color: var(--accent); }

/* Garage */
.garage { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.car-card { background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; display: grid; min-width: 0; }
.car-card:hover { border-color: var(--ink); }
.car-card .thumb { aspect-ratio: 3 / 2; max-width: 100%; background: var(--line); overflow: hidden; display: grid; place-items: center; }
.car-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-card .thumb span { font: 800 italic 2rem/1 var(--font-display); text-transform: uppercase; color: var(--muted); padding: 0 12px; text-align: center; overflow-wrap: anywhere; }
.car-card-body { padding: 12px 14px 14px; display: grid; gap: 2px; }
.car-card-body strong { font: 800 1.3rem/1.1 var(--font-display); text-transform: uppercase; }
.car-card-body span { color: var(--muted); }
.car-card-body small { font: 500 11px var(--font-data); color: var(--muted); margin-top: 6px; }

/* Car page */
.back { color: var(--muted); text-decoration: none; font-weight: 600; width: fit-content; }
.back:hover { color: var(--ink); }
.car-hero { display: grid; gap: 6px; }
.specs { display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--font-data); font-size: .9rem; color: var(--muted); }
.specs b { color: var(--ink); }
.gallery { display: grid; gap: 10px; }
.main-photo { background: var(--line); aspect-ratio: 16 / 10; max-width: 100%; overflow: hidden; }
.main-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb-wrap { display: grid; gap: 6px; flex: 0 0 auto; }
.thumb-btn { padding: 0; border: 2px solid transparent; background: none; width: 120px; aspect-ratio: 3 / 2; overflow: hidden; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-btn[aria-pressed="true"] { border-color: var(--accent); }
.thumb-acts { display: flex; gap: 4px; flex-wrap: wrap; max-width: 120px; }
.no-photo { aspect-ratio: 16 / 6; max-width: 100%; background: var(--surface); border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-family: var(--font-data); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.car-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.car-cols .col { display: grid; gap: 18px; min-width: 0; }
h3 { font: 800 1.3rem/1 var(--font-display); text-transform: uppercase; margin: 0 0 10px; }
.about p { margin: 0; max-width: 65ch; }
.mods { display: grid; gap: 12px; }
.mod-group ul { margin: 4px 0 0; padding-left: 18px; }
.mod-group li { padding: 2px 0; }
.mod-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: center; }
.mod-edit input, .field textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; min-width: 0; }
table.compact { min-width: 0; }
.sub-line { display: block; color: var(--muted); font-size: .8rem; font-family: var(--font-body); }
.times td a { font-weight: 600; text-decoration: none; }
.times td a:hover { color: var(--accent); }
b.p1 { color: var(--gold); } b.p2 { color: var(--silver); } b.p3 { color: var(--bronze); }

@media (max-width: 700px) {
  .car-cols { grid-template-columns: 1fr; }
  .mod-edit { grid-template-columns: 1fr; }
}

/* Teams */
.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.team-card { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--accent); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.team-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.team-head > div:last-child { min-width: 0; }
.team-head h2 { font-size: 1.7rem; overflow-wrap: anywhere; }
.team-logo { width: 64px; height: 64px; flex: 0 0 auto; background: var(--line); display: grid; place-items: center; overflow: hidden; }
.team-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.team-logo span { font: 800 italic 1.6rem/1 var(--font-display); text-transform: uppercase; color: var(--muted); }
.team-about { margin: 0; color: var(--muted); }
.members { list-style: none; margin: 0; padding: 0; display: grid; }
.members li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.members strong { font: 800 1.1rem/1.1 var(--font-display); text-transform: uppercase; margin-right: auto; }
.members a { text-decoration: none; color: var(--muted); font-size: .9rem; }
.members a:hover { color: var(--accent); }
.members small { font-family: var(--font-data); font-size: 11px; }
.team-edit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.member-edit { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.member-edit li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.car-hero .eyebrow a { color: var(--accent); text-decoration: none; }

/* 3D models */
canvas.model-view { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .4s; }
canvas.model-view.ready { opacity: 1; }
.car-card .thumb.has-model, .model-stage { background: radial-gradient(ellipse at 50% 60%, var(--surface) 0%, var(--bg) 75%); }
.model-stage { aspect-ratio: 16 / 9; max-width: 100%; border: 1px solid var(--line); }
.model-stage { position: relative; margin: 0; }
.model-stage canvas.model-view[data-interactive="1"] { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.model-stage canvas.model-view.grabbing { cursor: grabbing; }
.model-stage figcaption { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; pointer-events: none; font-family: var(--font-data); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Accounts */
.head-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-acts a.btn { text-decoration: none; }
.badge { display: inline-block; min-width: 18px; padding: 1px 5px; margin-left: 4px; background: var(--accent); color: var(--accent-ink); font: 700 11px/16px var(--font-data); text-align: center; }
.box { background: var(--surface); border: 1px solid var(--line); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.box h3 { margin: 0; }
.box p { margin: 0; }
.flash { border-left: 4px solid var(--accent); background: var(--surface); padding: 12px 14px; }
.login-box { max-width: 420px; }
.login-box input, .box select, .login select { font: inherit; padding: 9px 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.avatar { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; background: var(--line); display: grid; place-items: center; }
.avatar.big { width: 96px; height: 96px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar span { font: 800 italic 1.5rem/1 var(--font-display); text-transform: uppercase; color: var(--muted); }
.avatar.big span { font-size: 2.2rem; }
.driver-hero { display: flex; gap: 16px; align-items: center; min-width: 0; }
.driver-hero > div:last-child { display: grid; gap: 4px; min-width: 0; }
.driver-hero h1 { overflow-wrap: anywhere; }
.eyebrow a, .insta { color: var(--accent); text-decoration: none; }
.car-hero .eyebrow a { color: var(--accent); }
.members strong a { text-decoration: none; }
.members strong a:hover { color: var(--accent); }
.subs { list-style: none; margin: 0; padding: 0; display: grid; }
.subs li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.subs li .notice { flex-basis: 100%; }
.subs small { color: var(--muted); font-family: var(--font-data); font-size: 11px; }
.status { font: 600 11px var(--font-data); text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border: 1px solid currentColor; }
.status.pending { color: var(--gold); }
.status.approved { color: var(--accent); }
.status.rejected { color: var(--danger); }
.review { border: 1px solid var(--line); padding: 12px; display: grid; gap: 10px; }
.review-head small { color: var(--muted); font-family: var(--font-data); font-size: 11px; margin-left: 6px; }
.change { display: grid; gap: 6px; }
.change > .label a { color: var(--ink); }
.diff-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; font-size: .92rem; overflow-wrap: anywhere; }
del { color: var(--muted); }
ins { text-decoration: none; background: color-mix(in srgb, var(--accent) 14%, transparent); }
img.mini { width: 72px; height: 48px; object-fit: cover; vertical-align: middle; margin: 2px 4px 2px 0; border: 1px solid var(--line); }
table.accounts { min-width: 640px; }
table.accounts input[type="text"], table.accounts input:not([type]) { font: inherit; padding: 6px 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; min-width: 120px; }
@media (max-width: 560px) {
  .diff-row { grid-template-columns: 1fr; gap: 2px; }
}
.field select, table.accounts select { font: inherit; padding: 9px 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; min-width: 0; }
table.accounts select { padding: 6px 8px; min-width: 180px; }
.field.wide { grid-column: 1 / -1; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.login-box select { max-width: 100%; }

/* Comments */
.comments { display: grid; gap: 12px; }
.comments h3 { margin: 0; }
.comment-form { display: grid; gap: 8px; max-width: 640px; }
.comment-form input, .comment-form textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; }
.comment-form .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.comment-list { list-style: none; margin: 0; padding: 0; display: grid; }
.comment-list li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.comment-list p { margin: 0; overflow-wrap: anywhere; }
.c-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.c-head a { color: var(--ink); text-decoration: none; }
.c-head a:hover { color: var(--accent); }
.c-head small { color: var(--muted); font-family: var(--font-data); font-size: 11px; }
.status.member { color: var(--muted); }
.linkish.armed-text { color: var(--danger); }

/* Team page */
.team-hero { display: flex; gap: 18px; align-items: center; min-width: 0; }
.team-hero > div:last-child { display: grid; gap: 6px; min-width: 0; }
.team-hero h1 { overflow-wrap: anywhere; }
.team-logo.big { width: 112px; height: 112px; }
.team-logo.big span { font-size: 2.6rem; }
.team-card h2 a { color: inherit; text-decoration: none; }
.team-card h2 a:hover { color: var(--accent); }
.team-card .sub a { color: var(--accent); text-decoration: none; }
.driver-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.driver-chip { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; min-width: 0; }
.driver-chip .avatar { width: 48px; height: 48px; }
.driver-chip .avatar span { font-size: 1.1rem; }
.driver-chip > div:last-child { display: grid; gap: 2px; min-width: 0; }
.driver-chip strong { font: 800 1.15rem/1.1 var(--font-display); text-transform: uppercase; overflow-wrap: anywhere; }
.driver-chip strong a { text-decoration: none; }
.driver-chip strong a:hover { color: var(--accent); }
.driver-chip small { color: var(--muted); font-family: var(--font-data); font-size: 11px; }
@media (max-width: 560px) { .team-logo.big { width: 80px; height: 80px; } }

/* Rankings: separate driver and car links */
td.driver a + a { margin-top: 1px; }
td.driver a:hover span { color: var(--accent); }

/* Photos always fill their frame, cropped evenly around the middle, whatever shape they were taken in */
.car-card .thumb, .main-photo, .thumb-btn { position: relative; overflow: hidden; min-height: 0; }
.car-card .thumb img, .main-photo img, .thumb-btn img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.team-logo img, .avatar img, img.mini { object-fit: cover; object-position: center; }

.subs li .row { display: inline-flex; gap: 6px; margin-left: auto; }

/* 3D course maps (80s arcade style) */
.course-map-box { display: grid; gap: 6px; }
.course-map { position: relative; }
.c3d { position: relative; aspect-ratio: 16 / 9; max-height: 70vh; width: 100%; overflow: hidden; background: #05010f; border: 2px solid #7a1cff; box-shadow: 0 0 0 1px #000, 0 0 24px rgba(122, 28, 255, .35); }
.c3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; touch-action: none; cursor: grab; }
.c3d-canvas:active { cursor: grabbing; }
.c3d-labels, .c3d-hud { position: absolute; inset: 0; pointer-events: none; font-family: "Press Start 2P", ui-monospace, monospace; }
.c3d-label { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 9px; letter-spacing: .04em; color: #fff; background: #c4002f; border: 2px solid #ff5c7a; padding: 4px 6px; box-shadow: 0 0 10px rgba(255, 42, 74, .7); }
.c3d-label.section { background: transparent; border: 0; box-shadow: none; color: #5dff3a; font-size: 16px; text-shadow: 0 0 6px #5dff3a; padding: 0; }
.c3d-title { position: absolute; left: 12px; top: 12px; background: rgba(5, 1, 15, .78); border: 2px solid #27e8ff; box-shadow: 0 0 12px rgba(39, 232, 255, .45); padding: 10px 12px; color: #fff; display: grid; gap: 6px; max-width: min(46%, 300px); }
.c3d-sub { font-size: 8px; color: #27e8ff; }
.c3d-name { font-size: clamp(13px, 2.4vw, 20px); color: #ff2bd6; text-shadow: 0 0 8px #ff2bd6; line-height: 1.2; overflow-wrap: anywhere; }
.c3d-lay { font-size: 9px; color: #5dff3a; text-shadow: 0 0 6px #5dff3a; }
.c3d-stats { display: grid; gap: 3px; font-size: 8px; margin-top: 2px; }
.c3d-stats div { display: flex; justify-content: space-between; gap: 14px; }
.c3d-stats span:first-child { color: #ffd23f; }
.c3d-compass { position: absolute; right: 14px; top: 14px; width: 54px; height: 54px; overflow: visible; }
.c3d-compass circle { fill: rgba(5, 1, 15, .7); stroke: #27e8ff; stroke-width: 1.5; }
.c3d-compass .n { fill: #ff2a4a; } .c3d-compass .s { fill: #fff; }
.c3d-compass text { fill: #ffd23f; font-size: 7px; text-anchor: middle; font-family: "Press Start 2P", monospace; }
.c3d-profile { position: absolute; left: 12px; right: 12px; bottom: 26px; width: calc(100% - 24px); height: 15%; min-height: 44px; background: rgba(5, 1, 15, .6); border: 1px solid rgba(93, 255, 58, .5); }
.c3d-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 8px; color: #ffd23f; animation: c3dblink 1.2s steps(2) infinite; }
.c3d.touched .c3d-hint { display: none; }
.c3d-credit { position: absolute; right: 8px; bottom: 8px; font: 9px var(--font-body); color: rgba(255, 255, 255, .55); }
.c3d-scan { position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px); box-shadow: inset 0 0 90px rgba(0, 0, 0, .75); }
@keyframes c3dblink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .c3d-hint { animation: none; } }
@media (max-width: 560px) {
  .c3d { aspect-ratio: 4 / 5; }
  .c3d-title { max-width: 62%; padding: 8px; }
  .c3d-compass { width: 40px; height: 40px; }
}
.map-picker { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }

/* "New version" bar */
.new-version { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20;
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: center; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); border-left: 4px solid var(--accent); }
.new-version .btn:not(.primary) { background: transparent; color: var(--bg); border-color: transparent; }

.track-tab.hidden-track { border-style: dashed; opacity: .8; }
.track-tab.hidden-track small { color: var(--accent); }

/* Replaying a time on the map */
.play-run { font: 700 11px/1 var(--font-data); width: 26px; height: 22px; margin-right: 8px; vertical-align: middle; border: 1px solid var(--line); background: var(--surface); color: var(--accent); cursor: pointer; }
.play-run:hover { border-color: var(--accent); }
.play-run.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.c3d-timer { position: absolute; right: 12px; top: 78px; display: grid; gap: 5px; justify-items: end; text-align: right; background: rgba(5, 1, 15, .78); border: 2px solid #5dff3a; box-shadow: 0 0 12px rgba(93, 255, 58, .4); padding: 8px 10px; font-size: 9px; color: #fff; max-width: 52%; }
.c3d-timer b { color: #5dff3a; font-weight: normal; text-shadow: 0 0 6px #5dff3a; overflow-wrap: anywhere; }
.c3d-timer span { color: #fff; }
.c3d-timer .g { color: #27e8ff; }
.c3d-timer .fin { color: #ffd23f; animation: c3dblink 1s steps(2) infinite; }
.c3d-label.runner { background: #0b3d00; border-color: #5dff3a; box-shadow: 0 0 10px rgba(93, 255, 58, .7); }
.c3d-label.ghost { background: #002f3d; border-color: #27e8ff; box-shadow: 0 0 10px rgba(39, 232, 255, .6); }
@media (max-width: 560px) { .c3d-timer { top: auto; bottom: calc(15% + 34px); right: 8px; font-size: 8px; } }

/* Racing several times on the map */
.compare-bar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.play-run.on { color: #05010f; }
.c3d-timer { gap: 4px; min-width: 190px; }
.c3d-clock { font-size: 14px; color: #ffd23f; text-shadow: 0 0 6px #ffd23f; justify-self: end; }
.c3d-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; width: 100%; text-align: left; }
.c3d-row i { width: 8px; height: 8px; display: block; }
.c3d-row b { font-weight: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c3d-row .gap { color: #27e8ff; min-width: 6ch; text-align: right; }
.c3d-row.fin span:not(.gap) { color: #ffd23f; }
.c3d-label.racer { background: rgba(5, 1, 15, .85); border-width: 2px; border-style: solid; }
