:root {
  color-scheme: dark;
  --background: #091625;
  --text: #eff5f2;
  --muted: #a8bec9;
  --accent: #a5e9d8;
  --line: #2b4553;
  font-family: "Instrument Sans", "Avenir Next", system-ui, sans-serif;
  color: var(--text);
  background: var(--background);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0 auto; max-width: 1600px; padding: clamp(16px, 4vw, 58px); }
header, .controls, .search-row, footer { display: flex; align-items: center; gap: 12px; }
header, footer { justify-content: space-between; }
header { margin-bottom: clamp(18px, 3.5vh, 38px); }
.brand { font-size: clamp(20px, 3vw, 32px); font-weight: 650; letter-spacing: -.05em; display: flex; align-items: center; gap: 10px; }
.mark { width: 24px; height: 23px; background: var(--accent); clip-path: polygon(50% 0, 100% 67%, 75% 94%, 50% 72%, 25% 94%, 0 67%); }
button, input { font: inherit; }
button {
  background: #172c3a;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 14px;
  min-height: 44px;
  cursor: pointer;
  transition: background .2s;
}
button:hover { background: #244252; }
button:disabled { opacity: .65; cursor: wait; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card { position: relative; isolation: isolate; overflow: hidden; background: #102438; border: 1px solid var(--line); border-radius: 20px; }
.seascape { position: absolute; z-index: -2; inset: 0; background: linear-gradient(152deg, #102439 33%, #224450 69%, #547575); }
.sun { position: absolute; left: 69%; top: 15%; width: min(18vw, 200px); aspect-ratio: 1; background: #a3bfa8; opacity: .38; border-radius: 50%; box-shadow: 0 0 65px #c5dfaf45; }
.far-shore { position: absolute; inset: 48% 0 29%; background: #294854; clip-path: polygon(0 50%, 14% 61%, 23% 48%, 37% 60%, 44% 45%, 54% 62%, 65% 54%, 73% 65%, 87% 52%, 100% 58%, 100% 100%, 0 100%); }
.sea { position: absolute; inset: 64% 0 0; background: repeating-linear-gradient(177deg, transparent 0 19px, #65989524 20px 21px, transparent 23px 33px), linear-gradient(#39626b, #173846); }
.ship { position: absolute; width: min(44%, 570px); aspect-ratio: 3.25; right: 7%; bottom: 33%; }
.ship i { position: absolute; background: #101f2e; }
.hull { inset: 68% 0 0; clip-path: polygon(0 13%, 60% 15%, 80% 21%, 100% 0, 94% 43%, 88% 91%, 83% 100%, 9% 100%, 4% 68%); }
.bridge { inset: 29% 74% 29% 9%; clip-path: polygon(0 5%, 84% 5%, 100% 50%, 92% 100%, 11% 100%); }
.mast { inset: 8% 84% 61% 13%; clip-path: polygon(0 0, 34% 0, 53% 39%, 100% 39%, 100% 56%, 61% 56%, 82% 100%, 48% 100%); }
.deck { inset: 42% 15% 26% 26%; clip-path: polygon(0 60%, 10% 60%, 10% 22%, 43% 22%, 43% 0, 72% 0, 72% 23%, 92% 23%, 92% 59%, 100% 59%, 100% 100%, 0 100%); }
.card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #091625f5 0%, #0a1929df 27%, #0a19292b 82%), linear-gradient(0deg, #0a1929 0%, transparent 56%); }
.content { min-height: min(66svh, 680px); padding: clamp(24px, 5.3vw, 76px); display: flex; flex-direction: column; align-items: flex-start; }
.location { color: var(--muted); font-size: clamp(.9rem, 1.5vw, 1.15rem); max-width: 45ch; overflow-wrap: anywhere; }
.status { display: flex; align-items: center; gap: 9px; margin-top: 13px; font-size: .9rem; color: var(--accent); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 13px currentColor; flex: none; }
.status[data-state="disconnected"] { color: #ffb6a1; }
.identity { margin-top: auto; padding-top: clamp(48px, 10vh, 125px); }
.identity.enter { animation: appear .45s ease-out; }
@keyframes appear { from { opacity: .55; transform: translateY(4px); } }
.type { color: var(--accent); margin: 0 0 8px; font-size: clamp(.9rem, 1.5vw, 1.15rem); }
h1 { font-size: clamp(2.45rem, 7.2vw, 7.2rem); letter-spacing: -.067em; line-height: 1.02; margin: 0; overflow-wrap: anywhere; text-wrap: balance; }
#help { margin: 12px 0 0; color: var(--muted); }
#help:empty { display: none; }
dl { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); width: min(100%, 680px); gap: 12px; padding-top: 16px; margin: 28px 0 0; border-top: 1px solid #a8bec94d; }
dt { color: var(--muted); font-size: .82rem; }
dd { margin: 5px 0 0; font-size: clamp(.95rem, 2vw, 1.35rem); overflow-wrap: anywhere; }
footer { color: var(--muted); font-size: .82rem; padding: 14px 3px 0; }
.picker { max-width: 600px; background: #112432; border: 1px solid var(--line); padding: 18px; margin-bottom: 18px; border-radius: 14px; }
.picker label { display: block; margin-bottom: 8px; }
input { min-width: 0; flex: 1; background: var(--background); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.picker p { color: var(--muted); margin: 8px 0; }
.picker ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.picker li button { text-align: left; width: 100%; }
.picker small, a { color: var(--muted); }
@media (max-width: 600px) {
  .controls { gap: 6px; }
  .controls button { font-size: .84rem; padding-inline: 10px; }
  .card::after { background: linear-gradient(0deg, #091625 0%, #091625dd 26%, transparent 80%), linear-gradient(90deg, #0a1929ce, transparent); }
  .content { min-height: 68svh; }
  .sun { width: 31vw; }
  .ship { width: 66%; bottom: 49%; }
  .sea { top: 50%; }
  .far-shore { top: 30%; bottom: 45%; }
  .identity { padding-top: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

#vessel-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 50%;
}
.seascape:has(#vessel-photo:not([hidden])) > div { display: none; }
#photo-credit {
  margin: 0;
  padding: 0 clamp(24px, 5.3vw, 76px) 18px;
  color: var(--muted);
  font-size: .77rem;
  overflow-wrap: anywhere;
}
#traffic { margin-top: clamp(36px, 6vw, 74px); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 2.4rem); letter-spacing: -.04em; }
.traffic-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; }
#map { position: relative; height: clamp(285px, 40vw, 465px); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #1e4857; }
#tiles { position: absolute; inset: 0; filter: saturate(.72) brightness(.83); }
#tiles img { position: absolute; width: 256px; height: 256px; user-select: none; }
.map-ship, .map-center { position: absolute; transform: translate(-50%, -50%); }
.map-center { top: 50%; left: 50%; color: #fff0a3; text-shadow: 0 1px 4px #000; font-size: 22px; z-index: 1; pointer-events: none; }
.map-ship {
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  padding: 0;
  transform: translate(-50%, -50%) rotate(var(--course));
  border-radius: 50%;
  background: #093343;
  color: #b4f8e4;
  border-color: #b4f8e4;
  font-size: 13px;
}
.map-ship[aria-pressed="true"], .map-ship:focus-visible { z-index: 2; background: #fff0a3; color: #102438; }
.map-credit { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; color: var(--muted); font-size: .78rem; }
#map-selection { color: var(--accent); min-height: 1.4em; margin: 10px 0 0; }
h3 { margin: 0 0 8px; font-size: 1.15rem; }
#traffic-count { font-size: .85rem; color: var(--muted); margin-left: 5px; }
.ship-list { list-style: none; padding: 0; margin: 0; max-height: 405px; overflow: auto; }
.ship-list li { border-bottom: 1px solid var(--line); }
.ship-list li > * { padding: 10px 8px; display: block; }
.ship-list li > button { width: 100%; text-align: left; background: transparent; border: 0; border-radius: 5px; }
.ship-list li > button:hover, .ship-list li > button:focus-visible { background: #17313e; outline-offset: -2px; }
.ship-list strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.ship-list small { display: block; color: var(--muted); margin-top: 4px; }
.ship-list .empty { padding: 10px 8px; color: var(--muted); }
.timeline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.timeline section { border: 1px solid var(--line); padding: 17px; border-radius: 14px; background: #102232; }
.timeline p { margin: 0 0 8px; color: var(--muted); font-size: .88rem; }
@media (max-width: 700px) {
  .traffic-layout, .timeline { grid-template-columns: 1fr; }
  .ship-list { max-height: 280px; }
}

.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
}
.login-card {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(300px, 1fr);
  width: min(880px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #102438;
  box-shadow: 0 24px 88px #0004;
}
.login-landscape { position: relative; isolation: isolate; min-height: 140px; }
.login-landscape .sun { width: 32%; top: 17%; left: 53%; }
.login-landscape .ship { width: 75%; right: 12%; }
.login-content { padding: clamp(24px, 5vw, 66px); }
.login-content .brand { font-size: 24px; margin-bottom: 34px; }
.login-content h1 { font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 24px; }
.login-content form { display: grid; gap: 9px; }
.login-content label { color: var(--muted); margin-top: 7px; }
.login-content input { min-height: 46px; width: 100%; }
.login-content button { margin-top: 12px; background: var(--accent); color: #09272b; font-weight: 700; }
.login-content button:hover { background: #c6faec; }
.login-error { color: #ffb6a1; margin: 0; }
.distance-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.distance-form label { color: var(--muted); font-size: .9rem; }
.distance-form input { flex: none; width: 68px; min-height: 44px; }
#map-range { margin-bottom: 8px; }
@media (max-width: 620px) {
  .login-card { grid-template-columns: 1fr; }
  .login-landscape { min-height: 145px; }
  .login-landscape .ship { width: 52%; right: 10%; }
  .login-landscape .sun { width: 22%; }
  .login-content .brand { margin-bottom: 22px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}
