/* style.css - Lumen Trench: landing + game styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #031019;
  color: #cfeef7;
  overflow-x: hidden;
}
:root {
  --ice: #9fe8ff; --teal: #3fd0ff; --deep: #071b28; --panel: rgba(8, 32, 48, 0.82);
  --glow: rgba(63, 208, 255, 0.35); --mag: #ff4fd0; --lime: #a8ff5f; --amber: #f2a03c;
}
a { color: var(--teal); }

/* ---------- landing page ---------- */
#hero {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem 1rem; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 10%, #0a3a52 0%, #051a28 55%, #020d15 100%);
}
#hero-preview {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block;
}
.hero-inner { position: relative; z-index: 1; max-width: 720px; }
h1.game-title {
  font-size: clamp(2.6rem, 9vw, 5.2rem); letter-spacing: 0.12em; font-weight: 800;
  color: #eaffff; text-shadow: 0 0 24px var(--glow), 0 0 80px rgba(63,208,255,0.25);
}
.tagline { margin-top: 0.6rem; font-size: clamp(1rem, 3vw, 1.35rem); color: #8fd4e8; letter-spacing: 0.08em; }
.cta-row { margin-top: 2rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
#play-now {
  display: inline-block; padding: 0.9rem 2.6rem; border-radius: 999px;
  background: linear-gradient(135deg, #3fd0ff, #1f8fd8);
  color: #03222e; font-weight: 800; letter-spacing: 0.12em; text-decoration: none;
  box-shadow: 0 0 30px var(--glow), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#play-now:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 48px var(--glow); }
.ghost-link {
  display: inline-block; padding: 0.9rem 1.6rem; border-radius: 999px;
  border: 1px solid rgba(159, 232, 255, 0.35); color: var(--ice); text-decoration: none;
}
section { max-width: 1060px; margin: 0 auto; padding: 4rem 1.2rem; }
h2 { font-size: clamp(1.4rem, 4vw, 2.1rem); letter-spacing: 0.14em; color: var(--ice); margin-bottom: 1.4rem; }
h2::after { content: ""; display: block; width: 64px; height: 3px; margin-top: 0.5rem;
  background: linear-gradient(90deg, var(--teal), transparent); }
#features { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
#features li {
  background: var(--panel); border: 1px solid rgba(63,208,255,0.18); border-radius: 14px;
  padding: 1rem 1.1rem; line-height: 1.45; font-size: 0.95rem;
}
#features b { color: var(--teal); display: block; letter-spacing: 0.06em; margin-bottom: 0.35rem; }
#gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem;
}
#gallery img {
  width: 100%; border-radius: 14px; border: 1px solid rgba(63,208,255,0.22);
  box-shadow: 0 8px 30px rgba(0,0,0,0.45); display: block; aspect-ratio: 16/10; object-fit: cover;
}
#controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.key-block { background: var(--panel); border-radius: 14px; padding: 1rem; border: 1px solid rgba(63,208,255,0.18); }
.key-block b { color: var(--amber); }
kbd {
  display: inline-block; min-width: 2.2rem; text-align: center; padding: 0.25rem 0.5rem;
  background: #0b2a3a; border: 1px solid #2a5a70; border-bottom-width: 3px; border-radius: 7px;
  font-family: inherit; font-size: 0.85rem; color: #eaffff; margin: 0.15rem 0.15rem 0.15rem 0;
}
footer { text-align: center; padding: 2.5rem 1rem 3rem; color: #5f8fa3; font-size: 0.85rem; }

/* ---------- game page ---------- */
body.game-page { overflow: hidden; height: 100%; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }
#flash {
  position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: 0;
  background: radial-gradient(70% 70% at 50% 50%, transparent 40%, rgba(255, 60, 40, 0.55) 100%);
  transition: opacity 0.25s ease;
}
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud-top {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
}
.meter { display: flex; align-items: center; gap: 8px; }
.label { font-size: 0.7rem; letter-spacing: 0.18em; color: #8fd4e8; }
.bar {
  width: clamp(70px, 16vw, 150px); height: 10px; border-radius: 6px;
  background: rgba(4, 22, 32, 0.75); border: 1px solid rgba(159,232,255,0.3); overflow: hidden;
}
#bar-hull { height: 100%; width: 100%; background: linear-gradient(90deg, #ff6a3d, #ffd23d, #7dffb0); transition: width 0.25s; }
#bar-o2 { height: 100%; width: 100%; background: linear-gradient(90deg, #ff4fd0, #3fd0ff); transition: width 0.25s; }
#hud-stats { display: flex; gap: 16px; margin-left: auto; font-size: 1rem; }
#hud-stats span { margin-left: 6px; }
#hud-time { color: #eaffff; }
#hud-time.low { color: #ff4fd0; animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
#hud-msg {
  position: absolute; top: 15%; left: 50%; transform: translateX(-50%);
  font-size: clamp(0.95rem, 2.6vw, 1.3rem); letter-spacing: 0.06em; text-align: center;
  padding: 0.6rem 1.2rem; border-radius: 12px; background: var(--panel);
  border: 1px solid rgba(63,208,255,0.35); color: #eaffff;
  opacity: 0; transition: opacity 0.35s; max-width: 92vw;
}
#hud-msg.show { opacity: 1; }
#compass-wrap { position: absolute; top: 78px; left: 50%; transform: translateX(-50%); }
#compass {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(4, 22, 32, 0.65); border: 1px solid rgba(159,232,255,0.4);
  display: flex; align-items: center; justify-content: center; position: relative;
}
#compass-arrow {
  width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent;
  border-bottom: 16px solid var(--teal); transform-origin: 50% 120%; margin-top: -10px;
  filter: drop-shadow(0 0 6px var(--glow));
}
/* overlays */
#start, #end {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(2, 12, 19, 0.55); backdrop-filter: blur(3px);
}
.panel {
  max-width: 560px; width: min(92vw, 560px); text-align: center;
  background: var(--panel); border: 1px solid rgba(63,208,255,0.35); border-radius: 18px;
  padding: 1.6rem 1.4rem; box-shadow: 0 0 60px rgba(0,0,0,0.6);
}
.panel h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); letter-spacing: 0.14em; color: #eaffff; text-shadow: 0 0 24px var(--glow); }
.panel h2 { font-size: clamp(1.3rem, 5vw, 1.9rem); margin-bottom: 0.8rem; }
#end-title.won { color: #7dffb0; } #end-title.lost { color: #ff6a5f; }
.panel .tag { color: #8fd4e8; margin: 0.6rem 0 1rem; }
.panel ul { list-style: none; text-align: left; margin: 0.4rem auto 1rem; max-width: 420px; }
.panel ul.how li { font-size: 0.9rem; margin: 0.45rem 0; line-height: 1.4; }
.panel ul.how li::before { content: "◈ "; color: var(--teal); }
.panel ul.keys li { font-size: 0.85rem; color: #8fd4e8; margin: 0.3rem 0; }
.panel button, #end button {
  pointer-events: auto; cursor: pointer; border: 0; border-radius: 999px;
  padding: 0.85rem 2.4rem; font-weight: 800; letter-spacing: 0.12em; font-size: 1rem;
  background: linear-gradient(135deg, #3fd0ff, #1f8fd8); color: #03222e;
  box-shadow: 0 0 30px var(--glow);
}
.hidden { display: none !important; }
/* touch controls */
#touch-controls {
  position: fixed; inset: auto 0 0 0; z-index: 15; display: flex;
  justify-content: space-between; padding: 0.8rem; pointer-events: none;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.tc-left, .tc-right { pointer-events: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; max-width: 46vw; }
.tc-right { justify-content: flex-end; }
.tc {
  pointer-events: auto; min-width: 58px; padding: 0.85rem 0.7rem; border-radius: 14px;
  background: rgba(10, 44, 64, 0.78); border: 1px solid rgba(159,232,255,0.6); text-shadow: 0 0 6px rgba(159,232,255,0.6);
  color: #eaffff; font-size: 0.85rem; letter-spacing: 0.06em; touch-action: none;
}
.tc.big { background: rgba(63, 208, 255, 0.25); }
.tc:active { background: rgba(63, 208, 255, 0.5); }
@media (hover: hover) and (pointer: fine) {
  #touch-controls { opacity: 0.45; }
  #touch-controls:hover { opacity: 1; }
}
@media (max-width: 640px) {
  #hud-stats { font-size: 0.85rem; gap: 10px; }
  .bar { width: 70px; }
  #compass-wrap { top: 64px; }
}
