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

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: #0a0a14;
  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 top, #1a1a2e 0%, #0a0a14 60%);
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  background: linear-gradient(180deg, #050510 0%, #12122a 100%);
  image-rendering: pixelated;
}

.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(48px, 14vw, 96px);
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  background: linear-gradient(180deg, #00d9ff 0%, #6a5cff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(0, 217, 255, 0.3);
}
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.06em;
}
.hint {
  font-size: 12px;
  opacity: 0.5;
  margin-top: 24px;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.cta {
  appearance: none;
  border: none;
  background: linear-gradient(135deg, #00d9ff 0%, #6a5cff 100%);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
  padding: 18px 36px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 217, 255, 0.25);
  cursor: pointer;
  margin: 8px 0;
  min-width: 240px;
}
.cta:active { transform: scale(0.97); }

.cta-rewarded {
  background: linear-gradient(135deg, #ffb300 0%, #ff5e7a 100%);
  box-shadow: 0 8px 24px rgba(255, 94, 122, 0.3);
}
.cta-rewarded .icon { display: inline-block; transform: rotate(-90deg); margin-right: 8px; }

.score {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0) + 16px);
  left: 0; right: 0;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.ghost-count {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0) + 56px);
  left: 0; right: 0;
  text-align: center;
  font-size: 14px;
  opacity: 0.75;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.run-stat {
  font-size: clamp(32px, 9vw, 56px);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 32px;
  color: #00d9ff;
}
.best-stat {
  margin-top: 24px;
  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, #1a1a2e 0%, #2a2a4e 100%);
  border: 1px solid rgba(106, 92, 255, 0.3);
  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: #00d9ff; }
.house-ad em { font-style: normal; opacity: 0.7; }
