/* SKT Scrutineering — shared theme (BTTiming brand)
   Default = DAY (light). Dark via <html data-theme="dark">. */
:root {
  --amber: #ff9e0d;
  --hot: #ff6a18;
  --bg: #f4f6f9;
  --bg-2: #ffffff;
  --bg-3: #eef1f5;
  --line: #dde3ea;
  --ink: #16202a;
  --muted: #667585;
  --pass: #16a34a;
  --pass-dim: #e4f7ec;
  --fail: #e5342b;
  --fail-dim: #fdeceb;
  --warn: #d98a00;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 30, 45, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai",
    "Sarabun", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --amber: #ffb020;
  --hot: #ff6a18;
  --bg: #0e1318;
  --bg-2: #141b22;
  --bg-3: #1b242d;
  --line: #26323d;
  --ink: #eef2f6;
  --muted: #8b9aa8;
  --pass: #17c964;
  --pass-dim: #0d3d24;
  --fail: #ff3b3b;
  --fail-dim: #421414;
  --warn: #ffb020;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(255, 106, 24, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255, 158, 13, .10), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; }
button { font-family: inherit; }

/* icons */
.i { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; }
.brand .dot {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--amber), var(--hot));
  box-shadow: 0 4px 14px rgba(255, 106, 24, .4);
  display: grid; place-items: center; color: #fff;
}
.brand .logo { height: 30px; width: auto; display: block; border-radius: 4px; }
:root[data-theme="dark"] .brand .logo { background:#fff; padding:2px 4px; }
.brand small { color: var(--muted); font-weight: 600; }
.spacer { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2);
  font-size: 13px; color: var(--muted);
}
.chip .live { width: 8px; height: 8px; border-radius: 50%; background: var(--pass); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(22,163,74,.5)} 70%{box-shadow:0 0 0 8px rgba(22,163,74,0)} 100%{box-shadow:0 0 0 0 rgba(22,163,74,0)} }

.nav { display: flex; gap: 6px; }
.nav a {
  text-decoration: none; padding: 7px 13px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
}
.nav a:hover { color: var(--ink); background: var(--bg-3); }
.nav a.active { color: var(--ink); background: var(--bg-3); border-color: var(--line); }

/* theme toggle */
.tgl { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); cursor: pointer; }
.tgl:hover { color: var(--ink); }
.tgl .sun { display: block; } .tgl .moon { display: none; }
:root[data-theme="dark"] .tgl .sun { display: none; }
:root[data-theme="dark"] .tgl .moon { display: block; }

/* ---- buttons ---- */
.btn {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink);
  padding: 10px 16px; border-radius: 11px; font-weight: 700; cursor: pointer;
  font-size: 15px; transition: .12s; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn:hover { border-color: #b9c3ce; }
:root[data-theme="dark"] .btn:hover { border-color: #354553; }
.btn.primary {
  background: linear-gradient(135deg, var(--amber), var(--hot));
  color: #fff; border: none; box-shadow: 0 6px 18px rgba(255, 106, 24, .3);
}
.btn.ghost { background: transparent; }
.btn.lg { padding: 14px 22px; font-size: 17px; }
.btn.block { width: 100%; }

.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }

/* ---- tire cells ---- */
.tire {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-3);
}
.tire .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px; letter-spacing: .5px; }
.tire.ok { border-color: rgba(22,163,74,.45); background: linear-gradient(90deg, var(--pass-dim), var(--bg-2)); }
.tire.bad { border-color: rgba(229,52,43,.5); background: linear-gradient(90deg, var(--fail-dim), var(--bg-2)); }
.tire .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.tire.ok .ic { background: var(--pass); }
.tire.bad .ic { background: var(--fail); }
.tire .pos { font-size: 12px; color: var(--muted); font-weight: 700; }

/* driver photo */
.dphoto { object-fit: cover; background: var(--bg-3); }

/* clickable racer name -> photo card */
.nmlink { cursor: pointer; }
.nmlink:hover { color: var(--amber); text-decoration: underline; }
.cntbadge { display:inline-grid; place-items:center; min-width:20px; height:20px; padding:0 5px; border-radius:6px; background:rgba(255,158,13,.14); border:1px solid var(--amber); color:var(--warn); font-size:11px; font-weight:800; }
