/* ═══════════════════════════════════════════
   TANZANITE CRYSTAL RUSH — Brand System
   Deep navy · Cobalt · Crystal ice · White
   ═══════════════════════════════════════════ */

:root {
  --navy-950: #030912;
  --navy-900: #050d1a;
  --navy-800: #0a1830;
  --navy-700: #0f2448;
  --cobalt: #0d3a8c;
  --blue-600: #1a5fd4;
  --blue-500: #2b7cff;
  --blue-400: #4da3ff;
  --ice: #a8d8ff;
  --ice-soft: #d4ecff;
  --white: #ffffff;
  --gold: #c9a84c;
  --gold-soft: #e8d5a3;
  --glass: rgba(12, 28, 58, 0.72);
  --glass-border: rgba(120, 180, 255, 0.22);
  --danger: #ff4d6a;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Montserrat", system-ui, sans-serif;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--navy-900);
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}

/* ── Ambient background ── */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  max-width: 480px;
  margin: 0 auto;
  left: 0; right: 0;
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(30, 90, 200, 0.35), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(80, 40, 180, 0.15), transparent 50%),
    radial-gradient(ellipse 50% 30% at 10% 60%, rgba(20, 100, 220, 0.12), transparent 50%),
    linear-gradient(180deg, #050d1a 0%, #081428 40%, #0a1a38 100%);
}

.bg-sparkles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.bg-sparkles span {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--ice);
  border-radius: 50%;
  opacity: 0.35;
  animation: twinkle var(--d, 4s) ease-in-out infinite;
  box-shadow: 0 0 6px var(--blue-400);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

/* ── Screens ── */
.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s var(--ease), visibility 0.4s;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Glass cards ── */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Typography ── */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  letter-spacing: 0.02em;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff 20%, var(--ice) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--blue-400);
  margin-bottom: 0.5rem;
}

.eyebrow.gold { color: var(--gold-soft); }

.lede {
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.55;
  color: rgba(255,255,255,0.72);
  max-width: 32ch;
  margin: 0 auto 1.5rem;
}

.tagline {
  font-size: 0.95rem;
  font-weight: 300;
  color: rgba(255,255,255,0.65);
  margin: 0.4rem 0 1.4rem;
  max-width: 28ch;
  text-align: center;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.75rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
  text-decoration: none;
  color: inherit;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-600) 0%, #0a3d9e 100%);
  color: var(--white);
  box-shadow: 0 8px 28px rgba(26, 95, 212, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-primary:hover {
  box-shadow: 0 12px 36px rgba(26, 95, 212, 0.55);
}

.btn-ghost {
  background: transparent;
  color: var(--ice);
  border: 1px solid rgba(120, 180, 255, 0.35);
}

.btn-ghost:hover {
  background: rgba(30, 90, 200, 0.15);
}

.btn-lg {
  padding: 1.1rem 2.4rem;
  font-size: 0.9rem;
  width: 100%;
  max-width: 280px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(10, 30, 60, 0.5);
  color: var(--ice);
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}

.icon-btn:hover { background: rgba(30, 90, 200, 0.25); }

/* ── Brand marks ── */
.brand-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.logo-img {
  height: 72px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(77, 163, 255, 0.45));
}

.logo-sm {
  height: 44px;
  width: auto;
  object-fit: contain;
}

/* ── Age gate ── */
#screen-age,
#screen-denied {
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  text-align: center;
}

.age-card,
.center-card {
  width: 100%;
  max-width: 380px;
  padding: 2rem 1.5rem 1.75rem;
}

.age-form { margin-top: 0.5rem; }

.field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.65rem;
}

.dob-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.dob-row input {
  width: 64px;
  height: 52px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--white);
  background: rgba(5, 15, 35, 0.7);
  border: 1px solid rgba(120, 180, 255, 0.28);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dob-row input#dob-yyyy { width: 88px; }

.dob-row input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(43, 124, 255, 0.2);
}

.dob-row input::placeholder { color: rgba(255,255,255,0.25); }

.dob-sep {
  color: rgba(255,255,255,0.3);
  font-size: 1.2rem;
}

.error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.legal-micro {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
  line-height: 1.5;
  margin-top: 1rem;
}

.legal-micro a {
  color: var(--ice);
  text-decoration: none;
}

/* ── Top bar ── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, rgba(5,13,26,0.95), transparent);
}

.top-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ice);
}

.top-meta { display: flex; align-items: center; gap: 0.5rem; }
.spacer { width: 40px; }

.pill {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(201,168,76,0.25), rgba(201,168,76,0.1));
  border: 1px solid rgba(201,168,76,0.45);
  color: var(--gold-soft);
}

/* ── Home ── */
.home-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem 1rem;
  text-align: center;
}

.bottle-orbit {
  position: relative;
  width: 160px;
  height: 260px;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-bottle {
  height: 240px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 20px 40px rgba(0, 40, 120, 0.55));
  animation: float 4s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-12px) rotate(1deg); }
}

.orbit-gems::before,
.orbit-gems::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: url("../assets/gem.png") center/contain no-repeat;
  animation: orbit 6s linear infinite;
  z-index: 1;
  filter: drop-shadow(0 0 8px rgba(77,163,255,0.8));
}

.orbit-gems::after {
  animation-delay: -3s;
  width: 14px;
  height: 14px;
  background-image: url("../assets/gem-gold.png");
}

@keyframes orbit {
  from { transform: rotate(0deg) translateX(80px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}

.hero-title { margin-bottom: 0.15rem; }

.challenge-banner {
  width: 100%;
  max-width: 340px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.1rem;
  text-align: center;
  border-color: rgba(201, 168, 76, 0.4);
  background: rgba(40, 30, 10, 0.5);
}

.challenge-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--gold);
  display: block;
  margin-bottom: 0.25rem;
}

.challenge-banner p {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.85);
  font-weight: 300;
}

.challenge-banner strong { font-weight: 600; color: var(--gold-soft); }

.name-row {
  width: 100%;
  max-width: 280px;
  margin-bottom: 1rem;
  text-align: center;
}

.name-row .field-label {
  margin-bottom: 0.4rem;
}

#player-name {
  width: 100%;
  height: 46px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--white);
  background: rgba(5, 15, 35, 0.7);
  border: 1px solid rgba(120, 180, 255, 0.28);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#player-name:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(43, 124, 255, 0.2);
}

#player-name::placeholder { color: rgba(255,255,255,0.25); }

.home-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

.stats-row {
  display: flex;
  gap: 2rem;
  margin-top: 0.25rem;
}

.stat { text-align: center; }

.stat-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ice);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.home-foot {
  text-align: center;
  padding: 0.75rem 1rem 1.25rem;
}

.shop-link {
  display: inline-block;
  color: var(--blue-400);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.shop-link:hover { color: var(--ice); }

/* ── Bottle select ── */
.select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  padding: 0.5rem 1.1rem 1rem;
  flex: 1;
  align-content: center;
}

.bottle-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 0.75rem 1rem;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  text-align: center;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}

.bottle-card:hover,
.bottle-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(77, 163, 255, 0.55);
  box-shadow: 0 16px 40px rgba(20, 80, 200, 0.35);
  outline: none;
}

.bottle-card img {
  height: 180px;
  width: auto;
  object-fit: contain;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 12px 24px rgba(0,30,80,0.5));
}

.bottle-card h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.bottle-card p {
  font-size: 0.68rem;
  font-weight: 300;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.75rem;
}

.card-cta {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue-400);
}

.select-hint {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 300;
  color: rgba(255,255,255,0.4);
  padding: 0 1.5rem 1.5rem;
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1rem;
}

/* ── How to play ── */
.how-list {
  padding: 0.5rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.how-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
}

.how-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  background: rgba(30, 90, 200, 0.2);
  border-radius: 12px;
  border: 1px solid rgba(77, 163, 255, 0.2);
}

.how-item h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
}

.how-item p {
  font-size: 0.8rem;
  font-weight: 300;
  color: rgba(255,255,255,0.6);
  line-height: 1.45;
}

#btn-how-play {
  margin: 0.75rem auto 1.5rem;
  display: flex;
}

/* ── Game HUD + canvas ── */
#screen-game {
  background: transparent;
  overflow: hidden;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top) + 0.75rem) 1rem 0;
  pointer-events: none;
}

.hud-left, .hud-right { text-align: left; }
.hud-right { text-align: right; }

.hud-label {
  display: block;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.45);
}

.hud-score, .hud-best {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--white);
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.hud-combo {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-soft);
  background: rgba(201, 168, 76, 0.2);
  border: 1px solid rgba(201, 168, 76, 0.4);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  animation: pulse 0.6s ease infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#game:active { cursor: grabbing; }

.touch-hint {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 1.5rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  background: rgba(5, 15, 35, 0.55);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(120,180,255,0.15);
  pointer-events: none;
  transition: opacity 0.5s;
  white-space: nowrap;
  z-index: 10;
}

.touch-hint.hide { opacity: 0; }

/* ── Game over ── */
#screen-over {
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: rgba(3, 9, 18, 0.55);
}

.over-card {
  width: 100%;
  max-width: 380px;
  padding: 1.75rem 1.35rem 1.35rem;
  text-align: center;
  max-height: 96vh;
  overflow-y: auto;
}

.over-score-block {
  margin: 0.75rem 0 0.5rem;
}

.over-score {
  display: block;
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(180deg, #fff, var(--blue-400));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.over-score-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.over-stats {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  margin: 0.75rem 0 1rem;
  font-weight: 400;
}

.over-stats span {
  color: var(--ice);
  font-weight: 600;
}

.challenge-result {
  font-size: 0.88rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.challenge-result.win {
  background: rgba(40, 120, 60, 0.25);
  border: 1px solid rgba(80, 200, 120, 0.4);
  color: #8fefb0;
}

.challenge-result.lose {
  background: rgba(80, 40, 20, 0.3);
  border: 1px solid rgba(255, 140, 80, 0.35);
  color: #ffc090;
}

.share-box {
  background: rgba(5, 20, 45, 0.5);
  border: 1px solid rgba(120, 180, 255, 0.15);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.share-prompt {
  font-size: 0.8rem;
  font-weight: 300;
  color: rgba(255,255,255,0.65);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.share-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.share-row .btn {
  padding: 0.8rem 1.2rem;
  font-size: 0.75rem;
  flex: 1;
  min-width: 120px;
}

.share-feedback {
  font-size: 0.75rem;
  color: var(--ice);
  margin-top: 0.6rem;
}

.over-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.cta-shop {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(20, 60, 140, 0.4), rgba(10, 30, 70, 0.5));
  border: 1px solid rgba(77, 163, 255, 0.3);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.cta-shop:hover {
  border-color: rgba(77, 163, 255, 0.6);
  background: rgba(30, 80, 180, 0.35);
}

.cta-bottle {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.cta-shop strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.cta-shop span {
  font-size: 0.68rem;
  font-weight: 300;
  color: rgba(255,255,255,0.55);
}

.cta-arrow {
  margin-left: auto;
  color: var(--blue-400);
  font-size: 1.2rem;
}

/* ── Leaderboard ── */
.board {
  margin: 0.5rem 1.1rem 1.5rem;
  padding: 1.25rem;
  flex: 1;
}

.board-sub {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 300;
}

.board-list {
  list-style: none;
  counter-reset: rank;
}

.board-list li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(120, 180, 255, 0.1);
}

.board-list li::before {
  content: counter(rank);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(30, 90, 200, 0.3);
  color: var(--ice);
  flex-shrink: 0;
}

.board-list li:nth-child(1)::before {
  background: linear-gradient(135deg, var(--gold), #8a7020);
  color: #1a1200;
}

.board-list .b-score {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-left: auto;
  color: var(--white);
}

.board-list .b-meta {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  font-weight: 300;
}

.board-empty {
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.9rem;
  font-weight: 300;
  padding: 2rem 1rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

/* ── Responsive ── */
@media (min-height: 780px) {
  .hero-bottle { height: 280px; }
  .bottle-orbit { height: 300px; }
}

@media (max-height: 640px) {
  .hero-bottle { height: 160px; }
  .bottle-orbit { height: 180px; margin-bottom: 0; }
  .display { font-size: 2rem; }
  .bottle-card img { height: 130px; }
}
