/* Имя ребёнка VK Mini App. Светлая по умолчанию, тёмная — [data-scheme="dark"]. */
:root {
    --brand: #e0568b;
    --brand-2: #f0789f;
    --accent: #7b6ef5;
    --bg: #f6f0f3;
    --surface: #ffffff;
    --text: #241722;
    --text-dim: #7a6a76;
    --border: #eee0e8;
    --radius: 16px;
    --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow: 0 6px 24px rgba(64,16,48,.12);

    --like: #2fae6f;
    --skip: #e0483d;
    --card-boy: linear-gradient(160deg, #eaf2ff, #dbe8fd);
    --card-girl: linear-gradient(160deg, #ffeef5, #fddbe9);
    --card-text: #241722;
}
[data-scheme="dark"] {
    --bg: #1a1218; --surface: #251a22; --text: #f3eaf0; --text-dim: #a892a1; --border: #3a2a35;
    --card-boy: linear-gradient(160deg, #23304a, #1b2436);
    --card-girl: linear-gradient(160deg, #47243a, #33192b);
    --card-text: #f3eaf0;
}

/* Тема по выбранному полу: мальчик — голубая, сюрприз — фиолетовая (девочка = базовая розовая). */
[data-gender="m"] {
    --brand: #4d82e0; --brand-2: #74a0ee;
    --bg: #eef2fa; --surface: #ffffff;
    --text: #16202c; --text-dim: #66788c; --border: #dfe7f2;
    --shadow: 0 6px 24px rgba(16,40,80,.12);
}
[data-scheme="dark"][data-gender="m"] {
    --bg: #111826; --surface: #1a2434; --text: #eaf0f8; --text-dim: #8fa2b8; --border: #2b3a4f;
}
[data-gender="all"] {
    --brand: #8a63d9; --brand-2: #a685ea;
    --bg: #f2eff8; --surface: #ffffff;
    --text: #1f1729; --text-dim: #776c88; --border: #e7e0f1;
    --shadow: 0 6px 24px rgba(48,24,80,.12);
}
[data-scheme="dark"][data-gender="all"] {
    --bg: #171221; --surface: #221a30; --text: #f0eaf8; --text-dim: #a094b4; --border: #362a4a;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px; line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    transition: background-color .35s ease, color .35s ease;
}
.seg-btn.active, .btn-primary, .btn-secondary, .icon-btn, .badge-count {
    transition: background-color .35s ease, border-color .35s ease, transform .06s ease, opacity .15s ease;
}
.hidden { display: none !important; }
#app { min-height: 100%; display: flex; flex-direction: column; }
.screen {
    flex: 1; display: flex; flex-direction: column;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

/* --- Меню --- */
#screen-menu { align-items: center; justify-content: center; gap: 8px; }
.menu-logo-img { width: 88px; height: 88px; border-radius: 22px; box-shadow: var(--shadow); }
.menu-title { font-size: 32px; font-weight: 800; margin: 6px 0 2px; }
.menu-tagline { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; text-align: center; }
.menu-actions { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.rules-link { margin-top: 22px; background: none; border: none; color: var(--text-dim); font-family: var(--font); font-size: 14px; font-weight: 600; text-decoration: underline; cursor: pointer; }

.btn {
    font-family: var(--font); font-size: 16px; font-weight: 700;
    border: none; border-radius: var(--radius); padding: 15px 18px;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform .06s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.badge { font-size: 11px; font-weight: 700; background: var(--border); color: var(--text-dim); padding: 2px 8px; border-radius: 999px; }
.badge-count { background: var(--brand); color: #fff; min-width: 22px; text-align: center; }

.picker { margin-top: 14px; text-align: center; }
.picker-label { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.seg { display: inline-flex; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.seg-btn { border: none; background: transparent; color: var(--text-dim); font-family: var(--font); font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.seg-btn.active { background: var(--brand); color: #fff; }

/* --- Шапка экранов --- */
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.status { font-weight: 700; font-size: 15px; text-align: center; flex: 1; }

/* --- Колода карточек --- */
.deck-wrap { flex: 1; display: flex; justify-content: center; align-items: center; min-height: 0; }
.deck { position: relative; width: min(88vw, 380px); height: min(62vh, 460px); }
.card {
    position: absolute; inset: 0;
    border-radius: 24px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 28px 22px; text-align: center;
    color: var(--card-text);
    touch-action: none; user-select: none; -webkit-user-select: none;
    will-change: transform;
}
.card.boy { background: var(--card-boy); }
.card.girl { background: var(--card-girl); }
/* Вторая/третья карта в стопке */
.card.under { transform: scale(.95) translateY(14px); filter: brightness(.97); pointer-events: none; }
.card.under2 { transform: scale(.9) translateY(28px); filter: brightness(.94); pointer-events: none; }
.card.dragging { transition: none; cursor: grabbing; }
.card.flyout { transition: transform .35s ease, opacity .35s ease; opacity: 0; pointer-events: none; }
.card.restore { transition: transform .2s ease; }

.card-gender { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .55; margin-bottom: 10px; }
.card-name { font-size: clamp(34px, 9vw, 44px); font-weight: 800; line-height: 1.1; }
.card-meaning { margin-top: 14px; font-size: 16px; font-weight: 600; opacity: .85; }
.card-origin { margin-top: 8px; font-size: 13px; opacity: .55; }

/* Штампы нравится/дальше при перетаскивании */
.card .stamp {
    position: absolute; top: 22px; padding: 6px 14px;
    border: 3px solid; border-radius: 10px;
    font-size: 20px; font-weight: 800; letter-spacing: .04em;
    opacity: 0; transform: rotate(-12deg);
}
.card .stamp-like { left: 18px; color: var(--like); border-color: var(--like); }
.card .stamp-skip { right: 18px; color: var(--skip); border-color: var(--skip); transform: rotate(12deg); }

/* --- Кнопки под колодой --- */
.swipe-actions { display: flex; justify-content: center; align-items: center; gap: 22px; padding: 18px 0 6px; }
.round-btn {
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; box-shadow: var(--shadow);
    transition: transform .06s ease;
    background: var(--surface); color: var(--text);
}
.round-btn:active { transform: scale(.92); }
.round-skip { width: 64px; height: 64px; color: var(--skip); }
.round-like { width: 64px; height: 64px; color: var(--like); }
.round-undo { width: 48px; height: 48px; font-size: 20px; color: var(--text-dim); }

/* --- Избранное --- */
.fav-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.fav-empty { color: var(--text-dim); text-align: center; margin-top: 40px; padding: 0 24px; }
.fav-item {
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; display: flex; align-items: center; gap: 12px;
}
.fav-item .fav-gender { font-size: 20px; }
.fav-item .fav-body { flex: 1; min-width: 0; }
.fav-item .fav-name { font-weight: 800; font-size: 17px; }
.fav-item .fav-meta { color: var(--text-dim); font-size: 13px; }
.fav-item .fav-del { border: none; background: none; color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 6px; }
.fav-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }

/* --- Оверлей --- */
.overlay { position: fixed; inset: 0; background: rgba(24,6,18,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.overlay-card { background: var(--surface); border-radius: 22px; padding: 28px 24px; width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.overlay-emoji { font-size: 56px; }
.overlay-title { font-size: 24px; font-weight: 800; margin-bottom: 2px; }
.overlay-text { color: var(--text-dim); font-size: 14px; margin-bottom: 6px; }
.rules-card { text-align: left; max-width: 360px; }
.rules-card .overlay-title { text-align: center; }
.rules-list { margin: 4px 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--text-dim); font-size: 14px; line-height: 1.4; }
.rules-list li { padding-left: 2px; }

/* --- Toast --- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
