/* UNDERTOW - deep dark; cyan for what might be worth something, gold for what is banked. */
:root {
  --bg: #04070e; --panel: #0a1120; --panel-2: #0f172a;
  --stroke: rgba(255,255,255,0.09); --ink: #eaf1fb; --dim: #8b98b0; --faint: #4e5b74;
  --cyan: #57d7ff; --gold: #ffc23e; --danger: #ff5d6e; --green: #4ade80;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-user-select: none; user-select: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
small { font-size: 11px; letter-spacing: .08em; color: var(--dim); }
.dim { color: var(--dim); } .tiny { font-size: 12px; } .eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); min-height: 14px; }

/* ---- HUD ---- */
#top { position: fixed; left: 0; right: 0; top: 0; padding: calc(10px + var(--sat)) 14px 0; pointer-events: none; display: flex; flex-direction: column; gap: 8px; }
#topline { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--dim);
  background: rgba(4,7,14,.72); border: 1px solid var(--stroke); border-radius: 12px; padding: 7px 12px; backdrop-filter: blur(6px); }
#topline .want b { font-weight: 700; } #topline .want i { font-style: normal; color: var(--ink); font-variant-numeric: tabular-nums; }
#topline .crowd { color: var(--cyan); }
#gauges { display: flex; gap: 10px; }
.gauge { flex: 1; display: flex; align-items: center; gap: 8px; }
.gauge span { font-size: 10px; letter-spacing: .12em; color: var(--dim); width: 34px; }
.gauge .track { flex: 1; height: 6px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.gauge .track i { display: block; height: 100%; background: var(--cyan); border-radius: 4px; transition: width .12s linear; }
#hull .track i { background: var(--gold); }
.gauge.low .track i { background: var(--danger); animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }

#mid { text-align: center; pointer-events: none; margin-top: 4px; }
#depthBox b { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; display: block; line-height: 1; text-shadow: 0 2px 12px rgba(0,0,0,.8); }
#depthBox small { display: block; margin-top: 2px; }
#zoneName { margin-top: 6px; font-size: 11px; letter-spacing: .18em; color: var(--gold); }
#zoneName.bad { color: var(--danger); animation: blink .5s steps(2) infinite; }

#feed { position: fixed; right: 14px; bottom: calc(118px + var(--sab)); text-align: right; pointer-events: none; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
#feed .line { font-size: 13px; font-weight: 600; background: rgba(4,7,14,.7); border-radius: 8px; padding: 3px 9px; color: var(--ink); transition: opacity .4s, transform .4s; }
#feed .line.out { opacity: 0; transform: translateX(10px); }
#feed .cy { color: var(--cyan); } #feed .dim { color: var(--dim); } #feed .bad { color: var(--danger); } #feed .gold { color: var(--gold); }
#feed .cat-metal { color: #9fb4d4; } #feed .cat-organic { color: #6ee7a8; } #feed .cat-mineral { color: #7cc4ff; } #feed .cat-relic { color: #ffc23e; } #feed .cat-living { color: #ff9ecb; } #feed .cat-anomaly { color: #b18cff; }

#toast { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  background: rgba(4,7,14,.75); border: 1px solid var(--stroke); border-radius: 12px; padding: 9px 16px; pointer-events: none; transition: opacity .5s; }
#toast.out { opacity: 0; }
#hint { position: fixed; left: 50%; bottom: calc(118px + var(--sab)); transform: translateX(-50%); max-width: 320px; width: calc(100% - 40px); text-align: center; font-size: 14px; color: var(--dim);
  background: rgba(4,7,14,.82); border: 1px solid var(--stroke); border-radius: 14px; padding: 10px 14px; }
#hint b { color: var(--ink); }

#bottom { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(14px + var(--sab)); display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: end; pointer-events: none; }
#bottom > * { pointer-events: auto; }
#hold { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(4,7,14,.72); border: 1px solid var(--stroke); border-radius: 12px; padding: 9px 12px; width: max-content; }
#hold small { display: block; font-weight: 500; }
.btn { appearance: none; font: inherit; font-weight: 700; color: var(--ink); background: var(--panel-2); border: 1px solid var(--stroke); border-radius: 14px; padding: 12px 18px; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sweep { background: var(--cyan); color: #04212c; border-color: var(--cyan); font-size: 18px; letter-spacing: .06em; padding: 16px 26px; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 128px; box-shadow: 0 0 24px rgba(87,215,255,.35); }
.btn.sweep.empty { background: #163b4a; color: #6fb7cc; box-shadow: none; }
#pips { display: flex; gap: 4px; } #pips i { width: 9px; height: 5px; border-radius: 2px; background: rgba(4,33,44,.35); } #pips i.on { background: #04212c; }
.btn.sweep.empty #pips i.on { background: #6fb7cc; }
.btn.surface { background: var(--gold); color: #2a1d00; border-color: var(--gold); font-size: 15px; padding: 16px 18px; }
.btn.surface.urgent { animation: pulse .7s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 26px rgba(255,194,62,.6); } }
.btn.primary { background: var(--gold); color: #2a1d00; border-color: var(--gold); font-size: 17px; flex: 1; }
.btn.on { border-color: var(--cyan); color: var(--cyan); }
.btn.sm { padding: 7px 12px; font-size: 14px; } .btn.sm.can { border-color: var(--gold); color: var(--gold); }
.lnk { background: none; border: 0; color: var(--dim); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }

/* ---- the surface sheet ---- */
#sheet { position: fixed; inset: 0; background: rgba(2,5,12,.82); backdrop-filter: blur(8px); overflow-y: auto; z-index: 5; padding: calc(16px + var(--sat)) 12px calc(20px + var(--sab)); }
.sh-wrap { max-width: 520px; margin: 0 auto; background: var(--panel); border: 1px solid var(--stroke); border-radius: 22px; padding: 20px 18px; }
#sheet.dead .sh-wrap { border-color: rgba(255,93,110,.45); }
.sh-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sh-top h1 { font-size: 24px; letter-spacing: -.02em; line-height: 1.1; margin-top: 2px; }
#sheet.dead h1 { color: var(--danger); }
.purse { text-align: right; white-space: nowrap; } .purse b { display: block; font-size: 18px; color: var(--gold); }
#haul { margin-top: 14px; display: grid; gap: 4px; }
.hl { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; font-size: 14px; padding: 5px 0; border-bottom: 1px solid var(--stroke); }
.hl .g { font-size: 15px; } .hl .n small { color: var(--dim); font-size: 12px; } .hl .m { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.hl .v { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; } .hl.husk .v { color: var(--dim); }
.hl .v s { color: var(--danger); }
.total { text-align: right; font-size: 30px; font-weight: 800; color: var(--gold); margin: 8px 0 4px; letter-spacing: -.02em; }
.total .lost { color: var(--danger); }
.water { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; margin-top: 14px; padding: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--stroke); border-radius: 16px; }
.water canvas { width: 120px; height: 120px; border-radius: 50%; border: 1px solid var(--stroke); }
.water p { margin-top: 4px; font-size: 14px; }
.sh-actions { display: flex; gap: 8px; margin-top: 16px; }
#rigBox { margin-top: 12px; } #rig { display: grid; gap: 8px; }
.rg { background: rgba(255,255,255,.03); border: 1px solid var(--stroke); border-radius: 14px; padding: 10px 12px; }
.rg-h { display: flex; gap: 8px; align-items: baseline; } .rg-g { color: var(--cyan); } .rg-l { margin-left: auto; color: var(--dim); font-size: 12px; }
.rg-line { font-size: 13px; color: var(--dim); margin: 3px 0 8px; }
.rg-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rg-v { font-weight: 700; font-variant-numeric: tabular-nums; } .rg-v i { font-style: normal; color: var(--green); font-weight: 600; }
.rg-max { color: var(--dim); font-size: 13px; }
.rg-depth { font-size: 13px; color: var(--dim); padding: 4px 2px; }
#boardBox { margin-top: 12px; } #boardBox .rb { max-width: none; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; font-size: 13px; color: var(--dim); }
.stats b { color: var(--ink); }
.sh-foot { display: flex; gap: 14px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.sh-foot .tiny { margin-left: auto; }
@media (max-width: 420px) { .btn.sweep { min-width: 110px; padding: 14px 18px; } .water { grid-template-columns: 96px 1fr; } .water canvas { width: 96px; height: 96px; } }
