:root {
  --sea-950: #062c33;
  --sea-900: #0b3c43;
  --sea-800: #12535a;
  --sea-700: #176b70;
  --sea-accent: #0e8f7c;
  --sea-accent-soft: #d8f2eb;
  --surface: #f5f8f7;
  --surface-raised: #ffffff;
  --ink: #102a2d;
  --muted: #5d7374;
  --border: #d5e1df;
  --map-panel: rgb(255 255 255 / 0.96);
  --shadow: 0 16px 46px rgb(7 47 51 / 0.14);
  --radius: 14px;
  --header-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #092f35;
    --surface-raised: #104249;
    --ink: #e4f1ef;
    --muted: #aec5c2;
    --border: #276066;
    --map-panel: rgb(9 47 53 / 0.97);
    --sea-accent-soft: #124c46;
    --shadow: 0 16px 46px rgb(0 0 0 / 0.26);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-width: 320px;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  font-family: Arial, Helvetica, sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--sea-accent); outline-offset: 2px; }

.skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 1000;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  color: #fff;
  background: var(--sea-950);
}
.skip-link:focus { top: 0.75rem; }

.sea-header {
  position: relative;
  z-index: 700;
  height: var(--header-height);
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.sea-brand { display: inline-flex; align-items: center; gap: 0.6rem; color: inherit; text-decoration: none; font-size: 0.96rem; font-weight: 800; letter-spacing: 0.08em; white-space: nowrap; }
.sea-brand img { width: 30px; height: 30px; }
.sea-brand b { color: var(--sea-accent); font-weight: 800; }
.refresh-button { min-width: 5.5rem; padding: 0.55rem 0.85rem; border: 1px solid var(--sea-accent); border-radius: 999px; color: #fff; background: var(--sea-accent); font-size: 0.82rem; font-weight: 800; white-space: nowrap; transition: transform 160ms ease, background 160ms ease; }
.refresh-button:hover { background: #087261; }
.refresh-button:active { transform: translateY(1px) scale(0.98); }

.sea-workspace { position: relative; min-height: calc(100dvh - var(--header-height)); }
.map-stage { position: relative; min-height: calc(100dvh - var(--header-height)); overflow: hidden; background: var(--sea-800); }
#map { position: absolute; inset: 0; z-index: 250; }
.map-scrim { pointer-events: none; position: absolute; inset: 0; z-index: 200; background: linear-gradient(180deg, rgb(6 44 51 / 0.7) 0%, transparent 22%, transparent 74%, rgb(6 44 51 / 0.48) 100%); }
.map-controls { position: absolute; z-index: 300; top: 1.35rem; left: 1.5rem; padding: 0.35rem; border: 1px solid rgb(255 255 255 / 0.2); border-radius: var(--radius); background: rgb(6 44 51 / 0.82); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 0.2rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.layer-label { padding: 0 0.5rem; color: rgb(255 255 255 / 0.68); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.layer-button { border: 0; border-radius: 9px; padding: 0.45rem 0.6rem; color: #d9ece9; background: transparent; font-size: 0.78rem; font-weight: 700; transition: background 160ms ease, color 160ms ease, transform 160ms ease; }
.layer-button:hover { background: rgb(255 255 255 / 0.1); }
.layer-button.active { color: var(--sea-950); background: #fff; }
.layer-button:active { transform: scale(0.98); }
.location-button { position: absolute; z-index: 300; top: 4.85rem; left: 1.5rem; min-height: 44px; padding: 0.45rem 0.75rem; border: 1px solid rgb(255 255 255 / 0.2); border-radius: var(--radius); color: #e8f6f3; background: rgb(6 44 51 / 0.82); font-size: 0.78rem; font-weight: 800; }
.location-button:hover { background: rgb(6 44 51 / 0.96); }
.location-button:disabled { cursor: wait; opacity: 0.7; }
.map-status { position: absolute; z-index: 300; top: 8.25rem; left: 1.5rem; max-width: 320px; padding: 0.55rem 0.7rem; border: 1px solid rgb(255 255 255 / 0.18); border-radius: 10px; color: #eef9f7; background: rgb(6 44 51 / 0.84); font-size: 0.75rem; font-weight: 600; }
.map-legend { position: absolute; z-index: 300; bottom: 1.25rem; left: 1.25rem; max-width: 320px; padding: 0.6rem 0.75rem; border: 1px solid rgb(255 255 255 / 0.18); border-radius: 10px; color: #e8f6f3; background: rgb(6 44 51 / 0.84); font-size: 0.7rem; }
.map-legend summary { cursor: pointer; color: #fff; font-size: 0.72rem; font-weight: 800; }
.map-legend[open] summary { margin-bottom: 0.4rem; }
.map-legend:not([open]) { padding-block: 0.5rem; }
.legend-row { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.map-legend span { display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.legend-mark { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.speed-still { background: #64748b; }.speed-slow { background: #f1b94c; }.speed-fast { background: #0e8f7c; }
.legend-shape { display: inline-block; width: 9px; height: 9px; background: #cfe9e4; border: 1px solid rgb(255 255 255 / 0.8); border-radius: 2px; }
.legend-shape.shape-triangle { width: 0; height: 0; background: transparent; border: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 9px solid #cfe9e4; }
.legend-shape.shape-circle { border-radius: 50%; }
.legend-shape.shape-diamond { transform: rotate(45deg); }
.legend-shape.shape-dot { width: 6px; height: 6px; border-radius: 50%; }
.legend-trail { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #e8f6f3, transparent); }
.legend-notch { display: inline-block; width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 6px solid #e8f6f3; }

.sea-panel { position: absolute; top: 0; right: 0; z-index: 500; width: min(360px, calc(100% - 2rem)); height: calc(100dvh - var(--header-height)); overflow-y: auto; padding: 1.1rem 1.35rem 1.35rem; border-left: 1px solid var(--border); background: var(--map-panel); box-shadow: var(--shadow); transition: transform 180ms ease-out; }
.sea-workspace.panel-closed .sea-panel { transform: translateX(calc(100% + 1rem)); }
.panel-toggle { position: absolute; z-index: 300; top: 1.35rem; right: 1.5rem; min-height: 44px; padding: 0.45rem 0.75rem; border: 1px solid rgb(255 255 255 / 0.2); border-radius: var(--radius); color: #e8f6f3; background: rgb(6 44 51 / 0.82); font-size: 0.78rem; font-weight: 800; }
.panel-toggle-close { display: none; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--border); }
.panel-kicker { margin: 0 0 0.2rem; color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.panel-header h2 { margin: 0; color: var(--ink); font-size: 1.2rem; letter-spacing: -0.03em; }
.panel-close { width: 44px; height: 44px; margin: -0.45rem -0.45rem 0 0; border: 1px solid var(--border); border-radius: 50%; color: var(--ink); background: var(--surface-raised); font-size: 1rem; flex: 0 0 auto; }
.panel-handle { display: none; }
.vessel-search { display: grid; gap: 0.35rem; margin-top: 0; color: var(--muted); font-size: 0.77rem; font-weight: 700; }
.vessel-search input { width: 100%; padding: 0.72rem 0.8rem; border: 1px solid var(--border); border-radius: 10px; outline: none; color: var(--ink); background: var(--surface-raised); }
.vessel-search input::placeholder { color: var(--muted); opacity: 0.75; }
.vessel-search input:focus { border-color: var(--sea-accent); }
.search-results { min-height: 0; max-height: 158px; overflow-y: auto; }
.search-result { width: 100%; padding: 0.66rem 0; border: 0; border-bottom: 1px solid var(--border); color: var(--ink); background: transparent; text-align: left; }
.search-result:hover { color: var(--sea-accent); }.search-result strong, .search-result span { display: block; }.search-result strong { font-size: 0.84rem; }.search-result span { margin-top: 0.15rem; color: var(--muted); font-size: 0.72rem; }
.panel-summary { padding: 0.9rem 0 0; }
.overview-grid { margin: 0 0 1rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.metric { min-height: 76px; padding: 0.65rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-size: 0.69rem; font-weight: 700; }.metric strong { color: var(--ink); font-size: 1.32rem; letter-spacing: -0.045em; }
.sea-spot-cta { display: block; margin-top: 0.7rem; padding: 0.65rem 0.8rem; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--sea-accent), var(--sea-700)); text-decoration: none; }
.sea-spot-cta strong { display: block; font-size: 0.82rem; font-weight: 800; }
.sea-spot-cta span { display: block; margin-top: 0.15rem; font-size: 0.72rem; font-weight: 600; color: rgb(255 255 255 / 0.88); }
.panel-tabs { display: flex; gap: 0.3rem; margin-top: 0.9rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--border); }
.panel-tabs a { flex: 1; padding: 0.5rem 0.35rem; border-radius: 8px; color: var(--muted); font-size: 0.78rem; font-weight: 700; text-align: center; text-decoration: none; transition: background 160ms ease, color 160ms ease; }
.panel-tabs a:hover { background: var(--sea-accent-soft); color: var(--ink); }
.panel-tabs a.active { background: var(--sea-accent); color: #fff; }
.panel-overview { margin-top: 0.9rem; border-bottom: 1px solid var(--border); }
.panel-overview summary { display: flex; align-items: center; min-height: 44px; color: var(--ink); cursor: pointer; font-size: 0.8rem; font-weight: 800; }
.panel-overview summary::marker { color: var(--sea-accent); }
.panel-view { display: none; padding-top: 1.1rem; }.panel-view.active { display: block; }
.empty-state { padding: 1rem 0.15rem; color: var(--muted); }.empty-state strong { display: block; color: var(--ink); font-size: 0.93rem; }.empty-state p { margin: 0.4rem 0 0; font-size: 0.82rem; line-height: 1.55; }
.explorer-empty { margin-top: 0.8rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); }
.vessel-detail { display: grid; gap: 1rem; }.hidden { display: none !important; }
.watch-button { margin-top: 0.6rem; padding: 0.42rem 0.6rem; border: 1px solid var(--sea-accent); border-radius: 8px; color: var(--sea-accent); background: transparent; font-size: 0.72rem; font-weight: 800; }
.watch-button:hover { color: #fff; background: var(--sea-accent); }
.detail-back { margin-bottom: 0.7rem; padding: 0; border: 0; color: var(--sea-accent); background: transparent; font-size: 0.78rem; font-weight: 700; }
.detail-back:hover { text-decoration: underline; }
.detail-status { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.72rem; }
.vessel-identity { padding-bottom: 0.85rem; border-bottom: 1px solid var(--border); }.vessel-identity h3 { margin: 0; font-size: 1.3rem; letter-spacing: -0.035em; }.vessel-identity p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.77rem; }
.detail-section h4 { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.11em; }.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }.detail-grid div { padding: 0.58rem; border-radius: 10px; background: var(--sea-accent-soft); }.detail-grid span { display: block; color: var(--muted); font-size: 0.66rem; font-weight: 700; }.detail-grid strong { display: block; margin-top: 0.18rem; color: var(--ink); font-size: 0.82rem; overflow-wrap: anywhere; }
.movement-card, .board-item { padding: 0.9rem 0; border-bottom: 1px solid var(--border); }.movement-card:first-child { padding-top: 0; }.board-item:first-child { padding-top: 0.7rem; }.movement-card strong, .board-item strong { display: block; font-size: 0.86rem; }.movement-card span, .board-item span { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.75rem; line-height: 1.4; }.board-item { width: 100%; border-left: 0; border-right: 0; border-top: 0; color: var(--ink); background: transparent; text-align: left; }.board-item:hover strong { color: var(--sea-accent); }
.board-summary { margin-bottom: 0.45rem; padding: 0.9rem; border-radius: var(--radius); background: var(--sea-accent-soft); }.board-summary strong { display: block; color: var(--ink); font-size: 0.9rem; }.board-summary span { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.72rem; }
.trend-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; margin: 1rem 0; }.trend-metric { padding: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); }.trend-metric span { display: block; color: var(--muted); font-size: 0.69rem; font-weight: 700; }.trend-metric strong { display: block; margin-top: 0.25rem; font-size: 1.4rem; letter-spacing: -0.05em; }.type-row { display: flex; align-items: center; justify-content: space-between; padding: 0.68rem 0; border-bottom: 1px solid var(--border); font-size: 0.8rem; }.type-row span { color: var(--muted); }
.source-note { margin: 1.2rem 0 0; color: var(--muted); font-size: 0.68rem; line-height: 1.5; }
.source-note a { color: var(--sea-accent); }

.vessel-marker-wrap { position: relative; width: 18px; height: 18px; }
.marker-trail { position: absolute; top: 50%; left: 50%; margin-left: -1.5px; width: 3px; height: var(--trail-len, 0); transform-origin: top center; background: linear-gradient(to bottom, var(--marker-color, #0e8f7c), transparent); border-radius: 3px; opacity: 0.7; pointer-events: none; }
.vessel-marker { position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; transform: translate(-50%, -50%); box-shadow: 0 2px 6px rgb(0 0 0 / 0.3); }
.vessel-marker.shape-triangle { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 12px solid var(--marker-color, #0e8f7c); background: transparent; box-shadow: none; transform: translate(-50%, -50%); }
.vessel-marker.shape-circle { border: 2px solid rgb(255 255 255 / 0.92); border-radius: 50%; background: var(--marker-color, #0e8f7c); }
.vessel-marker.shape-square { width: 11px; height: 11px; border: 2px solid rgb(255 255 255 / 0.92); border-radius: 2px; background: var(--marker-color, #0e8f7c); }
.vessel-marker.shape-diamond { width: 10px; height: 10px; border: 2px solid rgb(255 255 255 / 0.92); border-radius: 2px; background: var(--marker-color, #0e8f7c); }
.vessel-marker.shape-dot { width: 9px; height: 9px; border: 2px solid rgb(255 255 255 / 0.92); border-radius: 50%; background: var(--marker-color, #0e8f7c); }
.marker-heading { position: absolute; inset: 0; pointer-events: none; }
.marker-heading i { position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-left: 3px solid transparent; border-right: 3px solid transparent; border-bottom: 6px solid var(--marker-color, #0e8f7c); transform: translate(-50%, -50%) translateY(-6.5px); filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.45)); }
.vessel-marker-wrap.is-selected { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 2px 4px rgb(0 0 0 / 0.54)); }
.leaflet-container { font-family: Arial, Helvetica, sans-serif; background: var(--sea-800); }
.leaflet-tooltip.vessel-tooltip { padding: 0.5rem 0.65rem; border: 1px solid rgb(255 255 255 / 0.18); border-radius: 10px; color: #eaf8f5; background: rgb(6 44 51 / 0.92); font-size: 0.72rem; font-weight: 600; box-shadow: 0 8px 20px rgb(0 0 0 / 0.24); }
.leaflet-tooltip.vessel-tooltip strong { display: block; font-size: 0.78rem; }
.leaflet-tooltip.vessel-tooltip span { display: block; margin-top: 0.15rem; color: rgb(234 248 245 / 0.75); font-weight: 600; }
.leaflet-tooltip-top.vessel-tooltip::before { border-top-color: rgb(6 44 51 / 0.92) !important; }
.noscript-notice { padding: 1rem; color: var(--ink); background: var(--surface); }

.sea-info { background: var(--sea-800); border-top: 1px solid rgb(255 255 255 / 0.08); }
.sea-info-inner { max-width: 860px; margin: 0 auto; padding: 3rem 1.5rem 3.5rem; color: rgb(234 248 245 / 0.92); }
.sea-info-inner h2 { margin: 0 0 0.9rem; color: #fff; font-size: clamp(1.4rem, 2.2vw, 1.9rem); letter-spacing: -0.03em; }
.sea-info-inner h3 { margin: 2.1rem 0 1rem; color: #fff; font-size: 1.1rem; letter-spacing: -0.02em; }
.sea-info-inner p { margin: 0 0 0.9rem; font-size: 0.95rem; line-height: 1.65; color: rgb(234 248 245 / 0.78); }
.sea-faq { display: grid; gap: 0; margin: 0; }
.sea-faq details { padding: 1.05rem 0; border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.sea-faq details:last-child { border-bottom: 0; padding-bottom: 0; }
.sea-faq details:first-child { padding-top: 0; }
.sea-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: #fff; font-size: 0.92rem; font-weight: 700; cursor: pointer; list-style: none; }
.sea-faq summary::-webkit-details-marker { display: none; }
.sea-faq summary::after { content: "+"; flex-shrink: 0; color: rgb(234 248 245 / 0.6); font-size: 1.1rem; font-weight: 400; }
.sea-faq details[open] summary::after { content: "−"; }
.sea-faq details p { margin: 0.55rem 0 0; color: rgb(234 248 245 / 0.75); font-size: 0.86rem; line-height: 1.6; }
.sea-attribution { margin: 2.1rem 0 0; padding-top: 1.3rem; border-top: 1px solid rgb(255 255 255 / 0.08); color: rgb(234 248 245 / 0.6); font-size: 0.72rem; line-height: 1.6; }
.sea-attribution a { color: var(--sea-accent); }

@media (max-width: 980px) {
  .map-controls { left: 1rem; top: 1rem; }
  .panel-toggle { top: 1rem; right: 1rem; }
  .location-button { top: 4.5rem; left: 1rem; }
  .map-status { top: 7.9rem; left: 1rem; }
}
@media (max-width: 767px) {
  body { overflow: auto; }.sea-header { position: sticky; top: 0; height: 58px; padding: 0 0.75rem; gap: 0.45rem; }.sea-brand span { font-size: 0.78rem; }.sea-brand img { width: 26px; height: 26px; }.refresh-button { min-width: 0; padding: 0.45rem 0.6rem; font-size: 0.72rem; }
  .sea-workspace { min-height: calc(100dvh - 58px); }.map-stage { height: calc(100dvh - 58px); min-height: 440px; }.map-controls { top: 1rem; left: 0.75rem; right: auto; max-width: calc(100% - 1.5rem); }.layer-label { display: none; }.layer-button { min-height: 44px; }.panel-toggle { top: auto; right: 0.75rem; bottom: 1rem; z-index: 550; }.leaflet-top.leaflet-right { top: 3.6rem; }.weather-map-card { max-width: 150px; padding: 0.4rem 0.6rem; font-size: 0.66rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.map-legend { left: 0.75rem; right: 0.75rem; bottom: 4.5rem; max-width: none; gap: 0.3rem; font-size: 0.64rem; }.legend-row { gap: 0.4rem; }.map-status { right: 0.75rem; bottom: auto; top: 6.1rem; max-width: 150px; font-size: 0.67rem; }
  .sea-panel { top: auto; bottom: 0; width: 100%; height: min(64dvh, 600px); padding: 0.45rem 1rem max(1rem, env(safe-area-inset-bottom)); border: 0; border-radius: 18px 18px 0 0; transform: translateY(0); }.sea-workspace.panel-closed .sea-panel { transform: translateY(calc(100% - 64px)); }.panel-handle { display: block; width: 36px; height: 4px; margin: 0.15rem auto 0.5rem; border-radius: 999px; background: var(--border); }.panel-header { padding-bottom: 0.7rem; }.panel-header h2 { font-size: 1.05rem; }.panel-close { margin-top: -0.3rem; }.overview-grid { margin-bottom: 0.85rem; }.metric { min-height: 68px; }.source-note { padding-bottom: 0.5rem; }
  .location-button { top: 4.5rem; left: 0.75rem; }
  .map-status { top: 7.5rem; left: 0.75rem; right: auto; max-width: min(240px, calc(100% - 1.5rem)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; } }
