/* Driver portal. Mobile first, light, no framework, no build step.
   Designed at 390 px wide first and allowed to grow to 760. Big tappable rows,
   tabular numbers everywhere a lap time appears, and nothing that needs a
   mouse. */

:root {
  color-scheme: light;
  --pink: #d81f26;
  --bg: #f6f6f7;
  --card: #fff;
  --line: #e6e6ea;
  --text: #17171a;
  --muted: #5b5b66;
  --dim: #807c88;
  --good: #1d9e56;
  --radius: 13px;
}

* { box-sizing: border-box; }

/* The app hides the tab bar and the sign out button with the `hidden` attribute
   while nobody is signed in. A class that sets `display` outranks the browser's
   own `[hidden] { display: none }`, so say it here and mean it: without this the
   sign in screen carries a full nav bar that leads nowhere. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }

.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px;
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 53px; z-index: 4; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fbfbfc;
}
.tabs a.on { background: var(--pink); border-color: var(--pink); color: #fff; }

h1 { font-size: 22px; line-height: 1.2; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 26px 0 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.dim { color: var(--dim); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 14px;
}
.card.tight { padding: 0; overflow: hidden; }

.level { display: flex; align-items: baseline; gap: 10px; }
.level strong { font-size: 25px; }
.bar { height: 8px; background: #f0eff2; border-radius: 99px; margin: 12px 0 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--pink); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }

.row {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  border-bottom: 1px solid #f0eff2; text-decoration: none; color: inherit;
}
.row:last-child { border-bottom: 0; }
.row .main { flex: 1 1 auto; min-width: 0; }
.row .main b { display: block; font-size: 15px; }
.row .main span { font-size: 13px; color: var(--muted); }
.row .time { font-variant-numeric: tabular-nums; font-weight: 700; }
.row .pos { width: 30px; color: var(--dim); font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid #f0eff2; font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); background: #fbfbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.you td { background: #fff5fa; font-weight: 600; }

label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; }
input, select {
  width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--text); margin: 0 0 12px;
}
input:focus, select:focus { outline: 2px solid var(--pink); outline-offset: 1px; }
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

button {
  font: inherit; font-weight: 600; border-radius: 9px; padding: 12px 17px;
  border: 1px solid transparent; background: var(--pink); color: #fff; cursor: pointer;
}
button.ghost { background: #fff; color: var(--muted); border-color: var(--line); }
button.link { background: none; border: 0; color: var(--muted); padding: 6px; font-weight: 600; }
button[disabled] { opacity: .55; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px;
  background: #f3f2f5; color: var(--muted); border: 1px solid var(--line);
}
.chip.on { background: var(--pink); color: #fff; border-color: var(--pink); }
.chip.gold { background: #fdf6e7; color: #9a7110; border-color: #efe0b8; }

.notice { border-left: 3px solid var(--pink); background: #fff5fa; padding: 12px 14px; border-radius: 9px; margin: 0 0 14px; font-size: 14px; }
.notice.warn { border-color: #d8303f; background: #fdf0f1; }
.ok { color: var(--good); font-weight: 600; }

.foot { padding-top: 0; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* The track photos and clips (Phase 5d, BACKLOG section 7).
 *
 * A plain responsive grid: two up on a phone, more on a desk, and every tile the same height so
 * a gallery of one sharp photo per session does not read as a jumble. The caption carries the
 * moment ("Ada on lap 11", "Closest finish") and, where it applies, the word Private, because a
 * driver who did not tick the photo box should be able to see at a glance that the track is not
 * using this one anywhere.
 */
.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}
.shot { margin: 0; }
.shot img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: var(--line);
  display: block;
}
.shot figcaption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.35;
}
.shot .clip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.shot .clip span { font-size: 13px; opacity: 0.7; font-weight: 400; }

/* Race again (Phase 5e, BACKLOG section 20). The card at the top of a session
   and the whole of the page the results email opens. It is deliberately the one
   loud thing on a page of lap times: it is an offer with a clock on it. */
.card.again { border: 1px solid var(--pink, #d81f26); }
.again-slots { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 12px 0 0; }
.again-go {
  display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line, #d8d8e0); background: var(--pink, #d81f26); color: #fff;
  font: inherit; cursor: pointer;
}
.again-go b { display: block; font-size: 16px; }
.again-go span { display: block; font-size: 14px; opacity: 0.85; margin-top: 2px; }
.again-go[disabled] { opacity: 0.6; cursor: default; }
.again-out:empty { display: none; }
