:root {
  --ink: #101a16;
  --ink-soft: #45534c;
  --paper: #f4f0e7;
  --paper-deep: #e8e1d4;
  --white: #fffdf8;
  --lime: #d9ff55;
  --green: #1c704d;
  --green-dark: #164c38;
  --amber: #f0a93b;
  --red: #c7593e;
  --line: rgba(16, 26, 22, 0.14);
  --shadow: 0 20px 50px rgba(19, 35, 27, 0.12);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(28, 112, 77, 0.38);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.topbar {
  height: 70px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 58px); border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 231, 0.93); backdrop-filter: blur(18px);
  position: sticky; top: 0; z-index: 900;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 900; letter-spacing: -0.04em; }
.brand > span:last-child span { color: var(--green); }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; display: grid; place-content: center; gap: 2px; background: var(--ink); transform: rotate(-14deg); }
.brand-mark i { display: block; width: 17px; height: 3px; border-radius: 9px; background: var(--lime); }
.brand-mark i:nth-child(2) { width: 12px; }
.brand-mark i:nth-child(3) { width: 7px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.demo-pill { font-size: 12px; font-weight: 800; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--green-dark); background: var(--white); }
.icon-button { border: 0; border-radius: 999px; padding: 8px 13px; font-weight: 800; color: var(--white); background: var(--green); }

main { padding: 0 clamp(14px, 3.2vw, 52px) 80px; }
.hero { max-width: 1380px; margin: 0 auto; padding: clamp(42px, 7vw, 92px) 0 38px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.eyebrow { margin: 0 0 10px; font-size: 11px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; color: var(--green); }
h1 { margin: 0; max-width: 760px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 7.5vw, 104px); font-weight: 500; line-height: .86; letter-spacing: -.065em; }
h1 em { color: var(--green); font-weight: 500; }
.hero-copy { max-width: 640px; margin: 28px 0 0; color: var(--ink-soft); font-size: clamp(17px, 2vw, 21px); line-height: 1.5; }
.trust-card { width: 310px; flex: 0 0 auto; display: flex; gap: 12px; align-items: flex-start; padding: 18px; border-radius: 18px; background: var(--ink); color: var(--white); box-shadow: var(--shadow); }
.trust-card strong, .trust-card span { display: block; }
.trust-card strong { font-size: 14px; margin-bottom: 5px; }
.trust-card div > span { color: rgba(255,255,255,.68); font-size: 12px; line-height: 1.4; }
.pulse { width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 7px rgba(217,255,85,.12); }

.controls { max-width: 1380px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-box { height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 18px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px rgba(19,35,27,.05); }
.search-box > span:first-child { font-size: 28px; line-height: 1; transform: rotate(-15deg); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.locate-button { min-width: 176px; border: 0; border-radius: 16px; padding: 0 20px; font-weight: 900; color: var(--white); background: var(--green); box-shadow: 0 8px 20px rgba(28,112,77,.18); }
.locate-button.is-loading { opacity: .66; cursor: wait; }

.filter-row { max-width: 1380px; margin: 14px auto 22px; display: flex; gap: 8px; align-items: center; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; color: var(--ink); background: transparent; font-size: 13px; font-weight: 800; }
.filter-chip:hover { background: var(--white); }
.filter-chip.is-active { border-color: var(--ink); color: var(--white); background: var(--ink); }
.fresh-toggle { margin-left: auto; flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.fresh-toggle input { accent-color: var(--green); width: 17px; height: 17px; }

.explorer { max-width: 1380px; height: min(720px, calc(100vh - 150px)); min-height: 590px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .72fr); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; background: var(--white); box-shadow: var(--shadow); }
.map-shell { position: relative; min-width: 0; background: #dbe1d5; }
#map { width: 100%; height: 100%; z-index: 1; }
.leaflet-control-attribution { font-size: 9px !important; }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 14px 35px rgba(16,26,22,.18); }
.leaflet-popup-content { margin: 13px 15px; }
.popup-title { font-weight: 900; font-size: 14px; }
.popup-meta { margin: 5px 0; color: var(--ink-soft); font-size: 12px; }
.popup-button { border: 0; padding: 7px 9px; border-radius: 8px; background: var(--green); color: var(--white); font-weight: 800; }
.venue-marker { border-radius: 50%; border: 3px solid var(--white); box-shadow: 0 4px 12px rgba(16,26,22,.28); }
.venue-marker.fresh { background: var(--green); }
.venue-marker.aging { background: var(--amber); }
.venue-marker.stale { background: var(--red); }
.venue-marker::after { content: ''; display: block; width: 7px; height: 7px; margin: 5px; border-radius: 50%; background: var(--white); }
.map-key { position: absolute; left: 14px; bottom: 14px; z-index: 500; display: flex; gap: 9px; padding: 9px 11px; border-radius: 12px; background: rgba(255,253,248,.92); box-shadow: 0 5px 18px rgba(16,26,22,.12); font-size: 10px; font-weight: 800; }
.map-key span { display: flex; align-items: center; gap: 4px; }
.map-key i { width: 8px; height: 8px; border-radius: 50%; }
.fresh-dot { background: var(--green); } .aging-dot { background: var(--amber); } .stale-dot { background: var(--red); }
.list-toggle { display: none; position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 600; border: 0; border-radius: 999px; padding: 10px 16px; background: var(--ink); color: var(--white); font-weight: 900; box-shadow: var(--shadow); }

.results-panel { min-width: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--white); }
.results-heading { position: sticky; top: 0; z-index: 10; display: flex; align-items: end; justify-content: space-between; gap: 10px; padding: 22px 20px 17px; border-bottom: 1px solid var(--line); background: rgba(255,253,248,.94); backdrop-filter: blur(14px); }
.results-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 27px; font-weight: 500; letter-spacing: -.03em; }
.results-heading select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 25px 8px 9px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 800; }
.venue-list { padding: 8px; }
.venue-card { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); padding: 15px 13px 17px; background: transparent; color: var(--ink); transition: .16s ease; }
.venue-card:hover { border-radius: 13px; background: var(--paper); transform: translateY(-1px); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.venue-card h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.distance { flex: 0 0 auto; font-size: 11px; font-weight: 900; color: var(--ink-soft); }
.neighborhood { margin: 5px 0 9px; font-size: 12px; color: var(--ink-soft); }
.game-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.game-tag { display: inline-flex; padding: 5px 7px; border-radius: 7px; color: var(--green-dark); background: rgba(28,112,77,.09); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.game-tag span { margin-left: 4px; color: var(--ink-soft); }
.card-proof { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-top: 12px; }
.proof-line { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.proof-dot { width: 7px; height: 7px; border-radius: 50%; }
.proof-line.fresh .proof-dot { background: var(--green); } .proof-line.aging .proof-dot { background: var(--amber); } .proof-line.stale .proof-dot { background: var(--red); }
.scores { text-align: right; font-size: 11px; color: var(--ink-soft); }
.scores strong { color: var(--ink); font-size: 14px; }
.empty-state { padding: 48px 25px; text-align: center; color: var(--ink-soft); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 7px; color: var(--ink); }

.sheet { width: min(680px, calc(100% - 24px)); max-height: min(860px, calc(100dvh - 24px)); overflow-y: auto; padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: var(--white); box-shadow: 0 30px 90px rgba(12,24,18,.32); }
.sheet::backdrop { background: rgba(7,15,11,.62); backdrop-filter: blur(5px); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 23px 24px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; font-weight: 500; letter-spacing: -.035em; }
.close-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); font-size: 25px; line-height: 1; }
.detail-hero { padding: 24px; background: var(--ink); color: var(--white); }
.detail-hero .eyebrow { color: var(--lime); }
.detail-hero h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(34px, 6vw, 50px); font-weight: 500; line-height: 1; letter-spacing: -.05em; }
.detail-sub { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; color: rgba(255,255,255,.68); font-size: 12px; }
.detail-close { float: right; color: var(--white); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }
.equipment-section, .detail-actions, .league-box, .confidence-box { padding: 20px 24px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-title h3 { margin: 0; font-size: 15px; }
.section-title span { color: var(--ink-soft); font-size: 11px; }
.equipment-card { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); }
.equipment-card + .equipment-card { margin-top: 9px; }
.equipment-top { display: flex; justify-content: space-between; gap: 10px; }
.equipment-top h4 { margin: 0 0 4px; font-size: 16px; text-transform: capitalize; }
.equipment-top p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.price { text-align: right; font-size: 14px; font-weight: 900; color: var(--green-dark); }
.price small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 9px; font-weight: 700; }
.equipment-scores { display: flex; gap: 16px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-soft); }
.equipment-scores strong { color: var(--ink); }
.league-box { padding-top: 0; }
.league-box > div { border-left: 4px solid var(--lime); border-radius: 0 12px 12px 0; padding: 13px 15px; background: var(--ink); color: var(--white); }
.league-box strong, .league-box span { display: block; }
.league-box span { margin-top: 4px; color: rgba(255,255,255,.67); font-size: 12px; }
.confidence-box { padding-top: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; position: sticky; bottom: 0; border-top: 1px solid var(--line); background: rgba(255,253,248,.95); backdrop-filter: blur(14px); }
.directions-button { grid-column: 1 / -1; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 12px; padding: 12px 15px; color: var(--white); background: var(--ink); text-decoration: none; font-weight: 900; }
.directions-button:hover { background: var(--green-dark); }
.directions-button span { color: var(--lime); transform: rotate(-45deg); }
.primary-button, .secondary-button { min-height: 45px; border-radius: 12px; padding: 11px 15px; font-weight: 900; }
.primary-button { border: 0; color: var(--white); background: var(--green); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: var(--paper); }

.update-dialog form { padding-bottom: 22px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 20px 24px 0; }
.field-grid label, .wide-field { display: grid; gap: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.field-grid input, .field-grid select, .wide-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px; color: var(--ink); background: var(--paper); text-transform: none; letter-spacing: normal; }
.wide-field { margin: 17px 24px 0; }
.wide-field span { font-weight: 500; text-transform: none; }
.wide-field textarea { min-height: 85px; resize: vertical; }
fieldset { margin: 17px 24px 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.rating-row { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 5px; }
.rating-row input { position: absolute; opacity: 0; pointer-events: none; }
.rating-row label { width: 41px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: var(--paper); font-weight: 900; }
.rating-row input:checked ~ label, .rating-row label:hover, .rating-row label:hover ~ label { color: var(--ink); border-color: var(--lime); background: var(--lime); }
.field-help, .privacy-note { margin: 7px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.confirm-row { display: flex; align-items: center; gap: 9px; margin: 18px 24px; padding: 13px; border-radius: 12px; background: rgba(28,112,77,.08); font-size: 12px; font-weight: 800; }
.confirm-row input { width: 18px; height: 18px; accent-color: var(--green); }
.update-dialog form > .primary-button { width: calc(100% - 48px); margin: 0 24px; }
.update-dialog form > .privacy-note { margin: 9px 24px 0; text-align: center; }

.qr-layout { display: grid; grid-template-columns: 260px 1fr; align-items: center; gap: 25px; padding: 24px; }
.qr-card { padding: 22px; text-align: center; border: 2px solid var(--ink); border-radius: 18px; background: var(--paper); }
.qr-card p { margin: 0 0 12px; font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.qr-card img { width: 190px; max-width: 100%; aspect-ratio: 1; display: block; margin: 0 auto 12px; background: var(--white); }
.qr-card h3 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 24px; }
.qr-card span { display: block; color: var(--ink-soft); font-size: 10px; line-height: 1.4; }
.qr-card strong { display: block; margin-top: 17px; color: var(--green); font-size: 12px; letter-spacing: .1em; }
.qr-layout > div:last-child h3 { margin: 0 0 7px; }
.qr-url { overflow-wrap: anywhere; padding: 10px; border-radius: 9px; background: var(--paper); color: var(--ink-soft); font-size: 10px; }
.qr-layout .primary-button, .qr-layout .secondary-button { width: 100%; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 2000; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 999px; color: var(--white); background: var(--ink); box-shadow: var(--shadow); font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .trust-card { width: 100%; max-width: 480px; }
  .explorer { display: block; height: 690px; min-height: 0; }
  .map-shell { width: 100%; height: 100%; min-height: 0; }
  .results-panel { position: absolute; inset: auto 14px 14px; z-index: 700; max-height: calc(100dvh - 150px); border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(16,26,22,.2); transform: translateY(calc(100% + 24px)); transition: transform .25s ease; }
  .explorer { position: relative; }
  .explorer.show-list .results-panel { transform: translateY(0); }
  .list-toggle { display: block; }
  .explorer.show-list .list-toggle { bottom: auto; top: 12px; }
  .map-key { bottom: 70px; }
  .fresh-toggle { margin-left: 0; }
}

@media (max-width: 620px) {
  .topbar { height: 61px; }
  .demo-pill { display: none; }
  main { padding-left: 10px; padding-right: 10px; }
  .hero { padding: 37px 5px 27px; }
  .hero-copy { margin-top: 20px; }
  .controls { grid-template-columns: 1fr; }
  .locate-button { min-height: 50px; }
  .filter-row { margin-top: 10px; }
  .explorer { height: calc(100dvh - 130px); min-height: 600px; border-radius: 19px; }
  .results-panel { inset-left: 10px; inset-right: 10px; }
  .field-grid, .qr-layout { grid-template-columns: 1fr; }
  .qr-card { max-width: 270px; margin: 0 auto; }
  .detail-actions { grid-template-columns: 1fr; }
  .map-key { flex-direction: column; gap: 5px; }
}

@media print {
  body * { visibility: hidden !important; }
  #qrDialog, #qrDialog * { visibility: visible !important; }
  #qrDialog { position: absolute; inset: 0; width: 100%; max-height: none; box-shadow: none; }
  #qrDialog .sheet-head, #qrDialog .qr-layout > div:last-child { display: none; }
  .qr-layout { display: block; padding: 0; }
  .qr-card { width: 4in; margin: 0 auto; }
}
