/* Startlog visual system — ported from the Claude Design prototype (design/Startlog.html). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --ink: #14171a;
  --ink-2: #3f4339;
  --ink-3: #4b5157;
  --muted: #6b7280;
  --faint: #8a8d83;
  --line: #eceae4;
  --line-soft: #f1f0ea;
  --field: #dedbd3;
  --accent: #10b981;
  --accent-strong: #0d9668;
  --accent-deep: #0b7d57;
  --accent-soft: #e6f7ef;
  --gold: #b8860b;
  --gold-soft: #fdf3d8;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 16px;
  --radius-sm: 10px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color: var(--ink);
  background: var(--bg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
}

::selection {
  background: #cff3e4;
}

a {
  color: var(--accent-strong);
}

a:hover {
  color: var(--accent-deep);
}

input::placeholder,
textarea::placeholder {
  color: #a8aca3;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono {
  font-family: var(--mono);
}

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 9999px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #fff;
}

.btn-dark {
  background: var(--ink);
  color: #fff;
}

.btn-dark:hover {
  background: #2a2f34;
  color: #fff;
}

.btn-ghost {
  border-color: var(--field);
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  background: #f5f4ef;
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  color: #fff;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--field);
  border-radius: 9999px;
  background: var(--surface);
  color: var(--ink-2);
}

.icon-btn:hover {
  background: #f5f4ef;
  color: var(--ink);
}

.icon-btn.danger {
  color: var(--danger);
}

/* ---------- Forms ---------- */

.field {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--field);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgb(16 185 129 / 15%);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.hint {
  color: var(--faint);
  font-size: 12.5px;
  font-weight: 400;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-flex;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--faint);
  transform: translateY(-50%);
  cursor: pointer;
}

.password-toggle .icon-hide,
.password-toggle[aria-pressed="true"] .icon-show {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-hide {
  display: inline;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f5f4ef;
  font-size: 14px;
  font-weight: 500;
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.form-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: #991b1b;
  font-size: 14px;
}

/* ---------- Auth layout ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.auth-panel {
  display: none;
  position: relative;
  overflow: hidden;
  width: 380px;
  flex-shrink: 0;
  align-items: center;
  padding: 48px 40px;
  background: var(--ink);
  color: #fff;
}

.auth-panel-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.06;
  pointer-events: none;
}

.auth-panel-inner {
  position: relative;
  max-width: 400px;
}

.auth-panel .brand {
  margin-bottom: 40px;
  color: #fff;
}

.auth-panel .brand-mark {
  background: #fff;
  color: var(--accent);
}

.auth-panel h2 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.3;
}

.auth-panel p {
  margin: 0 0 28px;
  color: rgb(255 255 255 / 65%);
  font-size: 14px;
  line-height: 1.55;
}

.auth-panel ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: rgb(255 255 255 / 75%);
  font-size: 13px;
}

.auth-panel li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-panel li::before {
  content: "";
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 50%);
}

.auth-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.auth-main > .brand {
  margin-bottom: 28px;
}

.auth-card {
  width: min(100%, 400px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 3px -1px rgb(0 0 0 / 6%), 0 1px 0 rgb(25 28 33 / 2%);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.auth-sub {
  margin: 0 0 24px;
  color: var(--ink-3);
  font-size: 14px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form .btn {
  margin-top: 8px;
}

.auth-switch {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.auth-switch a {
  font-weight: 600;
  text-decoration: none;
}

.demo-try {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
}

.demo-try p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  color: var(--faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

@media (min-width: 900px) {
  .auth-panel {
    display: flex;
  }

  .auth-main > .brand {
    display: none;
  }
}

/* ---------- App layout ---------- */

.page-shell {
  min-height: 100vh;
  padding-bottom: 96px;
}

.sidebar {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar .brand {
  font-size: 16px;
}

.topbar .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.topbar form {
  margin-left: auto;
}

.link-btn {
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--ink);
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr 1fr;
  align-items: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.tab.is-active {
  color: var(--accent-strong);
}

.tab-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-top: -26px;
  border-radius: 9999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgb(16 185 129 / 35%);
}

.tab-add:hover {
  background: var(--accent-strong);
  color: #fff;
}

.content {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 16px;
}

@media (min-width: 900px) {
  .page-shell {
    display: flex;
    padding-bottom: 0;
  }

  .topbar,
  .tabbar {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 232px;
    height: 100vh;
    flex-shrink: 0;
    padding: 24px 16px;
    border-right: 1px solid var(--line);
    background: var(--surface);
  }

  .sidebar .brand {
    margin: 0 8px 28px;
  }

  .content {
    padding: 36px 40px;
  }
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.nav-item svg {
  color: var(--faint);
}

.nav-item:hover {
  background: #f3f5ef;
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.nav-item.is-active svg {
  color: var(--accent-strong);
}

.nav-add {
  margin: 12px 0;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar form {
  margin: 0;
}

.sidebar .nav-item.logout {
  color: var(--faint);
}

/* ---------- Page pieces ---------- */

.demo-banner {
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  color: #78350f;
  font-size: 14px;
  line-height: 1.5;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 900px) {
  .page-head h1 {
    font-size: 26px;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.card {
  margin: 0 0 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card h2 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 600;
}

.card-sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}

.empty p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty-title {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.chip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-gold {
  background: var(--gold-soft);
  color: #8a6508;
}

.chip-plain {
  background: var(--line-soft);
  color: var(--ink-2);
}

.trophy {
  flex-shrink: 0;
  color: var(--gold);
}

/* ---------- Archive ---------- */

.year-title {
  margin: 28px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.year-title:first-of-type {
  margin-top: 0;
}

.run-list {
  display: grid;
  gap: 10px;
}

.run-row {
  display: grid;
  grid-template-areas:
    "name time"
    "meta series";
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.run-row:hover {
  background: #fdfdfb;
  color: var(--ink);
}

.run-name {
  display: flex;
  grid-area: name;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
}

.run-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-meta {
  grid-area: meta;
  color: var(--muted);
  font-size: 13px;
}

.run-time {
  grid-area: time;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}

.run-series {
  grid-area: series;
  min-width: 0;
  max-width: 180px;
  text-align: right;
}

.run-head {
  display: none;
}

@media (min-width: 900px) {
  .run-list {
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .run-head,
  .run-row {
    display: grid;
    grid-template-areas: "name meta time series";
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) 0.8fr minmax(0, 1.4fr);
    gap: 16px;
    align-items: center;
    padding: 14px 20px;
  }

  .run-head {
    border-bottom: 1px solid var(--line-soft);
    color: var(--faint);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .run-row {
    border: 0;
    border-bottom: 1px solid #f5f4ef;
    border-radius: 0;
  }

  .run-row:last-child {
    border-bottom: 0;
  }

  .run-row:hover {
    background: var(--bg);
  }

  .run-time,
  .run-series {
    max-width: none;
    text-align: left;
  }
}

/* ---------- Race card ---------- */

.race-hero h1 {
  margin: 10px 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.race-meta {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.race-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.time-box {
  margin: 20px 0 16px;
  padding: 22px 16px;
  border-radius: 14px;
  background: var(--bg);
  text-align: center;
}

.time-label {
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.time-value {
  margin: 6px 0;
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
}

.time-pace {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
}

.facts {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.facts li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.facts .good {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}

.standings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.standings li {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
  text-align: center;
}

.standings .label {
  display: block;
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 12px;
}

.standings .value {
  font-size: 15px;
  font-weight: 700;
}

.section-label {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
}

.notes {
  margin: 0 0 16px;
  color: var(--ink-2);
  line-height: 1.6;
  white-space: pre-line;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* ---------- Series & comparison ---------- */

.series-list {
  display: grid;
  gap: 10px;
}

.series-item {
  display: grid;
  gap: 4px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.series-title {
  font-size: 16px;
  font-weight: 700;
}

.series-meta {
  color: var(--muted);
  font-size: 13px;
}

.series-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
}

.series-actions a {
  text-decoration: none;
}

.series-actions span {
  color: var(--faint);
  font-size: 12.5px;
  font-weight: 400;
}

.compare-list {
  display: grid;
  gap: 12px;
}

.compare-item {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.compare-item.is-best {
  border-color: #a7e3cb;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.compare-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.compare-top h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.compare-top h2 a {
  color: var(--ink);
  text-decoration: none;
}

.compare-time {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
}

.compare-item .facts {
  margin: 12px 0 0;
}

.compare-item h3 {
  margin: 12px 0 6px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
}

.compare-item .standings {
  margin: 0;
}

.bar {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 10px;
}

.bar-track {
  fill: var(--line-soft);
}

.bar-fill {
  fill: var(--accent);
}

/* ---------- Race form ---------- */

.race-form {
  display: grid;
  gap: 14px;
  max-width: 640px;
}

.race-form .card {
  display: grid;
  gap: 16px;
  margin: 0;
}

.race-form .card-sub {
  margin: -14px 0 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 560px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.place-row {
  margin: 0;
  padding: 0;
  border: 0;
}

.place-row legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
}

.place-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
}

.place-inputs .of {
  padding-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Iteration 2: summaries, badges, compact standings ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 24px;
}

.stat {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.stat-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}

.stat-label {
  color: var(--muted);
  font-size: 12.5px;
}

.summary {
  margin: 0 0 18px;
  padding: 22px 24px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
}

.summary-path {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 18px;
}

.summary-path > div {
  display: grid;
  gap: 2px;
}

.summary-year {
  color: rgb(255 255 255 / 55%);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.summary-time {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}

.summary-arrow {
  padding-bottom: 4px;
  color: var(--accent);
  font-size: 24px;
}

.summary-verdict {
  margin: 12px 0 0;
  color: rgb(255 255 255 / 80%);
  font-size: 15px;
  font-weight: 600;
}

.summary-verdict.faster {
  color: #34d399;
}

.summary-verdict.slower {
  color: #fca5a5;
}

.bar {
  height: 8px;
}

.bar-fill.best {
  fill: var(--accent-strong);
}

.pace {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.badge {
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12.5px;
  font-weight: 600;
}

.badge-gold {
  background: var(--gold-soft);
  color: #8a6508;
}

.deltas {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 8px 0 14px;
  color: var(--ink-3);
  font-size: 13.5px;
}

.deltas .faster {
  color: var(--accent-deep);
  font-weight: 600;
}

.deltas .slower {
  color: #b45309;
  font-weight: 600;
}

.standings .value {
  display: block;
  font-family: var(--mono);
  font-size: 18px;
}

.standings .of {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.compare-item .standings {
  margin-top: 4px;
}

@media (max-width: 899px) {
  .run-series.is-same {
    display: none;
  }

  .run-row:has(.run-series.is-same) {
    grid-template-areas:
      "name time"
      "meta meta";
  }

  .demo-banner {
    padding: 10px 12px;
    font-size: 13px;
  }
}

.badge-plain {
  background: var(--line-soft);
  color: var(--ink-2);
}

.series-link {
  color: var(--ink);
  text-decoration: none;
}

.series-link:hover {
  border-color: #a7e3cb;
  color: var(--ink);
}

.tab-form {
  display: flex;
  justify-content: center;
  margin: 0;
}

.tab-form .tab {
  border: 0;
  background: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Comparison filters ---------- */

.filters {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.filter-row {
  display: grid;
  gap: 8px;
  margin: 0;
}

.filter-label {
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 7px 14px;
  border: 1px solid var(--field);
  border-radius: 9999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.filter-chip.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}

.filter-years {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.filter-years label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-years select {
  padding: 7px 10px;
  border: 1px solid var(--field);
  border-radius: 9999px;
  background: #fff;
  font: inherit;
  font-family: var(--mono);
}

.btn-small {
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13.5px;
}

.filter-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 700px) {
  .filter-grid {
    grid-template-columns: 1.2fr 1.2fr 1fr;
  }
}

fieldset.filter-row {
  padding: 0;
  border: 0;
}

fieldset.filter-row legend {
  margin-bottom: 8px;
  padding: 0;
}

.check-chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.check-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-chip span {
  padding: 7px 14px;
  border: 1px solid var(--field);
  border-radius: 9999px;
  background: #fff;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 13.5px;
}

.check-chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}

.check-chip input:checked + span::before {
  content: "✓ ";
}

.check-chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Multi-select dropdown (years): a <details> styled like the native selects. */

.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: block;
  padding: 12px 36px 12px 14px;
  overflow: hidden;
  border: 1px solid var(--field);
  border-radius: var(--radius-sm);
  position: relative;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  list-style: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.dropdown-toggle::-webkit-details-marker {
  display: none;
}

.dropdown-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-70%) rotate(45deg);
}

.dropdown-toggle.is-disabled::after {
  border-color: #c7c4bb;
}

.dropdown[open] .dropdown-toggle {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(16 185 129 / 15%);
}

.dropdown-toggle.is-disabled {
  color: #a8aca3;
  background-color: #f5f4ef;
  cursor: not-allowed;
}

.dropdown-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 12px 28px rgb(20 23 26 / 12%);
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.dropdown-option:hover {
  background: var(--bg);
}

.dropdown-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.dropdown-panel .btn {
  margin-top: 6px;
}

.field select:disabled {
  color: #a8aca3;
  background: #f5f4ef;
}

/* ---------- Comparison: time chart + compact cards ---------- */

.chart {
  margin: 0 0 18px;
  padding: 16px 18px 12px;
}

.chart-title {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.chart-title span {
  color: var(--muted);
  font-weight: 400;
}

.chart-svg {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
}

.chart-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.chart-tick {
  stroke: var(--field);
  stroke-width: 1;
}

.chart-axis {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.chart-line {
  fill: none;
  stroke: #c7c4bb;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-hit {
  fill: transparent;
}

.chart-dot {
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-dot.is-pr {
  stroke: var(--gold);
  stroke-width: 2.5;
}

.chart-label {
  fill: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

/* Categorical series slots (validated: dataviz validate_palette.js, light surface). */
.s0 { fill: #2a78d6; background: #2a78d6; }
.s1 { fill: #eb6834; background: #eb6834; }
.s2 { fill: #1baf7a; background: #1baf7a; }
.s3 { fill: #eda100; background: #eda100; }
.s4 { fill: #e87ba4; background: #e87ba4; }
.sother { fill: #8a8d83; background: #8a8d83; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-3);
  font-size: 13px;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  margin-right: 5px;
  border-radius: 50%;
}

.chart-legend .chart-swatch {
  margin-right: 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 700px) {
  .compare-grid {
    gap: 10px;
  }
}

@media (max-width: 699px) {
  .mini {
    gap: 4px;
    padding: 12px;
  }

  .mini-top {
    flex-direction: column;
    gap: 0;
  }

  .mini-time {
    font-size: 18px;
  }

  .mini-name {
    font-size: 13px;
  }

  .mini-meta {
    flex-direction: column;
    font-size: 11.5px;
  }

  .mini .badge {
    max-width: 100%;
    overflow: hidden;
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mini-standings {
    font-size: 11.5px;
  }
}

.mini {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.mini.is-best {
  border-color: #a7e3cb;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.mini-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mini-date {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.mini-time {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
}

.mini-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini .bar {
  margin-top: 2px;
}

.mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.mini .badges {
  margin: 2px 0 0;
}

.mini .badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 11.5px;
}

.mini-standings {
  display: grid;
  gap: 2px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-3);
  font-size: 12.5px;
}

.mini-standings span {
  color: var(--faint);
}

.mini,
.mini > * {
  min-width: 0;
}

.mini .badges {
  min-width: 0;
}

.label-short {
  display: none;
}

@media (max-width: 699px) {
  .badge-series,
  .label-long {
    display: none;
  }

  .label-short {
    display: inline;
  }
}

/* ---------- Iteration: airier comparison cards ---------- */

.compare-grid {
  gap: 14px;
}

@media (min-width: 700px) {
  .compare-grid {
    gap: 18px;
  }
}

.mini {
  position: relative;
  gap: 8px;
  padding: 16px 18px 16px 20px;
  overflow: hidden;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgb(20 23 26 / 4%);
}

.mini::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--stripe, #c7c4bb);
}

.stripe-0 { --stripe: #2a78d6; }
.stripe-1 { --stripe: #eb6834; }
.stripe-2 { --stripe: #1baf7a; }
.stripe-3 { --stripe: #eda100; }
.stripe-4 { --stripe: #e87ba4; }
.stripe-other { --stripe: #8a8d83; }

.mini .chart-swatch {
  display: none;
}

.mini-meta {
  gap: 4px 14px;
  line-height: 1.45;
}

.mini-standings {
  gap: 6px;
  margin: 6px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line-soft);
  line-height: 1.4;
}

.mini-standings li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
}

.mini-standings .ms-label {
  color: var(--faint);
  font-size: 12px;
}

.mini-standings .ms-value {
  color: var(--ink-3);
  font-size: 13px;
}

.mini-standings b {
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
}

.ms-top {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--line-soft);
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
}

@media (max-width: 699px) {
  .mini {
    gap: 6px;
    padding: 14px 12px 14px 16px;
  }

  .mini .chart-swatch {
    display: none;
  }

  .mini-standings li {
    display: grid;
    gap: 0;
  }

  .mini-standings .ms-value {
    font-size: 12px;
  }

  .ms-top {
    margin-left: 4px;
    font-size: 10.5px;
  }
}

/* ---------- Documents, account, feedback ---------- */

.doc-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.doc-header {
  margin-bottom: 18px;
}

.doc {
  line-height: 1.6;
}

.doc h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.doc h2 {
  margin: 22px 0 6px;
  font-size: 16px;
}

.doc ul,
.doc ol {
  padding-left: 20px;
}

.doc li {
  margin: 4px 0;
}

.doc-draft {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  color: #78350f;
  font-size: 14px;
}

mark.todo {
  padding: 0 4px;
  border-radius: 4px;
  background: #fde68a;
  color: #78350f;
}

.doc-footer {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.doc-footer a {
  color: var(--muted);
}

.form-ok {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #a7e3cb;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 14px;
}

.consent-check {
  align-items: flex-start;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
}

.consent-check input {
  flex-shrink: 0;
  margin-top: 2px;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 12px 0 16px;
  font-size: 14px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 559px) {
  .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .kv dd {
    margin-bottom: 8px;
  }
}

.danger-zone {
  border-color: #fecaca;
}

.danger-zone .auth-form {
  max-width: 360px;
}

.forgot-link {
  margin: -8px 0 0;
  font-size: 13px;
  text-align: right;
}

.forgot-link a {
  font-weight: 500;
  text-decoration: none;
}
