:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #061211;
  color: #e9fff5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body, #app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background:
    radial-gradient(circle at 50% 38%, rgba(50, 255, 186, .10), transparent 42%),
    #061211;
}

button { font: inherit; }
.hidden { display: none !important; }

.game-shell,
#fallback-canvas,
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#fallback-canvas,
#game-canvas {
  display: block;
  touch-action: none;
}

#game-canvas { opacity: 0; pointer-events: none; }
#app[data-renderer="gpu"] #game-canvas { opacity: 1; }
#app[data-renderer="gpu"] #fallback-canvas { opacity: 0; }

.screen-panel {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 28px max(30px, env(safe-area-inset-bottom));
  text-align: center;
  background: radial-gradient(circle at 50% 42%, rgba(34, 255, 176, .16), rgba(3, 11, 11, .93) 58%);
}

.game-panel { backdrop-filter: blur(8px); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  border: 1px solid rgba(130, 255, 216, .48);
  border-radius: 50%;
  color: #7fffd4;
  letter-spacing: .15em;
  box-shadow: 0 0 36px rgba(80, 255, 194, .22), inset 0 0 18px rgba(80, 255, 194, .12);
}

.eyebrow, .microcopy, .hud-label, .adaptive-trace, .renderer-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.eyebrow { margin: 0 0 10px; color: #72dcb9; }
h1, h2 { margin: 0; line-height: .91; letter-spacing: -.05em; }
h1 { font-size: clamp(52px, 15vw, 76px); }
h2 { font-size: 66px; }
.screen-panel > p:not(.eyebrow, .microcopy, .url) { max-width: 340px; color: #b4cfc5; line-height: 1.55; }
.url { color: #72dcb9; letter-spacing: .08em; }

.primary-button, .mode-button, .upgrade-card {
  border: 1px solid rgba(124, 255, 211, .34);
  color: #ecfff8;
  background: rgba(12, 38, 33, .88);
  box-shadow: inset 0 0 24px rgba(70, 255, 190, .06);
}

.primary-button {
  min-width: min(82vw, 340px);
  min-height: 58px;
  margin-top: 22px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .11em;
  background: linear-gradient(135deg, #24c98e, #15745d);
}

.mode-button {
  min-height: 42px;
  margin-top: 22px;
  padding: 0 20px;
  border-radius: 999px;
  color: #8fffd7;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .10em;
}

.microcopy { max-width: 340px; margin-top: 18px; color: #73958a; line-height: 1.6; }

.hud {
  position: absolute;
  z-index: 8;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  pointer-events: none;
}

.hud > div { display: flex; flex-direction: column; }
.hud > div:nth-child(2) { align-items: center; }
.hud > div:last-child { align-items: flex-end; }
.hud-label { color: #609e89; }
.hud strong { font-variant-numeric: tabular-nums; font-size: 18px; }

.meter {
  position: absolute;
  z-index: 8;
  top: max(67px, calc(env(safe-area-inset-top) + 53px));
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  pointer-events: none;
}

.meter i { display: block; width: 100%; height: 100%; transform-origin: left; }
.health { left: 16px; width: calc(58% - 20px); }
.resonance { right: 16px; width: calc(42% - 20px); }
.health i { background: linear-gradient(90deg, #ff6d79, #ffb36b); }
.resonance i { background: linear-gradient(90deg, #59bfff, #7effd3); }

.adaptive-trace {
  position: absolute;
  z-index: 8;
  top: max(80px, calc(env(safe-area-inset-top) + 66px));
  left: 16px;
  right: 16px;
  color: rgba(158, 255, 221, .62);
  text-align: center;
  pointer-events: none;
}

.upgrade-panel {
  position: absolute;
  z-index: 16;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 18px;
  background: rgba(2, 11, 10, .72);
  backdrop-filter: blur(7px);
}

.upgrade-panel .eyebrow { text-align: center; }
.upgrade-grid { display: grid; gap: 10px; }
.upgrade-card {
  min-height: 84px;
  padding: 14px 18px;
  border-radius: 18px;
  text-align: left;
}
.upgrade-card strong, .upgrade-card small { display: block; }
.upgrade-card strong { color: #9bffdd; letter-spacing: .08em; }
.upgrade-card small { margin-top: 7px; color: #a9c4ba; line-height: 1.35; }

.joystick {
  position: fixed;
  z-index: 12;
  width: 108px;
  height: 108px;
  margin: -54px 0 0 -54px;
  border: 1px solid rgba(137, 255, 218, .24);
  border-radius: 50%;
  background: rgba(18, 67, 55, .12);
  pointer-events: none;
}
.joystick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  margin: -21px;
  border-radius: 50%;
  background: rgba(101, 255, 205, .44);
  box-shadow: 0 0 28px rgba(69, 255, 190, .28);
  transform: translate(var(--stick-x, 0), var(--stick-y, 0));
}

.renderer-label {
  position: absolute;
  z-index: 8;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  color: rgba(148, 189, 175, .45);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .game-panel { backdrop-filter: none; }
  .joystick i { transition: none; }
}
