/* Self-hosted fonts (no third-party round trips); files are content-hashed. */
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/Montserrat-cyrillic-520cd39b.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/Montserrat-latin-a5ec5492.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Montserrat Alternates'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/MontserratAlternates-cyrillic-6806b118.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Montserrat Alternates'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/MontserratAlternates-latin-994f831c.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Montserrat Alternates'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/MontserratAlternates-cyrillic-6806b118.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Montserrat Alternates'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/MontserratAlternates-latin-f36da383.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Montserrat Alternates'; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/MontserratAlternates-cyrillic-6806b118.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Montserrat Alternates'; font-style: normal; font-weight: 800; font-display: swap; src: url(fonts/MontserratAlternates-latin-16ef02bc.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
    --bg: #000000;
    --card: #141417;
    --card-2: #1c1c21;
    --line: rgba(255, 255, 255, .07);
    --ink: #ffffff;
    --soft: #8b8b93;
    --accent: #5538F8;
    --accent-hover: #6a50ff;
    --accent-soft: rgba(85, 56, 248, .18);
    --danger: #ff6b74;
    --radius: 18px;
    --gutter: 18px;
    --cta-space: calc(96px + env(safe-area-inset-bottom));
    --title: "Montserrat Alternates", "Montserrat", system-ui, sans-serif;
    --text: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { font: 500 15px/1.4 var(--text); overscroll-behavior-y: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.boot, .gate {
    position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center;
    gap: 10px; padding: 24px; background: var(--bg); text-align: center;
}
.boot-mark { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: var(--card-2); box-shadow: 0 0 0 1px var(--line); }
.boot-mark img { width: 40px; height: 40px; }
.boot-title { margin-top: 14px; font: 800 24px/1.1 var(--title); }
.boot-text { color: var(--soft); font-size: 14px; min-height: 20px; }
.gate-card { width: min(100%, 380px); display: grid; justify-items: center; gap: 12px; padding: 28px 22px; border-radius: 24px; background: var(--card); }
.gate-card h2 { margin: 8px 0 0; font: 800 22px/1.2 var(--title); }
.gate-card p { margin: 0 0 8px; color: var(--soft); font-size: 14px; }
.gate-card .cta { position: static; width: 100%; }
.ghost-btn { width: 100%; min-height: 50px; border-radius: 16px; background: var(--card-2); font-weight: 700; }
.gate { overflow-y: auto; place-content: safe center; }
.public-block { width: 100%; display: grid; gap: 8px; text-align: left; }
.public-block h3 { margin: 4px 0 0; font: 800 16px/1.2 var(--title); }
.public-block p { margin: 0; font-size: 13px; }
.public-tariffs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.public-tariffs li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--card-2); font-size: 14px; }
.public-tariffs b { white-space: nowrap; }
.public-cta { display: grid; place-items: center; text-decoration: none; }
.public-links { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.public-link { min-height: 44px; display: grid; place-items: center; padding: 6px 8px; border-radius: 12px; background: var(--card-2); color: inherit; font-size: 13px; font-weight: 700; text-decoration: none; }

.app { width: min(100%, 520px); margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) var(--gutter) var(--cta-space); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.brand { font: 700 19px/1 var(--text); letter-spacing: -.2px; }
.avatar-btn { position: relative; width: 46px; height: 46px; overflow: hidden; border-radius: 50%; background: var(--card-2); box-shadow: 0 0 0 1px var(--line); transition: transform .12s ease; }
.avatar-btn:active { transform: scale(.94); }
.avatar-btn img, .profile-ring img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--soft); font: 700 18px/1 var(--title); }
.avatar-fallback.big { font-size: 42px; }
.page { animation: pageIn .22s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-title { margin: 0; font: 800 30px/1.08 var(--title); letter-spacing: -.4px; }
.section-label { margin: 24px 2px 11px; color: var(--soft); font: 600 14px/1 var(--text); text-transform: lowercase; }

.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.home-head .page-title { max-width: 62%; }
.category-pill {
    display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; min-height: 44px; padding: 0 16px 0 22px;
    border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600;
}
.category-pill svg { width: 18px; height: 18px; }
.template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile {
    position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 16px; background: var(--card);
    box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s ease, transform .12s ease;
}
.tile:active { transform: scale(.97); }
.tile.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.tile-art { position: absolute; inset: 8%; display: grid; place-items: center; }
/* emoji engine: a still poster, with a live canvas layered on top when pressed */
.tile-art > .poster, .tile-art > .live, .pack-icon > .poster { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster { object-fit: contain; opacity: 0; transition: opacity .2s ease; user-select: none; -webkit-user-drag: none; }
.ready > .poster { opacity: 1; }
.playing > .poster { visibility: hidden; }
.live canvas { display: block; }
.tile-art > .unknown, .pack-icon > .unknown { position: relative; }
.tile-art .unknown { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #000; font: 800 16px/1 var(--text); }
.tile-badge {
    position: absolute; top: 7px; left: 7px; z-index: 1; display: grid; place-items: center; min-width: 22px; height: 22px;
    padding: 0 6px; border-radius: 999px; background: var(--accent); font: 700 11px/1 var(--text);
}
.tile-empty, .grid-empty { grid-column: 1 / -1; padding: 40px 12px; color: var(--soft); text-align: center; }
.skeleton { background: linear-gradient(100deg, var(--card) 40%, var(--card-2) 50%, var(--card) 60%) 0 0 / 300% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.pager { display: flex; align-items: center; justify-content: center; gap: 4px; width: max-content; margin: 22px auto 0; padding: 5px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.pager-arrow { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); }
.pager-arrow svg { width: 20px; height: 20px; stroke-width: 2.4; }
.pager-arrow:disabled { background: var(--card-2); color: var(--soft); }
.pager-label { min-width: 110px; text-align: center; font: 700 15px/1 var(--text); }
.target-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 18px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: #d9d2ff; font-size: 13px; font-weight: 600; }
.target-banner-close { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.08); font-size: 18px; line-height: 1; }

.card { overflow: hidden; border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.row {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 0 18px; text-align: left;
}
/* divider only between visible rows, so hidden rows never leave a stray line */
.card > .row:not([hidden]) ~ .row:not([hidden]) { border-top: 1px solid var(--line); }
.method .row-label { text-transform: none; }
.row-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 500; text-transform: lowercase; }
.row-value { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--soft); text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.row-input { flex: 1 1 55%; min-width: 0; height: 56px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--soft); text-align: right; font-size: 15px; }
.row-input:focus { color: var(--ink); }
.row-input:focus-visible, .field input:focus-visible { outline: none; }
.app { overflow-x: clip; }
.row-input::placeholder { color: #55555d; }
.row-input::-webkit-outer-spin-button, .row-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.row-chevron { color: var(--soft); font-size: 26px; line-height: 1; margin-right: -4px; }
.row-clear { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--card-2); color: var(--soft); font-size: 17px; }
.row.disabled { opacity: .45; pointer-events: none; }
.swatch { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.swatch.empty { background: transparent; box-shadow: inset 0 0 0 1.5px #3a3a42; }

.choice-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px; margin: 0 -2px; scrollbar-width: none; scroll-snap-type: x proximity; }
.choice-row::-webkit-scrollbar { display: none; }
.choice { position: relative; flex: 0 0 calc((100% - 24px) / 3); aspect-ratio: 1; scroll-snap-align: start; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.choice.active { box-shadow: inset 0 0 0 2px var(--accent); }
.choice-remove { position: absolute; top: 6px; right: 6px; z-index: 2; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.92); color: #000; font: 700 15px/1 var(--text); }
.choice-add { display: grid; place-items: center; color: var(--soft); font-size: 34px; font-weight: 300; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.segmented button { min-height: 46px; border-radius: 999px; color: var(--soft); font-size: 16px; font-weight: 600; text-transform: lowercase; transition: background .16s ease, color .16s ease; }
.segmented button.active { background: #2a2a30; color: var(--ink); }
.segmented.locked { opacity: .55; pointer-events: none; }
/* chat preview in the app palette (not Telegram's blue theme) */
.chat { padding: 18px 16px; border-radius: var(--radius); background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23ffffff' stroke-opacity='.03'/%3E%3C/svg%3E"); box-shadow: inset 0 0 0 1px var(--line); }
.chat-bubble { width: max-content; max-width: 100%; margin-left: auto; padding: 8px 8px 6px; border-radius: 18px 18px 6px 18px; background: #232329; box-shadow: inset 0 0 0 1px var(--line); }
.chat-sticker { position: relative; display: grid; place-items: center; width: 168px; height: 168px; }
.chat-sticker.small { width: 84px; height: 84px; }
.chat-sticker > svg { width: 100% !important; height: 100% !important; }
.chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; color: var(--soft); font-size: 12px; }
.chat-meta svg { width: 16px; height: 11px; stroke-width: 1.6; color: var(--accent); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chat-sticker.loading::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; animation: spin .8s linear infinite; }

.profile-avatar { display: flex; justify-content: center; margin: 30px 0 16px; }
.profile-ring { width: 118px; height: 118px; overflow: hidden; border-radius: 50%; background: var(--card-2); box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px rgba(85,56,248,.16); }
.profile-name { text-align: center; font: 800 22px/1.2 var(--title); }
.profile-username { margin: 4px 0 24px; text-align: center; color: var(--soft); font-size: 15px; }
.balance-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 4px; padding: 18px; border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.page-title + .balance-card { margin-top: 22px; }
.balance-label { display: flex; align-items: center; gap: 8px; color: var(--soft); font-size: 14px; font-weight: 600; }
.balance-label img { width: 17px; height: 17px; }
.balance-value { margin-top: 8px; font: 800 26px/1 var(--title); }
.pill-btn { padding: 14px 28px; border-radius: 14px; background: var(--accent); font: 700 15px/1 var(--text); transition: background .16s ease; }
.pill-btn:hover { background: var(--accent-hover); }
.menu-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; margin-bottom: 14px; padding: 20px 18px; border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.menu-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--card-2); }
.menu-icon svg { width: 22px; height: 22px; stroke-width: 1.8; }
.menu-text { font: 700 18px/1 var(--text); }

.pack-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 26px; }
.pack {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 86px; padding: 14px 18px 14px 16px; text-align: left;
    border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
}
.pack-icon { position: relative; flex: 0 0 46px; width: 46px; height: 46px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: #0b0b0d; }
.pack-icon > svg { width: 100% !important; height: 100% !important; }
.pack-icon .unknown { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #000; font: 800 16px/1 var(--text); }
.pack-copy { flex: 1 1 auto; min-width: 0; }
.pack-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; }
.pack-meta { margin-top: 4px; color: var(--soft); font-size: 13px; }
.pack .row-chevron { flex: 0 0 auto; }

.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.amount-grid button { min-height: 58px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font: 700 18px/1 var(--title); }
.amount-grid button.active { background: var(--accent); box-shadow: none; }
.radio { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px #3a3a42; }
.method.active .radio { box-shadow: inset 0 0 0 7px var(--accent); }
.method:disabled { opacity: .4; }
.row-label + .row-value { text-transform: none; }
.hint { margin: 14px 2px 0; color: var(--soft); font-size: 13px; }

.cta-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 18px var(--gutter) calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, #000 70%, rgba(0,0,0,0)); pointer-events: none; }
.cta {
    display: block; width: min(100%, 484px); margin: 0 auto; min-height: 56px; padding: 0 18px; border-radius: 16px;
    background: var(--accent); color: #fff; font: 700 16px/1 var(--text); pointer-events: auto;
    transition: background .16s ease, opacity .16s ease, transform .12s ease;
}
.cta:hover { background: var(--accent-hover); }
.cta:active { transform: scale(.99); }
.cta:disabled { opacity: .55; }

.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; }
.overlay.center { place-items: center; }
.overlay.sheet { align-items: end; justify-items: center; padding: 0; }
.overlay-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fade .18s ease both; }
.dialog { position: relative; z-index: 1; width: min(100%, 380px); max-height: min(86vh, 680px); overflow: auto; padding: 22px 16px 16px; border-radius: 24px; background: var(--card); animation: rise .24s cubic-bezier(.2,.8,.2,1) both; }
.overlay.sheet .dialog { width: min(100%, 520px); padding-bottom: calc(18px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; }
.dialog-title { margin-bottom: 16px; text-align: center; font: 700 19px/1.2 var(--text); text-transform: lowercase; }
.dialog-body .card { background: var(--card-2); box-shadow: none; }
.dialog-body .row { min-height: 56px; }
.dialog-body .row.active .row-label { font-weight: 700; }
.dialog-body .cta, .dialog-body .ghost-btn { margin-top: 12px; }
.dialog-body p { margin: 0 4px 14px; color: var(--soft); font-size: 14px; text-align: center; }
.selected-note { margin-left: 8px; color: var(--soft); font-size: 13px; font-weight: 500; text-transform: none; }
.field { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 16px; border-radius: 16px; background: var(--card-2); }
.field input { flex: 1; min-width: 0; height: 54px; border: 0; outline: 0; background: transparent; font-size: 16px; }
.field .swatch { flex-basis: 30px; width: 30px; height: 30px; border-radius: 9px; }
.palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 14px; }
.palette button { aspect-ratio: 1; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.palette button.active { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.slider { display: grid; grid-template-columns: 26px 1fr 52px; align-items: center; gap: 12px; min-height: 52px; }
.slider span:first-child { color: var(--soft); font-weight: 700; }
.slider output { padding: 6px 0; border-radius: 9px; background: var(--card-2); text-align: center; font-size: 13px; font-weight: 600; }
input[type="range"] { width: 100%; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: #34343b; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--accent); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #34343b; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--accent); }
.result-art { display: grid; place-items: center; width: 120px; height: 120px; margin: 0 auto 10px; }
.result-art > svg { width: 100% !important; height: 100% !important; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 60; max-width: calc(100% - 36px); padding: 12px 16px; border-radius: 14px; background: #26262c; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px; font-weight: 600; transform: translate(-50%, 10px); opacity: 0; transition: opacity .24s ease, transform .24s cubic-bezier(.2,.8,.2,1); }
.toast.toast-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #3a1b20; color: #ffd2d6; }

@media (max-width: 360px) {
    :root { --gutter: 14px; }
    .page-title { font-size: 26px; }
    .template-grid { gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.grad-chip { flex: 0 0 44px; width: 44px; height: 22px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.grad-chip.empty { background: transparent; box-shadow: inset 0 0 0 1.5px #3a3a42; }
.grad-preview { position: sticky; top: 0; z-index: 5; margin: 0 calc(var(--gutter) * -1) 14px; padding: 6px var(--gutter) 10px; background: linear-gradient(180deg, #000 85%, rgba(0,0,0,0)); }
.grad-preview .chat { padding: 10px 12px; }
.grad-preview .chat-sticker, .grad-preview .chat-sticker.small { width: 116px; height: 116px; }
.grad-preview .chat-meta { display: none; }
.switch { flex: 0 0 auto; position: relative; width: 50px; height: 30px; margin: 0; border-radius: 999px; background: #3a3a42; -webkit-appearance: none; appearance: none; cursor: pointer; transition: background .16s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .16s ease; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
#gradControls.off { opacity: .45; pointer-events: none; }

/* Reference surface bridge. The previous Nikivus implementation remains in
   the document for rollback, but the downloaded Hours Studio surface is the
   only visible application. */
body.reference-source {
    min-height: 100vh;
    background: #000 !important;
    color: #fff !important;
}

body.reference-source .boot-screen,
body.reference-source .welcome-screen,
body.reference-source .app-shell,
body.reference-source > .toast,
body.reference-source > .pack-modal,
body.reference-source > .pack-choice-modal,
body.reference-source > .hours-category-modal {
    display: none !important;
}

body.reference-source .reference-app {
    display: block !important;
    min-height: 100vh;
    animation: pageIn .22s ease both;
}

body.reference-source .reference-app[hidden] {
    display: block !important;
}

body.reference-source .reference-app .page[hidden] {
    display: none !important;
}

body.reference-source .reference-app .cta-bar[hidden] {
    display: none !important;
}

.reference-app .topbar {
    position: relative;
    z-index: 5;
}

.reference-app .avatar-btn {
    border: 0;
    padding: 2px;
    background: #10171b;
    box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 0 18px rgba(85, 56, 248, .18);
}

.reference-app .avatar-btn img {
    border-radius: 50%;
}

.reference-app .choice-row {
    padding-bottom: 4px;
    cursor: grab;
    touch-action: pan-x;
}
.reference-app .choice-row:active { cursor: grabbing; }
.reference-app .choice-scroll-hint {
    margin: 7px 2px 0;
    color: #9299a7;
    font-size: 11px;
    text-align: center;
    letter-spacing: .01em;
}

.reference-app .choice {
    overflow: hidden;
}

.reference-app .choice .tile-art {
    inset: 9%;
}

.reference-app .choice .poster,
.reference-app .tile .poster {
    opacity: 1;
}

.reference-app .tile-art.ready {
    animation: ref-art-in .36s cubic-bezier(.2,.8,.2,1) both;
}

.reference-app .tile.selected {
    animation: ref-tile-pick .28s cubic-bezier(.2,.9,.3,1.25) both;
}

.reference-app .chat-sticker {
    overflow: hidden;
}

.reference-app .chat-sticker .ref-preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: ref-preview-in .52s cubic-bezier(.2,.9,.3,1.12) both;
}

.reference-app .chat-sticker.preview-swap {
    animation: ref-preview-pulse .5s ease both;
}

.reference-app .dialog-body .pack-choice-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 0 16px;
    border-radius: 16px;
    background: var(--card-2);
    text-align: left;
}

.reference-app .dialog-body .pack-choice-row + .pack-choice-row {
    margin-top: 8px;
}

.reference-app .dialog-body .pack-choice-row b {
    flex: 1;
}

.reference-app .dialog-body .pack-choice-row small {
    color: var(--soft);
}

.reference-app .dialog-body .dialog-note {
    margin: 0 4px 12px;
    color: var(--soft);
    font-size: 13px;
}

.reference-app .dialog-body .dialog-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 56px;
    padding: 0 16px;
    border-radius: 16px;
    background: var(--card-2);
    text-align: left;
}

.reference-app .dialog-body .dialog-option + .dialog-option {
    margin-top: 8px;
}

.reference-app .dialog-body .dialog-option:hover,
.reference-app .dialog-body .pack-choice-row:hover {
    background: #26262e;
}

@keyframes ref-art-in {
    from { opacity: 0; transform: scale(.88) translateY(4px); }
    to { opacity: 1; transform: none; }
}

@keyframes ref-tile-pick {
    0% { transform: scale(1); }
    55% { transform: scale(.95); }
    100% { transform: scale(1); }
}

@keyframes ref-preview-in {
    from { opacity: 0; transform: scale(.82) translateY(7px); filter: blur(5px); }
    62% { opacity: 1; transform: scale(1.035); filter: blur(0); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes ref-preview-pulse {
    0% { transform: scale(.96); }
    60% { transform: scale(1.025); }
    100% { transform: scale(1); }
}

/* Nikivus Studio identity: keep the reference mechanics, remove the foreign
   Hours palette and proportions. */
:root {
    --bg: #07090f;
    --card: #111620;
    --card-2: #171e2b;
    --line: rgba(145, 168, 255, .18);
    --ink: #f7f9ff;
    --soft: #8993aa;
    --accent: #7184ff;
    --accent-hover: #8ea7ff;
    --accent-soft: rgba(113, 132, 255, .16);
    --radius: 17px;
    --gutter: 16px;
    --title: "Montserrat Alternates", "Montserrat", system-ui, sans-serif;
    --text: "Montserrat", system-ui, sans-serif;
}

body.reference-source {
    background:
        radial-gradient(circle at 100% -10%, rgba(113,132,255,.13), transparent 31%),
        radial-gradient(circle at -12% 44%, rgba(44,118,180,.09), transparent 29%),
        var(--bg) !important;
}

body.reference-source .reference-app {
    width: min(100%, 520px);
    padding-top: calc(16px + env(safe-area-inset-top));
}

.reference-app .topbar {
    min-height: 54px;
    padding-bottom: 14px;
    margin-bottom: 24px;
    border-color: rgba(145, 168, 255, .14);
}

.reference-app .brand-stack {
    display: grid;
    gap: 3px;
}

.reference-app .brand {
    color: #f8faff;
    font-family: var(--title);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.04em;
}

.reference-app .brand-stack small {
    color: #7f8aa6;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .03em;
}

.reference-app .page-title {
    font-size: clamp(28px, 7.5vw, 34px);
    letter-spacing: -.065em;
}

.reference-app .home-head {
    align-items: end;
    margin-bottom: 20px;
}

.reference-app .home-head .page-title {
    max-width: 70%;
}

.reference-app .category-pill {
    min-height: 40px;
    padding: 0 12px 0 15px;
    border: 1px solid rgba(145,168,255,.24);
    background: #151b29;
    color: #dfe5ff;
    font-size: 12px;
}

.reference-app .category-pill svg {
    width: 15px;
    height: 15px;
    color: var(--accent);
}

.reference-app .template-grid {
    gap: 10px;
}

.reference-app .tile {
    border-radius: 15px;
    background: #111722;
    box-shadow: inset 0 0 0 1px rgba(145,168,255,.15), 0 9px 22px rgba(0,0,0,.16);
}

.reference-app .tile.selected {
    box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px rgba(113,132,255,.12), 0 10px 24px rgba(58,71,180,.2);
}

.reference-app .tile-badge {
    background: #7d8fff;
    color: #081021;
}

.reference-app .pager {
    margin-top: 18px;
    background: #111620;
    box-shadow: inset 0 0 0 1px rgba(145,168,255,.15);
}

.reference-app .pager-arrow {
    width: 34px;
    height: 34px;
    background: #7184ff;
    color: #081021;
}

.reference-app .pager-label {
    min-width: 82px;
    color: #dfe5ff;
    font-size: 12px;
}

.reference-app .section-label {
    margin-top: 25px;
    color: #858fa8;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: .02em;
    text-transform: lowercase;
}

.reference-app .card,
.reference-app .chat,
.reference-app .menu-card,
.reference-app .pack {
    background: #111620;
    box-shadow: inset 0 0 0 1px rgba(145,168,255,.15), 0 8px 24px rgba(0,0,0,.12);
}

.reference-app .row {
    min-height: 57px;
}

.reference-app .row-label,
.reference-app .menu-text {
    font-weight: 650;
}

.reference-app .row-value {
    color: #8792aa;
}

.reference-app .segmented {
    background: #10151f;
    box-shadow: inset 0 0 0 1px rgba(145,168,255,.16);
}

.reference-app .segmented button.active {
    background: #202a3b;
    color: #f8faff;
    box-shadow: inset 0 0 0 1px rgba(145,168,255,.16);
}

.reference-app .choice.active {
    box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 2px rgba(113,132,255,.11);
}

.reference-app .choice-add {
    border: 1px solid rgba(145,168,255,.11);
    background: #111620;
}

.reference-app .cta-bar {
    padding: 16px var(--gutter) calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(0deg, #07090f 68%, rgba(7,9,15,0));
}

.reference-app .cta {
    min-height: 54px;
    border: 1px solid rgba(151,169,255,.45);
    border-radius: 16px;
    background: linear-gradient(135deg, #5e6fff, #8297ff);
    box-shadow: 0 10px 28px rgba(54,72,188,.26);
    font-family: var(--title);
    font-size: 14px;
    font-weight: 800;
}

.reference-app .cta:hover {
    background: linear-gradient(135deg, #7184ff, #9ab0ff);
}

.reference-app .cta:disabled {
    background: #1b2230;
    border-color: rgba(145,168,255,.14);
    color: #6f7890;
    opacity: 1;
}

.reference-app .profile-avatar {
    margin: 26px 0 14px;
}

.reference-app .profile-ring {
    width: 104px;
    height: 104px;
    padding: 7px;
    background: #0d1420;
    box-shadow: 0 0 0 2px #7184ff, 0 0 0 7px rgba(113,132,255,.12), 0 12px 30px rgba(0,0,0,.28);
}

.reference-app .profile-ring img {
    border-radius: 50%;
}

.reference-app .profile-name {
    font-size: 24px;
    letter-spacing: -.05em;
}

.reference-app .profile-username {
    color: #7f8aa3;
}

.reference-app .menu-card {
    justify-content: flex-start;
    min-height: 70px;
    margin-bottom: 11px;
    padding: 13px 16px;
    border: 1px solid rgba(145,168,255,.13);
}

.reference-app .menu-card::after {
    content: "›";
    margin-left: auto;
    color: #7f8aa3;
    font-size: 23px;
    line-height: 1;
}

.reference-app .menu-icon {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(145,168,255,.1);
    background: #192131;
    color: #9eb4ff;
    font-size: 20px;
}

.reference-app .menu-text {
    margin-left: 12px;
    color: #eef1ff;
    font-size: 15px;
}

/* The dialog lives next to the reference app in the DOM, so its original
   styles must not depend on a descendant selector of .reference-app. */
body.reference-source .dialog-body .dialog-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 56px;
    margin: 0;
    padding: 0 16px;
    border-radius: 14px;
    background: #171e2b;
    color: #f7f9ff;
    text-align: left;
}

body.reference-source .dialog-body .dialog-option + .dialog-option {
    margin-top: 8px;
}

body.reference-source .dialog-body .dialog-option:hover {
    background: #202b3f;
}

body.reference-source .dialog-body .dialog-option b {
    font-family: var(--text);
    font-size: 14px;
    font-weight: 700;
}

body.reference-source .dialog-body .dialog-option span {
    color: var(--accent-hover);
    font-size: 18px;
}

body.reference-source .dialog-body .pack-choice-row {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 58px;
    gap: 10px;
    padding: 0 16px;
    border-radius: 14px;
    background: #171e2b;
    color: #f7f9ff;
    text-align: left;
}

body.reference-source .dialog-body .pack-choice-row + .pack-choice-row {
    margin-top: 8px;
}

body.reference-source .dialog-body .pack-choice-row b {
    flex: 1;
    font-size: 13px;
}

.reference-app .hologram-row .switch {
    flex: 0 0 50px;
}

.telegram-preview {
    overflow: hidden;
    border: 1px solid rgba(145,168,255,.14);
    border-radius: 18px;
    background: #0c1622;
    box-shadow: 0 10px 28px rgba(0,0,0,.2);
}

.telegram-preview-head {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 52px;
    padding: 9px 13px;
    border-bottom: 1px solid rgba(145,168,255,.12);
    background: #111d2b;
}

.telegram-preview-avatar {
    display: block;
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: #0c1018 url("./nikivus-avatar-current.png") center / cover no-repeat;
    box-shadow: 0 0 0 1px rgba(145,168,255,.3);
}

.telegram-preview-head div {
    display: grid;
    gap: 1px;
}

.telegram-preview-head b {
    font-size: 12px;
    font-weight: 750;
}

.telegram-preview-head small {
    color: #6e86a6;
    font-size: 9px;
}

.telegram-preview .chat {
    min-height: 184px;
    padding: 12px 12px 14px;
    border: 0;
    border-radius: 0;
    background-color: #0d1927;
    background-image:
        linear-gradient(rgba(145,168,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(145,168,255,.035) 1px, transparent 1px);
    background-size: 32px 32px;
    box-shadow: none;
}

.telegram-preview .chat-bubble {
    margin-left: auto;
    padding: 6px 6px 5px;
    border: 1px solid rgba(145,168,255,.12);
    border-radius: 15px 15px 5px 15px;
    background: #1b2a3a;
    box-shadow: 0 7px 18px rgba(0,0,0,.2);
}

.telegram-preview .chat-sticker {
    width: 102px;
    height: 102px;
}

.telegram-preview .chat-meta {
    color: #83a2d8;
    font-size: 10px;
}

.telegram-preview .chat-meta svg {
    color: #6d8dff;
}

body.reference-source .dialog-body .pack-choice-row small {
    color: #8792aa;
    font-size: 11px;
}
.grad-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grad-presets button { height: 46px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.grad-presets button.active { box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--accent); }
.grad-editor { padding: 16px; }
.grad-editor .field { margin-top: 12px; }
.grad-bar { position: relative; height: 40px; margin: 6px 11px 0; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); touch-action: none; cursor: copy; }
.grad-handle { position: absolute; top: 50%; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.4); transform: translate(-50%, -50%); touch-action: none; cursor: grab; }
.grad-handle.active { width: 30px; height: 30px; box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0,0,0,.5); z-index: 1; }
.grad-tools { display: flex; gap: 8px; margin-top: 14px; }
.chip-btn { min-height: 38px; padding: 0 16px; border-radius: 999px; background: var(--card-2); font-size: 14px; font-weight: 600; }
.chip-btn:disabled { opacity: .4; }
.grad-editor .slider { margin-top: 6px; }
.angle-quick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.angle-quick button { height: 38px; border-radius: 10px; background: var(--card-2); color: var(--soft); font-size: 17px; }
.angle-quick button.active { background: var(--accent); color: #fff; }
.check { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 7px; box-shadow: inset 0 0 0 2px #3a3a42; }
.check-row.active .check { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat; box-shadow: none; }
.grad-reset { margin-top: 18px; }

.opt-label { margin: 16px 2px 9px; color: var(--soft); font-size: 13px; font-weight: 600; text-transform: lowercase; }
.opt-label:first-child { margin-top: 0; }
.segmented.three { grid-template-columns: repeat(3, 1fr); background: var(--card-2); box-shadow: none; }
.segmented.four { grid-template-columns: repeat(4, 1fr); background: var(--card-2); box-shadow: none; }
.segmented.three button, .segmented.four button { min-height: 40px; font-size: 14px; padding: 0 4px; }
.effect-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.effect-chips .chip-btn { text-transform: lowercase; }
.effect-chips .chip-btn.active { background: var(--accent); color: #fff; }
.image-bg-card { margin-top: 12px; }
.legal-hint { font-size: 12px; }

/* Silver graphite palette based on the current NIKIVUS EMOJI avatar. */
body.reference-source {
    --bg: #080a0f;
    --card: #12151c;
    --card-2: #1b1f27;
    --line: rgba(218, 222, 230, .16);
    --ink: #f3f4f7;
    --soft: #9299a7;
    --accent: #cdd3dd;
    --accent-hover: #ffffff;
    --accent-soft: rgba(205, 211, 221, .14);
    background:
        radial-gradient(circle at 100% -10%, rgba(220, 225, 233, .11), transparent 31%),
        radial-gradient(circle at -12% 44%, rgba(125, 133, 146, .08), transparent 29%),
        var(--bg) !important;
}

body.reference-source .reference-app .topbar { border-color: rgba(218, 222, 230, .14); }
body.reference-source .reference-app .brand { color: #f3f4f7; }
body.reference-source .reference-app .brand-stack small,
body.reference-source .reference-app .section-label,
body.reference-source .reference-app .profile-username { color: #9299a7; }
body.reference-source .reference-app .category-pill {
    border-color: rgba(218, 222, 230, .22);
    background: #171a21;
    color: #e4e6eb;
}
body.reference-source .reference-app .category-pill svg { color: #cdd3dd; }
body.reference-source .reference-app .tile {
    background: #15181f;
    box-shadow: inset 0 0 0 1px rgba(218, 222, 230, .15), 0 9px 22px rgba(0, 0, 0, .2);
}
body.reference-source .reference-app .tile.selected {
    box-shadow: inset 0 0 0 2px #d7dce4, 0 0 0 3px rgba(205, 211, 221, .12), 0 10px 24px rgba(0, 0, 0, .3);
}
body.reference-source .reference-app .tile-badge,
body.reference-source .reference-app .pager-arrow {
    background: #d5dae3;
    color: #151820;
}
body.reference-source .reference-app .pager,
body.reference-source .reference-app .card,
body.reference-source .reference-app .chat,
body.reference-source .reference-app .menu-card,
body.reference-source .reference-app .pack {
    background: #12151c;
    box-shadow: inset 0 0 0 1px rgba(218, 222, 230, .15), 0 8px 24px rgba(0, 0, 0, .2);
}
body.reference-source .reference-app .pager-label,
body.reference-source .reference-app .row-value { color: #b0b6c1; }
body.reference-source .reference-app .segmented {
    background: #101218;
    box-shadow: inset 0 0 0 1px rgba(218, 222, 230, .16);
}
body.reference-source .reference-app .segmented button.active {
    background: #272b34;
    color: #f3f4f7;
    box-shadow: inset 0 0 0 1px rgba(218, 222, 230, .17);
}
body.reference-source .reference-app .choice.active {
    box-shadow: inset 0 0 0 2px #d5dae3, 0 0 0 2px rgba(205, 211, 221, .11);
}
body.reference-source .reference-app .choice-add { border-color: rgba(218, 222, 230, .13); background: #12151c; }
body.reference-source .reference-app .cta-bar { background: linear-gradient(0deg, #080a0f 68%, rgba(8, 10, 15, 0)); }
body.reference-source .reference-app .cta {
    border-color: rgba(238, 240, 244, .62);
    background: #cdd3dd;
    color: #11141a;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .32);
}
body.reference-source .reference-app .cta:hover { background: #f0f2f5; }
body.reference-source .reference-app .cta:disabled { background: #272b34; border-color: rgba(218, 222, 230, .14); color: #7e8592; }
body.reference-source .reference-app .profile-ring {
    background: #0d1016;
    box-shadow: 0 0 0 2px #cdd3dd, 0 0 0 7px rgba(205, 211, 221, .12), 0 12px 30px rgba(0, 0, 0, .34);
}
body.reference-source .reference-app .menu-card { border-color: rgba(218, 222, 230, .13); }
body.reference-source .reference-app .menu-icon { border-color: rgba(218, 222, 230, .1); background: #1b1f27; color: #d7dbe2; }
body.reference-source .reference-app .menu-card::after { color: #9299a7; }
body.reference-source .dialog-body .dialog-option,
body.reference-source .dialog-body .pack-choice-row { background: #1b1f27; color: #f3f4f7; }
body.reference-source .dialog-body .dialog-option:hover { background: #272b34; }
body.reference-source .dialog-body .dialog-option span { color: #d5dae3; }
body.reference-source .dialog-body .pack-choice-row small { color: #9299a7; }
body.reference-source .dialog-body .cta {
    display: grid;
    place-items: center;
    min-height: 54px;
    padding: 0 16px;
    border-radius: 16px;
    background: #cdd3dd;
    color: #11141a;
    font-weight: 800;
    text-decoration: none;
}
body.reference-source .dialog-body .cta:hover { background: #f0f2f5; }

body.reference-source .telegram-preview {
    border-color: rgba(218, 222, 230, .16);
    background: #11141a;
}
body.reference-source .telegram-preview-head {
    border-color: rgba(218, 222, 230, .12);
    background: #171a21;
}
body.reference-source .telegram-preview-avatar { box-shadow: 0 0 0 1px rgba(218, 222, 230, .34); }
body.reference-source .telegram-preview-head small { color: #9ba2af; }
body.reference-source .telegram-preview .chat {
    background-color: #0f1218;
    background-image:
        linear-gradient(rgba(218, 222, 230, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(218, 222, 230, .035) 1px, transparent 1px);
}
body.reference-source .telegram-preview .chat-bubble { border-color: rgba(218, 222, 230, .14); background: #242932; }
body.reference-source .telegram-preview .chat-meta { color: #b4bbc6; }
body.reference-source .telegram-preview .chat-meta svg { color: #d5dae3; }

body.reference-source .reference-app .avatar-btn {
    background: #12151c;
    box-shadow: 0 0 0 1px rgba(218, 222, 230, .2), 0 0 18px rgba(218, 222, 230, .08);
}

body.reference-source .reference-app .chat-sticker .ref-preview-image {
    animation: ref-preview-in .32s cubic-bezier(.2, .9, .3, 1.12) both;
    transform-origin: 50% 55%;
    will-change: opacity, transform;
}
body.reference-source .reference-app .chat-sticker .ref-preview-live {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}
body.reference-source .reference-app .chat-sticker .ref-preview-live svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    overflow: visible;
}

/* Cards use the original TGS/Lottie timeline. A poster is only an instant
   fallback while JSON is fetched, never the animation itself. */
body.reference-source .reference-app .tile-art > .live {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}
body.reference-source .reference-app .tile-art > .live svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    overflow: visible;
}
body.reference-source .reference-app .tile-art.playing > .live { opacity: 1; }
body.reference-source .reference-app .tile-art.playing > .poster { opacity: 0; }
body.reference-source .reference-app .choice .poster,
body.reference-source .reference-app .tile .poster {
    animation: none !important;
    transform: none !important;
    will-change: auto;
}
.legal-hint a { color: #9d8cff; }

body.reference-source .reference-app .position-dialog {
    display: grid;
    gap: 6px;
    padding: 10px 14px 12px;
    border: 1px solid rgba(218, 222, 230, .1);
    border-radius: 16px;
    background: #171a21;
}
body.reference-source .reference-app .position-axis {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 46px;
    align-items: center;
    gap: 10px;
    min-height: 46px;
}
body.reference-source .reference-app .position-axis b {
    color: #d5dae3;
    font-size: 14px;
}
body.reference-source .reference-app .position-axis input[type="range"] {
    direction: ltr;
}
body.reference-source .reference-app .position-axis output {
    min-width: 42px;
    padding: 5px 7px;
    border-radius: 8px;
    background: #242932;
    color: #f3f4f7;
    font-size: 12px;
    font-weight: 750;
    text-align: center;
}
body.reference-source .reference-app .position-center-hint {
    color: #9299a7;
    font-size: 11px;
    text-align: center;
}

/* User TGS import tab */
body.reference-source .reference-app .topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.reference-source .reference-app .import-tab-button {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid rgba(218, 222, 230, .2);
    border-radius: 12px;
    background: #171a21;
    color: #e9edf3;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

body.reference-source .reference-app .import-tab-button:hover {
    border-color: rgba(238, 240, 244, .55);
    background: #242932;
    transform: translateY(-1px);
}

body.reference-source .reference-app .import-home-button {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: -4px 0 18px;
    padding: 12px 13px;
    border: 1px solid rgba(218, 222, 230, .18);
    border-radius: 16px;
    background: linear-gradient(135deg, #242932, #171a21);
    color: #f3f4f7;
    text-align: left;
    transition: transform .22s ease, border-color .22s ease, background .22s ease;
}

body.reference-source .reference-app .import-home-button:hover {
    border-color: rgba(238, 240, 244, .62);
    background: linear-gradient(135deg, #303641, #1b1f27);
    transform: translateY(-1px);
}

body.reference-source .reference-app .import-home-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: #d5dae3;
    color: #11141a;
    font-size: 22px;
    font-weight: 900;
}

body.reference-source .reference-app .import-home-button b,
body.reference-source .reference-app .import-home-button small {
    display: block;
}

body.reference-source .reference-app .import-home-button b { font-size: 12px; }
body.reference-source .reference-app .import-home-button small { margin-top: 3px; color: #aeb5c0; font-size: 10px; }
body.reference-source .reference-app .import-home-button i { color: #d5dae3; font-size: 18px; font-style: normal; }

body.reference-source .reference-app .import-page {
    padding-bottom: 26px;
}

body.reference-source .reference-app .import-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

body.reference-source .reference-app .import-heading .page-title {
    margin-bottom: 8px;
}

body.reference-source .reference-app .import-subtitle {
    max-width: 280px;
    margin: 0;
    color: #9299a7;
    font-size: 12px;
    line-height: 1.45;
}

body.reference-source .reference-app .import-back {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(218, 222, 230, .18);
    border-radius: 50%;
    background: #171a21;
    color: #d7dbe2;
    font-size: 22px;
    line-height: 1;
}

body.reference-source .reference-app .import-drop {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 24px 16px;
    border: 1px dashed rgba(218, 222, 230, .32);
    border-radius: 18px;
    background: linear-gradient(145deg, #171a21, #101218);
    color: #f3f4f7;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

body.reference-source .reference-app .import-drop:hover,
body.reference-source .reference-app .import-drop.dragging {
    border-color: #d5dae3;
    background: #242932;
    transform: translateY(-1px);
}

body.reference-source .reference-app .import-drop-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #d5dae3;
    color: #11141a;
    font-size: 22px;
    font-weight: 900;
}

body.reference-source .reference-app .import-drop b {
    font-size: 14px;
}

body.reference-source .reference-app .import-drop small,
body.reference-source .reference-app .import-item-head small,
body.reference-source .reference-app .import-target small {
    color: #9299a7;
    font-size: 11px;
}

body.reference-source .reference-app .import-list {
    display: grid;
    gap: 10px;
    margin: 14px 0 20px;
}

body.reference-source .reference-app .import-item {
    padding: 13px;
    border: 1px solid rgba(218, 222, 230, .14);
    border-radius: 16px;
    background: #12151c;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}

body.reference-source .reference-app .import-item-head {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

body.reference-source .reference-app .import-item-head b,
body.reference-source .reference-app .import-item-head small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.reference-source .reference-app .import-file-icon {
    display: grid;
    place-items: center;
    min-height: 30px;
    border-radius: 9px;
    background: #272b34;
    color: #d5dae3;
    font-size: 10px;
    font-weight: 900;
}

body.reference-source .reference-app .import-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #242932;
    color: #d7dbe2;
    font-size: 18px;
}

body.reference-source .reference-app .import-field {
    display: grid;
    grid-template-columns: 1fr minmax(108px, 1.1fr);
    align-items: center;
    gap: 10px;
    min-height: 42px;
    border-top: 1px solid rgba(218, 222, 230, .1);
}

body.reference-source .reference-app .import-field span {
    color: #b0b6c1;
    font-size: 12px;
    font-weight: 700;
}

body.reference-source .reference-app .import-field input,
body.reference-source .reference-app .import-pack-select {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(218, 222, 230, .14);
    border-radius: 10px;
    outline: none;
    background: #1b1f27;
    color: #f3f4f7;
    font: inherit;
    font-size: 12px;
    text-align: right;
}

body.reference-source .reference-app .import-field input:focus,
body.reference-source .reference-app .import-pack-select:focus {
    border-color: rgba(238, 240, 244, .58);
}

body.reference-source .reference-app .import-targets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 10px;
}

body.reference-source .reference-app .import-target {
    display: grid;
    gap: 4px;
    min-height: 64px;
    padding: 12px;
    border: 1px solid rgba(218, 222, 230, .14);
    border-radius: 14px;
    background: #12151c;
    color: #e9edf3;
    text-align: left;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

body.reference-source .reference-app .import-target.active {
    border-color: rgba(238, 240, 244, .7);
    background: #272b34;
    transform: translateY(-1px);
}

body.reference-source .reference-app .import-target b {
    font-size: 12px;
}

body.reference-source .reference-app .import-pack-select {
    display: block;
    margin-bottom: 10px;
    min-height: 42px;
    text-align: left;
}

body.reference-source .reference-app .import-note,
body.reference-source .reference-app .import-empty {
    margin: 12px 2px 16px;
    color: #9299a7;
    font-size: 11px;
    line-height: 1.45;
}

body.reference-source .reference-app .import-empty {
    padding: 20px;
    border: 1px dashed rgba(218, 222, 230, .16);
    border-radius: 16px;
    text-align: center;
}

body.reference-source .reference-app .import-create-button {
    position: static;
    width: 100%;
    margin-top: 4px;
}

/* Imported TGS cards behave like small editor panels: the source animation
   stays visible while text and size are adjusted beside it. */
body.reference-source .reference-app .import-item-visual {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

body.reference-source .reference-app .import-preview-wrap {
    position: relative;
    width: 112px;
    height: 112px;
}

body.reference-source .reference-app .import-preview {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    overflow: hidden;
    border: 1px solid rgba(218, 222, 230, .18);
    border-radius: 18px;
    background: radial-gradient(circle at 50% 42%, #303642, #1b1f27 72%);
    transition: border-color .25s ease, box-shadow .25s ease;
}

body.reference-source .reference-app .import-preview.is-ready {
    border-color: rgba(218, 222, 230, .42);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}

body.reference-source .reference-app .import-preview svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    overflow: visible;
}

body.reference-source .reference-app .import-preview-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 2px solid #12151c;
    border-radius: 999px;
    background: #d7dbe2;
    color: #15181e;
    font-size: 11px;
    font-weight: 800;
}

body.reference-source .reference-app .import-preview-error {
    padding: 10px;
    color: #aeb5c0;
    font-size: 10px;
    line-height: 1.3;
    text-align: center;
}

body.reference-source .reference-app .import-item-controls {
    min-width: 0;
}

body.reference-source .reference-app .import-item-controls .import-item-head {
    margin-bottom: 6px;
}

body.reference-source .reference-app .import-size-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    border-top: 1px solid rgba(218, 222, 230, .1);
    color: #b0b6c1;
    font-size: 11px;
    font-weight: 700;
}

body.reference-source .reference-app .import-size-head output {
    color: #f3f4f7;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

body.reference-source .reference-app .import-size-auto {
    padding: 4px 7px;
    border: 1px solid rgba(218, 222, 230, .16);
    border-radius: 7px;
    background: #1b1f27;
    color: #c7cdd7;
    font: inherit;
    font-size: 10px;
}

body.reference-source .reference-app .import-size-range {
    display: block;
    width: 100%;
    height: 18px;
    margin: 0 0 2px;
    accent-color: #d5dae3;
}

@media (max-width: 360px) {
    body.reference-source .reference-app .import-item-visual {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 9px;
    }
    body.reference-source .reference-app .import-preview,
    body.reference-source .reference-app .import-preview-wrap {
        width: 92px;
        height: 92px;
    }
}
