:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #68717c;
  --line: #d9ded8;
  --accent: #2f6f73;
  --accent-dark: #1f4f54;
  --gold: #b98b2f;
  --danger: #a84343;
  --shadow: 0 18px 45px rgba(24, 32, 42, 0.09);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.quarto-title-block,
#quarto-header,
#title-block-header {
  display: none;
}

.page-layout-full .page-columns {
  display: block;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 28px;
  align-items: end;
  max-width: 1280px;
  margin: 0 auto 22px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.1rem, 4vw, 4.6rem);
  line-height: 1;
  font-weight: 850;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.search-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

#player-search {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

#player-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 115, 0.18);
  outline: none;
}

#player-search:disabled {
  color: var(--muted);
  cursor: wait;
}

.status-line {
  min-height: 22px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-line.error {
  color: var(--danger);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 22px;
  max-width: 1280px;
  margin: 0 auto;
}

.results-panel,
.detail-panel {
  min-height: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.results-panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

#result-count {
  min-width: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf4f3;
  color: var(--accent-dark);
  text-align: center;
  font-weight: 800;
}

.player-results {
  max-height: 650px;
  overflow: auto;
}

.result-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.result-button:hover,
.result-button:focus,
.result-button.active {
  background: #edf4f3;
  outline: none;
}

.result-name {
  display: block;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-detail {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.level-badge {
  align-self: start;
  min-width: 48px;
  padding: 4px 8px;
  border: 1px solid rgba(185, 139, 47, 0.35);
  border-radius: 999px;
  color: #765716;
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
}

.detail-panel {
  padding: 22px;
}

.empty-state {
  display: grid;
  min-height: 510px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.empty-state p {
  max-width: 460px;
  color: var(--muted);
}

.comparison-view.hidden,
.hidden {
  display: none;
}

.selected-player {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.selected-player h2 {
  font-size: 1.8rem;
}

.selected-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(78px, auto));
  gap: 10px;
  margin: 0;
}

.selected-meta div {
  min-width: 78px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.selected-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.selected-meta dd {
  margin: 2px 0 0;
  font-weight: 850;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

td:nth-child(1),
td:nth-child(3),
td:nth-child(4),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9),
td:nth-child(10) {
  font-variant-numeric: tabular-nums;
}

.score {
  color: var(--accent-dark);
  font-weight: 900;
}

.selected-value,
.comp-value {
  display: block;
  min-width: 54px;
}

.selected-value {
  color: var(--muted);
  font-size: 0.78rem;
}

.comp-value {
  margin-top: 2px;
  color: var(--ink);
  font-weight: 850;
}

.reached-mlb {
  font-weight: 900;
}

.mlb-wraa {
  font-weight: 850;
  white-space: nowrap;
}

#projection-panel {
  margin-top: 18px;
}

.projections-section {
  border-top: 0;
  padding: 16px 0 2px;
}

.projection-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(240px, 1.4fr);
  gap: 14px;
  align-items: stretch;
}

.proj-reach,
.proj-wraa {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.proj-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.proj-value.big {
  display: block;
  margin-top: 4px;
  font-size: 1.6rem;
  font-weight: 900;
}

.proj-range {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  font-weight: 850;
}

.proj-range .median {
  font-weight: 950;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 14px;
  }

  .search-panel,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .search-panel {
    padding: 20px;
  }

  .results-panel,
  .detail-panel {
    min-height: auto;
  }

  .selected-player {
    display: block;
  }

  .selected-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
  }

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