:root {
    --bg: #f8e3c8;
    --bg-soft: #f4d9b8;
    --card-bg: #fdf2dd;
    --card-stroke: #f0cfa2;
    --accent: #d78246;
    --accent-strong: #b66432;
    --accent-soft: rgba(215, 130, 70, 0.12);

    --text-main: #5a3a24;
    --text-soft: #8c6a49;
    --text-muted: #b58c63;

    --radius-lg: 26px;
    --radius-pill: 999px;

    --shadow-soft: 0 14px 30px rgba(203, 152, 92, 0.25);
    --snow-cap-height: 28px;
    --snow-cap: radial-gradient(120% 30px at 50% -6px,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(255, 255, 255, 0.92) 60%,
            rgba(255, 255, 255, 0) 72%),
        linear-gradient(180deg,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(255, 255, 255, 0.9) 60%,
            rgba(255, 255, 255, 0) 100%);
}

body[data-theme="cozy"] {
    --bg: #f2d2ad;
    --bg-soft: #e9b98b;
    --card-bg: #fff1da;
    --card-stroke: #e0b17c;
    --accent: #c56a2d;
    --accent-strong: #9b4d21;
    --accent-soft: rgba(197, 106, 45, 0.16);
    --text-main: #5a341c;
    --text-soft: #7a5131;
    --text-muted: #a0744e;
    --shadow-soft: 0 14px 30px rgba(186, 120, 70, 0.3);
}

body[data-theme="festive"] {
    --bg: #f5cfc5;
    --bg-soft: #f0b2a5;
    --card-bg: #fff0ec;
    --card-stroke: #e9a79b;
    --accent: #c64f3d;
    --accent-strong: #9f2f29;
    --accent-soft: rgba(198, 79, 61, 0.16);
    --text-main: #6a2c24;
    --text-soft: #87403a;
    --text-muted: #b06b62;
    --shadow-soft: 0 14px 30px rgba(176, 88, 78, 0.28);
    --garland-line: rgba(122, 43, 35, 0.85);
    --garland-bulb-1: #f35b5b;
    --garland-bulb-2: #f4c44f;
    --garland-bulb-3: #4fb5ff;
    --garland-bulb-4: #6fd47f;
}

body[data-theme="minimal"] {
    --bg: #f1f0ed;
    --bg-soft: #e3e0db;
    --card-bg: #f9f7f4;
    --card-stroke: #d6d1c7;
    --accent: #8f7b63;
    --accent-strong: #6f5d4b;
    --accent-soft: rgba(143, 123, 99, 0.14);
    --text-main: #4b4036;
    --text-soft: #6c5f53;
    --text-muted: #9a8c7d;
    --shadow-soft: 0 12px 24px rgba(140, 130, 120, 0.22);
}

body[data-theme="sunset"] {
    --bg: #f7d6c0;
    --bg-soft: #f0b6a7;
    --card-bg: #fff1e7;
    --card-stroke: #f0b59b;
    --accent: #e36a4a;
    --accent-strong: #c54b36;
    --accent-soft: rgba(227, 106, 74, 0.16);
    --text-main: #6b2e25;
    --text-soft: #8f4b3f;
    --text-muted: #b26f5f;
    --shadow-soft: 0 14px 30px rgba(200, 105, 80, 0.3);
}

body[data-theme="ocean"] {
    --bg: #d9eef0;
    --bg-soft: #b9dde2;
    --card-bg: #f2fbfb;
    --card-stroke: #9ecbd1;
    --accent: #2f8c8f;
    --accent-strong: #1f6f73;
    --accent-soft: rgba(47, 140, 143, 0.16);
    --text-main: #214b4e;
    --text-soft: #3d6b6f;
    --text-muted: #6e9aa0;
    --shadow-soft: 0 14px 30px rgba(70, 130, 140, 0.28);
}

/* базовый фон и контейнер */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        sans-serif;
    background: radial-gradient(circle at top, var(--bg), var(--bg-soft));
    color: var(--text-main);
}

.snow-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    opacity: 0.85;
}

input,
textarea,
button {
    font-size: 16px;
}

.app {
    min-height: 100vh;
    max-width: 420px;
    margin: 0 auto;
    padding: 16px 14px 80px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.onboard-root {
    position: relative;
    z-index: 1;
}

.card {
    background-color: var(--card-bg);
    background-image: var(--snow-cap);
    background-repeat: no-repeat;
    background-size: 100% var(--snow-cap-height);
    background-position: 0 0;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--card-stroke);
    box-shadow: var(--shadow-soft);
}

body[data-theme="festive"] .card,
body[data-theme="festive"] .settings-modal,
body[data-theme="festive"] .pay-modal,
body[data-theme="festive"] .album-modal,
body[data-theme="festive"] .wishlist-modal,
body[data-theme="festive"] .ideas-shuffle-modal,
body[data-theme="festive"] .modal-card,
body[data-theme="festive"] .onboard-card {
    position: relative;
    z-index: 0;
}

body[data-theme="festive"] .card > *,
body[data-theme="festive"] .settings-modal > *,
body[data-theme="festive"] .pay-modal > *,
body[data-theme="festive"] .album-modal > *,
body[data-theme="festive"] .wishlist-modal > *,
body[data-theme="festive"] .ideas-shuffle-modal > *,
body[data-theme="festive"] .modal-card > *,
body[data-theme="festive"] .onboard-card > * {
    position: relative;
    z-index: 1;
}

body[data-theme="festive"] .card::before,
body[data-theme="festive"] .settings-modal::before,
body[data-theme="festive"] .pay-modal::before,
body[data-theme="festive"] .album-modal::before,
body[data-theme="festive"] .wishlist-modal::before,
body[data-theme="festive"] .ideas-shuffle-modal::before,
body[data-theme="festive"] .modal-card::before,
body[data-theme="festive"] .onboard-card::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 12px;
    right: 12px;
    height: 12px;
    background-color: var(--garland-line);
    background-image: linear-gradient(var(--garland-line), var(--garland-line));
    background-size: 100% 2px;
    background-position: center;
    background-repeat: no-repeat;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='12'%20viewBox='0%200%2064%2012'%3E%3Cpath%20d='M0%206%20C8%200%2024%200%2032%206%20C40%2012%2056%2012%2064%206'%20stroke='%23fff'%20stroke-width='2'%20fill='none'%20stroke-linecap='round'/%3E%3C/svg%3E");
    -webkit-mask-size: 64px 12px;
    -webkit-mask-repeat: repeat-x;
    -webkit-mask-position: left center;
    mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='12'%20viewBox='0%200%2064%2012'%3E%3Cpath%20d='M0%206%20C8%200%2024%200%2032%206%20C40%2012%2056%2012%2064%206'%20stroke='%23fff'%20stroke-width='2'%20fill='none'%20stroke-linecap='round'/%3E%3C/svg%3E");
    mask-size: 64px 12px;
    mask-repeat: repeat-x;
    mask-position: left center;
    opacity: 0.9;
    pointer-events: none;
}

body[data-theme="festive"] .card::after,
body[data-theme="festive"] .settings-modal::after,
body[data-theme="festive"] .pay-modal::after,
body[data-theme="festive"] .album-modal::after,
body[data-theme="festive"] .wishlist-modal::after,
body[data-theme="festive"] .ideas-shuffle-modal::after,
body[data-theme="festive"] .modal-card::after,
body[data-theme="festive"] .onboard-card::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 10px;
    right: 10px;
    height: 16px;
    background-image: radial-gradient(circle at 10px 4px,
            var(--garland-bulb-1) 0 3px,
            rgba(255, 255, 255, 0.45) 4px,
            transparent 6px),
        radial-gradient(circle at 22px 12px,
            var(--garland-bulb-2) 0 3px,
            rgba(255, 255, 255, 0.4) 4px,
            transparent 6px),
        radial-gradient(circle at 34px 4px,
            var(--garland-bulb-3) 0 3px,
            rgba(255, 255, 255, 0.4) 4px,
            transparent 6px),
        radial-gradient(circle at 46px 12px,
            var(--garland-bulb-4) 0 3px,
            rgba(255, 255, 255, 0.4) 4px,
            transparent 6px);
    background-size: 56px 16px;
    background-repeat: repeat-x;
    animation: garland-blink 1.6s ease-in-out infinite;
    pointer-events: none;
}

body[data-theme="festive"] .settings-modal,
body[data-theme="festive"] .pay-modal,
body[data-theme="festive"] .album-modal,
body[data-theme="festive"] .wishlist-modal,
body[data-theme="festive"] .ideas-shuffle-modal,
body[data-theme="festive"] .modal-card,
body[data-theme="festive"] .card {
    padding-top: 20px;
}

body[data-theme="festive"] .onboard-card {
    padding-top: 28px;
}

body[data-theme="festive"] .settings-modal-close,
body[data-theme="festive"] .ideas-shuffle-close,
body[data-theme="festive"] .modal-close {
    position: absolute;
    z-index: 2;
}

/* нижняя навигация */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 10px;
    max-width: 420px;
    margin: 0 auto;
    padding: 6px 14px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.beige-nav {
    background: transparent;
    backdrop-filter: none;
}

.nav-btn {
    flex: 1;
    border-radius: 999px;
    border: 1px solid rgba(231, 189, 138, 0.9);
    background: #fdf2dd;
    color: var(--text-soft);
    padding: 6px 0 7px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(200, 150, 100, 0.15);
}

.nav-btn-active {
    background: #f9e0bf;
    color: var(--text-main);
}

.nav-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nav-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.nav-label {
    font-size: 11px;
}

/* общая primary-кнопка */

.primary-btn {
    border-radius: var(--radius-pill);
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fffdf6;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(170, 105, 60, 0.55);
}

.primary-btn-full {
    width: 100%;
    text-align: center;
}

.secondary-btn {
    border-radius: var(--radius-pill);
    border: 1px solid rgba(232, 186, 119, 0.9);
    background: #fdf2dd;
    color: var(--text-soft);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn:active {
    transform: translateY(1px);
}

/* настройки */

.settings-tab {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: 12px;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 1px solid rgba(231, 189, 138, 0.9);
    background: rgba(253, 242, 221, 0.92);
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(200, 150, 100, 0.2);
    opacity: 0.6;
    transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
    z-index: 9;
}

.settings-tab.premium-tab {
    top: calc(12px + env(safe-area-inset-top, 0px) + 46px);
}

.settings-tab:focus-visible,
.settings-tab:hover {
    opacity: 1;
    color: var(--text-main);
    transform: translateY(-2px);
}

.settings-tab:active {
    transform: translateY(0);
}

.settings-tab-icon {
    font-size: 18px;
    line-height: 1;
}

.settings-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(60, 42, 26, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 70;
}

.settings-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.settings-modal {
    width: min(360px, 92vw);
    background: var(--card-bg);
    border-radius: 22px;
    border: 1.5px solid var(--card-stroke);
    box-shadow: var(--shadow-soft);
    padding: 18px 16px 16px;
    position: relative;
    max-height: 88vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.pay-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(60, 42, 26, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 80;
}

.pay-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.pay-modal {
    width: min(360px, 92vw);
    background: var(--card-bg);
    border-radius: 22px;
    border: 1.5px solid var(--card-stroke);
    box-shadow: var(--shadow-soft);
    padding: 18px 16px 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pay-modal-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

.pay-modal-price {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.pay-modal-price img {
    width: 18px;
    height: 18px;
}

.pay-modal-actions {
    display: grid;
    gap: 8px;
}

.settings-modal-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
}

.settings-modal-subtitle {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--text-soft);
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(232, 186, 119, 0.7);
    background: #fff7ea;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.settings-section + .settings-section {
    margin-top: 12px;
}

.settings-section .settings-modal-subtitle {
    margin: 0;
    font-weight: 600;
    color: var(--text-main);
}

.settings-section .settings-theme-grid {
    margin-top: 0;
}

.settings-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: none;
    background: transparent;
    color: var(--text-soft);
    font-size: 16px;
    cursor: pointer;
}

.settings-language-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.settings-lang-btn {
    border-radius: 16px;
    border: 1px solid rgba(231, 189, 138, 0.9);
    background: #fffaf1;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-soft);
    font-size: 12px;
    transition: transform 0.12s ease, box-shadow 0.12s ease,
        background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.settings-lang-btn:focus-visible {
    outline: 2px solid rgba(215, 130, 70, 0.45);
    outline-offset: 2px;
}

.settings-lang-btn.is-active {
    border-color: var(--accent);
    background: rgba(215, 130, 70, 0.12);
    color: var(--text-main);
    box-shadow: 0 6px 14px rgba(215, 130, 70, 0.18);
    transform: translateY(-1px);
}

.settings-lang-btn:active {
    transform: translateY(0);
}

.settings-lang-flag {
    font-size: 20px;
    line-height: 1;
}

.settings-lang-label {
    font-weight: 600;
}

.settings-modal-note {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--text-soft);
    background: #fffaf1;
    border: 1px dashed rgba(232, 186, 119, 0.6);
    border-radius: 14px;
    padding: 8px 12px;
}

.premium-modal-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-soft);
}

.premium-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(232, 186, 119, 0.7);
    background: linear-gradient(180deg, #fffaf1, #fff2de);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.premium-badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(215, 130, 70, 0.12);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
}

.premium-lead {
    margin: 0;
    font-size: 12px;
    color: var(--text-soft);
}

.premium-benefits {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
    font-size: 12px;
    color: var(--text-soft);
}

.premium-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.premium-benefits li::before {
    content: "✦";
    color: rgba(215, 130, 70, 0.7);
    font-size: 10px;
    line-height: 1.4;
    margin-top: 2px;
}

.premium-plans {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.premium-plan-card {
    border-radius: 18px;
    padding: 12px;
    border: 1px solid rgba(232, 186, 119, 0.7);
    background: #fff6e8;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 20px rgba(203, 152, 92, 0.18);
}

.premium-plan-card[data-plan="lifetime"] {
    border-color: rgba(215, 130, 70, 0.9);
    background: linear-gradient(180deg, #fff0d5, #ffe2bf);
}

.premium-plan-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.premium-plan-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.premium-plan-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(215, 130, 70, 0.12);
}

.premium-plan-desc {
    margin: 0;
    font-size: 12px;
    color: var(--text-soft);
}

.premium-plan-cta {
    border: none;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fffdf6;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(170, 105, 60, 0.4);
}

.premium-plan-cta:active {
    filter: brightness(0.96);
}

.premium-list {
    margin: 0;
    padding-left: 16px;
    font-size: 12px;
    color: var(--text-soft);
    display: grid;
    gap: 4px;
}

.premium-options {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.settings-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.settings-theme-card {
    border: 1px solid rgba(232, 186, 119, 0.8);
    border-radius: 16px;
    padding: 10px;
    background: #fff4e2;
    font-size: 12px;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    position: relative;
}

.settings-theme-card.is-active {
    border-color: rgba(215, 130, 70, 0.9);
    box-shadow: 0 6px 14px rgba(203, 152, 92, 0.25);
}

.settings-theme-card.is-locked {
    opacity: 0.6;
}

.settings-theme-card.is-locked::after {
    content: "🔒";
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 12px;
}

@keyframes garland-blink {
    0%,
    100% {
        opacity: 0.75;
        filter: brightness(0.85);
    }

    50% {
        opacity: 1;
        filter: brightness(1.2);
    }
}

@media (min-width: 460px) {
    .settings-tab {
        right: calc(50% - 210px + 12px);
    }
}
