:root {
  --bg: #f7f1e8;
  --paper: rgba(255, 251, 245, 0.88);
  --paper-strong: #fffaf2;
  --ink: #162119;
  --muted: #5f6b60;
  --line: rgba(29, 44, 31, 0.1);
  --brand: #bd5b3d;
  --brand-deep: #8d3b22;
  --accent: #1f6b54;
  --accent-soft: rgba(31, 107, 84, 0.12);
  --gold: #d9a24c;
  --shadow: 0 18px 40px rgba(53, 35, 16, 0.08);
  --radius: 24px;
  --radius-sm: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 162, 76, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(31, 107, 84, 0.12), transparent 26%),
    linear-gradient(180deg, #f4ecdf 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(189, 91, 61, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(189, 91, 61, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.36), transparent 85%);
}

.page-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 8px 0 20px;
}

.app-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.app-bar,
.panel,
.result-card,
.pick-card {
  background: var(--paper);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.app-bar {
  border-radius: 24px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #3b2d1c 0%, #2c2217 100%);
  border-color: rgba(59, 45, 28, 0.9);
  box-shadow: none;
}

.app-bar h1,
.panel h2,
.pick-card h2,
.result-card h3 {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.app-bar h1 {
  margin: 0;
  font-size: clamp(1.28rem, 2vw, 1.9rem);
  line-height: 1.02;
  color: #fff7ea;
}

.hero-subline {
  margin: 6px 0 0;
  color: rgba(244, 231, 209, 0.72);
  font-size: 0.88rem;
  line-height: 1.15;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.82);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.app-bar-stats {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mini-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 76px;
  padding: 7px 9px;
  border-radius: 13px;
  background: rgba(255, 247, 234, 0.05);
  border: 1px solid rgba(255, 247, 234, 0.1);
}

.mini-metric strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.94rem;
  color: #fff7ea;
}

.mini-metric span {
  color: rgba(244, 231, 209, 0.72);
  font-size: 0.72rem;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 14px;
}

.filters-shell {
  display: block;
}

.filters-toggle {
  display: none;
}

.filters-toggle-copy {
  display: grid;
  gap: 2px;
}

.filters-toggle-copy strong {
  font-size: 0.9rem;
  line-height: 1.05;
}

.filters-toggle-copy span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.15;
}

.controls,
.results {
  display: grid;
  gap: 8px;
  align-content: start;
}

.panel {
  border-radius: var(--radius);
  padding: 12px;
}

.panel.muted {
  background: rgba(247, 244, 237, 0.94);
}

.panel-head,
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 1rem;
}

.field {
  margin-top: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(22, 33, 25, 0.06);
}

.field-emphasis {
  background: rgba(255, 248, 239, 0.78);
  border-color: rgba(189, 91, 61, 0.14);
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.pill-grid,
.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-grid.compact {
  gap: 6px;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.86);
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: 180ms ease;
  font: inherit;
  font-size: 0.84rem;
}

.pill:hover {
  transform: translateY(-1px);
  border-color: rgba(189, 91, 61, 0.28);
}

.pill.active {
  background: linear-gradient(135deg, var(--brand), #cb7b55);
  color: white;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(189, 91, 61, 0.24);
}

.ghost-button,
.text-button,
.tag-button {
  border: 0;
  background: transparent;
  color: var(--brand-deep);
  font: inherit;
  cursor: pointer;
}

.ghost-button {
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(189, 91, 61, 0.08);
  font-size: 0.85rem;
}

.text-button {
  padding: 0;
  font-size: 0.88rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.range-scale,
.helper,
.subtle {
  color: var(--muted);
  font-size: 0.76rem;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.search-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  color: var(--ink);
}

.search-input:focus {
  outline: 2px solid rgba(31, 107, 84, 0.18);
  border-color: rgba(31, 107, 84, 0.28);
}

.search-results {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  max-height: 184px;
  overflow: auto;
}

.compact-results {
  max-height: 132px;
}

.search-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.85);
  text-align: left;
  cursor: pointer;
}

.search-item strong {
  display: block;
  font-size: 0.84rem;
}

.search-item span {
  color: var(--muted);
  font-size: 0.76rem;
}

.search-title {
  font-size: 0.81rem !important;
  font-weight: 600;
  line-height: 1.15;
}

.search-meta {
  margin-top: 2px;
  font-size: 0.7rem !important;
  line-height: 1.15;
}

.search-action {
  font-size: 0.72rem !important;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(31, 107, 84, 0.1);
  color: var(--accent);
}

.selected-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.summary-item {
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.summary-item strong {
  display: block;
  margin-top: 3px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.84rem;
}

.top-pick {
  display: grid;
}

.pick-card {
  border-radius: 30px;
  padding: 12px;
  overflow: hidden;
  position: relative;
}

.pick-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -70px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 107, 84, 0.17), transparent 70%);
}

.pick-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.pick-copy {
  display: grid;
  gap: 6px;
}

.pick-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pick-kicker {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(189, 91, 61, 0.12);
  border: 1px solid rgba(189, 91, 61, 0.18);
  color: var(--brand-deep);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pick-card h2 {
  margin: 0;
  font-size: clamp(1.18rem, 1.9vw, 1.65rem);
  line-height: 0.98;
}

.pick-bank {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.score-wrap {
  display: flex;
  align-items: start;
}

.score-badge {
  min-width: 84px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #2f8b6d);
  color: white;
  text-align: center;
}

.score-badge strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
}

.score-badge span {
  font-size: 0.7rem;
}

.score-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.info-dot {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(22, 33, 25, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  padding: 0;
}

.tooltip-card {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(22, 33, 25, 0.94);
  color: #fff7ea;
  font-size: 0.74rem;
  line-height: 1.3;
  box-shadow: 0 14px 30px rgba(22, 33, 25, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 5;
}

.tooltip-wrap:hover .tooltip-card,
.tooltip-wrap:focus-within .tooltip-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.pick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.stat-tile {
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.stat-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.stat-tile strong {
  display: block;
  margin-top: 3px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.88rem;
}

.pick-details {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 8px;
  margin-top: 8px;
  align-items: start;
}

.detail-box {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.detail-box h3 {
  margin: 0 0 8px;
  font-size: 0.84rem;
  font-family: "Space Grotesk", sans-serif;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(22, 33, 25, 0.08);
}

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

.detail-row strong {
  font-size: 0.82rem;
  line-height: 1.2;
}

.detail-row span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.results-grid {
  display: grid;
  gap: 8px;
}

.results-note {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.result-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  border-radius: 18px;
  padding: 9px 10px;
}

.rank-pill {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff6eb, #f5dfc8);
  color: var(--brand-deep);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}

.result-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.result-main h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.08;
}

.result-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.result-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.metric-chip {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(31, 107, 84, 0.08);
  color: var(--accent);
  font-size: 0.7rem;
}

.result-side {
  min-width: 64px;
  text-align: right;
}

.result-side strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
}

.result-side span {
  color: var(--muted);
  font-size: 0.66rem;
}

.mobile-inline {
  display: none;
}

.desktop-only {
  display: block;
}

.result-details {
  margin-top: 6px;
  border-top: 1px solid rgba(22, 33, 25, 0.08);
  padding-top: 6px;
}

.result-details summary {
  cursor: pointer;
  color: var(--brand-deep);
  font-size: 0.74rem;
  font-weight: 700;
  list-style: none;
}

.result-details summary::-webkit-details-marker {
  display: none;
}

.result-details summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.result-details[open] summary::after {
  content: "-";
}

.match-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.match-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(22, 33, 25, 0.07);
}

.match-item strong {
  display: block;
  font-size: 0.8rem;
}

.match-item span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.empty-state {
  text-align: center;
}

.hidden {
  display: none !important;
}

.explain-list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.explain-list li + li {
  margin-top: 8px;
}

@media (max-width: 1080px) {
  .app-bar,
  .app-layout,
  .pick-details {
    grid-template-columns: 1fr;
  }

  .app-bar-stats {
    flex-wrap: wrap;
  }

  .summary-strip,
  .pick-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls {
    order: 2;
  }

  .results {
    order: 1;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 10px;
  }

  .app-bar,
  .panel,
  .pick-card {
    padding: 14px;
    border-radius: 18px;
  }

  .controls {
    position: relative;
    top: auto;
    z-index: auto;
    order: 1;
  }

  .results {
    order: 2;
  }

  .filters-shell {
    border-radius: 18px;
    background: var(--paper);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 4px;
  }

  .filters-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    list-style: none;
  }

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

  .filters-toggle-copy {
    max-width: calc(100% - 56px);
  }

  .filters-toggle::after {
    content: "Show";
    color: var(--muted);
    font-family: "Source Sans 3", sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
  }

  .filters-shell[open] .filters-toggle::after {
    content: "Hide";
  }

  .filters-shell > .panel {
    border-radius: 0;
    border: 0;
    border-top: 1px solid rgba(22, 33, 25, 0.06);
    box-shadow: none;
    background: transparent;
  }

  .filters-shell:not([open]) > .panel {
    display: none;
  }

  .app-bar h1 {
    font-size: 1.35rem;
  }

  .hero-subline {
    font-size: 0.8rem;
  }

  .summary-strip,
  .pick-stats {
    grid-template-columns: 1fr;
  }

  .summary-item strong,
  .stat-tile strong {
    font-size: 0.92rem;
  }

  .result-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .result-side {
    text-align: left;
  }

  .desktop-only {
    display: none;
  }

  .mobile-inline {
    display: block;
    min-width: auto;
    text-align: right;
  }

  .result-title-row {
    align-items: center;
  }

  .match-item {
    flex-direction: column;
    gap: 5px;
  }

  .pick-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .score-wrap {
    align-self: flex-start;
  }

  .tooltip-card {
    right: auto;
    left: 0;
  }

  .field {
    margin-top: 8px;
    padding: 9px;
  }

  .search-results {
    max-height: 168px;
  }

  .compact-results {
    max-height: 120px;
  }

  .pick-details {
    grid-template-columns: 1fr;
  }
}
