:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #111316;
  --panel-2: #171a1f;
  --text: #f6f7f8;
  --muted: #969ca5;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #ff7a00;
  --accent-2: #ffb13b;
  --red: #ff453a;
  --blue: #4aa3ff;
  --green: #42d66b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: block;
  background: #030303;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 76px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.38));
  backdrop-filter: blur(16px);
  padding: 14px 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 122, 0, 0.55);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 800;
  background: rgba(255, 122, 0, 0.08);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.04;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.nav-item,
.nav-link {
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
  text-decoration: none;
  padding: 10px 13px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item.active,
.nav-link:hover,
.nav-item:hover {
  color: var(--text);
  background: var(--panel-2);
}

.status-card {
  margin-top: 0;
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(17, 19, 22, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-card p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(255, 122, 0, 0.8);
}

.main {
  padding: 0 24px 24px;
  display: grid;
  gap: 18px;
}

.hero {
  position: relative;
  min-height: 940px;
  display: grid;
  grid-template-columns: minmax(430px, 0.92fr) minmax(520px, 1.08fr);
  align-items: center;
  gap: 24px;
  padding: 108px 32px 34px;
  overflow: hidden;
  border: 0;
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.98) 0%, rgba(0, 0, 0, 0.74) 35%, rgba(0, 0, 0, 0.25) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), #030303 98%),
    url("/static/assets/hero-race.png");
  background-size: cover;
  background-position: center;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 180px;
  background: linear-gradient(180deg, transparent, #030303);
  pointer-events: none;
}

.hero-content,
.phone-stage,
.hero-metrics {
  position: relative;
  z-index: 2;
}

.hero-content {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 690px;
}

.hero-lead {
  color: #f4eee6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  margin-bottom: 18px;
}

.hero-copy {
  max-width: 650px;
  margin-top: 14px;
  color: #f2eee8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}

.hero h2 {
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 6vw, 86px);
  font-weight: 700;
  text-shadow: 0 3px 22px rgba(0, 0, 0, 0.58);
}

.hero h2 span,
.tagline span {
  color: var(--accent);
}

.hero h2 span {
  display: inline-block;
  white-space: nowrap;
}

.feature-stack {
  margin-top: 34px;
  display: grid;
  gap: 14px;
  width: min(100%, 520px);
}

.feature-card {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 16px;
  align-items: center;
  min-height: 96px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 122, 0, 0.08);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(12, 13, 15, 0.94), rgba(20, 21, 24, 0.72));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.feature-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 122, 0, 0.65);
  border-radius: 50%;
  color: var(--accent);
  font-size: 28px;
  background: rgba(255, 122, 0, 0.08);
}

.feature-card h3 {
  color: var(--accent);
  font-size: 21px;
  letter-spacing: 0.08em;
}

.feature-card p {
  margin-top: 5px;
  color: #efe9df;
  line-height: 1.55;
}

.tagline {
  margin-top: 26px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.38;
}

.hero-metrics {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  max-width: 900px;
  margin-left: auto;
}

.hero-metrics div {
  padding: 13px 16px;
  border: 1px solid rgba(255, 122, 0, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.62);
  text-align: center;
}

.hero-metrics span {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.hero-metrics small,
.muted {
  color: var(--muted);
}

.phone-stage {
  min-height: 650px;
  align-self: stretch;
}

.phone {
  position: absolute;
  width: 250px;
  min-height: 470px;
  padding: 20px 14px;
  border: 5px solid #070707;
  border-radius: 34px;
  background: linear-gradient(180deg, #101214, #050607);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.66);
  outline: 1px solid rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.phone::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 82px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 0 0 14px 14px;
  background: #030303;
}

.phone-top {
  color: #f4f4f4;
  font-size: 12px;
  margin-bottom: 16px;
}

.phone h3 {
  text-align: center;
  margin-bottom: 12px;
}

.phone-list {
  left: 2%;
  bottom: 70px;
  transform: scale(0.94);
}

.phone-main {
  left: 33%;
  bottom: 50px;
  width: 285px;
  min-height: 560px;
  z-index: 3;
}

.phone-pattern {
  right: 1%;
  bottom: 78px;
  transform: scale(0.90);
}

.phone-tabs {
  display: flex;
  justify-content: space-around;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
  margin-bottom: 12px;
}

.phone-tabs span:first-child {
  color: var(--accent);
}

.race-preview,
.readability-mini,
.pattern-mini p,
.ranking-mini p {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.race-preview {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 13px;
  margin-bottom: 10px;
}

.race-preview.active {
  border-color: rgba(255, 122, 0, 0.7);
  background: radial-gradient(circle at 90% 50%, rgba(255, 122, 0, 0.22), rgba(255, 255, 255, 0.035));
}

.race-preview em {
  position: absolute;
  right: 14px;
  top: 12px;
  color: var(--accent);
  font-size: 34px;
  font-style: normal;
  font-weight: 900;
}

.race-preview small {
  color: var(--muted);
}

.readability-mini {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.readability-mini span {
  color: var(--muted);
  font-size: 12px;
}

.readability-mini strong {
  color: var(--accent);
  font-size: 54px;
  line-height: 1;
}

.readability-mini em {
  align-self: end;
  color: #fff;
  font-style: normal;
  font-size: 24px;
}

.chart-lines {
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 100% 25%, 20% 100%;
  position: relative;
  overflow: hidden;
}

.chart-lines i {
  position: absolute;
  left: -8%;
  width: 116%;
  height: 2px;
  background: var(--accent);
  transform: rotate(-10deg);
}

.chart-lines i:nth-child(1) { top: 40%; background: #ff7a00; }
.chart-lines i:nth-child(2) { top: 48%; background: #ff2d2d; transform: rotate(7deg); }
.chart-lines i:nth-child(3) { top: 58%; background: #ffd60a; transform: rotate(-4deg); }
.chart-lines i:nth-child(4) { top: 68%; background: #34c759; transform: rotate(5deg); }
.chart-lines i:nth-child(5) { top: 76%; background: #64d2ff; transform: rotate(-6deg); }

.ranking-mini {
  margin-top: 12px;
  display: grid;
  gap: 7px;
}

.ranking-mini p,
.pattern-mini p {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
}

.ranking-mini b,
.pattern-mini b {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 4px;
  background: var(--panel-2);
}

.ranking-mini span,
.pattern-mini em {
  color: #f2f2f2;
  font-style: normal;
}

.pattern-mini {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.toolbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  padding: 14px;
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input {
  width: 100%;
  color: var(--text);
  background: #07080a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.primary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  min-height: 42px;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #111;
  padding: 0 18px;
  font-weight: 800;
}

.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  background: #0b0c0f;
  color: var(--text);
  padding: 0 16px;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 20px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.grid.three {
  grid-template-columns: 0.8fr 1.1fr 1.1fr;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header.compact {
  margin-bottom: 10px;
}

.pill {
  color: var(--accent-2);
  border: 1px solid rgba(255, 122, 0, 0.35);
  background: rgba(255, 122, 0, 0.08);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.venue-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.venue-card {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 12px;
}

.venue-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

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

.race-button {
  border: 1px solid var(--line);
  background: #0b0c0f;
  color: var(--text);
  min-width: 48px;
  min-height: 34px;
  border-radius: 6px;
  cursor: pointer;
}

.race-button:hover,
.race-button.selected {
  border-color: var(--accent);
  color: var(--accent);
}

.entry-list,
.mini-list,
.similar-list {
  display: grid;
  gap: 9px;
}

.entry-row,
.mini-row,
.similar-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0c0f;
}

.lane {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 900;
  background: var(--panel-2);
}

.lane-1 { color: #f4f4f4; }
.lane-2 { color: #1f1f1f; background: #f2f2f2; }
.lane-3 { color: var(--red); }
.lane-4 { color: var(--blue); }
.lane-5 { color: #ffd60a; }
.lane-6 { color: var(--green); }

.entry-main strong,
.mini-row strong,
.similar-row strong {
  display: block;
}

.entry-main span,
.mini-row span,
.similar-row span {
  color: var(--muted);
  font-size: 12px;
}

.readability {
  display: flex;
  gap: 16px;
  align-items: center;
}

.readability strong {
  color: var(--accent);
  font-size: 72px;
  line-height: 1;
}

.readability span {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.readability small {
  color: var(--muted);
}

.elo-bar {
  height: 8px;
  border-radius: 8px;
  overflow: hidden;
  background: #050505;
  margin-top: 8px;
}

.elo-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.empty {
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.skeleton {
  min-height: 180px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 122, 0, 0.35);
  border-radius: 8px;
  background: #111316;
  color: var(--text);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    height: auto;
    grid-template-columns: auto 1fr;
    padding: 12px 18px;
  }

  .status-card {
    display: none;
  }

  .hero,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 42px;
  }

  .phone-stage {
    min-height: 620px;
  }
}

@media (max-width: 680px) {
  .sidebar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .brand {
    justify-content: center;
  }

  .nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item,
  .nav-link {
    flex: 0 0 auto;
  }

  .main {
    padding: 0 12px 12px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .hero {
    padding: 20px;
    background-position: center top;
  }

  .hero h2 {
    font-size: 40px;
  }

  .hero-copy {
    font-size: 20px;
  }

  .feature-card {
    grid-template-columns: 58px 1fr;
    padding: 13px;
  }

  .feature-icon {
    width: 46px;
    height: 46px;
    font-size: 22px;
  }

  .tagline {
    font-size: 28px;
  }

  .hero-metrics {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    grid-template-columns: 1fr 1fr;
    margin-top: 22px;
  }

  .phone-stage {
    display: none;
  }
}
