/* Racer Tracker — web console styles. Single sheet, no build step. */

:root {
    --bg: #0f1419;
    --panel: #1a212b;
    --panel-2: #222c38;
    --ink: #e7edf3;
    --muted: #8a99a8;
    --line: #2c3744;
    --accent: #ff6b35;
    --accent-ink: #fff;
    --ok: #2ecc71;
    --warn: #f1c40f;
    --bad: #e74c3c;
    --live: #ff4d4d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: radial-gradient(1200px 600px at 70% -10%, #1c2733 0%, var(--bg) 60%);
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Top bar */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 22px; border-bottom: 1px solid var(--line);
    background: rgba(15, 20, 25, 0.7); position: sticky; top: 0; backdrop-filter: blur(6px); z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); margin-right: 4px; }
.topnav { display: flex; gap: 18px; align-items: center; }
.topnav a { color: var(--muted); font-weight: 500; }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav a.ghost { color: var(--accent); }

.wrap { max-width: 960px; margin: 0 auto; padding: 28px 22px 60px; }

/* Flash */
.flash { padding: 11px 14px; border-radius: 9px; margin: 0 0 16px; border: 1px solid var(--line); }
.flash-success { background: rgba(46, 204, 113, 0.12); border-color: rgba(46, 204, 113, 0.4); }
.flash-error { background: rgba(231, 76, 60, 0.12); border-color: rgba(231, 76, 60, 0.4); }
.flash-info { background: rgba(255, 107, 53, 0.1); border-color: rgba(255, 107, 53, 0.35); }

/* Cards */
.card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 14px; padding: 24px; margin-bottom: 20px;
}
.card.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.card.empty { text-align: center; }
.card h1 { margin-top: 0; }

/* Hero / landing */
.hero { text-align: center; padding: 50px 0 30px; }
.hero h1 { font-size: 40px; margin: 0 0 12px; letter-spacing: -0.5px; }
.lead { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0 auto 26px; }
.cta-row { display: flex; gap: 12px; justify-content: center; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.step-n {
    display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-bottom: 8px;
}
.step h3 { margin: 6px 0; }
.step p { color: var(--muted); margin: 0; }

/* Buttons */
.btn {
    display: inline-block; background: var(--accent); color: var(--accent-ink);
    border: none; border-radius: 10px; padding: 11px 18px; font-size: 15px; font-weight: 600;
    cursor: pointer; text-align: center;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(231, 76, 60, 0.5); }
.btn.danger:hover { background: rgba(231, 76, 60, 0.12); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn-row, .cta-row { display: flex; gap: 12px; align-items: center; }

/* Forms */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field input, .field select, .field textarea {
    width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
    border-radius: 9px; padding: 10px 12px; font-size: 15px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
}
.field .hint { color: var(--muted); font-size: 12.5px; display: block; margin-top: 5px; }
.err { color: var(--bad); font-size: 13px; font-style: normal; display: block; margin-top: 5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2 .span-2 { grid-column: 1 / -1; }
.section-label { margin: 22px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.crumb { margin: 0 0 16px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; }
.table td.num, .table th.num { text-align: right; }
.table.compact th, .table.compact td { padding: 9px 8px; }
.link { color: var(--accent); }

/* Race ID display */
.raceid { background: var(--panel-2); padding: 3px 8px; border-radius: 6px; color: var(--accent); }
.raceid-card { display: flex; align-items: center; justify-content: space-between; }
.raceid-big { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.raceid-big code { font-size: 26px; font-weight: 700; color: var(--accent); letter-spacing: 0.5px; }

/* Pills / badges */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; border: 1px solid var(--line); }
.pill-scheduled { color: var(--warn); border-color: rgba(241, 196, 15, 0.4); }
.pill-live, .pill-active { color: var(--live); border-color: rgba(255, 77, 77, 0.5); }
.pill-finished, .pill-completed { color: var(--ok); border-color: rgba(46, 204, 113, 0.4); }
.pill-cancelled, .pill-abandoned { color: var(--muted); }
.count-badge { display: inline-block; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 9px; font-size: 13px; vertical-align: middle; }

/* Two-column layout on the event page */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cols .card { margin-bottom: 0; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* Clickable racer rows */
.racer-row { cursor: pointer; }
.racer-row:hover, .racer-row:focus { background: var(--panel-2); outline: none; }
.racer-row:focus { box-shadow: inset 0 0 0 2px rgba(255, 107, 53, 0.5); }

/* Racer map + stats overlay */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
    width: 100%; max-width: 880px; max-height: 92vh; overflow: auto; padding: 22px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.modal-head-right { display: flex; align-items: center; gap: 10px; }
.session-select { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 7px 10px; font-family: inherit; }
.modal-status { color: var(--muted); padding: 10px 0; }
.racer-map { width: 100%; height: 420px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }

.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; }
.stat-label { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-value { display: block; font-size: 20px; font-weight: 700; margin-top: 3px; }
.stat-sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }

@media (max-width: 760px) {
    .statgrid { grid-template-columns: repeat(2, 1fr); }
    .racer-map { height: 300px; }
}

/* Footer */
.foot { max-width: 960px; margin: 0 auto; padding: 24px 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
    .grid-2, .steps, .cols { grid-template-columns: 1fr; }
    .foot { flex-direction: column; gap: 6px; }
    .hero h1 { font-size: 30px; }
}
