/* d'Alba Gifts — Колесо фортуны. Mobile lottery landing.
   Flat 2D design, TT Chocolates throughout. Values mirror the approved design. */

/* ─── TT Chocolates — local fonts ─────────────────────────── */
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-Light.otf')        format('opentype'); font-weight:300; font-style:normal; font-display:swap; }
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-Regular.otf')      format('opentype'); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-Italic.otf')       format('opentype'); font-weight:400; font-style:italic; font-display:swap; }
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-Medium.otf')       format('opentype'); font-weight:500; font-style:normal; font-display:swap; }
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-MediumItalic.otf') format('opentype'); font-weight:500; font-style:italic; font-display:swap; }
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-DemiBold.otf')     format('opentype'); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-Bold.otf')         format('opentype'); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:'TT Chocolates'; src:url('fonts/TTChocolates-BoldItalic.otf')   format('opentype'); font-weight:700; font-style:italic; font-display:swap; }

:root {
  --gold:      #c9a35b;
  --gold-deep: #a07a3a;
  --ink:       #1a1410;
  --paper:     #fffaee;
  --yellow:    #f0d040;
  --cream:     #f5ead0;
  --sans: 'TT Chocolates', -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--sans);
  font-feature-settings: 'ss01', 'liga';
  background: #ebe1ce;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
}

img { -webkit-user-drag: none; user-select: none; }

/* ─── Phone shell — full-bleed on mobile, framed on desktop ── */
.phone {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
@media (min-width: 480px) {
  body { padding: 24px; }
  .phone {
    height: min(calc(100dvh - 48px), 920px);
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(60, 40, 10, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.06);
  }
}

/* ─── Screens + cross-fade ────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.screen.is-active { opacity: 1; visibility: visible; }

.screen__logo { display: flex; justify-content: center; }
.logo { display: block; height: auto; }
.logo--invert { filter: invert(1); }
.screen--home .screen__logo .logo   { width: 100px; }
.screen--wheel  .screen__logo .logo,
.screen--result .screen__logo .logo { width: 84px; }

/* ─── Flat buttons — no gradient, no shadow, no 3D ────────── */
.btn {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: none;
  transition: opacity 0.15s ease;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { opacity: 0.85; }
.btn--dark  { background: var(--ink);   color: var(--paper); }
.btn--light { background: var(--paper); color: var(--ink);   }
.btn:disabled {
  background: #e6dccb;
  color: rgba(26, 20, 16, 0.35);
  cursor: default;
}

/* ─── 01 · Home ───────────────────────────────────────────── */
.screen--home { background: var(--ink); color: var(--paper); }
.home__hero { position: absolute; inset: 0; }
.home__hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}
.home__scrim {
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(20,16,12,0)    0%,
    rgba(20,16,12,0)    25%,
    rgba(20,16,12,0.55) 50%,
    rgba(20,16,12,0.88) 75%,
    rgba(20,16,12,0.98) 100%);
}
.home__content {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 52px 24px 36px;
}
.home__spacer { flex: 1; }
.home__textblock { padding: 0 4px 4px; }
.home__title {
  margin: 0;
  font-weight: 600;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--paper);
  text-wrap: pretty;
}
.home__lede {
  margin: 14px 0 0;
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(255, 250, 238, 0.85);
  text-wrap: pretty;
}
.home__lede strong { color: var(--paper); font-weight: 600; }
.home__cta { margin-top: 18px; }

/* ─── 02 · Wheel ──────────────────────────────────────────── */
.screen--wheel {
  background: radial-gradient(ellipse 100% 80% at 50% 35%, #fffaef 0%, #fdf3d8 60%, #f8e8b8 100%);
}
.wheel-bg {
  position: absolute;
  top: 50%; left: 50%;
  width: 200%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  opacity: 0.85;
  z-index: 0;
  pointer-events: none;
}
.wheel-bg svg { display: block; width: 100%; height: 100%; }
.wheel-orb {
  position: absolute;
  width: 60%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}
.wheel-orb--tr { top: -12%; right: -15%; background: radial-gradient(circle, rgba(255,244,210,0.85), transparent 70%); }
.wheel-orb--bl { bottom: -15%; left: -15%; background: radial-gradient(circle, rgba(216,188,132,0.55), transparent 70%); }

.wheel__content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 56px 24px 32px;
}
.wheel__head { text-align: center; margin-top: 28px; }
.wheel__title {
  margin: 0;
  font-weight: 700;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: #000;
  text-transform: uppercase;
}
.wheel__sub {
  margin: 10px 0 0;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(26, 20, 16, 0.6);
}
.wheel__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

/* the wheel itself */
.wheel {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wheel__ring {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--yellow);
  padding: 4.5%;
  overflow: hidden;
}
.wheel__face {
  width: 100%; height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--cream);
  will-change: transform;
}
.wheel__face svg { display: block; width: 100%; height: 100%; }

.wheel__bulbs { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.wheel__bulb {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.7);
  transform: translate(-50%, -50%);
}
.wheel__bulbs.is-spinning .wheel__bulb {
  animation: bulb-pulse 1.4s var(--phase) ease-in-out infinite;
}
@keyframes bulb-pulse {
  0%, 100% { box-shadow: 0 0 3px rgba(255, 255, 255, 0.7); }
  50%      { box-shadow: 0 0 10px 3px rgba(255, 255, 255, 1), 0 0 20px 5px rgba(255, 240, 180, 0.7); }
}

.wheel__hub {
  position: absolute;
  width: 22%; height: 22%;
  border: none;
  padding: 0;
  border-radius: 50%;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  z-index: 3;
  transition: opacity 0.15s ease;
}
.wheel__hub:active:not(:disabled) { opacity: 0.9; }
.wheel__hub:disabled { cursor: default; }
.wheel__hub img { width: 70%; height: auto; display: block; pointer-events: none; }

.wheel__pointer {
  position: absolute;
  top: -4px; left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 0; height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 24px solid var(--ink);
}

/* ─── 03 · Result ─────────────────────────────────────────── */
.screen--result { background: var(--ink); color: var(--paper); }
.result__hero { position: absolute; inset: 0; overflow: hidden; }
.result__hero img {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(28px) brightness(0.5);
  transform: scale(1.08);
}
.result__scrim {
  position: absolute; inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(20,16,12,0.5) 0%, rgba(20,16,12,0.75) 100%);
}
.result__content {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 56px 24px 36px;
}
.result__center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 64px;
  padding-bottom: 12px;
  gap: 12px;
  min-height: 0;
}
.result__title {
  margin: 0;
  font-weight: 700;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.005em;
  color: var(--paper);
}
.result__sub {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 250, 238, 0.7);
}
.result__packshot {
  width: 100%;
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  overflow: hidden;
}
.result__packshot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.45));
}
.result__name {
  margin-top: 4px;
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.4;
  color: rgba(255, 250, 238, 0.92);
  text-wrap: pretty;
  white-space: pre-line;
  max-width: 300px;
}
.result__spacer { flex: 1; min-height: 12px; }
.result__note {
  font-weight: 400;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 250, 238, 0.45);
  text-wrap: pretty;
  max-width: 290px;
}

/* ─── Confetti ────────────────────────────────────────────── */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 4; }
.confetti__piece {
  position: absolute;
  top: -20px;
  opacity: 0;
  animation: confetti-fall var(--dur) var(--delay) ease-in forwards;
}
@keyframes confetti-fall {
  0%   { transform: translate(0, -20px) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translate(var(--drift), 110vh) rotate(var(--rot)); opacity: 0; }
}

/* ─── Toast (network / rate-limit errors) ─────────────────── */
.toast {
  position: absolute;
  left: 50%;
  bottom: 104px;
  transform: translate(-50%, 12px);
  z-index: 10;
  max-width: calc(100% - 48px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(26, 20, 16, 0.92);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .wheel__face { transition: none !important; }
  .confetti { display: none; }
  .wheel__bulbs.is-spinning .wheel__bulb { animation: none; }
}
