:root {
  --sky-top: #b9d6fb;
  --sky-bot: #e6f0fd;
  --ink: #1f2f5c;
  --ink-soft: #5a6a92;
  --ice: #eaf4ff;
  --ice-edge: #bcd5f4;
  --coral: #ff6a5c;
  --coral-dark: #e8524a;
  --paper: #fdf7ea;
  --navy: #22325f;
  --green: #2f9e62;
  --radius: 22px;
  --shadow: 0 10px 30px -12px rgba(40, 70, 140, .35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, #cfe2fb 40%, var(--sky-bot) 100%) fixed;
  overflow-x: hidden;
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.bg-hills { position: fixed; left: 50%; top: 190px; width: min(100%, 760px); aspect-ratio: 400 / 220; transform: translateX(-50%); z-index: 0; pointer-events: none; }
.bg-hills::after { content: ""; position: fixed; left: -50vw; right: -50vw; top: 99%; height: 100vh; background: linear-gradient(#e8f1fd, var(--sky-bot)); }
.bg-hills svg { width: 100%; height: 100%; }


main { position: relative; z-index: 2; max-width: 560px; margin: 0 auto; padding: 0 14px 60px; overflow-x: clip; }

/* ---------- табличка ---------- */
.sign-wrap { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 0; }
.ropes { width: 300px; height: 96px; display: block; }
.rope { stroke: #9a6a3e; stroke-width: 5; stroke-dasharray: 7 4; stroke-linecap: round; }
.bulbs circle { fill: #ffe27a; filter: drop-shadow(0 0 5px #ffd84a); animation: blink 1.6s infinite ease-in-out; }
.bulbs circle:nth-child(2n) { animation-delay: .8s; fill: #fff1b0; }
@keyframes blink { 50% { opacity: .35; filter: none; } }
.sign { position: relative; margin-top: -8px; width: min(340px, 92vw); animation: sway 7s ease-in-out infinite; transform-origin: 50% -100px; }
@keyframes sway { 0%,100% { transform: rotate(-.8deg); } 50% { transform: rotate(.8deg); } }
.sign-board {
  position: relative; text-align: center; padding: 34px 20px 22px;
  background:
    radial-gradient(120% 70% at 50% 0%, #ffffff 0%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, #f3f9ff 0%, #ddecff 100%);
  border-radius: 28px;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px #c4daf6,
    inset 0 -8px 0 rgba(150, 190, 235, .25),
    0 22px 40px -16px rgba(40, 80, 160, .45);
}
.snowcap { position: absolute; top: -18px; left: -8px; width: calc(100% + 16px); height: 50px; z-index: 2; filter: drop-shadow(0 3px 2px rgba(110, 150, 210, .25)); }
.bow { position: absolute; top: -44px; left: 50%; width: 150px; transform: translateX(-50%); z-index: 3; filter: drop-shadow(0 3px 3px rgba(120, 30, 30, .25)); }
.corner-flake { position: absolute; top: 46px; font-size: 18px; color: #9cc0ee; }
.corner-flake.l { left: 22px; } .corner-flake.r { right: 22px; }
.portrait {
  position: relative; z-index: 1; width: 124px; height: 124px; margin: 6px auto 0; border-radius: 50%; padding: 5px;
  background: conic-gradient(from 200deg, #ffe08a, #e2a52b, #fff1c2, #d9951c, #ffe08a);
  box-shadow: 0 8px 20px -6px rgba(180, 120, 20, .55), 0 0 0 4px #fff;
  animation: bob 4s ease-in-out infinite;
}
.portrait img { display: block; width: 100%; height: 100%; border-radius: 50%; }
@keyframes bob { 50% { transform: translateY(-4px); } }
h1 { margin: 14px 0 2px; font-size: 27px; font-weight: 900; letter-spacing: -.3px; position: relative; }
.sub { margin: 0 0 14px; font-size: 14px; color: var(--ink-soft); font-weight: 700; position: relative; }
.date-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; background: #fff; border: 1.5px solid #d3e3f8; padding: 7px 14px; border-radius: 99px; font-size: 14px; font-weight: 800; }
.hero-action { margin-top: 16px; }
.hero-action:empty { display: none; }
.hero-action .btn-primary { font-size: 18px; padding: 15px; animation: nudge 2.8s ease-in-out infinite; }
.state-chip { display: inline-flex; align-items: center; gap: 6px; background: #e3f6ea; color: #1f7a46; font-weight: 900; font-size: 15px; padding: 9px 16px; border-radius: 99px; }

/* ---------- карточки ---------- */
.card { position: relative; background: rgba(255, 255, 255, .82); backdrop-filter: blur(6px); border-radius: var(--radius); padding: 20px; margin-top: 18px; box-shadow: var(--shadow); border: 1.5px solid rgba(255, 255, 255, .9); }
.card h2 { margin: 0 0 12px; font-size: 19px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.card p { margin: 0; line-height: 1.5; font-size: 15px; }
.muted { color: var(--ink-soft); }

/* таймер */
.timer-card { text-align: center; margin-top: 26px; background: linear-gradient(180deg, #2b3f7a, #1d2b58); color: #fff; border: none; overflow: hidden; }
.timer-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 20% 0%, rgba(255,255,255,.15), transparent 50%), radial-gradient(circle at 90% 100%, rgba(255,106,92,.25), transparent 50%); }
.timer-card .label { font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.timer-card .date { font-size: 15px; font-weight: 800; margin-top: 4px; }
.countdown { display: flex; justify-content: center; gap: 8px; margin: 16px 0 6px; position: relative; z-index: 1; }
.unit { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.unit small { font-size: 11px; font-weight: 800; opacity: .7; text-transform: uppercase; letter-spacing: .06em; }
.digits { display: flex; gap: 3px; }
.digit { position: relative; width: 30px; height: 44px; perspective: 200px; }
.digit .face { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 900; background: linear-gradient(180deg, #fff 50%, #eef4ff 50%); color: var(--navy); border-radius: 8px; box-shadow: 0 3px 0 rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
.digit .face::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(30, 50, 100, .18); }
.digit.flip .face { animation: flip .5s cubic-bezier(.3,.7,.4,1); }
@keyframes flip { 0% { transform: rotateX(0); } 45% { transform: rotateX(-90deg); } 55% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.sep { font-size: 26px; font-weight: 900; padding-top: 6px; opacity: .6; animation: pulse 1s steps(1) infinite; }
@keyframes pulse { 50% { opacity: .15; } }

/* конверт-приглашение */
.envelope { background: var(--paper); border: none; padding: 26px 22px 22px; }
.envelope::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); padding: 7px; pointer-events: none;
  background: repeating-linear-gradient(135deg, #e9555a 0 14px, transparent 14px 22px, #4d7fd6 22px 36px, transparent 36px 44px);
  -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.envelope .stamp { position: absolute; right: 16px; top: 14px; width: 74px; transform: rotate(6deg); }
.envelope h2 { padding-right: 70px; }
.ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #fff; box-shadow: 0 2px 6px rgba(60, 90, 160, .15); font-size: 20px; flex: none; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.fact { display: flex; gap: 10px; align-items: flex-start; }
.fact b { display: block; font-size: 14px; }
.fact span { font-size: 13.5px; color: var(--ink-soft); font-weight: 700; }

/* шаги */
.steps { display: grid; gap: 10px; }
.step { display: flex; gap: 12px; align-items: center; background: linear-gradient(180deg, #f3f8ff, #e2eefe); border-radius: 16px; padding: 12px 14px; }
.step .n { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 14px; flex: none; }
.step p { font-size: 14px; font-weight: 700; }

/* кнопки */
.btn { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 16px; padding: 16px; font: inherit; font-size: 17px; font-weight: 900; cursor: pointer; transition: transform .12s, box-shadow .12s, opacity .2s; }
.btn:active { transform: translateY(2px) scale(.99); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 5px 0 var(--coral-dark), 0 12px 24px -8px rgba(255, 106, 92, .6); }
.btn-primary:active { box-shadow: 0 2px 0 var(--coral-dark); }
.btn-soft { background: #fff; color: var(--ink); box-shadow: 0 3px 0 #cfdcf0; font-size: 15px; padding: 13px; }
.btn-ghost { background: transparent; color: var(--ink-soft); font-size: 15px; padding: 12px; }
.btn-danger { background: transparent; color: #c94545; font-size: 14px; padding: 10px; }
.cta { margin-top: 20px; }
.cta .btn-primary { animation: nudge 2.8s ease-in-out infinite; }
@keyframes nudge { 0%, 85%, 100% { transform: none; } 90% { transform: rotate(-2deg) scale(1.02); } 95% { transform: rotate(2deg) scale(1.02); } }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

/* участники */
.section-title { margin: 28px 4px 12px; font-size: 19px; font-weight: 900; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.person { position: relative; background: linear-gradient(180deg, #f4f9ff, #dfeefe); border-radius: 18px; padding: 16px 10px 12px; text-align: center; box-shadow: 0 6px 16px -10px rgba(40, 80, 160, .5); animation: pop .4s backwards; }
.person::before { content: ""; position: absolute; top: -6px; left: 18%; width: 42%; height: 14px; background: #fff; border-radius: 12px 14px 8px 8px; box-shadow: 30px 2px 0 -3px #fff; }
.person .av { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; font-size: 28px; border: 3px dashed #4b5f96; outline: 3px solid var(--navy); outline-offset: -1px; }
.person .nm { font-weight: 900; font-size: 15px; line-height: 1.2; word-break: break-word; }
.person .un { font-size: 12.5px; font-weight: 800; color: #3d6fc4; margin-top: 2px; word-break: break-all; }
.person .st { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-top: 3px; }
.person.me { background: linear-gradient(180deg, #fff6e9, #ffe7cf); }
.person .x { position: absolute; right: 6px; top: 6px; border: 0; background: #fff; border-radius: 50%; width: 26px; height: 26px; color: #c94545; font-weight: 900; cursor: pointer; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.empty { text-align: center; padding: 24px; color: var(--ink-soft); font-weight: 700; background: rgba(255,255,255,.6); border-radius: 18px; }

/* мои данные */
.mine { display: grid; gap: 8px; margin-top: 4px; }
.mine div { display: flex; gap: 10px; font-size: 14.5px; }
.mine dt, .mine .k { color: var(--ink-soft); font-weight: 700; min-width: 74px; }
.mine .v { font-weight: 800; word-break: break-word; }
.ok-badge { display: inline-flex; align-items: center; gap: 6px; background: #e3f6ea; color: #1f7a46; font-weight: 800; font-size: 13px; padding: 5px 12px; border-radius: 99px; margin-bottom: 10px; }
.warn { background: #fff4e0; border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 700; margin-top: 12px; }
.warn .btn { margin-top: 10px; }

/* получатель — конверт раскрывается */
.reveal { text-align: center; padding-top: 26px; }
.mail { position: relative; width: 260px; height: 170px; margin: 96px auto 8px; }
.mail .back { position: absolute; inset: 0; background: #e9d6b0; border-radius: 12px; }
.mail .letter { position: absolute; left: 16px; right: 16px; top: 18px; height: 140px; background: #fff; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.12); display: grid; place-items: center; font-size: 46px; transition: transform .9s cubic-bezier(.2,.8,.2,1) .5s; }
.mail .front { position: absolute; inset: 0; border-radius: 12px; background: linear-gradient(155deg, transparent 49.5%, #f3e3c1 50%) left / 50% 100% no-repeat, linear-gradient(205deg, transparent 49.5%, #f3e3c1 50%) right / 50% 100% no-repeat; }
.mail .front::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 58%; background: #f7ead0; clip-path: polygon(0 100%, 50% 18%, 100% 100%); border-radius: 0 0 12px 12px; }
.mail .flap { position: absolute; left: 0; right: 0; top: 0; height: 56%; background: #ecd8b0; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .6s ease; z-index: 3; }
.mail .seal { position: absolute; left: 50%; top: 44%; width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; background: #d8343a; z-index: 4; display: grid; place-items: center; color: #fff; font-size: 16px; box-shadow: 0 2px 0 #a92228; transition: opacity .3s; }
.mail.open .flap { transform: rotateX(180deg); z-index: 0; }
.mail.open .seal { opacity: 0; }
.mail.open .letter { transform: translateY(-70px); }
.recipient { margin-top: 6px; text-align: left; opacity: 0; transform: translateY(10px); transition: all .6s ease 1.2s; }
.mail.open + .recipient { opacity: 1; transform: none; }
.recipient .big { text-align: center; font-size: 22px; font-weight: 900; margin: 4px 0 14px; }
.copy { border: 0; background: #eef4ff; color: var(--ink); border-radius: 10px; padding: 3px 8px; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; margin-left: 6px; }
.track { display: flex; gap: 8px; margin-top: 12px; }
.track input { flex: 1; }

/* форма */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(20, 35, 75, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet-backdrop[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--paper); border-radius: 26px 26px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .35s cubic-bezier(.2,.9,.3,1); }
@keyframes up { from { transform: translateY(100%); } }
.sheet-handle { width: 44px; height: 5px; border-radius: 9px; background: #d9cdb4; margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.hint { margin: 0 0 14px; color: var(--ink-soft); font-size: 14px; font-weight: 700; }
label { display: block; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.opt { color: var(--ink-soft); font-weight: 700; font-size: 12px; }
input, textarea { display: block; width: 100%; margin-top: 6px; padding: 13px 14px; border-radius: 14px; border: 2px solid #e8dcc2; background: #fff; font: inherit; font-size: 16px; font-weight: 700; color: var(--ink); resize: none; outline: none; transition: border-color .15s; }
input:focus, textarea:focus { border-color: #7aa7e6; }
.small-link { display: inline-block; margin-top: 6px; font-size: 13px; color: #3d6fc4; font-weight: 800; text-decoration: none; }
.form-error { background: #ffe5e2; color: #b3322b; border-radius: 12px; padding: 10px 12px; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.sheet .btn-primary { margin-top: 6px; }

.loader { width: 34px; height: 34px; margin: 40px auto; border-radius: 50%; border: 4px solid #c7dbf7; border-top-color: var(--coral); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; font-size: 14px; box-shadow: var(--shadow); animation: up .3s; max-width: 90vw; text-align: center; }
.confetti { position: fixed; top: -10px; width: 9px; height: 14px; z-index: 25; pointer-events: none; animation: fall linear forwards; border-radius: 2px; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.admin { background: rgba(255, 255, 255, .7); border: 2px dashed #b9cbe8; }
.admin h2 { font-size: 16px; }
.admin ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 360px) { .digit { width: 25px; height: 38px; } .digit .face { font-size: 23px; } .facts { grid-template-columns: 1fr; } }
.envelope h2 + p { padding-right: 64px; }
