/* ===========================================
   Home Page — Black Minimal Landing
   =========================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-0);
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    opacity: 0;
    transition: opacity var(--t-page) ease;
}

body.loaded { opacity: 1; }

html[lang="ja"] body,
html[lang="zh"] body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans CJK SC', 'Noto Sans CJK JP',
        'Hiragino Sans', 'Microsoft YaHei', 'Yu Gothic', sans-serif;
}

/* === CANVAS === */
#smokeCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* === APP CONTAINER === */
#app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    pointer-events: none;
}

#app * {
    pointer-events: auto;
}

/* === LOGO MARK === */
.logo-mark {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    opacity: 0;
    transition: opacity 1s ease;
}

.logo-mark.visible {
    opacity: 1;
}

.open-wrap {
    position: relative;
    width: 65px;
    height: 72px;
}

.frame-back {
    position: absolute;
    top: 0;
    left: 8px;
    width: 50px;
    height: 70px;
    border: 2.5px solid rgba(201, 162, 78, 0.25);
    border-radius: 5px 5px 0 0;
    background: linear-gradient(150deg, rgba(14, 14, 32, 0.3), rgba(24, 24, 56, 0.3));
}

.inner-light {
    position: absolute;
    top: 4px;
    left: 20px;
    width: 36px;
    height: 64px;
    background: linear-gradient(135deg, rgba(226, 179, 90, 0.04), rgba(226, 179, 90, 0.1));
    border-radius: 3px 3px 0 0;
}

.door-open {
    position: absolute;
    top: 2px;
    left: 0;
    width: 32px;
    height: 66px;
    border: 2.5px solid rgba(201, 162, 78, 0.7);
    border-radius: 4px 4px 0 0;
    transform: perspective(200px) rotateY(-35deg);
    transform-origin: left center;
    background: linear-gradient(150deg, rgba(14, 14, 32, 0.15), rgba(24, 24, 56, 0.15));
}

.door-open::after {
    content: '';
    position: absolute;
    right: 5px;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

/* === TITLE === */
.landing-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-align: center;
    opacity: 0;
    transition: opacity 1.2s ease;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fff 0%, var(--text-1) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-title.visible {
    opacity: 1;
}

/* === HERO BADGES (audience filter) === */
.hero-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 4px 0 14px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 1s ease, transform 1s ease;
}

.hero-badges.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1;
}

.hero-badge--beta {
    background: rgba(226,179,90,0.12);
    border: 1px solid rgba(226,179,90,0.45);
    color: var(--gold-bright);
}

.hero-badge--root {
    background: rgba(226,179,90,0.12);
    border: 1px solid rgba(226,179,90,0.45);
    color: var(--gold-bright);
}

.hero-badge--root svg { width: 13px; height: 13px; flex-shrink: 0; }

@media (max-width: 380px) {
    .hero-badge { font-size: 0.65rem; padding: 3px 8px; letter-spacing: 0.08em; }
}

/* === GREETING === */
.greeting {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: rgba(255,255,255,0.5);
    text-align: center;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    margin-bottom: 8px;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.greeting.visible {
    opacity: 1;
    transform: translateX(0);
}

/* === HINT === */
.hint {
    font-size: clamp(0.8rem, 1.5vw, 0.95rem);
    color: rgba(255,255,255,0.3);
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
    margin-bottom: 32px;
}

.hint.visible {
    opacity: 1;
}

/* === AUTH CONTAINER === */
.auth-container {
    width: 100%;
    max-width: 380px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.auth-container.visible {
    opacity: 1;
}

/* === FORM INPUTS === */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--line);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease, background 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.09);
}

.form-input::placeholder {
    color: rgba(255,255,255,0.2);
}

/* === PASSWORD TOGGLE === */
.password-wrap {
    position: relative;
}
.password-wrap .form-input {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    padding: 4px;
    font-size: 0;
    line-height: 1;
    transition: color var(--t-mid) ease;
}
.password-toggle:hover {
    color: rgba(255,255,255,0.5);
}
.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* === BUTTONS === */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: #fff;
    color: var(--bg-0);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.3s ease, transform var(--t-fast) ease;
    margin-top: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-link {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    margin-top: 16px;
    display: block;
    text-align: center;
    width: 100%;
}

.btn-link:hover {
    color: var(--text-1);
}

/* === OTP === */
.otp-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.otp-digit, .forgot-otp-digit {
    width: 50px;
    height: 60px;
    background: var(--line);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    outline: none;
    transition: border-color 0.3s ease, background 0.3s ease;
    caret-color: transparent;
}

.otp-digit:focus, .forgot-otp-digit:focus {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
}

.otp-digit.filled, .forgot-otp-digit.filled {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
}

.otp-info {
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.35);
    margin-bottom: 20px;
    line-height: 1.5;
}

.otp-info strong {
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

/* === ERROR / SUCCESS MESSAGES === */
.msg {
    padding: 10px 14px;
    border-radius: var(--r-md);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
    text-align: center;
    line-height: 1.4;
}

.msg.error {
    display: block;
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-400);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.msg.success {
    display: block;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-400);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* === USER VIEW (Authenticated) === */
.user-view {
    text-align: center;
    max-width: 380px;
    width: 100%;
}

/* === ACCOUNT CHIP (authenticated) — glass backdrop tinted by subscription tier === */
.account-chip {
    --tier-rgb: 217, 149, 74;          /* FREE / Bronze tint until the plan loads */
    --tier-text: #D9954A;
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    padding: 15px 17px;
    text-align: left;
    background: linear-gradient(135deg, var(--line), rgba(255,255,255,0.02));
    border: 1px solid rgba(var(--tier-rgb), 0.34);
    border-radius: 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.account-chip:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--tier-rgb), 0.6);
    background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
    box-shadow: 0 12px 32px rgba(0,0,0,0.42);
}

.account-chip-glow {
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(var(--tier-rgb), 0.22), transparent 55%),
        radial-gradient(120% 90% at 100% 100%, rgba(var(--tier-rgb), 0.12), transparent 60%);
    opacity: 0.55;
    transition: opacity var(--t-slow) ease;
}
.account-chip:hover .account-chip-glow { opacity: 1; }

/* subscription tiers — accents mirror the catalog-metal SSOT (accent colors) */
.account-chip--free       { --tier-rgb: 217, 149, 74;  --tier-text: var(--metal-bronze-accent); }   /* Бронза */
.account-chip--pro        { --tier-rgb: 188, 193, 210; --tier-text: var(--metal-steel-accent); }   /* Сталь */
.account-chip--enterprise { --tier-rgb: 138, 212, 245; --tier-text: var(--metal-mithril-accent); }   /* Мифрил */
.account-chip--adamantine { --tier-rgb: 185, 166, 255; --tier-text: var(--metal-adamantine-accent); }   /* Адамантий */
.account-chip--meteoric   { --tier-rgb: 226, 179, 90;  --tier-text: var(--metal-meteoric-accent); }   /* Метеорит */

.account-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--tier-rgb), 0.14);
    border: 1px solid rgba(var(--tier-rgb), 0.34);
    color: var(--tier-text);
}
.account-icon svg { width: 20px; height: 20px; }

.account-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.account-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255,255,255,0.82);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-chip-badge {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: 1;
    color: var(--tier-text);
    background: rgba(var(--tier-rgb), 0.14);
    border: 1px solid rgba(var(--tier-rgb), 0.45);
}

/* === DOWNLOAD BUTTON === */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: var(--line);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--r-lg);
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-slow) ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-download::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(236,72,153,0.3), rgba(16,185,129,0.3));
    z-index: -1;
    opacity: 0;
    transition: opacity var(--t-slow) ease;
    filter: blur(8px);
}

.btn-download:hover {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99,102,241,0.15);
}

.btn-download:hover::before {
    opacity: 1;
}

.btn-download svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* «Выйти» — inline right under the account name, inside the chip */
.account-logout {
    align-self: flex-start;
    position: relative;
    margin: 0;
    padding: 1px 0;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: color var(--t-base) ease;
}

.account-logout::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s ease;
}

.account-logout:hover { color: var(--tier-text); }
.account-logout:hover::after { transform: scaleX(1); }
.account-logout:focus-visible {
    outline: 2px solid rgba(var(--tier-rgb), 0.6);
    outline-offset: 3px;
    border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .account-chip:hover,
    .channel-status.available a:hover,
    .channel-status.available a:active { transform: none; }
    .account-logout::after,
    .channel-status.available a::before { transition: none; }
}

/* === RESEND LINK === */
.resend-row {
    text-align: center;
    margin-top: 12px;
}

.resend-link {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
}

.resend-link:hover {
    color: rgba(255,255,255,0.6);
}

.resend-link:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

/* === DOWNLOAD SECTION === */
.download-section {
    width: 100%;
    max-width: 420px;
    margin-top: 48px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.download-section.visible {
    opacity: 1;
}

.section-title {
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

.platform-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 12px;
}

.platform-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-1);
}

.platform-header svg {
    flex-shrink: 0;
}

.channel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.channel-row:first-of-type {
    border-top: none;
}

.channel-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.45);
}

.channel-status {
    font-size: 0.8rem;
    font-weight: 500;
}

.channel-status.unavailable {
    color: rgba(255,255,255,0.25);
}

/* Download buttons — same glass style as the chips/CTA, with a green accent + shimmer */
.channel-status.available a {
    --dl-rgb: 52, 211, 153;            /* green accent */
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px 9px 15px;
    background: linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025));
    color: #eafff6;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    border-radius: var(--r-pill);
    border: 1px solid rgba(var(--dl-rgb), 0.42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
    transition: transform 0.22s ease, box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    overflow: hidden;
    isolation: isolate;
}

.channel-status.available a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, var(--text-3) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.7s ease;
    z-index: -1;
}

.channel-status.available a:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--dl-rgb), 0.72);
    background: linear-gradient(135deg, rgba(var(--dl-rgb), 0.2), rgba(var(--dl-rgb), 0.08));
    box-shadow: 0 12px 28px rgba(var(--dl-rgb), 0.26), inset 0 1px 0 rgba(255,255,255,0.14);
}

.channel-status.available a:hover::before {
    transform: translateX(120%);
}

.channel-status.available a:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(var(--dl-rgb), 0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

.channel-status.available a svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
}

.channel-status.login-required {
    color: rgba(255,255,255,0.3);
    font-style: italic;
}

.coming-soon {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.25);
    text-align: center;
    padding: 8px 0;
}

.download-guest-msg {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.35);
    text-align: center;
    padding: 24px 0;
    line-height: 1.5;
}

/* download root-only note */
.download-root-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    background: rgba(226,179,90,0.06);
    border: 1px solid rgba(226,179,90,0.2);
    color: rgba(240,200,120,0.85);
    font-size: 0.78rem;
    line-height: 1.4;
}

.download-root-note svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--accent);
}

/* === LOADING SPINNER === */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(5,5,5,0.2);
    border-top-color: var(--bg-0);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.spinner.light {
    border-color: rgba(255,255,255,0.2);
    border-top-color: #fff;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === FOOTER TAGLINE === */
.footer-tagline {
    margin-top: 48px;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    letter-spacing: 0.04em;
    opacity: 0;
    transition: opacity 1s ease;
}

.footer-tagline.visible {
    opacity: 1;
}

.footer-legal-links {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.footer-legal-links.visible {
    opacity: 1;
    transform: translateY(0);
}

.footer-legal-links a {
    color: rgba(255,255,255,0.25);
    text-decoration: none;
    transition: color var(--t-mid);
}

.footer-legal-links a:hover {
    color: rgba(255,255,255,0.6);
}

/* === NAV MENU === */
.nav-menu {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 100;
}

.nav-menu-btn {
    background: var(--line);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    width: 44px;   /* W4: тач-таргет ≥44px */
    height: 44px;
    border-radius: var(--r-md);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t-mid) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0.5;
    padding-bottom: 4px;
}

.nav-menu-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
}

.nav-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    background: rgba(20,20,20,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 160px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.nav-dropdown a,
.nav-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 18px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.88rem;
    font-family: inherit;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all var(--t-fast) ease;
}

.nav-dropdown a:hover,
.nav-dropdown button:hover {
    background: var(--line);
    color: var(--accent-alt);
}

/* === HIDDEN STATE === */
.hidden {
    display: none !important;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .nav-menu {
        top: 12px;
        right: 12px;
    }

    #app {
        padding: 32px 16px;
    }

    .otp-digit, .forgot-otp-digit {
        width: 42px;
        height: 52px;
        font-size: 1.3rem;
    }

    .otp-container {
        gap: 7px;
    }

    .btn-download {
        padding: 14px 24px;
        font-size: 0.9rem;
    }

    .download-section {
        margin-top: 32px;
    }

    .platform-card {
        padding: 16px;
    }
}

@media (max-height: 700px) {
    #app {
        padding: 20px 24px;
    }

    .landing-title {
        margin-bottom: 8px;
    }

    .greeting {
        margin-bottom: 4px;
    }

    .hint {
        margin-bottom: 20px;
    }
}

/* ═══ FLIP PAGE CONTAINER ═══ */
.flip-page-container {
    max-width: 860px;
    margin: 48px auto 0;
    padding: 0 20px 60px;
    perspective: 1800px;
    visibility: hidden;
}
.flip-page-container.visible { visibility: visible; }

.flip-page {
    transform-origin: left center;
    transform: rotateY(-90deg);
    will-change: transform;
}
.flip-page.flipped {
    transform: rotateY(0deg);
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.flip-page-inner {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
    backface-visibility: hidden;
}

/* ═══ LEADERBOARD ═══ */
.leaderboard-section {
    max-width: 800px;
    margin: 0 auto;
}

.leaderboard-subtitle {
    text-align: center;
    color: rgba(255,255,255,0.35);
    font-size: 0.85rem;
    margin: -8px 0 24px;
}

.leaderboard-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.02);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.leaderboard-table th {
    padding: 10px 12px;
    text-align: left;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--line);
}
.leaderboard-table td {
    padding: 10px 12px;
    color: var(--text-1);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.leaderboard-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}
.lb-rank {
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    font-size: 0.75rem;
}
.lb-rank-1 { color: var(--warn-400); }
.lb-rank-2 { color: #d1d5db; }
.lb-rank-3 { color: #cd7f32; }
.lb-model {
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}
.lb-score {
    font-weight: 700;
    color: var(--accent-alt);
    font-size: 0.9rem;
}
.lb-dim { color: rgba(255,255,255,0.35); }

@media (max-width: 600px) {
    .leaderboard-table { font-size: 0.75rem; }
    .leaderboard-table th, .leaderboard-table td { padding: 8px 6px; }
    .hide-mobile { display: none; }
}

/* ═══════════════════════════════════════════════════════
   ABOUT CTA — "Что это такое? Коротко о главном"
   sits between title and greeting/auth
   ═══════════════════════════════════════════════════════ */
.about-cta {
    --cta-accent: var(--accent);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px 14px 18px;
    margin: 4px 0 22px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid rgba(226,179,90,0.32);
    border-radius: 16px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    isolation: isolate;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.9s ease, transform 0.9s ease, border-color 0.3s ease, background 0.3s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
}

.about-cta.visible {
    opacity: 1;
    transform: translateY(0);
}

.about-cta-glow {
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    background: radial-gradient(120% 80% at 0% 0%, rgba(226,179,90,0.22), transparent 55%),
                radial-gradient(120% 80% at 100% 100%, rgba(167,139,250,0.18), transparent 55%);
    opacity: 0.6;
    transition: opacity var(--t-slow) ease;
    z-index: -1;
    pointer-events: none;
}

.about-cta:hover {
    border-color: rgba(226,179,90,0.65);
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    transform: translateY(-2px);
}

.about-cta:hover .about-cta-glow {
    opacity: 1;
}

.about-cta:active {
    transform: translateY(0);
}

.about-cta-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(226,179,90,0.14);
    color: var(--cta-accent);
    border: 1px solid rgba(226,179,90,0.3);
}

.about-cta-icon svg {
    width: 20px;
    height: 20px;
}

.about-cta-label {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.about-cta-title {
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.005em;
}

.about-cta-sub {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
    font-weight: 400;
}

.about-cta-arrow {
    margin-left: auto;
    font-size: 1.2rem;
    color: var(--cta-accent);
    transition: transform 0.3s ease;
}

.about-cta:hover .about-cta-arrow {
    transform: translateX(4px);
}

@media (max-width: 480px) {
    .about-cta {
        gap: 11px;
        padding: 12px 16px 12px 14px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 380px;
    }
    .about-cta-icon { width: 34px; height: 34px; }
    .about-cta-icon svg { width: 18px; height: 18px; }
    .about-cta-sub { font-size: 0.72rem; }
}

/* ═══════════════════════════════════════════════════════
   ONBOARDING OVERLAY — stack of cards
   ═══════════════════════════════════════════════════════ */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* While the onboarding modal is open, hide the body-level FAB + cookie banner —
   they are siblings of #app, so inert-ing #app cannot reach them. `display:none`
   removes them from both the paint and the tab order (belt-and-suspenders with the
   JS inert/aria-hidden fallback, and the only tab-order guard on browsers sans inert). */
body.onb-open .lang-fab,
body.onb-open .cookie-notice {
    display: none;
}

.onb-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-overlay);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* `safe center` centres the deck when it fits, but falls back to flex-start
       (instead of clipping the top) when the content is taller than the viewport */
    justify-content: safe center;
    gap: 12px;
    padding: 24px 16px;
    /* the overlay itself scrolls on short screens so the card + "Далее" are always reachable */
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-page) ease;
}

.onb-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.onb-overlay.hidden {
    display: none !important;
}

.onb-backdrop {
    /* fixed (not absolute) so the dark blur always covers the viewport,
       even when the overlay scrolls on short screens */
    position: fixed;
    inset: 0;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(226,179,90,0.10), transparent 60%),
        radial-gradient(120% 80% at 50% 100%, rgba(167,139,250,0.10), transparent 60%),
        rgba(5,5,8,0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 0;
}

.onb-close {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--line);
    border: 1px solid var(--line-strong);
    color: var(--text-1);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-mid) ease;
    z-index: 10;
}

.onb-close:hover {
    background: var(--line-strong);
    color: #fff;
}

.onb-close svg { width: 20px; height: 20px; }

.onb-stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1400px;
    /* reserve room for the stack peek below the active card */
    padding-bottom: 36px;
}

.onb-stack {
    position: relative;
    width: 100%;
    /* Stacked-deck via CSS grid: every card lives in the SAME single cell, so the
       stack auto-sizes to the TALLEST card's content. No fixed aspect-ratio/height →
       content (incl. the "Далее" button) is never clipped, and the height stays
       stable across slides because even hidden cards still size the cell. */
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
}

.onb-card {
    --c-from: #1c1a26;
    --c-to:   #0a0a10;
    --c-accent: var(--accent);
    /* all cards overlap in the single grid cell (1/1); transforms below build the deck */
    grid-column: 1;
    grid-row: 1;
    position: relative;
    border-radius: 22px;
    will-change: transform, opacity;
    transition:
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        opacity   0.45s ease;
    transform-origin: 50% 100%;
}

.onb-card[data-accent="cyan"]   { --c-from: #0e2030; --c-to: #06121d; --c-accent: #67e8f9; }
.onb-card[data-accent="green"]  { --c-from: #0e2620; --c-to: #06140f; --c-accent: var(--success-400); }
.onb-card[data-accent="violet"] { --c-from: #1d1730; --c-to: #0c081a; --c-accent: var(--accent-alt); }
.onb-card[data-accent="rose"]   { --c-from: #2a0e1f; --c-to: #150611; --c-accent: #f472b6; }
.onb-card[data-accent="gold"]   { --c-from: #221b0e; --c-to: #100a04; --c-accent: var(--accent); }

.onb-card-bg {
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background:
        radial-gradient(110% 70% at 0% 0%, color-mix(in oklab, var(--c-accent) 22%, transparent), transparent 55%),
        radial-gradient(120% 80% at 100% 100%, color-mix(in oklab, var(--c-accent) 14%, transparent), transparent 60%),
        linear-gradient(160deg, var(--c-from), var(--c-to));
    border: 1px solid color-mix(in oklab, var(--c-accent) 28%, rgba(255,255,255,0.08));
    box-shadow:
        0 18px 50px rgba(0,0,0,0.55),
        inset 0 1px 0 var(--line);
    z-index: 0;
}

/* Fallback for browsers without color-mix */
@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-card-bg {
        background: linear-gradient(160deg, var(--c-from), var(--c-to));
        border: 1px solid rgba(255,255,255,0.08);
    }
}

.onb-card-inner {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 26px 24px 22px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* stack offsets for cards behind the active one */
.onb-card[data-rel="0"]  { transform: translateY(0)     scale(1)    rotate(0);     opacity: 1;    z-index: 50; }
.onb-card[data-rel="1"]  { transform: translateY(14px)  scale(0.96) rotate(-1deg); opacity: 0.92; z-index: 49; }
.onb-card[data-rel="2"]  { transform: translateY(28px)  scale(0.92) rotate(1.5deg); opacity: 0.7;  z-index: 48; }
.onb-card[data-rel="3+"] { transform: translateY(40px)  scale(0.88) rotate(-1deg); opacity: 0;    z-index: 47; pointer-events: none; }
.onb-card.is-leaving     { transform: translateX(125%) translateY(-10px) rotate(14deg); opacity: 0; z-index: 60; }
.onb-card[data-rel="behind"] { opacity: 0; transform: translateY(-30px) scale(0.95); pointer-events: none; }

.onb-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.onb-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklab, var(--c-accent) 14%, rgba(255,255,255,0.04));
    border: 1px solid color-mix(in oklab, var(--c-accent) 35%, rgba(255,255,255,0.1));
    color: var(--c-accent);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-icon {
        background: var(--line);
        border: 1px solid rgba(255,255,255,0.14);
    }
}

.onb-icon svg { width: 30px; height: 30px; }

.onb-card-counter {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

.onb-card-num {
    color: var(--c-accent);
    font-size: 1.05rem;
}

.onb-card-title {
    font-size: clamp(1.45rem, 4.5vw, 1.75rem);
    line-height: 1.18;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #fff 0%, color-mix(in oklab, var(--c-accent) 38%, #fff) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-card-title { background: none; -webkit-text-fill-color: #fff; color: #fff; }
}

.onb-card-tag {
    font-size: 0.86rem;
    color: rgba(255,255,255,0.55);
    margin-bottom: 18px;
    font-weight: 400;
    line-height: 1.4;
    border-left: 2px solid color-mix(in oklab, var(--c-accent) 50%, transparent);
    padding-left: 10px;
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-card-tag { border-left-color: rgba(226,179,90,0.5); }
}

.onb-card-bullets {
    list-style: none;
    margin: 0 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.onb-card-bullets li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 0.92rem;
    line-height: 1.42;
    color: rgba(255,255,255,0.85);
}

.onb-bullet-mark {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 50%;
    background: color-mix(in oklab, var(--c-accent) 16%, rgba(255,255,255,0.05));
    border: 1px solid color-mix(in oklab, var(--c-accent) 45%, var(--line-strong));
    position: relative;
}

.onb-bullet-mark::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 4px;
    border-left: 2px solid var(--c-accent);
    border-bottom: 2px solid var(--c-accent);
    transform: translate(-50%, -65%) rotate(-45deg);
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-bullet-mark {
        background: rgba(255,255,255,0.05);
        border-color: rgba(255,255,255,0.18);
    }
}

.onb-bullet-text {
    flex: 1 1 auto;
}

.onb-bullet-text strong {
    color: #fff;
    font-weight: 600;
}

.onb-card-actions {
    margin-top: 22px;
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.onb-back-btn {
    flex: 0 0 auto;
    width: 50px;
    border-radius: var(--r-lg);
    border: 1px solid color-mix(in oklab, var(--c-accent) 35%, var(--line-strong));
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-mid) ease;
    font-family: inherit;
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-back-btn { border-color: rgba(255,255,255,0.18); }
}

.onb-back-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.08);
    color: #fff;
    transform: translateX(-2px);
}

.onb-back-btn:active:not(:disabled) { transform: translateX(0); }

.onb-back-btn:disabled {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.onb-back-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
}

.onb-card-footnote {
    margin-top: 14px;
    margin-bottom: -4px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255,255,255,0.45);
    font-style: italic;
    padding-left: 2px;
    border-left: 2px solid color-mix(in oklab, var(--c-accent) 30%, transparent);
    padding-left: 10px;
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-card-footnote { border-left-color: rgba(255,255,255,0.15); }
}

.onb-next-btn {
    flex: 1 1 auto;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 22px;
    border-radius: var(--r-lg);
    border: 1px solid color-mix(in oklab, var(--c-accent) 55%, rgba(255,255,255,0.15));
    background: linear-gradient(135deg,
        color-mix(in oklab, var(--c-accent) 70%, #fff) 0%,
        color-mix(in oklab, var(--c-accent) 100%, transparent) 100%);
    color: #0a0a10;
    font-weight: 700;
    font-size: 0.97rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow var(--t-base) ease, filter var(--t-mid) ease;
    box-shadow: 0 6px 22px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-next-btn {
        background: linear-gradient(135deg, var(--gold-pale), var(--accent));
        border-color: rgba(226,179,90,0.6);
    }
}

.onb-next-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 8px 28px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.5);
}

.onb-next-btn:active {
    transform: translateY(0);
}

.onb-next-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.4;
}

.onb-controls {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 6px;
}

.onb-skip {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    padding: 8px 4px;
    transition: color var(--t-mid) ease;
}

.onb-skip:hover { color: rgba(255,255,255,0.85); }

.onb-dots {
    display: inline-flex;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    padding: 6px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line);
}

.onb-dot {
    position: relative; /* W4: якорь для hit-area ::after */
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: rgba(255,255,255,0.22);
    cursor: pointer;
    transition: all var(--t-base) ease;
}

/* W4: расширяем область попадания точки, визуальный размер не меняем */
.onb-dot::after {
    content: '';
    position: absolute;
    inset: -8px;
}

.onb-dot:hover { background: rgba(255,255,255,0.45); }

.onb-dot.is-active {
    background: var(--accent);
    width: 22px;
    border-radius: var(--r-sm);
    box-shadow: 0 0 0 3px rgba(226,179,90,0.18);
}

/* ─── Diagram block (hand-drawn pencil-style schemas) ─── */
.onb-card-diagram {
    margin: 6px -6px 14px;
    padding: 10px 8px;
    border-radius: 12px;
    background:
        repeating-linear-gradient(0deg, transparent 0 22px, color-mix(in oklab, var(--c-accent) 7%, transparent) 22px 23px),
        color-mix(in oklab, var(--c-accent) 4%, rgba(255,255,255,0.02));
    border: 1px dashed color-mix(in oklab, var(--c-accent) 28%, rgba(255,255,255,0.08));
    color: color-mix(in oklab, var(--c-accent) 65%, #f5e8c8);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    /* prevent the flex layout from squishing the schema into a thin sliver on small screens */
    flex-shrink: 0;
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-card-diagram {
        background: rgba(255,255,255,0.03);
        border-color: var(--line-strong);
        color: rgba(255,255,255,0.85);
    }
}

.onb-card-diagram svg {
    width: 100%;
    height: auto;
    max-height: 170px;
    display: block;
    filter: drop-shadow(0 1px 0 rgba(0,0,0,0.25));
}

/* ─── Real screenshot variant (slide s19) ─── */
.onb-card-diagram--screenshot {
    background:
        repeating-linear-gradient(0deg, transparent 0 22px, color-mix(in oklab, var(--c-accent) 6%, transparent) 22px 23px),
        rgba(0,0,0,0.25);
    padding: 8px;
    border-style: solid;
    border-color: color-mix(in oklab, var(--c-accent) 30%, rgba(255,255,255,0.1));
}

.onb-phone-frame {
    position: relative;
    width: 78px;
    aspect-ratio: 9 / 19.5;
    margin: 0 auto;
    border-radius: var(--r-lg);
    background: var(--bg-0);
    border: 1.5px solid color-mix(in oklab, var(--c-accent) 40%, rgba(255,255,255,0.18));
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.5),
        0 8px 24px rgba(0,0,0,0.45),
        inset 0 1px 0 var(--line);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

@supports not (background: color-mix(in oklab, red, blue)) {
    .onb-phone-frame { border-color: rgba(226,179,90,0.4); }
}

.onb-phone-frame::before {
    content: '';
    position: absolute;
    top: 4px; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
}

.onb-phone-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.onb-phone-frame--empty {
    background: rgba(255,255,255,0.04);
}

.onb-phone-placeholder {
    font-family: 'Kalam', cursive;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.04em;
    transform: rotate(-4deg);
}

@media (min-width: 540px) {
    .onb-phone-frame { width: 96px; }
}
@media (max-width: 380px) {
    .onb-phone-frame { width: 70px; }
}

.onb-card-diagram svg text {
    font-family: 'Kalam', 'Caveat', 'Comic Sans MS', cursive;
    fill: currentColor;
}

/* ─── Pencil-draw reveal ──────────────────────────────────────────────
   When a card becomes the active (top) one, its schema "draws itself":
   every stroked shape animates its dash from empty → full, then the
   handwritten labels ink in on top. Re-runs every time you land on a card. */
@keyframes onbDraw {
    from { stroke-dashoffset: var(--draw-len, 900); }
    to   { stroke-dashoffset: 0; }
}
@keyframes onbInkIn {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* raster reveal (real screenshot) — wiped top→bottom like a pencil sketch filling in */
@keyframes onbSketchReveal {
    from { clip-path: inset(0 0 100% 0); filter: grayscale(0.9) contrast(1.15) brightness(1.08); }
    60%  { filter: grayscale(0.35) contrast(1.05) brightness(1.02); }
    to   { clip-path: inset(0 0 0 0);   filter: grayscale(0) contrast(1) brightness(1); }
}

/* BASE: schemas start un-drawn on EVERY card, so a card is never revealed
   pre-drawn behind the active one — it always inks in live when it reaches the front.
   `:not([stroke-dasharray])` leaves the intentionally-dashed connectors alone
   (overriding their dash pattern would turn them solid). */
.onb-card-diagram svg :is(path, line, rect, circle, ellipse, polyline, polygon):not([stroke-dasharray]) {
    stroke-dasharray: var(--draw-len, 900);
    stroke-dashoffset: var(--draw-len, 900);
}
.onb-card-diagram svg text,
.onb-card-diagram svg [stroke-dasharray],
.onb-card-diagram svg [fill="currentColor"]:not(text) {
    opacity: 0;
}

/* ACTIVE card: solid strokes draw themselves… */
.onb-card[data-rel="0"] .onb-card-diagram svg :is(path, line, rect, circle, ellipse, polyline, polygon):not([stroke-dasharray]) {
    animation: onbDraw 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
/* …dashed connectors keep their dashes and fade in once the solid lines are down… */
.onb-card[data-rel="0"] .onb-card-diagram svg [stroke-dasharray] {
    animation: onbInkIn 0.5s ease-out forwards;
    animation-delay: 0.45s;
}
/* …handwritten labels ink in after the strokes are mostly drawn… */
.onb-card[data-rel="0"] .onb-card-diagram svg text {
    animation: onbInkIn 0.45s ease-out forwards;
    animation-delay: 0.66s;
}
/* …and solid fill markers (dots, arrow pointers) fade with the labels. */
.onb-card[data-rel="0"] .onb-card-diagram svg [fill="currentColor"]:not(text) {
    animation: onbInkIn var(--t-slow) ease-out forwards;
    animation-delay: 0.5s;
}
/* screenshot variant (if a real image is dropped into demo/) sketches in too */
.onb-card[data-rel="0"] .onb-card-diagram--screenshot .onb-phone-img {
    animation: onbSketchReveal 1.1s cubic-bezier(0.5, 0, 0.2, 1) forwards;
}

/* card with diagram: condense header & bullets to keep within viewport */
.onb-card.has-diagram .onb-card-head { margin-bottom: 12px; }
.onb-card.has-diagram .onb-icon { width: 44px; height: 44px; border-radius: 12px; }
.onb-card.has-diagram .onb-icon svg { width: 24px; height: 24px; }
.onb-card.has-diagram .onb-card-title { font-size: clamp(1.25rem, 4vw, 1.5rem); margin-bottom: 4px; }
.onb-card.has-diagram .onb-card-tag { margin-bottom: 10px; font-size: 0.8rem; }
.onb-card.has-diagram .onb-card-bullets { gap: 8px; }
.onb-card.has-diagram .onb-card-bullets li { font-size: 0.85rem; line-height: 1.36; }
.onb-card.has-diagram .onb-card-bullets li .onb-bullet-mark { width: 18px; height: 18px; }
.onb-card.has-diagram .onb-card-actions { margin-top: 14px; }
.onb-card.has-diagram .onb-next-btn { padding: 11px 18px; }
.onb-card.has-diagram .onb-card-footnote { margin-top: 8px; font-size: 0.72rem; }

/* responsive: smaller phones (stack is content-driven now — only tune typography/spacing) */
@media (max-width: 420px) {
    .onb-card-inner { padding: 22px 20px 20px; }
    .onb-icon { width: 48px; height: 48px; border-radius: var(--r-lg); }
    .onb-icon svg { width: 26px; height: 26px; }
    .onb-card-bullets li { font-size: 0.88rem; }
    .onb-next-btn { padding: 12px 18px; font-size: 0.92rem; }

    .onb-card-diagram { margin: 4px -2px 10px; padding: 6px 4px; min-height: 96px; }
    .onb-card-diagram svg { max-height: 120px; }
    .onb-card.has-diagram .onb-card-bullets li { font-size: 0.8rem; }
    .onb-card.has-diagram .onb-icon { width: 40px; height: 40px; }
    .onb-card.has-diagram .onb-icon svg { width: 22px; height: 22px; }
}

/* very small phones (≤ 360px) — tighter typography to keep schema visible */
@media (max-width: 360px) {
    .onb-card-inner { padding: 18px 16px 16px; }
    .onb-card-diagram svg { max-height: 108px; }
    .onb-card-diagram { min-height: 88px; }
    .onb-card.has-diagram .onb-card-title { font-size: 1.15rem; }
    .onb-card.has-diagram .onb-card-tag { font-size: 0.74rem; margin-bottom: 6px; }
    .onb-card.has-diagram .onb-card-bullets { gap: 6px; }
    .onb-card.has-diagram .onb-card-bullets li { font-size: 0.76rem; line-height: 1.32; }
    .onb-card.has-diagram .onb-card-actions { margin-top: 10px; }
    .onb-card.has-diagram .onb-card-footnote { font-size: 0.66rem; margin-top: 6px; }
}

/* short screens (landscape phones, low-height windows) — overlay scrolls; just compact a touch */
@media (max-height: 640px) {
    .onb-card-bullets { gap: 8px; }
    .onb-card-bullets li { font-size: 0.85rem; line-height: 1.32; }
    .onb-card-tag { margin-bottom: 12px; }
    .onb-card-actions { margin-top: 14px; }
    .onb-next-btn { padding: 10px 18px; }
}

/* tablets+ : a touch larger */
@media (min-width: 720px) {
    .onb-stage { max-width: 520px; }
    .onb-card-inner { padding: 32px 30px 28px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    .onb-card { transition: opacity var(--t-mid) ease; }
    .onb-card.is-leaving { transform: none; }
    .about-cta { transition: opacity 0.3s ease; }
    /* show the schemas fully drawn — no pencil animation */
    .onb-card[data-rel="0"] .onb-card-diagram svg :is(path, line, rect, circle, ellipse, polyline, polygon),
    .onb-card[data-rel="0"] .onb-card-diagram svg text,
    .onb-card[data-rel="0"] .onb-card-diagram svg [stroke-dasharray],
    .onb-card[data-rel="0"] .onb-card-diagram svg [fill="currentColor"],
    .onb-card[data-rel="0"] .onb-card-diagram--screenshot .onb-phone-img {
        animation: none !important;
        stroke-dashoffset: 0 !important;
        opacity: 1 !important;
        clip-path: none !important;
        filter: none !important;
    }
}

