/* BELOW 100M — instruments and dive slates. The ocean is painted on the canvas. */

:root {
  --ink: #02070c;
  --text: #d6e4e8;
  --dim: #7f969d;
  --line: rgba(214, 228, 232, 0.16);
  --slate: rgba(3, 11, 18, 0.9);
  --o2: #7cc4d4;
  --hp: #cf6c5c;
  --gold: #e0b35c;
  --warn: #e8a24a;
  --bad: #d9705e;
  --r-common: #b6c1c4;
  --r-uncommon: #8cc6a0;
  --r-rare: #d8b35c;
  --r-epic: #b48fd8;
  --r-legendary: #e6d6a0;
  --head: "Bahnschrift", "DIN Alternate", "Arial Narrow", "Roboto Condensed", "DejaVu Sans Condensed", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--head);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#sea {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  touch-action: none;
}

button { font: inherit; color: inherit; }
button:focus-visible { outline: 1px solid var(--o2); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

.gauge {
  position: absolute;
  font-family: var(--mono);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.g-label { font-size: 11px; letter-spacing: 0.22em; color: var(--dim); }
.g-big { font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.g-big small { font-size: 20px; margin-left: 2px; color: var(--dim); }
.g-mid { font-size: 24px; font-weight: 700; color: var(--gold); margin-top: 2px; }
.g-sub { font-size: 12px; letter-spacing: 0.16em; margin-top: 4px; }
.g-sub.dim { color: var(--dim); }
.g-num { width: 46px; text-align: right; font-size: 14px; font-weight: 700; }

.g-warn {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--warn);
  animation: warn-blink 1.6s ease-in-out infinite;
}

@keyframes warn-blink { 50% { opacity: 0.35; } }

.depth { top: 18px; left: 22px; }
.bars { bottom: 22px; left: 22px; display: flex; flex-direction: column; gap: 10px; }
.loot { top: 18px; right: 22px; text-align: right; }

.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .g-label { width: 62px; }

.bar {
  width: 190px;
  height: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(214, 228, 232, 0.2);
}

.bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--o2);
  transition: width 0.25s linear, background-color 0.4s;
}

.bar.health i { background: var(--hp); }
.bar i.low { background: var(--warn); }
.bar i.critical { background: var(--bad); animation: warn-blink 0.9s ease-in-out infinite; }

.hint {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--text);
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

.hint kbd {
  display: inline-block;
  min-width: 22px;
  margin-right: 8px;
  padding: 2px 6px;
  border: 1px solid rgba(214, 228, 232, 0.5);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.hint.full { color: var(--warn); }

/* touch controls only on coarse pointers */
.touch-btn {
  position: absolute;
  pointer-events: auto;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text);
  background: rgba(3, 11, 18, 0.6);
  border: 1px solid rgba(214, 228, 232, 0.35);
}

.t-collect { right: 26px; bottom: 120px; padding: 16px 18px; font-size: 14px; letter-spacing: 0.12em; }
.t-pause { right: 22px; top: 96px; width: 40px; height: 40px; display: none; }

@media (pointer: coarse) {
  .t-pause { display: block; }
  .keys { display: none; }
}

@media (pointer: fine) {
  .t-collect { display: none !important; }
}

/* ---------- screens ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(1, 5, 9, 0.2), rgba(1, 5, 9, 0.75));
}

.screen.active { display: flex; animation: fade-in 0.3s ease-out; }
.screen.top { z-index: 20; background: rgba(1, 5, 9, 0.6); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* a dive slate: a plain bordered board, not a floating card */
.slate {
  width: min(420px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 26px 28px 22px;
  background: var(--slate);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.slate.wide { width: min(680px, 100%); }

.menu-slate {
  background: transparent;
  border: 0;
  text-align: center;
}

.title {
  margin: 0;
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 300;
  white-space: nowrap;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  line-height: 1;
  color: #e6f0f2;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.tag {
  margin: 14px 0 30px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.4em;
  color: var(--dim);
}

h2 {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.24em;
}

h2.bad { color: var(--bad); }

.slate-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.slate-head h2 { margin: 0; }
.money { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--gold); }
.money.dim { color: var(--dim); font-size: 13px; font-weight: 400; letter-spacing: 0.1em; }

.stats {
  display: flex;
  justify-content: center;
  gap: 42px;
  margin: 26px 0 20px;
  font-family: var(--mono);
}

.stats > div > span, .sum-grid > div > span, .sum-total > span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--dim);
}

.stats b { font-size: 22px; }

.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

.btn {
  min-width: 130px;
  padding: 11px 18px;
  background: rgba(3, 11, 18, 0.55);
  border: 1px solid rgba(214, 228, 232, 0.32);
  border-radius: 2px;
  font-size: 15px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn:hover, .btn:focus-visible { background: var(--text); color: var(--ink); border-color: var(--text); outline: none; }
.btn.primary { border-color: var(--o2); color: #e8f6f9; background: rgba(40, 110, 128, 0.45); }
.btn.primary:hover, .btn.primary:focus-visible { background: var(--o2); color: var(--ink); }
.btn.danger { border-color: var(--bad); }
.btn.danger:hover, .btn.danger:focus-visible { background: var(--bad); border-color: var(--bad); color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: default; background: transparent; color: var(--dim); border-color: var(--line); }

.menu-slate > .btn.primary { min-width: 220px; padding: 14px 22px; font-size: 18px; }

.keys { margin: 22px 0 0; font-family: var(--mono); font-size: 12px; color: #5e7378; letter-spacing: 0.06em; }

.toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 12px 2px;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-align: left;
  cursor: pointer;
}

.toggle b { color: var(--o2); }
.toggle b.off { color: var(--dim); }
.toggle.danger { color: var(--bad); border-bottom: 1px solid var(--line); }
.toggle:hover, .toggle:focus-visible { color: #fff; outline: none; }

.note { margin: 14px 0 0; min-height: 1em; font-family: var(--mono); font-size: 12px; color: var(--dim); text-align: center; }
.note:empty { display: none; }
.confirm-text { margin: 0 0 6px; font-size: 17px; line-height: 1.5; text-align: center; }

/* ---------- shop ---------- */

.shop-list { border-top: 1px solid var(--line); }

.up {
  display: grid;
  grid-template-columns: 1fr 112px 150px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.up-name { font-size: 17px; letter-spacing: 0.14em; }
.up-lvl { margin-top: 3px; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.up-eff { margin-top: 3px; font-family: var(--mono); font-size: 13px; }
.up-eff i { font-style: normal; color: var(--dim); }
.up-cost { font-family: var(--mono); font-size: 15px; color: var(--gold); text-align: right; }
.up-cost.poor { color: var(--dim); }
.up .btn { min-width: 0; width: 100%; padding: 9px 6px; font-size: 13px; }
.up .btn:disabled { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; }

.pips { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: middle; }
.pips i { width: 9px; height: 4px; background: rgba(214, 228, 232, 0.15); }
.pips i.on { background: var(--o2); }

.stash {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px dashed rgba(224, 179, 92, 0.4);
  font-family: var(--mono);
  font-size: 13px;
}

.stash .btn { min-width: 0; padding: 7px 12px; font-size: 12px; }

/* ---------- collection ---------- */

.col-list { border-top: 1px solid var(--line); }
.col-group { padding: 12px 0 8px; border-bottom: 1px solid var(--line); }
.col-group h3 { margin: 0 0 8px; font-size: 12px; font-weight: 400; letter-spacing: 0.3em; }
.col-items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; font-family: var(--mono); font-size: 14px; }
.col-items div { display: flex; justify-content: space-between; gap: 8px; }
.col-items .unknown { color: #4f6368; }
.col-items em { font-style: normal; color: var(--dim); font-size: 12px; }
.col-disc p { margin: 6px 0 0; font-family: var(--mono); font-size: 13px; line-height: 1.5; color: var(--dim); }
.col-disc p b { color: var(--text); font-weight: 400; }

.rar-common { color: var(--r-common); }
.rar-uncommon { color: var(--r-uncommon); }
.rar-rare { color: var(--r-rare); }
.rar-epic { color: var(--r-epic); }
.rar-legendary { color: var(--r-legendary); }

/* ---------- summary ---------- */

.sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; font-family: var(--mono); }
.sum-grid.two { grid-template-columns: repeat(2, 1fr); }
.sum-grid b { font-size: 22px; }
.sum-grid b.yes { color: var(--gold); }

.sum-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 8px 0;
  max-height: 34vh;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 14px;
}

.sum-list li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 2px; }
.sum-list li span:last-child { color: var(--gold); }
.sum-list li.empty { justify-content: center; color: var(--dim); }

.sum-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; font-family: var(--mono); }
.sum-total b { font-size: 26px; color: var(--gold); }

@media (max-width: 640px) {
  .up { grid-template-columns: 1fr 120px; }
  .up-cost { display: none; }
  .sum-grid { grid-template-columns: repeat(2, 1fr); }
  .col-items { grid-template-columns: 1fr; }
  .bar { width: 120px; }
  .g-big { font-size: 34px; }
}

@media (max-height: 640px) {
  .slate { padding: 18px 20px; }
  .stats { margin: 16px 0 12px; }
  .tag { margin-bottom: 18px; }
}
