/* UK Long-Shot Finder — Horse Racing Theme */
:root {
  --turf-dark: #1B7D3A;
  --turf-bright: #2ECC71;
  --gold: #D4AF37;
  --gold-bright: #F5C518;
  --burgundy: #7B1E3A;
  --burgundy-light: #9B2335;
  --navy: #1A2744;
  --navy-mid: #2D4A7A;
  --cream: #FFF8E7;
  --cream-dim: #F0E6CC;
  --white: #FFFFFF;
  --shadow: 0 8px 32px rgba(26, 39, 68, 0.18);
  --radius: 14px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: linear-gradient(160deg, var(--cream) 0%, #E8F5E9 40%, var(--cream-dim) 100%);
  color: var(--navy);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Hero ── */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 4px solid var(--gold);
  min-height: 460px;
  background: var(--navy);
}

.hero img {
  width: 100%;
  height: 460px;
  display: block;
  object-fit: cover;
  object-position: center 44%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 22, 42, 0.96) 0%, rgba(18, 38, 66, 0.78) 35%, rgba(26,39,68,0.08) 70%),
    linear-gradient(to top, rgba(10, 22, 42, 0.7) 0%, transparent 55%);
  pointer-events: none;
}

.hero-content {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: max(1.5rem, calc((100% - 1100px) / 2));
  transform: translateY(-50%);
  color: var(--white);
  max-width: 560px;
  padding: 1rem;
}

.hero-kicker {
  color: var(--gold-bright);
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.hero-content h1 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.84;
  letter-spacing: -0.04em;
  text-shadow: 0 3px 24px rgba(0,0,0,0.35);
}

.hero-content h1 span { color: var(--gold-bright); }

.hero-content p {
  margin-top: 1.1rem;
  font-size: 1rem;
  color: var(--cream);
  max-width: 480px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.hero-badges span {
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(245,197,24,0.7);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(26,39,68,0.6);
  backdrop-filter: blur(4px);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* ── Disclaimer Banner ── */
.disclaimer-banner {
  background: linear-gradient(90deg, var(--burgundy), var(--burgundy-light));
  color: var(--cream);
  padding: 0.85rem 1.25rem;
  font-size: 0.82rem;
  text-align: center;
  border-bottom: 2px solid var(--gold);
  animation: slideDown 0.6s ease-out;
}

.disclaimer-banner strong { color: var(--gold-bright); }

.disclaimer-banner a {
  color: var(--gold-bright);
  text-decoration: underline;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Header stats bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: -2rem auto 2rem;
  position: relative;
  z-index: 2;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--turf-dark);
  animation: fadeUp 0.5s ease-out both;
}

.stat-card:nth-child(2) { border-left-color: var(--gold); animation-delay: 0.1s; }
.stat-card:nth-child(3) { border-left-color: var(--burgundy); animation-delay: 0.2s; }
.stat-card:nth-child(4) { border-left-color: var(--navy-mid); animation-delay: 0.3s; }

.stat-card .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  font-family: var(--font-display);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Section titles ── */
.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--burgundy);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 1.4rem;
  background: var(--gold);
  border-radius: 2px;
}

/* ── How to use ── */
.how-to {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--turf-dark), var(--turf-bright));
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.step h3 {
  font-size: 0.95rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.step p {
  font-size: 0.85rem;
  color: #475569;
}

/* ── Guardrails panel ── */
.guardrails {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.chip {
  background: var(--navy);
  color: var(--gold-bright);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.chip.green { background: var(--turf-dark); color: var(--cream); }
.chip.gold { background: var(--gold); color: var(--navy); }
.chip.burgundy { background: var(--burgundy); color: var(--cream); }

/* ── Controls ── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--turf-dark), var(--turf-bright));
  color: var(--white);
  box-shadow: 0 4px 16px rgba(27, 125, 58, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(27, 125, 58, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--gold);
}

.scan-status {
  font-size: 0.9rem;
  color: var(--navy-mid);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--cream-dim);
  border-top-color: var(--turf-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results grid ── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.pick-section { margin-bottom: 2rem; }

.pick-section-heading {
  margin-bottom: 0.85rem;
  border-left: 4px solid var(--turf-dark);
  padding-left: 0.85rem;
}

.pick-section-heading h3 {
  color: var(--navy);
  font-family: var(--font-display);
}

.pick-section-heading p {
  color: #64748b;
  font-size: 0.82rem;
}

.pick-section.tier-one .pick-section-heading { border-left-color: var(--gold); }
.pick-section.watchlist { opacity: 0.92; }

.pick-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(27, 125, 58, 0.15);
  animation: cardIn 0.45s ease-out both;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pick-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(26, 39, 68, 0.15);
}

.pick-card.tier-one {
  border: 2px solid var(--gold);
  box-shadow: 0 10px 36px rgba(212, 175, 55, 0.25);
}

.tier-one-badge {
  display: inline-block;
  margin-bottom: 0.3rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--gold-bright);
  color: var(--navy);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes cardIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.pick-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: var(--cream);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.pick-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--gold-bright);
}

.pick-meta {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.2rem;
}

.odds-badge {
  background: var(--burgundy);
  color: var(--gold-bright);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
}

.odds-badge .odds-frac {
  display: block;
  font-size: 0.72rem;
  opacity: 0.9;
  font-weight: 600;
}

.odds-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.odds-row .odds-label { color: #64748b; min-width: 4rem; }
.odds-row .odds-val { font-weight: 700; color: var(--burgundy); }

.pick-body { padding: 1rem 1.25rem; }

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.score-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--cream-dim);
  border-radius: 4px;
  margin: 0 0.75rem;
  overflow: hidden;
}

.score-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--turf-dark), var(--gold));
  border-radius: 4px;
  transition: width 1s ease-out;
}

.confidence {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.confidence.high { background: #DCFCE7; color: #166534; }
.confidence.medium { background: #FEF9C3; color: #854D0E; }
.confidence.low { background: #FEE2E2; color: #991B1B; }

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0;
}

.signal-tag {
  background: #ECFDF5;
  color: var(--turf-dark);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(27, 125, 58, 0.2);
}

.pick-reason {
  font-size: 0.85rem;
  color: #475569;
  font-style: italic;
  border-left: 3px solid var(--gold);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
}

.pick-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.75rem;
}

.feedback-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--cream-dim);
}

.feedback-btn {
  flex: 1;
  padding: 0.4rem;
  border: 1px solid #CBD5E1;
  background: var(--white);
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}

.feedback-btn:hover { background: var(--cream); }
.feedback-btn.won:hover { background: #DCFCE7; border-color: var(--turf-dark); }
.feedback-btn.placed:hover { background: #FEF9C3; border-color: var(--gold); }
.feedback-btn.lost:hover { background: #FEE2E2; border-color: var(--burgundy); }
.feedback-btn.logged { opacity: 0.6; cursor: default; }

.pick-card.outcome-won { border-color: var(--turf-dark); }
.pick-card.outcome-placed { border-color: var(--gold); }
.pick-card.outcome-lost { border-color: #CBD5E1; }

/* ── Settlement banner ── */
.settlement-banner {
  background: linear-gradient(90deg, #ECFDF5, #D1FAE5);
  border: 2px solid var(--turf-dark);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: #166534;
  animation: fadeUp 0.4s ease-out;
}

.settlement-banner strong { color: var(--turf-dark); }

/* ── History panel ── */
.history-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.history-intro {
  font-size: 0.88rem;
  color: #64748b;
  margin-bottom: 1rem;
}

.history-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--cream);
  border-radius: 8px;
}

.history-stat {
  font-size: 0.85rem;
  color: var(--navy);
}

.history-stat span {
  font-weight: 700;
  color: var(--burgundy);
}

.history-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.45rem 1rem;
  border: 2px solid var(--cream-dim);
  background: var(--white);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--navy);
}

.tab-btn.active {
  background: var(--turf-dark);
  color: var(--white);
  border-color: var(--turf-dark);
}

.history-content {
  max-height: 420px;
  overflow-y: auto;
}

.history-empty {
  text-align: center;
  color: #94a3b8;
  padding: 2rem;
  font-size: 0.9rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.history-table th {
  text-align: left;
  padding: 0.5rem 0.65rem;
  background: var(--navy);
  color: var(--gold-bright);
  position: sticky;
  top: 0;
}

.history-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--cream-dim);
}

.history-table tr:hover td { background: #F8FAF8; }

.outcome-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.outcome-pill.won { background: #DCFCE7; color: #166534; }
.outcome-pill.placed { background: #FEF9C3; color: #854D0E; }
.outcome-pill.lost { background: #FEE2E2; color: #991B1B; }

.signal-perf-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.signal-perf-bar {
  flex: 1;
  height: 6px;
  background: var(--cream-dim);
  border-radius: 3px;
  overflow: hidden;
}

.signal-perf-fill {
  height: 100%;
  background: var(--turf-dark);
  border-radius: 3px;
}

.signal-performance-grid {
  min-width: 650px;
  font-size: 0.8rem;
}

.signal-performance-head,
.signal-performance-row {
  display: grid;
  grid-template-columns: 1.5fr 0.75fr 1fr 0.7fr 0.8fr 0.8fr;
  gap: 0.6rem;
  align-items: center;
  padding: 0.6rem 0.7rem;
}

.signal-performance-head {
  position: sticky;
  top: 0;
  background: var(--navy);
  color: var(--gold-bright);
  font-weight: 700;
}

.signal-performance-row { border-bottom: 1px solid var(--cream-dim); }
.signal-performance-row .positive { color: #166534; }
.signal-performance-row .negative { color: #991b1b; }

.recommendation {
  width: fit-content;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  text-transform: capitalize;
  font-weight: 700;
}

.recommendation.promote { background: #dcfce7; color: #166534; }
.recommendation.hold { background: #fef9c3; color: #854d0e; }
.recommendation.demote { background: #fee2e2; color: #991b1b; }

/* ── Empty / error states ── */
.empty-state, .error-state {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty-state h3, .error-state h3 {
  font-family: var(--font-display);
  color: var(--burgundy);
  margin-bottom: 0.5rem;
}

/* ── Learning panel ── */
.learning-panel {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 2rem;
  border: 2px solid var(--gold);
}

.learning-panel h3 {
  font-family: var(--font-display);
  color: var(--gold-bright);
  margin-bottom: 0.75rem;
}

.learning-panel p { font-size: 0.88rem; opacity: 0.9; }

.learning-stats {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.learning-stat span {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-bright);
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.78rem;
  color: #64748b;
  border-top: 1px solid rgba(212, 175, 55, 0.3);
  margin-top: 2rem;
}

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

/* ── Responsive ── */
@media (max-width: 600px) {
  .hero, .hero img { min-height: 410px; height: 410px; }
  .hero img { object-position: 62% center; }
  .hero-overlay {
    background: linear-gradient(90deg, rgba(10,22,42,0.95), rgba(10,22,42,0.48));
  }
  .hero-content { left: 0.75rem; right: 0.75rem; }
  .hero-content h1 { font-size: 3.4rem; }
  .stats-bar { margin-top: 1rem; }
  .pick-header { flex-direction: column; gap: 0.5rem; }
  .results-grid { grid-template-columns: 1fr; }
}

/* ── Racing Chronicle edition ── */
:root {
  --ink: #18231d;
  --muted-ink: #5d665f;
  --paper: #f7f2e7;
  --paper-deep: #ede3d1;
  --rule: #c9bda7;
  --turf-dark: #174c35;
  --turf-bright: #2d7a55;
  --gold: #b28a35;
  --gold-bright: #e7c66d;
  --burgundy: #762d35;
  --burgundy-light: #98424a;
  --navy: #1d3028;
  --navy-mid: #385247;
  --cream: #f8f2e5;
  --cream-dim: #e9dfcd;
  --white: #fffdf8;
  --shadow: 0 14px 34px rgba(37, 48, 40, 0.11);
  --radius: 4px;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 253, 248, 0.82), rgba(255, 253, 248, 0.82)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(73, 63, 48, 0.035) 31px 32px),
    var(--paper);
}

.edition-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0.55rem max(1rem, calc((100% - 1180px) / 2));
  border-bottom: 1px solid #19251f;
  background: var(--paper);
  color: var(--muted-ink);
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.edition-date-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.edition-date-controls label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-date-input {
  border: 1px solid var(--cream-dim);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  font: inherit;
  background: #fff;
}

.btn-link {
  border: 0;
  background: none;
  color: var(--turf-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.radar-gear {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--navy-mid);
}

.edition-bar strong {
  color: var(--ink);
  font-size: 0.85rem;
  text-align: center;
}

.edition-bar span:last-child { text-align: right; }

.hero,
.hero img {
  height: 390px;
  min-height: 390px;
}

.hero img {
  object-position: center 42%;
  filter: saturate(0.82) contrast(1.04);
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(15, 32, 24, 0.96) 0%, rgba(21, 47, 35, 0.8) 40%, rgba(19, 39, 30, 0.15) 74%),
    linear-gradient(to top, rgba(11, 29, 21, 0.68), transparent 58%);
}

.hero-content {
  left: max(1.5rem, calc((100% - 1180px) / 2));
  max-width: 620px;
}

.hero-content h1 {
  font-size: clamp(3.4rem, 7vw, 6.2rem);
  font-weight: 700;
  letter-spacing: -0.055em;
}

.hero-deck {
  max-width: 530px;
  font-family: var(--font-display);
  font-size: 1.08rem !important;
  line-height: 1.45;
}

.container {
  max-width: 1180px;
  padding-bottom: 4rem;
}

.stats-bar {
  gap: 0;
  margin-top: -1.45rem;
  border: 1px solid var(--rule);
  background: var(--white);
  box-shadow: var(--shadow);
}

.stat-card {
  border: 0;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
}

.stat-card:last-child { border-right: 0; }
.stat-card .value { color: var(--ink); }

.section-label {
  margin-bottom: 0.35rem;
  color: var(--burgundy);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-title {
  color: var(--ink);
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.section-title::before { display: none; }

.how-to,
.history-panel,
.learning-desk {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}

.how-to {
  padding: 1.65rem 1.8rem;
}

.steps {
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
}

.step {
  min-width: 0;
  padding: 1rem;
  border-right: 1px solid var(--rule);
}

.step:last-child { border-right: 0; }

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 0;
  background: var(--ink);
  font-family: var(--font-display);
}

.step h3 { font-family: var(--font-display); font-size: 1rem; }

.learning-desk {
  margin: 2.2rem 0;
  overflow: hidden;
}

.learning-heading {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  padding: 1.5rem 1.7rem 1.25rem;
  border-bottom: 3px double var(--ink);
}

.learning-heading h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.55rem);
}

.learning-heading p {
  max-width: 670px;
  color: var(--muted-ink);
  font-size: 0.86rem;
}

.storage-seal {
  flex: 0 0 auto;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--turf-dark);
  color: var(--turf-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.learning-layout {
  display: grid;
  grid-template-columns: 180px 1fr minmax(280px, 0.9fr);
  min-height: 230px;
}

.learning-progress-wrap,
.learning-copy,
.learning-signal-list {
  padding: 1.35rem 1.5rem;
}

.learning-progress-wrap {
  border-right: 1px solid var(--rule);
  text-align: center;
}

.learning-progress {
  display: grid;
  width: 112px;
  height: 112px;
  margin: 0 auto 0.8rem;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--turf-dark) var(--progress), var(--paper-deep) 0);
  position: relative;
  transition: background 700ms ease;
}

.learning-progress::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background: var(--white);
}

.learning-progress span {
  position: relative;
  font: 700 1.55rem var(--font-display);
}

.learning-progress-wrap > strong {
  display: block;
  font-family: var(--font-display);
}

.learning-progress-wrap p {
  margin-top: 0.25rem;
  color: var(--muted-ink);
  font-size: 0.72rem;
}

.learning-copy { border-right: 1px solid var(--rule); }

.learning-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.learning-metrics div {
  padding: 0.75rem;
  background: var(--white);
}

.learning-metrics span {
  display: block;
  color: var(--burgundy);
  font: 700 1.35rem var(--font-display);
}

.learning-metrics small,
.learning-highlight small {
  color: var(--muted-ink);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.learning-highlight {
  margin-top: 1rem;
  padding-left: 0.8rem;
  border-left: 3px solid var(--gold);
}

.learning-highlight strong,
.learning-highlight span {
  display: block;
}

.learning-highlight strong { font-family: var(--font-display); }
.learning-highlight span { color: var(--muted-ink); font-size: 0.72rem; }

.learning-signal-list { display: grid; align-content: start; gap: 0.6rem; }

.learning-signal-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
}

.learning-signal-item strong,
.learning-signal-item span { display: block; }
.learning-signal-item strong { font-family: var(--font-display); }
.learning-signal-item div span { color: var(--muted-ink); font-size: 0.68rem; }
.signal-lift { align-self: center; font-weight: 800; }
.signal-lift.positive { color: var(--turf-dark); }
.signal-lift.negative { color: var(--burgundy); }
.learning-waiting { color: var(--muted-ink); font-style: italic; }

.guardrails { margin-bottom: 1rem; }
.chip { border-radius: 2px; }
.chip.gold { background: #d7b85f; color: #17231d; }

.btn { border-radius: 2px; }

.results-grid {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  align-items: start;
}

.pick-section-heading {
  padding: 0.65rem 0;
  border: 0;
  border-top: 3px double var(--ink);
  border-bottom: 1px solid var(--rule);
}

.pick-card {
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: 0 8px 22px rgba(37, 48, 40, 0.09);
}

.pick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(37, 48, 40, 0.13);
}

.pick-header {
  background: var(--ink);
  padding: 1rem 1.1rem;
}

.pick-identity {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.racing-silk {
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.silk-placeholder {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 56px;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  color: var(--gold-bright);
  font: 700 1.2rem var(--font-display);
}

.pick-header h3 { font-size: 1.35rem; }

.race-edition-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font: 700 0.8rem var(--font-display);
}

.race-edition-line span:first-child {
  color: var(--burgundy);
  white-space: nowrap;
}

.race-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0.8rem 0;
  border: 1px solid var(--rule);
}

.race-facts > span {
  min-height: 48px;
  padding: 0.45rem;
  border-right: 1px solid var(--rule);
  font-size: 0.76rem;
  font-weight: 700;
}

.race-facts > span:last-child { border-right: 0; }
.race-facts small { display: block; color: var(--muted-ink); font-size: 0.58rem; text-transform: uppercase; }

.insight-box {
  margin-top: 0.9rem;
  padding: 0.85rem 0.9rem;
  border-top: 3px double var(--ink);
  border-bottom: 1px solid var(--rule);
  background: #faf6ed;
}

.insight-box > strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.insight-box ul {
  margin: 0.55rem 0 0 1rem;
  color: var(--muted-ink);
  font-size: 0.76rem;
}

.analyst-note {
  margin-top: 0.7rem;
  color: var(--muted-ink);
  font-size: 0.75rem;
}

.analyst-note span {
  display: block;
  color: var(--burgundy);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.automatic-result-row {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
}

.auto-result {
  display: inline-block;
  padding: 0.3rem 0.55rem;
  border: 1px solid currentColor;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auto-result.pending { color: #765d20; background: #fff9dc; }
.auto-result.won { color: #166534; background: #ecfdf5; }
.auto-result.placed { color: #854d0e; background: #fef9c3; }
.auto-result.lost { color: #7f1d1d; background: #fff1f2; }

.settlement-banner {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid var(--turf-dark);
  border-radius: 2px;
  background: #f2f7f2;
}

.settlement-banner.is-current { border-color: var(--gold); background: #fffbec; color: #5e4a18; }
.settlement-banner p { margin-top: 0.1rem; font-size: 0.76rem; }
.settlement-icon { font: 700 1.4rem var(--font-display); }

.history-panel { border-radius: 2px; }
.history-stats { border-radius: 0; border: 1px solid var(--rule); background: var(--paper); }
.tab-btn { border-radius: 2px; }
.history-table th { background: var(--ink); }
.history-table small { color: var(--muted-ink); }

.footer {
  border-top: 3px double var(--ink);
  background: var(--paper-deep);
  color: #465149;
}

@media (max-width: 900px) {
  .edition-bar { grid-template-columns: 1fr; text-align: center; }
  .edition-bar span:last-child { text-align: center; }
  .steps { grid-template-columns: 1fr 1fr; }
  .step { border-bottom: 1px solid var(--rule); }
  .learning-layout { grid-template-columns: 150px 1fr; }
  .learning-signal-list { grid-column: 1 / -1; border-top: 1px solid var(--rule); }
  .learning-copy { border-right: 0; }
}

@media (max-width: 600px) {
  .hero,
  .hero img { height: 390px; min-height: 390px; }
  .hero-content h1 { font-size: 3.7rem; }
  .stats-bar { grid-template-columns: 1fr 1fr; }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card:nth-child(-n + 2) { border-bottom: 1px solid var(--rule); }
  .steps { grid-template-columns: 1fr; }
  .step { border-right: 0; }
  .learning-heading { display: block; }
  .storage-seal { display: inline-block; margin-top: 0.8rem; }
  .learning-layout { grid-template-columns: 1fr; }
  .learning-progress-wrap,
  .learning-copy { border-right: 0; border-bottom: 1px solid var(--rule); }
  .learning-signal-list { grid-column: auto; }
  .results-grid { grid-template-columns: 1fr; }
  .race-edition-line { grid-template-columns: 1fr; gap: 0.2rem; }
  .race-facts { grid-template-columns: 1fr 1fr; }
  .race-facts > span:nth-child(2) { border-right: 0; }
  .race-facts > span:nth-child(-n + 2) { border-bottom: 1px solid var(--rule); }
  .pick-details { grid-template-columns: 1fr; }
}

/* ── v18 Paper Radar ── */
.paper-radar-section {
  margin: 2rem 0;
  padding: 1.5rem;
  border: 2px solid var(--turf-dark);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.radar-intro {
  margin: 0.75rem 0 1rem;
  color: var(--navy-mid);
  font-size: 0.92rem;
}

.radar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.radar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.radar-panel {
  border: 1px solid var(--cream-dim);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--white);
}

.radar-panel h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.radar-panel-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 0.75rem;
}

.radar-signal-card {
  border: 1px solid var(--cream-dim);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: #f8fff9;
}

.radar-signal-card.liability-warning {
  border-color: var(--burgundy);
  background: #fff5f7;
}

.radar-signal-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.radar-btl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
}

.radar-btl strong { display: block; font-size: 0.95rem; }

.radar-list {
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.radar-list li {
  display: grid;
  gap: 0.15rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px dashed var(--cream-dim);
  font-size: 0.82rem;
}

.radar-odds, .radar-tag.pending {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--burgundy);
}

.radar-alert {
  border: 1px solid var(--gold);
  background: #fffbea;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.radar-warning {
  color: var(--burgundy);
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0.35rem 0 0.65rem;
}

.radar-empty {
  font-size: 0.82rem;
  color: #64748b;
}

.radar-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--cream-dim);
  font-size: 0.85rem;
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
}

.signal-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.signal-modal.open { display: flex; }

.signal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 39, 68, 0.55);
}

.signal-modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.signal-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 1rem 0;
}

.signal-modal-grid small {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
}

.signal-modal-profit {
  grid-column: 1 / -1;
  padding: 0.65rem;
  background: #ecfdf5;
  border-radius: 8px;
}

.signal-modal-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.82rem;
  margin-top: 0.75rem;
}

.signal-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .radar-grid { grid-template-columns: 1fr; }
  .radar-btl { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
