/* Laptimes by ObigRS – same look as the ObigRS 2027 trackday calendar. */
:root {
  --bg: #f4f3ef;
  --paper: #ffffff;
  --ink: #1b1c1f;
  --muted: #6b6d73;
  --line: #e3e1db;
  --red: #d2331f;
  --red-bg: #fbe7e3;
  --red-ink: #8a1d10;
  --green: #1c8a4a;
  --green-bg: #e2f3e8;
  --radius: 12px;
  --display: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --text: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(6px + var(--safe-t)) 14px 6px;
  /* Matches the carbon background of the original ObigRS dark logo. */
  background: #2e2d2d; color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-img { height: 52px; width: auto; display: block; }
.signin-logo { width: 220px; height: auto; display: block; margin: 0 0 18px -8px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .5px; text-transform: uppercase; font-stretch: condensed; }
.wordmark .rs { color: var(--red); }
.appname { font-family: var(--display); font-weight: 600; font-size: 18px; text-transform: uppercase; letter-spacing: 1px; opacity: .85; font-stretch: condensed; }
.env-badge { font: 700 11px var(--text); letter-spacing: 1px; background: #f2b705; color: var(--ink); padding: 3px 8px; border-radius: 999px; }

main { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); outline: none; }

/* ---------- headings ---------- */
.page-title { margin: 6px 0 16px; }
.page-title h1, .display, h2, h3 {
  font-family: var(--display); text-transform: uppercase; letter-spacing: .5px; font-stretch: condensed; margin: 0;
}
.page-title h1 { font-size: 34px; line-height: 1.05; font-weight: 700; }
.page-title p { margin: 2px 0 0; color: var(--muted); }
h3 { font-size: 21px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; margin: 2px 0; word-break: break-all; }

/* ---------- sign in ---------- */
.signin { padding-top: 3vh; }
.display { font-size: 52px; line-height: .98; font-weight: 700; }
.display .accent { color: var(--red); }
.lead { font-size: 18px; color: #3a3b40; margin: 16px 0 28px; max-width: 30ch; }
.signin-buttons { display: grid; gap: 12px; }
.signin-box { margin-top: 26px; padding: 18px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.signin-title { margin: 0 0 12px; font: 800 20px/1.2 var(--display); text-transform: uppercase; letter-spacing: .5px; }
.signin-note { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.signin-note .lock { font-size: 14px; line-height: 1.3; }
.header-right { display: flex; align-items: center; gap: 10px; }
.feedback-link { font: 700 13px var(--text); color: #fff; text-decoration: none; padding: 4px 10px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; }
.feedback-btn { margin-bottom: 14px; }
.btn.signin-btn { justify-content: flex-start; gap: 14px; padding: 15px 18px; background: var(--paper); border: 1px solid var(--line); font-weight: 600; }
.btn.signin-btn:active { background: #f7f6f2; }
.logo { width: 20px; height: 20px; flex: 0 0 20px; background-repeat: no-repeat; background-size: contain; }
.logo-google { background-image: url("../icons/google.svg"); }
.logo-microsoft { background-image: url("../icons/microsoft.svg"); }
.fineprint { color: var(--muted); font-size: 13px; margin-top: 22px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer; background: none;
}
.btn.block { width: 100%; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:active { background: #b52a18; }
.btn.ghost { background: var(--paper); border-color: var(--line); }
.btn.danger { background: var(--ink); color: #fff; }
.btn.danger-ghost { color: var(--red-ink); margin-top: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #2d6cdf; outline-offset: 2px; }

/* ---------- best laps ---------- */
.pb-list, .session-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pb-card {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--red);
  border-radius: var(--radius); padding: 14px 16px; text-decoration: none;
}
.pb-main { display: flex; flex-direction: column; min-width: 0; }
.pb-circuit { font-family: var(--display); font-weight: 700; font-size: 22px; text-transform: uppercase; line-height: 1.1; font-stretch: condensed; }
.pb-sub { color: var(--muted); font-size: 13px; }
.pb-time { text-align: right; display: flex; flex-direction: column; }
.time { font-family: var(--mono); font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.pb-date { color: var(--muted); font-size: 13px; }
.pb-meta { grid-column: 1 / -1; color: var(--muted); font-size: 12px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---------- best laps: hero, season, timing tower ---------- */
.best .hero {
  display: block; position: relative; overflow: hidden; border-radius: 16px; padding: 18px 18px 16px;
  color: #fff; text-decoration: none;
  background: radial-gradient(120% 140% at 100% 0%, #3a3838 0%, #232222 55%, #1b1a1a 100%);
}
.best .hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(210,51,31,.35), rgba(210,51,31,0) 70%); pointer-events: none; }
.kicker { font: 700 11px var(--text); letter-spacing: 1.6px; text-transform: uppercase; color: #ff6b55; }
.hero-row { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.track { width: 56px; height: 40px; flex: 0 0 auto; color: #fff; }
.track.no-layout { color: #8f8b84; }
.hero-track { width: 78px; height: 55px; }
.hero-row > div { min-width: 0; }
.hero-circuit { font-family: var(--display); font-weight: 700; font-size: 28px; text-transform: uppercase; line-height: 1.05; font-stretch: condensed; }
.hero-circuit.long { font-size: 21px; }
.hero-sub { color: #bdbab3; font-size: 13px; margin-top: 4px; }
.hero-time { font-family: var(--mono); font-weight: 700; font-size: 46px; letter-spacing: -1.5px; margin-top: 10px; line-height: 1; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; font-size: 13px; color: #d9d6cf; }
.welcome-title { font-size: 34px; margin-top: 8px; }
.welcome-title .accent { color: #ff6b55; }
.welcome-sub { font-size: 14px; margin-top: 10px; color: #d9d6cf; }
.hero-btn { margin-top: 16px; position: relative; z-index: 1; }
.chip { font: 700 12px var(--mono); padding: 3px 8px; border-radius: 999px; display: inline-block; }
.chip.gain { background: #123d22; color: #5fe08a; }
.chip.same { background: #2d2c2c; color: #a9a59d; }
.chip.pb { background: var(--red); color: #fff; font-family: var(--text); letter-spacing: .5px; animation: pb-pulse 1.8s ease-in-out infinite; }
@keyframes pb-pulse { 50% { box-shadow: 0 0 14px rgba(210,51,31,.75); } }
.season { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 20px; }
.season div { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px 8px; }
.season b { display: block; font: 700 26px var(--mono); line-height: 1.1; }
.season span { font-size: 12px; color: var(--muted); }
.section-h { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 2px 8px; }
.section-h h2 { font-size: 22px; margin: 0; }
.section-h span { font-size: 12px; color: var(--muted); }
.tower { background: #1d1c1c; border-radius: 16px; padding: 4px 6px; list-style: none; margin: 0; }
.tower li + li { border-top: 1px solid #2f2e2e; }
.tower-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 11px 6px; color: #fff; text-decoration: none; }
.t-name { min-width: 0; }
.circuit-name { font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.1; font-stretch: condensed; overflow-wrap: anywhere; }
.full { font-size: 12px; color: #a9a59d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.spark { display: block; margin-top: 5px; }
.spark-line { stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: #d9d6cf; }
.spark-dot.pb { fill: #5fe08a; }
.spark-dot.first { fill: #8f8b84; }
.t-time { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.t-time .time { color: #fff; font-size: 21px; }
.when { font-size: 11px; color: #8f8b84; }
.tower.ghost { opacity: .55; }
.credit { font-size: 11px; color: var(--muted); margin: 8px 2px 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.steps b { width: 30px; height: 30px; border-radius: 50%; background: #2e2d2d; color: #fff; display: grid; place-items: center; font: 700 15px var(--mono); }
.steps strong { display: block; font-size: 15px; }
.steps span { color: var(--muted); font-size: 13px; }
.steps .soon { display: block; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: var(--red-bg); color: var(--red-ink); font-size: 12px; }
.help-back { margin-top: 16px; }

/* PB celebration */
.pb-celebration { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: rgba(20,19,19,.98); opacity: 0; transition: opacity .25s; }
.pb-celebration.show { opacity: 1; }
.pb-celebration .flag { width: 220px; height: 120px; border-radius: 6px;
  background: conic-gradient(#fff 25%, #111 0 50%, #fff 0 75%, #111 0) 0 0 / 40px 40px;
  transform-origin: left center; animation: flag-wave 1.1s ease-in-out infinite alternate; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
@keyframes flag-wave { from { transform: perspective(400px) rotateY(-8deg) skewY(-3deg); } to { transform: perspective(400px) rotateY(8deg) skewY(3deg); } }
.pb-cel-text { text-align: center; color: #fff; display: flex; flex-direction: column; gap: 4px; }
.pb-cel-text strong { font-family: var(--display); font-size: 44px; text-transform: uppercase; color: #ff6b55; font-stretch: condensed; }
.pb-cel-text .time { font-size: 40px; }
@media (prefers-reduced-motion: reduce) { .chip.pb, .pb-celebration .flag { animation: none; } }

/* ---------- sessions ---------- */
.session-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; text-decoration: none;
}
.s-date { display: flex; flex-direction: column; align-items: center; line-height: 1.05; border-right: 1px solid var(--line); padding-right: 10px; }
.s-date .dm { font-family: var(--display); font-weight: 700; font-size: 19px; font-stretch: condensed; }
.s-date .y { font-size: 11px; color: var(--muted); }
.s-main { display: flex; flex-direction: column; min-width: 0; }
.s-circuit { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-time { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.s-time .time { font-size: 19px; }
.badge { font: 700 11px var(--text); letter-spacing: .5px; background: var(--red); color: #fff; border-radius: 999px; padding: 1px 8px; }
.gap { font: 12px var(--mono); color: var(--muted); }
.chip { display: inline-block; margin: -6px 0 14px; padding: 6px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 14px; text-decoration: none; }

/* ---------- form ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.label { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.field-error { color: var(--red-ink); font-size: 13px; min-height: 0; }
.field-error:empty { display: none; }
.field.invalid input, .field.invalid select { border-color: var(--red); background: #fff8f6; }
input[type="text"], input[type="email"], input[type="date"], select {
  width: 100%; min-height: 48px; padding: 11px 12px;
  border: 1px solid #d5d3cc; border-radius: 10px; background: var(--paper);
  font-size: 16px; /* 16px stops iOS zooming in */
  appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.lap-input { font-family: var(--mono); font-size: 18px; letter-spacing: .3px; }
.lap-input.best { font-size: 26px; font-weight: 700; min-height: 58px; border-width: 2px; border-color: var(--ink); max-width: 220px; }
.other-laps { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.lap-input::placeholder { color: #b9b7b0; font-weight: 400; }
.lap-rows { display: grid; gap: 8px; }
.lap-rows:empty { display: none; }
.lap-row { display: grid; grid-template-columns: minmax(0, 180px) 48px; gap: 8px; }
.btn.icon { min-height: 48px; padding: 0; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.btn.add-lap { justify-self: start; min-height: 42px; padding: 8px 14px; }
.optional { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px; }
.optional[open] { padding-bottom: 14px; }
.optional summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.optional .field { margin-top: 12px; }
.segmented { display: inline-flex; border: 1px solid #d5d3cc; border-radius: 10px; overflow: hidden; background: var(--paper); width: max-content; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmented span { display: block; padding: 10px 18px; min-width: 64px; text-align: center; border-left: 1px solid #d5d3cc; }
.segmented label:first-child span { border-left: none; }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid #2d6cdf; outline-offset: -3px; }

/* ---------- import ---------- */
.status { font: 700 11px var(--text); letter-spacing: .6px; text-transform: uppercase; background: #e0ded7; color: #55575c; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }

/* ---------- account ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.card p { margin: 2px 0; }
.stack { display: grid; gap: 10px; }
.delete-line { margin: 22px 2px 0; font-size: 14px; }
.link-danger { background: none; border: 0; padding: 0; color: var(--red); font-weight: 700; text-decoration: underline; cursor: pointer; font-size: 14px; }
.signups-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.signups-card .badge { margin-left: 8px; }
.signups-card.closed { border-color: #ecc8c1; background: #fdf3f1; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.btn.donate-btn {
  display: flex; width: 100%; justify-content: center; margin-top: 10px; min-height: 44px; padding: 8px 16px;
  border-radius: 999px; background: transparent; color: #fff; font-size: 14px; font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, .45);
}
.btn.donate-btn:active { background: rgba(255, 255, 255, .08); }
.pay-card h3 { margin: 4px 0 10px; }
.pay-qr { display: block; width: 220px; height: 220px; margin: 0 auto 18px; border-radius: 12px; background: #fff; }
.pay-qr.placeholder { display: grid; place-items: center; border: 2px dashed var(--line); color: var(--muted); font-weight: 700; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.pay-label { display: block; font-size: 12px; color: var(--muted); }
.pay-value { display: block; font: 600 16px var(--mono); word-break: break-all; }

/* ---------- support footer ---------- */
.support-footer {
  margin: 32px 0 8px; padding: 18px 16px; border-radius: var(--radius);
  background: #2e2d2d; color: #fff; text-align: center;
}
.support-footer p { margin: 0 0 12px; color: #e6e4de; font-size: 14px; }
.support-footer strong { color: #fff; }
.btn.insta {
  display: flex; width: 100%; justify-content: center; gap: 8px; min-height: 60px; padding: 10px 18px;
  border-radius: 999px; color: #fff; font-weight: 800; font-size: 16px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  background: linear-gradient(90deg, rgba(210, 51, 31, .92), rgba(210, 51, 31, .55)), url("../img/insta-ride.webp") center 45% / cover, var(--red);
  box-shadow: 0 4px 14px rgba(210, 51, 31, .35);
}
.btn.insta:active { background: linear-gradient(90deg, rgba(181, 42, 24, .95), rgba(181, 42, 24, .7)), url("../img/insta-ride.webp") center 45% / cover, #b52a18; }
.insta-at { font-weight: 800; font-size: 20px; line-height: 1; }

/* ---------- admin ---------- */
.admin-card { display: flex; justify-content: space-between; align-items: center; text-decoration: none; border-left: 4px solid var(--red); }
.uid code { font: 11px var(--mono); word-break: break-all; }
.access-group { margin: 18px 0; }
.access-group h3 { margin-bottom: 8px; font-size: 19px; }
.access-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.access-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.access-main { display: flex; flex-direction: column; min-width: 0; }
.access-email { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 0 1 auto; }
.btn.danger-text { color: var(--red-ink); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.tab { position: relative; }
.tab-badge { position: absolute; top: 6px; left: 52%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

.dashboard { margin: 10px 0 24px; }
.dashboard h3 { font-size: 18px; margin: 20px 0 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; }
.stat-n { font-family: var(--mono); font-weight: 700; font-size: 22px; }
.stat-label { font-size: 12px; color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; height: 120px; align-items: end; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 4px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; }
.bar { width: 100%; max-width: 26px; background: var(--red); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-n { font-size: 11px; font-weight: 600; }
.bar-label { font-size: 10px; color: var(--muted); }
.log-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.log-list li { display: flex; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 14px; }
.log-list li:first-child { border-top: none; }
.log-date { color: var(--muted); font-family: var(--mono); font-size: 12px; flex: 0 0 auto; padding-top: 2px; }

/* ---------- privacy page ---------- */
.prose { padding-bottom: 40px; }
.prose h2 { font-size: 22px; margin: 22px 0 6px; }
.prose p, .prose li { color: #2c2d31; }
.prose ul { padding-left: 20px; }

/* ---------- misc ---------- */
.empty { background: var(--paper); border: 1px dashed #d5d3cc; border-radius: var(--radius); padding: 28px 18px; text-align: center; }
.empty p { margin: 0 0 14px; color: var(--muted); }
.error { color: var(--red-ink); background: var(--red-bg); padding: 10px 12px; border-radius: 8px; }
.error:empty { display: none; }
.loading, .boot { padding: 30px 0; text-align: center; color: var(--muted); }
.fatal { max-width: 480px; margin: 18vh auto 0; padding: 0 20px; text-align: center; }
.fatal h1 { font-family: var(--display); text-transform: uppercase; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--paper); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--red); }
/* Add: raised round red button in the middle of the bar */
.tab-add-circle {
  display: grid; place-items: center; width: 52px; height: 52px; margin-top: -22px; border-radius: 50%;
  background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(210, 51, 31, .4); border: 3px solid var(--paper);
}
.tab-add-circle svg { width: 26px; height: 26px; stroke-width: 2.6; }
.tab-add:active .tab-add-circle { background: #b52a18; }
.tab-add.active { color: var(--red); }
.circuit-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 4px 0 16px; }

/* ---------- dialogs & toasts ---------- */
.dlg { border: none; border-radius: 16px; padding: 20px; width: min(420px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(0,0,0,.4); }
.dlg h3 { margin-bottom: 8px; }
.dlg .field { margin-top: 12px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.dlg-actions.stacked { flex-direction: column; align-items: stretch; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; transition: opacity .2s, transform .2s; z-index: 20; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red-ink); }

@media (min-width: 700px) {
  .display { font-size: 68px; }
  .tabbar { max-width: 640px; margin: 0 auto; border: 1px solid var(--line); border-bottom: none; border-radius: 14px 14px 0 0; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- printable report (Save as PDF) ---------- */
.report-actions { margin-bottom: 20px; }
.report-actions .btn { margin-top: 10px; }
.report-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.report-head img { width: 100px; height: auto; }
.report-head h1 { margin: 0; font: 800 28px/1.1 var(--display); text-transform: uppercase; }
.report-head p { margin: 4px 0 0; font-size: 13px; }
.report h2 { font: 800 20px var(--display); text-transform: uppercase; margin: 22px 0 8px; }
.report h3 { font: 800 16px var(--display); text-transform: uppercase; margin: 16px 0 6px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--paper); }
.report-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); padding: 6px 6px; }
.report-table td { border-bottom: 1px solid var(--line); padding: 6px; vertical-align: middle; }
.report-table .num { text-align: right; white-space: nowrap; }
.report-table .time { font: 700 14px var(--mono); }
.report-table .badge { margin-left: 6px; }
.report-table td.icon { width: 46px; }
.track.report-track { width: 40px; height: 28px; color: var(--ink); }
.report-table tr { break-inside: avoid; }
.report-table.sessions { table-layout: fixed; }
.report-table.sessions th:nth-child(1) { width: 22%; }
.report-table.sessions th:nth-child(2) { width: 22%; }
.report-table.sessions th:nth-child(3) { width: 32%; }
.report-circuit { break-inside: avoid-page; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .topbar, .tabbar, .support-footer, .no-print, .toast { display: none !important; }
  main { padding: 0 !important; max-width: none; }
  .report-table { background: none; }
  .report .page-break { break-before: page; }
  .report .badge { border: 1px solid currentColor; }
}

/* ---------- screenshot import ---------- */
.notice { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px; font-size: 14px; }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.file-input { display: block; width: 100%; padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--paper); }
.ocr-preview { display: block; max-width: 100%; max-height: 260px; margin-top: 10px; border-radius: 8px; border: 1px solid var(--line); object-fit: contain; }
.race-no { max-width: 120px; }
.ocr-status { margin: 12px 0; font-weight: 600; min-height: 1.4em; }
.ocr-laps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 16px; }
.ocr-lap { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.ocr-lap input { width: 20px; height: 20px; accent-color: var(--red); }
.ocr-lap .time { font: 700 16px var(--mono); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-pick { cursor: pointer; }
.file-row .file-name { font-size: 13px; overflow-wrap: anywhere; }
.visually-hidden:focus-visible + .file-row .file-pick { outline: 3px solid #2d6cdf; outline-offset: 2px; }
.ocr-best { display: flex; align-items: baseline; justify-content: space-between; background: #1f1f1f; color: #fff; border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 12px; }
.ocr-best .label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #ff7a66; font-weight: 700; }
.ocr-best .time { font: 700 30px var(--mono); }
.ocr-lap.best { border-color: var(--red); background: var(--red-bg); }
.ocr-lap .badge { margin-left: auto; }
.optional .ocr-laps { margin-top: 12px; }
.ocr-tick-row { display: flex; gap: 8px; margin-top: 12px; }
.signups-card { flex-direction: column; align-items: stretch; }
.signups-seg { width: 100%; display: flex; }
.signups-seg label { flex: 1; display: flex; }
.signups-seg span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px 6px; font-size: 13px; min-width: 0; }
.hero .btn.ghost.hero-btn-2 { margin-top: 10px; color: #fff; border: 1.5px solid rgba(255, 255, 255, .45); background: transparent; }
.step-links { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; }
.step-links .testing { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--red-bg); color: var(--red-ink); }
.install-card h3 { margin: 0 0 8px; }
.install-steps { margin: 0; padding-left: 20px; }
.install-steps li { margin: 6px 0; }

/* ---------- pull to refresh & update bar (installed app) ---------- */
.ptr { position: fixed; left: 50%; top: calc(var(--safe-t) + 70px); z-index: 20; margin-left: -80px; width: 160px; text-align: center;
  padding: 8px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; pointer-events: none; transition: opacity .1s; }
.update-bar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius); background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* ---------- Add: choice sheet ---------- */
.add-sheet {
  margin: auto auto 0; width: min(520px, 100vw); max-width: 100vw; border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px;
}
.add-sheet:not([open]) { display: none; }
.add-sheet h2 { font-family: var(--display); font-size: 26px; margin: 4px 0; }
.sheet-grab { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: #d6d3cc; }
.sheet-choice {
  display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: #faf9f6; color: var(--ink); text-decoration: none;
}
.sheet-choice:active { background: #f1efe9; }
.sheet-icon { flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--red-bg); color: var(--red); }
.sheet-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sheet-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.sheet-title { font-weight: 600; font-size: 16px; }
.sheet-sub { font-size: 13px; color: var(--muted); }
.sheet-choice .status { flex-shrink: 0; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #ecebe6; color: #4a4c52; }
.sheet-choice.disabled { border-style: dashed; background: #f4f3ef; }
.sheet-choice.disabled .sheet-title { color: #4a4c52; }
.sheet-choice.disabled .sheet-icon { background: #e8e6e0; color: #6b6d73; }

/* ---------- tyre pressure & notes ---------- */
.pressure-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.pressure { display: flex; flex-direction: column; gap: 4px; width: 84px; }
.pressure input { width: 100%; }
.segmented.small span { padding: 10px 12px; min-width: 48px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.field textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border: 1px solid #d5d3cc; border-radius: 10px; background: var(--paper); resize: vertical; }
.s-notes { color: var(--muted); font-size: 12px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
/* Info tab: support the race season (green button, red heart on a white dot so it stays visible) */
.btn.support-season { background: var(--green); color: #fff; gap: 10px; }
.btn.support-season:active { background: #166f3b; }
.support-season .heart { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--red); font-size: 15px; line-height: 1; }
.find-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.find-row input { flex: 1; min-width: 0; }
