.zh-chart {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 380px;
  overflow: hidden;
  isolation: isolate;
  background: #e5ddc7;
  color: #3f463a;
  font-family: var(--serif, 'Songti SC', 'Noto Serif CJK SC', serif);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: grab;
}

.zh-chart--dragging { cursor: grabbing; }
.zh-chart--dragging .zh-chart__haze ellipse,
.zh-chart--dragging .zh-chart__winds path,
.zh-chart--dragging .zh-chart__ship-wake path { animation-play-state: paused; }
.zh-chart:focus-visible { outline: 2px solid #8b4234; outline-offset: -2px; }
.zh-chart::before,
.zh-chart::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.zh-chart::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)' opacity='.44'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  opacity: .46;
}

.zh-chart::after {
  z-index: 2;
  box-shadow: inset 0 0 80px #65533f26, inset 0 0 24px #6e64471d;
  border: 1px solid #57493239;
}

.zh-chart__canvas { display: block; width: 100%; height: 100%; min-height: inherit; }
.zh-chart__haze { pointer-events: none; }
.zh-chart__haze ellipse:not(:first-child) { animation: zh-chart-haze 12s ease-in-out infinite alternate; }
.zh-chart__haze ellipse:nth-child(odd) { animation-delay: -6s; }
@keyframes zh-chart-haze { from { opacity: .47; } to { opacity: .88; } }
.zh-chart__mountains { fill: none; stroke: #394b42; stroke-width: .85; stroke-linecap: round; }
.zh-chart__rivers { fill: none; stroke: #4a6663; stroke-width: .85; stroke-opacity: .55; stroke-linecap: round; stroke-linejoin: round; }
.zh-chart__waves { fill: none; stroke: #666e5c; stroke-width: .56; stroke-opacity: .29; stroke-linecap: round; pointer-events: none; }
.zh-chart__geography { text-anchor: middle; dominant-baseline: middle; font-weight: 600; pointer-events: none; }
.zh-chart__geo-land { font-size: 15px; fill: #293a35; opacity: .66; letter-spacing: .09em; paint-order: stroke; stroke: #afb5a0; stroke-width: .8; }
.zh-chart__geo-water { font-size: 13px; fill: #596255; opacity: .67; letter-spacing: .08em; paint-order: stroke; stroke: #f0ead6; stroke-width: .8; }

.zh-chart__winds { fill: none; stroke: #5d7062; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1; opacity: .43; pointer-events: none; }
.zh-chart__winds path { animation: zh-chart-breeze 3s ease-in-out infinite alternate; }
.zh-chart__weather--storm { stroke: #8b4538; stroke-width: 1.42; }
.zh-chart__weather--ice, .zh-chart__weather--fog { stroke: #596f82; stroke-dasharray: 2 2; }
.zh-chart__weather--calm { opacity: .5; }
.zh-chart__winds g:nth-child(3n+1) path { animation-delay: -.9s; }
.zh-chart__winds g:nth-child(3n+2) path { animation-delay: -2s; }
@keyframes zh-chart-breeze { from { opacity: .43; transform: translateY(4px); } to { opacity: 1; transform: translateY(-2px); } }

.zh-chart__route { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.zh-chart__route-stroke,
.zh-chart__route-hit { vector-effect: non-scaling-stroke; }
.zh-chart__route-stroke { pointer-events: none; }
.zh-chart__route--distant { stroke: #827354; stroke-dasharray: 2 5; stroke-width: 1.15; opacity: .39; }
.zh-chart__route--visited { stroke: #576450; stroke-dasharray: 3 5; stroke-width: 1.15; opacity: .55; }
.zh-chart__route--next { stroke: #8b3929; stroke-dasharray: 4 4; stroke-width: 1.85; opacity: .86; }
.zh-chart__route--selected { stroke: #983c2c; stroke-dasharray: 5 3; stroke-width: 2.35; }
.zh-chart__route--active { stroke: #983c2c; stroke-dasharray: 5 3; stroke-width: 2.35; }
.zh-chart__route[role='button'] { cursor: pointer; }
.zh-chart__route[role='button']:focus-visible { outline: 0; }
.zh-chart__route[role='button']:is(:hover, :focus-visible) > .zh-chart__route-stroke { stroke: #a13a25; stroke-width: 3; }
.zh-chart__route-hit { fill: none; stroke: transparent; stroke-width: 17; pointer-events: stroke; }
.zh-chart__route-point { fill: #875d49; stroke: #f5e8cb; stroke-width: 1; stroke-dasharray: none; vector-effect: non-scaling-stroke; pointer-events: none; }

.zh-chart__port { color: #675b40; pointer-events: none; }
.zh-chart__port[role='button'] { cursor: pointer; pointer-events: auto; }
.zh-chart__port[role='button']:focus-visible { outline: 0; }
.zh-chart__port[role='button']:is(:hover, :focus-visible) { color: #7d2c1f; }
.zh-chart__port[role='button']:is(:hover, :focus-visible) .zh-chart__port-dot { stroke-width: 2; }
.zh-chart__port--current,
.zh-chart__port--next { color: #963e2e; }
.zh-chart__port--visited { color: #465744; }
.zh-chart__port--station.zh-chart__port--distant { color: #4f6556; }
.zh-chart__port-hit { fill: transparent; }
.zh-chart__port-dot { fill: #f0e6ca; stroke: currentColor; stroke-width: 1.25; }
.zh-chart__port--station.zh-chart__port--distant .zh-chart__port-dot { fill: #e9e3c5; }
.zh-chart__port--current .zh-chart__port-dot { fill: currentColor; stroke: #f7ead0; }
.zh-chart__port-ring { fill: none; stroke: currentColor; stroke-width: .9; opacity: .69; }
.zh-chart__port text { fill: currentColor; stroke: #ece3ca; stroke-width: 2; paint-order: stroke; font-size: 11px; font-weight: 650; letter-spacing: .055em; }
.zh-chart__port--next text, .zh-chart__port--current text { font-size: 13px; }
.zh-chart__course-marks { pointer-events: none; }
.zh-chart__destination { fill: none; stroke: #983c2c; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.zh-chart__course-fix { fill: none; stroke: #914d38; stroke-opacity: .65; stroke-dasharray: 2 4; stroke-width: 1.05; vector-effect: non-scaling-stroke; }
.zh-chart__waypoint-leader { fill: none; stroke: #914d38; stroke-opacity: .6; stroke-dasharray: 1 3; stroke-width: .8; vector-effect: non-scaling-stroke; }
.zh-chart__waypoint > path:first-child { fill: #f2e6ca; stroke: #914b37; stroke-width: 1.15; }
.zh-chart__waypoint > path:nth-child(2) { fill: #914b37; }
.zh-chart__guides { pointer-events: none; }
.zh-chart__pin-guide { fill: none; stroke: #385f5b; stroke-opacity: .76; stroke-width: 1.6; stroke-dasharray: 5 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.zh-chart__pin-guide--sounded { stroke: #285854; stroke-opacity: .92; stroke-width: 2.25; }
.zh-chart__pin { cursor: pointer; }
.zh-chart__pin:focus-visible { outline: 0; }
.zh-chart__pin-hit { fill: transparent; }
.zh-chart__pin-shape { fill: #efe7d0; stroke: #385d5b; stroke-width: 1.5; }
.zh-chart__pin-core { fill: #385d5b; }
.zh-chart__pin:is(:hover, :focus-visible) .zh-chart__pin-shape { stroke-width: 2.2; }
.zh-chart__pin--active .zh-chart__pin-shape { fill: #385d5b; stroke: #f3e6c9; }
.zh-chart__pin--active .zh-chart__pin-core { fill: #f3e6c9; }
.zh-chart__pin text { fill: #294f4d; stroke: #eee4c9; stroke-width: 2.2; paint-order: stroke; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.zh-chart__pin--active text { font-size: 13px; }
.zh-chart__pin--sighting .zh-chart__pin-shape { stroke: #973f2c; stroke-dasharray: 2 1; }
.zh-chart__pin--sighting .zh-chart__pin-core { fill: #973f2c; }
.zh-chart__pin--sighting text { fill: #853721; }
.zh-chart__pin--survey-lead .zh-chart__pin-shape { fill: #ead7a4; stroke: #6e5329; }
.zh-chart__pin--survey-lead .zh-chart__pin-core,
.zh-chart__pin--survey-lead text { fill: #6e5329; }
.zh-chart__fleet { pointer-events: none; }
.zh-chart__fleet-mooring { fill: none; stroke: #705647; stroke-width: .85; stroke-dasharray: 2 2; opacity: .63; }
.zh-chart__escorts { opacity: .75; }
.zh-chart__ship-art { filter: drop-shadow(1px 2px 2px #45382154); }
.zh-chart__ship-drawing { stroke-linejoin: round; }
.zh-chart__ship-shadow { fill: #41382b; opacity: .22; transform: translate(.5px, 2px); }
.zh-chart__ship-hull { fill: #45382b; stroke: #e9d4a3; stroke-width: 1.1; }
.zh-chart__ship-rim { fill: #766049; stroke: #291f15; stroke-width: .85; }
.zh-chart__ship-deck { fill: #ad8f63; stroke: #4b3928; stroke-width: .8; }
.zh-chart__ship-planks { fill: none; stroke: #54402d; stroke-opacity: .7; stroke-width: .45; }
.zh-chart__ship-stern { fill: #6e3e30; stroke: #33261a; stroke-width: .75; }
.zh-chart__ship-trim { fill: none; stroke: #cab183; stroke-width: .55; }
.zh-chart__ship-mast { fill: none; stroke: #342a21; stroke-width: 1.25; stroke-linecap: round; }
.zh-chart__ship-sail { fill: #9d5540; stroke: #422e24; stroke-width: .85; }
.zh-chart__ship-battens { fill: none; stroke: #e4ba84; stroke-width: .56; }
.zh-chart__ship-pennant { fill: #9d3d2d; stroke: #442a22; stroke-width: .65; }
.zh-chart__ship-wake { fill: none; stroke: #5f796c; stroke-width: .75; stroke-linecap: round; opacity: .42; }
.zh-chart__ship-wake path { animation: zh-chart-wake 2s ease-out infinite; }
@keyframes zh-chart-wake { from { transform: translateY(-2px); opacity: .75; } to { transform: translateY(4px); opacity: .25; } }
.zh-chart__helm-line { fill: none; stroke: #395b52; stroke-width: 1.3; stroke-linecap: round; }
.zh-chart__helm-tip { fill: #395b52; }

.zh-chart__hud { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.zh-chart__caption {
  position: absolute;
  top: 15px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4e503d;
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: .09em;
}

.zh-chart__caption > span:first-child {
  padding: 4px 6px 3px 7px;
  background: #e6dac1df;
  border: 1px solid #934d3b7a;
  color: #8d3e2f;
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .15em;
}

.zh-chart__coordinates {
  min-width: 115px;
  padding: 2px 4px;
  background: #e9e0c5aa;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9px;
  letter-spacing: .035em;
}

.zh-chart__controls {
  position: absolute;
  top: 15px;
  right: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(29px, 33px));
  box-shadow: 0 2px 8px #3d332223;
  background: #efe6cf;
  border: 1px solid #82755661;
  pointer-events: auto;
}

.zh-chart__controls--waypoints { grid-template-columns: repeat(5, minmax(29px, 33px)) minmax(60px, auto); }
.zh-chart__controls--waypoints.zh-chart__controls--sail { grid-template-columns: repeat(5, minmax(29px, 33px)) minmax(55px, auto) minmax(74px, auto); }

.zh-chart__controls button {
  appearance: none;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 0;
  border-inline-end: 1px solid #ab987253;
  border-radius: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: #4c4937;
  font: 16px/1 Georgia, serif;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.zh-chart__controls button:last-child { border-inline-end: 0; }
.zh-chart__controls button:disabled { color: #958a73; cursor: default; }
.zh-chart__controls button:is(:hover, :active, :focus-visible, [aria-pressed='true']):not(:disabled) { background: #dfd4b8; color: #8f402f; }
.zh-chart__controls button:focus-visible { outline: 1px solid #8f402f; outline-offset: -2px; }
.zh-chart__controls .zh-chart__wind-switch { font-size: 18px; }
.zh-chart__controls .zh-chart__place { background: #405e55; color: #fff1d2; font: 700 13px/1 var(--serif, serif); white-space: nowrap; }
.zh-chart__controls .zh-chart__place:is(:hover, :active, :focus-visible, [aria-pressed='true']) { background: #2d4c45; color: #fff2d5; outline-color: #ede2c6; }
.zh-chart__controls .zh-chart__sail-to { padding-inline: 6px; color: #78372a; font: 700 13px/1 var(--serif, serif); white-space: nowrap; }
.zh-chart__controls .zh-chart__sail-to[aria-pressed='true'] { background: #7e3a2d; color: #fff4d9; outline-color: #f1e7d0; }

.zh-chart--placing,
.zh-chart--placing .zh-chart__canvas :is(.zh-chart__route, .zh-chart__port, .zh-chart__pin) { cursor: crosshair; }
.zh-chart--placing.zh-chart--dragging { cursor: grabbing; }
.zh-chart__placement-hint {
  position: absolute;
  top: 57px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  border: 1px solid #62766b;
  background: #f2ead4;
  box-shadow: 0 2px 8px #3b3d3022;
  color: #34544c;
  padding: 6px 9px;
  font-size: 12px;
  text-align: center;
}
.zh-chart__placement-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  transform: translate(-50%, -50%);
  border: 1px solid #375d54;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #eee6d1;
  color: #375d54;
}
.zh-chart__placement-center::before,
.zh-chart__placement-center::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: currentColor; }
.zh-chart__placement-center::before { width: 24px; height: 1px; }
.zh-chart__placement-center::after { width: 1px; height: 24px; }

.zh-chart__rose {
  position: absolute;
  right: 13px;
  bottom: 17px;
  width: 92px;
  height: 92px;
  opacity: .8;
  filter: drop-shadow(0 1px 1px #e9ddc5);
}

.zh-chart__rose svg { display: block; width: 100%; height: 100%; fill: none; stroke: #6b5c43; stroke-width: .7; }
.zh-chart__rose .zh-chart__rose-guides { stroke: #776953; opacity: .29; }
.zh-chart__rose .zh-chart__rose-north { fill: #a14d3d; stroke: #a14d3d; }
.zh-chart__rose .zh-chart__rose-south { fill: #77765b; stroke: #77765b; }
.zh-chart__rose text { fill: #574934; stroke: none; text-anchor: middle; font-size: 9px; }

.zh-chart__legend {
  position: absolute;
  bottom: 14px;
  left: 17px;
  display: grid;
  gap: 6px;
  padding: 7px 8px 5px;
  background: linear-gradient(100deg, #e9dfc8c4, #e9dfc800);
  color: #5a5039;
  font-size: 10px;
  letter-spacing: .04em;
}

.zh-chart__legend-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 13px; }
.zh-chart__legend-keys > span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.zh-chart__key-route { display: inline-block; width: 14px; border-top: 1px dashed #963e2e; }
.zh-chart__key-port { display: inline-block; width: 7px; height: 7px; border: 1px solid #78664a; border-radius: 50%; background: #efe3c4; }
.zh-chart__key-station { display: inline-block; width: 7px; height: 7px; border: 1px solid #4f6556; border-radius: 50%; background: #e9e3c5; }
.zh-chart__key-survey { display: inline-block; width: 7px; height: 7px; border: 1px solid #6e5329; background: #ead7a4; transform: rotate(45deg); }
.zh-chart__scale { width: var(--ruler, 56px); border: solid #79694d; border-width: 0 1px 1px; padding: 0 3px 2px; text-align: center; font-size: 9px; line-height: 1; white-space: nowrap; }

@media (max-width: 600px), (orientation: landscape) and (max-width: 1024px) and (max-height: 540px) {
  .zh-chart { min-height: 0; }
}

@media (max-width: 600px) {
  .zh-chart__caption { left: 11px; top: 11px; gap: 6px; }
  .zh-chart__coordinates { position: absolute; top: 27px; left: 0; }
  .zh-chart__controls { top: auto; right: auto; bottom: 11px; left: 11px; }
  .zh-chart__legend { bottom: 63px; left: 10px; padding-left: 4px; }
  .zh-chart__legend-keys { gap: 5px 9px; }
  .zh-chart__rose { right: 8px; top: 9px; bottom: auto; height: 63px; width: 63px; }
}

@media (max-width: 600px), (any-pointer: coarse) {
  .zh-chart__controls { grid-template-columns: repeat(5, 44px); }
  .zh-chart__controls--waypoints { grid-template-columns: repeat(5, 44px) 56px; }
  .zh-chart__controls--waypoints.zh-chart__controls--sail { grid-template-columns: repeat(5, 44px) 56px 68px; }
  .zh-chart__controls button { height: 44px; font-size: 19px; }
  .zh-chart__controls .zh-chart__wind-switch { font-size: 21px; }
  .zh-chart__controls .zh-chart__place { font-size: 13px; }
  .zh-chart__route-hit { stroke-width: 24; }
  .zh-chart__port-hit { r: 15px; }
  .zh-chart__port--current .zh-chart__port-hit,
  .zh-chart__port--next .zh-chart__port-hit { r: 18px; }
  .zh-chart__pin-hit { r: 18px; }
}

@media (max-width: 400px) {
  .zh-chart__controls--waypoints.zh-chart__controls--sail { grid-template-columns: repeat(5, 44px); }
  .zh-chart__controls--waypoints.zh-chart__controls--sail .zh-chart__place { grid-column: span 2; }
  .zh-chart__controls--waypoints.zh-chart__controls--sail .zh-chart__sail-to { grid-column: span 3; }
  .zh-chart:has(.zh-chart__controls--sail) .zh-chart__legend { bottom: 108px; }
}

@media (prefers-reduced-motion: reduce) {
  .zh-chart__haze ellipse, .zh-chart__winds path, .zh-chart__ship-wake path { animation: none; }
}
