/* Вечерок — «Ночной попкорн»: спокойная ночная раскладка + тёплые сочные акценты, маскот-проектор.
   Тёмная тема по умолчанию, светлая — через [data-theme="light"]. */
:root, [data-theme="dark"] {
  --bg: #0f0c22; --bg-2: #141030; --surface: #1b1638; --surface-2: #272050; --surface-3: #332a66;
  --text: #fff5e6; --muted: #b8b0d6; --faint: #8d84b3;
  --accent: #ff5c78; --accent-press: #a3203a; --accent-ink: #ffffff;
  --yellow: #ffd23f; --mint: #2ad1a3; --violet: #8a63ff; --pink: #ffb3c1; --mint-soft: #b9f2df;
  --on-color: #1d1438;
  --card: #18142f; --card-ink: #fff5e6;
  --why-bg: #2b2540; --why-label: #ffd23f;
  --line: rgba(255, 245, 230, .1); --line-strong: rgba(255, 245, 230, .26);
  --scrim: rgba(6, 4, 16, .72); --shadow: 0 18px 40px rgba(0, 0, 0, .35);
  --pop: 0 4px 0 rgba(0, 0, 0, .35);
  --error: #ff9aa9;
  --glow-a: rgba(138, 99, 255, .30); --glow-b: rgba(255, 92, 120, .18);
  color-scheme: dark;

  --display: "Rubik", "Manrope", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 64px;
  --col: 600px;
  --ease-spring: cubic-bezier(.2, .9, .3, 1.15);
}
[data-theme="light"] {
  --bg: #fff7ec; --bg-2: #fff1dc; --surface: #ffffff; --surface-2: #ffeccc; --surface-3: #ffe0a8;
  --text: #1d1438; --muted: #5c5277; --faint: #7a7094;
  --accent: #e2264a; --accent-press: #a3203a; --accent-ink: #ffffff;
  --card: #ffffff; --card-ink: #1d1438;
  --why-bg: #fff3c4; --why-label: #a3203a;
  --line: rgba(29, 20, 56, .1); --line-strong: rgba(29, 20, 56, .24);
  --scrim: rgba(29, 20, 56, .42); --shadow: 0 14px 34px rgba(120, 60, 40, .14);
  --pop: 0 4px 0 rgba(29, 20, 56, .16);
  --error: #b3122f;
  --glow-a: rgba(138, 99, 255, .16); --glow-b: rgba(255, 92, 120, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  color: var(--text); font: 400 16px/1.5 var(--body);
  background:
    radial-gradient(70% 380px at 100% 0, var(--glow-a), transparent 70%),
    radial-gradient(60% 320px at 0 60px, var(--glow-b), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  transition: background-color .3s, color .3s;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 10px; }
[data-theme="light"] :focus-visible { outline-color: var(--violet); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── шапка ── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: var(--col); margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 4px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; min-height: 44px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.brand-name { font: 800 23px/1 var(--display); letter-spacing: -.02em; }
.brand-name::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 3px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); transition: transform .15s;
}
.icon-btn:active { transform: scale(.94); }
[data-theme="dark"] .i-moon, [data-theme="light"] .i-sun { display: none; }
.premium-btn {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--yellow); color: var(--on-color); font-weight: 800; font-size: 13px; box-shadow: var(--pop);
}

main { max-width: var(--col); margin: 0 auto; padding: 0 16px; }
.view { padding-top: 8px; animation: fade-in .35s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

.eyebrow {
  display: inline-block; margin: 0 0 10px; padding: 6px 10px; border-radius: 99px;
  background: var(--mint); color: #0e2a20; font: 800 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase;
}
.h1 { font: 800 31px/1.06 var(--display); letter-spacing: -.02em; margin: 0 0 10px; max-width: 11ch; text-wrap: balance; }
.h1-page { max-width: none; margin-top: 14px; }
.h2 { font: 800 21px/1.2 var(--display); letter-spacing: -.01em; margin: 0 0 8px; text-wrap: balance; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 44ch; }
.note { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.note.small { font-size: 13px; }
.note a { color: var(--text); text-underline-offset: 3px; }
.error { color: var(--error); margin: 12px 0; font-weight: 600; }
.status { color: var(--muted); text-align: center; margin: 20px 0; min-height: 1.5em; }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

/* ── кнопки ── */
.cta {
  min-height: 56px; padding: 0 26px; border: 0; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent); color: var(--accent-ink); font: 800 17px/1 var(--display);
  box-shadow: 0 5px 0 var(--accent-press), 0 14px 30px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.cta:not(:disabled):hover { filter: brightness(1.06); }
.cta:not(:disabled):active { transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-press); }
.cta.wide { width: 100%; }
.cta:disabled { background: var(--surface-2); color: var(--faint); box-shadow: none; cursor: not-allowed; }
.link {
  background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--text); font-weight: 700;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px;
}
.link.back { text-decoration: none; color: var(--muted); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700;
}

/* ── главный: hero и поиск ── */
.hero { position: relative; padding-top: 18px; }
.hero-mascot {
  position: absolute; right: -8px; top: 4px; width: 132px; height: auto; pointer-events: none;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .35)); animation: bob 3.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-7px); } }
.hero .h1, .hero .lead { position: relative; }
.hero .lead { max-width: 30ch; }
@media (max-width: 370px) { .hero-mascot { width: 104px; } .h1 { font-size: 27px; } }

.field { margin-bottom: 12px; }
.combo { position: relative; }
.combo-icon { position: absolute; left: 16px; top: 18px; z-index: 1; color: var(--faint); pointer-events: none; }
input[type="text"] {
  width: 100%; height: 56px; padding: 0 16px 0 46px;
  background: var(--surface); border: 2px solid var(--line-strong); border-radius: 18px;
  color: var(--text); font-size: 17px; font-weight: 600; transition: border-color .2s, box-shadow .2s;
}
input[type="text"]::placeholder { color: var(--faint); font-weight: 500; }
input[type="text"]:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type="text"]:disabled { opacity: .55; }

.suggest {
  list-style: none; margin: 8px 0 0; padding: 6px; position: absolute; left: 0; right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px;
  max-height: min(55vh, 440px); overflow-y: auto; box-shadow: 0 24px 50px rgba(0, 0, 0, .45);
  animation: pop-in .18s ease-out both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.suggest li { margin: 0; }
.opt {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 12px; padding: 8px; min-height: 60px; color: var(--text);
}
.opt[aria-selected="true"], .opt:hover { background: var(--surface-2); }
.opt-thumb { width: 38px; height: 56px; border-radius: 8px; background: var(--surface-2); object-fit: cover; flex: none; }
.opt-title { display: block; font-weight: 700; line-height: 1.25; }
.opt-meta { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.suggest-msg { padding: 14px 12px; color: var(--muted); font-size: 15px; }

.chips { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 6px; max-width: 100%; min-height: 40px; padding: 2px 2px 2px 14px;
  border-radius: 999px; color: var(--on-color); font-weight: 700; font-size: 15px; box-shadow: var(--pop);
  animation: chip-in .35s var(--ease-spring) both;
}
@keyframes chip-in { from { transform: scale(.6); opacity: 0; } }
.chip:nth-child(3n+1) { background: var(--yellow); }
.chip:nth-child(3n+2) { background: var(--pink); }
.chip:nth-child(3n+3) { background: var(--mint-soft); }
.chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip span.y { font-size: 12px; opacity: .7; }
.chip button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--on-color); font-size: 20px; line-height: 1; flex: none; }
.chip button:hover { background: rgba(29, 20, 56, .1); }
.hint { color: var(--muted); font-size: 14px; min-height: 1.5em; margin: 4px 0 12px; }

.resume {
  display: grid; gap: 4px; margin: 14px 0 6px; padding: 16px 18px; border-radius: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--violet) 26%, var(--surface)), var(--surface));
  border: 1px solid var(--line);
}
.resume .eyebrow { justify-self: start; background: var(--yellow); color: var(--on-color); }
.resume-text { margin: 0 0 6px; }

/* ── ряды подборок ── */
.home-shelf { margin-top: 30px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.row-head .h2 { margin: 0; }
.more-link { background: none; border: 0; color: var(--accent); font-weight: 800; font-size: 15px; min-height: 44px; padding: 0 4px; }
.shelf {
  list-style: none; margin: 0 -16px; padding: 4px 16px 12px; display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf li { flex: none; scroll-snap-align: start; }
.cover {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  width: 156px; height: 208px; padding: 12px; border: 0; border-radius: 22px; overflow: hidden; text-align: left;
  color: #fff; box-shadow: var(--pop); transition: transform .2s var(--ease-spring);
}
.cover::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(10, 6, 25, .78)); }
.cover:hover { transform: translateY(-4px) rotate(-1deg); }
.cover:active { transform: scale(.97); }
.cover-title { position: relative; font: 800 15px/1.15 var(--display); text-shadow: 0 1px 8px rgba(0, 0, 0, .4); }
.cover-desc { position: relative; font-size: 12px; font-weight: 600; line-height: 1.3; opacity: .9; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* сетка подборок на вкладке */
.tiles { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles .cover { width: 100%; height: auto; aspect-ratio: 3 / 3.6; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile.create {
  width: 100%; min-height: 64px; margin-top: 12px; padding: 14px 18px; text-align: left;
  border: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--text); font-weight: 700;
}
.tile.create b { color: var(--accent); }
.col-cover { height: 120px; border-radius: 24px; margin-top: 10px; box-shadow: var(--pop); }

/* ── ожидание ИИ ── */
.wait { text-align: center; padding-top: 20px; max-width: 380px; margin: 0 auto; }
.wait-art { position: relative; width: 210px; height: 220px; margin: 0 auto 10px; }
.wait-art img { position: relative; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 16px 30px rgba(0, 0, 0, .35)); animation: bob 2.6s ease-in-out infinite; }
.beam {
  position: absolute; left: 50%; top: 50%; width: 250px; height: 190px; transform-origin: 0 50%;
  transform: translate(0, -50%) rotate(-28deg);
  background: linear-gradient(90deg, color-mix(in srgb, var(--yellow) 75%, transparent), transparent 85%);
  clip-path: polygon(0 44%, 100% 0, 100% 100%, 0 56%); filter: blur(6px); opacity: .55; mix-blend-mode: screen;
  animation: flicker 2.2s steps(1) infinite, sweep 5s ease-in-out infinite;
}
[data-theme="light"] .beam { mix-blend-mode: multiply; opacity: .4; }
@keyframes flicker { 0%, 100% { opacity: .55; } 12% { opacity: .38; } 14% { opacity: .6; } 58% { opacity: .45; } 60% { opacity: .62; } }
@keyframes sweep { 50% { transform: translate(0, -50%) rotate(-18deg); } }
.wait-seeds { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0; margin: 8px 0 14px; }
.wait-seeds li { padding: 5px 12px; border-radius: 99px; background: var(--surface-2); font-size: 14px; font-weight: 700; }
.wait-steps { list-style: none; padding: 0; margin: 0 auto 16px; max-width: 290px; text-align: left; display: grid; gap: 10px; font-size: 15px; }
.wait-steps li { display: flex; gap: 10px; align-items: center; color: var(--muted); animation: step-on 18s linear both; }
.wait-steps li::before { content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; opacity: .5; animation: step-dot 18s linear both; animation-delay: inherit; }
.wait-steps li:nth-child(2) { animation-delay: 5s; } .wait-steps li:nth-child(3) { animation-delay: 11s; }
@keyframes step-on { 0% { color: var(--muted); } 2%, 100% { color: var(--text); font-weight: 700; } }
@keyframes step-dot { 0% { opacity: .5; } 2%, 100% { opacity: 1; background: var(--mint); border-color: var(--mint); } }
.progress { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; max-width: 290px; margin: 0 auto; }
.progress span {
  display: block; height: 100%; width: 92%; border-radius: inherit; transform-origin: 0 50%;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 10px, #ff8aa0 10px 20px);
  animation: grow 24s cubic-bezier(.1, .7, .3, 1) both, stripes .8s linear infinite;
  background-size: 28px 28px;
}
@keyframes grow { from { transform: scaleX(.05); } to { transform: scaleX(1); } }
@keyframes stripes { to { background-position: 28px 0; } }
.wait .row { justify-content: center; margin-top: 8px; }

/* ── лента и карточка ── */
.feed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 0 4px; }
.feed-seeds { color: var(--muted); font-size: 14px; margin: 0; min-width: 0; }
.feed-head .link { white-space: nowrap; flex: none; }
.swipe-tip { margin: 0 0 10px; font-size: 13px; color: var(--faint); }
@media (hover: hover) and (pointer: fine) { .swipe-tip { display: none; } }
.cards { list-style: none; margin: 0; padding: 0; }
.end, .state { text-align: center; padding: 28px 0 8px; }
.end-mascot, .state-mascot { width: 140px; height: auto; margin: 0 auto 10px; display: block; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .3)); }
.end-title { font: 800 23px var(--display); margin: 0 0 4px; }
.end .cta, .state .cta { margin-top: 18px; }

.slot { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .32s ease, opacity .2s; }
.slot > .inner { min-height: 0; overflow: hidden; padding: 8px 10px; margin: 0 -10px; }
.slot.gone { grid-template-rows: 0fr; }
.slot.gone > .inner { padding-top: 0; padding-bottom: 0; }

.ticket {
  position: relative; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  background: var(--card); color: var(--card-ink); border-radius: 26px; border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .3s var(--ease-spring);
}
.ticket.dragging { transition: none; }
.ticket.tear { animation: fly-left .38s cubic-bezier(.5, 0, .9, .4) forwards; }
.ticket.tear.right { animation-name: fly-right; }
@keyframes fly-left { to { transform: translateX(-120%) rotate(-10deg); opacity: 0; } }
@keyframes fly-right { to { transform: translateX(120%) rotate(10deg); opacity: 0; } }

/* подсказки свайпа */
.swipe-hint {
  position: absolute; top: 18px; z-index: 3; padding: 8px 14px; border-radius: 14px; font: 800 15px/1 var(--display);
  opacity: 0; pointer-events: none; border: 3px solid currentColor; background: var(--card); transform: rotate(-8deg);
}
.swipe-hint.seen { right: 16px; color: var(--mint); }
.swipe-hint.later { left: 16px; color: var(--yellow); transform: rotate(8deg); }
[data-theme="light"] .swipe-hint.seen { color: #0e8c6a; }
[data-theme="light"] .swipe-hint.later { color: #b07800; }

.t-hero { position: relative; padding: 16px 16px 0; overflow: hidden; }
.t-bg { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(26px) saturate(1.3); opacity: .55; transform: scale(1.1); }
.t-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, var(--card) 96%); }
.t-main { position: relative; z-index: 1; display: flex; gap: 14px; align-items: flex-end; }
.poster {
  flex: none; width: 112px; height: 168px; border-radius: 14px; background: var(--surface-2); object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
}
.poster.empty { display: grid; place-items: center; color: var(--faint); }
.t-info { min-width: 0; flex: 1; padding-bottom: 4px; }
.t-title { font: 800 23px/1.1 var(--display); letter-spacing: -.01em; margin: 0 0 8px; overflow-wrap: anywhere; }
.t-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--muted); }
.seal {
  display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px; border-radius: 10px; transform: rotate(-4deg);
  background: var(--yellow); color: var(--on-color); font: 800 14px/1.2 var(--display); box-shadow: var(--pop);
}
.seal::before { content: "★"; font-size: 12px; }

.t-stub { position: relative; z-index: 1; padding: 14px 16px 16px; }
.t-why { margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; background: var(--why-bg); border-left: 4px solid var(--yellow); font-size: 15px; line-height: 1.45; }
.t-why b { display: block; margin-bottom: 3px; font: 800 11px/1.2 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--why-label); }
.desc { font-size: 14.5px; line-height: 1.5; margin: 0 0 6px; color: var(--muted); }
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more { background: none; border: 0; padding: 6px 0 10px; min-height: 36px; font-weight: 700; font-size: 14px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.act {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 10px;
  border: 0; border-radius: 16px; background: var(--surface-2); color: var(--card-ink); font-weight: 700; font-size: 14.5px;
  transition: transform .12s, background-color .2s;
}
.act svg { flex: none; }
.act:hover { background: var(--surface-3); }
.act:active { transform: translateY(2px); }
.act.primary { background: var(--surface-2); }
.act[aria-pressed="false"].later, .act.later { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 var(--accent-press); }
.act.later:active { box-shadow: 0 1px 0 var(--accent-press); }
.act[aria-pressed="true"] { background: var(--yellow); color: var(--on-color); box-shadow: none; }
.act.danger { background: transparent; color: var(--muted); border: 1.5px solid var(--line-strong); }
.act.danger:hover { color: var(--error); border-color: var(--error); }

.trailers { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.trailers a { color: #fff; background: var(--accent); text-decoration: none; font-weight: 700; padding: 11px 14px; border-radius: 12px; }
.trailers a:hover { filter: brightness(1.1); }

/* ── нижняя панель ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 84%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.tabbtn {
  height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 700;
}
.tabbtn svg { width: 40px; height: 28px; padding: 3px 9px; border-radius: 12px; transition: background-color .2s, color .2s; }
.tabbtn[aria-selected="true"] { color: var(--text); }
.tabbtn[aria-selected="true"] svg { background: var(--accent); color: #fff; }
@media (min-width: 640px) {
  .tabbar { left: 50%; right: auto; width: var(--col); transform: translateX(-50%); bottom: 12px; border: 1px solid var(--line); border-radius: 22px; padding-bottom: 4px; box-shadow: var(--shadow); }
}

/* ── уведомление ── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px); z-index: 40;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 10px 10px 18px;
  transform: translate(-50%, 14px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); border-radius: 16px; font-weight: 700; font-size: 15px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45); transition: opacity .2s, transform .25s var(--ease-spring);
}
.toast:not(:has(.toast-undo:not([hidden]))) { padding-right: 18px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-undo { min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--yellow); color: var(--on-color); font-weight: 800; flex: none; }
@media (min-width: 640px) { .toast { bottom: calc(var(--tabbar-h) + 34px); } }

/* ── шторки ── */
.sheet {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: var(--scrim); animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } }
.sheet-card {
  width: 100%; max-width: var(--col); max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 28px 28px 0 0; border-top: 1px solid var(--line);
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheet-up .4s var(--ease-spring) both;
}
@keyframes sheet-up { from { transform: translateY(60%); } }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet-card { border-radius: 28px; max-width: 460px; border: 1px solid var(--line); } }
.grabber { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 0 auto 16px; }
.sheet .h2 { font-size: 24px; }
.sheet-close { display: block; margin: 8px auto 0; }
.plans { display: grid; gap: 10px; margin: 18px 0 10px; }
.plan-btn {
  display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 60px; padding: 0 18px;
  color: var(--text); background: var(--surface-2); border: 2px solid transparent; border-radius: 18px; font-weight: 700;
  transition: border-color .2s, transform .12s;
}
.plan-btn:hover { border-color: var(--yellow); }
.plan-btn:active { transform: scale(.98); }
.plan-btn b { font: 800 22px/1 var(--display); color: var(--yellow); }
[data-theme="light"] .plan-btn b { color: var(--accent); }
.plan-btn:disabled { opacity: .6; cursor: wait; }
.code-input {
  margin: 14px 0 12px; padding: 0 16px !important; font: 800 22px/1 var(--display) !important;
  letter-spacing: .2em; text-transform: uppercase; text-align: center;
}
.code-out { font: 800 32px/1 var(--display); letter-spacing: .22em; color: var(--yellow); text-align: center; margin: 18px 0; user-select: all; }
[data-theme="light"] .code-out { color: var(--accent); }

/* ── десктоп ── */
@media (min-width: 900px) {
  :root { --col: 680px; }
  .h1 { font-size: 42px; max-width: 15ch; }
  .hero .h1 { max-width: 17ch; }
  .hero { padding-top: 30px; }
  .hero-mascot { width: 170px; right: 0; }
  .hero .lead { max-width: 40ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .beam { animation: none !important; }
  .wait-steps li, .wait-steps li::before { animation: none !important; }
}
