:root {
  --bg: #f3f7f9; --surface: #ffffff; --surface2: #eaf2f6; --text: #16232c; --muted: #54656f; --border: #cfdbe2;
  --brand: #12466b; --brand2: #1f7a8c; --accent: #e8890c; --good: #1d7a3f; --fair: #a36a00; --poor: #b3261e; --exc: #0d6b50;
  --focus: #0b57d0; --shadow: 0 1px 3px rgba(10, 30, 45, .12); --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1a21; --surface: #15252e; --surface2: #1c3140; --text: #e6eef2; --muted: #9db0ba; --border: #2b4350;
    --brand: #7cc4e8; --brand2: #5fc0c8; --accent: #ffb24d; --good: #5fd48a; --fair: #f0c05a; --poor: #ff8a80; --exc: #4fe0b0; --focus: #8ab4ff; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1a21; --surface: #15252e; --surface2: #1c3140; --text: #e6eef2; --muted: #9db0ba; --border: #2b4350;
  --brand: #7cc4e8; --brand2: #5fc0c8; --accent: #ffb24d; --good: #5fd48a; --fair: #f0c05a; --poor: #ff8a80; --exc: #4fe0b0; --focus: #8ab4ff; --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: 8px 12px; z-index: 1000; }
.skip:focus { left: 8px; top: 8px; }
.muted { color: var(--muted); }
.print-only { display: none; }
[hidden] { display: none !important; }

/* header */
.site-header { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 500; box-shadow: var(--shadow); }
:root[data-theme="dark"] .site-header, :root:not([data-theme="light"]) .site-header { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-header { background: #0b2a3d; color: #e6eef2; } }
:root[data-theme="dark"] .site-header { background: #0b2a3d; color: #e6eef2; }
.header-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { color: inherit; text-decoration: none; font-size: 1.4rem; font-weight: 400; display: flex; gap: 6px; align-items: center; }
.brand b { font-weight: 800; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1 1 320px; scrollbar-width: thin; }
.tabs button { background: transparent; color: inherit; border: 0; padding: 10px 12px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 44px; }
.tabs button[aria-selected="true"] { background: rgba(255, 255, 255, .22); box-shadow: inset 0 -3px 0 var(--accent); }
.tabs button:hover { background: rgba(255, 255, 255, .14); }
.header-actions { display: flex; gap: 8px; margin-left: auto; position: relative; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 10px 14px; border-radius: 8px; font-weight: 600; min-height: 44px; border: 1px solid rgba(255, 255, 255, .35); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); padding: 8px; display: grid; gap: 4px; z-index: 600; }
.menu-panel button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font: inherit; color: inherit; cursor: pointer; min-height: 44px; }
.menu-panel button:hover { background: var(--surface2); }
.settings label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); padding: 4px 6px; }
.settings select { width: 100%; }

/* panels & controls */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; box-shadow: var(--shadow); }
.filters { margin-top: 16px; }
.filter-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.field { display: grid; gap: 4px; align-content: start; font-size: .9rem; color: var(--muted); font-weight: 600; }
.field .label, .field label { color: var(--muted); }
select, input[type="text"], input[type="date"], input[type="datetime-local"], input[type="password"], input[type="url"], input[type="number"], textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; min-height: 44px;
}
textarea { resize: vertical; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.spacer { flex: 1; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-weight: 500; }
.check input { width: 20px; height: 20px; }
.btn { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--brand); background: var(--surface); color: var(--brand); cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #08202c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #08202c; } }
.btn.ghost { border-color: var(--border); color: var(--text); }
.btn.small { padding: 6px 10px; min-height: 36px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.notice { background: var(--surface2); border-left: 4px solid var(--brand2); padding: 10px 12px; border-radius: 6px; margin: 12px 0 0; }

/* multi-select */
.ms { position: relative; }
.ms summary { list-style: none; cursor: pointer; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 32px 10px 10px; min-height: 44px; color: var(--text); font-weight: 400; position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms summary::-webkit-details-marker { display: none; }
.ms summary::after { content: "▾"; position: absolute; right: 12px; top: 10px; }
.ms-panel { position: absolute; z-index: 400; left: 0; right: 0; min-width: 240px; max-height: 340px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); padding: 8px; margin-top: 4px; color: var(--text); font-weight: 400; }
.ms-group { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 8px 4px 2px; font-weight: 700; }
.ms-item { display: flex; gap: 8px; align-items: center; padding: 6px 4px; min-height: 36px; border-radius: 6px; cursor: pointer; }
.ms-item:hover { background: var(--surface2); }
.ms-item input { width: 18px; height: 18px; flex: none; }
.ms-actions { position: sticky; top: -8px; background: var(--surface); padding: 4px 0 6px; display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.status { min-height: 0; }
.status .msg { padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.msg.warn { background: #fff3d6; color: #5a3d00; border: 1px solid #f0c05a; }
.msg.err { background: #fde7e5; color: #7a1710; border: 1px solid #f2a39d; }
.msg.info { background: var(--surface2); border: 1px solid var(--border); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .msg.warn { background: #3a2f10; color: #ffe3a3; border-color: #6e5716; }
  :root:not([data-theme="light"]) .msg.err { background: #3b1a18; color: #ffcbc6; border-color: #7a2c26; }
}
:root[data-theme="dark"] .msg.warn { background: #3a2f10; color: #ffe3a3; border-color: #6e5716; }
:root[data-theme="dark"] .msg.err { background: #3b1a18; color: #ffcbc6; border-color: #7a2c26; }

/* results */
.results { outline: none; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.hero { display: grid; gap: 16px; grid-template-columns: auto 1fr; align-items: center; }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; } }
.score-ring { width: 132px; height: 132px; border-radius: 50%; display: grid; place-content: center; text-align: center; border: 10px solid var(--c, var(--brand2)); background: var(--surface); }
.score-ring b { font-size: 2.4rem; line-height: 1; }
.score-ring span { font-size: .8rem; color: var(--muted); }
.label-Poor { --c: var(--poor); } .label-Fair { --c: var(--fair); } .label-Good { --c: var(--good); } .label-Excellent { --c: var(--exc); }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.pill.Poor { background: var(--poor); color: #fff; border-color: transparent; } .pill.Fair { background: var(--fair); color: #fff; border-color: transparent; }
.pill.Good { background: var(--good); color: #fff; border-color: transparent; } .pill.Excellent { background: var(--exc); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .pill.Poor, :root[data-theme="dark"] .pill.Fair, :root[data-theme="dark"] .pill.Good, :root[data-theme="dark"] .pill.Excellent { color: #08202c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.Poor, :root:not([data-theme="light"]) .pill.Fair, :root:not([data-theme="light"]) .pill.Good, :root:not([data-theme="light"]) .pill.Excellent { color: #08202c; } }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.badge { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: .9rem; border: 2px solid; background: var(--surface); cursor: default; }
button.badge { cursor: pointer; font: inherit; font-weight: 700; font-size: .9rem; }
.badge.tourn { border-color: var(--accent); color: #8a4b00; background: #fff1d9; }
.badge.hydro { border-color: #2b6cb0; color: #174a80; background: #e3f0fd; }
.badge.tide { border-color: #0f766e; color: #0a4f4a; background: #dcf6f3; }
.badge.limited { border-color: var(--muted); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.tourn { background: #3d2a0c; color: #ffd28a; }
  :root:not([data-theme="light"]) .badge.hydro { background: #12304f; color: #a8d1fb; }
  :root:not([data-theme="light"]) .badge.tide { background: #0f3532; color: #8ee7de; }
}
:root[data-theme="dark"] .badge.tourn { background: #3d2a0c; color: #ffd28a; }
:root[data-theme="dark"] .badge.hydro { background: #12304f; color: #a8d1fb; }
:root[data-theme="dark"] .badge.tide { background: #0f3532; color: #8ee7de; }
.alert { padding: 10px 14px; border-radius: 8px; margin: 8px 0; border-left: 5px solid var(--fair); background: var(--surface2); }
.alert.danger { border-color: var(--poor); } .alert.warn { border-color: var(--fair); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kv > div { background: var(--surface2); border-radius: 10px; padding: 10px; }
.kv .k { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kv .v { font-size: 1.15rem; font-weight: 700; }
.outlook { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(104px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.day-btn { border: 2px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px; text-align: center; cursor: pointer; font: inherit; color: var(--text); min-height: 44px; }
.day-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--surface2); }
.day-btn b { font-size: 1.3rem; display: block; }
.day-btn small { color: var(--muted); display: block; }
.hours { display: flex; align-items: flex-end; gap: 2px; height: 120px; margin: 8px 0 2px; }
.hours .h { flex: 1; background: var(--brand2); border-radius: 3px 3px 0 0; min-width: 6px; position: relative; opacity: .85; }
.hours .h.best { background: var(--exc); opacity: 1; outline: 2px solid var(--accent); }
.hours .h.night { filter: grayscale(.6) brightness(.8); }
.hour-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.rank { font-size: 1.4rem; font-weight: 800; color: var(--brand); }
.bar { height: 10px; background: var(--surface2); border-radius: 6px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--brand2); }
.lure { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 10px 0; background: var(--surface); }
.lure h3 { margin: 0; }
.lure .meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .9rem; margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
details.more > summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 6px 0; min-height: 36px; }
dl.spec { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; margin: 6px 0; }
dl.spec dt { color: var(--muted); font-size: .85rem; } dl.spec dd { margin: 0; }
.ai-box { background: var(--surface2); border-left: 5px solid var(--brand2); border-radius: 8px; padding: 14px; white-space: pre-wrap; }
.ai-box.loading { opacity: .8; font-style: italic; }
.tag-note { font-size: .8rem; color: var(--muted); }
button.term { background: none; border: 0; border-bottom: 1px dotted var(--brand); color: var(--brand); font: inherit; cursor: help; padding: 0; }
.pop { position: fixed; z-index: 900; max-width: 280px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.map { height: 420px; border-radius: 10px; border: 1px solid var(--border); margin: 8px 0; z-index: 1; }
.map.tall { height: 520px; }
.leaflet-container { font: inherit; }
.pin { display: grid; place-content: center; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); color: #fff; font-weight: 800; font-size: .75rem; }
.pin span { transform: rotate(45deg); display: block; }
.pin-fish { background: #0b5fa5; } .pin-lake { background: #6a4aa8; } .pin-ramp { background: #1d7a3f; } .pin-pier { background: #0f766e; } .pin-park { background: #6b7280; } .pin-tourn { background: #e8890c; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .85rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.photos figure { margin: 0; max-width: 220px; }
.photos img { width: 100%; border-radius: 8px; display: block; }
.photos figcaption { font-size: .78rem; color: var(--muted); }
.report { border-top: 1px solid var(--border); padding: 10px 0; }
.tabs-inner { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.start-here { border: 2px dashed var(--brand2); border-radius: 12px; padding: 12px; margin: 12px 0; }
.cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 700; background: var(--surface); border-top: 3px solid var(--brand); padding: 12px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; box-shadow: 0 -4px 16px rgba(0, 0, 0, .2); }
.cookie-bar p { margin: 0; flex: 1 1 320px; font-size: .92rem; }
.ask textarea { margin-bottom: 8px; }
.ask-row { display: flex; justify-content: space-between; align-items: center; }
.site-footer { padding: 24px 0 90px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--border); margin-top: 24px; }
dialog { width: min(760px, 94vw); max-height: 86vh; border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 16px; overflow: auto; max-height: calc(86vh - 70px); }
.dlg-body h3 { margin-top: 16px; }
.loader { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loader { animation: none; } }

/* print */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .filters, .ask, .cookie-bar, .site-footer, .skip, #statusBar, .no-print, dialog, .tabs-inner, .btn, details.more > summary { display: none !important; }
  .print-only { display: block !important; }
  .print-head { border-bottom: 2px solid #000; margin-bottom: 8px; padding-bottom: 4px; }
  .panel { box-shadow: none; border: 1px solid #999; break-inside: avoid; background: #fff; }
  details.more > *:not(summary) { display: block !important; }
  .map { height: 320px; }
  body.no-print-media .map, body.no-print-media .photos, body.no-print-media .legend, body.no-print-media .print-media { display: none !important; }
  a { color: #000; text-decoration: none; }
  .hours .h { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* layout hardening: allow grid children to shrink so long labels never cause sideways scrolling */
.field, .ms, .filter-grid > * { min-width: 0; }
.ms summary { max-width: 100%; }
