:root{
  --deep:#052129; --pearl:#f6f5f3; --sand:#e6c88f; --teal:#1aa5a1; --mint:#60eac2;
}

html,body{height:100%;margin:0;background:var(--deep);color:var(--pearl);font-family:ui-sans-serif,system-ui,Segoe UI,Roboto,Arial;overflow:hidden}
#bg{position:fixed;inset:0;display:block;z-index:0}
#ui{position:fixed;inset:0;pointer-events:none;z-index:10}
.hidden{display:none}

/* Cards / panels */
.panel.card{
  pointer-events:all;width:min(860px,92vw);padding:28px 24px;position:absolute;left:50%;top:50%;
  transform:translate(-50%,-50%);text-align:center;border-radius:28px;
  background:linear-gradient(180deg,rgba(255,255,255,.10),rgba(255,255,255,.04));
  border:1px solid rgba(255,255,255,.28);box-shadow:0 18px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.15)
}
.panel h1{margin:0 0 6px;font-size:56px;color:var(--sand)}
.panel h2{margin:0 0 12px;font-size:32px}
.pill{padding:12px 18px;border-radius:999px;border:0;background:linear-gradient(135deg,var(--mint),var(--teal));color:#052129;font-weight:900;cursor:pointer;box-shadow:0 8px 24px rgba(0,0,0,.3)}
.pill.big{padding:16px 26px;font-size:18px}
.ghost{padding:10px 16px;border-radius:999px;border:1px dashed rgba(255,255,255,.45);background:rgba(255,255,255,.06);color:#fff;cursor:pointer}

/* HUD */
.bubblebar{position:absolute;left:16px;right:16px;top:16px;padding:12px 16px;display:flex;gap:16px;justify-content:space-between;align-items:center;pointer-events:none;background:rgba(73,153,190,.45);border:1px solid rgba(255,255,255,.18);border-radius:16px;box-shadow:0 10px 30px rgba(0,0,0,.3)}
#crosshair{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:20px;opacity:.3;pointer-events:none}
#o2bar{position:relative;width:260px;height:16px;border-radius:999px;background:rgba(255,255,255,.12);margin-top:6px;border:1px solid rgba(255,255,255,.25);overflow:hidden}
#o2fill{position:absolute;left:0;top:0;bottom:0;width:100%;display:block;background:linear-gradient(90deg,var(--mint),var(--teal));border-radius:999px;box-shadow:0 0 12px rgba(41,221,180,.55) inset}
.chip{position:absolute;right:18px;bottom:18px;background:rgba(10,44,51,.8);border:1px solid rgba(96,234,194,.35);border-radius:14px;padding:10px 14px;pointer-events:none;box-shadow:0 10px 28px rgba(0,0,0,.35)}

/* Radar */
#radarWrap{
  position:absolute; right:18px; bottom:94px; width:180px; height:180px;
  pointer-events:none; z-index:7; background:rgba(10,44,51,.82);
  border:1px solid rgba(96,234,194,.35); border-radius:14px; box-shadow:0 10px 28px rgba(0,0,0,.35);
}
#radar{ width:100%; height:100%; display:block; }
#legend{
  position:absolute; right:18px; bottom:280px; z-index:7; font-size:12px; opacity:.8;
  background:rgba(10,44,51,.7); border:1px solid rgba(96,234,194,.25);
  padding:6px 8px; border-radius:10px; pointer-events:none;
}
#legend b{ display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; transform:translateY(1px) }
#legend .boat{ background:#ffe28a }
#legend .island{ background:#fff }
#legend .pearl{ background:#b5f5ff }

/* Underwater fade */
#fade{position:fixed;inset:0;background:#000;opacity:0;transition:opacity .6s ease;pointer-events:none;z-index:9}
#fade.show{opacity:1}

/* ---------- Mobile touch controls ---------- */
body.mobile #touchUI{ display:none; }                /* hidden by default on mobile */
body.mobile #touchUI:not(.hidden){ display:block; }  /* only when gameplay starts */

#touchUI{position:fixed;inset:0;z-index:20;pointer-events:none}
.joy{
  position:fixed; width:140px; height:140px; border-radius:50%;
  border:2px solid rgba(255,255,255,.28); background:rgba(255,255,255,.06);
  backdrop-filter: blur(4px); pointer-events:auto; box-shadow:0 10px 28px rgba(0,0,0,.35)
}
#joyL{left:18px;bottom:18px}
#joyR{right:18px;bottom:18px}
.joy .knob{
  position:absolute; width:64px; height:64px; border-radius:50%;
  left:50%; top:50%; transform:translate(-50%,-50%);
  background:linear-gradient(135deg,var(--mint),var(--teal));
  box-shadow:0 6px 20px rgba(0,0,0,.35), inset 0 1px rgba(255,255,255,.25)
}
.tbuttons{position:fixed;right:18px;bottom:178px;display:flex;gap:10px;flex-direction:column;pointer-events:auto}
.tbuttons button{
  width:54px;height:54px;border-radius:999px;border:0;font-weight:800;color:#052129;
  background:linear-gradient(135deg,var(--mint),var(--teal)); box-shadow:0 8px 24px rgba(0,0,0,.3)
}
@media (max-width:420px){
  .joy{width:120px;height:120px}
  .joy .knob{width:56px;height:56px}
  .tbuttons button{width:50px;height:50px}
}

/* --- Prevent mobile pinch/double-tap zoom in the game layer --- */
html, body {
  touch-action: none;               /* disable browser gestures */
  overscroll-behavior: none;        /* no pull-to-refresh */
  -webkit-user-select: none;        /* iOS selection off */
}

#bg,
#touchUI,
#touchUI * ,
.joy,
.tbuttons,
.tbuttons button {
  touch-action: none;               /* no pinch/pan on controls */
  -ms-touch-action: none;
}

/* Allow fast tap without zoom on the round buttons */
.tbuttons button { touch-action: manipulation; }
