* { box-sizing: border-box; }
body { margin: 0; color: #f0f8f8; background: #071822; }
main { position: relative; isolation: isolate; width: 100%; height: 100dvh; overflow: hidden; }
.poster, .views, .views iframe, #crossing { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster { object-fit: cover; }
.views iframe, #crossing { border: 0; pointer-events: none; opacity: 0; transition: opacity 410ms ease; }
.views iframe.visible, #crossing.visible { opacity: 1; }
#crossing.visible { pointer-events: auto; }
#crossing { z-index: 1; }
.cam-dock {
  position: fixed; right: 16px; bottom: 16px; z-index: 6;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  font: 12px/1.3 system-ui, -apple-system, sans-serif; color: #f0f8f8;
  pointer-events: none;
}
.cam-pills {
  display: flex; gap: 4px; padding: 4px; border-radius: 999px;
  background: rgba(6, 20, 29, 0.78); border: 1px solid rgba(163, 220, 224, 0.24);
  backdrop-filter: blur(10px); pointer-events: auto;
}
.cam-btn {
  min-height: 32px; padding: 0 11px; border: 0; border-radius: 999px;
  background: transparent; color: #c7dce0; cursor: pointer;
  font: 500 12px/1 system-ui, -apple-system, sans-serif;
  transition: background .16s ease, color .16s ease;
}
.cam-btn:hover { background: rgba(163, 220, 224, 0.14); color: #f5f2eb; }
.cam-btn[aria-pressed="true"] { background: #a3dce0; color: #061822; font-weight: 650; }
.cam-btn:focus-visible { outline: 2px solid #a3dce0; outline-offset: 2px; }
.cam-hint {
  padding: 5px 10px; border-radius: 8px;
  background: rgba(6, 20, 29, 0.76); border: 1px solid rgba(163, 220, 224, 0.18);
  color: #cfe4e8; letter-spacing: .01em;
}
.cam-dock[hidden], .cam-hint[hidden], .basin-swim-actions[hidden] { display: none; }
@media (min-width: 900px) {
  body .om-quiet-hud .om-live-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 20px;
    row-gap: 12px;
    width: min(880px, 100%);
  }
}
@media (max-width: 640px) { .cam-dock { right: 12px; bottom: 12px; } .cam-hint { display: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
#load-error { position: absolute; z-index: 3; top: 6rem; left: 1.5rem; max-width: calc(100% - 3rem); padding: .75rem; border-radius: .35rem; background: #071c28; font: .875rem system-ui, sans-serif; }
#load-error button { margin-left: .45rem; }
@media (prefers-reduced-motion: reduce) { .views iframe, #crossing { transition: none; } }

.location-editor {
  width: min(560px, calc(100% - 28px));
  max-height: min(700px, 88dvh);
  margin: auto;
  padding: 0;
  border: 1px solid #3b525c;
  border-radius: 10px;
  color: #f0f8f8;
  background: #0b1922;
  color-scheme: dark;
  font: 14px system-ui, sans-serif;
}
.location-editor::backdrop { background: #02070bd9; }
.location-editor form { display: flex; flex-direction: column; max-height: min(700px, 88dvh); }
.location-editor header, .location-editor footer { padding: 16px 20px; }
.location-editor h1 { margin: 0; font-size: 20px; font-weight: 650; }
.location-editor header p { margin: 4px 0 0; color: #adc0c7; }
.location-fields { overflow: auto; padding: 0 20px 12px; }
.location-fields fieldset { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.location-fields legend { margin-bottom: 8px; padding: 0; color: #b4dfe2; font-weight: 650; }
.location-fields label { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); align-items: center; gap: 12px; }
.location-fields input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #3b525c;
  border-radius: 4px;
  color: inherit;
  background: #111f29;
  font: 16px system-ui, sans-serif;
}
.location-editor footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; border-top: 1px solid #2b3d45; }
.location-editor button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #3b525c;
  border-radius: 4px;
  color: inherit;
  background: #111f29;
  cursor: pointer;
  font: inherit;
}
.location-editor button[type="submit"] { border-color: #a3dce0; color: #0a1a22; background: #a3dce0; font-weight: 650; }
.location-editor :focus-visible { outline: 2px solid #a3dce0; outline-offset: 2px; }
.location-error { flex-basis: 100%; margin: 0; color: #ffd5b3; }
.location-error:empty { display: none; }
@media (max-width: 480px) {
  .location-editor header, .location-editor footer { padding-inline: 14px; }
  .location-fields { padding-inline: 14px; }
  .location-fields label { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}

/* Public web ocean-world UI */
.loading-veil {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 14, 21, 0.44);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 420ms ease;
}
.loading-veil.is-ready {
  opacity: 0;
  pointer-events: none;
}
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  width: min(380px, 100%);
  padding: 26px 28px 24px;
  border-radius: 18px;
  background: rgba(6, 20, 29, 0.8);
  border: 1px solid rgba(163, 220, 224, 0.24);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.56);
}
.loading-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 10.5px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8ee2e6;
}
.loading-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #62d7db;
  box-shadow: 0 0 12px #62d7db;
  animation: ocean-veil-pulse 2.2s ease-in-out infinite;
}
@keyframes ocean-veil-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.25); opacity: 1; }
}
.loading-title {
  margin: 2px 0 0;
  font-family: 'Young Serif', Georgia, serif;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 400;
  line-height: 1.12;
  color: #f5f2eb;
}
.loading-status {
  margin: 0;
  font: 500 13px/1.4 system-ui, -apple-system, sans-serif;
  color: rgba(242, 239, 232, 0.76);
}
.loading-track {
  width: 100%;
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(163, 220, 224, 0.16);
}
.loading-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #42bfc5, #7fe7ea);
  transition: width 180ms ease-out;
}
.loading-pct {
  font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #8ee2e6;
}

.ocean-nav {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ocean-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(6, 20, 29, 0.78);
  border: 1px solid rgba(163, 220, 224, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e8f4f5;
  text-decoration: none;
  cursor: pointer;
  font: 600 12.5px/1 system-ui, -apple-system, sans-serif;
  white-space: nowrap;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}
.ocean-pill:hover {
  background: rgba(16, 46, 62, 0.9);
  border-color: rgba(127, 231, 234, 0.62);
  color: #ffffff;
}
.ocean-pill:focus-visible {
  outline: 2px solid #7fe7ea;
  outline-offset: 2px;
}
.ocean-controls-btn[aria-expanded="true"] {
  background: #62d7db;
  border-color: #9becef;
  color: #04151d;
}

.controls-card {
  position: fixed;
  top: calc(max(16px, env(safe-area-inset-top)) + 44px);
  left: max(16px, env(safe-area-inset-left));
  z-index: 12;
  width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(6, 20, 29, 0.9);
  border: 1px solid rgba(163, 220, 224, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.5);
  color: #e8f4f5;
  font: 12.5px/1.45 system-ui, -apple-system, sans-serif;
}
.controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.controls-head h2 {
  margin: 0;
  font: 650 13.5px/1.2 system-ui, -apple-system, sans-serif;
  color: #8ee2e6;
}
.controls-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #d6eaed;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.controls-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}
.controls-list {
  display: grid;
  gap: 8px;
  margin: 0;
}
.controls-list > div {
  display: grid;
  gap: 2px;
}
.controls-list dt {
  font-weight: 650;
  color: #f5f2eb;
}
.controls-list dd {
  margin: 0;
  color: rgba(226, 240, 242, 0.8);
}
.controls-list kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(163, 220, 224, 0.3);
  background: rgba(163, 220, 224, 0.12);
  color: #9becef;
  font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.welcome-hint {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(6, 20, 29, 0.78);
  border: 1px solid rgba(163, 220, 224, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #dff2f4;
  font: 500 12px/1.3 system-ui, -apple-system, sans-serif;
  white-space: nowrap;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}
.hint-mobile { display: none; }
@media (max-width: 1160px) {
  .welcome-hint {
    top: calc(max(16px, env(safe-area-inset-top)) + 44px);
    left: max(16px, env(safe-area-inset-left));
    transform: none;
    max-width: calc(100vw - 32px);
    white-space: normal;
  }
}
@media (max-width: 640px) {
  .ocean-nav {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
  }
  .controls-card {
    top: calc(max(12px, env(safe-area-inset-top)) + 44px);
    left: max(12px, env(safe-area-inset-left));
    width: calc(100vw - 24px);
  }
  .welcome-hint {
    top: calc(max(12px, env(safe-area-inset-top)) + 44px);
    left: max(12px, env(safe-area-inset-left));
    max-width: calc(100vw - 24px);
    font-size: 11.5px;
    border-radius: 12px;
  }
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
  .ocean-minimap.om-quiet-hud .om-compact {
    --om-radar-size: 112px;
    inset: auto auto max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .cam-pills { padding: 3px; gap: 2px; }
  .cam-btn { min-height: 30px; padding: 0 9px; font-size: 11px; }
}
.ocean-nav[hidden], .controls-card[hidden], .welcome-hint[hidden], .loading-veil[hidden] { display: none; }
#load-error a { margin-left: .65rem; color: #7fe7ea; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
#load-error { position: absolute; z-index: 3; top: 6rem; left: 1.5rem; max-width: calc(100% - 3rem); padding: .75rem; border-radius: .35rem; background: #071c28; font: .875rem system-ui, sans-serif; }
#load-error button { margin-left: .45rem; }
@media (prefers-reduced-motion: reduce) { .views iframe, #crossing, .loading-veil { transition: none; } .loading-dot { animation: none; } }

.location-editor {
  width: min(560px, calc(100% - 28px));
  max-height: min(700px, 88dvh);
  margin: auto;
  padding: 0;
  border: 1px solid #3b525c;
  border-radius: 10px;
  color: #f0f8f8;
  background: #0b1922;
  color-scheme: dark;
  font: 14px system-ui, sans-serif;
}
.location-editor::backdrop { background: #02070bd9; }
.location-editor form { display: flex; flex-direction: column; max-height: min(700px, 88dvh); }
.location-editor header, .location-editor footer { padding: 16px 20px; }
.location-editor h1 { margin: 0; font-size: 20px; font-weight: 650; }
.location-editor header p { margin: 4px 0 0; color: #adc0c7; }
.location-fields { overflow: auto; padding: 0 20px 12px; }
.location-fields fieldset { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.location-fields legend { margin-bottom: 8px; padding: 0; color: #b4dfe2; font-weight: 650; }
.location-fields label { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); align-items: center; gap: 12px; }
.location-fields input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #3b525c;
  border-radius: 4px;
  color: inherit;
  background: #111f29;
  font: 16px system-ui, sans-serif;
}
.location-editor footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; border-top: 1px solid #2b3d45; }
.location-editor button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #3b525c;
  border-radius: 4px;
  color: inherit;
  background: #111f29;
  cursor: pointer;
  font: inherit;
}
.location-editor button[type="submit"] { border-color: #a3dce0; color: #0a1a22; background: #a3dce0; font-weight: 650; }
.location-editor :focus-visible { outline: 2px solid #a3dce0; outline-offset: 2px; }
.location-error { flex-basis: 100%; margin: 0; color: #ffd5b3; }
.location-error:empty { display: none; }
@media (max-width: 480px) {
  .location-editor header, .location-editor footer { padding-inline: 14px; }
  .location-fields { padding-inline: 14px; }
  .location-fields label { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}

.ocean-credits { margin-top: 10px; }
.ocean-credits summary { cursor: pointer; }
.ocean-credits p { margin: 6px 0 0; }
.ocean-credits a { color: #8ee2e6; }
