:root {
  --ink: #14221c;
  --ink-soft: #4a5c53;
  --paper: #f3efe6;
  --paper-2: #e7e1d4;
  --line: #d8d0c2;
  --brass: #8c6840;
  --brass-2: #c6a57a;
  --good: #1b7f45;
  --mid: #a56b10;
  --bad: #b4332c;
  --shadow: 0 18px 50px rgba(20, 34, 28, 0.14);
  --sans: "Outfit", "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--ink);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
}
.topbar { grid-column: 1 / -1; grid-row: 1; }
.panel { grid-column: 1; grid-row: 2; }
.map-wrap { grid-column: 2; grid-row: 2; }

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  padding: 14px 22px;
  background:
    radial-gradient(1200px 80px at 10% 0%, rgba(198, 165, 122, 0.18), transparent 50%),
    #10211a;
  color: #f4efe6;
  border-bottom: 1px solid rgba(198, 165, 122, 0.35);
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 {
  font-family: var(--serif);
  font-weight: 650;
  font-size: 28px;
  letter-spacing: 0.08em;
  margin: 0;
  line-height: 1;
}
.brand-kicker {
  margin: 0 0 2px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-2);
}
.top-lead {
  margin: 0;
  max-width: 640px;
  color: #d9d3c6;
  font-size: 14.5px;
  line-height: 1.45;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.updated {
  margin: 0;
  font-size: 12px;
  color: #b7c2ba;
  min-width: 9.5rem;
  text-align: right;
}

.btn, .btn-map {
  border: 1px solid rgba(198, 165, 122, 0.45);
  background: #1b3128;
  color: #f4efe6;
  border-radius: 999px;
  padding: 8px 14px;
}
.btn:hover { background: #244236; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.55; cursor: wait; }

.panel {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.panel.showing .summary,
.panel.showing .tools,
.panel.showing .fine { display: none; }
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 14px 8px;
}
.stat {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px 8px;
}
.stat .n {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat span:last-child {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stat:nth-child(1) .n { color: var(--good); }
.stat:nth-child(2) .n { color: var(--mid); }
.stat:nth-child(3) .n { color: var(--bad); }

.tools { padding: 8px 14px 0; }
.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
.search input:focus { border-color: #8c6840; }
.filters { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chip, .text-btn {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}
.chip.on, .text-btn.on {
  background: var(--ink);
  color: #f4efe6;
  border-color: var(--ink);
}
.sort-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.list {
  overflow: auto;
  padding: 6px 10px 12px;
  min-height: 0;
  flex: 1;
}
.card {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin: 0 0 6px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
}
.card:hover, .card.active { background: #fffdf8; border-color: var(--line); }
.score-pip {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 22px;
  color: white;
  font-variant-numeric: tabular-nums;
}
.card h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.meta { margin: 2px 0 0; color: var(--ink-soft); font-size: 12.5px; }
.rates { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 4px 0 0; font-size: 12px; font-weight: 600; }
.rates .absent { color: var(--ink-soft); font-weight: 500; }
.rate-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin: 0 0 12px;
}
.rate-card header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.rate-card h3 { margin: 0; font-size: 14px; }
.rate-card header p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.rate-basis { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; }
.rate-row {
  display: grid;
  grid-template-columns: 92px 1fr 42px;
  gap: 4px 8px;
  align-items: center;
  margin-top: 10px;
}
.rate-row > span:first-child { font-weight: 600; font-size: 14px; }
.rate-track { height: 8px; border-radius: 99px; background: #e7e1d4; overflow: hidden; }
.rate-track span { display: block; height: 100%; border-radius: 99px; }
.rate-row b { text-align: right; font-variant-numeric: tabular-nums; }
.delta { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; }
.delta.down { color: var(--good); }
.delta.up { color: var(--bad); }
.delta.flat { color: var(--ink-soft); }
.empty {
  padding: 28px 12px;
  color: var(--ink-soft);
  text-align: center;
}
.banner {
  margin: 4px 4px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fffdf8;
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.banner strong { color: var(--ink); }

.detail {
  position: absolute;
  inset: 0;
  background: var(--paper);
  overflow: auto;
  padding: 14px 16px 24px;
  z-index: 2;
}
.back { margin-bottom: 8px; }
.kicker {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--brass);
}
.detail h2 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.05;
  margin: 4px 0 8px;
  font-weight: 560;
}
.gauge-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  margin: 8px 0 14px;
}
.gauge {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e4ddd0 0);
}
.gauge span {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 26px;
}
.status-word { margin: 0; font-size: 18px; font-weight: 600; }
.odds { margin: 4px 0 0; font-size: 15px; }
.odds b { font-variant-numeric: tabular-nums; font-size: 18px; }
.odds-line { margin: 3px 0 0; font-size: 12.5px; font-weight: 650; }
.advice { margin: 4px 0 0; color: var(--ink-soft); line-height: 1.45; font-size: 14.5px; }
.should {
  background: #eef6ef;
  border: 1px solid #c9e0d0;
  border-radius: 16px;
  padding: 12px 14px;
  margin: 12px 0 0;
}
.should p { margin: 0; font-size: 14.5px; line-height: 1.45; }
.should .should-now { margin-top: 6px; font-weight: 600; }
.should .should-fit { margin-top: 4px; color: var(--ink-soft); font-size: 13.5px; }
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.metric {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.metric b {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}
.metric span { color: var(--ink-soft); font-size: 12px; }
.chart-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 12px 8px;
}
.chart-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.chart-card h3 { margin: 0; font-size: 14px; font-weight: 600; }
.chart-card p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: 168px; display: block; }
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: #f4efe6;
  font-size: 12px;
  padding: 4px 7px;
  border-radius: 8px;
  transform: translate(-50%, -130%);
  white-space: nowrap;
  display: none;
}
.species { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.species span, .warn {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12.5px;
  background: #e7f3ec;
  color: #145c34;
}
.warn {
  display: block;
  border-radius: 12px;
  background: #fbf1dc;
  color: #6d4a0d;
  padding: 10px 12px;
  line-height: 1.4;
  margin: 0 0 10px;
}
.note { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin: 0; }
.water { margin: 2px 0 0; font-size: 12.5px; font-weight: 650; }
.water-note { margin: 0 0 12px; color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; }
.bait { margin: 3px 0 0; color: var(--ink); font-size: 12px; line-height: 1.35; }
.bait-note { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.bait-note b { font-weight: 650; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.star { color: #c4b9a6; font-size: 18px; line-height: 1; cursor: pointer; }
.star.on { color: #a56b10; }
.star-lg { font-size: 22px; margin-left: 6px; }
.field, .cold, .ban { margin: 3px 0 0; font-size: 12px; line-height: 1.35; }
.cold { color: #3d5c8a; }
.ban { color: #8a3d2f; }
.today-card {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fffdf8;
  border: 1px solid var(--line);
}
.today-card h3 { margin: 0 0 6px; font-size: 14px; }
.today-card p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.45; }
.today-card p:last-child { margin-bottom: 0; }
.hours { margin: 8px 0 0; font-size: 13.5px; }
.fine {
  padding: 10px 14px 14px;
  color: #6d786f;
  font-size: 11.5px;
  line-height: 1.45;
  border-top: 1px solid var(--line);
}
.fine a { color: var(--brass); }

.map-wrap { position: relative; min-height: 0; height: 100%; }
#map { position: absolute; inset: 0; background: #d5dde2; }
.leaflet-interactive { cursor: pointer; }
.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution { font-size: 10px; max-width: 240px; background: rgba(255, 253, 248, 0.85); }
.card:focus-visible, .btn:focus-visible, .chip:focus-visible, .text-btn:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
.legend {
  position: absolute;
  z-index: 500;
  left: 14px;
  bottom: 28px;
  width: 210px;
  background: rgba(243, 239, 230, 0.94);
  border: 1px solid rgba(20, 34, 28, 0.12);
  border-radius: 14px;
  padding: 10px 12px 8px;
  box-shadow: var(--shadow);
}
.legend p { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.scale {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #b4332c 0%, #d0892a 48%, #1b7f45 100%);
}
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-top: 4px;
  color: var(--ink-soft);
}
.map-toggle {
  position: absolute;
  z-index: 500;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
}
.btn-map {
  background: rgba(244, 239, 230, 0.96);
  color: var(--ink);
  border-color: transparent;
  box-shadow: var(--shadow);
}
.btn-map.on, .btn-map.on:hover { background: #14221c; color: #f4efe6; }
.btn-map:hover { background: #fffdf8; }
.map-note {
  position: absolute;
  z-index: 500;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  background: #fff8ee;
  color: #6d4a0d;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: min(520px, 70%);
}
.pin {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  border: 2px solid white;
  box-shadow: 0 6px 16px rgba(20, 34, 28, 0.28);
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.pin.selected { transform: scale(1.12); }

.sheet {
  border: none;
  border-radius: 18px;
  padding: 0;
  width: min(560px, calc(100% - 28px));
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgba(16, 33, 26, 0.46); }
.sheet form { padding: 18px 20px 20px; }
.sheet header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet h2 { font-family: var(--serif); margin: 0; font-weight: 560; }
.sheet header .btn { color: var(--ink); border-color: var(--line); background: #fffdf8; }
.sheet ul { padding-left: 18px; line-height: 1.45; }
.sheet p { line-height: 1.5; }
.dialog-note { color: var(--ink-soft); font-size: 14px; }

@media (max-width: 860px) {
  html, body { height: auto; min-height: 100%; overflow: auto; }
  .app {
    height: auto;
    min-height: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto 52vh auto;
  }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; padding: 12px; }
  .brand { grid-column: 1 / -1; }
  .top-lead { display: none; }
  .top-actions { justify-content: flex-end; }
  .updated { text-align: left; min-width: 0; align-self: center; }
  .topbar, .panel, .map-wrap { grid-column: 1; }
  .panel {
    grid-row: 3;
    border-right: none;
    border-top: 1px solid var(--line);
    overflow: visible;
  }
  .list { overflow: visible; flex: none; }
  .detail { position: static; }
  .map-wrap { grid-row: 2; height: 52vh; min-height: 280px; }
  .legend { left: 8px; bottom: 8px; }
  .map-note { max-width: calc(100% - 24px); top: 8px; }
}
