:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body.site-chart { display: flex; flex-direction: column; min-height: 100dvh; background: #0d1b2a; color: #f3f7fc; font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif; }
.chart-header { position: relative; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 66px; flex: 0 0 66px; padding: 0 clamp(16px, 3vw, 42px); border-bottom: 1px solid #2a3a4a; background: #0d1b2a; }
.chart-brand { display: inline-flex; align-items: center; gap: 10px; color: #f3f7fc; font-weight: 700; letter-spacing: .3px; text-decoration: none; white-space: nowrap; }
.chart-brand img { width: 34px; height: 34px; }
.chart-app-name { margin: 0; border: 1px solid #3b6285; border-radius: 7px; padding: 4px 8px; color: #9bdce6; background: #1a3044; font: 600 11px/1.2 "Segoe UI", "Microsoft YaHei", sans-serif; }
.chart-about { position: relative; }
.chart-about summary { display: grid; place-items: center; width: 28px; height: 28px; list-style: none; color: #a9bdd3; cursor: pointer; border-radius: 6px; }
.chart-about summary::-webkit-details-marker { display: none; }
.chart-about summary:hover { background: #1a3044; color: #fff; }
.chart-about svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.chart-about article { position: absolute; top: 38px; inset-inline-end: 0; width: min(330px, calc(100vw - 24px)); padding: 18px; border: 1px solid #304359; border-radius: 12px; background: #152233; box-shadow: 0 12px 32px #0004; }
.chart-about h2 { margin: 0 0 10px; font-size: 17px; }
.chart-about p { margin: 0 0 16px; color: #a9bdd3; font-size: 13px; line-height: 1.7; }
.chart-about nav { display: flex; flex-wrap: wrap; gap: 14px; }
.chart-about a { color: #9bdce6; font-size: 12px; }
.chart-static-summary { position: absolute; z-index: 600; top: 16px; inset-inline-start: 16px; max-width: min(420px, calc(100% - 32px)); padding: 20px; color: #213b4d; background: #fff; border-radius: 10px; line-height: 1.7; }
.chart-static-summary h2 { margin-top: 0; }
.chart-header-actions { display: flex; align-items: center; gap: 18px; }
.chart-nav-link { color: #a9bdd3; font-size: 13px; text-decoration: none; transition: color .18s; }
.chart-nav-link:hover { color: #fff; }
.chart-login-link { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 15px; border: 1px solid #3c78cd; border-radius: 9px; color: #f7fbff; background: #347be0; font-size: 12px; font-weight: 650; text-decoration: none; transition: background .18s, transform .18s; }
.chart-login-link:hover { transform: translateY(-1px); background: #468cf0; }
.chart-language { display: flex; align-items: center; }
.chart-language label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.chart-language select { height: 36px; max-width: 150px; padding: 0 10px; color: #d6e2ef; background: #152233; border: 1px solid #304359; border-radius: 9px; font: inherit; font-size: 12px; }
.chart-main { flex: 1; min-height: 0; padding: 0; }
.chart-map-shell { position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden; border: 0; border-radius: 0; background: #c7dce0;  isolation: isolate; }
#chart-map { position: absolute; inset: 0; background: #c7dce0; }
.leaflet-container { font: 13px/1.4 "Segoe UI", "Microsoft YaHei", Arial, sans-serif; }
.leaflet-control-attribution { padding: 4px 7px !important; border-radius: 6px 0 0 0; color: #223848 !important; background: #f6f8f1e8 !important; }
.leaflet-control-attribution a { color: #176b91 !important; }
.leaflet-control-zoom { overflow: hidden; border: 1px solid #cfdae2 !important; border-radius: 10px !important; box-shadow: 0 5px 18px #11243420 !important; }
.leaflet-control-zoom a { width: 34px !important; height: 34px !important; line-height: 33px !important; color: #213b4d !important; background: #f9fbf7 !important; border-color: #e0e7e9 !important; }
.leaflet-control-scale-line { color: #274254 !important; background: #f7f9f1d9 !important; border-color: #426273 !important; }
.map-status { position: absolute; z-index: 500; inset-inline-start: 18px; bottom: 16px; display: inline-flex; align-items: center; gap: 8px; max-width: min(360px, calc(100% - 36px)); padding: 9px 12px; border: 1px solid #ffffffb0; border-radius: 10px; color: #284455; background: #f7f9f1ed; box-shadow: 0 6px 22px #172e3b21; font-size: 11px; opacity: 1; transition: opacity .3s, transform .3s; pointer-events: none; }
.map-status.is-hidden { opacity: 0; transform: translateY(5px); }
.status-pulse { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #4285f4; box-shadow: 0 0 0 4px #4285f426; animation: status-pulse 1.5s ease-in-out infinite; }
.map-status.is-error .status-pulse { background: #c25145; box-shadow: 0 0 0 4px #c2514526; animation: none; }
@keyframes status-pulse { 50% { box-shadow: 0 0 0 7px #4285f40c; } }
.chart-layer-panel { position: absolute; z-index: 450; top: 10px; inset-inline-end: 10px; width: 258px; max-height: max(44px, calc(100% - 190px)); overflow-y: auto; overscroll-behavior: contain; padding: 10px 14px; border: 1px solid #dce3e6; border-radius: 8px; color: #333; background: rgba(255,255,255,.95); box-shadow: 0 2px 8px #0003; font-size: 13px; line-height: 1.6; color-scheme: light; scrollbar-width: thin; scrollbar-color: #bdc7ce transparent; }
.layer-panel-heading { position: sticky; top: -10px; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 5px; padding: 0 0 6px; border-bottom: 1px solid #eee; background: #fff; color: #222; font-size: 15px; font-weight: 700; }
.layer-panel-heading button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid #dbe3e8; border-radius: 4px; color: #536371; background: #f5f7f9; cursor: pointer; font-size: 17px; line-height: 1; }
.layer-option { display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 0; color: #444; font-size: 12px; cursor: pointer; }
.layer-option input { width: 14px; height: 14px; margin: 0; accent-color: #4a90d9; cursor: pointer; }
.layer-mark { display: inline-block; width: 12px; height: 12px; flex: 0 0 12px; border: 1px solid #0002; border-radius: 2px; background: var(--layer-swatch, #7895ad); }
.base-mark { background: #bacbd0; }
.depth-mark { background: #53a6ce; }
.seamark-mark { background: #e3ad43; }
.layer-option small { margin-inline-start: auto; color: #89939a; font-size: 10px; }
.chart-notice { margin: 8px 0 0; padding: 8px 0 0; border: 0; border-top: 1px solid #eee; border-radius: 0; color: #80888e; background: transparent; font-size: 10px; line-height: 1.6; }
.chart-layer-panel.is-collapsed { width: 44px; height: 44px; padding: 8px; }
.chart-layer-panel.is-collapsed .layer-panel-heading { margin: 0; padding: 0; border: 0; }
.chart-layer-panel.is-collapsed .layer-group, .chart-layer-panel.is-collapsed .layer-panel-heading > span, .chart-layer-panel.is-collapsed .layer-option, .chart-layer-panel.is-collapsed .chart-notice { display: none; }
.chart-layer-panel.is-collapsed .layer-panel-heading button { width: 28px; height: 28px; }
/* 独立圆形按钮竖排，按钮组自身不绘制底板。 */
.map-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 44px; margin-right: 16px !important; margin-bottom: 28px !important; border: 0; background: transparent; box-shadow: none; }
.map-control { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid #d8e2e8; border-radius: 50%; color: #284b65; background: #fff; box-shadow: 0 3px 12px #11243424; cursor: pointer; transition: color .18s, box-shadow .18s; }
.map-control svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.map-control:hover { color: #2175cf; background: #fff; box-shadow: 0 4px 16px #11243438; }
.map-control:active { box-shadow: 0 1px 5px #11243424; }
.map-control:disabled { color: #a8b7c1; cursor: default; background: #fff; }
.map-scale-slot { display: flex; align-items: center; gap: 8px; direction: ltr; position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; pointer-events: none; }
.map-scale-zoom { color: #233e50; font: 12px/1.2 "Segoe UI", Arial, sans-serif; text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; white-space: nowrap; }
.map-scale-slot .leaflet-control-scale { float: none; clear: none; margin: 0 !important; }
.map-scale-slot .leaflet-control-scale-line { padding: 0 5px 3px; border-width: 0 2px 2px; border-radius: 0; border-color: #233e50 !important; color: #233e50 !important; background: transparent !important; font: 12px/1.2 "Segoe UI", Arial, sans-serif; text-align: center; text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; filter: drop-shadow(0 1px 0 #fff); }
.site-chart a:focus-visible, .site-chart button:focus-visible, .site-chart select:focus-visible, .site-chart input:focus-visible { outline: 2px solid #63cddd; outline-offset: 3px; }
html[dir="rtl"] .map-status { text-align: right; }
@media (max-width: 700px) {
  .chart-header { height: 58px; flex-basis: 58px; padding: 0 13px; gap: 8px; }
  .chart-brand { gap: 7px; font-size: 14px; }
  .chart-brand img { width: 29px; height: 29px; }
  .chart-app-name { display: none; }
  .chart-about article { position: fixed; top: 65px; inset-inline-end: 12px; }
  .chart-header-actions { gap: 10px; }
  .chart-nav-link { font-size: 11px; }
  .chart-login-link { min-height: 33px; padding: 0 11px; font-size: 11px; }
  .chart-language select { max-width: 116px; height: 33px; padding: 0 7px; font-size: 11px; }
  .chart-layer-panel { top: 10px; inset-inline-end: 10px; width: min(258px, calc(100% - 20px)); padding: 10px 12px; border-radius: 8px; }
  .chart-layer-panel.is-collapsed { width: 40px; height: 40px; padding: 6px; }
  .layer-panel-heading { margin-bottom: 4px; padding-bottom: 5px; font-size: 11px; }
  .layer-option { min-height: 30px; gap: 7px; font-size: 12px; }
  .chart-notice { padding: 7px; font-size: 9px; }
  .map-status { bottom: 10px; inset-inline-start: 10px; padding: 7px 9px; font-size: 10px; }
  .leaflet-control-attribution { max-width: calc(100vw - 92px); font-size: 9px !important; }
}
@media (max-width: 380px) {
  .chart-header { padding: 0 8px; }
  .chart-brand { gap: 5px; }
  .chart-app-name { display: none; }
  .chart-header-actions { gap: 6px; }
  .chart-language select { max-width: 82px; padding-inline: 5px; }
  .chart-layer-panel { width: min(258px, calc(100% - 20px)); }
  .chart-layer-panel.is-collapsed { width: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-chart *, .site-chart *::before, .site-chart *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.layer-group { border-top: 1px solid #eee; padding-block: 6px 2px; margin-top: 4px; }
.layer-children { margin: 0; padding: 2px 0 0; border: 0; }
.layer-child { min-height: 25px; font-size: 12px; }
.layer-option:has(input:disabled) { cursor: default; }
.layer-option input:disabled { cursor: default; }

.layer-option:hover { color: #000; }
.layer-group > .layer-option { color: #66737e; font-size: 11px; font-weight: 650; }
.layer-child:has([data-layer-option="depth_area"]) { --layer-swatch: #72c4de; }
.layer-child:has([data-layer-option="depth_contour"]) { --layer-swatch: #226a91; }
.layer-child:has([data-layer-option="depth_label"]) { --layer-swatch: #174d70; }
.layer-child:has([data-layer-option="depth_sounding"]) { --layer-swatch: #517f9b; }
.layer-child:has([data-layer-option="marks_buoys"]) { --layer-swatch: #df4949; }
.layer-child:has([data-layer-option="marks_beacons"]) { --layer-swatch: #28a166; }
.layer-child:has([data-layer-option="marks_lights"]) { --layer-swatch: #f4cd00; }
.layer-child:has([data-layer-option="marks_hazards"]) { --layer-swatch: #ce637b; }
.layer-child:has([data-layer-option="marks_areas"]) { --layer-swatch: #93b98a; }
.layer-child:has([data-layer-option="marks_lines"]) { --layer-swatch: #a66abf; }
.layer-child:has([data-layer-option="marks_subsea"]) { --layer-swatch: #9566ac; }
.layer-child:has([data-layer-option="marks_ports"]) { --layer-swatch: #4a90d9; }
.layer-child:has([data-layer-option="marks_labels"]) { --layer-swatch: #89939a; }
.layer-child:has([data-layer-option="marks_other"]) { --layer-swatch: #e87840; }

@media (max-width: 700px) {
  .layer-panel-heading { font-size: 13px; }
  .layer-child { min-height: 30px; }
}

.satellite-mark { background: #537a4c; }

/* Only the explicit retry button may reload after a subresource challenge. */
.map-status[data-verification-required="true"] { pointer-events: auto; }
#chart-retry { flex: 0 0 auto; padding: 6px 10px; border: 1px solid #426273; border-radius: 6px; background: #fff; color: #213b4d; font: inherit; cursor: pointer; }
#chart-retry[hidden] { display: none; }
#chart-retry:focus-visible { outline: 2px solid #176b91; outline-offset: 3px; }
