:root {
  --navy-980: #03111d;
  --navy-950: #061827;
  --navy-900: #082133;
  --navy-840: #0b2b3d;
  --navy-780: #12394a;
  --cyan-300: #77f7ee;
  --cyan-400: #2fd3c6;
  --cyan-500: #13b8af;
  --green-300: #9af0c8;
  --amber-200: #fde68a;
  --coral-300: #ffb4a2;
  --ice-50: #f3feff;
  --ice-200: #cdeef2;
  --ice-400: #83b6c0;
  --ink-muted: #6e98a4;
  --panel: rgba(7, 28, 43, .84);
  --panel-strong: rgba(10, 42, 61, .94);
  --line: rgba(205, 238, 242, .15);
  --line-strong: rgba(119, 247, 238, .34);
  --shadow: 0 28px 70px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  padding-bottom: 74px;
  background:
    linear-gradient(180deg, rgba(4, 21, 35, .82), rgba(3, 17, 29, .98)),
    repeating-linear-gradient(90deg, rgba(119, 247, 238, .035) 0 1px, transparent 1px 76px),
    repeating-linear-gradient(0deg, rgba(119, 247, 238, .026) 0 1px, transparent 1px 64px),
    var(--navy-950);
  color: var(--ice-50);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--cyan-300);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(3, 17, 29, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.navbar {
  min-height: 64px;
  padding-block: .55rem;
}

.navbar .container {
  min-width: 0;
}

.navbar-brand {
  color: var(--ice-50);
  min-width: 0;
  font-weight: 850;
}

.navbar-brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-toggler {
  flex: 0 0 auto;
  margin-left: auto;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan-300), var(--cyan-500));
  color: var(--navy-980);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .24), 0 14px 28px rgba(19, 184, 175, .2);
}

.nav-link {
  color: var(--ice-200);
  font-weight: 750;
}

.nav-link:hover,
.nav-link:focus {
  color: #fff;
}

.legal-strip {
  border-top: 1px solid rgba(205, 238, 242, .1);
  color: var(--amber-200);
  font-size: .9rem;
  line-height: 1.45;
  padding: .65rem 0;
  overflow-wrap: anywhere;
}

.app-main {
  min-height: calc(100vh - 178px);
}

.sea-console {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1rem, 4vw, 2.5rem) 0 clamp(1.5rem, 5vw, 3rem);
}

.bathymetry-lines {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .55;
  background:
    radial-gradient(ellipse at 78% 18%, transparent 0 20%, rgba(119, 247, 238, .08) 20.3% 20.7%, transparent 21% 30%, rgba(119, 247, 238, .06) 30.3% 30.7%, transparent 31% 41%, rgba(119, 247, 238, .04) 41.3% 41.7%, transparent 42%),
    linear-gradient(145deg, transparent 0 58%, rgba(253, 230, 138, .08) 58.2% 58.6%, transparent 58.8%);
}

.console-shell {
  display: grid;
  gap: 1rem;
}

.eyebrow {
  margin: 0 0 .45rem;
  color: var(--cyan-300);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2.15rem, 6vw, 4.6rem);
  font-weight: 900;
  line-height: .95;
  letter-spacing: 0;
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr);
  gap: 1rem;
  align-items: stretch;
}

.top-action-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(150px, .8fr);
  gap: .75rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 28, 43, .72);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .2);
}

.depth-card,
.signal-panel,
.source-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.depth-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: clamp(1rem, 3vw, 1.55rem);
}

.depth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(119, 247, 238, .08), transparent),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 34px);
  mask-image: linear-gradient(180deg, transparent 0, #000 28%, #000 100%);
}

.card-topline {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.1rem;
  color: var(--ice-200);
  font-size: .95rem;
  font-weight: 800;
}

.status-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber-200);
  box-shadow: 0 0 0 6px rgba(253, 230, 138, .12);
}

.status-dot.ready {
  background: var(--green-300);
  box-shadow: 0 0 0 6px rgba(154, 240, 200, .14);
}

.status-dot.error {
  background: var(--coral-300);
  box-shadow: 0 0 0 6px rgba(255, 180, 162, .15);
}

.depth-value {
  position: relative;
  display: grid;
  gap: .35rem;
  margin-bottom: 1rem;
  padding: .95rem 1rem 1.15rem;
  border: 1px solid rgba(119, 247, 238, .16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(47, 211, 198, .09), rgba(255, 255, 255, .035));
}

.depth-value span {
  color: var(--ice-200);
  font-size: .95rem;
  font-weight: 850;
}

.depth-value strong {
  color: #fff;
  font-size: clamp(3.25rem, 13vw, 6.9rem);
  font-weight: 950;
  line-height: .95;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-shadow: 0 0 28px rgba(47, 211, 198, .2);
}

.sounder-scale {
  position: relative;
  display: grid;
  gap: .44rem;
  margin: 0 0 1rem;
}

.sounder-scale span {
  display: block;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(119, 247, 238, .72), rgba(119, 247, 238, .08));
}

.sounder-scale span:nth-child(2) {
  width: 82%;
}

.sounder-scale span:nth-child(3) {
  width: 66%;
}

.sounder-scale span:nth-child(4) {
  width: 48%;
}

.metric-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.metric-grid > div,
.signal-stats > div {
  min-width: 0;
  min-height: 82px;
  padding: .8rem;
  border: 1px solid rgba(205, 238, 242, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
}

.metric-grid span,
.signal-stats span {
  display: block;
  margin-bottom: .35rem;
  color: var(--ink-muted);
  font-size: .74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-grid strong,
.signal-stats strong {
  display: block;
  color: var(--ice-50);
  font-size: .98rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.demo-warning,
.message-box,
.legal-callout {
  position: relative;
  margin-top: 1rem;
  padding: .85rem 1rem;
  border-radius: 8px;
  font-weight: 750;
  line-height: 1.45;
}

.demo-warning {
  border: 1px solid rgba(253, 230, 138, .32);
  background: rgba(253, 230, 138, .12);
  color: var(--amber-200);
}

.message-box {
  border: 1px solid rgba(255, 180, 162, .35);
  background: rgba(255, 180, 162, .12);
  color: #ffd4ca;
}

.action-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .52rem;
  min-height: 50px;
  border-radius: 8px;
  font-weight: 850;
  white-space: normal;
}

.btn-sea-primary {
  --bs-btn-bg: var(--cyan-400);
  --bs-btn-border-color: var(--cyan-400);
  --bs-btn-color: var(--navy-980);
  --bs-btn-hover-bg: var(--cyan-300);
  --bs-btn-hover-border-color: var(--cyan-300);
  --bs-btn-hover-color: var(--navy-980);
  box-shadow: 0 16px 28px rgba(19, 184, 175, .18);
}

.btn-sea-secondary {
  --bs-btn-bg: rgba(255, 255, 255, .08);
  --bs-btn-border-color: rgba(255, 255, 255, .14);
  --bs-btn-color: var(--ice-50);
  --bs-btn-hover-bg: rgba(255, 255, 255, .14);
  --bs-btn-hover-border-color: rgba(255, 255, 255, .2);
  --bs-btn-hover-color: #fff;
}

.signal-panel {
  display: grid;
  min-width: 0;
  gap: .9rem;
  padding: 1rem;
}

.map-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(3, 17, 29, .82);
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 58px;
  padding: .75rem .85rem;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 33, 51, .92);
}

.map-toolbar span {
  display: block;
  color: var(--ink-muted);
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.map-toolbar strong {
  color: var(--ice-50);
  font-size: .98rem;
  font-weight: 900;
}

.map-icon-btn {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(205, 238, 242, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: var(--ice-50);
}

.map-icon-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.leaflet-map {
  width: 100%;
  min-height: 360px;
  background: #0b2435;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.user-location-marker,
.depth-location-marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.user-location-marker {
  border: 3px solid #fff;
  background: var(--cyan-400);
  box-shadow: 0 0 0 8px rgba(47, 211, 198, .22);
}

.depth-location-marker {
  border: 3px solid var(--navy-980);
  background: var(--amber-200);
  box-shadow: 0 0 0 6px rgba(253, 230, 138, .18);
}

.map-modal .modal-content {
  background: var(--navy-950);
  color: var(--ice-50);
}

.map-modal .modal-header {
  min-height: 76px;
  border-color: var(--line);
  background: rgba(3, 17, 29, .96);
}

.map-modal .modal-title {
  margin: 0;
  color: #fff;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 900;
}

.map-modal .modal-header p {
  margin: .2rem 0 0;
  color: var(--ice-200);
  font-size: .92rem;
}

.map-modal .modal-body {
  padding: 0;
}

.full-map {
  min-height: calc(100vh - 76px);
}

.signal-screen {
  position: relative;
  display: grid;
  min-height: 280px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    repeating-radial-gradient(circle, rgba(119, 247, 238, .18) 0 1px, transparent 1px 38px),
    linear-gradient(180deg, rgba(8, 33, 51, .92), rgba(3, 17, 29, .92));
}

.sonar-sweep {
  position: absolute;
  width: 125%;
  height: 125%;
  background: conic-gradient(from 0deg, transparent 0deg 276deg, rgba(119, 247, 238, .28) 314deg, transparent 360deg);
  animation: sonar-spin 7s linear infinite;
}

.sonar-core {
  position: relative;
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  border: 1px solid rgba(119, 247, 238, .45);
  border-radius: 50%;
  background: rgba(3, 17, 29, .82);
  box-shadow: inset 0 0 26px rgba(119, 247, 238, .14), 0 0 34px rgba(47, 211, 198, .16);
}

.sonar-core span {
  align-self: end;
  color: var(--ink-muted);
  font-size: .75rem;
  font-weight: 900;
}

.sonar-core strong {
  align-self: start;
  color: var(--cyan-300);
  font-size: 1.22rem;
  font-weight: 900;
}

.signal-stats {
  display: grid;
  gap: .7rem;
}

.source-page {
  padding: clamp(1.25rem, 5vw, 3rem) 0;
}

.source-panel {
  max-width: 940px;
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 2rem);
  background: var(--panel-strong);
}

.source-panel.compact {
  max-width: 640px;
}

.source-panel h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.source-panel p {
  color: var(--ice-200);
  line-height: 1.7;
}

.source-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.source-list article {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.source-list h2 {
  margin: 0 0 .35rem;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
}

.legal-callout {
  border: 1px solid rgba(253, 230, 138, .28);
  background: rgba(253, 230, 138, .1);
  color: var(--amber-200);
}

.app-footer {
  border-top: 1px solid var(--line);
  color: var(--ice-200);
  padding: 1rem 0 5.5rem;
  background: rgba(3, 17, 29, .38);
}

.footer-warning {
  font-size: .88rem;
  line-height: 1.5;
}

.fixed-ad-slot {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: .45rem .75rem;
  border-top: 1px solid var(--line);
  background: rgba(3, 12, 22, .97);
}

.ad-label {
  width: min(460px, 100%);
  padding: .65rem 1rem;
  border: 1px dashed rgba(205, 238, 242, .28);
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: .78rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

@keyframes sonar-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 991.98px) {
  .console-grid {
    grid-template-columns: 1fr;
  }

  .signal-panel {
    grid-template-columns: minmax(220px, .75fr) 1fr;
    align-items: stretch;
  }

  .signal-screen {
    min-height: 220px;
  }

  .leaflet-map {
    min-height: 260px;
  }
}

@media (max-width: 767.98px) {
  .signal-panel {
    grid-template-columns: 1fr;
  }

  .signal-screen {
    min-height: 210px;
  }

  .top-action-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  body {
    padding-bottom: 82px;
  }

  .sea-console {
    padding-top: .75rem;
  }

  .depth-card,
  .signal-panel {
    padding: .85rem;
  }

  .container {
    max-width: 100%;
    padding-right: .75rem;
    padding-left: .75rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid > div,
  .signal-stats > div {
    min-height: 74px;
  }

  .depth-value {
    padding: .85rem;
  }

  .depth-value strong {
    font-size: clamp(2.9rem, 18vw, 4.5rem);
  }
}

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