* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: #05030f;
  color: #e8eaf2;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0e0a28 0%, #05030f 70%);
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) 24px env(safe-area-inset-bottom, 24px);
  text-align: center;
  pointer-events: none;
}
.screen.visible { display: flex; }
.screen > * { pointer-events: auto; }

h1 {
  font-size: clamp(56px, 16vw, 112px);
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 0 0 8px;
  background: linear-gradient(180deg, #ffd86b 0%, #ff5e7a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 200, 80, 0.25);
}
h2 {
  font-size: clamp(36px, 10vw, 64px);
  font-weight: 900;
  letter-spacing: 0.1em;
  margin: 0 0 12px;
  color: #ff5e7a;
}
.tag {
  font-size: 16px;
  opacity: 0.7;
  margin: 0 0 40px;
  letter-spacing: 0.04em;
  max-width: 320px;
  line-height: 1.5;
}
.hint {
  font-size: 12px;
  opacity: 0.5;
  margin-top: 24px;
  letter-spacing: 0.04em;
  line-height: 1.7;
}
.hint-desktop { opacity: 0.65; }

.cta {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, #ffd86b 0%, #ff5e7a 100%);
  color: #1a0a14;
  font-family: inherit;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.12em;
  padding: 18px 40px;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(255, 134, 90, 0.30);
  cursor: pointer;
  margin: 8px 0;
  min-width: 240px;
}
.cta:active { transform: scale(0.97); }

.cta-rewarded {
  background: linear-gradient(135deg, #00d9ff 0%, #6a5cff 100%);
  color: #fff;
  box-shadow: 0 8px 28px rgba(0, 217, 255, 0.30);
}
.cta-rewarded .icon { display: inline-block; transform: rotate(-90deg); margin-right: 8px; }

.score {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0) + 18px);
  left: 0; right: 0;
  text-align: center;
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  line-height: 1;
}
.sublabel {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0) + 96px);
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  opacity: 0.55;
  letter-spacing: 0.3em;
  pointer-events: none;
}
.death-quip {
  font-size: 14px;
  font-style: italic;
  opacity: 0.78;
  letter-spacing: 0.02em;
  max-width: 300px;
  margin: 0 auto 24px;
  line-height: 1.5;
}

.run-stat {
  font-size: clamp(28px, 8vw, 48px);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 32px;
  color: #ffd86b;
}
.best-stat {
  margin-top: 12px;
  font-size: 14px;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.ad-slot {
  margin-top: 24px;
  min-height: 0;
  width: min(320px, 90vw);
}

.ad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.ad-overlay[hidden] { display: none; }
.ad-overlay-inner {
  background: #1a1a2e;
  border-radius: 16px;
  padding: 24px;
  max-width: 90vw;
  text-align: center;
}

.house-ad {
  display: block;
  background: linear-gradient(135deg, #0e0a28 0%, #1a0a30 100%);
  border: 1px solid rgba(255, 215, 100, 0.25);
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.house-ad strong { display: block; font-size: 16px; margin-bottom: 4px; color: #ffd86b; }
.house-ad em { font-style: normal; opacity: 0.7; }

.mute-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0) + 12px);
  right: calc(env(safe-area-inset-right, 0) + 12px);
  z-index: 100;
  appearance: none;
  background: rgba(10, 6, 24, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 216, 107, 0.35);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.mute-toggle:active { transform: scale(0.92); }
.mute-toggle.muted { opacity: 0.55; border-color: rgba(255, 255, 255, 0.2); }
