﻿:root {
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #1f2a30;
  --muted: #607078;
  --line: #d8e1de;
  --brand: #0d7f6f;
  --brand-strong: #0a5f53;
  --danger: #b3261e;
  --shadow: 0 14px 34px rgba(20, 52, 46, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.45;
  background: linear-gradient(130deg, #f3f9f4 0%, #eef3f7 60%, #fff4e9 100%);
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 10%, rgba(13, 127, 111, 0.14), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(255, 159, 67, 0.16), transparent 32%);
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.2rem;
}

.top-nav {
  margin-left: auto;
  display: flex;
  gap: 1rem;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--brand);
}

.section {
  padding: 1rem 0 1.2rem;
}

.hero-page {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1rem;
  padding-top: 2rem;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.77rem;
  letter-spacing: 0.09em;
}

h1 {
  margin: 0.4rem 0;
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1.1;
}

.subtitle {
  margin: 1rem 0 1.4rem;
  color: var(--muted);
  max-width: 60ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.feature-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.5rem;
}

.steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.4rem;
}

.auth-grid,
.admin-grid,
.stats-grid,
.snapshots {
  display: grid;
  gap: 1rem;
}

.auth-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.snapshots {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.race-page {
  display: grid;
  gap: 1rem;
}

.race-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.9rem;
  align-items: end;
}

.race-controls-actions {
  display: flex;
  justify-content: flex-end;
}

.panel {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.panel-note,
.dashboard-head p {
  color: var(--muted);
}

.stat-card {
  background: linear-gradient(170deg, #ffffff 0%, #f2faf6 100%);
  border: 1px solid #cfe2da;
  border-radius: 12px;
  padding: 0.85rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: 0.3rem;
}

.stat-user {
  font-size: 1rem;
}

form {
  display: grid;
  gap: 0.5rem;
}

label {
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #bccdc6;
  background: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  color: var(--text);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(13, 127, 111, 0.35);
  outline-offset: 2px;
}

.btn {
  border: none;
  min-height: 42px;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn:hover {
  background: var(--brand-strong);
}

.btn-ghost {
  background: #fff;
  border: 1px solid #bfd1ca;
  color: var(--text);
}

.btn-ghost:hover {
  background: #f2f8f5;
}

pre {
  margin: 0;
  min-height: 90px;
  border-radius: 10px;
  border: 1px solid #d2dbd8;
  background: var(--surface-soft);
  padding: 0.65rem;
  overflow: auto;
  white-space: pre-wrap;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  border-bottom: 1px solid #d6dfdc;
  padding: 0.55rem;
}

.data-table thead th {
  font-size: 0.9rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: 320px;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  color: #fff;
  background: #234239;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 960px) {
  .hero-page,
  .auth-grid,
  .admin-grid,
  .stats-grid,
  .snapshots,
  .race-controls {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    flex-wrap: wrap;
    padding: 0.45rem 0;
  }

  .top-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }
}