/* ═══════════════════════════════════════════════════════════
   VENERA (local) — drop Venera-*.otf into ./fonts/
   Falls back to Chakra Petch (Google Fonts) if not installed.
═══════════════════════════════════════════════════════════ */
@font-face {
  font-family: 'Venera';
  src: url('../fonts/Venera-300.otf') format('opentype');
  font-weight: 300; font-display: swap;
}
@font-face {
  font-family: 'Venera';
  src: url('../fonts/Venera-500.otf') format('opentype');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Venera';
  src: url('../fonts/Venera-700.otf') format('opentype');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Venera';
  src: url('../fonts/Venera-900.otf') format('opentype');
  font-weight: 900; font-display: swap;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ─── TOKENS ─── */
:root {
  --bg:        #050505;
  --bg-2:      #0b0b0b;
  --surface:   #111112;
  --surface-2: #18181a;
  --surface-3: #1f1f22;
  --border:    #262629;
  --border-h:  #3a3a3f;
  --text:      #f5f5f5;
  --text-2:    #9a9a9f;
  --text-3:    #55555a;
  --red:       #E10600;
  --red-dim:   rgba(225, 6, 0, 0.14);
  --red-glow:  rgba(225, 6, 0, 0.35);
  --gold:      #F5C518;
  --silver:    #C0C4CC;
  --bronze:    #CD7F32;
  --green:     #22C55E;
  --blue:      #3B82F6;
  --vf: 'Venera', 'Chakra Petch', 'Impact', 'Arial Black', sans-serif;
  --mf: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --monof: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  --r:   10px;
  --rl:  16px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --tr:  0.2s var(--ease);
}

body {
  font-family: var(--mf);
  background: var(--bg);
  color: var(--text);
  position: relative;
}

/* Background grid / stripe */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}
/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ═════════════════════════════════════════
   ICON BUTTON (shared — modals, etc.)
═════════════════════════════════════════ */
.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: var(--tr);
}
.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-h);
  background: var(--surface-2);
}
.icon-btn svg { width: 18px; height: 18px; }

/* ═════════════════════════════════════════
   SECTION TABS
═════════════════════════════════════════ */
.tab-nav {
  display: flex; align-items: stretch;
  gap: 2px;
  margin: 0 0 28px;
  padding: 6px;
  background: rgba(10, 10, 10, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-link {
  position: relative;
  flex: 1 1 0;
  min-width: max-content;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px;
  font-family: var(--vf);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--tr), background var(--tr);
  white-space: nowrap;
}
.tab-link:hover { color: var(--text); background: var(--surface-2); }
.tab-link.active {
  color: #fff;
  background: var(--red);
  box-shadow: 0 4px 14px -4px var(--red-glow);
}

.tab-settings {
  flex: 0 0 auto;
  width: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 4px;
  color: var(--text-3);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--tr), background var(--tr);
}
.tab-settings:hover { color: var(--text); background: var(--surface-2); }
.tab-settings svg { width: 17px; height: 17px; }

/* ═════════════════════════════════════════
   HERO
═════════════════════════════════════════ */
.hero {
  position: relative;
  padding: clamp(48px, 8vw, 96px) clamp(16px, 4vw, 48px) clamp(32px, 5vw, 64px);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(225, 6, 0, 0.09), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(225, 6, 0, 0.05), transparent 55%);
}
.hero-inner {
  position: relative;
  max-width: 1440px; margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 48px;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--text-2);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.eyebrow-bar {
  width: 40px; height: 2px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

.hero-name {
  font-family: var(--vf);
  font-weight: 900;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text);
  word-break: break-word;
}
.hero-name .accent { color: var(--red); }
.hero-sub {
  margin-top: 18px;
  font-size: clamp(13px, 1.2vw, 15px);
  font-weight: 400;
  color: var(--text-2);
  letter-spacing: 0.06em;
  max-width: 540px;
}

.hero-tiles {
  display: grid;
  grid-template-columns: repeat(2, 130px);
  gap: 12px;
}
.hero-tile {
  position: relative;
  padding: 18px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.hero-tile::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 16px;
  background: var(--red);
}
.tile-num {
  font-family: var(--vf);
  font-weight: 900;
  font-size: 34px;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.01em;
}
.tile-num.red    { color: var(--red); }
.tile-num.gold   { color: var(--gold); }
.tile-num.silver { color: var(--silver); }
.tile-lbl {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ═════════════════════════════════════════
   WRAP + SECTIONS
═════════════════════════════════════════ */
.wrap {
  position: relative; z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) clamp(16px, 4vw, 48px);
}
.page-section { display: none; animation: fadeUp 0.4s var(--ease); }
.page-section.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.section-title-wrap {
  display: flex; align-items: baseline; gap: 16px;
}
.section-no {
  font-family: var(--monof);
  font-size: 12px;
  font-weight: 500;
  color: var(--red);
  letter-spacing: 0.1em;
}
.section-title {
  font-family: var(--vf);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
}
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═════════════════════════════════════════
   BUTTONS
═════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: var(--tr);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(225, 6, 0, 0.6);
}
.btn-primary:hover { background: #ff1a14; box-shadow: 0 8px 22px -4px rgba(225, 6, 0, 0.75); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-h); background: var(--surface); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

/* ═════════════════════════════════════════
   YEAR TABS
═════════════════════════════════════════ */
.year-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.year-tabs::-webkit-scrollbar { display: none; }

.year-tab {
  font-family: var(--vf);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 8px 18px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
  transition: var(--tr);
  white-space: nowrap;
}
.year-tab:hover { color: var(--text); border-color: var(--border-h); }
.year-tab.active {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 4px 14px -4px var(--red-glow);
}

.year-summary {
  padding: 18px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--r);
  margin-bottom: 20px;
}
.ys-head {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 14px;
}
.ys-label {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.ys-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
}
.ys-year {
  font-family: var(--vf);
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.ys-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.ys-stats {
  display: flex; gap: 28px; flex-wrap: wrap;
}
.ys-item {
  display: flex; flex-direction: column; gap: 4px;
}
.ys-num {
  font-family: var(--vf);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.ys-lbl {
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ═════════════════════════════════════════
   TOOLBAR
═════════════════════════════════════════ */
.toolbar {
  display: flex; gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-field {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-field svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-3);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: var(--tr);
}
.search-field input::placeholder { color: var(--text-3); }
.search-field input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

.select-field {
  padding: 11px 36px 11px 14px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9a9f' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  transition: var(--tr);
  min-width: 160px;
  cursor: pointer;
}
.select-field:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

/* ═════════════════════════════════════════
   CARDS
═════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
}

/* ═════════════════════════════════════════
   RESULTS TABLE
═════════════════════════════════════════ */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.results-table th {
  font-family: var(--vf);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: left;
  padding: 14px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
.results-table th.num { text-align: center; }
.results-table th.sortable { cursor: pointer; user-select: none; transition: color var(--tr); }
.results-table th.sortable:hover { color: var(--text); }
.results-table th .si {
  display: inline-block;
  width: 0; height: 0;
  margin-left: 6px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.35;
  transition: var(--tr);
  vertical-align: middle;
}
.results-table th.sorted-asc .si {
  border-bottom: 5px solid var(--red);
  opacity: 1;
}
.results-table th.sorted-desc .si {
  border-top: 5px solid var(--red);
  opacity: 1;
}

.results-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}
.results-table tbody tr { transition: background var(--tr); }
.results-table tbody tr:hover { background: var(--surface-2); }
.results-table tbody tr:last-child td { border-bottom: none; }

.td-date { font-family: var(--monof); color: var(--text-2); font-size: 12px; }
.td-circuit { color: var(--text); font-weight: 500; }
.td-series { color: var(--text-2); }
.td-class {
  display: inline-block;
  padding: 3px 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.td-num { text-align: center; }

.pos-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 30px;
  padding: 0 10px;
  font-family: var(--vf);
  font-size: 15px;
  font-weight: 700;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
}
.pos-chip.p1 {
  background: linear-gradient(135deg, #FFD84D, var(--gold));
  color: #111;
  box-shadow: 0 0 0 1px #F5C518 inset, 0 4px 12px -4px rgba(245, 197, 24, 0.5);
}
.pos-chip.p2 {
  background: linear-gradient(135deg, #E8EBEE, var(--silver));
  color: #111;
  box-shadow: 0 0 0 1px #C0C4CC inset, 0 4px 12px -4px rgba(192, 196, 204, 0.4);
}
.pos-chip.p3 {
  background: linear-gradient(135deg, #E89D5C, var(--bronze));
  color: #111;
  box-shadow: 0 0 0 1px var(--bronze) inset, 0 4px 12px -4px rgba(205, 127, 50, 0.45);
}
.pos-chip.pT { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-h); }
.pos-chip.pO { background: var(--surface-2); color: var(--text-2); }
.pos-chip.pDNF {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* Combined Finish cell */
.finish-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
.in-class-tag {
  font-family: var(--mf);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
  padding: 2px 6px;
  border: 1px solid var(--red);
  border-radius: 3px;
  background: var(--red-dim);
  white-space: nowrap;
}
.pos-chip.small {
  min-width: 30px; height: 26px;
  font-size: 13px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  box-shadow: none;
}
.pos-chip.small.p1 { color: var(--gold); border-color: var(--gold); background: transparent; }
.pos-chip.small.p2 { color: var(--silver); border-color: var(--silver); background: transparent; }
.pos-chip.small.p3 { color: var(--bronze); border-color: var(--bronze); background: transparent; }
.pos-chip.small.pDNF { color: var(--red); border-color: var(--red); }

/* Race column badge */
.td-race {
  display: inline-block;
  padding: 3px 8px;
  font-family: var(--monof);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  letter-spacing: 0.06em;
}

.actions-col { width: 1%; padding: 0 8px; }
.row-actions {
  display: flex; gap: 2px;
  opacity: 0;
  transition: var(--tr);
}
tbody tr:hover .row-actions { opacity: 1; }
.row-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-3);
  transition: var(--tr);
}
.row-btn:hover { color: var(--text); background: var(--surface-3); }
.row-btn.danger:hover { color: var(--red); background: var(--red-dim); }
.row-btn svg { width: 14px; height: 14px; }

.empty-state {
  padding: 64px 24px;
  text-align: center;
  color: var(--text-2);
}
.empty-state svg {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  color: var(--text-3);
}
.empty-state-title {
  font-family: var(--vf);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-state-sub {
  font-size: 13px;
  color: var(--text-2);
}

/* Mobile result cards */
.card-mobile { display: none; padding: 12px 0; gap: 10px; flex-direction: column; }
.result-card {
  position: relative;
  background: transparent;
  border-radius: 12px;
  overflow: hidden;
  isolation: isolate;
}
.rc-slide {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-h);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  z-index: 1;
  transform: translateX(0);
  will-change: transform;
  touch-action: pan-y;
}
.result-card.win    .rc-slide { border-left-color: var(--gold); }
.result-card.silver .rc-slide { border-left-color: var(--silver); }
.result-card.bronze .rc-slide { border-left-color: var(--bronze); }

.rc-info {
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.rc-circuit {
  font-family: var(--vf);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
  overflow-wrap: anywhere;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rc-race {
  display: inline-block;
  font-family: var(--monof);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rc-series {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font-size: 11px;
  color: var(--text-2);
  margin-top: 4px;
}
.rc-date {
  font-family: var(--monof);
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.rc-kv {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-2);
}
.rc-kv b { color: var(--text); font-weight: 600; font-family: var(--monof); }

.rc-finish {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  min-width: 50px;
}
.rc-finish .pos-chip {
  min-width: 48px;
  height: 42px;
  font-size: 19px;
}

/* Swipe-reveal actions */
.rc-swipe-actions {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 160px;
  display: flex;
  z-index: 0;
}
.swipe-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: #fff;
  font-family: var(--vf);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.swipe-btn svg { width: 20px; height: 20px; }
.swipe-btn.edit   { background: #2a2a2e; }
.swipe-btn.edit:active   { background: #35353a; }
.swipe-btn.delete { background: var(--red); }
.swipe-btn.delete:active { background: #ff1a14; }
.result-card.swiped .rc-slide { transform: translateX(-160px); }

/* ═════════════════════════════════════════
   CHAMPIONSHIPS
═════════════════════════════════════════ */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.ach-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 22px 22px 20px;
  overflow: hidden;
  transition: var(--tr);
}
.ach-card:hover {
  border-color: var(--border-h);
  transform: translateY(-2px);
}
.ach-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--border-h);
}
.ach-card.championship::before { background: var(--gold); }
.ach-card.podium::before       { background: var(--silver); }
.ach-card.record::before       { background: var(--blue); }
.ach-card.award::before        { background: var(--red); }
.ach-card.special::before      { background: var(--green); }

.ach-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.ach-type {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--surface-3);
  font-family: var(--vf);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}
.ach-card.championship .ach-type { color: var(--gold); background: rgba(245, 197, 24, 0.08); }
.ach-card.podium       .ach-type { color: var(--silver); }
.ach-card.record       .ach-type { color: var(--blue); background: rgba(59, 130, 246, 0.08); }
.ach-card.award        .ach-type { color: var(--red); background: var(--red-dim); }
.ach-card.special      .ach-type { color: var(--green); background: rgba(34, 197, 94, 0.08); }

.ach-year {
  font-family: var(--vf);
  font-weight: 900;
  font-size: 22px;
  color: var(--text);
  letter-spacing: 0.02em;
}
.ach-title {
  font-family: var(--vf);
  font-weight: 900;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}
.ach-series {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.ach-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
.ach-actions {
  position: absolute; bottom: 10px; right: 10px;
  display: flex; gap: 2px;
  opacity: 0;
  transition: var(--tr);
}
.ach-card:hover .ach-actions { opacity: 1; }

/* ═════════════════════════════════════════
   STATS
═════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  position: relative;
  padding: 20px 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: var(--tr);
}
.stat-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 48px; height: 48px;
  background: linear-gradient(225deg, var(--red-dim), transparent 70%);
  pointer-events: none;
  opacity: 0.6;
}
.stat-card:hover { border-color: var(--border-h); transform: translateY(-2px); }
.stat-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 8px;
}
.stat-val {
  font-family: var(--vf);
  font-weight: 900;
  font-size: 36px;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.01em;
}
.stat-val.gold   { color: var(--gold); }
.stat-val.red    { color: var(--red); }
.stat-val.silver { color: var(--silver); }
.stat-val.green  { color: var(--green); }
.stat-sub {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
}

/* charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.chart-card { padding: 22px; }
.chart-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.chart-title {
  font-family: var(--vf);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.bar-label {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  position: relative;
  height: 10px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--red), #ff4a45);
  border-radius: 99px;
  transition: width 0.6s var(--ease);
}
.bar-val {
  font-family: var(--vf);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

.pos-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding: 8px 4px 0;
}
.pos-bar {
  flex: 1;
  min-width: 16px;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.pos-bar-fill {
  width: 100%;
  background: var(--surface-3);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s var(--ease);
  min-height: 2px;
}
.pos-bar.p1 .pos-bar-fill { background: var(--gold); }
.pos-bar.p2 .pos-bar-fill { background: var(--silver); }
.pos-bar.p3 .pos-bar-fill { background: var(--bronze); }
.pos-bar.pT .pos-bar-fill { background: var(--red); }
.pos-bar-lbl {
  margin-top: 6px;
  font-family: var(--monof);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-2);
}
.pos-bar-val {
  position: absolute;
  top: -18px;
  font-family: var(--vf);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

/* ═════════════════════════════════════════
   MODALS
═════════════════════════════════════════ */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: bgFade 0.2s var(--ease);
}
.modal-bg.open { display: flex; }
@keyframes bgFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.25s var(--ease);
}
.modal.modal-sm { max-width: 440px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--vf);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.confirm-msg {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

/* forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span2 { grid-column: 1 / -1; }
.field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}
.field .opt {
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: none;
  margin-left: 4px;
}
.field .hint {
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-left: 4px;
  font-style: italic;
  font-size: 10px;
}
.field input, .field select, .field textarea {
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: var(--tr);
  width: 100%;
  font-family: var(--mf);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}
.field textarea { resize: vertical; min-height: 80px; }
.field select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9a9f' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.field input[type="date"] { color-scheme: dark; }

.danger-zone {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.dz-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* CSV import */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--tr);
  background: var(--surface);
}
.drop-zone:hover, .drop-zone.drag {
  border-color: var(--red);
  background: var(--red-dim);
}
.drop-zone svg {
  width: 38px; height: 38px;
  margin: 0 auto 12px;
  color: var(--text-2);
}
.dz-title {
  font-family: var(--vf);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 4px;
}
.dz-sub { font-size: 12px; color: var(--text-2); }

.import-preview {
  display: none;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.import-preview.show { display: block; }
.import-preview.err { border-color: var(--red); color: var(--red); }
.ip-row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  color: var(--text-2);
}
.ip-row b { color: var(--text); font-weight: 600; }

.csv-hint {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  font-size: 12px;
}
.csv-hint-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 10px;
}
.csv-hint-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.csv-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.csv-tag.req { background: var(--red); color: #fff; }
.csv-tag.opt { background: var(--surface-3); color: var(--text-2); }
.csv-hint code {
  font-family: var(--monof);
  font-size: 12px;
  color: var(--text);
}
.csv-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
}

/* ═════════════════════════════════════════
   TOASTS
═════════════════════════════════════════ */
.toast-wrap {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
  animation: toastIn 0.28s var(--ease);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.out     { animation: toastOut 0.24s var(--ease) forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}

/* ═════════════════════════════════════════
   FOOTER
═════════════════════════════════════════ */
.site-footer {
  margin-top: 64px;
  padding: 32px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.foot-dot {
  width: 4px; height: 4px; border-radius: 99px;
  background: var(--red);
}

/* ═════════════════════════════════════════
   RESPONSIVE
═════════════════════════════════════════ */
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; align-items: start; gap: 36px; }
  .hero-tiles { grid-template-columns: repeat(4, 1fr); }

  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .results-table { display: none; }
  .card-mobile   { display: flex; }
  .table-card { border: none; background: transparent; border-radius: 0; }
  .card-mobile { padding: 0; }

  .hero { padding-top: 36px; padding-bottom: 28px; }
  .hero-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hero-tile  { padding: 14px 12px 12px; }
  .tile-num   { font-size: 26px; }
  .tile-lbl   { font-size: 9px; letter-spacing: 0.16em; }

  .section-head { align-items: flex-start; }
  .section-actions .btn span { display: none; }
  .section-actions .btn { padding: 10px 12px; }
  .section-actions .btn svg { margin: 0; }

  .toolbar { gap: 8px; }
  .select-field { min-width: 0; flex: 1; }
  .search-field { min-width: 0; }

  .form-grid { grid-template-columns: 1fr; }
  .field.span2 { grid-column: auto; }

  .modal { border-radius: 12px; }
  .modal-body { padding: 18px; }
  .modal-head { padding: 16px 18px; }

  .bar-row { grid-template-columns: 88px 1fr 32px; font-size: 11px; }
  .bar-label { font-size: 11px; }
  .chart-card { padding: 18px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 16px 14px 14px; }
  .stat-val  { font-size: 28px; }

  .ach-grid  { grid-template-columns: 1fr; }

  .pos-chart { height: 140px; gap: 3px; }
  .pos-bar-lbl { font-size: 9px; }

  .ys-num { font-size: 16px; }
  .ys-lbl { font-size: 10px; letter-spacing: 0.1em; }
  .year-summary { gap: 14px 20px; padding: 12px 14px; }

  .year-tab { padding: 7px 14px; font-size: 13px; }
}

@media (max-width: 440px) {
  .tab-link { padding: 10px 14px; font-size: 11px; letter-spacing: 0.12em; }
  .toast-wrap { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; }
}

/* Utility */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}
