:root[data-map-theme="light"]{color-scheme:light}
:root[data-map-theme="dark"]{color-scheme:dark;--panel-bg:rgba(25,34,45,.97);--shadow:0 4px 18px #0006}
.map-appearance-control{display:flex;flex-direction:column;gap:7px;margin-top:14px;padding-top:12px;border-top:1px solid #8293a744;font-size:12px;font-weight:700}
.map-appearance-control select{font:inherit;width:100%;min-height:40px;border:1px solid #8898aa;border-radius:8px;padding:7px;background:#fff;color:#172536}
html[data-map-theme="dark"] body{background:#111923;color:#ecf2f8}
html[data-map-theme="dark"] :is(.panel,.mobile-sheet,.mapboxgl-popup-content,.language-menu,.search-results,.search-box,.map-mode,.language-button,.tutorial-modal){background:#19222df5;color:#ecf2f8;border-color:#566575}
html[data-map-theme="dark"] :is(.search-result-name,.search-box input,.language-option,.map-mode button){color:#ecf2f8}
html[data-map-theme="dark"] :is(.hint,.status,.search-result-address,.search-empty){color:#bac8d6}
html[data-map-theme="dark"] :is(.search-box input)::placeholder{color:#bac8d6}
html[data-map-theme="dark"] :is(.map-appearance-control select,.search-clear,.sheet-close,.mapboxgl-popup-close-button){background:#283647;color:#ecf2f8}
html[data-map-theme="dark"] :is(.map-mode button.active,.language-option.active,.search-result:hover){background:#3c5066;color:#fff}
html[data-map-theme="dark"] :is(#detail-content a,.mapboxgl-popup-content a){color:#8ecbff}
html[data-map-theme="dark"] .mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{border-top-color:#19222d}
html[data-map-theme="dark"] :is(.detail-title,.detail-desc,.detail-meta,.detail-category){color:#ecf2f8}
html[data-map-theme="dark"] :is(.mobile-bottom-actions button,.detail-feedback-button){background:#283647;color:#ecf2f8}

/* Detail cards use the same dark surfaces as the surrounding popup. */
html[data-map-theme="dark"]{--detail-text:#f1f5f9;--detail-muted:#c2cedb;--detail-surface:#263545;--detail-border:#60758b;--detail-link:#a6d8ff}
html[data-map-theme="dark"] :is(.event-detail-card,.manner-alert-detail,.pref-capture-detail,.release-guidance-content){color:var(--detail-text)}
html[data-map-theme="dark"] :is(.sponsor-meta,.sponsor-hours,.sponsor-note,.event-card-label,.event-card-end,.detail-meta,.manner-alert-note,.share-status,.pref-capture-detail small){color:var(--detail-muted)}
html[data-map-theme="dark"] :is(.event-card-facts,.manner-alert-note,.sponsor-chip,.manner-genre-label,.pref-capture-detail,.capture-poster-card){background:var(--detail-surface);color:var(--detail-text);border-color:var(--detail-border)}
html[data-map-theme="dark"] .event-card-description h4{color:#f4d584}
html[data-map-theme="dark"] .event-card-symbol{color:#f4d584}
html[data-map-theme="dark"] .event-card-badge{background:#263545;color:#f4d584;border-color:#ba9b4e}
html[data-map-theme="dark"] .event-card-footer{border-color:var(--detail-border)}
html[data-map-theme="dark"] .sponsor-status.open{background:#173e30;color:#a0edbe}
html[data-map-theme="dark"] .sponsor-status.closed{background:#492c34;color:#ffbdc6}
html[data-map-theme="dark"] :is(.info-share,.sponsor-site-button,.sponsor-route-button:not(.primary),.event-card-link,.fishing-tap-choice,.fishing-tap-back,.harvest-rights-open,.harvest-species-actions button,.harvest-drawer-header button){background:var(--detail-surface);color:var(--detail-text);border-color:var(--detail-border)}
html[data-map-theme="dark"] :is(#detail-content,.mapboxgl-popup-content) a{color:var(--detail-link)}
html[data-map-theme="dark"] :is(#detail-content,.mapboxgl-popup-content) a.sponsor-route-button.primary{color:#fff}
html[data-map-theme="dark"] :is(.fishing-tap-choice span,.fishing-tap-choices>p){color:var(--detail-muted)}
html[data-map-theme="dark"] .fishing-tap-choice:hover{background:#354c64}
html[data-map-theme="dark"] .capture-rule-table :is(th,td){border-color:var(--detail-border);color:var(--detail-text)}
html[data-map-theme="dark"] .capture-rule-table thead th{background:#354c64}
html[data-map-theme="dark"] .capture-rule-table tbody :is(th,td){background:var(--detail-surface)}
html[data-map-theme="dark"] .harvest-type-button:not([aria-pressed="true"]){background:var(--detail-surface);color:var(--detail-text)}
html[data-map-theme="dark"] .harvest-rights-drawer fieldset label.harvest-risk-species:not(:has(input:checked)){color:#ffb6cb}
html[data-map-theme="dark"] .detail-share-toolbar>.share-status{color:var(--detail-muted)}
html[data-map-theme="dark"] :is(.mapboxgl-popup-content,.mobile-sheet,.harvest-rights-drawer){scrollbar-color:#91a6bc #19222d}
html[data-map-theme="dark"] :is(.mapboxgl-popup-content,.mobile-sheet,.harvest-rights-drawer) :is(a,button,summary):focus-visible{outline:3px solid #b5e0ff;outline-offset:3px}
html[data-map-theme="dark"] .mapboxgl-popup-anchor-top .mapboxgl-popup-tip{border-bottom-color:#19222d}
html[data-map-theme="dark"] .mapboxgl-popup-anchor-left .mapboxgl-popup-tip{border-right-color:#19222d}
html[data-map-theme="dark"] .mapboxgl-popup-anchor-right .mapboxgl-popup-tip{border-left-color:#19222d}
html[data-map-theme="dark"] :is(.capture-rule-block>p,.capture-poster-card figcaption){color:var(--detail-muted)}
html[data-map-theme="dark"] .pref-capture-point{color:#172b3a}
