/* Abyss Signal game UI */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #061c22; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #cfeeee;
  -webkit-user-select: none; user-select: none;
}
#scene { position: fixed; inset: 0; touch-action: none; }

#dmg-flash {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255,64,40,0.55) 100%);
  transition: opacity 0.15s;
}

#hud { position: fixed; top: 10px; left: 12px; right: 12px; pointer-events: none; }
.hud-row { display: flex; gap: 10px; flex-wrap: wrap; }
.hud-cell {
  background: rgba(6, 28, 34, 0.72);
  border: 1px solid rgba(84, 255, 200, 0.35);
  border-radius: 8px; padding: 6px 12px;
  display: flex; flex-direction: column; min-width: 74px;
}
.lbl { font-size: 10px; letter-spacing: 0.18em; color: #59d8c8; }
.hud-cell span:last-child { font-size: 19px; font-weight: 700; color: #eafff8; }

.bar-block { max-width: 340px; margin-top: 8px; }
.bar-label { display: flex; justify-content: space-between; font-size: 11px; letter-spacing: 0.14em; color: #59d8c8; margin-bottom: 3px; }
.bar { height: 9px; background: rgba(10, 40, 48, 0.8); border: 1px solid rgba(84,255,200,0.25); border-radius: 5px; overflow: hidden; margin-bottom: 6px; }
.fill { height: 100%; width: 100%; transition: width 0.15s; }
.fill.o2 { background: linear-gradient(90deg, #2fa8ff, #6fd8ff); }
.fill.o2.low { background: linear-gradient(90deg, #ff5533, #ffaa33); }
.fill.hull { background: linear-gradient(90deg, #36d6c0, #a4ffe4); }
.fill.hull.low { background: linear-gradient(90deg, #ff5533, #ffaa33); }
#hud-sonar.ready { color: #7dffd9; text-shadow: 0 0 8px rgba(125,255,217,0.6); }

#toast {
  margin-top: 10px; display: inline-block;
  background: rgba(8, 42, 50, 0.85); border: 1px solid rgba(84,255,200,0.4);
  color: #d8fff5; padding: 7px 14px; border-radius: 8px; font-size: 14px;
  opacity: 0; transform: translateY(-6px); transition: opacity 0.25s, transform 0.25s;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* Touch controls */
#touch-controls { position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 14px; pointer-events: none; }
.pad, .actions { pointer-events: auto; display: flex; flex-direction: column; gap: 8px; }
.pad-mid { display: flex; gap: 52px; justify-content: center; }
.actions { align-items: flex-end; }
.tbtn {
  min-width: 58px; padding: 14px 12px;
  background: rgba(10, 46, 54, 0.72);
  border: 1px solid rgba(84, 255, 200, 0.45); border-radius: 12px;
  color: #bffcf0; font-size: 14px; font-weight: 700; letter-spacing: 0.08em;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
.tbtn:active, .tbtn.tap-flash { background: rgba(54, 214, 192, 0.45); color: #fff; }
.tbtn.big { min-width: 96px; }
.tbtn.sonar { border-color: rgba(255, 180, 84, 0.6); color: #ffd9a0; }

/* Overlays */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(3, 14, 18, 0.72); backdrop-filter: blur(3px); }
.overlay.hidden { display: none; }
.panel {
  max-width: 560px; width: calc(100% - 32px);
  background: linear-gradient(160deg, rgba(10, 44, 52, 0.96), rgba(6, 24, 30, 0.96));
  border: 1px solid rgba(84, 255, 200, 0.4); border-radius: 16px;
  padding: 28px 30px; text-align: center;
  box-shadow: 0 0 60px rgba(54, 214, 192, 0.18);
}
.panel h1 { font-size: 30px; letter-spacing: 0.12em; color: #7dffd9; text-shadow: 0 0 18px rgba(125,255,217,0.5); margin-bottom: 10px; }
.panel h1.lose { color: #ff8c66; text-shadow: 0 0 18px rgba(255,140,102,0.5); }
.panel p { font-size: 15px; line-height: 1.55; color: #bfe8e2; margin-bottom: 14px; }
.howto { list-style: none; text-align: left; font-size: 13.5px; line-height: 1.9; color: #9fd6cf; margin-bottom: 18px; }
.howto b { color: #eafff8; }
.cta {
  display: inline-block; padding: 14px 40px; font-size: 17px; font-weight: 800; letter-spacing: 0.14em;
  color: #04262a; background: linear-gradient(90deg, #54ffc8, #2fa8ff);
  border: none; border-radius: 10px; cursor: pointer;
  box-shadow: 0 0 26px rgba(84, 255, 200, 0.45);
}
.cta:hover { filter: brightness(1.12); }
.ghost-link { display: block; margin-top: 14px; color: #59d8c8; font-size: 13px; }

@media (max-width: 640px) {
  .hud-cell { min-width: 60px; padding: 4px 8px; }
  .hud-cell span:last-child { font-size: 15px; }
  .panel h1 { font-size: 23px; }
  .panel { padding: 20px 16px; }
  .howto { font-size: 12px; }
  .pad-mid { gap: 46px; }
}
