/* Стиль «Праздник»: светлая и тёмная версии (тема берётся из Telegram, см. app.js).
   Встроенные атрибуты style запрещены политикой CSP: всё оформление - только здесь. */
:root {
  --bg: #f6f3fb; --card: #ffffff; --text: #1d1530; --hint: #736b89; --line: #f0ecf6; --field: #f6f3fb;
  --accent: #7a3cf0; --soft: #f0e9ff; --danger: #d6336c; --ok-bg: #e3f6ec; --ok: #14794a;
  --grad: linear-gradient(100deg, #7a3cf0, #d4429f);
  --party: linear-gradient(135deg, #6d34e8, #c93f9f 62%, #f4775f);
  --shadow: 0 6px 20px rgba(64, 34, 120, .07);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #120e1d; --card: #1e182e; --text: #f4f0fc; --hint: #a69dbd; --line: #2d2542; --field: #161124;
  --accent: #b592ff; --soft: #32264f; --danger: #ff7ba5; --ok-bg: #16372a; --ok: #70dca6;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

header { max-width: 640px; margin: 0 auto; padding: 14px 16px 0; }
main { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(116px + env(safe-area-inset-bottom)); }
main > * { animation: rise .32s cubic-bezier(.2, .7, .3, 1) both; }
main > :nth-child(2) { animation-delay: .03s; }
main > :nth-child(3) { animation-delay: .06s; }
main > :nth-child(4) { animation-delay: .09s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.over { font-size: 13px; color: var(--hint); }
h1 { font-size: 28px; line-height: 1.15; font-weight: 750; letter-spacing: -.025em; margin: 2px 0 16px; overflow-wrap: anywhere; }
h2 { font-size: 13px; font-weight: 650; color: var(--hint); margin: 20px 4px 8px; }

textarea { resize: vertical; }
.pre { white-space: pre-line; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--field); border: 1.5px solid transparent; border-radius: 14px; padding: 12px 14px; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; }
select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 16px; padding-left: 14px; margin-bottom: 14px; color: var(--hint); box-shadow: var(--shadow); }
.search input { background: transparent; padding-left: 4px; }
.search:focus-within { outline: 2px solid var(--accent); }
.search input:focus { border-color: transparent; }

.card { background: var(--card); border-radius: 22px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.list { background: var(--card); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
button.item { cursor: pointer; }
button.item:active { background: var(--soft); }
.item + .item { border-top: 1px solid var(--line); }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.name { font-weight: 650; }
.sub { font-size: 13px; color: var(--hint); }
.days { flex: none; text-align: right; }
.days b { display: block; font-size: 19px; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.days span { font-size: 11px; color: var(--hint); }

.ava { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff; text-transform: uppercase; }
.g0 { background: linear-gradient(135deg, #ff8d6c, #f04f86); }
.g1 { background: linear-gradient(135deg, #7b86ff, #9d52e8); }
.g2 { background: linear-gradient(135deg, #28b89a, #2484c9); }
.g3 { background: linear-gradient(135deg, #f7ad3c, #ee7434); }

.hero { position: relative; overflow: hidden; border-radius: 28px; padding: 20px; margin-bottom: 12px; color: #fff; background: var(--party); }
.hero .ava { position: relative; width: 60px; height: 60px; font-size: 24px; background: #fff; color: #6d34e8; }
.hero h3 { position: relative; margin: 14px 0 6px; font-size: 25px; line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }
.tag { position: relative; display: inline-block; font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 99px; background: rgba(40, 8, 70, .28); }
.hero .when { position: relative; margin-left: 8px; font-size: 13px; font-weight: 600; }
.confetti { position: absolute; top: 0; right: 0; width: 170px; height: 140px; fill: #fff; }
.confetti > * { animation: float 3.6s ease-in-out infinite alternate; }
.confetti > :nth-child(odd) { animation-delay: -1.8s; }
@keyframes float { to { transform: translateY(5px); } }

button.primary, button.secondary, button.plain, button.light { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 16px; padding: 14px; margin-top: 10px; font: inherit; font-weight: 700; cursor: pointer; transition: transform .12s, opacity .12s; }
button.primary { background: var(--grad); color: #fff; }
button.secondary { background: var(--soft); color: var(--accent); }
button.plain { background: transparent; color: var(--hint); font-weight: 600; padding: 10px; }
button.light { position: relative; background: #fff; color: #5f27d6; margin-top: 18px; }
button:active { transform: scale(.98); }
button:disabled { opacity: .55; }
.back { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--card); color: var(--accent); font: inherit; font-weight: 650; padding: 9px 14px 9px 11px; border-radius: 99px; margin-bottom: 14px; cursor: pointer; box-shadow: var(--shadow); }
.back svg.i { width: 18px; height: 18px; }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.chip { flex: none; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 99px; background: var(--soft); color: var(--accent); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.off { background: var(--field); color: var(--hint); }
.sum { margin-top: 12px; font-size: 38px; line-height: 1.1; font-weight: 780; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.sum small { font-size: 18px; font-weight: 600; letter-spacing: 0; }
.note { background: var(--soft); border-radius: 14px; padding: 11px 13px; margin-top: 12px; font-size: 14px; }

.bank { position: relative; overflow: hidden; border-radius: 20px; padding: 18px; margin: 14px 0 4px; color: #fff; background: linear-gradient(135deg, #4d23c4, #a8348f 68%, #d95f6b); }
.bank::after { content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%; right: -64px; top: -104px; background: rgba(255, 255, 255, .12); }
.bank .kind { font-size: 13px; font-weight: 600; opacity: .92; }
.bank .num { margin: 22px 0 14px; font-size: 20px; letter-spacing: .06em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bank .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; font-size: 13px; }
.bank .foot b { display: block; font-size: 14px; font-weight: 650; }
.bank button { position: relative; z-index: 1; flex: none; display: flex; align-items: center; gap: 6px; border: 0; border-radius: 12px; padding: 9px 13px; background: rgba(255, 255, 255, .22); color: #fff; font: inherit; font-weight: 650; cursor: pointer; }
.bank button svg.i { width: 16px; height: 16px; }
.others { white-space: pre-line; margin-top: 10px; }

.person { text-align: center; padding: 6px 0 4px; }
.person .ava { width: 84px; height: 84px; font-size: 34px; margin: 0 auto 10px; }
.person h1 { margin-bottom: 6px; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--hint); margin: 12px 4px 6px; }
label:first-child { margin-top: 0; }
label.item { margin: 0; font-size: 16px; color: var(--text); cursor: pointer; }
.switch { appearance: none; position: relative; width: 52px; height: 31px; flex: none; margin: 0; padding: 0; border: 0; border-radius: 99px; cursor: pointer; background: #bdb6cd; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 25px; height: 25px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .22); transition: left .18s; }
.switch:checked { background: var(--grad); }
.switch:checked::after { left: 24px; }
.switch:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.stack { margin-bottom: 12px; }

.wish { display: flex; align-items: flex-start; gap: 12px; }
.icon-box { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--soft); color: var(--accent); }
.wish .price { font-weight: 700; color: var(--accent); }
.wish a { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--accent); }
.wish a svg.i { width: 15px; height: 15px; }

.go { flex: none; display: grid; color: var(--hint); }
.go svg.i { width: 18px; height: 18px; }
.badge { flex: none; min-width: 24px; padding: 2px 7px; border-radius: 99px; background: var(--grad); color: #fff; font-size: 13px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.hint { margin: 8px 4px 0; }
.list.stack, .note.stack, .hint.stack { margin-bottom: 12px; }
.note.stack { margin-top: 0; }
.middle { align-self: center; }
.pair { display: flex; gap: 8px; }
button.secondary.danger, button.plain.danger { color: var(--danger); }

summary { cursor: pointer; font-weight: 700; color: var(--accent); }
details[open] summary { margin-bottom: 10px; }


.empty { text-align: center; color: var(--hint); padding: 46px 12px; }
.empty .icon-box { width: 76px; height: 76px; border-radius: 26px; margin: 0 auto 14px; }
.empty .icon-box svg.i { width: 36px; height: 36px; }
.skeleton { height: 76px; border-radius: 22px; margin-bottom: 12px; background: var(--card); animation: pulse 1.1s ease-in-out infinite alternate; }
.skeleton.tall { height: 190px; }
@keyframes pulse { to { opacity: .45; } }

nav { position: fixed; z-index: 2; left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 612px; margin: 0 auto; display: flex; gap: 4px; padding: 8px; border-radius: 28px; background: var(--card); box-shadow: 0 10px 34px rgba(30, 12, 66, .18); }
nav button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; border-radius: 20px; padding: 8px 2px; background: none; color: var(--hint); font: inherit; font-size: 11px; line-height: 1.2; font-weight: 650; text-align: center; cursor: pointer; transition: background .18s, color .18s; }
nav button.active { background: var(--soft); color: var(--accent); }
#toast { position: fixed; z-index: 3; left: 20px; right: 20px; bottom: calc(100px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; padding: 13px 16px; border-radius: 16px; background: #2a2140; color: #fff; font-weight: 600; text-align: center; animation: rise .22s both; }
#sheet { position: fixed; z-index: 4; inset: 0; display: flex; align-items: flex-end; background: rgba(16, 8, 34, .55); }
.sheet-box { width: 100%; max-width: 640px; margin: 0 auto; padding: 22px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: var(--card); animation: up .25s cubic-bezier(.2, .8, .3, 1) both; }
.sheet-box p { margin: 0 6px 8px; font-weight: 600; text-align: center; }
@keyframes up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

header { display: flex; justify-content: flex-end; }
header select { width: auto; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: var(--card); border: 0; border-radius: 99px; padding: 7px 12px; box-shadow: var(--shadow); }
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.segments { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.segments button { flex: 1; min-width: 0; border: 0; border-radius: 14px; padding: 10px 6px; background: none; color: var(--hint); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.segments button.active { background: var(--soft); color: var(--accent); }
.rows { margin: 10px 0 0; padding: 0; list-style: none; }
.rows li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rows li b { flex: none; font-variant-numeric: tabular-nums; }
.about { white-space: pre-wrap; font-size: 14px; }
.card h3 { margin: 0; font-size: 18px; }
.card details { margin-top: 10px; }
.card .bank { margin-top: 12px; }
.result { border: 1.5px solid var(--accent); }

/* новогоднее оформление: касания проходят сквозь него */
.fest-top, .fest-guest { position: fixed; pointer-events: none; }
.fest-top { top: 0; left: 0; width: min(150px, 42vw); aspect-ratio: 1004 / 480; z-index: 1; }
.fest-top.fest-independence, .fest-top.fest-homeland { width: min(130px, 36vw); aspect-ratio: 1; }
.fest-navruz { width: min(160px, 44vw); aspect-ratio: 19 / 13; }
.fest-top.wide { left: 50%; transform: translateX(-50%); width: min(100%, 520px); aspect-ratio: 1; opacity: .85; }
.fest-guest { bottom: calc(76px + env(safe-area-inset-bottom)); width: 84px; height: 160px; z-index: 4; }
.fest-guest.right { right: 0; }
.fest-guest.left { left: 0; }
[data-theme="dark"] .fest-newyear { filter: drop-shadow(0 0 1px rgba(255, 255, 255, .75)); }   /* чёрный провод на тёмном фоне */
