/* «Kabutar parvozi» */
:root { --plum: #5B3A52; --rose: #D9708F; --gold: #C9A05A; --acc: #E0789D; --accd: #B9567C; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #F3D6BE; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
body { font-family: 'Cormorant Garamond', Georgia, serif; color: var(--plum); -webkit-font-smoothing: antialiased; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#mist { position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(255,255,255,.97), rgba(255,246,248,.88) 55%, rgba(255,236,242,.74)); }

/* ——— заставка ——— */
#splash { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
  background: linear-gradient(180deg, #A8CBEA 0%, #F4DDCB 46%, #FFD5A9 72%, #F6B8A8 100%); transition: opacity 1.1s ease, visibility 1.1s; }
#splash.out { opacity: 0; visibility: hidden; }
.sp-glow { position: absolute; left: 50%; top: 56%; width: 130vmax; height: 130vmax; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255,247,222,.95), rgba(255,232,196,.35) 18%, rgba(255,230,190,0) 42%); animation: spglow 4s ease-in-out infinite alternate; }
@keyframes spglow { to { transform: translate(-50%, -50%) scale(1.08); } }
.sp-dove { position: relative; width: 220px; max-width: 60vw; filter: drop-shadow(0 12px 16px rgba(150,80,110,.25)); animation: spfloat 3.2s ease-in-out infinite; }
.sp-dove .w1 { transform-origin: 116px 86px; animation: spflap .5s ease-in-out infinite alternate; }
.sp-dove .w2 { transform-origin: 112px 82px; animation: spflap .5s ease-in-out .06s infinite alternate; }
.sp-dove .rib { animation: sprib 1.2s ease-in-out infinite alternate; transform-origin: 188px 82px; }
@keyframes spflap { from { transform: scaleY(1); } to { transform: scaleY(-.5); } }
@keyframes spfloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes sprib { to { transform: rotate(-8deg); } }
.sp-k { position: relative; margin: 22px 0 2px; font: 800 12px 'Nunito', system-ui, sans-serif; letter-spacing: .24em; text-transform: uppercase; color: #9B5C7E; }
.sp-n { position: relative; margin: 0; padding: 0 16px; text-align: center; font: 400 46px/1.15 'Great Vibes', 'Marck Script', cursive; color: #B24F7B; text-shadow: 0 2px 12px rgba(255,255,255,.7); }
.sp-n i { font: italic 500 24px 'Cormorant Garamond', serif; color: #9B5C7E; margin: 0 4px; }
.sp-bar { position: relative; width: 150px; height: 3px; margin-top: 20px; border-radius: 3px; background: rgba(255,255,255,.55); overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #EE85A6, #F2C46A); transition: width .35s ease; }

/* ——— подсказка ——— */
#hint { position: fixed; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 24; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px;
  width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 11px 18px 11px 12px; border-radius: 26px;
  background: rgba(255,255,255,.84); box-shadow: 0 14px 30px -14px rgba(90,40,80,.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transform: translate(-50%, 18px); pointer-events: none; transition: opacity .6s, transform .6s; }
#hint.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.fing { position: relative; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #FDE3EC, #EFE3FB); }
.fing i { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: #E0789D; box-shadow: 0 0 0 5px rgba(224,120,157,.22); animation: fing 2.6s ease-in-out infinite; }
@keyframes fing { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-10px, -6px); } 50% { transform: translate(9px, -9px); } 75% { transform: translate(6px, 8px); } }
.ht { display: flex; flex-direction: column; text-align: left; min-width: 0; }
.ht b { font: 800 14.5px/1.25 'Nunito', system-ui, sans-serif; color: var(--plum); }
.ht small { font: 700 12.5px/1.3 'Nunito', system-ui, sans-serif; color: #9A7090; margin-top: 2px; }
.tiltb { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 99px; padding: 7px 13px 7px 9px; cursor: pointer;
  font: 800 12.5px 'Nunito', system-ui, sans-serif; color: #8E4E73; background: #FBEAF1; box-shadow: 0 0 0 1.5px rgba(224,120,157,.35) inset; }
.tiltb svg, #tilt svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.tiltb.act, #tilt.act { background: linear-gradient(135deg, #EE85A6, #C77CD6); color: #fff; box-shadow: none; }
#tilt { position: fixed; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 25; width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.7); color: #B9568A; box-shadow: 0 8px 18px -10px rgba(80,30,70,.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: pointer; padding: 0; }
#tilt[hidden] { display: none; }
#tilt svg { width: 22px; height: 22px; }

/* ——— точки ——— */
#dots { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 25; display: flex; gap: 10px;
  opacity: 0; transform: translate(-50%, 20px); transition: opacity .6s, transform .6s; pointer-events: none; }
#dots.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.dot { position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.5); box-shadow: 0 8px 18px -10px rgba(80,30,70,.55), 0 0 0 1.5px rgba(255,255,255,.75) inset; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .35s cubic-bezier(.3,1.6,.5,1), background .4s; }
.dot svg { width: 21px; height: 21px; fill: none; stroke: #B79AAE; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke .4s; }
.dot:disabled { cursor: default; opacity: .6; }
.dot.ok { background: rgba(255,255,255,.92); animation: dotpop .6s cubic-bezier(.3,1.6,.5,1); }
.dot.ok svg { stroke: #D9708F; }
.dot.cur { background: linear-gradient(135deg, #EE85A6, #C77CD6); transform: scale(1.08); }
.dot.cur svg { stroke: #fff; }
@keyframes dotpop { 0% { transform: scale(.7); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ——— карточки колец ——— */
#cards { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.card { position: absolute; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); width: min(calc(100vw - 28px), 400px); box-sizing: border-box; padding: 20px 22px 22px; text-align: center;
  border-radius: 28px; background: linear-gradient(165deg, rgba(255,252,248,.95), rgba(255,244,248,.91));
  box-shadow: 0 26px 50px -22px rgba(90,40,80,.6), 0 0 0 1px rgba(255,255,255,.8) inset; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-50%, 46px) scale(.95);
  transition: transform .75s cubic-bezier(.2,.9,.25,1.12), opacity .5s, visibility 0s .75s; }
.card::before { content: ""; position: absolute; inset: 7px; border-radius: 22px; border: 1px solid rgba(201,160,90,.45); pointer-events: none; }
.card.on { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0) scale(1); transition: transform .75s cubic-bezier(.2,.9,.25,1.12), opacity .5s, visibility 0s; }
.card.on .cb > * { animation: rise .8s cubic-bezier(.2,.8,.3,1) both; }
.card.on .cb > *:nth-child(2) { animation-delay: .08s; } .card.on .cb > *:nth-child(3) { animation-delay: .16s; } .card.on .cb > *:nth-child(4) { animation-delay: .24s; } .card.on .cb > *:nth-child(5) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.card.c1 { --acc: #D2A458; --accd: #A87A30; } .card.c2 { --acc: #A688D8; --accd: #7C5DB0; } .card.c3 { --acc: #EC9479; --accd: #C2664C; }
.card .x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; padding: 0; cursor: pointer; z-index: 2;
  font: 400 22px/32px system-ui, sans-serif; color: #9A7090; background: rgba(255,255,255,.75); box-shadow: 0 0 0 1px rgba(201,160,90,.3) inset; }
.card .bar { position: absolute; left: 34px; right: 34px; bottom: 11px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--acc), #F2C46A);
  transform-origin: left center; transform: scaleX(calc(1 - var(--p, 0))); opacity: .7; }
.orn { display: block; width: 132px; height: 15px; margin: 2px auto 6px; }
.orn path { fill: none; stroke: var(--acc); stroke-width: 1.3; stroke-linecap: round; }
.orn circle { fill: var(--acc); stroke: var(--acc); stroke-width: 1; }
.orn circle + circle { fill: none; opacity: .6; }
.cb { position: relative; }
.k { margin: 0 0 4px; font: 800 11.5px 'Nunito', system-ui, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--accd); }
.nm { margin: 0; font: 400 50px/1.02 'Great Vibes', 'Marck Script', cursive; color: #B24F7B; }
.nm span { display: table; margin: 0 auto; white-space: nowrap; }
.nm .cn { display: block; font: italic 500 20px/1.1 'Cormorant Garamond', serif; color: #A07090; margin: 1px 0 3px; }
.hello { margin: 12px 0 2px; font: 700 20px/1.25 'Cormorant Garamond', serif; color: var(--plum); }
.inv { margin: 0; font: italic 500 18.5px/1.3 'Cormorant Garamond', serif; color: #7E5A72; }
.dbig { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 4px; }
.dbig b { font: 700 78px/0.9 'Cormorant Garamond', serif; color: var(--accd); }
.dbig span { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.dbig em { font: italic 600 30px/1 'Cormorant Garamond', serif; color: var(--plum); }
.dbig small { font: 800 13px 'Nunito', system-ui, sans-serif; letter-spacing: .2em; color: #A88; margin-top: 6px; }
.dl { margin: 6px 0 0; font: 700 19px/1.3 'Cormorant Garamond', serif; color: var(--plum); }
.dl.small { font-size: 17px; color: #7E5A72; }
.btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.btns:empty { display: none; }
.cd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 4px; }
.cd div { padding: 10px 2px 8px; border-radius: 16px; background: rgba(255,255,255,.75); box-shadow: 0 0 0 1px rgba(166,136,216,.25) inset; }
.cd b { display: block; font: 700 36px/1 'Cormorant Garamond', serif; color: var(--accd); font-variant-numeric: tabular-nums; }
.cd small { display: block; margin-top: 4px; font: 800 10.5px 'Nunito', system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #9A7FA8; }
.today { margin: 10px 0 0; font: 700 22px/1.25 'Cormorant Garamond', serif; color: var(--accd); }
.hall { margin: 4px 0 2px; font: 700 29px/1.12 'Cormorant Garamond', serif; color: var(--plum); }
.addr { margin: 4px 0 0; font: 500 18.5px/1.3 'Cormorant Garamond', serif; color: #7E5A72; }

/* ——— финальный свиток ——— */
#finale { position: fixed; left: 50%; top: calc(68px + env(safe-area-inset-top)); z-index: 22; width: min(calc(100vw - 40px), 400px);
  opacity: 0; visibility: hidden; transform: translate(-50%, -12px) scale(.96); transition: opacity .8s, transform .9s cubic-bezier(.2,.9,.3,1.1), visibility 0s .9s; }
#finale.on { opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1); transition: opacity .8s, transform .9s cubic-bezier(.2,.9,.3,1.1), visibility 0s; }
.roll { position: relative; z-index: 2; height: 15px; margin: 0 -12px; border-radius: 9px; cursor: pointer;
  background: linear-gradient(180deg, #F9E1A6, #DDAE58 45%, #B8853C); box-shadow: 0 5px 10px -4px rgba(90,50,20,.55); }
.roll::before, .roll::after { content: ""; position: absolute; top: -2px; width: 12px; height: 19px; border-radius: 6px; background: linear-gradient(180deg, #F6D486, #C99540); }
.roll::before { left: -9px; } .roll::after { right: -9px; }
.pw { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 1.6s cubic-bezier(.3,.75,.25,1); }
#finale.on:not(.rolled) .pw { grid-template-rows: 1fr; }
.paper { min-height: 0; overflow: hidden; margin: -4px 0; text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.7), rgba(255,255,255,0) 60%), linear-gradient(180deg, #FFF8EE, #FFF1E4);
  box-shadow: 0 0 0 1px rgba(201,160,90,.25) inset, 0 20px 40px -24px rgba(90,40,60,.6); }
.paper .in { padding: 18px 20px 16px; }
.fnm { font: 400 40px/1.08 'Great Vibes', 'Marck Script', cursive; color: #B24F7B; }
.fnm span { display: inline-block; white-space: nowrap; }
.fnm i { display: inline-block; font: italic 500 18px/1.1 'Cormorant Garamond', serif; color: #A07090; margin: 0 8px; vertical-align: 0.35em; }
.seat { margin: 10px 0 2px; font: 700 22px/1.22 'Cormorant Garamond', serif; color: var(--plum); }
.wait { margin: 0 0 6px; font: italic 600 18.5px/1.25 'Cormorant Garamond', serif; color: #8C5E7C; }
.ar { margin: 4px 0 0; font: 400 30px/1.5 'Amiri', serif; color: #A0744A; }
.ay { margin: 0; font: italic 500 16.5px/1.3 'Cormorant Garamond', serif; color: #6E4E64; }
.ref { margin: 3px 0 0; font: 700 11.5px 'Nunito', system-ui, sans-serif; color: #A28A98; letter-spacing: .03em; }
.paper .btns { margin-top: 12px; }
.fold { position: absolute; right: 22px; bottom: -24px; width: 44px; height: 22px; border: 0; border-radius: 0 0 14px 14px; cursor: pointer; padding: 0;
  background: rgba(255,248,238,.85); box-shadow: 0 8px 14px -8px rgba(90,40,60,.5); }
.fold::after { content: ""; position: absolute; left: 50%; top: 5px; width: 8px; height: 8px; margin-left: -5px; border: solid #B9568A; border-width: 2px 0 0 2px; transform: rotate(45deg); transition: transform .4s; }
#finale.rolled .fold::after { transform: translateY(3px) rotate(225deg); }

body.fin #hint { display: none; }

/* ——— компьютер / широкий экран ——— */
@media (min-aspect-ratio: 1/1) and (min-width: 760px) {
  .card { left: max(28px, 5vw); top: 50%; bottom: auto; width: 410px; transform: translate(-30px, -50%) scale(.96); }
  .card.on { transform: translate(0, -50%) scale(1); }
  #finale { left: max(28px, 6vw); top: 50%; width: 420px; transform: translate(0, calc(-50% - 12px)) scale(.97); }
  #finale.on { transform: translate(0, -50%) scale(1); }
  /* свёрнутый свиток (открыта карточка) — наверх под значок, не поверх карточки */
  #finale.on.rolled { top: calc(96px + env(safe-area-inset-top)); transform: translate(0, 0) scale(1); }
  #hint { bottom: 92px; }
  .nm { font-size: 56px; }
}
@media (max-height: 700px) and (max-aspect-ratio: 1/1) {
  .nm { font-size: 42px; } .fnm { font-size: 36px; } .dbig b { font-size: 64px; } .card { padding: 16px 18px 18px; }
  .ar { font-size: 26px; } .seat { font-size: 20px; } .paper .in { padding: 12px 16px; }
}
