/* ---------------------------------------------------------------
   guppy one — reef explorer
   aqua water · frosted white HUD · navy ink
---------------------------------------------------------------- */

:root {
  --ink: #0c2a3a;
  --ink-soft: #3d5a68;
  --hair: rgba(12, 42, 58, 0.14);
  --frost: rgba(255, 255, 255, 0.74);
  --aqua: #1b7fa2;
  --sun: #ffd23f;
  --font-ui: "Instrument Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::selection { background: var(--aqua); color: #fff; }

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: #0e5c7a;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.dive {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.dive canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.noscript {
  position: absolute;
  inset: 40% 0 auto 0;
  text-align: center;
  font: 500 13px/1.5 var(--font-mono);
  color: #fff;
}

/* ---------- chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--frost);
  border: 1px solid var(--hair);
  border-radius: 12px;
  padding: 8px 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px -10px rgba(12, 42, 58, 0.35);
}

/* ---------- hud placement ---------- */

.hud { position: absolute; z-index: 5; display: flex; gap: 10px; }
.hud-tl { top: 18px; left: 18px; }
.hud-tr { top: 18px; right: 18px; flex-wrap: wrap; justify-content: flex-end; }
.hud-bl { bottom: 18px; left: 18px; flex-wrap: wrap; }
.hud-br { bottom: 18px; right: 18px; }

/* vessel chip */

.vessel strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.vessel .sub-label {
  display: block;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.vessel .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2fbf71;
  box-shadow: 0 0 0 3px rgba(47, 191, 113, 0.22);
}

/* buttons */

.chip-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.chip-btn:hover { background: #fff; transform: translateY(-1px); }
.chip-btn:active { transform: translateY(0); }

.chip-btn[aria-pressed="false"] { color: var(--ink-soft); }
.chip-btn[aria-pressed="false"] svg { opacity: 0.45; }

button:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

/* legend */

.legend {
  gap: 6px 14px;
  background: var(--frost);
  border: 1px solid var(--hair);
  border-radius: 12px;
  padding: 9px 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: min(62vw, 560px);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--hair);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 6px;
}

/* telemetry */

.tele { gap: 10px; padding: 8px 13px; }
.tele-k {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tele-v {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- intro card ---------- */

.intro {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.intro.gone { opacity: 0; transform: translateY(-12px); }

.intro-title {
  font-family: var(--font-mono);
  font-size: clamp(20px, 3.4vw, 30px);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(9, 58, 76, 0.5);
}

.intro-sub {
  font-size: clamp(13px, 1.6vw, 15.5px);
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 2px 18px rgba(9, 58, 76, 0.5);
}

/* ---------- touch controls ---------- */

.touch-ui { display: none; }

@media (pointer: coarse) {
  .touch-ui {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 7;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
  }

  .legend { display: none; }

  /* one compact bar, bottom-center, clear of joystick and buttons */
  .telemetry {
    position: absolute;
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    flex-direction: row;
    gap: 0;
    background: var(--frost);
    border: 1px solid var(--hair);
    border-radius: 12px;
    padding: 7px 6px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: calc(100vw - 190px);
  }

  .tele {
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    gap: 7px;
    padding: 2px 9px;
  }

  .tele-v { font-size: 12px; min-width: 0; }
  .tele-k { font-size: 9px; letter-spacing: 0.1em; }

  .joy {
    width: 114px;
    height: 114px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    position: relative;
    pointer-events: auto;
    touch-action: none;
    flex: none;
  }

  .joy-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--frost);
    border: 1px solid var(--hair);
    transform: translate(-50%, -50%);
    box-shadow: 0 6px 16px -6px rgba(12, 42, 58, 0.45);
  }

  .touch-btns {
    display: flex;
    gap: 10px;
    pointer-events: auto;
  }

  .tbtn {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    border: 1px solid var(--hair);
    background: var(--frost);
    color: var(--ink);
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.12s ease, background 0.12s ease;
  }

  .tbtn:active { transform: scale(0.92); background: #fff; }
  .tbtn:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
}

@media (max-width: 720px) {
  .vessel .sub-label { display: none; }
  .chip-btn { padding: 7px 11px; font-size: 12px; }
  .vessel { padding: 7px 12px; }
  .intro { padding-bottom: 100px; }
}

@media (max-width: 720px) and (pointer: fine) {
  .legend { display: flex; }
  .telemetry { flex-wrap: wrap; justify-content: flex-end; max-width: 44vw; }
}

@media (prefers-reduced-motion: reduce) {
  .intro { transition: none; }
  .chip-btn, .tbtn { transition: none; }
}
