/* Мишины Игрушки — Telegram Mini App.
   Отдельные стили приложения, сайт их не подключает. */

:root {
    --radius: 22px;
    --radius-lg: 28px;
    --gap: 16px;
    --nav-h: 76px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --font-display: 'Montserrat', 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
/* Атрибут hidden сильнее любых display у компонентов */
[hidden] { display: none !important; }
html { background: var(--bg); }
body.tma-app {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.4;
    background:
        radial-gradient(120% 60% at 50% -10%, var(--brand-a35), transparent 60%),
        radial-gradient(80% 40% at 100% 100%, var(--brand-2-a18), transparent 70%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }

/* Тонкие линии слоёв печати на фоне */
.app-layers {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: repeating-linear-gradient(0deg, var(--line-a035) 0 1px, transparent 1px 6px);
    mask-image: linear-gradient(180deg, var(--mask) 0%, transparent 75%);
}

.app-screen {
    position: relative; z-index: 1;
    overflow-x: clip;
    max-width: 520px; margin: 0 auto;
    padding: 12px 16px calc(var(--nav-h) + 32px + var(--safe-b));
    display: flex; flex-direction: column; gap: var(--gap);
}

.glass {
    position: relative;
    background: linear-gradient(160deg, var(--surface-high), var(--glass-to));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 var(--white-a06), 0 10px 30px var(--shadow-a35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* Появление блоков каскадом */
.app-screen > * { animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; }
.app-screen > *:nth-child(2) { animation-delay: .05s; }
.app-screen > *:nth-child(3) { animation-delay: .1s; }
.app-screen > *:nth-child(4) { animation-delay: .15s; }
.app-screen > *:nth-child(n+5) { animation-delay: .2s; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Верх ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-hello { display: flex; align-items: center; gap: 12px; }
/* .theme-toggle живёт в общем css/theme-toggle.css */
.home-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex: none;
    display: grid; place-items: center; overflow: hidden;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    border: 2px solid var(--accent-a55);
    box-shadow: 0 0 16px var(--accent-a25);
    color: var(--brand-on);
    font-size: 18px;
}
.home-avatar img { width: 100%; height: 100%; object-fit: cover; }
.home-hello-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.home-hello-sub { color: var(--muted); font-size: 12.5px; }

/* ---------- Герой: Миша печатается на столе ---------- */
.hero { text-align: center; }
.hero-stage { position: relative; height: 300px; margin: 0 auto; max-width: 340px; }
.hero-glow {
    position: absolute; left: 50%; top: 48%; width: 280px; height: 280px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--accent-a38), var(--brand-2-a18) 45%, transparent 70%);
    filter: blur(6px);
    animation: glow 4s ease-in-out infinite;
}
@keyframes glow { 50% { opacity: .7; transform: translate(-50%, -50%) scale(1.08); } }

/* Печатный стол: светящаяся сетка в перспективе */
.hero-plate {
    position: absolute; left: 50%; bottom: 6px; width: 290px; height: 120px;
    transform: translateX(-50%) perspective(420px) rotateX(64deg);
    border-radius: 14px;
    border: 2px solid var(--accent-a80);
    background:
        linear-gradient(var(--accent-a55) 1.5px, transparent 1.5px) 0 0 / 100% 20px,
        linear-gradient(90deg, var(--accent-a55) 1.5px, transparent 1.5px) 0 0 / 24px 100%,
        var(--accent-a08);
    box-shadow: 0 0 30px var(--accent-glow), inset 0 0 30px var(--accent-a25);
}

@keyframes print-in { to { clip-path: inset(0 0 0 0); } }

/* Янтарная линия сопла, идущая вверх вместе с печатью */
.hero-scan {
    position: absolute; left: -12%; right: -12%; bottom: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-hot), var(--white), var(--accent-hot), transparent);
    box-shadow: 0 0 14px 3px var(--accent-glow);
    border-radius: 3px;
    opacity: 0;
    animation: scan 1.6s steps(28, end) .2s forwards;
}
@keyframes scan {
    0% { bottom: 0; opacity: 1; }
    92% { opacity: 1; }
    100% { bottom: 100%; opacity: 0; }
}

.hero-title {
    margin: 6px 0 6px;
    font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -.02em;
}
.hero-title span {
    background: linear-gradient(90deg, var(--accent-hot), var(--accent));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    text-shadow: 0 0 24px var(--accent-a35);
}
.hero-text { margin: 0 auto; max-width: 330px; color: var(--muted); font-size: 14px; }


/* ---------- Плитки разделов ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 92px; padding: 12px 6px; text-align: center; font-weight: 600; font-size: 13.5px;
    transition: transform .15s ease;
}
.tile i { font-size: 24px; color: var(--accent-hot); filter: drop-shadow(0 0 8px var(--accent-glow)); }
.tile:active, .stl-card:active, .opt-card:active { transform: scale(.97); }

/* ---------- Полка товаров ---------- */
.shelf-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.shelf-head h2 { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.shelf-head a { color: var(--muted); font-size: 13.5px; }
.shelf-row {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 4px 16px 10px; scrollbar-width: none;
}
.shelf-row::-webkit-scrollbar { display: none; }

.toy-card { flex: 0 0 158px; scroll-snap-align: start; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.toy-media {
    position: relative; display: block; height: 150px; border-radius: 16px; overflow: hidden;
    background: radial-gradient(90% 60% at 50% 100%, var(--accent-a28), transparent 70%), var(--well-a60);
}
.toy-media img, .toy-noimg { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.toy-noimg { display: grid; place-items: center; font-size: 34px; color: var(--muted); }
.toy-pedestal {
    position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent-hot), transparent);
    box-shadow: 0 0 14px 2px var(--accent-glow);
}
.toy-opt {
    position: absolute; z-index: 3; top: 8px; right: 8px; width: 38px; height: 38px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
    background: var(--ok-deep); border: 1px solid var(--ok-a70); color: var(--ok-text-strong);
    font-weight: 800; font-size: 13px; box-shadow: 0 0 12px var(--ok-a35);
}
.toy-opt small { font-size: 8.5px; font-weight: 600; margin-top: 2px; }
.toy-title {
    font-size: 13px; font-weight: 600; min-height: 36px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.toy-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.toy-price { font-family: var(--font-display); font-weight: 800; color: var(--price); font-size: 16px; }
.toy-state { font-size: 11px; color: var(--muted); }
.toy-state.is-stock { color: var(--ok-text); }
.toy-add {
    width: 36px; height: 36px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-size: 17px; color: var(--white);
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 6px 16px var(--brand-a35);
    transition: transform .15s ease, filter .15s ease;
}
.toy-add:hover { filter: brightness(1.12); }
.toy-add:active { transform: scale(.88); }
.toy-add.is-busy { opacity: .6; pointer-events: none; }

/* ---------- Печать по STL ---------- */
.stl-card {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px;
    background: linear-gradient(135deg, var(--brand-a55), var(--brand-2-a45));
    border-color: var(--violet-a35);
    transition: transform .15s ease;
}
.stl-title { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; }
.stl-text { color: var(--brand-ink); font-size: 13px; margin-top: 4px; }
.stl-icon {
    width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 22px;
    background: var(--overlay-a45); color: var(--icon-on-brand); border: 1px solid var(--accent-a35);
}

/* ---------- Нижнее меню-капсула ---------- */
.app-nav {
    position: fixed; z-index: 20; left: 50%; bottom: calc(12px + var(--safe-b));
    transform: translateX(-50%);
    width: min(488px, calc(100% - 24px)); height: 64px;
    display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: center;
    padding: 0 6px; border-radius: 32px;
    background: var(--nav);
    border: 1px solid var(--line-strong);
    box-shadow: 0 12px 34px var(--shadow-a60), inset 0 1px 0 var(--white-a06);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.app-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); font-size: 10.5px; font-weight: 600;
}
.app-nav-item i { font-size: 21px; line-height: 1; }
.app-nav-item.is-active { color: var(--accent-hot); }
.app-nav-item.is-active i { filter: drop-shadow(0 0 8px var(--accent-glow)); }
.app-nav-cart {
    position: relative; justify-self: center; margin-top: -26px;
    width: 64px; height: 64px; border-radius: 50%;
    display: grid; place-items: center; font-size: 26px; color: var(--accent-ink);
    background: radial-gradient(circle at 35% 30%, var(--accent-light), var(--accent) 55%, var(--accent-deep));
    box-shadow: 0 0 0 5px var(--bg), 0 0 26px var(--accent-a60);
    transition: transform .2s ease;
}
.app-nav-cart:active { transform: scale(.92); }
.app-nav-cart.is-bump { animation: bump .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump { 40% { transform: scale(1.18); } }
.app-nav-badge {
    position: absolute; top: 2px; right: 0; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
    display: grid; place-items: center; font-size: 11.5px; font-weight: 800; color: var(--white);
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    border: 2px solid var(--bg);
}
.app-nav-badge.is-empty { display: none; }

/* Товар, улетающий в корзину */
.fly-ghost {
    position: fixed; z-index: 60; pointer-events: none; border-radius: 14px; object-fit: cover;
    box-shadow: 0 0 20px var(--accent-glow);
    transition: transform .7s cubic-bezier(.5, -0.2, .7, .9), opacity .7s ease;
}

.app-toast {
    position: fixed; z-index: 70; left: 50%; bottom: calc(var(--nav-h) + 26px + var(--safe-b));
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    max-width: calc(100% - 40px); padding: 10px 16px; border-radius: 14px;
    background: var(--toast); border: 1px solid var(--line-strong); font-size: 13.5px; text-align: center;
    transition: opacity .25s ease, transform .25s ease;
}
.app-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Каталог ---------- */
.page-head h1 { margin: 4px 0 12px; font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.search {
    display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 16px;
    background: var(--well-a55); border: 1px solid var(--line);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.search:focus-within { border-color: var(--accent-a60); box-shadow: 0 0 0 3px var(--accent-a12); }
.search i { color: var(--muted); }
.search input {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
    color: var(--text); font: inherit; font-size: 15px;
}
.search input::placeholder { color: var(--placeholder); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

.catalog-results { display: flex; flex-direction: column; gap: 14px; transition: opacity .2s ease; }
.catalog-results.is-loading { opacity: .45; pointer-events: none; }

/* Переключатель «Все / В наличии» */
.segmented {
    position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 18px;
    background: var(--well-a55); border: 1px solid var(--line);
}
.segmented-item {
    height: 40px; display: grid; place-items: center; border-radius: 14px;
    font-weight: 600; color: var(--muted); transition: color .2s ease, background .25s ease, box-shadow .25s ease;
}
.segmented-item.is-active {
    color: var(--accent-ink);
    background: radial-gradient(circle at 35% 25%, var(--accent-light), var(--accent) 60%, var(--accent-deep));
    box-shadow: 0 0 18px var(--accent-glow);
}

/* Категории — прокручиваемые чипы */
.chips {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px; padding: 2px 16px 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 18px;
    background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; white-space: nowrap;
    transition: border-color .2s ease, background .2s ease;
}
.chip span { color: var(--muted); font-size: 12px; font-weight: 700; }
.chip.is-active { border-color: var(--accent-a70); background: var(--accent-a14); color: var(--accent-hot); }
.chip.is-active span { color: var(--accent); }

.sort-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sort-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.sort-options { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.sort-options::-webkit-scrollbar { display: none; }
.sort-option { flex: none; padding: 6px 9px; border-radius: 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.sort-option.is-active { color: var(--text); background: var(--line-a14); }

/* Сетка 2×N */
.toy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.toy-grid .toy-card { flex: none; animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.toy-grid .toy-card:nth-child(2n) { animation-delay: .04s; }
.toy-grid .toy-media { height: auto; aspect-ratio: 1 / 1; }

/* Пустой результат */
.empty { padding: 22px 20px 24px; text-align: center; }
.empty img { width: 96px; height: auto; margin: 0 auto 10px; filter: drop-shadow(0 0 18px var(--accent-a30)); }
.empty-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.empty p { margin: 6px auto 16px; max-width: 290px; color: var(--muted); font-size: 13.5px; }
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 22px; border-radius: 16px;
    font-weight: 700; color: var(--white); background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
    box-shadow: 0 8px 22px var(--brand-a40);
}
.btn-primary:active { transform: scale(.97); }

/* ---------- Товар ---------- */
.product { display: flex; flex-direction: column; gap: 14px; }
.gallery {
    position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 1 / 1;
    background: radial-gradient(90% 60% at 50% 100%, var(--accent-a28), transparent 70%), var(--well-a60);
    border: 1px solid var(--line);
}
.gallery-track {
    display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track > img, .gallery-track > .toy-noimg { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.gallery .toy-pedestal { height: 5px; }
.gallery-dots { position: absolute; z-index: 3; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 6px; }
.gallery-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--white-a40); transition: width .25s ease, background .25s ease; }
.gallery-dots i.is-active { width: 20px; background: var(--accent-hot); }
.toy-opt-lg { top: 14px; right: 14px; width: 50px; height: 50px; font-size: 17px; }
.toy-opt-lg small { font-size: 10px; }

.product-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip {
    display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; border-radius: 14px;
    font-size: 12.5px; font-weight: 600; color: var(--text-soft-2); background: var(--line-a10); border: 1px solid var(--line);
}
.pchip.is-green { color: var(--ok-text); background: var(--ok-a12); border-color: var(--ok-a40); }
.pchip.is-amber { color: var(--accent-hot); background: var(--accent-a12); border-color: var(--accent-a40); }
.product-title { margin: 0; font-family: var(--font-display); font-size: 22px; line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
.product-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.product-share { flex: none; height: 36px; padding: 0 12px; border-radius: 12px; font-size: 13px; }

.price-card { padding: 16px; }
.price-rows { display: grid; gap: 8px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.price-row { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 14px; }
.price-row b { color: var(--text); font-family: var(--font-display); font-size: 17px; }
.price-row small { font-family: var(--font-body); font-size: 12px; color: var(--muted); font-weight: 500; }
.price-row.is-opt b { color: var(--ok-text); }
.price-row.is-on { color: var(--text); }
.price-row.is-on b { text-shadow: 0 0 14px var(--ok-a50); }

.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper {
    display: flex; align-items: center; height: 48px; padding: 4px; border-radius: 16px;
    background: var(--well-a60); border: 1px solid var(--line);
}
.stepper button {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 17px;
    background: var(--line-a12); transition: transform .12s ease, background .2s ease;
}
.stepper button:active { transform: scale(.9); background: var(--accent-a25); }
.stepper button:disabled { opacity: .35; }
.stepper input {
    width: 52px; height: 40px; border: 0; outline: 0; background: none; text-align: center;
    color: var(--text); font: 700 17px var(--font-display); -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-total { text-align: right; }
.qty-total span { display: block; color: var(--muted); font-size: 12px; }
.qty-total b { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--price); text-shadow: 0 0 18px var(--accent-a35); }
.price-hint { margin-top: 10px; min-height: 18px; font-size: 13px; color: var(--muted); }
.price-hint b { color: var(--accent-hot); }
.price-hint.is-win { color: var(--ok-text); }

.in-cart-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.in-cart-note i { color: var(--accent-hot); }

.about { padding: 0 16px; }
.about summary {
    list-style: none; display: flex; justify-content: space-between; align-items: center; height: 52px;
    font-weight: 700; cursor: pointer;
}
.about summary::-webkit-details-marker { display: none; }
.about summary i { transition: transform .25s ease; color: var(--muted); }
.about[open] summary i { transform: rotate(180deg); }
.about p, .about-text { margin: 0 0 12px; color: var(--text-soft-2); font-size: 14px; }
.about-text p { margin: 0 0 8px; }
.specs { margin: 0 0 14px; display: grid; gap: 6px; }
.specs div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; text-align: right; font-weight: 600; }

.btn-block { width: 100%; height: 54px; gap: 8px; font-size: 16px; }
.btn-primary { gap: 8px; transition: transform .15s ease, opacity .2s ease; }
.btn-primary.is-busy { opacity: .6; pointer-events: none; }
.product-action { position: sticky; bottom: 0; padding: 10px 0 2px; }
.product-page .product-action { bottom: calc(var(--nav-h) + 6px + var(--safe-b)); }

/* ---------- Нижняя шторка ---------- */
.sheet { --drag: 0px; position: fixed; inset: 0; z-index: 50; }
.sheet[hidden] { display: none; }
.sheet-backdrop {
    position: absolute; inset: 0; background: var(--scrim);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; transition: opacity .3s ease;
}
.sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto;
    max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
    display: flex; flex-direction: column;
    border-radius: 28px 28px 0 0;
    background: linear-gradient(180deg, var(--sheet-top), var(--bg) 70%);
    border: 1px solid var(--line-strong); border-bottom: 0;
    box-shadow: 0 -20px 60px var(--shadow-a60);
    transform: translateY(100%); transition: transform .38s cubic-bezier(.2, .9, .25, 1);
}
.sheet.is-open .sheet-backdrop { opacity: 1; }
.sheet.is-open .sheet-panel { transform: translateY(var(--drag, 0px)); }
.sheet.is-dragging .sheet-panel { transition: none; }
.sheet-handle { flex: none; width: 100%; height: 26px; position: relative; touch-action: none; cursor: grab; }
.sheet-handle::after {
    content: ''; position: absolute; left: 50%; top: 10px; width: 42px; height: 5px; margin-left: -21px;
    border-radius: 3px; background: var(--hairline);
}
.sheet-close {
    position: absolute; z-index: 5; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; background: var(--overlay-a75); border: 1px solid var(--line-strong);
}
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 16px calc(16px + var(--safe-b)); }
.sheet-body .product-action { background: linear-gradient(180deg, transparent, var(--bg) 35%); padding-top: 18px; }
.sheet-loading { padding: 16px 0 24px; display: grid; gap: 14px; }
.skeleton {
    border-radius: 18px;
    background: linear-gradient(100deg, var(--line-a06) 30%, var(--line) 50%, var(--line-a06) 70%) 0 0 / 300% 100%;
    animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }
body.has-sheet { overflow: hidden; }

/* ---------- Общие элементы экранов ---------- */
.page-sub { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.section-title { margin: 4px 0 10px; font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.alert {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px;
    background: var(--danger-a12); border: 1px solid var(--danger-a45); color: var(--danger-text-soft); font-size: 14px;
}
.field-error { color: var(--danger-text); font-size: 13px; margin-top: 6px; }
.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px;
    border-radius: 16px; font-weight: 700; background: var(--line-a10); border: 1px solid var(--line-strong);
}
.btn-chip {
    flex: none; height: 36px; padding: 0 14px; border-radius: 12px; font-weight: 700; font-size: 13.5px; color: var(--accent-ink);
    background: radial-gradient(circle at 35% 25%, var(--accent-light), var(--accent) 60%, var(--accent-deep)); box-shadow: 0 0 14px var(--accent-glow);
}
.btn-chip.is-done { color: var(--ok-text); background: var(--ok-a14); box-shadow: none; border: 1px solid var(--ok-a45); }
.icon-btn {
    width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
    background: var(--line-a10); border: 1px solid var(--line); color: var(--muted);
}
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }

/* ---------- Корзина ---------- */
.cart-body { display: flex; flex-direction: column; gap: 14px; transition: opacity .2s ease; }
.cart-body.is-loading { opacity: .55; pointer-events: none; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; padding-right: 40px; }
.line-media {
    position: relative; width: 84px; height: 84px; border-radius: 14px; overflow: hidden;
    background: radial-gradient(90% 60% at 50% 100%, var(--accent-a28), transparent 70%), var(--well-a60);
}
.line-media img, .line-media .toy-noimg { width: 100%; height: 100%; object-fit: cover; }
.line-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.line-title {
    font-weight: 600; font-size: 14px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.line-unit { color: var(--muted); font-size: 12.5px; }
.line-opt {
    display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 800;
    color: var(--ok-text-strong); background: var(--ok-a16); border: 1px solid var(--ok-a40); vertical-align: 1px;
}
.line-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.line-total { font-family: var(--font-display); font-weight: 800; color: var(--price); font-size: 15.5px; white-space: nowrap; }
.line-remove {
    position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 10px;
    display: grid; place-items: center; color: var(--muted); font-size: 13px;
}
.line-remove:active { background: var(--danger-a15); color: var(--danger-text); }
.stepper-sm { height: 36px; padding: 3px; border-radius: 12px; }
.stepper-sm button { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
.stepper-value { min-width: 30px; text-align: center; font: 700 15px var(--font-display); }

.deal { display: flex; align-items: center; gap: 12px; padding: 14px; border-color: var(--accent-a40); }
.deal-icon {
    width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 19px;
    color: var(--accent-hot); background: var(--accent-a14);
}
.deal-text { flex: 1; font-size: 13.5px; color: var(--text-soft); }
.deal-title { font-weight: 800; color: var(--accent-hot); font-size: 14px; margin-bottom: 2px; }

.totals { padding: 16px; display: grid; gap: 9px; }
.totals .form-title { margin-bottom: 2px; }
.totals-row { display: flex; justify-content: space-between; gap: 14px; font-size: 14px; color: var(--muted); }
.totals-row span:last-child { color: var(--text); text-align: right; white-space: nowrap; }
.totals-row span:first-child { min-width: 0; }
.totals-row.is-win, .totals-row.is-win span:last-child { color: var(--ok-text); }
.totals-sum {
    display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 2px;
    border-top: 1px solid var(--line); font-weight: 700;
}
.totals-sum b { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--price); text-shadow: 0 0 18px var(--accent-a35); }
.totals-note { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

/* ---------- Оформление ---------- */
.checkout { display: flex; flex-direction: column; gap: 14px; }
.form-card { padding: 16px; display: grid; gap: 12px; }
.form-title { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.form-title i { color: var(--accent-hot); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field small { font-weight: 500; opacity: .7; }
.field input, .field textarea {
    width: 100%; border-radius: 14px; border: 1px solid var(--line); background: var(--well-a60);
    color: var(--text); font: inherit; font-size: 16px; padding: 12px 14px; outline: 0; resize: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field textarea:focus { border-color: var(--accent-a60); box-shadow: 0 0 0 3px var(--accent-a12); }
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder-field); }
.field em { font-style: normal; color: var(--danger-text); font-size: 12.5px; }
.field.has-error input, .field.has-error textarea { border-color: var(--danger-a60); }

.delivery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.delivery-option input { position: absolute; opacity: 0; pointer-events: none; }
.delivery-card {
    display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 12px; border-radius: 14px;
    background: var(--well-a55); border: 1px solid var(--line); font-size: 13px; font-weight: 600; line-height: 1.25;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.delivery-card i { font-size: 20px; color: var(--muted); }
.delivery-option input:checked + .delivery-card {
    border-color: var(--accent-a75); background: var(--accent-a10); box-shadow: 0 0 16px var(--accent-a18);
}
.delivery-option input:checked + .delivery-card i { color: var(--accent-hot); }
.delivery-option input:focus-visible + .delivery-card { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; }
.switch-card[hidden] { display: none; }
.switch-text { display: grid; gap: 3px; }
.switch-text b { font-size: 14.5px; }
.switch-text span { color: var(--muted); font-size: 12.5px; }
.switch {
    appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 50px; height: 30px; border-radius: 15px;
    background: var(--line-a20); transition: background .2s ease; cursor: pointer;
}
.switch::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--white);
    transition: transform .2s ease; box-shadow: 0 2px 6px var(--black-a30);
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }

.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.consent input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
.consent a { color: var(--accent-hot); text-decoration: underline; text-underline-offset: 2px; }
.consent.has-error { color: var(--danger-text); }

/* ---------- Заказ ---------- */
.success { text-align: center; }
.success-stage { position: relative; height: 210px; }
.success-stage .hero-glow { width: 230px; height: 230px; }
.success-misha {
    position: absolute; left: 50%; bottom: 0; height: 200px; width: auto; transform: translateX(-50%);
    animation: hop 1.1s cubic-bezier(.3, 1.6, .5, 1) .15s both;
    filter: drop-shadow(0 10px 18px var(--shadow-a55));
}
@keyframes hop { from { opacity: 0; transform: translateX(-50%) translateY(40px) scale(.85); } to { opacity: 1; transform: translateX(-50%); } }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
    position: absolute; left: 50%; top: 45%; width: 7px; height: 11px; border-radius: 2px; opacity: 0;
    background: var(--c, var(--accent-hot));
    animation: burst 1.4s cubic-bezier(.2, .7, .3, 1) var(--d, .3s) both;
}
.confetti i:nth-child(1) { --x: -130px; --y: -90px; --r: 220deg; }
.confetti i:nth-child(2) { --x: 120px; --y: -110px; --r: -180deg; --c: var(--confetti-2); --d: .35s; }
.confetti i:nth-child(3) { --x: -90px; --y: -150px; --r: 300deg; --c: var(--ok-text); }
.confetti i:nth-child(4) { --x: 80px; --y: -160px; --r: 140deg; --d: .4s; }
.confetti i:nth-child(5) { --x: -150px; --y: -20px; --r: -260deg; --c: var(--confetti-1); --d: .32s; }
.confetti i:nth-child(6) { --x: 150px; --y: -30px; --r: 200deg; --c: var(--ok-text); --d: .38s; }
.confetti i:nth-child(7) { --x: -40px; --y: -170px; --r: 90deg; --c: var(--confetti-2); }
.confetti i:nth-child(8) { --x: 40px; --y: -180px; --r: -120deg; --d: .42s; }
.confetti i:nth-child(9) { --x: -110px; --y: 40px; --r: 160deg; --c: var(--confetti-3); --d: .36s; }
.confetti i:nth-child(10) { --x: 110px; --y: 30px; --r: -200deg; --c: var(--confetti-1); }
.confetti i:nth-child(11) { --x: -170px; --y: -100px; --r: 240deg; --c: var(--ok-text); --d: .45s; }
.confetti i:nth-child(12) { --x: 170px; --y: -80px; --r: -300deg; --d: .34s; }
@keyframes burst {
    0% { opacity: 1; transform: translate(0, 0) rotate(0); }
    100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}
.success-title { margin: 8px 0 4px; font-family: var(--font-display); font-size: 28px; font-weight: 800; }
.success-text { margin: 0 auto; max-width: 320px; color: var(--muted); font-size: 14px; }

.order-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.order-number { font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: .01em; word-break: break-all; }
.order-date { color: var(--muted); font-size: 13px; margin-top: 2px; }
.order-cancelled { display: flex; gap: 12px; align-items: center; padding: 16px; border-color: var(--danger-a45); }
.order-cancelled i { font-size: 26px; color: var(--danger-text); }
.order-cancelled div { display: grid; gap: 2px; }
.order-cancelled span { color: var(--muted); font-size: 13px; }

.timeline-card { padding: 16px; display: grid; gap: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.tl-step { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before {
    content: ''; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; border-radius: 2px;
    background: var(--line);
}
.tl-step:last-child::before { display: none; }
.tl-step.is-done::before { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); box-shadow: 0 0 8px var(--accent-glow); }
.tl-dot {
    position: relative; z-index: 1; width: 36px; height: 36px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-size: 15px; color: var(--muted);
    background: var(--well-a85); border: 2px solid var(--line-a22);
}
.tl-step.is-done .tl-dot { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tl-step.is-current .tl-dot {
    color: var(--accent-ink); border-color: var(--accent-hot);
    background: radial-gradient(circle at 35% 30%, var(--accent-flare-2), var(--accent-hot) 45%, var(--accent));
    box-shadow: 0 0 0 5px var(--accent-a18), 0 0 22px var(--accent-glow);
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 9px var(--accent-a06), 0 0 30px var(--accent-glow); } }
.tl-text { display: grid; gap: 2px; padding-top: 7px; }
.tl-text b { font-size: 15px; color: var(--muted); font-weight: 600; }
.tl-step.is-done .tl-text b { color: var(--text); }
.tl-step.is-current .tl-text b { color: var(--accent-hot); font-weight: 800; text-shadow: 0 0 14px var(--accent-a35); }
.tl-text span { color: var(--muted); font-size: 13px; }

/* Принтер, который печатает (заказ в печати, экран 3D-печати) */
.printer { display: flex; justify-content: center; }
.printer-frame {
    position: relative; width: 150px; height: 110px; border: 3px solid var(--metal); border-bottom-width: 0; border-radius: 10px 10px 0 0;
    background: linear-gradient(180deg, var(--brand-a10), var(--accent-a08));
}
.printer-head {
    position: absolute; top: 14px; left: 20px; width: 26px; height: 18px; border-radius: 4px;
    background: linear-gradient(180deg, var(--metal-light), var(--metal)); animation: head 2.4s ease-in-out infinite alternate;
}
.printer-head::after {
    content: ''; position: absolute; left: 9px; bottom: -8px; width: 8px; height: 8px;
    background: var(--accent); clip-path: polygon(0 0, 100% 0, 60% 100%, 40% 100%); box-shadow: 0 0 10px var(--accent);
}
.printer-thread {
    position: absolute; left: 50%; top: -24px; width: 2px; height: 40px; margin-left: -1px;
    background: linear-gradient(180deg, transparent, var(--accent)); opacity: .7;
}
.printer-part {
    position: absolute; left: 50%; bottom: 8px; width: 46px; margin-left: -23px; height: 34px; border-radius: 10px 10px 2px 2px;
    background: repeating-linear-gradient(0deg, var(--accent) 0 3px, var(--accent-deep) 3px 5px);
    box-shadow: 0 0 16px var(--accent-glow); transform-origin: bottom; animation: grow 4.8s steps(16, end) infinite;
}
.printer-bed { position: absolute; left: 8px; right: 8px; bottom: 0; height: 8px; border-radius: 3px; background: var(--metal); box-shadow: 0 0 14px var(--accent-a35); }
@keyframes head { from { transform: translateX(0); } to { transform: translateX(78px); } }
@keyframes grow { from { transform: scaleY(.05); } to { transform: scaleY(1); } }
.printer-lg .printer-frame { width: 210px; height: 150px; }
.printer-lg .printer-part { width: 64px; margin-left: -32px; height: 52px; }
.printer-lg .printer-head { animation-name: head-lg; }
@keyframes head-lg { from { transform: translateX(0); } to { transform: translateX(140px); } }

/* ---------- Список заказов ---------- */
.orders-wrap { display: flex; flex-direction: column; gap: 10px; transition: opacity .2s ease; }
.orders-wrap.is-loading { opacity: .55; }
.orders { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.order-card { display: grid; gap: 8px; padding: 14px 16px; }
.order-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.order-card-head b { font-family: var(--font-display); font-size: 14.5px; word-break: break-all; }
.order-card-sum { font-family: var(--font-display); font-weight: 800; color: var(--price); white-space: nowrap; }
.order-card-meta { color: var(--muted); font-size: 12.5px; margin-top: -4px; }
.order-card-status { display: flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--accent-hot); }
.order-card.is-done .order-card-status { color: var(--ok-text); }
.live-dot {
    width: 8px; height: 8px; margin: 0 4px 0 2px; border-radius: 50%; background: var(--accent-hot);
    box-shadow: 0 0 10px var(--accent); animation: hot 1.2s ease-in-out infinite;
}
.order-card.is-cancelled .order-card-status { color: var(--danger-text); }
.filament-sm { height: 10px; margin: 0; }
.filament-sm .filament-track { top: 3px; height: 4px; }
.filament-sm .filament-fill { top: 2px; height: 6px; }
.order-card.is-done .filament-fill { background: linear-gradient(90deg, var(--ok-deep-solid), var(--ok)); box-shadow: 0 0 10px var(--ok-a40); animation: none; }

/* ---------- Профиль ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 16px; }
.profile-avatar { width: 58px; height: 58px; font-size: 24px; }
.profile-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.profile-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.menu { padding: 4px 0; }
.menu-item {
    display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 8px 16px; font-weight: 600; font-size: 14.5px;
}
.menu-item + .menu-item { border-top: 1px solid var(--line); }
.menu-item > i:first-child { width: 22px; font-size: 19px; color: var(--accent-hot); text-align: center; }
.menu-item > span { flex: 1; display: grid; gap: 1px; }
.menu-item small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.menu-item > i:last-child:not(:first-child) { color: var(--muted); font-size: 14px; }
a.menu-item:active { background: var(--line-a06); }

/* ---------- Печать по модели ---------- */
.print-hero { text-align: center; }
.print-stage { position: relative; height: 190px; display: flex; align-items: flex-end; justify-content: center; }
.print-stage .hero-glow { width: 240px; height: 240px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.step { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.step-num {
    width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center;
    font: 800 16px var(--font-display); color: var(--accent-ink);
    background: radial-gradient(circle at 35% 25%, var(--accent-light), var(--accent) 60%, var(--accent-deep)); box-shadow: 0 0 12px var(--accent-glow);
}
.step div { display: grid; gap: 2px; }
.step span { color: var(--muted); font-size: 13px; }
.materials { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.material { padding: 14px; display: grid; gap: 4px; }
.material b { font-size: 14.5px; }
.material span { color: var(--muted); font-size: 12.5px; }

/* ---------- Заставка ---------- */
.splash {
    position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: radial-gradient(70% 45% at 50% 45%, var(--brand-a35), transparent 70%), var(--bg);
    animation: splash-out .45s ease 1.55s forwards;
}
.splash.is-gone { animation: splash-out .3s ease forwards; }
.splash-glow {
    position: absolute; left: 50%; top: 46%; width: 260px; height: 260px; transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--accent-a30), transparent 65%); animation: glow 2s ease-in-out infinite;
}
.splash-logo { position: relative; }
.splash-word {
    display: block; font-family: var(--font-display); font-weight: 800; font-size: 38px; letter-spacing: -.02em; white-space: nowrap;
    clip-path: inset(0 100% 0 0); animation: write 1.1s steps(22, end) .15s forwards;
}
.splash-word b { color: var(--accent-hot); text-shadow: 0 0 20px var(--accent-glow); }
/* Сопло идёт слева направо и «наносит» буквы */
.splash-nozzle {
    position: absolute; top: -22px; left: 0; width: 18px; height: 22px; margin-left: -9px;
    animation: nozzle 1.1s steps(22, end) .15s forwards;
}
.splash-nozzle::before {
    content: ''; position: absolute; inset: 0 0 8px; border-radius: 4px; background: linear-gradient(180deg, var(--metal-light), var(--metal));
}
.splash-nozzle::after {
    content: ''; position: absolute; left: 4px; right: 4px; bottom: 0; height: 8px;
    background: var(--accent-hot); clip-path: polygon(0 0, 100% 0, 60% 100%, 40% 100%);
}
.splash-nozzle i {
    position: absolute; left: 50%; top: 24px; width: 3px; height: 40px; margin-left: -1.5px; border-radius: 2px;
    background: linear-gradient(180deg, var(--white), var(--accent-hot)); box-shadow: 0 0 12px 2px var(--accent-glow);
}
.splash-sub {
    color: var(--muted); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
    opacity: 0; animation: rise .5s ease 1.05s forwards;
}
@keyframes write { to { clip-path: inset(0 0 0 0); } }
@keyframes nozzle { to { left: 100%; } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }

/* Пока идёт заставка, блоки главной появляются после неё */
.splash-on body[data-nav="home"] .app-screen > * { animation-delay: 1.7s; }

/* ---------- Переходы между экранами (браузеры с View Transitions) ---------- */
@view-transition { navigation: auto; }
.app-nav { view-transition-name: app-nav; }
::view-transition-old(root) { animation: vt-out .16s ease both; }
::view-transition-new(root) { animation: vt-in .24s ease both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Миша-ассистент ---------- */
.assistant {
    position: fixed; z-index: 40; right: 14px; bottom: calc(64px + 24px + var(--safe-b));
    display: flex; align-items: flex-end; gap: 8px; pointer-events: none;
}
.assistant { transition: opacity .3s ease, transform .4s cubic-bezier(.3, 1.5, .5, 1); }
.assistant.is-hidden { opacity: 0; transform: scale(.4); transform-origin: 100% 100%; }
.assistant-btn {
    position: relative; pointer-events: auto; width: 58px; height: 58px; border-radius: 50%; flex: none;
    box-shadow: 0 0 0 3px var(--accent-a80), 0 8px 24px var(--shadow-a55), 0 0 22px var(--accent-glow);
    animation: bob 3.2s ease-in-out infinite; transition: transform .2s ease;
}
.assistant-btn img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.assistant-btn:active { transform: scale(.9); }
@keyframes bob { 50% { translate: 0 -5px; } }
.assistant-bubble {
    pointer-events: auto; position: relative; max-width: min(240px, calc(100vw - 110px)); margin-bottom: 30px;
    padding: 11px 14px; border-radius: 18px 18px 4px 18px; font-size: 13.5px; line-height: 1.35; font-weight: 500;
    background: linear-gradient(160deg, var(--bubble-from), var(--bubble-to)); border: 1px solid var(--line-strong);
    box-shadow: 0 12px 30px var(--shadow-a50); transform-origin: 100% 100%;
    animation: bubble-in .35s cubic-bezier(.3, 1.4, .5, 1) both;
}
.assistant-bubble[hidden] { display: none; }
.assistant-bubble.is-leaving { animation: bubble-out .25s ease forwards; }
.assistant-bubble b { color: var(--accent-hot); }
@keyframes bubble-in { from { opacity: 0; transform: scale(.6) translateY(8px); } }
@keyframes bubble-out { to { opacity: 0; transform: scale(.8) translateY(6px); } }
.typing-caret { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--accent-hot); animation: hot .8s steps(2) infinite; }
body.has-sheet .assistant { opacity: 0; pointer-events: none; }

/* ---------- Чат поддержки ---------- */
.chat-sheet .sheet-panel { height: calc(100vh - 60px); height: calc(100dvh - 60px); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 0 60px 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head img { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent-a70); }
.chat-head div { display: grid; gap: 1px; }
.chat-head b { font-size: 15.5px; }
.chat-head span { color: var(--muted); font-size: 12px; }
.chat-list {
    flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 6px;
    display: flex; flex-direction: column; gap: 12px;
}
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg.is-customer { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.msg-body { display: grid; gap: 3px; min-width: 0; }
.msg-meta { font-size: 11px; color: var(--muted); padding: 0 6px; }
.msg.is-customer .msg-meta { text-align: right; }
.msg-bubble {
    padding: 10px 13px; border-radius: 18px 18px 18px 5px; font-size: 14px; line-height: 1.42; word-break: break-word;
    background: var(--surface-high-a60); border: 1px solid var(--line);
}
.msg.is-bot .msg-bubble { border-color: var(--accent-a35); background: var(--accent-a08); }
.msg.is-customer .msg-bubble {
    border-radius: 18px 18px 5px 18px; border: 0; color: var(--white);
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}
.msg-image { display: block; margin-top: 8px; max-width: 100%; max-height: 180px; border-radius: 12px; object-fit: cover; }
.msg-file {
    display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 7px 10px; border-radius: 10px;
    background: var(--overlay-a35); font-size: 13px; word-break: break-all;
}
.chat-form { flex: none; padding: 8px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); display: grid; gap: 6px; }
.chat-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-attach, .chat-send {
    width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 18px; cursor: pointer;
}
.chat-attach { color: var(--muted); background: var(--line-a10); }
.chat-send { color: var(--white); background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); box-shadow: 0 6px 16px var(--brand-a40); }
.chat-send:disabled { opacity: .5; }
.chat-row textarea {
    flex: 1; min-height: 42px; max-height: 120px; padding: 10px 14px; border-radius: 16px; resize: none; outline: 0;
    border: 1px solid var(--line); background: var(--well-a60); color: var(--text); font: inherit; font-size: 16px;
}
.chat-row textarea:focus { border-color: var(--accent-a60); }
.chat-file {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; font-size: 13px;
    background: var(--accent-a10); border: 1px solid var(--accent-a35);
}
.chat-file[hidden] { display: none; }
.chat-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-consent { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.chat-consent input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

/* ---------- Главная: сцена мастерской ---------- */
.home-hello-name .accent { color: var(--accent-hot); }
.stage { position: relative; height: 340px; margin: 0 auto; width: 100%; max-width: 360px; }
.stage .hero-glow { top: 50%; }
.stage .hero-plate { bottom: 4px; }
/* Итоговое состояние (без скрипта и при «меньше анимации»): принтер на столе, Миша — ассистент в углу */
.stage-printer {
    position: absolute; left: 50%; bottom: 16px; height: 300px; width: auto; transform: translateX(-50%);
    filter: drop-shadow(0 14px 22px var(--shadow-a60));
    transition: opacity .6s ease, transform .8s cubic-bezier(.2, 1.3, .4, 1);
}
.stage-nozzle {
    position: absolute; left: 50%; bottom: 186px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%;
    background: radial-gradient(circle, var(--accent-flare), var(--accent-a50) 40%, transparent 70%);
    mix-blend-mode: screen; animation: hot 1.3s ease-in-out infinite; pointer-events: none;
}
.stage-misha {
    position: absolute; left: 50%; bottom: 40px; width: 200px; height: 260px; margin-left: -100px;
    display: none; transform-origin: 50% 100%;
}
.misha-pose {
    position: absolute; left: 50%; bottom: 0; height: 100%; width: auto; transform: translateX(-50%);
    filter: drop-shadow(0 10px 18px var(--shadow-a55));
    transition: opacity .25s ease;
}
.misha-pose.is-point { opacity: 0; height: 104%; margin-left: -6px; }
.stage .hero-scan { animation: none; }

/* Знакомство: принтера ещё нет, Миша печатается на столе */
.intro-pending .assistant { opacity: 0; transform: scale(.4); }
.intro-pending .stage-printer, .intro-pending .stage-nozzle { opacity: 0; }
.stage.is-intro .stage-misha { display: block; }
.stage.is-intro .stage-printer { opacity: 0; transform: translateX(-50%) translateY(40px) scale(.8); }
.stage.is-intro .stage-nozzle { opacity: 0; animation: none; }
.stage.is-intro.is-printer-in .stage-printer { opacity: 1; transform: translateX(-50%); }
.stage.is-intro.is-printer-in .stage-nozzle { opacity: 1; animation: hot 1.3s ease-in-out .7s infinite; }
.stage-misha.is-printing .misha-pose.is-wave { clip-path: inset(100% 0 0 0); animation: print-in 1.3s steps(24, end) forwards; }
.stage-misha.is-printing .hero-scan { animation: scan 1.3s steps(24, end) forwards; }
.stage-misha.is-idle { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.015, .985); } }
.stage-misha.is-pointing .misha-pose.is-wave { opacity: 0; }
.stage-misha.is-pointing .misha-pose.is-point { opacity: 1; }
.stage-misha.is-hop { animation: hop-pose .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes hop-pose { 40% { transform: translateY(-14px) scale(1.04, .96); } }
.stage-misha.is-flying { transition: transform .75s cubic-bezier(.5, -0.15, .3, 1), opacity .75s ease; }

.stage-bubble {
    position: absolute; z-index: 3; top: 4px; left: 52%; max-width: min(200px, 46vw);
    padding: 10px 13px; border-radius: 18px 18px 18px 4px; font-size: 13.5px; line-height: 1.35; font-weight: 600;
    background: linear-gradient(160deg, var(--bubble-from), var(--bubble-to)); border: 1px solid var(--line-strong);
    box-shadow: 0 12px 30px var(--shadow-a50); transform-origin: 0 100%;
    animation: bubble-in .35s cubic-bezier(.3, 1.4, .5, 1) both;
}
.stage-bubble[hidden] { display: none; }
.stage-bubble.is-leaving { animation: bubble-out .25s ease forwards; }
.stage-skip {
    position: absolute; z-index: 3; right: 0; bottom: 8px; height: 30px; padding: 0 12px; border-radius: 15px;
    font-size: 12.5px; color: var(--muted); background: var(--overlay-a60); border: 1px solid var(--line);
}
.stage-skip[hidden] { display: none; }

/* ---------- Окно «Печать на заказ» ---------- */
.print-window { padding: 16px; display: grid; gap: 14px; border-color: var(--accent-a35); }
.print-window-head { display: flex; gap: 12px; align-items: center; }
.print-window-icon {
    width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 22px; color: var(--accent-ink);
    background: radial-gradient(circle at 35% 25%, var(--accent-light), var(--accent) 60%, var(--accent-deep)); box-shadow: 0 0 16px var(--accent-glow);
}
.print-window h2 { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 800; }
.print-window p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.dropzone {
    display: grid; justify-items: center; gap: 4px; padding: 18px 14px; border-radius: 18px; text-align: center; cursor: pointer;
    border: 2px dashed var(--accent-glow); background: var(--accent-a06);
    transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.dropzone:active, .dropzone.is-over { background: var(--accent-a14); border-color: var(--accent-hot); transform: scale(.99); }
.dropzone i { font-size: 30px; color: var(--accent-hot); filter: drop-shadow(0 0 10px var(--accent-glow)); }
.dropzone b { font-size: 15.5px; }
.dropzone span { color: var(--muted); font-size: 12px; }
.print-materials { display: flex; gap: 6px; flex-wrap: wrap; }
.print-materials span {
    padding: 4px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; color: var(--text-soft-2);
    background: var(--line-a10); border: 1px solid var(--line);
}
.print-printer { position: relative; height: 200px; width: auto; margin: 0 auto; filter: drop-shadow(0 12px 20px var(--shadow-a60)); }
.print-stage { height: 210px; align-items: flex-end; }

/* ---------- Каталог на главной ---------- */
.home-catalog { display: flex; flex-direction: column; gap: 12px; }
.home-catalog .shelf-head { margin-bottom: 0; }
.home-chips .chip i { color: var(--accent-hot); }
.opt-card.is-compact { padding: 12px 14px; }
.opt-card.is-compact .opt-head { margin-bottom: 8px; }
.opt-card.is-compact .opt-title { font-size: 14.5px; }
.opt-card.is-compact .opt-note { margin-top: 8px; font-size: 12.5px; }

/* ---------- Слайсер ---------- */
.slicer {
    position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column;
    background: radial-gradient(120% 50% at 50% 0%, var(--brand-a30), transparent 60%), var(--bg);
    opacity: 0; transform: translateY(24px); transition: opacity .3s ease, transform .35s cubic-bezier(.2, .9, .25, 1);
}
.slicer[hidden] { display: none; }
.slicer.is-open { opacity: 1; transform: none; }
.slicer-top { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.slicer-title { display: grid; min-width: 0; }
.slicer-title b { font-family: var(--font-display); font-size: 17px; }
.slicer-title span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slicer-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.slicer-view {
    position: relative; flex: none; height: 300px; border-radius: var(--radius-lg); overflow: hidden;
    background: radial-gradient(80% 60% at 50% 100%, var(--accent-a18), transparent 70%), var(--well-a70);
    border: 1px solid var(--line);
}
.slicer-view canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.slicer-placeholder {
    position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 20px;
    text-align: center; color: var(--muted); font-size: 13.5px;
}
.slicer-placeholder i { font-size: 46px; color: var(--accent-hot); opacity: .8; }
.slicer-hint {
    position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 5px 12px; border-radius: 12px;
    font-size: 12px; color: var(--text-soft); background: var(--overlay-a75); white-space: nowrap; pointer-events: none;
}
.slicer-hint[hidden] { display: none; }
.slicer-hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slicer-hud[hidden] { display: none; }
.slicer-hud div {
    display: grid; gap: 2px; padding: 10px; border-radius: 14px; text-align: center;
    background: var(--surface); border: 1px solid var(--line);
}
.slicer-hud span { color: var(--muted); font-size: 11.5px; }
.slicer-hud b { font-family: var(--font-display); font-size: 13.5px; }
.slicer-form { display: flex; flex-direction: column; gap: 14px; }
.slicer-form[hidden], .slicer-placeholder[hidden] { display: none; }
[data-print-price].is-loading { opacity: .5; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card {
    display: grid; gap: 2px; height: 100%; padding: 10px 12px; border-radius: 14px;
    background: var(--well-a55); border: 1px solid var(--line); transition: border-color .2s ease, background .2s ease;
}
.choice-card b { font-size: 14px; }
.choice-card small { color: var(--muted); font-size: 11.5px; line-height: 1.25; }
.choice input:checked + .choice-card { border-color: var(--accent-a75); background: var(--accent-a10); box-shadow: 0 0 14px var(--accent-a15); }
.choice input:checked + .choice-card b { color: var(--accent-hot); }
.choice input:focus-visible + .choice-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span {
    display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); cursor: pointer;
    border: 2px solid var(--soft-line); box-shadow: inset 0 -4px 8px var(--black-a25);
    transition: transform .15s ease, box-shadow .2s ease;
}
.swatch input:checked + span { transform: scale(1.12); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent-hot); }
.field > span b { color: var(--text); }
.range { display: grid; gap: 8px; }
.range > span { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.range > span b { color: var(--accent-hot); font-family: var(--font-display); }
.range small { color: var(--muted); font-size: 12px; margin-top: -4px; }
.range input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.tier-note { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.tier-note.is-win { color: var(--ok-text); }
.slicer-price .qty-total { text-align: left; }
.slicer-price .qty-total b { font-size: 30px; }
.slicer-price .totals-note { margin-top: 4px; }
.slicer-done { display: grid; justify-items: center; gap: 10px; padding: 20px 10px; text-align: center; }
.slicer-done[hidden] { display: none; }
.slicer-done img { height: 200px; width: auto; animation: pop-in .9s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop-in { from { opacity: 0; transform: translateY(30px) scale(.85); } }
.slicer-done h2 { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.slicer-done p { margin: 0 0 8px; color: var(--muted); font-size: 14px; max-width: 320px; }
.slicer-done p b { color: var(--accent-hot); }
body.has-slicer { overflow: hidden; }
body.has-slicer .app-nav, body.has-slicer .assistant { display: none; }

/* Горизонтальные ряды: затухание у краёв подсказывает, что ряд продолжается.
   Маска рисуется скриптом hscroll.js по классам has-more-left / has-more-right. */
.chips.has-more-right,
.sort-options.has-more-right {
    -webkit-mask-image: linear-gradient(to right, var(--mask) calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, var(--mask) calc(100% - 28px), transparent);
}
.chips.has-more-left,
.sort-options.has-more-left {
    -webkit-mask-image: linear-gradient(to right, transparent, var(--mask) 28px);
    mask-image: linear-gradient(to right, transparent, var(--mask) 28px);
}
.chips.has-more-left.has-more-right,
.sort-options.has-more-left.has-more-right {
    -webkit-mask-image: linear-gradient(to right, transparent, var(--mask) 28px, var(--mask) calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, transparent, var(--mask) 28px, var(--mask) calc(100% - 28px), transparent);
}
@media (hover: hover) {
    .chips, .sort-options { cursor: grab; }
}
.chips.is-dragging,
.sort-options.is-dragging { cursor: grabbing; user-select: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .misha-pose { clip-path: none !important; }
    .hero-scan, .splash { display: none; }
    .printer-part { transform: none; }
}
