:root {
  --bg: #07170f;
  --bg-2: #0c2a1f;
  --emerald: #1f5040;
  --emerald-2: #174a37;
  --ink: #123a2b;
  --gold: #c9a45c;
  --gold-2: #e6cf98;
  --gold-3: #8f6f32;
  --champagne: #fff3d1;
  --ivory: #f3ead8;
  --ivory-soft: rgba(243, 234, 216, .74);
  --glow: rgba(201, 164, 92, .45);
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gold-grad: linear-gradient(100deg, #9c7a3c 0%, #e9d39d 32%, #fff4d6 50%, #d4b16c 68%, #9c7a3c 100%);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ivory);
  background:
    radial-gradient(900px 600px at 50% -10%, #154433 0%, transparent 60%),
    radial-gradient(700px 600px at 110% 110%, #0f3326 0%, transparent 55%),
    var(--bg);
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

.gold-text, .intro-name, .board-name, .end-title, .finale-banner h2, .monogram span {
  background: var(--gold-grad);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: goldShift 7s ease-in-out infinite alternate;
}
@keyframes goldShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }

.kicker {
  margin: 0; font-family: var(--sans); font-weight: 500; font-size: 11px;
  letter-spacing: .38em; text-transform: uppercase; color: var(--gold);
}

/* ---------------- Фон ---------------- */
#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; animation: orb 20s ease-in-out infinite alternate; }
.o1 { width: 90vmax; height: 90vmax; left: -45vmax; top: -40vmax; background: radial-gradient(circle, rgba(31, 107, 79, .45), transparent 62%); }
.o2 { width: 80vmax; height: 80vmax; right: -40vmax; bottom: -40vmax; background: radial-gradient(circle, rgba(201, 164, 92, .16), transparent 62%); animation-delay: -7s; }
.o3 { width: 60vmax; height: 60vmax; left: 20%; top: 35%; background: radial-gradient(circle, rgba(18, 70, 50, .35), transparent 65%); animation-delay: -13s; }
@keyframes orb { to { transform: translate(6vmax, 4vmax) scale(1.08); } }

.grain {
  position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.photo-layer { position: absolute; inset: 0; opacity: .55; transition: filter .6s, opacity .6s; }
body.on-board .photo-layer { opacity: .28; filter: blur(1px); }
body.stage-open .photo-layer { filter: blur(4px); }
.bg-photo {
  position: absolute; width: clamp(90px, 20vw, 180px); padding: 6px;
  background: var(--bg-2); border: 1px solid rgba(201, 164, 92, .5);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .5);
  transform: rotate(var(--rot, 0deg));
  animation: drift var(--dur, 16s) ease-in-out infinite alternate; animation-delay: var(--del, 0s);
}
.bg-photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: saturate(.85) sepia(.08); }
@keyframes drift {
  from { transform: translate(0, 0) rotate(var(--rot, 0deg)); }
  to   { transform: translate(var(--dx, 8px), var(--dy, -12px)) rotate(calc(var(--rot, 0deg) + 2deg)); }
}

.speck {
  position: absolute; width: var(--s, 3px); height: var(--s, 3px); border-radius: 50%;
  background: radial-gradient(circle, var(--champagne), var(--gold) 60%, transparent 72%);
  box-shadow: 0 0 6px rgba(230, 207, 152, .8);
  opacity: 0;
  animation: dust var(--dur, 10s) linear infinite; animation-delay: var(--del, 0s);
}
@keyframes dust {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: var(--o, .7); }
  80% { opacity: var(--o, .7); }
  100% { transform: translateY(-90px); opacity: 0; }
}

/* ---------------- Экраны ---------------- */
.screen {
  position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh;
  display: none;
  padding: calc(env(safe-area-inset-top) + 48px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 28px) max(16px, env(safe-area-inset-left));
}
.screen.active { display: flex; flex-direction: column; animation: screenIn .9s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Заставка */
#intro { align-items: center; justify-content: center; text-align: center; }
.intro-frame {
  position: relative; width: 100%; max-width: 430px; padding: 46px 26px 38px;
  background: linear-gradient(180deg, rgba(14, 44, 32, .78), rgba(6, 22, 15, .86));
  border: 1px solid rgba(201, 164, 92, .45);
  outline: 1px solid rgba(201, 164, 92, .18); outline-offset: -9px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.intro-frame::before, .intro-frame::after {
  content: ""; position: absolute; left: 50%; width: 10px; height: 10px;
  background: var(--bg); border: 1px solid var(--gold); transform: translateX(-50%) rotate(45deg);
}
.intro-frame::before { top: -6px; }
.intro-frame::after { bottom: -6px; }
.monogram {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(201, 164, 92, .8);
  box-shadow: inset 0 0 0 5px rgba(7, 23, 15, .9), inset 0 0 0 6px rgba(201, 164, 92, .35), 0 0 30px rgba(201, 164, 92, .15);
}
.monogram span { font-style: italic; font-weight: 600; font-size: 42px; line-height: 1; padding-right: 3px; }
.intro-name { margin: 8px 0 16px; font-style: italic; font-weight: 600; font-size: clamp(54px, 16vw, 78px); line-height: 1; }
.divider { display: flex; align-items: center; gap: 12px; width: 70%; margin: 0 auto 18px; }
.divider i { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.divider i:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.divider b { width: 7px; height: 7px; border: 1px solid var(--gold); transform: rotate(45deg); }
.intro-text { margin: 0 0 28px; color: var(--ivory-soft); font-size: 20px; line-height: 1.4; }

.btn-gold {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  padding: 17px 36px; border-radius: 1px;
  font-family: var(--sans); font-weight: 600; font-size: 12px; letter-spacing: .24em; text-transform: uppercase;
  color: #0a1f16;
  background: linear-gradient(135deg, #b8914a 0%, #ecd6a0 45%, #f7e7bd 52%, #c9a45c 100%);
  box-shadow: 0 12px 30px rgba(201, 164, 92, .22), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .15s;
}
.btn-gold::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: sweep 3.8s ease-in-out infinite;
}
@keyframes sweep { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn-gold:active, .btn-soft:active { transform: scale(.97); }
.btn-soft {
  padding: 16px 24px; border-radius: 1px;
  font-family: var(--sans); font-weight: 500; font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ivory); border: 1px solid rgba(201, 164, 92, .55); background: rgba(7, 23, 15, .5);
  transition: transform .15s;
}

/* Поле */
.board-head { text-align: center; margin-bottom: 26px; }
.board-name { margin: 4px 0 14px; font-style: italic; font-weight: 600; font-size: clamp(42px, 12vw, 58px); line-height: 1.05; }
.progress { display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--sans); font-size: 11px; letter-spacing: .18em; color: var(--ivory-soft); }
.progress-bar { width: min(180px, 44vw); height: 2px; background: rgba(201, 164, 92, .2); overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold-2)); transition: width .8s ease; }

.grid {
  width: 100%; max-width: 760px; margin: 0 auto;
  display: grid; gap: 22px 16px;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
}
@media (max-width: 420px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 20px 12px; } }
.board-foot { margin: 26px 0 0; text-align: center; font-style: italic; font-size: 21px; color: var(--ivory-soft); }

.slot { position: relative; aspect-ratio: 3 / 4; }
.slot-num {
  position: absolute; z-index: 3; top: -9px; left: -7px; min-width: 24px; height: 24px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 12px;
  background: var(--bg); border: 1px solid rgba(201, 164, 92, .65);
  color: var(--gold-2); font-weight: 600; font-size: 14px; line-height: 1;
}
.slot.locked .gift { filter: brightness(.55) saturate(.6); }
.slot.current { cursor: pointer; }
.slot.current .gift { animation: breathe 3.2s ease-in-out infinite; }
.slot.current .gift::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 243, 209, .28) 50%, transparent 70%) 0 0 / 250% 100% no-repeat;
  animation: sheen 3.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 1px rgba(230, 207, 152, .7), 0 0 20px 2px rgba(201, 164, 92, .3), 0 14px 26px rgba(0, 0, 0, .5); }
  50% { transform: translateY(-4px); box-shadow: 0 0 0 1px rgba(255, 243, 209, .95), 0 0 38px 8px rgba(201, 164, 92, .5), 0 18px 30px rgba(0, 0, 0, .5); }
}
@keyframes sheen { 0% { background-position: 150% 0; } 60%, 100% { background-position: -60% 0; } }
.slot.opened { cursor: pointer; }
.slot.drop { animation: drop 1.1s cubic-bezier(.3, 1.35, .5, 1) both; }
@keyframes drop {
  0% { transform: translateY(-110vh) rotate(-20deg); }
  70% { transform: translateY(8px) rotate(3deg); }
  100% { transform: none; }
}

/* ---------------- Подарок ---------------- */
.gift {
  --r1: #8f6f32; --r2: #d9bb7a; --r3: #fff3d1;
  position: relative; width: 100%; height: 100%; border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .08) 0%, transparent 38%, rgba(0, 0, 0, .3) 100%),
    repeating-linear-gradient(45deg, rgba(230, 207, 152, .065) 0 1px, transparent 1px 13px),
    repeating-linear-gradient(-45deg, rgba(230, 207, 152, .065) 0 1px, transparent 1px 13px),
    linear-gradient(160deg, #22584a 0%, #0c2a1f 100%);
  box-shadow: inset 0 0 0 1px rgba(230, 207, 152, .22), 0 14px 28px rgba(0, 0, 0, .5);
}
.gift.final {
  --r1: #0b2a1e; --r2: #1f5a42; --r3: #4a9474;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .4) 0%, transparent 40%, rgba(120, 95, 50, .25) 100%),
    repeating-linear-gradient(45deg, rgba(143, 111, 50, .09) 0 1px, transparent 1px 13px),
    linear-gradient(160deg, #f5ecd9 0%, #d6c197 100%);
}
.gift.bonus {
  background:
    radial-gradient(circle, rgba(230, 207, 152, .9) 0 1px, transparent 1.6px) 0 0 / 11px 11px,
    radial-gradient(circle, rgba(255, 243, 209, .4) 0 .8px, transparent 1.4px) 5px 6px / 11px 11px,
    linear-gradient(160deg, #1d1d20 0%, #050506 100%);
  box-shadow: inset 0 0 0 1px rgba(230, 207, 152, .45), 0 14px 28px rgba(0, 0, 0, .55);
}
.gift .rib-v, .gift .rib-h { position: absolute; box-shadow: 0 0 6px rgba(0, 0, 0, .25); }
.gift .rib-v { left: 50%; top: 0; bottom: 0; width: 11%; transform: translateX(-50%); background: linear-gradient(90deg, var(--r1), var(--r2) 42%, var(--r3) 50%, var(--r2) 58%, var(--r1)); }
.gift .rib-h { top: 38%; left: 0; right: 0; height: 8%; background: linear-gradient(180deg, var(--r1), var(--r2) 42%, var(--r3) 50%, var(--r2) 58%, var(--r1)); }
.gift .bow { position: absolute; left: 50%; top: 38%; width: 54%; height: 28%; transform: translate(-50%, -62%); transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.gift .bow i {
  position: absolute; top: 10%; width: 46%; height: 80%;
  border: .5em solid var(--r2); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  font-size: clamp(4px, 1.3vw, 6px);
}
.gift .bow i:nth-child(1) { left: 2%; transform: rotate(-28deg); }
.gift .bow i:nth-child(2) { right: 2%; transform: rotate(28deg); }
.gift .bow b {
  position: absolute; left: 50%; top: 50%; width: 20%; height: 32%; transform: translate(-50%, -30%);
  border-radius: 40%; background: radial-gradient(circle at 35% 30%, var(--r3), var(--r2) 60%, var(--r1));
}
.gift .qmark {
  position: absolute; left: 50%; top: 70%; transform: translate(-50%, -50%);
  width: 1.55em; height: 1.55em; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #22604b, #0a2519);
  border: 1px solid var(--gold-2); box-shadow: 0 4px 12px rgba(0, 0, 0, .45);
  font-style: italic; font-weight: 600; font-size: clamp(17px, 5.2vw, 24px); line-height: 1;
  color: var(--gold-2);
}
.gift.final .qmark { background: radial-gradient(circle at 35% 30%, #fffaf0, #e0cfa9); border-color: var(--emerald-2); color: var(--emerald-2); }
.gift.bonus .qmark { background: radial-gradient(circle at 35% 30%, #2a2a2e, #050506); }

/* Открытая карточка на поле */
.mini-polaroid {
  position: absolute; inset: 0; padding: 5px 5px 26px;
  background: linear-gradient(160deg, #10301f, #081a12);
  border: 1px solid rgba(201, 164, 92, .6);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .45);
  animation: miniIn .7s cubic-bezier(.3, 1.3, .5, 1) both;
}
.mini-polaroid img, .mini-polaroid .ph { width: 100%; height: 100%; object-fit: cover; display: block; background: #04110b; filter: saturate(.9); }
.mini-polaroid .ph { display: grid; place-items: center; font-size: 30px; color: var(--gold-2); filter: none; }
.mini-polaroid span {
  position: absolute; left: 4px; right: 4px; bottom: 3px; text-align: center;
  font-style: italic; font-weight: 600; font-size: 17px; line-height: 20px; color: var(--ivory);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-polaroid.final-mini .ph { background: linear-gradient(160deg, #f5ecd9, #d6c197); color: var(--emerald-2); }
.mini-polaroid.bonus-mini { border-color: var(--gold-2); box-shadow: 0 0 18px rgba(201, 164, 92, .35), 0 12px 24px rgba(0, 0, 0, .45); }
.mini-polaroid.bonus-mini .ph { background: linear-gradient(160deg, #1d1d20, #050506); }
@keyframes miniIn { from { transform: scale(.6); opacity: 0; } }

/* ---------------- Сцена ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 62px) 16px calc(env(safe-area-inset-bottom) + 20px);
}
.overlay > .stage { margin-top: auto; }
.overlay > .stage-actions { margin-bottom: auto; }
/* Во время титров и звонка поле полностью скрыто (иначе оно просвечивает под панелью браузера Telegram/Safari) */
body.takeover .screen, body.takeover #bg { visibility: hidden; }

.overlay-dim {
  position: fixed; inset: 0; background: rgba(2, 10, 6, .8);
  box-shadow: 0 0 0 100vmax rgba(2, 10, 6, .8); /* затемнение уходит и под панель браузера */
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .45s ease;
}
.overlay.show .overlay-dim { opacity: 1; }
.close-btn {
  position: fixed; z-index: 3; top: calc(env(safe-area-inset-top) + 12px); right: 14px;
  width: 40px; height: 40px; border-radius: 50%; font-family: var(--sans); font-size: 15px;
  background: rgba(7, 23, 15, .6); color: var(--gold-2); border: 1px solid rgba(201, 164, 92, .5);
  opacity: 0; transition: opacity .3s .3s;
}
.overlay.show .close-btn { opacity: 1; }
.stage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; perspective: 1200px; }
.stage-actions { position: relative; z-index: 2; margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; min-height: 48px; }

/* Карточка-подсказка */
.hint-note {
  position: relative; max-width: min(86vw, 360px); margin-bottom: 28px; padding: 18px 22px 20px;
  background: linear-gradient(180deg, #f6eedd, #eadcc0); color: var(--ink); text-align: center;
  outline: 1px solid rgba(143, 111, 50, .5); outline-offset: -7px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  animation: noteIn .7s .2s cubic-bezier(.25, 1.2, .5, 1) both;
  transition: opacity .3s;
}
.hint-note small { display: block; font-family: var(--sans); font-size: 10px; letter-spacing: .32em; text-transform: uppercase; color: var(--gold-3); font-weight: 600; }
.hint-note p { margin: 6px 0 0; font-style: italic; font-weight: 600; font-size: clamp(22px, 6.2vw, 27px); line-height: 1.2; }
@keyframes noteIn { from { opacity: 0; transform: translateY(-16px); } }

.big-gift-wrap { position: relative; width: min(64vw, 290px, 40vh); aspect-ratio: 3 / 4; cursor: pointer; touch-action: manipulation; }
.big-gift-wrap .gift { transition: transform .12s; }
.big-gift-wrap .gift .bow i { font-size: clamp(8px, 2.5vw, 12px); }
.big-gift-wrap .gift .qmark { font-size: clamp(38px, 11vw, 54px); }
@media (max-height: 700px) {
  .hint-note { margin-bottom: 18px; padding: 14px 18px 16px; }
  .hint-note p { font-size: 21px; }
  .big-gift-wrap { width: min(62vw, 290px, 30vh); }
  .tap-meter { margin-top: 14px; }
}
.big-gift-wrap.glow .gift { box-shadow: inset 0 0 0 1px rgba(255, 243, 209, .6), 0 0 0 1px var(--gold-2), 0 0 60px 14px var(--glow), 0 20px 40px rgba(0, 0, 0, .45); }
.gift.hit { animation: hit .28s ease; }
@keyframes hit {
  0% { transform: scale(1) rotate(0); }
  30% { transform: scale(.94) rotate(var(--r, 4deg)); }
  65% { transform: scale(1.03) rotate(calc(var(--r, 4deg) * -.6)); }
  100% { transform: scale(1) rotate(0); }
}
.gift.burst { animation: burst .55s ease-in forwards; }
@keyframes burst {
  30% { transform: scale(1.1); filter: brightness(1.5); }
  100% { transform: scale(1.45); opacity: 0; filter: brightness(2.6) blur(6px); }
}

.cracks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cracks path {
  fill: none; stroke: var(--champagne); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
  filter: drop-shadow(0 0 2px #ffe3a3) drop-shadow(0 0 5px #d9a84a);
}
.cracks path.on { opacity: 1; animation: crack .3s ease-out forwards; }
@keyframes crack { to { stroke-dashoffset: 0; } }

.tap-meter { margin-top: 24px; text-align: center; transition: opacity .3s; }
.tap-meter .dots { display: flex; gap: 9px; justify-content: center; margin-bottom: 10px; }
.tap-meter .dots i { width: 7px; height: 7px; border: 1px solid rgba(230, 207, 152, .55); transform: rotate(45deg); transition: background .2s, transform .2s, box-shadow .2s; }
.tap-meter .dots i.on { background: var(--gold-2); border-color: var(--gold-2); transform: rotate(45deg) scale(1.25); box-shadow: 0 0 10px var(--gold); }
.tap-meter p { margin: 0; font-style: italic; font-size: 24px; color: var(--ivory); animation: pulseTxt 1.6s ease-in-out infinite; }
@keyframes pulseTxt { 50% { opacity: .5; } }

.tap-fx {
  position: fixed; z-index: 70; pointer-events: none; font-size: 18px; color: #f0d9a0;
  text-shadow: 0 0 8px rgba(255, 220, 140, .9);
  transform: translate(-50%, -50%); animation: tapfx .7s ease-out forwards;
}
@keyframes tapfx { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.4); opacity: 0; } }

/* Рамка с видео */
.polaroid {
  position: relative; width: min(90vw, 430px);
  padding: 12px 12px 16px;
  background: linear-gradient(180deg, #f6eedd, #eadcc0);
  outline: 1px solid rgba(143, 111, 50, .55); outline-offset: -6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  animation: reveal .85s cubic-bezier(.25, 1.25, .5, 1) both;
}
@keyframes reveal {
  0% { transform: perspective(1000px) rotateY(95deg) scale(.6); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: perspective(1000px) rotateY(0) scale(1); }
}
.polaroid.bonus-card { box-shadow: 0 0 0 2px var(--gold-2), 0 0 40px rgba(201, 164, 92, .35), 0 30px 80px rgba(0, 0, 0, .6); }

.vid-box { position: relative; background: #04110b; overflow: hidden; display: grid; place-items: center; min-height: 120px; }
.vid-box video { display: block; width: 100%; max-height: 56vh; max-height: 56dvh; object-fit: contain; background: #04110b; }
.vid-box .play-ico {
  position: absolute; inset: 0; margin: auto; width: 70px; height: 70px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--sans); font-size: 22px; color: var(--gold-2); padding-left: 4px;
  background: rgba(4, 17, 11, .55); border: 1px solid rgba(230, 207, 152, .7);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.vid-box.paused .play-ico { opacity: 1; }
.vid-box .vid-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .15); }
.vid-box .vid-progress i { display: block; height: 100%; width: 0; background: var(--gold-2); }
.vid-box .loading { position: absolute; padding: 0 16px; text-align: center; color: var(--ivory); font-style: italic; font-size: 22px; }

.pol-caption { padding: 12px 6px 0; text-align: center; }
.pol-caption .from { font-family: var(--sans); font-size: 10px; letter-spacing: .32em; text-transform: uppercase; color: var(--gold-3); font-weight: 600; }
.pol-caption h3 { margin: 2px 0 0; font-style: italic; font-weight: 600; font-size: clamp(34px, 9vw, 42px); line-height: 1.05; color: var(--ink); }
.pol-caption p { margin: 2px 0 0; color: #4b5d52; font-size: 17px; }
.pol-photo {
  position: absolute; right: -12px; bottom: 36px; width: 74px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--gold); box-shadow: 0 8px 18px rgba(0, 0, 0, .35); transform: rotate(6deg);
}
.pol-photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

.letter {
  max-height: 46vh; overflow-y: auto; margin-top: 12px; padding: 8px 16px 14px;
  background: repeating-linear-gradient(180deg, transparent 0 31px, rgba(18, 58, 43, .12) 31px 32px);
  color: var(--ink); font-size: clamp(20px, 5.6vw, 23px); line-height: 32px; white-space: pre-line;
  -webkit-user-select: text; user-select: text;
}

.finale-banner { text-align: center; margin-bottom: 20px; animation: noteIn .7s both; }
.finale-banner h2 { margin: 0; text-wrap: balance; font-style: italic; font-weight: 600; font-size: clamp(36px, 10vw, 48px); line-height: 1.05; }
.finale-banner p { margin: 8px 0 0; font-style: italic; font-size: 22px; color: var(--ivory-soft); }

/* Телефон повёрнут горизонтально: видео крупнее, подписи компактнее */
@media (orientation: landscape) and (max-height: 520px) {
  .overlay { padding-top: calc(env(safe-area-inset-top) + 10px); padding-bottom: 10px; }
  .polaroid { width: auto; max-width: 88vw; padding: 8px 8px 10px; }
  .vid-box video { width: auto; height: 60vh; height: 60dvh; max-width: 84vw; max-height: none; }
  .pol-caption { padding-top: 6px; }
  .pol-caption h3 { font-size: 26px; }
  .stage-actions { margin-top: 10px; min-height: 0; }
  .close-btn { top: 10px; right: 10px; }
}

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 80; pointer-events: none; }

/* ---------------- Ложные титры ---------------- */
.ending {
  position: fixed; inset: 0; z-index: 78; display: grid; place-items: center; overflow: hidden;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 20px);
  background: radial-gradient(120% 90% at 50% 40%, #12382a 0%, #04100a 70%);
  box-shadow: 0 0 0 100vmax #04100a;
  color: var(--ivory); text-align: center;
  opacity: 0; transition: opacity .8s ease;
}
.ending.show { opacity: 1; }
.ending::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 3px);
}
.ending-inner { width: 100%; max-width: 420px; }
.end-title { font-style: italic; font-weight: 600; font-size: clamp(64px, 20vw, 92px); line-height: 1; }
.end-sub { margin: 10px 0 20px; font-style: italic; font-size: clamp(22px, 6.5vw, 27px); color: var(--ivory-soft); }
.credits {
  height: 40vh; height: 40dvh; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}
.credits-roll { display: flex; flex-direction: column; gap: 4px; animation: roll 9s linear forwards; }
.credits-roll small { margin-top: 20px; font-family: var(--sans); font-size: 10px; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); font-weight: 500; }
.credits-roll small:first-child { margin-top: 0; }
.credits-roll b { font-style: italic; font-weight: 500; font-size: 26px; line-height: 1.15; }
@keyframes roll { from { transform: translateY(40vh); } to { transform: translateY(-100%); } }

.ending.glitching { animation: flicker .13s steps(2) infinite; }
.ending.glitching::after, .ending.glitch-soft::after { opacity: 1; }
.ending.glitching .ending-inner { animation: glitch .24s steps(2) infinite; }
@keyframes flicker { 50% { background: #2a0a12; } }
@keyframes glitch {
  0%   { transform: translate(0); text-shadow: 3px 0 #ff2a6d, -3px 0 #05d9e8; }
  25%  { transform: translate(-6px, 2px) skewX(10deg); clip-path: inset(10% 0 40% 0); }
  50%  { transform: translate(5px, -3px); clip-path: inset(50% 0 5% 0); filter: hue-rotate(90deg); }
  75%  { transform: translate(-3px, 1px) skewX(-8deg); clip-path: none; text-shadow: -4px 0 #ff2a6d, 4px 0 #05d9e8; }
  100% { transform: translate(0); }
}
.glitch-msg { max-width: 360px; }
.glitch-msg .g1 { margin: 0; font-weight: 600; font-size: clamp(40px, 12vw, 54px); color: var(--ivory); text-shadow: 2px 0 #ff2a6d, -2px 0 #05d9e8; animation: jitter 1.4s infinite; }
.glitch-msg .g2 { margin: 14px 0 0; font-style: italic; font-size: clamp(24px, 7vw, 30px); color: var(--ivory-soft); animation: noteIn .7s 1.1s both; }
@keyframes jitter { 0%, 88%, 100% { transform: none; } 90% { transform: translate(-4px, 1px) skewX(12deg); } 94% { transform: translate(3px, -1px); } }

/* ---------------- Входящий звонок (как на телефоне) ---------------- */
.call {
  position: fixed; inset: 0; z-index: 78; overflow: hidden; color: #fff; background: #0c0a0f;
  box-shadow: 0 0 0 100vmax #0c0a0f;
  font-family: -apple-system, "SF Pro Display", system-ui, "Segoe UI", sans-serif;
  opacity: 0; transition: opacity .5s ease;
}
.call.show { opacity: 1; }
.call-bg {
  position: absolute; inset: -60px; background: radial-gradient(circle at 50% 30%, #2c4a3e, #07100c 70%) center / cover no-repeat;
  filter: blur(34px) brightness(.5) saturate(1.2); transform: scale(1.1);
}
.call-screen, .call-live { position: absolute; inset: 0; }
.call-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center;
  padding: calc(env(safe-area-inset-top) + 70px) 24px calc(env(safe-area-inset-bottom) + 48px);
}
.call-top { display: flex; flex-direction: column; align-items: center; }
.call-avatar {
  position: relative; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(160deg, #8e8e93, #4a4a4f); font-size: 54px; font-weight: 300; margin-bottom: 18px;
}
.call-avatar::before, .call-avatar::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45);
  animation: ring 2s ease-out infinite;
}
.call-avatar::after { animation-delay: 1s; }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.call-name { margin: 0; font-size: 32px; font-weight: 500; letter-spacing: -.01em; }
.call-sub { margin: 6px 0 0; font-size: 17px; opacity: .75; }
.call.connecting .call-btns { opacity: 0; pointer-events: none; transition: opacity .3s; }
.call.connecting .call-avatar::before, .call.connecting .call-avatar::after { animation-duration: .8s; }
.call-toast {
  max-width: 300px; padding: 12px 18px; border-radius: 16px; font-size: 17px; line-height: 1.3;
  background: rgba(255, 255, 255, .16); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.call-toast.pop { animation: toastIn .45s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes toastIn { from { transform: scale(.7); opacity: 0; } }
.call-btns { width: 100%; max-width: 330px; display: flex; justify-content: space-between; }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 15px; color: #fff; transition: transform .35s cubic-bezier(.3, 1.5, .5, 1), opacity .35s; }
.call-btn i { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; }
.call-btn.decline i, .call-btn.hangup i { background: #ff3b30; }
.call-btn.decline svg, .call-btn.hangup svg { transform: rotate(135deg); }
.call-btn.accept i { background: #34c759; animation: callPulse 1.3s ease-in-out infinite; }
@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .6); transform: rotate(0); }
  10% { transform: rotate(-14deg); } 20% { transform: rotate(14deg); } 30% { transform: rotate(-10deg); } 40% { transform: rotate(0); }
  70% { box-shadow: 0 0 0 20px rgba(52, 199, 89, 0); }
}
.call-btn.decline.shy { transform: translate(-18px, 30px) scale(.7); opacity: .55; }
.call-btn.decline.gone { transform: translate(-60px, 80px) scale(0); opacity: 0; pointer-events: none; }

.call-live { background: rgba(0, 0, 0, .35); }
.call-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; }
.call-hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top) + 16px) 16px 40px;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent);
}
.call-hud b { font-size: 22px; font-weight: 600; }
.call-hud span { font-size: 15px; opacity: .8; font-variant-numeric: tabular-nums; }
.call-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; font-size: 22px; opacity: .85; }
.call-btn.hangup { position: absolute; z-index: 2; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 36px); transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) {
  .orb, .bg-photo, .speck, .slot.current .gift, .slot.current .gift::after, .btn-gold::after,
  .gold-text, .intro-name, .board-name, .end-title, .finale-banner h2, .monogram span { animation: none !important; }
}
