* { box-sizing: border-box; }

html, body, #app {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #071018;
  color: #fff8df;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

#app {
  position: relative;
  isolation: isolate;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  background: #071018;
  touch-action: none;
}

.screen-card {
  position: absolute;
  top: 12%;
  left: 50%;
  width: min(92%, 720px);
  padding: clamp(20px, 4vw, 42px);
  border: 2px solid rgba(255, 235, 176, .72);
  border-radius: 18px;
  background: rgba(5, 11, 18, .78);
  box-shadow: 0 18px 70px rgba(0, 0, 0, .45);
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.screen-card h1 {
  margin: 4px 0 18px;
  color: #ffe59a;
  font-size: clamp(42px, 9vw, 92px);
  letter-spacing: -.06em;
  text-shadow: 0 4px 20px #000;
}

.screen-card p {
  font-size: clamp(13px, 2.1vw, 20px);
  line-height: 1.7;
}

.screen-card strong {
  display: block;
  margin-top: 24px;
  color: #8cf4d3;
  font-size: clamp(16px, 2.8vw, 26px);
  animation: pulse 1.3s ease-in-out infinite alternate;
}

.eyebrow {
  margin: 0;
  color: #8cf4d3;
  font-weight: 800;
  letter-spacing: .16em;
}

#sound-button {
  position: absolute;
  z-index: 5;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  width: 48px;
  height: 48px;
  border: 1px solid #ffe59a;
  border-radius: 50%;
  background: rgba(5, 11, 18, .82);
  color: #ffe59a;
  cursor: pointer;
}

.sound-panel {
  display: none;
  position: absolute;
  z-index: 10;
  top: max(70px, calc(env(safe-area-inset-top) + 58px));
  right: 16px;
  width: min(310px, calc(100% - 32px));
  padding: 18px;
  border: 1px solid #ffe59a;
  border-radius: 14px;
  background: rgba(5, 11, 18, .95);
  box-shadow: 0 16px 50px #0009;
}

.sound-panel.open { display: grid; gap: 15px; }
.sound-panel label { display: grid; gap: 7px; color: #fff1c4; }
.sound-panel input { width: 100%; accent-color: #66e3bb; }

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title button, #master-toggle {
  border: 1px solid #7edec1;
  border-radius: 9px;
  background: #102c2d;
  color: white;
  cursor: pointer;
}

.panel-title button { width: 34px; height: 34px; font-size: 24px; }
#master-toggle { padding: 10px; }

#touch-controls {
  display: none;
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  gap: 9px;
}

#touch-controls button {
  width: clamp(52px, 14vw, 70px);
  height: clamp(52px, 14vw, 70px);
  border: 1px solid #fff8;
  border-radius: 50%;
  background: #06101db8;
  color: white;
  font-size: 25px;
  touch-action: none;
}

.hidden { display: none !important; }

@media (pointer: coarse), (max-width: 760px) {
  #touch-controls { display: flex; }
  .screen-card { top: 8%; }
}

@keyframes pulse {
  from { opacity: .55; transform: scale(.98); }
  to { opacity: 1; transform: scale(1.02); }
}