* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(77, 67, 154, 0.28), transparent 30%),
    radial-gradient(circle at bottom right, rgba(215, 143, 72, 0.18), transparent 24%),
    linear-gradient(180deg, #090814 0%, #05050c 100%);
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

code {
  font-family: inherit;
}

.shell {
  width: 100vw;
  width: var(--app-viewport-width, 100vw);
  height: 100vh;
  height: 100dvh;
  height: var(--app-viewport-height, 100dvh);
  padding: 12px;
}

.stage-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  background: #0a0d16;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.stage-wrap:fullscreen,
.stage-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.stage-wrap--fullscreen-fallback {
  position: fixed;
  inset: auto;
  top: 0;
  left: 0;
  top: var(--app-viewport-top, 0px);
  left: var(--app-viewport-left, 0px);
  width: 100vw;
  width: var(--app-viewport-width, 100vw);
  height: 100vh;
  height: 100dvh;
  height: var(--app-viewport-height, 100dvh);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  z-index: 12;
}

.stage-wrap:fullscreen .screen,
.stage-wrap:-webkit-full-screen .screen,
.stage-wrap--fullscreen-fallback .screen {
  inset:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#gameCanvas,
.stage-canvas--overlay {
  touch-action: none;
  z-index: 1;
}

.stage-canvas--scene {
  z-index: 0;
  background: linear-gradient(180deg, #111628 0%, #0b0e16 100%);
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 7, 14, 0.4);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 4;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}
