* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; background: #041c26;
  font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif; color: #dceff5; }
#scene, #scene canvas { position: fixed; inset: 0; }
#hud { position: fixed; inset: 0; pointer-events: none; padding: 12px;
  display: flex; flex-direction: column; }
.hud-top { display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  background: rgba(3, 22, 30, 0.55); border: 1px solid rgba(53, 240, 255, 0.25);
  border-radius: 10px; padding: 8px 12px; width: fit-content; }
.gauge { display: flex; align-items: center; gap: 8px; }
.lbl { font-size: 10px; letter-spacing: 0.14em; color: #6fd8e8; }
.bar { width: 110px; height: 10px; background: rgba(255,255,255,0.12);
  border-radius: 5px; overflow: hidden; }
.bar.slim { width: 90px; height: 6px; }
#bar-oxygen { height: 100%; width: 100%; background: linear-gradient(90deg, #35f0ff, #7de8ff);
  border-radius: 5px; transition: width 0.25s; }
#bar-hull { height: 100%; width: 100%; background: linear-gradient(90deg, #7ee787, #b6f36b);
  border-radius: 5px; transition: width 0.25s; }
#bar-scan { height: 100%; width: 100%; background: #35f0ff; border-radius: 3px; }
.bar .low { }
#bar-oxygen.low { background: #ff5d5d; }
#bar-hull.low { background: #ff8a3d; }
.stat { font-size: 12px; color: #9fc4cf; letter-spacing: 0.08em; }
.stat b { color: #ffe9c4; font-size: 15px; margin-left: 4px; }
.scan-wrap { margin-top: 8px; display: flex; align-items: center; gap: 8px;
  background: rgba(3,22,30,0.55); border: 1px solid rgba(53,240,255,0.25);
  border-radius: 10px; padding: 6px 12px; width: fit-content; }
#hud-msg { margin-top: 10px; align-self: center; font-size: 18px; letter-spacing: 0.1em;
  color: #9effd8; text-shadow: 0 0 14px rgba(29,227,178,0.7); }

#touch-pad { position: fixed; inset: auto 0 0 0; display: none; }
#touch-pad.show { display: flex; justify-content: space-between; }
.tpad { display: flex; gap: 8px; padding: 10px; }
.tpad button { width: 62px; height: 52px; border-radius: 12px; border: 1px solid rgba(111,216,232,0.4);
  background: rgba(6,35,46,0.65); color: #cfeef5; font-size: 20px; touch-action: none;
  user-select: none; -webkit-user-select: none; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; pointer-events: auto; }
.tpad button i { font-style: normal; font-size: 9px; letter-spacing: 0.1em; color: #6fd8e8; }
.tpad button.on { background: rgba(53,240,255,0.35); }

#overlay { position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; background: radial-gradient(ellipse at 50% 30%,
  rgba(8,44,60,0.88), rgba(2,12,18,0.96)); z-index: 10; }
#overlay.hidden { display: none; }
#ov-start, #ov-end { max-width: 620px; margin: 16px; padding: 28px 32px;
  background: rgba(4,26,36,0.85); border: 1px solid rgba(53,240,255,0.3);
  border-radius: 16px; text-align: center; }
#ov-start h1, #ov-end h1 { font-size: 44px; letter-spacing: 0.32em; color: #e8f6fa;
  text-shadow: 0 0 24px rgba(53,240,255,0.5); margin-bottom: 4px; }
#ov-end h1.win { color: #9effd8; } #ov-end h1.lose { color: #ff7a6b; }
.tag { color: #6fd8e8; letter-spacing: 0.18em; font-size: 12px; margin-bottom: 16px; }
.howto { font-size: 14px; line-height: 1.6; color: #b9d4dd; margin-bottom: 14px; }
.keys { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-bottom: 18px; }
.keys li { font-size: 12px; color: #9fc4cf; background: rgba(53,240,255,0.08);
  border: 1px solid rgba(53,240,255,0.2); padding: 6px 10px; border-radius: 8px; }
kbd { background: #10404f; border: 1px solid #35f0ff66; border-bottom-width: 2px;
  border-radius: 4px; padding: 2px 6px; font-size: 11px; color: #d8f6ff; }
.cta { font-size: 18px; letter-spacing: 0.14em; padding: 12px 38px; border-radius: 10px;
  border: none; cursor: pointer; color: #03222e; font-weight: 700;
  background: linear-gradient(120deg, #35f0ff, #9effd8);
  box-shadow: 0 0 26px rgba(53,240,255,0.45); }
.cta:hover { filter: brightness(1.12); }
#end-sub { margin-bottom: 18px; color: #b9d4dd; }
@media (max-width: 480px) {
  #ov-start h1, #ov-end h1 { font-size: 30px; }
  .bar { width: 74px; }
}
.compass-wrap { margin-top: 8px; display: flex; align-items: center; gap: 10px;
  background: rgba(3,22,30,0.55); border: 1px solid rgba(53,240,255,0.25);
  border-radius: 10px; padding: 6px 12px; width: fit-content; }
.compass { width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(53,240,255,0.4); display: flex; align-items: center;
  justify-content: center; }
#hud-dir { font-size: 20px; color: #ffb347; text-shadow: 0 0 10px rgba(255,179,71,0.8);
  transition: transform 0.15s linear; }
#hud-dir.vent { color: #1de3b2; text-shadow: 0 0 10px rgba(29,227,178,0.9); }
#hud-dist { font-size: 12px; color: #9fc4cf; letter-spacing: 0.1em; }

#flash { position: fixed; inset: 0; opacity: 0; pointer-events: none; z-index: 5;
  transition: opacity 0.5s ease-out;
  background: radial-gradient(ellipse at center, rgba(255,40,20,0) 45%,
  rgba(255,60,30,0.55) 100%); }
