/* ============================================================
   Sky Dash — Stylesheet
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: linear-gradient(180deg, #0b1437 0%, #1b2a6b 55%, #3a4cb1 100%);
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* -------- Header -------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  padding-top: max(14px, env(safe-area-inset-top));
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { width: 22px; height: 22px; }
.brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,209,102,0.35);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.score-pill svg { width: 14px; height: 14px; }

/* -------- Game area -------- */
.game-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
}

.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.stars span {
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

.pipes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pipe-segment {
  position: absolute;
  width: 64px;
  background: #3ec97a;
  border: 2px solid #1f7a47;
  box-sizing: border-box;
}
.pipe-cap {
  position: absolute;
  width: 72px;
  height: 12px;
  background: #48d987;
  border: 2px solid #1f7a47;
  border-radius: 4px;
  box-sizing: border-box;
}

.player {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd166 0%, #ff924c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(255,209,102,0.55);
  will-change: transform, top;
  pointer-events: none;
  z-index: 2;
}
.player svg { width: 22px; height: 22px; }

.live-score {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 56px;
  font-weight: 900;
  text-shadow: 0 3px 6px rgba(0,0,0,0.55);
  pointer-events: none;
  display: none;
  z-index: 3;
}
.live-score.visible { display: block; }

/* -------- Overlay cards -------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  z-index: 4;
}
.overlay.hidden { display: none; }

.card {
  width: 100%;
  max-width: 360px;
  background: rgba(11,20,55,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.card h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}
.card p {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255,255,255,0.75);
  margin-bottom: 16px;
}
.tap-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffd166;
  font-weight: 700;
  font-size: 14px;
  margin-top: 4px;
}
.tap-hint svg { width: 18px; height: 18px; }

/* -------- Stats -------- */
.stats {
  display: flex;
  gap: 16px;
  margin: 16px 0;
}
.stat {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
}

/* -------- Buttons -------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #ffd166;
  color: #0b1437;
  font-weight: 800;
  font-size: 16px;
  border: none;
  padding: 14px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(255,209,102,0.35); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary svg { width: 18px; height: 18px; }

.btn-secondary {
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  font-size: 14px;
  border: none;
  padding: 12px 22px;
  margin-top: 8px;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}
.btn-secondary:hover { color: #fff; }

/* -------- Footer -------- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  font-size: 13px;
}
.app-footer a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 600;
}
.app-footer a:hover { color: #ffd166; }
.app-footer .dot { color: rgba(255,255,255,0.4); }
.app-footer .muted { color: rgba(255,255,255,0.4); }

/* -------- Welcome Modal -------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade-in 0.2s ease;
}
.modal-backdrop.hidden { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: 100%;
  max-width: 380px;
  background: #0f1c4d;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  padding: 24px;
  text-align: center;
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,209,102,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.modal-icon svg { width: 28px; height: 28px; }

.modal-card h3 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}
.modal-card > p {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255,255,255,0.78);
  margin-bottom: 18px;
}
.modal-note {
  margin-top: 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}

/* -------- Legal pages (terms/privacy) -------- */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  padding-top: max(24px, env(safe-area-inset-top));
  overflow-y: auto;
  height: 100vh;
  height: 100dvh;
}
.legal-page header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.legal-page header a {
  color: #fff;
  text-decoration: none;
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.legal-page header h1 {
  font-size: 18px;
  font-weight: 800;
}
.legal-page .updated {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  margin-bottom: 16px;
}
.legal-page h2 {
  color: #ffd166;
  font-size: 15px;
  font-weight: 800;
  margin: 18px 0 6px;
}
.legal-page p {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 4px;
}

html, body { overflow-y: auto; }
body { overflow-x: hidden; }
#app { overflow: hidden; }
