:root {
  --bg: #071f3f;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;
  --text: #10233f;
  --muted: #5a6e84;
  --accent: #123d73;
  --accent-2: #d6a84f;
  --accent-3: #0b2b55;
  --line: rgba(16, 35, 63, 0.14);
  --good: #1f7d56;
  --warn: #a66910;
  --bad: #a53434;
  --shadow: 0 18px 44px rgba(3, 17, 38, 0.26);
  --map-toolbar-height: 4rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #071f3f 0%, #0a2b55 48%, #082244 100%);
  background-color: var(--bg);
}

.app-shell {
  width: min(1440px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 0.5rem 0;
}

.hero {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(18, 61, 115, 0.96), rgba(8, 34, 68, 0.96));
  box-shadow: 0 14px 34px rgba(3, 17, 38, 0.24);
}

.eyebrow {
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.62rem;
  color: var(--accent-2);
  font-weight: 700;
}

.hero h1,
.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(1.2rem, 3vw, 1.9rem);
  max-width: none;
  color: white;
}

.hero-copy,
.section-heading p,
.ship-subline,
.ship-meta,
.empty-state,
.popup-copy {
  color: var(--muted);
}

.hero-copy {
  max-width: 58ch;
  margin: 0.75rem 0 0;
}

.status-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.status-row span {
  color: rgba(255, 255, 255, 0.78);
}

.status-row strong {
  color: white;
}

.view-toggle {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0;
}

.toggle-button {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 0.9rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.toggle-button.is-active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.layout {
  margin-top: 0.55rem;
}

.site-disclaimer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.55rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(214, 168, 79, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
  text-align: center;
}

.site-disclaimer div {
  flex: 1 1 480px;
}

.site-disclaimer strong {
  color: #7b251f;
}

.about-button,
.about-close {
  border: 1px solid #b8882f;
  background: var(--accent-2);
  color: #10233f;
  padding: 0.7rem 0.95rem;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.about-button:hover,
.about-button:focus-visible,
.about-close:hover,
.about-close:focus-visible {
  background: #e4bd69;
  outline: none;
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.about-modal[hidden] {
  display: none;
}

.about-modal.is-open {
  pointer-events: auto;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 17, 38, 0);
  cursor: pointer;
  transition: background 180ms ease;
}

.about-modal.is-open .about-backdrop {
  background: rgba(3, 17, 38, 0.58);
}

.about-panel {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 1.5rem));
  min-height: 100%;
  padding: 1.4rem;
  border-left: 1px solid rgba(16, 35, 63, 0.16);
  background: var(--panel-strong);
  box-shadow: -22px 0 60px rgba(3, 17, 38, 0.28);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.about-modal.is-open .about-panel {
  transform: translateX(0);
}

.about-close {
  float: right;
  margin-left: 1rem;
}

.about-panel h2 {
  margin: 0.25rem 0 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  line-height: 1.08;
  color: var(--accent-3);
}

.about-panel p:not(.eyebrow) {
  margin: 0 0 1rem;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
}

body.has-open-modal {
  overflow: hidden;
}

.panel {
  display: block;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.is-active {
  display: block;
}

.map-toolbar,
.drawer-header,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.map-toolbar {
  flex-wrap: wrap;
}

.map-toolbar h2,
.drawer-header h2,
.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.map-toolbar p,
.drawer-header p,
.section-heading p {
  margin: 0;
  color: var(--muted);
}

.map-actions {
  display: flex;
  flex: 1 1 560px;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.map-action-button {
  flex: 0 0 auto;
  border: 1px solid rgba(18, 61, 115, 0.24);
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  padding: 0.7rem 0.95rem;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.map-action-button:hover,
.map-action-button:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  outline: none;
}

.map-action-button.is-active,
.map-action-button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.ship-list {
  display: grid;
  gap: 0.85rem;
}

.ship-card {
  padding: 0.85rem;
  border-radius: 8px;
  background: var(--panel-strong);
  border: 1px solid rgba(29, 43, 56, 0.09);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.ship-card:hover,
.ship-card:focus-visible {
  border-color: rgba(18, 61, 115, 0.34);
  box-shadow: 0 16px 34px rgba(3, 17, 38, 0.14);
  outline: none;
  transform: translateY(-1px);
}

.ship-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 61, 115, 0.16);
}

.ship-card.no-position {
  cursor: default;
}

.ship-card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.ship-card h3,
.ship-card p {
  margin: 0;
}

.ship-name-link {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.ship-name-link:hover,
.ship-name-link:focus-visible {
  color: #0b2b55;
}

.ship-subline {
  margin-top: 0.25rem;
}

.ship-grid {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.ship-metric {
  padding: 0.65rem;
  border-radius: 8px;
  background: rgba(18, 61, 115, 0.06);
}

.ship-metric span {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.ship-metric strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.92rem;
}

.ship-meta {
  margin-top: 0.9rem;
  font-size: 0.92rem;
}

.ship-card-action {
  margin-top: 0.65rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent);
}

.ship-card.no-position .ship-card-action {
  color: var(--muted);
}

#map {
  width: 100%;
  min-height: calc(100vh - 148px);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 63, 0.1);
  background: #cfe7ef;
}

#map .leaflet-tile-pane {
  filter: saturate(0.92) contrast(0.94) brightness(1.06);
}

.water-wave-shell {
  background: transparent;
  border: 0;
  pointer-events: none;
}

.water-wave {
  width: 44px;
  height: 26px;
  opacity: 0.74;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.84))
    drop-shadow(0 5px 8px rgba(3, 17, 38, 0.14));
  animation: water-wave-bob 3.8s ease-in-out infinite;
}

.water-wave-1 {
  animation-delay: -1.2s;
  transform: scale(0.88) rotate(-4deg);
}

.water-wave-2 {
  animation-delay: -2.1s;
  transform: scale(1.04) rotate(3deg);
}

.water-wave svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.water-wave-crest {
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.water-wave-crest-back {
  opacity: 0.62;
  stroke: #9ad7e5;
  stroke-width: 4;
}

.water-wave-spark {
  fill: #d6a84f;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 1.2;
}

@keyframes water-wave-bob {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .water-wave {
    animation: none;
  }
}

.panel-map {
  position: relative;
  overflow: hidden;
  padding: 0.75rem;
}

.fleet-drawer {
  position: absolute;
  z-index: 500;
  top: calc(var(--map-toolbar-height) + 1.25rem);
  left: 1.25rem;
  width: min(390px, calc(100% - 2.5rem));
  max-height: calc(100% - var(--map-toolbar-height) - 2.25rem);
  overflow: auto;
  padding: 0.95rem;
  border: 1px solid rgba(16, 35, 63, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(3, 17, 38, 0.22);
  backdrop-filter: blur(16px);
  transform: translateX(0);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 180ms ease;
}

.fleet-drawer.is-collapsed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(calc(-100% - 2rem));
}

.drawer-toggle {
  border: 1px solid #b8882f;
  background: var(--accent-2);
  color: #10233f;
  padding: 0.7rem 0.95rem;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(3, 17, 38, 0.22);
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(3, 17, 38, 0.16);
}

.leaflet-popup-content a {
  color: var(--accent);
  font-weight: 800;
}

.ship-marker-shell {
  background: transparent;
  border: 0;
}

.ship-marker {
  width: 48px;
  height: 34px;
  transform: translateY(-2px);
  filter: drop-shadow(0 7px 9px rgba(3, 17, 38, 0.26));
}

.ship-marker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ship-marker-hull {
  fill: var(--accent);
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 2.8;
}

.ship-marker-keel {
  fill: var(--accent-3);
}

.ship-marker-decks,
.ship-marker-bridge {
  fill: #ffffff;
  stroke: var(--accent);
  stroke-linejoin: round;
  stroke-width: 2;
}

.ship-marker-funnel {
  fill: #d43c31;
  stroke: var(--accent);
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ship-marker-window {
  fill: none;
  stroke: var(--accent-2);
  stroke-linecap: round;
  stroke-width: 2;
}

.ship-marker-shadow {
  fill: rgba(18, 61, 115, 0.14);
}

.park-marker-shell {
  background: transparent;
  border: 0;
}

.park-marker {
  width: 38px;
  height: 46px;
  filter: drop-shadow(0 7px 9px rgba(3, 17, 38, 0.24));
}

.park-marker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.park-marker-pin {
  fill: #123d73;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.park-marker-castle {
  fill: #ffffff;
  stroke: #10233f;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.park-marker-gate {
  fill: #d6a84f;
  stroke: #10233f;
  stroke-width: 1.1;
}

.park-marker-roof {
  fill: none;
  stroke: #d6a84f;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.park-marker-label {
  fill: #ffffff;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 8px;
  font-weight: 900;
}

.empty-state {
  padding: 1.1rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (min-width: 840px) {
  .view-toggle {
    display: none;
  }
}

@media (min-width: 640px) {
  .ship-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: calc(100% - 0.5rem);
    padding: 0.25rem 0;
  }

  .hero {
    align-items: flex-start;
    padding: 0.65rem;
  }

  .status-panel {
    display: grid;
    justify-content: stretch;
  }

  .status-row {
    justify-content: space-between;
  }

  .map-toolbar {
    align-items: flex-start;
    gap: 0.65rem;
  }

  .map-toolbar p {
    display: none;
  }

  .map-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .map-action-button,
  .drawer-toggle {
    padding: 0.62rem 0.78rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  #map {
    min-height: calc(100vh - 132px);
  }

  .fleet-drawer {
    top: calc(var(--map-toolbar-height) + 1.5rem);
    left: 0.75rem;
    width: calc(100% - 1.5rem);
    max-height: calc(100% - var(--map-toolbar-height) - 2.25rem);
    border-radius: 8px;
  }

  .site-disclaimer {
    display: block;
    padding: 0.7rem;
    font-size: 0.84rem;
  }

  .site-disclaimer strong {
    display: block;
    margin-bottom: 0.25rem;
  }

  .about-button {
    width: 100%;
    margin-top: 0.65rem;
  }

  .about-panel {
    width: min(360px, calc(100% - 1rem));
    padding: 1.1rem;
  }

  .about-panel h2 {
    font-size: 1.5rem;
  }
}
