/* =========================
   БАЗОВЫЙ ФОН — iOS палитра Lotti
   ========================= */

/* Nunito — rounded fallback for non-Apple platforms (Apple gets ui-rounded = SF Pro Rounded) */
@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap");

:root {
    /* Фоновый градиент (iOS: topLeading → bottomTrailing) */
    --bg-grad-1: #FFD9EB;  /* Color(1.00, 0.86, 0.92) */
    --bg-grad-2: #D4E8FF;  /* Color(0.83, 0.91, 1.00) */
    --bg-grad-3: #E6D1F7;  /* Color(0.90, 0.82, 0.97) */

    /* OP palette */
    --lotti-pink:     #FFB5C8;  /* OP.pink */
    --lotti-blue:     #A8D8EA;  /* OP.blue */
    --lotti-lavender: #E8C5E5;  /* OP.lavender */
    --lotti-peach:    #FFD4B2;
    --lotti-mint:     #C7F2E0;

    /* Text */
    --lotti-text-title: #613851;  /* OP.textTitle */
    --lotti-text-sub:   #947389;  /* OP.textSub */

    /* Button gradient */
    --lotti-btn-from: #FF99B8;  /* OP.buttonGradient start */
    --lotti-btn-to:   #F877A6;  /* OP.buttonGradient end */

    /* Sheet */
    --lotti-sheet-bg: #FAF7FC;

    /* Legacy iOS vars (kept for compatibility) */
    --ios-bg:           #f2f4f7;
    --ios-sheet-bg:     var(--lotti-sheet-bg);
    --ios-title:        var(--lotti-text-title);
    --ios-accent:       var(--lotti-btn-from);
    --ios-accent-pressed: var(--lotti-btn-to);
    --ios-muted:        var(--lotti-text-sub);
    --ios-separator:    rgba(97, 56, 81, 0.08);
    --ios-card-bg:      #ffffff;
    --ios-card-border:  rgba(255, 153, 184, 0.35);

    --radius-xl: 28px;
    --radius-lg: 18px;
    --radius-md: 12px;

    --shadow-soft: 0 4px 14px rgba(97, 56, 81, 0.07);
    --tap-h: 56px;
}

/* Глобальный сброс */
*, *::before, *::after { box-sizing: border-box; }
img { display: block; max-width: 100%; }
ul, li { list-style: none; margin: 0; padding: 0; }

html, body { height: 100%; margin: 0; }

body.app-bg {
    background:
        linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 50%, var(--bg-grad-3) 100%)
        fixed;
    background-color: var(--bg-grad-1);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    color: var(--lotti-text-title);
    /* iOS uses SF Pro Rounded (.system design: .rounded); web equivalent: */
    /* ui-rounded = SF Pro Rounded on macOS/iOS 14+, Nunito on all other platforms */
    font-family: ui-rounded, "Nunito", -apple-system, BlinkMacSystemFont, system-ui,
                 "Segoe UI", Roboto, Arial, sans-serif;
}

/* Белый/светлый лист поверх градиента */
.sheet {
    background: var(--lotti-sheet-bg);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    box-shadow: 0 -4px 24px rgba(97, 56, 81, 0.08);
}

/* Первичная кнопка (градиент) */
@keyframes btnGlow {
    0%, 100% { box-shadow: 0 8px 22px rgba(248,119,166,.28); }
    50%      { box-shadow: 0 12px 32px rgba(248,119,166,.52); }
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: var(--tap-h);
    border: none;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--lotti-btn-from), var(--lotti-btn-to));
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    animation: btnGlow 2.4s ease-in-out infinite;
    transition: transform .1s ease, opacity .1s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary:active {
    transform: scale(0.88);
    animation: none;
    box-shadow: 0 4px 12px rgba(248,119,166,.25);
}
.btn-primary:disabled {
    opacity: .5;
    animation: none;
    box-shadow: none;
    cursor: default;
    pointer-events: none;
}

/* Вторичная кнопка */
.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 22px;
    background: rgba(148, 115, 137, 0.12);
    color: var(--lotti-text-sub);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.btn-secondary:active { opacity: .7; }

/* Нижняя панель с кнопкой (фиксированная) */
.bottom-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(250,247,252,.82) 28%,
        var(--lotti-sheet-bg) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Шапка страницы (header zone — поверх градиента) */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: calc(env(safe-area-inset-top) + 16px) 22px 0 22px;
    height: 130px;
}
.page-header__left { display: flex; flex-direction: column; gap: 6px; }
.page-header__title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0,0,0,.22);
    line-height: 1.15;
    padding-bottom: 14px;
}

/* Кнопка «Назад» в хедере */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px 0;
    color: rgba(160, 210, 235, 1);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.back-btn__icon {
    width: 9px; height: 9px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    flex-shrink: 0;
}

/* Аксолотль в хедере */
@keyframes axolotlBob {
    0%, 100% { transform: translateY(5px); }
    50%      { transform: translateY(-6px); }
}
@keyframes axolotlTilt {
    0%, 100% { transform: rotate(-4deg); }
    50%      { transform: rotate(4deg); }
}
.header-axolotl {
    width: 100px; height: 100px;
    object-fit: contain;
    margin-bottom: -40px;
    flex-shrink: 0;
    transform-origin: center bottom;
    animation: axolotlBob 2.2s ease-in-out .5s infinite,
               axolotlTilt 2.8s ease-in-out .5s infinite;
}

/* Прокручиваемый основной контент */
.page-sheet {
    background: var(--lotti-sheet-bg);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -4px 24px rgba(97,56,81,.08);
    min-height: calc(100dvh - 90px);
    padding: 24px 0 160px 0;
}

/* Заголовок секции */
.section-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--lotti-text-sub);
    padding: 0 20px;
    margin: 16px 0 8px;
}

/* Белая карточка */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

/* Pill-тег */
.pill-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

/* Accessibility */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.hidden { display: none !important; }
