:root {
  --bg: #130d08;
  --bg-panel: #1d150d;
  --bg-panel-2: #251b10;
  --border: #3a2a18;
  --text: #e8eaed;
  --text-muted: #9aa1ab;
  --accent: #e2421f;
  --accent-2: #f0a93a;
  --success: #35c46a;
  --error: #ff5d5d;
  --info: #4da3ff;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: linear-gradient(180deg, #1c140c, #130d08);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.4rem; }
.brand-name { text-transform: uppercase; }

/* Daktales wordmark — rendered as inline SVG (gradient fill + a real
   stroke), not CSS background-clip:text. The clip-text + stacked
   text-shadow approach we tried first rendered as an illegible blur in
   real browsers (no blur radius on the shadow layers = hard duplicate
   outlines fighting the transparent fill) — SVG text with a proper
   linearGradient and stroke renders crisp and identically everywhere.
   Used on the nav brand (.nav-wordmark-svg) and the leaderboard hero
   (.hero-wordmark-svg). Alfa Slab One loaded via Google Fonts in
   header.php's <head>. */
.nav-wordmark-svg { display: block; height: 30px; width: auto; }
.hero-wordmark-svg { display: block; height: 56px; width: auto; margin-bottom: 4px; }

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
}

.main-nav a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
}
.main-nav a:hover { color: var(--text); text-decoration: none; }

.nav-cta {
  background: var(--accent);
  color: #fff !important;
  padding: 6px 12px;
  border-radius: var(--radius);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 18px;
  background: var(--text);
  border-radius: 2px;
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    order: 3;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
  }
  .main-nav.nav-open { display: flex; }
  .main-nav a {
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
  }
  .nav-cta {
    margin-top: 6px;
    text-align: center;
  }
}

main.wrap { padding-top: 24px; padding-bottom: 60px; }

h1 {
  font-family: 'Alfa Slab One', serif;
  font-size: 1.5rem;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--accent-2);
}
h2 {
  font-family: 'Alfa Slab One', serif;
  font-size: 1.05rem;
  margin: 28px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--accent-2);
}

.muted { color: var(--text-muted); }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.hero {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  min-height: 260px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  background-image: var(--hero-img);
  background-size: cover;
  background-position: center 35%;
  background-color: var(--bg-panel);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(19,13,8,0.15) 0%, rgba(19,13,8,0.55) 55%, rgba(19,13,8,0.92) 100%);
}
.hero-inner {
  position: relative;
  padding: 20px 24px;
}
.hero-inner p {
  margin: 0;
  color: var(--text);
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}

@media (max-width: 480px) {
  .hero { min-height: 180px; }
  .hero-wordmark-svg { height: 40px; }
}
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }

.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 0.92rem;
}
.flash-error { background: rgba(255,93,93,0.12); border: 1px solid var(--error); color: #ff9c9c; }
.flash-success { background: rgba(53,196,106,0.12); border: 1px solid var(--success); color: #7fe0a4; }
.flash-info { background: rgba(77,163,255,0.12); border: 1px solid var(--info); color: #9cc7ff; }

form { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
form.inline-form { margin: 0; display: inline-flex; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }
label.radio { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

#opponent-bike-pickers { display: flex; flex-direction: column; gap: 14px; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], select, textarea {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
legend { padding: 0 6px; color: var(--text-muted); font-size: 0.85rem; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 11px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  display: inline-block;
}
button:hover, .btn:hover { background: #c2371a; text-decoration: none; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-danger { background: transparent; border: 1px solid var(--error); color: var(--error); }
.btn-danger:hover { background: rgba(255,93,93,0.12); }

.hint { font-size: 0.82rem; color: var(--text-muted); margin: -6px 0 0; }

.table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table-actions { display: flex; gap: 8px; }

.leaderboard .dak-count { font-weight: 800; color: var(--accent-2); font-size: 1.05rem; }
.leader-row { background: rgba(240,169,58,0.08); }

.duel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.duel-row.race-revoked { opacity: 0.55; }

.revoke-form { align-items: center; }
.revoke-reason { width: 160px; padding: 6px 8px; }

.badge {
  background: var(--accent-2);
  color: #1a1300;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  vertical-align: middle;
}

.dak-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.dak-list li { background: var(--bg-panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 0.85rem; }

.result-win { color: var(--success); font-weight: 700; }
.result-loss { color: var(--error); font-weight: 700; }

.cta-block { margin-top: 20px; }

/* Bike photos */
.rider-link { display: inline-flex; align-items: center; gap: 8px; }
.bike-thumb {
  width: 28px; height: 28px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  flex-shrink: 0;
}
.bike-thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.bike-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  flex-shrink: 0;
}
.bike-photo-preview {
  max-width: 260px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 4px;
}
.btn-edit {
  display: inline-block;
  margin-top: 4px;
}
.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
input[type=file] {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 10px 12px;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .bike-photo { width: 100px; height: 100px; }
}

/* Garage gallery (profile.php — a rider's full bike list) */
.bike-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin: 8px 0;
}
.bike-card {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.bike-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
  display: block;
}
.bike-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  font-size: 2rem;
  border-radius: 6px;
  background: var(--bg-panel);
  margin-bottom: 6px;
}
.bike-card-name { font-size: 0.85rem; }

/* Bike management list (settings.php) */
.bike-manage-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 10px; }
.bike-manage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  flex-wrap: wrap;
}
.bike-thumb-lg {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.bike-manage-info { flex: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bike-class-form { align-items: center; gap: 6px; }
.bike-class-form select { padding: 6px 8px; font-size: 0.85rem; }

/* Class chip — distinct from .badge (used for Primary/admin) so the two
   don't read as the same kind of tag. */
.chip {
  display: inline-block;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* Uploaded proof photo on a pending confirmation */
.proof-thumb {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  display: block;
}

/* Leaderboard category tabs */
.class-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
}
.class-tabs a {
  color: var(--text-muted);
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}
.class-tabs a:hover { color: var(--text); text-decoration: none; }
.class-tabs a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
.footer-tagline { color: var(--accent-2); }
.footer-credit { margin-top: 4px; font-size: 0.78rem; }

@media (max-width: 480px) {
  .card { padding: 16px; }
  .header-inner { padding: 12px; }
  .main-nav { gap: 6px 10px; }
  .main-nav a { font-size: 0.85rem; }
  .table th, .table td { padding: 8px 5px; font-size: 0.82rem; }
  h1 { font-size: 1.25rem; }
  .nav-wordmark-svg { height: 24px; }
}