:root {
  color-scheme: light;
  --ink: #102c3c;
  --muted: #57717e;
  --teal: #007f7b;
  --line: #dae5e9;
  --paper: #f7fafb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #aad3df;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #008d91;
  outline-offset: 3px;
}
button {
  border: 0;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button[hidden],
[hidden] {
  display: none !important;
}
#map {
  position: fixed;
  inset: 0;
  background: #aad3df;
}
.topbar {
  position: fixed;
  z-index: 900;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--ink);
  color: white;
  border-radius: 20px;
  box-shadow: 0 6px 25px #102c3c24;
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
}
.brand svg {
  width: 34px;
  height: 34px;
}
.brand strong {
  font-size: 20px;
  letter-spacing: -0.6px;
}
.brand span {
  display: block;
  color: #b5d2da;
  font-size: 8px;
  letter-spacing: 2px;
  margin-top: 2px;
}
.pill {
  border-radius: 20px;
  font-size: 10px;
  background: #254854;
  color: #acf2df;
  padding: 8px 9px;
}
.pill.offline {
  color: #ffe3a6;
  background: #574829;
}
.icon-button {
  background: transparent;
  color: #d8e7eb;
  font-size: 23px;
  padding: 6px;
}
.map-controls {
  position: fixed;
  z-index: 800;
  right: 14px;
  top: calc(env(safe-area-inset-top) + 104px);
  display: grid;
  gap: 9px;
}
.map-controls button {
  background: white;
  width: 43px;
  height: 43px;
  border-radius: 14px;
  color: var(--ink);
  box-shadow: 0 3px 12px #16334525;
  font-size: 26px;
}
.dashboard {
  position: fixed;
  z-index: 900;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 22px 22px 0 0;
  background: #fffffffa;
  box-shadow: 0 -4px 30px #15364b1a;
  padding: 0 12px env(safe-area-inset-bottom);
}
.telemetry {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 9px 10px;
  font-size: 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
#speed {
  color: var(--ink);
  font-weight: 700;
}
#ais-status {
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
nav {
  display: flex;
  justify-content: space-around;
  padding: 8px 0 10px;
}
nav button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  color: var(--muted);
  min-width: 52px;
  min-height: 48px;
}
nav b {
  font-size: 25px;
  font-weight: 500;
  line-height: 28px;
}
nav span {
  font-size: 10px;
}
nav button.active {
  color: var(--teal);
}
nav i {
  position: absolute;
  top: 1px;
  right: 0;
  font-size: 8px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 2px 4px;
  font-style: normal;
}
.route-summary {
  position: fixed;
  z-index: 800;
  left: 12px;
  right: 12px;
  bottom: calc(128px + env(safe-area-inset-bottom));
  border-radius: 16px;
  padding: 15px;
  background: var(--ink);
  color: white;
  display: flex;
  gap: 16px;
  align-items: center;
  box-shadow: 0 5px 20px #15364b22;
}
.route-summary small {
  display: block;
  color: #afcbd4;
  font-size: 8px;
  letter-spacing: 1.2px;
  margin-bottom: 5px;
}
.route-summary strong {
  font-size: 17px;
}
.route-summary button {
  margin-left: auto;
  background: none;
  color: #a2f0e0;
  font-size: 11px;
  padding: 8px;
}
.map-mode {
  position: fixed;
  z-index: 850;
  top: calc(92px + env(safe-area-inset-top));
  left: 12px;
  right: 70px;
  border-radius: 12px;
  background: white;
  padding: 10px;
  font-size: 11px;
  box-shadow: 0 3px 20px #15364b22;
}
.map-mode button {
  background: var(--teal);
  color: white;
  padding: 7px;
  border-radius: 8px;
  margin-top: 5px;
  margin-left: 5px;
}
.toast {
  position: fixed;
  z-index: 2000;
  left: 16px;
  right: 16px;
  bottom: calc(135px + env(safe-area-inset-bottom));
  padding: 14px 16px;
  border-radius: 14px;
  background: #102c3cf5;
  color: white;
  box-shadow: 0 4px 22px #0003;
  font-size: 13px;
  line-height: 1.5;
}
.toast.alarm {
  background: #ad2727;
}
.leaflet-bottom {
  bottom: calc(112px + env(safe-area-inset-bottom));
}
.leaflet-control-attribution {
  font-size: 9px !important;
  max-width: 85vw;
}
.leaflet-popup-content {
  font-size: 13px;
  line-height: 1.7;
  min-width: 160px;
}
.leaflet-container a {
  color: #006b70;
}
.ship-icon {
  background: none;
  border: 0;
}
.ship-arrow {
  width: 24px;
  height: 24px;
  transform-origin: center;
}
.ship-label {
  position: absolute;
  top: 25px;
  left: -10px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  color: #102c3c;
  text-shadow:
    1px 1px white,
    -1px -1px white,
    1px -1px white,
    -1px 1px white;
  pointer-events: none;
}
.wp-icon {
  border-radius: 50%;
  width: 28px !important;
  height: 28px !important;
  background: #007f7b;
  color: white;
  border: 2px solid white;
  text-align: center;
  line-height: 24px;
  font-weight: 700;
  box-shadow: 0 2px 6px #0004;
}
dialog {
  border: 0;
  border-radius: 25px 25px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  margin: auto auto 0;
  width: min(100%, 560px);
  max-height: min(88dvh, 850px);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -10px 50px #0d2c3c25;
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: #102c3c65;
}
.panel-handle {
  width: 36px;
  height: 4px;
  border-radius: 3px;
  background: #ccd8dd;
  margin: 0 auto 15px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}
.panel-header h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.5px;
}
.panel-header button {
  background: #e6eef1;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  color: var(--ink);
}
h2 {
  font-size: 15px;
  margin-top: 22px;
}
p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
label {
  font-size: 12px;
  display: block;
  margin: 14px 0 7px;
  font-weight: 650;
}
input:not([type="checkbox"]),
textarea,
select {
  width: 100%;
  border: 1px solid #c9d9df;
  border-radius: 11px;
  background: white;
  padding: 13px;
  color: var(--ink);
  min-height: 46px;
  font-size: 16px;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 6px;
}
.primary,
.secondary,
.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 15px;
  border-radius: 12px;
  min-height: 45px;
  font-weight: 650;
  font-size: 13px;
  gap: 6px;
}
.primary {
  background: var(--teal);
  color: white;
}
.secondary {
  background: #e6eef1;
  color: var(--ink);
}
.danger {
  background: #f8e4e3;
  color: #9e302d;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 16px 0;
}
.actions > * {
  flex: 1;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.6;
}
.card strong {
  color: var(--ink);
}
.small {
  font-size: 11px;
  line-height: 1.6;
}
.list {
  display: grid;
  gap: 8px;
}
.list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  gap: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  min-height: 48px;
  color: var(--ink);
  font-size: 13px;
}
.list small {
  color: var(--muted);
  display: block;
  font-size: 11px;
}
.list .delete {
  padding: 7px;
  border-radius: 8px;
  background: #fae5e3;
  color: #a02c2c;
  flex: 0;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat-grid .card {
  margin: 0;
}
.stat-grid strong {
  display: block;
  font-size: 20px;
}
.chat-log {
  min-height: 80px;
  max-height: 36dvh;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.6;
}
.chat-entry {
  padding: 12px;
  margin: 8px 0;
  border-radius: 13px;
  background: #e7eef2;
}
.chat-entry.user {
  background: #def2ed;
}
.notice {
  background: #edf4f4;
  border-left: 3px solid var(--teal);
  padding: 11px 13px;
  border-radius: 0 10px 10px 0;
  font-size: 12px;
  line-height: 1.6;
}
.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.weather-grid .card {
  margin: 0;
}
.weather-grid strong {
  display: block;
  font-size: 22px;
  margin-top: 5px;
}
.badge {
  display: inline-block;
  font-size: 10px;
  border-radius: 7px;
  padding: 3px 7px;
  background: #def2ed;
  color: #006f66;
}
.photo-preview {
  max-width: 100%;
  max-height: 35vh;
  border-radius: 12px;
}
a {
  color: var(--teal);
}
.alarm-banner {
  background: #a52b2b;
  color: white;
  padding: 15px;
  border-radius: 12px;
}
@media (min-width: 700px) {
  .topbar {
    right: auto;
    width: 360px;
  }
  .dashboard {
    left: 20px;
    bottom: 20px;
    right: auto;
    width: 400px;
    border-radius: 20px;
    padding-bottom: 0;
  }
  .route-summary {
    right: auto;
    width: 400px;
    left: 20px;
    bottom: 158px;
  }
  .map-mode {
    right: auto;
    width: 330px;
  }
  .toast {
    left: 20px;
    right: auto;
    max-width: 420px;
    bottom: 175px;
  }
  dialog {
    margin: auto;
    border-radius: 24px;
  }
  .leaflet-bottom {
    bottom: 0;
  }
}
