:root {
  --bg-deep: #020b14;
  --bezel: rgba(8, 15, 26, 0.9);
  --bezel-border: rgba(56, 189, 248, 0.28);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --cyan: #38bdf8;
  --purple: #c084fc;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Toast Banner (sits cleanly above bottom dive console & wreck action pill) */
.game-toast {
  position: fixed;
  bottom: max(206px, calc(env(safe-area-inset-bottom) + 200px));
  top: auto;
  left: 50%;
  transform: translate(-50%, 16px);
  background: rgba(8, 17, 30, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: min(92vw, 520px);
  text-align: center;
}
.game-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 760px) {
  .game-toast {
    top: max(106px, calc(env(safe-area-inset-top) + 98px));
    bottom: auto;
    transform: translate(-50%, -10px);
    font-size: 0.78rem;
  }
  .game-toast.visible {
    transform: translate(-50%, 0);
  }
}

/* Overlay Menu & Debrief */
.overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(28px, calc(env(safe-area-inset-top) + 18px))
           max(16px, env(safe-area-inset-right))
           max(32px, calc(env(safe-area-inset-bottom) + 22px))
           max(16px, env(safe-area-inset-left));
  background: radial-gradient(circle at 50% 35%, rgba(6, 35, 58, 0.72), rgba(2, 11, 20, 0.9));
  backdrop-filter: blur(6px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.overlay-screen[hidden],
[hidden] {
  display: none !important;
}

.menu-card {
  width: min(640px, 100%);
  margin: auto 0;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(9, 19, 34, 0.95), rgba(6, 13, 24, 0.96));
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 18px;
  padding: 20px 20px 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(186, 230, 253, 0.08);
}

.menu-header {
  position: relative;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.menu-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.menu-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.22);
}

.menu-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  margin-bottom: 12px;
  background: rgba(2, 8, 18, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 12px;
}

.menu-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 9px;
  padding: 9px 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.menu-tab:hover:not(:disabled) {
  color: #e0f2fe;
}

.menu-tab:disabled {
  opacity: 0.5;
  cursor: default;
}

.menu-tab.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(2, 132, 199, 0.22));
  border-color: rgba(56, 189, 248, 0.55);
  color: #f0f9ff;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.22);
}

.menu-tab.has-rooms:not(.active) {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.32);
}

.menu-eyebrow {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--cyan);
  margin-bottom: 4px;
}

.menu-title {
  margin: 0;
  font-size: clamp(1.15rem, 3.6vw, 1.8rem);
  letter-spacing: 0.03em;
  line-height: 1.12;
}

@media (max-width: 440px) {
  .menu-card {
    padding: 15px 14px 16px;
  }
  .menu-brand-icon {
    width: 34px;
    height: 34px;
  }
  .menu-tab {
    padding: 8px 4px;
    font-size: 0.76rem;
    letter-spacing: 0.01em;
  }
}

.menu-desc-wrap {
  margin: 0 0 12px;
}

.menu-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.menu-desc.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.menu-desc-toggle {
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(14, 165, 233, 0.1);
  color: #7dd3fc;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.menu-desc-toggle:hover {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 165, 233, 0.2);
  color: #e0f2fe;
}

.menu-desc-toggle:active {
  transform: scale(0.96);
}

.menu-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.menu-name-row label {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.menu-name-row input,
.menu-name-row select,
.lan-join-row input {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
}
.menu-name-row select {
  max-width: 62%;
  text-overflow: ellipsis;
}
.menu-name-row input:focus,
.menu-name-row select:focus,
.lan-join-row input:focus {
  border-color: var(--cyan);
}
.callsign-count {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.75);
  margin-left: 6px;
}
.menu-name-row input.invalid,
.loader-callsign-gate input.invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25);
}
.loader-callsign-gate {
  display: flex;
  gap: 8px;
  margin: 10px 0 6px;
}
.loader-callsign-gate input {
  flex: 1;
  min-width: 0;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 0.88rem;
  outline: none;
}

.menu-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.btn {
  border: none;
  border-radius: 11px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #f8fafc;
}
.btn.secondary {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--text-main);
}
.btn.accent {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-muted);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn.tiny {
  padding: 5px 9px;
  font-size: 0.74rem;
  border-radius: 7px;
}

/* Level Picker Cards & Inline Progress */
.level-picker-block {
  margin-bottom: 12px;
}
.level-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.level-picker-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.level-picker-head label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.site-view-tabs {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.site-view-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.site-view-btn.active {
  background: rgba(14, 165, 233, 0.25);
  color: #e0f2fe;
}
.site-browser {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
  align-items: stretch;
}
.site-browser.view-map {
  grid-template-columns: 1fr;
}
.site-browser.view-map .level-cards {
  display: none;
}
.site-browser.view-list {
  grid-template-columns: 1fr;
}
.site-browser.view-list .site-map-panel {
  display: none;
}
.site-browser.view-list .level-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 224px;
}
.site-map-panel {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: radial-gradient(circle at 55% 40%, #071e34, #030d19);
  min-height: 196px;
}
.site-world-map {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 196px;
}
.site-map-overlay-top {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.site-map-region-badge {
  background: rgba(2, 11, 20, 0.84);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.site-map-zoom-btn {
  pointer-events: auto;
  background: rgba(2, 11, 20, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
}
.site-map-zoom-btn:hover {
  border-color: var(--cyan);
  color: #ffffff;
}
.site-map-overlay-bottom {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.site-map-legend {
  display: flex;
  gap: 10px;
  background: rgba(2, 11, 20, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.64rem;
  color: var(--text-muted);
}
.site-map-coords {
  background: rgba(2, 11, 20, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.22);
  padding: 2px 7px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  color: #7dd3fc;
}
.site-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.legend-dot.lined {
  background: #38bdf8;
}
.legend-dot.reel {
  background: #fbbf24;
}
.legend-dot.wreck {
  background: #fb923c;
}
.site-picker-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.site-cat-tabs {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  --cat-index: 0;
}
.site-cat-tabs::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 10px) / 4);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.34), rgba(14, 165, 233, 0.28));
  border: 1px solid rgba(251, 146, 60, 0.45);
  transform: translateX(calc(var(--cat-index, 0) * (100% + 2px)));
  transition: transform 0.3s var(--ease-spring);
  pointer-events: none;
  z-index: 0;
}
.site-cat-btn {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s ease;
}
.site-cat-btn:hover {
  color: #e0f2fe;
}
.site-cat-btn.active {
  color: #fff7ed;
}
.level-card-btn.is-wreck {
  border-color: rgba(251, 146, 60, 0.32);
}
.level-card-btn.is-wreck .lvl-card-top {
  color: #fdba74;
}
.level-card-btn.is-wreck.active {
  border-color: #fb923c;
  background: rgba(249, 115, 22, 0.2);
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.22), 0 0 0 1px rgba(251, 146, 60, 0.38);
}
.level-card-btn.is-wreck.active::before {
  background: linear-gradient(180deg, #fed7aa, #fb923c, #ea580c);
}
.map-pin-btn {
  cursor: pointer;
  outline: none;
}
.map-pin-btn.locked {
  cursor: not-allowed;
  opacity: 0.65;
}
.map-pin-halo {
  fill: rgba(56, 189, 248, 0.28);
  transform-box: fill-box;
  transform-origin: center;
  animation: pinPulse 1.8s ease-in-out infinite;
}
@keyframes pinPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.45); opacity: 0.16; }
}
.campaign-progress-pill {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  padding: 2px 8px;
}
.level-lock-note {
  font-size: 0.72rem;
  color: var(--warn);
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
}
.level-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 224px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-padding-block: 6px;
  padding: 2px 3px 2px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.38) transparent;
}
.lvl-card-meta.reel {
  color: #fbbf24;
  font-weight: 700;
}
.level-card-btn {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 58px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.08s ease;
}
.level-card-btn:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 116, 144, 0.2);
}
.level-card-btn.active {
  border-color: var(--cyan);
  background: rgba(14, 165, 233, 0.22);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}
.level-card-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}
.lvl-card-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cyan);
}
.lvl-card-depth {
  color: #cbd5e1;
  font-weight: 600;
}
.lvl-card-name {
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lvl-card-meta {
  font-family: ui-monospace, monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
}
.lvl-card-meta.cached {
  color: var(--ok);
}
@media (max-width: 640px) {
  .site-browser {
    grid-template-columns: 1fr;
  }
  .level-cards {
    max-height: 230px;
    gap: 7px;
  }
  .site-browser.view-list .level-cards {
    grid-template-columns: 1fr;
    max-height: 340px;
  }
  .level-card-btn {
    padding: 10px 12px;
    gap: 4px;
    min-height: 66px;
  }
  .lvl-card-top {
    font-size: 0.75rem;
  }
  .lvl-card-name {
    font-size: 0.85rem;
    line-height: 1.24;
  }
  .lvl-card-meta {
    font-size: 0.7rem;
  }
}

/* Larger Expedition Map & Menu Layout on Tablet, Foldable & Desktop screens (> phone width) */
@media (min-width: 641px) {
  .menu-card {
    width: min(920px, 100%);
  }
  .site-browser {
    grid-template-columns: 1.65fr 1fr;
    gap: 10px;
  }
  .site-map-panel,
  .site-world-map {
    min-height: clamp(300px, 38dvh, 430px);
  }
  .level-cards {
    max-height: clamp(300px, 38dvh, 430px);
  }
  .site-browser.view-map .site-map-panel,
  .site-browser.view-map .site-world-map {
    min-height: clamp(360px, 48dvh, 540px);
  }
  .site-browser.view-list .level-cards {
    max-height: clamp(320px, 42dvh, 460px);
  }
}

@media (min-width: 1080px) {
  .menu-card {
    width: min(1060px, 100%);
  }
  #screen-menu.is-leaderboard .menu-card {
    width: min(920px, 100%);
  }
  .site-browser {
    grid-template-columns: 1.85fr 1fr;
    gap: 12px;
  }
  .site-map-panel,
  .site-world-map {
    min-height: clamp(340px, 42dvh, 480px);
  }
  .level-cards {
    max-height: clamp(340px, 42dvh, 480px);
  }
  .site-browser.view-map .site-map-panel,
  .site-browser.view-map .site-world-map {
    min-height: clamp(420px, 54dvh, 620px);
  }
}

.sr-only-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.inline-level-loader {
  margin-top: 8px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 6px 9px;
}
#inline-level-loader-label {
  display: block;
  font-size: 0.72rem;
  color: var(--cyan);
  margin-bottom: 4px;
  font-family: ui-monospace, monospace;
}
.inline-loader-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}
.inline-loader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #4ade80);
  transition: width 0.14s ease;
}

.dive-coop-dock {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}
.dive-coop-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Tab Panels (Leaderboards & Co-op Room Dock) */
.lan-panel {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.lan-conn-badge {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--warn);
}
.lan-conn-badge.ok {
  color: var(--ok);
}
.lan-conn-badge.danger {
  color: var(--danger);
}

.lan-controls {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
}
@media (max-width: 480px) {
  .lan-controls {
    grid-template-columns: 1fr;
  }
}
.lan-create-group {
  display: flex;
  gap: 6px;
}
.lan-create-group select {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px;
  font-size: 0.82rem;
}
.lan-create-group .btn {
  flex: 1;
}
.lan-join-row {
  display: flex;
  gap: 6px;
}
.lan-join-row input {
  flex: 1;
  min-width: 68px;
  text-transform: uppercase;
  text-align: center;
  font-family: ui-monospace, monospace;
  font-weight: 700;
}

.lan-rooms-section {
  margin-top: 10px;
}
.lan-rooms-title {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.lan-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lan-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 0.78rem;
}
.lan-room-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lan-room-row-info strong {
  font-family: ui-monospace, monospace;
  color: var(--warn);
}
.lan-room-row-sub {
  color: var(--text-muted);
  font-size: 0.71rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lan-status {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--cyan);
}
.lan-status.warn {
  color: var(--warn);
}
.lan-status.ok {
  color: var(--ok);
}

.lan-room-box {
  margin-top: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 10px;
}
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, monospace;
}
.room-code-block {
  display: flex;
  align-items: center;
  gap: 8px;
}
.room-code-block span {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.room-header strong {
  font-size: 1.2rem;
  color: var(--warn);
  letter-spacing: 0.16em;
}
.room-header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.room-site-pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
  padding: 2px 7px;
}
.room-invite-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.room-invite-input {
  flex: 1;
  min-width: 0;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 7px;
  padding: 5px 8px;
  color: #e0f2fe;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  cursor: pointer;
}
.room-invite-input:focus {
  outline: none;
  border-color: var(--cyan);
}
#btn-copy-invite.copied {
  background: rgba(34, 197, 94, 0.24);
  border-color: rgba(74, 222, 128, 0.6);
  color: #bbf7d0;
}
.lan-roster {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
}
.lan-roster li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.65);
  border-radius: 7px;
  padding: 5px 8px;
}
.roster-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: ui-monospace, monospace;
  font-size: 0.69rem;
}
.roster-pill {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.roster-pill.ok {
  background: rgba(74, 222, 128, 0.18);
  color: var(--ok);
}
.roster-pill.loading {
  background: rgba(251, 191, 36, 0.18);
  color: var(--warn);
}
.roster-pill.off {
  background: rgba(248, 113, 113, 0.18);
  color: var(--danger);
}
.room-actions {
  display: flex;
  gap: 8px;
}
.room-actions .btn.primary {
  flex: 1;
}

/* HUD Layer */
.hud-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

/* Unified Single-Strip Top Bar + Sub-bar Callsign Pill */
.hud-top-stack {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;
}

.hud-top-bar {
  position: relative;
  width: 100%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 13px;
  background: rgba(6, 15, 29, 0.93);
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48), inset 0 0 10px rgba(14, 165, 233, 0.08);
  contain: layout style;
  pointer-events: none;
}

/* Bottom Dive Telemetry Card */
.dive-telemetry {
  background: rgba(6, 15, 29, 0.94);
  border: 1.5px solid var(--bezel-border);
  border-radius: 11px;
  padding: 5px 7px 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(14, 165, 233, 0.1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  contain: layout style;
  width: clamp(238px, 23vw, 285px);
}

.dc-alerts {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 6px;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dc-alerts.ok {
  background: rgba(74, 222, 128, 0.12);
  color: var(--ok);
}
.dc-alerts.warn {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warn);
}
.dc-alerts.danger {
  background: rgba(239, 68, 68, 0.3);
  color: #fecaca;
  animation: pulseFlash 0.65s infinite alternate;
}

.dc-primary-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr 1fr 28px;
  gap: 4px;
  align-items: stretch;
}

.dc-cell {
  background: rgba(2, 8, 18, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 8px;
  padding: 4px 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.dc-lbl {
  font-size: 0.56rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dc-lbl.warn { color: var(--warn); }
.dc-lbl.danger { color: var(--danger); }

.dc-val {
  font-size: 1.04rem;
  font-weight: 800;
  line-height: 1.1;
}
.dc-val.big {
  font-size: 1.24rem;
  color: #f8fafc;
}
.dc-val.ok { color: var(--ok); }
.dc-val.warn { color: var(--warn); }
.dc-val.danger { color: var(--danger); }
.dc-val.cyan { color: var(--cyan); }

.dc-sub,
.dc-sub-pair {
  font-size: 0.59rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 3px;
  white-space: nowrap;
}
.dc-subval.warn { color: var(--warn); }
.dc-subval.danger { color: var(--danger); }

.dc-ascent-col {
  background: rgba(2, 8, 18, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 8px;
  padding: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}
.dc-ascent-track {
  position: relative;
  width: 9px;
  flex: 1;
  min-height: 22px;
  margin: 2px 0;
  background: linear-gradient(
    to top,
    rgba(30, 41, 59, 0.9) 0%,
    rgba(74, 222, 128, 0.18) 25%,
    rgba(74, 222, 128, 0.25) 55%,
    rgba(248, 113, 113, 0.25) 65%,
    rgba(248, 113, 113, 0.35) 100%
  );
  border-radius: 99px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.dc-ascent-target {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 50%;
  height: 2px;
  background: #f8fafc;
  z-index: 2;
  opacity: 0.9;
}
.dc-ascent-limit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 61%;
  height: 1.5px;
  background: var(--danger);
  z-index: 2;
  opacity: 0.75;
}
.dc-ascent-fill {
  width: 100%;
  height: 0%;
  transition: height 0.1s linear;
}
.dc-ascent-fill.ok { background: var(--ok); }
.dc-ascent-fill.warn { background: var(--warn); }
.dc-ascent-fill.danger { background: var(--danger); }

.dc-objective {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 200px;
  min-width: 0;
  max-width: 400px;
  padding: 1px 4px;
}
.obj-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.obj-count {
  font-family: ui-monospace, monospace;
  font-size: 0.64rem;
  color: var(--cyan);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.obj-gas {
  font-family: ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  flex-shrink: 0;
}
.obj-gas.ok {
  background: rgba(74, 222, 128, 0.16);
  color: var(--ok);
}
.obj-gas.switch {
  background: rgba(251, 191, 36, 0.25);
  color: var(--warn);
  animation: pulseFlash 0.65s infinite alternate;
}
.obj-action {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 5px;
  margin-top: 1px;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.obj-action.stop {
  background: rgba(251, 191, 36, 0.24);
  border: 1px solid rgba(251, 191, 36, 0.6);
  color: #fde68a;
}
.obj-action.danger {
  background: rgba(239, 68, 68, 0.32);
  border: 1px solid rgba(248, 113, 113, 0.85);
  color: #fee2e2;
  animation: pulseFlash 0.55s infinite alternate;
}
.obj-action.move {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}

/* One-Tap Floating Gas-Switch Coaching Banner */
.hud-gas-callout {
  align-self: center;
  width: min(94vw, 490px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1.8px solid rgba(251, 191, 36, 0.88);
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.94), rgba(69, 26, 3, 0.96));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 22px rgba(251, 191, 36, 0.28);
  color: #fef3c7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  animation: gasPulse 1.15s ease-in-out infinite;
}
.hud-gas-callout[hidden] {
  display: none !important;
}
.hud-gas-callout.danger {
  border-color: rgba(248, 113, 113, 0.95);
  background: linear-gradient(135deg, rgba(153, 27, 27, 0.96), rgba(69, 10, 10, 0.98));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.62), 0 0 26px rgba(239, 68, 68, 0.45);
  color: #fef2f2;
  animation: gasPulse 0.72s ease-in-out infinite;
}
.hud-gas-callout:active {
  transform: scale(0.98);
}
.gas-callout-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gas-callout-copy strong {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.15;
}
.gas-callout-copy span {
  font-size: 0.65rem;
  color: rgba(254, 243, 199, 0.88);
  line-height: 1.25;
}
.hud-gas-callout.danger .gas-callout-copy span {
  color: rgba(254, 226, 226, 0.92);
}
.gas-callout-cta {
  flex-shrink: 0;
  padding: 5px 9px;
  border-radius: 8px;
  background: #fbbf24;
  color: #1c1917;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.hud-gas-callout.danger .gas-callout-cta {
  background: #fecaca;
  color: #7f1d1d;
}
@media (max-width: 680px) {
  .hud-gas-callout {
    padding: 6px 9px;
    gap: 8px;
  }
  .gas-callout-copy strong {
    font-size: 0.72rem;
  }
  .gas-callout-copy span {
    font-size: 0.6rem;
  }
  .gas-callout-cta {
    padding: 4px 7px;
    font-size: 0.62rem;
  }
}
.obj-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.obj-hint {
  font-size: 0.66rem;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Self & Teammate Health Cards */
.self-health-card {
  background: rgba(8, 15, 26, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.38);
  border-radius: 11px;
  padding: 5px 7px;
  width: clamp(212px, 24vw, 258px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  contain: layout style;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  overflow: hidden;
}
.self-health-card.warn {
  border-color: rgba(251, 191, 36, 0.7);
}
.self-health-card.danger {
  border-color: rgba(239, 68, 68, 0.85);
  background: rgba(69, 10, 10, 0.9);
  animation: pulseFlash 0.65s infinite alternate;
}

.self-tag {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 800;
  color: #bae6fd;
  background: rgba(6, 15, 29, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.34);
  border-radius: 999px;
  padding: 3px 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.dc-ekg-row {
  background: rgba(2, 8, 18, 0.86);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 7px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 auto;
  width: 100%;
  min-height: 38px;
  min-width: 0;
}
.dc-ekg-row.warn {
  border-color: rgba(251, 191, 36, 0.6);
}
.dc-ekg-row.danger {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(45, 8, 12, 0.85);
}
.ekg-meta {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}
.ekg-heart {
  color: var(--ok);
  font-size: 0.7rem;
  display: inline-block;
  transition: transform 0.08s ease;
}
.ekg-heart.pulse {
  transform: scale(1.28);
}
.ekg-bpm {
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1;
  color: var(--ok);
}
.dc-ekg-row.warn .ekg-heart,
.dc-ekg-row.warn .ekg-bpm {
  color: var(--warn);
}
.dc-ekg-row.danger .ekg-heart,
.dc-ekg-row.danger .ekg-bpm {
  color: var(--danger);
}
.ekg-unit {
  font-size: 0.54rem;
  color: var(--text-muted);
}
.ekg-canvas {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  height: 100%;
  min-height: 28px;
  display: block;
}

.dc-vitals-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.dc-vital {
  background: rgba(2, 8, 18, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 6px;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  gap: 1.5px;
}
.dc-vital .v-lbl {
  font-size: 0.5rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.dc-vital .v-track {
  height: 3.5px;
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  overflow: hidden;
}
.dc-vital .v-fill {
  height: 100%;
  width: 0%;
  background: var(--ok);
  transition: width 0.12s ease;
}
.dc-vital .v-val {
  font-size: 0.56rem;
  font-weight: 800;
  color: var(--text-main);
}
.dc-vital.warn {
  border-color: rgba(251, 191, 36, 0.55);
}
.dc-vital.warn .v-fill { background: var(--warn); }
.dc-vital.warn .v-val { color: var(--warn); }
.dc-vital.danger {
  border-color: rgba(239, 68, 68, 0.8);
}
.dc-vital.danger .v-fill { background: var(--danger); }
.dc-vital.danger .v-val { color: #fecaca; }

.dc-team-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}
.mate-card {
  background: rgba(8, 15, 26, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 10px;
  padding: 5px 8px;
  width: clamp(168px, 18vw, 212px);
  font-family: ui-monospace, monospace;
  font-size: 0.66rem;
  contain: layout style;
}
.mate-card.warn {
  border-color: rgba(251, 191, 36, 0.65);
}
.mate-card.danger {
  border-color: rgba(239, 68, 68, 0.85);
  background: rgba(69, 10, 10, 0.78);
  animation: pulseFlash 0.65s infinite alternate;
}
.mate-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  color: #fdba74;
}
.mate-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mate-cond {
  font-size: 0.56rem;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.16);
  color: var(--ok);
  flex-shrink: 0;
}
.mate-cond.warn {
  background: rgba(251, 191, 36, 0.22);
  color: var(--warn);
}
.mate-cond.danger {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}
.mate-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  margin: 2px 0 3px;
  font-size: 0.62rem;
}
.mate-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.mate-bar {
  height: 3.5px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  overflow: hidden;
}
.mate-bar-fill {
  height: 100%;
  transition: width 0.15s ease;
}
.mate-ekg-row {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(2, 8, 18, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.16);
  border-radius: 6px;
  padding: 2px 5px;
}
.mate-hr {
  font-size: 0.6rem;
  font-weight: 800;
  min-width: 34px;
  color: var(--ok);
}
.mate-hr.warn { color: var(--warn); }
.mate-hr.danger { color: var(--danger); }
.mate-ekg-canvas {
  flex: 1;
  width: 100%;
  height: 15px;
  display: block;
}

.hud-util-btns {
  position: relative;
  display: flex;
  gap: 5px;
  pointer-events: auto;
}
.util-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(8, 15, 26, 0.86);
  color: var(--text-main);
  font-size: 0.96rem;
  cursor: pointer;
}
.util-btn.active {
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(14, 116, 144, 0.42);
  color: #bae6fd;
}
.util-btn.danger {
  color: var(--danger);
}

.hud-menu-wrap {
  display: inline-flex;
}
.hud-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 178px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(6, 15, 29, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.38);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.68);
  z-index: 45;
  pointer-events: auto;
}
.hud-menu-popover[hidden] {
  display: none !important;
}
.hud-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.88);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.hud-menu-item[hidden] {
  display: none !important;
}
.hud-menu-item:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(15, 33, 58, 0.95);
}
.hud-menu-item.util-pill {
  border-color: rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}
.hud-menu-item.util-pill.copied {
  border-color: rgba(52, 211, 153, 0.75);
  color: #6ee7b7;
  background: rgba(6, 78, 59, 0.42);
}
.hud-menu-item.radio-hud-btn.active {
  border-color: rgba(56, 189, 248, 0.72);
  color: #7dd3fc;
  background: rgba(14, 116, 144, 0.34);
}
.hud-menu-item.muted {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.45);
}

/* Bottom Dive Console Cluster:
   Dive Computer Telemetry + Health (Left) | Line Status + Joystick (Center) | Line Controls + Tank Controls (Right) */
.hud-bottom-dock {
  position: fixed;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  z-index: 28;
  pointer-events: none;
}

/* Left Wing: Dive Computer Telemetry + Diver Health */
.hud-left-col {
  grid-column: 1;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  pointer-events: none;
}

.hud-left-wing {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  max-width: 100%;
  pointer-events: none;
}

/* Right Wing: Guideline Controls stacked above Tank Controls */
.hud-right-wing {
  grid-column: 3;
  justify-self: start;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  max-width: 100%;
  pointer-events: none;
}

.hud-reel-dock {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 5px;
  padding: 4px;
  border-radius: 11px;
  background: rgba(6, 15, 29, 0.94);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  contain: layout style;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: auto;
}
.hud-reel-dock[hidden] {
  display: none !important;
}
.hud-reel-dock.active {
  border-color: rgba(251, 191, 36, 0.85);
  background: rgba(24, 18, 6, 0.92);
  box-shadow: 0 8px 26px rgba(245, 158, 11, 0.25);
}
.hud-reel-dock.warn {
  border-color: rgba(251, 191, 36, 0.7);
}
.hud-reel-dock.danger {
  border-color: rgba(239, 68, 68, 0.85);
  background: rgba(45, 8, 12, 0.92);
}

/* Center Column: Line Status Pill + Swim Joystick */
.hud-stick-center {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.reel-dock-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(6, 15, 29, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.reel-dock-status[hidden] {
  display: none !important;
}
.reel-dock-status.active {
  border-color: rgba(251, 191, 36, 0.85);
  background: rgba(24, 18, 6, 0.92);
}
.reel-dock-status.warn {
  border-color: rgba(251, 191, 36, 0.7);
}
.reel-dock-status.danger {
  border-color: rgba(239, 68, 68, 0.85);
  background: rgba(45, 8, 12, 0.92);
}

.reel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.75);
}
.reel-dock-status.active .reel-dot {
  background: #fbbf24;
  box-shadow: 0 0 10px #fbbf24;
  animation: pulseFlash 0.6s infinite alternate;
}
.reel-dock-status.danger .reel-dot {
  background: #f87171;
  box-shadow: 0 0 10px #f87171;
}
.reel-tag {
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.reel-dock-status strong {
  font-size: 0.74rem;
  font-weight: 800;
  color: #e0f2fe;
}
.reel-dock-status.active strong { color: #fef08a; }
.reel-dock-status.warn strong { color: var(--warn); }
.reel-dock-status.danger strong { color: var(--danger); }

.reel-btn {
  border: 1px solid rgba(56, 189, 248, 0.55);
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.45), rgba(14, 165, 233, 0.35));
  color: #f0f9ff;
  border-radius: 8px;
  padding: 6px 10px;
  font-family: ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
}
.reel-btn:hover {
  filter: brightness(1.15);
}
.reel-btn.active {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border-color: #fde68a;
  color: #111827;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}
.reel-btn.ghost {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(148, 163, 184, 0.4);
  color: #cbd5e1;
}

/* Swim Joystick */
.touch-stick {
  position: relative;
  width: 96px;
  height: 96px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.touch-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(8, 15, 26, 0.5);
  border: 2px solid rgba(56, 189, 248, 0.42);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.touch-knob {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7dd3fc, #0284c7);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.45);
  pointer-events: none;
}

/* Optional Left Flashlight Aim Joystick (sits on top of left-side controls) */
.torch-stick {
  width: 86px;
  height: 86px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.torch-stick[hidden] {
  display: none !important;
}
.torch-ring {
  background: rgba(10, 16, 26, 0.56);
  border-color: rgba(251, 191, 36, 0.48);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.48), inset 0 0 12px rgba(251, 191, 36, 0.08);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.torch-stick.aiming .torch-ring {
  border-color: rgba(253, 224, 71, 0.92);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.52), 0 0 18px rgba(251, 191, 36, 0.42), inset 0 0 14px rgba(254, 240, 138, 0.18);
}
.torch-knob {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 32%, #fef08a, #f59e0b 65%, #b45309);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.48);
  color: #1e293b;
}
.torch-knob-svg {
  width: 22px;
  height: 22px;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.35));
}

.dc-gas-rack {
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 94px));
  gap: 5px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(6, 15, 29, 0.94);
  border: 1.5px solid var(--bezel-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  contain: layout style;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: auto;
}

.dc-tank-btn {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 5px 6px 4px;
  color: var(--text-main);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dc-tank-btn.active {
  border-color: #f8fafc;
  background: rgba(14, 116, 144, 0.38);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}
.dc-tank-btn.recommended {
  border-color: var(--warn);
  background: rgba(251, 191, 36, 0.28);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
  animation: gasPulse 0.9s ease-in-out infinite;
}
.dc-tank-btn.recommended .tank-bar-txt {
  color: #fef08a;
  font-weight: 900;
}
.dc-tank-btn.recommended.urgent {
  border-color: #f87171;
  background: rgba(220, 38, 38, 0.38);
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.68);
  animation: gasPulse 0.6s ease-in-out infinite;
}
.dc-tank-btn.recommended.urgent .tank-bar-txt {
  color: #fecaca;
}
.dc-tank-btn.unsafe {
  border-color: rgba(248, 113, 113, 0.55);
}
.dc-tank-btn.unsafe .tank-meta {
  color: var(--danger);
}
.dc-tank-btn.empty {
  opacity: 0.45;
}

.tank-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 3px;
  font-size: 0.66rem;
  font-weight: 800;
}
.tank-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tank-bar-txt {
  color: var(--text-muted);
  font-size: 0.62rem;
  flex-shrink: 0;
}
.tank-meta {
  font-size: 0.52rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tank-gauge {
  height: 3.5px;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 1px;
}
.tank-gauge-fill {
  height: 100%;
  width: 100%;
}

/* Responsive Console & Portrait Adjustments */
@media (max-width: 1020px) and (min-width: 601px) and (min-height: 461px) {
  .hud-left-wing {
    flex-direction: column;
    align-items: stretch;
  }
  .dive-telemetry,
  .self-health-card {
    width: clamp(210px, 27vw, 260px);
  }
}

@media (max-width: 680px) {
  .hud-top-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "obj utils"
      "buddy buddy";
    align-items: center;
    gap: 4px 6px;
    padding: 4px 6px;
  }
  .dc-objective {
    grid-area: obj;
    max-width: none;
    padding: 1px 2px;
  }
  .obj-name {
    font-size: 0.72rem;
  }
  .obj-hint {
    font-size: 0.6rem;
  }
  .self-tag {
    max-width: 180px;
    padding: 2px 8px;
    font-size: 0.6rem;
  }
  .hud-util-btns {
    grid-area: utils;
    justify-self: end;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
  }
  .util-btn {
    width: 31px;
    height: 31px;
    font-size: 0.86rem;
    border-radius: 8px;
  }
  .dc-team-panel {
    grid-area: buddy;
    width: 100%;
    border-top: 1px solid rgba(56, 189, 248, 0.16);
    padding-top: 4px;
  }
  .mate-card {
    flex: 1 1 135px;
    width: auto;
    padding: 3px 6px;
  }
  .mate-ekg-row {
    display: none;
  }
}

@media (max-width: 600px) and (min-height: 461px) {
  .hud-bottom-dock {
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(6px, env(safe-area-inset-left));
    right: max(6px, env(safe-area-inset-right));
    gap: 6px;
  }
  .hud-left-col {
    width: min(142px, 100%);
    align-items: flex-start;
    gap: 6px;
  }
  .hud-left-wing {
    flex-direction: column;
    width: 100%;
    gap: 4px;
  }
  .dive-telemetry {
    width: 100%;
    padding: 3px 5px;
    border-radius: 9px;
  }
  .dc-alerts {
    margin-bottom: 3px;
    padding: 1.5px 4px;
    font-size: 0.58rem;
  }
  .dc-primary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5px;
  }
  .dc-cell {
    padding: 2px 4px;
    border-radius: 6px;
  }
  .dc-lbl {
    font-size: 0.54rem;
  }
  .dc-val {
    font-size: 0.84rem;
  }
  .dc-val.big {
    font-size: 0.94rem;
  }
  .dc-sub,
  .dc-sub-pair {
    font-size: 0.54rem;
  }
  .dc-ascent-col {
    padding: 2px 4px;
    border-radius: 6px;
  }
  .dc-ascent-track {
    width: 8px;
    min-height: 18px;
    margin: 1px 0;
  }
  .self-health-card {
    width: 100%;
    padding: 3px 5px;
    border-radius: 9px;
    gap: 3px;
  }
  .dc-ekg-row {
    width: 100%;
    min-height: 28px;
    padding: 2px 5px;
    overflow: hidden;
  }
  .self-health-card .ekg-unit {
    display: none;
  }
  .ekg-bpm {
    font-size: 0.86rem;
  }
  .ekg-canvas {
    height: 22px;
    min-height: 22px;
  }
  .dc-vitals-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
  }
  .dc-vital {
    padding: 1px 3px;
  }
  .touch-stick {
    width: 88px;
    height: 88px;
  }
  .torch-stick {
    width: 80px;
    height: 80px;
  }
  .touch-knob {
    width: 36px;
    height: 36px;
  }
  .torch-knob-svg {
    width: 19px;
    height: 19px;
  }
  .hud-right-wing {
    width: min(142px, 100%);
    gap: 4px;
  }
  .hud-reel-dock {
    flex-direction: column;
    padding: 3px;
    gap: 3px;
    border-radius: 9px;
  }
  .reel-btn {
    padding: 6px 6px;
    min-height: 30px;
    font-size: 0.58rem;
  }
  .reel-dock-status {
    padding: 2px 7px;
  }
  .reel-dock-status .reel-tag {
    display: none;
  }
  .dc-gas-rack {
    grid-template-columns: 1fr;
    width: 100%;
    gap: 4px;
    padding: 4px;
    border-radius: 9px;
  }
  .dc-tank-btn {
    padding: 6px 6px;
    min-height: 36px;
    gap: 2px;
  }
  .tank-meta {
    display: none;
  }
}

@media (max-height: 460px) and (orientation: landscape) {
  .hud-top-bar {
    gap: 6px;
    padding: 4px 7px;
  }
  .obj-hint {
    display: none;
  }
  .hud-bottom-dock {
    grid-template-columns: auto auto auto;
    justify-content: space-between;
    gap: 6px;
  }
  .hud-left-wing {
    flex-direction: row;
    gap: 4px;
  }
  .dive-telemetry {
    width: 172px;
    padding: 3px 5px;
  }
  .dc-alerts {
    margin-bottom: 2px;
    font-size: 0.56rem;
  }
  .dc-val {
    font-size: 0.86rem;
  }
  .dc-val.big {
    font-size: 0.96rem;
  }
  .self-health-card {
    width: 126px;
    padding: 3px 5px;
    gap: 3px;
  }
  .self-health-card .dc-ekg-row {
    min-height: 28px;
    padding: 2px 5px;
  }
  .self-health-card .ekg-unit {
    display: none;
  }
  .dc-vitals-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
  }
  .touch-stick {
    width: 78px;
    height: 78px;
  }
  .torch-stick {
    width: 70px;
    height: 70px;
  }
  .touch-knob {
    width: 32px;
    height: 32px;
  }
  .torch-knob-svg {
    width: 17px;
    height: 17px;
  }
  .dc-gas-rack {
    grid-template-columns: repeat(3, minmax(66px, 80px));
    padding: 4px;
  }
}

/* Solo Dive Pause Overlay */
.hud-pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 18, 0.72);
  pointer-events: auto;
}
.hud-pause-overlay[hidden] {
  display: none !important;
}
.hud-pause-card {
  width: min(400px, 100%);
  border-radius: 16px;
  padding: 18px;
  background: linear-gradient(160deg, rgba(10, 23, 44, 0.97), rgba(4, 10, 24, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  text-align: center;
}
.hud-pause-card h3 {
  margin: 4px 0 12px;
  font-size: 1.25rem;
  color: #f8fafc;
}
.pause-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.72rem;
  text-align: left;
  color: #cbd5e1;
}
.pause-keys strong {
  color: #7dd3fc;
  display: block;
  font-family: ui-monospace, monospace;
}

/* Keyboard Focus Visibility & Reduced-Motion Accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Animated Debrief Stats & Scoring */
.debrief-overlay {
  background: radial-gradient(circle at 50% 30%, rgba(14, 116, 144, 0.28), rgba(2, 6, 18, 0.72));
  backdrop-filter: blur(4px);
}
.debrief-card {
  max-width: 680px;
  animation: debriefSlideIn 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.debrief-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.debrief-grade-seal {
  min-width: 58px;
  height: 58px;
  border-radius: 14px;
  border: 2px solid #fbbf24;
  background: radial-gradient(circle at 30% 25%, rgba(251, 191, 36, 0.32), rgba(120, 53, 15, 0.38));
  color: #fef08a;
  font-family: ui-monospace, monospace;
  font-size: 1.55rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.25);
  transform: scale(0.5);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}
.debrief-grade-seal.revealed {
  transform: scale(1);
  opacity: 1;
}
.debrief-grade-seal.dnf {
  border-color: var(--danger);
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
  box-shadow: none;
}
.debrief-hero {
  display: grid;
  grid-template-columns: 175px 1fr;
  gap: 12px;
  background: rgba(8, 16, 32, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
@media (max-width: 560px) {
  .debrief-hero {
    grid-template-columns: 1fr;
  }
}
.debrief-score-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  padding-right: 10px;
}
@media (max-width: 560px) {
  .debrief-score-block {
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    padding-right: 0;
    padding-bottom: 8px;
  }
}
.debrief-score-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
  font-weight: 700;
}
.debrief-total-score {
  font-family: ui-monospace, monospace;
  font-size: 2.15rem;
  line-height: 1.05;
  color: #fef08a;
  margin: 4px 0;
}
.debrief-best {
  font-size: 0.7rem;
  color: var(--ok);
}
.debrief-breakdown {
  display: flex;
  flex-direction: column;
  gap: 7px;
  justify-content: center;
}
.score-bar-row {
  display: grid;
  grid-template-columns: 102px 1fr 62px;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
}
.score-bar-lbl {
  color: var(--text-muted);
}
.score-bar-track {
  height: 8px;
  background: rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.score-bar-fill.gold { background: linear-gradient(90deg, #ca8a04, #fde047); }
.score-bar-fill.green { background: linear-gradient(90deg, #16a34a, #4ade80); }
.score-bar-fill.purple { background: linear-gradient(90deg, #9333ea, #e879f9); }
.score-bar-pts {
  text-align: right;
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: #f8fafc;
}
.debrief-team {
  background: rgba(12, 22, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}
.debrief-section-title {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
  font-weight: 800;
  margin-bottom: 6px;
}
.team-avg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.team-avg-cell {
  background: rgba(2, 8, 18, 0.65);
  border-radius: 8px;
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
}
.team-avg-cell span { font-size: 0.62rem; color: var(--text-muted); }
.team-avg-cell strong { font-size: 0.88rem; font-family: ui-monospace, monospace; }
.team-roster-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.debrief-artifacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.artifact-chip {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  opacity: 0.55;
}
.artifact-chip.found {
  opacity: 1;
  color: #fef08a;
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(161, 98, 7, 0.28);
  animation: chipPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes debriefSlideIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes chipPop {
  from { transform: scale(0.75); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.obj-extra {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  color: #fde047;
  margin-left: 6px;
}
.debrief-badge {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.debrief-badge.ok {
  background: rgba(74, 222, 128, 0.18);
  color: var(--ok);
}
.debrief-badge.danger {
  background: rgba(248, 113, 113, 0.2);
  color: var(--danger);
}
.debrief-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.debrief-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.debrief-stats > div {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.debrief-stats span {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.debrief-stats strong {
  font-family: ui-monospace, monospace;
  font-size: 1rem;
}

.blink {
  animation: pulseFlash 0.55s infinite alternate;
}

@keyframes pulseFlash {
  from { opacity: 1; }
  to { opacity: 0.42; }
}

/* Boot & Graphics Loader Overlay */
.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, #062840 0%, #031321 55%, #020b14 100%);
  transition: opacity 0.38s ease, visibility 0.38s ease;
}
.loader-screen.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(9, 19, 34, 0.95), rgba(6, 13, 24, 0.97));
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 20px;
  padding: 26px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(186, 230, 253, 0.09);
}
.loader-emblem {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loader-emblem-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.42);
  animation: sonarPulse 1.8s ease-out infinite;
}
.loader-screen.done .loader-emblem-pulse {
  animation: none;
}
.loader-emblem-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: block;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}
.loader-title {
  margin: 4px 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #bae6fd, #38bdf8, #2dd4bf);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.loader-step {
  margin: 0 0 14px;
  min-height: 1.2em;
  font-size: 0.84rem;
  color: #cbd5e1;
}
.loader-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.24);
  overflow: hidden;
  margin-bottom: 10px;
}
.loader-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7, #38bdf8, #2dd4bf);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.65);
  transition: width 0.14s ease-out;
}
.loader-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: #7dd3fc;
  text-align: left;
}
.loader-meta strong {
  font-size: 0.92rem;
  color: #f8fafc;
}
.loader-coop-sync {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.loader-crew-status {
  font-family: ui-monospace, monospace;
  font-size: 0.76rem;
  color: #fde68a;
}
.loader-sync-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.btn.has-rooms {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.28);
  color: #e0f2fe;
}

/* Co-op Quick Hand Signals Bar */
.coop-comms {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  top: max(98px, calc(env(safe-area-inset-top) + 90px));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: auto;
  z-index: 32;
}
.comm-btn {
  background: rgba(8, 15, 26, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  border-radius: 999px;
  padding: 4px 8px;
  font-family: ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  cursor: pointer;
}
.comm-btn:active {
  transform: scale(0.95);
  background: rgba(14, 165, 233, 0.35);
}

/* Co-op Surfacing & Spectate Sync Banner */
.coop-wait-banner {
  position: fixed;
  top: max(68px, calc(env(safe-area-inset-top) + 60px));
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 470px);
  background: rgba(8, 17, 30, 0.95);
  border: 1px solid rgba(74, 222, 128, 0.45);
  border-radius: 14px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: auto;
  z-index: 30;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.coop-wait-banner.down {
  border-color: rgba(248, 113, 113, 0.55);
}
.coop-wait-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.coop-wait-info strong {
  font-size: 0.78rem;
  color: var(--ok);
  letter-spacing: 0.04em;
}
.coop-wait-banner.down .coop-wait-info strong {
  color: var(--danger);
}
.coop-wait-info span {
  font-size: 0.74rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coop-wait-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

@keyframes sonarPulse {
  0% { transform: scale(0.72); opacity: 0.9; }
  100% { transform: scale(1.25); opacity: 0; }
}

@media (max-width: 680px) {
  .coop-comms {
    top: auto;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(224px, calc(env(safe-area-inset-bottom) + 218px));
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .coop-comms::-webkit-scrollbar {
    display: none;
  }
  .coop-comms .comm-btn {
    padding: 4px 7px;
    font-size: 0.62rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .coop-wait-banner {
    top: max(112px, calc(env(safe-area-inset-top) + 104px));
  }
}

/* Landscape Mobile Overlay Lanes (placed after base & <=680px rules so cascade wins cleanly!) */
@media (max-height: 460px) and (orientation: landscape) {
  .coop-comms {
    top: max(52px, calc(env(safe-area-inset-top) + 46px));
    bottom: auto;
    right: max(8px, env(safe-area-inset-right));
    flex-direction: row;
    flex-wrap: nowrap;
    max-width: 56vw;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .coop-comms::-webkit-scrollbar {
    display: none;
  }
  .coop-comms .comm-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .game-toast {
    top: max(54px, calc(env(safe-area-inset-top) + 48px));
    bottom: auto;
  }
  .wreck-action-btn {
    bottom: max(100px, calc(env(safe-area-inset-bottom) + 94px));
    min-width: 162px;
    padding: 6px 14px;
  }
}

@media (max-width: 600px) and (min-height: 461px) {
  .wreck-action-btn {
    bottom: max(118px, calc(env(safe-area-inset-bottom) + 112px));
    min-width: 146px;
    max-width: 184px;
    padding: 7px 12px;
  }
  .wreck-action-btn strong {
    font-size: 0.74rem;
  }
}

/* Global Individual & Team Leaderboard */
#screen-menu.is-leaderboard {
  height: 100dvh;
  overflow: hidden;
  padding: max(14px, calc(env(safe-area-inset-top) + 10px))
           max(14px, env(safe-area-inset-right))
           max(14px, calc(env(safe-area-inset-bottom) + 10px))
           max(14px, env(safe-area-inset-left));
}
#screen-menu.is-leaderboard .menu-card {
  height: 100%;
  max-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#screen-menu.is-leaderboard .menu-header,
#screen-menu.is-leaderboard .pwa-update-banner {
  flex-shrink: 0;
}
#screen-menu.is-leaderboard .menu-desc-wrap {
  display: none;
}
#screen-menu.is-leaderboard .leaderboard-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 4px;
  padding-top: 10px;
}
#screen-menu.is-leaderboard .lb-nav-bar,
#screen-menu.is-leaderboard .lb-head,
#screen-menu.is-leaderboard .lb-career-summary,
#screen-menu.is-leaderboard .lb-sub {
  flex-shrink: 0;
}
#screen-menu.is-leaderboard .lb-rows {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.38) transparent;
}
.leaderboard-panel {
  margin-top: 10px;
}
.lb-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.lb-tabs,
.lb-scope-tabs {
  display: inline-flex;
  gap: 4px;
  background: rgba(2, 8, 18, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 9px;
  padding: 2px;
}
.lb-tab,
.lb-scope {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.lb-tab.active,
.lb-scope.active {
  background: rgba(14, 165, 233, 0.25);
  color: #e0f2fe;
}
.lb-site-select {
  flex: 1;
  min-width: 170px;
  max-width: 280px;
  background: rgba(2, 8, 18, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 9px;
  color: #e0f2fe;
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}
.lb-site-select:focus {
  border-color: var(--cyan);
}
.lb-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.lb-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 360px;
  overflow-y: auto;
}
.lb-row {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto auto 14px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(8, 16, 32, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.14);
  font-size: 0.76rem;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease;
}
@media (max-width: 640px) {
  .lb-row {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 0.8rem;
  }
}
.lb-row:hover,
.lb-row:focus-visible {
  outline: none;
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(14, 116, 144, 0.24);
}
.lb-row:active {
  transform: scale(0.992);
}
.lb-chevron {
  font-size: 0.9rem;
  line-height: 1;
  color: #64748b;
  text-align: right;
  font-weight: 700;
}
.lb-row:hover .lb-chevron {
  color: #7dd3fc;
}
.lb-row.me {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 116, 144, 0.26);
}
.lb-rank {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: #94a3b8;
}
.lb-row:nth-child(1) .lb-rank { color: #fbbf24; }
.lb-row:nth-child(2) .lb-rank { color: #e2e8f0; }
.lb-row:nth-child(3) .lb-rank { color: #fb923c; }
.lb-name {
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-meta {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.lb-grade {
  font-family: ui-monospace, monospace;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
}
.lb-score {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: #fef08a;
}
.lb-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 10px 6px;
  text-align: center;
}
.debrief-leaderboard {
  margin: 10px 0 12px;
  background: rgba(8, 16, 32, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 12px;
  padding: 10px;
}
.debrief-lb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.debrief-lb-rank {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
}

.lb-career-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.24), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(56, 189, 248, 0.28);
}
.lb-career-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.lb-career-cell span {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lb-career-cell strong {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: #f0f9ff;
}

.menu-header-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.pwa-version-btn {
  font-variant-numeric: tabular-nums;
  opacity: 0.86;
}
.pwa-version-btn.has-update {
  opacity: 1;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(5, 150, 105, 0.95));
  border-color: rgba(110, 231, 183, 0.82);
  color: #ecfdf5;
  animation: gasPulse 1.5s ease-in-out infinite;
}
.pwa-update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  padding: 8px 11px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.68), rgba(14, 116, 144, 0.48));
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #ecfdf5;
  font-size: 0.78rem;
  font-weight: 700;
}
.pwa-update-banner[hidden] {
  display: none;
}
.radio-btn.active,
.util-btn.radio-hud-btn.active {
  border-color: rgba(56, 189, 248, 0.72);
  color: #7dd3fc;
  background: rgba(14, 116, 144, 0.34);
}
.comm-btn.share-gas {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.88), rgba(5, 150, 105, 0.92));
  border-color: rgba(110, 231, 183, 0.7);
  color: #ecfdf5;
  animation: gasPulse 1.4s ease-in-out infinite;
}
.comm-btn.tow-buddy {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.92), rgba(217, 119, 6, 0.94));
  border-color: rgba(253, 230, 138, 0.78);
  color: #fffbeb;
  animation: gasPulse 1.4s ease-in-out infinite;
}
@keyframes gasPulse {
  0%, 100% { transform: scale(1); opacity: 0.94; }
  50% { transform: scale(1.035); opacity: 1; }
}

.lb-stats-modal {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(2, 6, 18, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lb-stats-modal[hidden] {
  display: none;
}
.lb-stats-card {
  width: min(460px, 100%);
  max-height: min(86vh, 660px);
  overflow-y: auto;
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(160deg, rgba(10, 23, 44, 0.96), rgba(4, 10, 24, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(186, 230, 253, 0.14);
}
.lb-stats-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.lb-stats-kicker {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #38bdf8;
  text-transform: uppercase;
}
.lb-stats-title {
  margin: 2px 0 3px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
}
.lb-stats-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.lb-stats-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.28), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(56, 189, 248, 0.34);
  margin-bottom: 10px;
}
.lb-stats-score-val {
  font-family: ui-monospace, monospace;
  font-size: 1.55rem;
  font-weight: 900;
  color: #fef08a;
  line-height: 1.1;
}
.lb-stats-score-lbl {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}
.lb-stats-grade-pill {
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
  font-weight: 900;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #bae6fd;
}
.lb-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}
.lb-stats-cell {
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(8, 16, 32, 0.74);
  border: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lb-stats-cell span {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.lb-stats-cell strong {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: #f0f9ff;
}
.lb-stats-section {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}
.lb-stats-section-title {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #7dd3fc;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.lb-stats-note {
  margin-top: 8px;
  font-size: 0.7rem;
  color: #64748b;
  text-align: center;
}
.lb-stats-sitelist {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 200px;
  overflow-y: auto;
}
.lb-stats-siterow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(8, 16, 32, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.72rem;
}

/* ==========================================================================
   HOME PAGE AQUATIC MOTION & SONAR TELEMETRY TRANSITIONS
   ========================================================================== */
:root {
  --ease-buoyant: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
  --ease-submerge: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Buoyant menu screen entrance & submerge-to-dive exit */
#screen-menu {
  transition: opacity 0.34s var(--ease-submerge), backdrop-filter 0.34s var(--ease-submerge);
}
#screen-menu:not([hidden]) {
  animation: backdropDissolveIn 0.42s var(--ease-buoyant) both;
}
#screen-menu.menu-submerging {
  opacity: 0;
  pointer-events: none;
}
#screen-menu.menu-submerging .menu-card {
  transform: translateY(-14px) scale(0.965);
  opacity: 0;
  transition: transform 0.28s var(--ease-submerge), opacity 0.24s var(--ease-submerge);
}

@keyframes backdropDissolveIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes menuCardSurface {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes sectionRise {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes causticSheen {
  0%, 100% { opacity: 0.28; transform: translateX(-18%) scaleX(0.92); }
  50% { opacity: 0.72; transform: translateX(18%) scaleX(1.06); }
}

.menu-card {
  position: relative;
  overflow: visible;
  animation: menuCardSurface 0.48s var(--ease-buoyant) both;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s var(--ease-buoyant), opacity 0.25s ease;
}

/* Home Header Popover Menu (Leaderboard, Music, Version, Install) */
.home-menu-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 30;
}
.home-menu-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  background: rgba(15, 23, 42, 0.86);
  color: #e0f2fe;
  font-size: 1.05rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 11, 20, 0.45);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}
.home-menu-btn:hover {
  border-color: rgba(56, 189, 248, 0.72);
  background: rgba(14, 116, 144, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.28);
}
.home-menu-btn:active {
  transform: scale(0.95);
}
.home-menu-btn.active {
  border-color: var(--cyan);
  background: rgba(14, 165, 233, 0.26);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.22);
}
.home-menu-glyph {
  line-height: 1;
  transition: transform 0.24s var(--ease-spring);
}
.home-menu-btn.active .home-menu-glyph {
  transform: rotate(90deg);
}
.home-menu-update-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  border: 1.5px solid #081222;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.85);
  animation: gasPulse 1.4s ease-in-out infinite;
}
@keyframes popoverDropIn {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.home-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 224px;
  padding: 6px;
  border-radius: 13px;
  background: linear-gradient(175deg, rgba(10, 22, 42, 0.98), rgba(5, 12, 24, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.38);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(186, 230, 253, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform-origin: top right;
  z-index: 100;
}
.home-menu-popover:not([hidden]) {
  animation: popoverDropIn 0.24s var(--ease-spring) both;
}
.home-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #e2e8f0;
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.14s ease;
}
.home-menu-item:hover {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(56, 189, 248, 0.34);
  color: #f8fafc;
}
.home-menu-item:active {
  transform: scale(0.98);
}
.home-menu-item.active {
  background: rgba(14, 116, 144, 0.28);
  border-color: rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}
.home-menu-chevron {
  font-size: 1rem;
  color: #7dd3fc;
  line-height: 1;
}
.home-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background: rgba(148, 163, 184, 0.18);
}
.home-menu-ver-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 4px 10px;
}
.home-menu-ver-lbl {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.lb-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.lb-nav-title {
  font-family: ui-monospace, monospace;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #7dd3fc;
}
.lb-back-btn {
  font-weight: 800;
}
.menu-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.75), rgba(45, 212, 191, 0.65), transparent);
  pointer-events: none;
  animation: causticSheen 6.5s ease-in-out infinite;
}

#screen-menu:not([hidden]) .menu-header {
  animation: sectionRise 0.38s var(--ease-buoyant) 0.04s both;
}
#screen-menu:not([hidden]) .menu-desc-wrap {
  animation: sectionRise 0.38s var(--ease-buoyant) 0.08s both;
}
#screen-menu:not([hidden]) .menu-tabs {
  animation: sectionRise 0.38s var(--ease-buoyant) 0.11s both;
}
#screen-menu:not([hidden]) .menu-name-row {
  animation: sectionRise 0.38s var(--ease-buoyant) 0.14s both;
}
#screen-menu:not([hidden]) .level-picker-block {
  animation: sectionRise 0.42s var(--ease-buoyant) 0.17s both;
}
#screen-menu:not([hidden]) #solo-panel {
  animation: sectionRise 0.42s var(--ease-buoyant) 0.21s both;
}

.menu-brand-icon {
  transition: transform 0.32s var(--ease-spring), box-shadow 0.32s ease;
}
.menu-brand:hover .menu-brand-icon {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.42);
}

/* Sliding liquid-glass pill on main menu tabs */
.menu-tabs {
  position: relative;
  --tab-index: 0;
}
.menu-tabs::before {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 6.5px);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.34), rgba(6, 182, 212, 0.22));
  border: 1px solid rgba(56, 189, 248, 0.58);
  box-shadow: 0 2px 14px rgba(14, 165, 233, 0.28), inset 0 1px 0 rgba(186, 230, 253, 0.2);
  transform: translateX(calc(var(--tab-index, 0) * (100% + 5px)));
  transition: transform 0.34s var(--ease-spring);
  pointer-events: none;
  z-index: 0;
}
.menu-tab {
  position: relative;
  z-index: 1;
  transition: color 0.22s ease, transform 0.16s var(--ease-buoyant);
}
.menu-tab:active:not(:disabled) {
  transform: scale(0.97);
}
.menu-tab.active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #f0f9ff;
}

/* Sliding pill on Site View switcher (Split / Map / List) */
.site-view-tabs {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  --view-index: 0;
}
.site-view-tabs::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 8px) / 3);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.34), rgba(2, 132, 199, 0.24));
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 1px 8px rgba(14, 165, 233, 0.22);
  transform: translateX(calc(var(--view-index, 0) * (100% + 2px)));
  transition: transform 0.3s var(--ease-spring);
  pointer-events: none;
  z-index: 0;
}
.site-view-btn {
  position: relative;
  z-index: 1;
  text-align: center;
  transition: color 0.2s ease, transform 0.14s ease;
}
.site-view-btn:hover {
  color: #e0f2fe;
}
.site-view-btn.active {
  background: transparent;
  color: #f0f9ff;
}

/* Sliding pill on Leaderboard mode switcher (Individual / Team) */
.lb-tabs {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  --lb-index: 0;
}
.lb-tabs::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 4px);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.32), rgba(2, 132, 199, 0.24));
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 1px 10px rgba(14, 165, 233, 0.22);
  transform: translateX(calc(var(--lb-index, 0) * (100% + 4px)));
  transition: transform 0.32s var(--ease-spring);
  pointer-events: none;
  z-index: 0;
}
.lb-tab {
  position: relative;
  z-index: 1;
  text-align: center;
  transition: color 0.2s ease;
}
.lb-tab:hover {
  color: #e0f2fe;
}
.lb-tab.active {
  background: transparent;
  color: #f0f9ff;
}

/* Directional buoyant panel glide when switching tabs */
@keyframes tabGlideFromRight {
  0% { opacity: 0; transform: translateX(16px) translateY(4px); }
  100% { opacity: 1; transform: translateX(0) translateY(0); }
}
@keyframes tabGlideFromLeft {
  0% { opacity: 0; transform: translateX(-16px) translateY(4px); }
  100% { opacity: 1; transform: translateX(0) translateY(0); }
}
.anim-glide-right {
  animation: tabGlideFromRight 0.3s var(--ease-buoyant) both !important;
}
.anim-glide-left {
  animation: tabGlideFromLeft 0.3s var(--ease-buoyant) both !important;
}

/* Site browser Split / Map / List transition */
@keyframes siteViewMorph {
  0% { opacity: 0.45; transform: scale(0.985) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.site-browser.anim-view-morph .site-map-panel,
.site-browser.anim-view-morph .level-cards {
  animation: siteViewMorph 0.28s var(--ease-buoyant) both;
}

/* Telemetry text swap when picking a new dive site */
@keyframes telemetrySwap {
  0% { opacity: 0.2; transform: translateY(6px); filter: brightness(1.35); }
  100% { opacity: 1; transform: translateY(0); filter: brightness(1); }
}
@keyframes badgeSonarFlash {
  0% { transform: scale(0.94); border-color: rgba(125, 211, 252, 0.95); box-shadow: 0 0 12px rgba(56, 189, 248, 0.55); }
  100% { transform: scale(1); border-color: rgba(56, 189, 248, 0.35); box-shadow: none; }
}
.anim-telemetry-swap {
  animation: telemetrySwap 0.32s var(--ease-buoyant) both;
}
.anim-badge-lock {
  animation: badgeSonarFlash 0.45s var(--ease-buoyant) both;
}

/* World map pin hover & expanding sonar ping ring on select */
.map-pin-btn circle {
  transition: transform 0.22s var(--ease-spring), filter 0.22s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.map-pin-btn:hover:not(.locked) circle {
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.9));
}
.map-pin-sonar {
  fill: none;
  stroke: rgba(125, 211, 252, 0.85);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: mapSonarRipple 0.78s var(--ease-buoyant) both;
  pointer-events: none;
}
@keyframes mapSonarRipple {
  0% { transform: scale(0.45); opacity: 0.95; }
  100% { transform: scale(2.6); opacity: 0; }
}
.site-map-zoom-btn {
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.16s var(--ease-spring);
}
.site-map-zoom-btn:hover {
  background: rgba(14, 116, 144, 0.45);
  transform: translateY(-1px);
}
.site-map-zoom-btn:active {
  transform: scale(0.95);
}

/* Level cards tactile hover lift & glowing active depth bar */
.level-card-btn {
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.22s ease, transform 0.22s var(--ease-buoyant), box-shadow 0.22s ease;
}
.level-card-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16%;
  bottom: 16%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #7dd3fc, #0ea5e9, #2dd4bf);
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.26s var(--ease-spring), opacity 0.2s ease;
}
.level-card-btn:hover:not(:disabled) {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px rgba(2, 11, 20, 0.48), 0 0 0 1px rgba(56, 189, 248, 0.22);
}
.level-card-btn:active:not(:disabled) {
  transform: scale(0.985);
}
.level-card-btn.active {
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.22), 0 0 0 1px rgba(56, 189, 248, 0.35);
}
.level-card-btn.active::before {
  transform: scaleY(1);
  opacity: 1;
}

/* Primary CTA bioluminescent sheen & tactile elevation */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.18s var(--ease-spring), opacity 0.18s ease, box-shadow 0.24s ease, border-color 0.2s ease, background 0.22s ease;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1.5px);
}
.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.975);
}
.btn.primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 55%, #0369a1 100%);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.3), inset 0 1px 0 rgba(224, 242, 254, 0.28);
}
.btn.primary::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -75%;
  width: 55%;
  background: linear-gradient(105deg, transparent 20%, rgba(224, 242, 254, 0.34) 50%, transparent 80%);
  transform: skewX(-18deg);
  transition: left 0.58s var(--ease-buoyant);
  pointer-events: none;
}
.btn.primary:hover:not(:disabled) {
  box-shadow: 0 10px 26px rgba(14, 165, 233, 0.45), inset 0 1px 0 rgba(224, 242, 254, 0.36);
}
.btn.primary:hover:not(:disabled)::after {
  left: 135%;
}
.btn.secondary:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.52);
  background: rgba(30, 41, 59, 1);
  box-shadow: 0 4px 14px rgba(2, 11, 20, 0.42);
}
.btn.ghost:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.45);
  color: #e0f2fe;
  background: rgba(14, 165, 233, 0.1);
}

/* Input focus glow & invalid callsign shake */
.menu-name-row input,
.lan-join-row input {
  transition: border-color 0.2s ease, box-shadow 0.24s ease, background 0.2s ease;
}
.menu-name-row input:focus,
.lan-join-row input:focus {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2), 0 0 14px rgba(56, 189, 248, 0.18);
  background: #0b1629;
}
@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.menu-name-row input.invalid,
.loader-callsign-gate input.invalid {
  animation: inputShake 0.36s ease both;
}

/* Co-op Room Box, Active Rooms, Status & Update Banner reveals */
@keyframes panelEmerge {
  0% { opacity: 0; transform: translateY(10px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.lan-room-box:not([hidden]),
.lan-rooms-section:not([hidden]),
.pwa-update-banner:not([hidden]),
.lan-status:not([hidden]) {
  animation: panelEmerge 0.32s var(--ease-buoyant) both;
}
.lan-roster li,
.lan-room-row {
  flex-shrink: 0;
  animation: rowWaterfall 0.28s var(--ease-buoyant) both;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s var(--ease-buoyant);
}
.lan-room-row:hover {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(14, 116, 144, 0.16);
  transform: translateX(2px);
}

/* Leaderboard waterfall rows & career summary pop-in */
@keyframes rowWaterfall {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.lb-row {
  animation: rowWaterfall 0.28s var(--ease-buoyant) calc(min(var(--row-i, 0), 8) * 28ms) both;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.2s var(--ease-buoyant), box-shadow 0.2s ease;
}
.lb-row:hover,
.lb-row:focus-visible {
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(2, 11, 20, 0.4);
}
.lb-chevron {
  transition: color 0.18s ease, transform 0.2s var(--ease-spring);
}
.lb-row:hover .lb-chevron {
  transform: translateX(3px);
}
.lb-career-summary:not([hidden]) .lb-career-cell {
  animation: rowWaterfall 0.3s var(--ease-buoyant) both;
}
.lb-career-summary:not([hidden]) .lb-career-cell:nth-child(2) { animation-delay: 40ms; }
.lb-career-summary:not([hidden]) .lb-career-cell:nth-child(3) { animation-delay: 80ms; }
.lb-career-summary:not([hidden]) .lb-career-cell:nth-child(4) { animation-delay: 120ms; }

/* Dive Stats Modal buoyant open & animated close */
@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalCardSurface {
  0% { opacity: 0; transform: translateY(18px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.lb-stats-modal:not([hidden]) {
  animation: modalBackdropIn 0.22s ease both;
}
.lb-stats-modal:not([hidden]) .lb-stats-card {
  animation: modalCardSurface 0.34s var(--ease-spring) both;
}
.lb-stats-modal.is-closing {
  opacity: 0;
  transition: opacity 0.19s ease;
  pointer-events: none;
}
.lb-stats-modal.is-closing .lb-stats-card {
  transform: translateY(12px) scale(0.95);
  opacity: 0;
  transition: transform 0.19s var(--ease-submerge), opacity 0.18s ease;
}

/* Pre-Dive Loader Card smooth buoyant rise & sonar shimmer */
.loader-screen {
  transition: opacity 0.4s var(--ease-buoyant), visibility 0.4s var(--ease-buoyant);
}
.loader-card {
  transform: translateY(0) scale(1);
  transition: transform 0.42s var(--ease-buoyant), opacity 0.36s ease;
}
.loader-screen.done .loader-card {
  transform: translateY(14px) scale(0.96);
  opacity: 0;
}
.loader-bar-fill {
  position: relative;
  overflow: hidden;
}
.loader-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: barSonarSweep 1.3s ease-in-out infinite;
}
@keyframes barSonarSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Contextual Shipwreck Action Pill (Cut Net / Open Watertight Hatch / Clip Shot Line) */
.wreck-action-btn {
  position: fixed;
  left: 50%;
  bottom: calc(max(134px, 21vh) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 36;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 196px;
  max-width: min(86vw, 320px);
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(56, 189, 248, 0.72);
  background: rgba(6, 20, 36, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e0f2fe;
  box-shadow: 0 8px 26px rgba(2, 11, 20, 0.62), 0 0 18px rgba(56, 189, 248, 0.28);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.wreck-action-btn[hidden] {
  display: none !important;
}
.wreck-action-btn:active {
  transform: translateX(-50%) scale(0.96);
}
.wreck-action-btn strong {
  position: relative;
  z-index: 1;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
}
.wreck-action-btn span#wreck-action-detail {
  position: relative;
  z-index: 1;
  font-size: 0.68rem;
  color: rgba(186, 230, 253, 0.85);
}
.wreck-action-progress {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.32), rgba(56, 189, 248, 0.52));
  transition: width 0.09s linear;
  pointer-events: none;
}
.wreck-action-btn.is-cut {
  border-color: rgba(248, 113, 113, 0.92);
  background: rgba(69, 10, 10, 0.9);
  color: #fee2e2;
  box-shadow: 0 8px 28px rgba(127, 29, 29, 0.55), 0 0 22px rgba(248, 113, 113, 0.45);
  animation: wreckPulseDanger 0.9s ease-in-out infinite;
}
.wreck-action-btn.is-hatch {
  border-color: rgba(251, 191, 36, 0.9);
  background: rgba(42, 26, 8, 0.9);
  color: #fef3c7;
  box-shadow: 0 8px 26px rgba(120, 53, 15, 0.5), 0 0 18px rgba(251, 191, 36, 0.32);
}
.wreck-action-btn.is-unclip {
  border-color: rgba(52, 211, 153, 0.85);
  background: rgba(6, 36, 28, 0.88);
  color: #d1fae5;
}
.wreck-action-btn.is-stage {
  border-color: rgba(52, 211, 153, 0.92);
  background: rgba(6, 42, 32, 0.92);
  color: #d1fae5;
  box-shadow: 0 8px 26px rgba(6, 95, 70, 0.52), 0 0 20px rgba(52, 211, 153, 0.36);
}
.wreck-action-btn.is-marker {
  border-color: rgba(250, 204, 21, 0.92);
  background: rgba(45, 34, 6, 0.92);
  color: #fef9c3;
  box-shadow: 0 8px 26px rgba(133, 77, 14, 0.5), 0 0 20px rgba(250, 204, 21, 0.34);
}
/* v102 Career Logbook, Mastery Grade Pills & Map Cleared Legend */
button.campaign-progress-pill {
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.14s ease;
}
button.campaign-progress-pill:hover {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 165, 233, 0.24);
  transform: translateY(-1px);
}
.legend-dot.cleared {
  background: transparent;
  border: 2px solid #34d399;
  box-shadow: 0 0 5px rgba(52, 211, 153, 0.6);
}
.lvl-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lvl-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.63rem;
  font-weight: 800;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.03em;
  border: 1px solid rgba(52, 211, 153, 0.5);
  background: rgba(6, 78, 59, 0.72);
  color: #a7f3d0;
}
.lvl-grade-badge.grade-s {
  border-color: rgba(250, 204, 21, 0.72);
  background: rgba(113, 63, 18, 0.78);
  color: #fef08a;
}
.lvl-grade-badge.grade-a {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(12, 74, 110, 0.78);
  color: #bae6fd;
}
.lvl-next-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(14, 165, 233, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: #7dd3fc;
}
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 116, 144, 0.28);
  color: #bae6fd;
}
button.mode-badge {
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}
button.mode-badge:hover {
  filter: brightness(1.16);
  transform: translateY(-1px);
}
.mode-badge.mode-guided {
  background: rgba(13, 148, 136, 0.28);
  border-color: rgba(45, 212, 191, 0.6);
  color: #99f6e4;
}
.mode-badge.mode-standard {
  background: rgba(14, 116, 144, 0.28);
  border-color: rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}
.mode-badge.mode-hardcore {
  background: rgba(153, 27, 27, 0.42);
  border-color: rgba(248, 113, 113, 0.72);
  color: #fecaca;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.24);
}
.mode-badge.compact {
  padding: 1px 5px;
  font-size: 0.55rem;
}
.hud-self-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
}
.hud-mode-badge {
  font-size: 0.6rem;
  padding: 2px 7px;
  background-color: rgba(6, 15, 29, 0.88);
}
.debrief-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.debrief-badge-row .debrief-badge {
  margin-bottom: 0;
}
.logbook-card {
  max-width: 680px;
  width: min(94vw, 680px);
  max-height: 86vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.logbook-card > * {
  flex-shrink: 0;
}
.logbook-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 540px) {
  .logbook-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.logbook-kpi {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 7px 6px;
  text-align: center;
}
.logbook-kpi span {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.logbook-kpi strong {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
  color: #e0f2fe;
  font-family: ui-monospace, monospace;
}
.logbook-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #7dd3fc;
  margin-top: 2px;
}
.logbook-certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 6px;
}
.logbook-cert-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(6, 78, 59, 0.32);
  border: 1px solid rgba(52, 211, 153, 0.45);
}
.logbook-cert-card.locked {
  background: rgba(15, 23, 42, 0.62);
  border-color: rgba(148, 163, 184, 0.2);
  opacity: 0.72;
}
.logbook-cert-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}
.logbook-cert-copy strong {
  display: block;
  font-size: 0.76rem;
  color: #f0f9ff;
}
.logbook-cert-copy span {
  display: block;
  font-size: 0.64rem;
  color: var(--text-muted);
}
.logbook-sites-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 2px;
}
.logbook-site-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  font-size: 0.74rem;
}
@media (max-width: 480px) {
  .logbook-site-row {
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    gap: 5px 6px;
    padding: 6px 7px;
  }
  .logbook-site-stat {
    grid-column: 2 / 4;
    font-size: 0.64rem;
    color: var(--text-muted);
  }
  .logbook-site-row .btn {
    grid-row: 1 / 3;
    grid-column: 4;
  }
}
.logbook-site-row.cleared {
  border-color: rgba(52, 211, 153, 0.34);
  background: rgba(6, 42, 34, 0.35);
}
.logbook-site-num {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: #7dd3fc;
  font-size: 0.7rem;
}
.logbook-site-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  color: #f1f5f9;
}
.logbook-site-stat {
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  color: #cbd5e1;
}
@keyframes wreckPulseDanger {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.045); }
}
@media (max-width: 600px) and (min-height: 461px) {
  .wreck-action-btn {
    bottom: max(118px, calc(env(safe-area-inset-bottom) + 112px));
    min-width: 146px;
    max-width: 184px;
    padding: 7px 12px;
  }
  .wreck-action-btn strong {
    font-size: 0.74rem;
  }
}
@media (max-height: 460px) and (orientation: landscape) {
  .wreck-action-btn {
    bottom: max(100px, calc(env(safe-area-inset-bottom) + 94px));
    min-width: 162px;
    padding: 6px 14px;
  }
}

/* Post-Dive Real Dive Computer Depth Profile Graph */
.debrief-profile-wrap {
  margin: 10px 0 8px;
  padding: 9px 11px 8px;
  border-radius: 11px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: linear-gradient(180deg, rgba(6, 18, 34, 0.9), rgba(3, 10, 20, 0.94));
}
.debrief-profile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.debrief-profile-title {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #7dd3fc;
}
.debrief-profile-legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.64rem;
  color: var(--text-muted);
}
.debrief-profile-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.prof-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.prof-dot.ean { background: #38bdf8; }
.prof-dot.tmx { background: #fbbf24; }
.prof-dot.o2 { background: #34d399; }
.debrief-profile-svg {
  display: block;
  width: 100%;
  height: 116px;
}

/* Technical Certification Badges Strip (Debrief + Career Logbook) */
.debrief-certs,
.lb-cert-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}
.cert-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid rgba(56, 189, 248, 0.34);
  background: rgba(14, 165, 233, 0.14);
  color: #e0f2fe;
}
.cert-pill.locked {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  color: rgba(148, 163, 184, 0.72);
  font-weight: 600;
}

/* First-Dive Quick Briefing Modal */
.dive-guide-card {
  max-width: 520px;
}
.dive-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.dive-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: rgba(15, 23, 42, 0.72);
}
.dive-guide-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.24);
  border: 1px solid rgba(56, 189, 248, 0.58);
  color: #7dd3fc;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.dive-guide-step strong {
  display: block;
  font-size: 0.84rem;
  color: #f8fafc;
  margin-bottom: 2px;
}
.dive-guide-step p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.42;
  color: #cbd5e1;
}
