:root {
  --bg: #f4efe7;
  --panel: rgba(255, 250, 242, 0.92);
  --panel-strong: #fff8ef;
  --text: #1d2b38;
  --muted: #596b79;
  --accent: #0f6c74;
  --accent-2: #f0a23b;
  --line: rgba(29, 43, 56, 0.12);
  --good: #1f8f58;
  --warn: #ce7d1a;
  --bad: #b44343;
  --shadow: 0 20px 50px rgba(18, 38, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 108, 116, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(240, 162, 59, 0.18), transparent 28%),
    linear-gradient(180deg, #f6f1ea 0%, #efe5d6 100%);
}

.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.7rem 0.85rem;
  border: 1px solid rgba(29, 43, 56, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 239, 0.88)),
    linear-gradient(120deg, rgba(15, 108, 116, 0.08), rgba(240, 162, 59, 0.08));
  box-shadow: 0 10px 26px rgba(18, 38, 54, 0.08);
}

.eyebrow {
  margin: 0 0 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.62rem;
  color: var(--accent);
  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;
}

.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: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

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

.status-row span {
  color: var(--muted);
}

.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: 999px;
  font-weight: 700;
  cursor: pointer;
}

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

.layout {
  margin-top: 0.55rem;
}

.panel {
  display: block;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 28px;
  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 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);
}

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

.ship-card {
  padding: 0.85rem;
  border-radius: 18px;
  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(15, 108, 116, 0.34);
  box-shadow: 0 16px 34px rgba(18, 38, 54, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.ship-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 108, 116, 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-subline {
  margin-top: 0.25rem;
}

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

.ship-metric {
  padding: 0.65rem;
  border-radius: 14px;
  background: rgba(15, 108, 116, 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);
}

.status-badge {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-live {
  background: rgba(31, 143, 88, 0.12);
  color: var(--good);
}

.status-stale {
  background: rgba(206, 125, 26, 0.12);
  color: var(--warn);
}

.status-offline {
  background: rgba(180, 67, 67, 0.12);
  color: var(--bad);
}

#map {
  width: 100%;
  min-height: calc(100vh - 148px);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(29, 43, 56, 0.1);
}

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

.fleet-drawer {
  position: absolute;
  z-index: 500;
  top: 5rem;
  left: 1.25rem;
  width: min(390px, calc(100% - 2.5rem));
  max-height: calc(100% - 6rem);
  overflow: auto;
  padding: 0.95rem;
  border: 1px solid rgba(29, 43, 56, 0.14);
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.94);
  box-shadow: 0 22px 60px rgba(18, 38, 54, 0.18);
  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 rgba(15, 108, 116, 0.2);
  background: var(--accent);
  color: white;
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 108, 116, 0.2);
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
}

.marker-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 2px solid white;
  box-shadow: 0 0 0 4px rgba(15, 108, 116, 0.18);
}

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

@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;
  }

  .map-toolbar p {
    display: none;
  }

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

  .fleet-drawer {
    top: 4.4rem;
    left: 0.75rem;
    width: calc(100% - 1.5rem);
    max-height: calc(100% - 5.25rem);
    border-radius: 20px;
  }
}
