*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #030305;
    --surface: rgba(18, 18, 24, 0.4);
    --surface-bright: rgba(255, 255, 255, 0.05);
    --surface-highlight: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(255, 255, 255, 0.15);

    --text-main: #fcfcfd;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --accent-orange: #f97316;
    --accent-orange-glow: rgba(249, 115, 22, 0.3);
    --accent-blue: #3b82f6;
    --accent-text: #ffffff;

    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Work Sans', sans-serif;
    --font-mono: 'Inconsolata', monospace;

    --glass: rgba(15, 15, 22, 0.45);
    --glass-blur: blur(24px) saturate(160%);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    height: auto;
    background-color: var(--bg);
    color: var(--text-main);
    font-family: var(--font-sans);
    display: flex;
    flex-direction: column;
    position: relative;
    line-height: 1.5;
    zoom: 0.8;
    -moz-transform: scale(0.8);
    -moz-transform-origin: top center;
}

@-moz-document url-prefix() {
    body {
        width: 125%;
        margin-left: -12.5%;
    }

    #scene {
        -moz-transform: scale(1.25);
        -moz-transform-origin: top left;
    }
}

@keyframes pageLoad {
    from {
        opacity: 0;
        transform: scale(0.98);
        filter: blur(12px);
    }

    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

.hidden {
    display: none !important;
}

/* ===== MATERIAL ICONS ===== */
.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* =============================================
   TEXTURED BACKGROUND LAYERS
   ============================================= */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -4;
    background:
        radial-gradient(circle at 20% 30%, rgba(249, 115, 22, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.03) 0%, transparent 50%);
    opacity: 0.8;
}

#scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    z-index: -5;
    pointer-events: none;
    opacity: 0.6;
}

/* =============================================
   GLOBAL SCROLLBARS
   ============================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* =============================================
   HEADER
   ============================================= */
.header {
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(3, 3, 5, 0.5);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    transition: var(--transition-smooth);
    letter-spacing: -0.02em;
}

.logo-img {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 0 15px rgba(249, 115, 22, 0.2));
    transition: var(--transition-smooth);
}

.logo:hover {
    transform: translateY(-1px);
}

.logo:hover .logo-img {
    transform: rotate(10deg) scale(1.1);
    filter: drop-shadow(0 0 25px rgba(249, 115, 22, 0.5));
}

.library-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface-bright);
    border: 1px solid var(--border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.library-btn:hover {
    background: var(--surface-highlight);
    border-color: var(--border-bright);
    transform: scale(1.05);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* PRICING BUTTON IN HEADER */
.header-pricing-btn {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.05) 100%);
    border: 1px solid rgba(249, 115, 22, 0.5);
    color: var(--accent-orange);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
    text-decoration: none;
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.15);
    position: relative;
    overflow: hidden;
}

.header-pricing-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.header-pricing-btn:hover::before {
    left: 150%;
}

.header-pricing-btn:hover {
    background: var(--accent-orange);
    color: #fff;
    border-color: var(--accent-orange);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 25px rgba(249, 115, 22, 0.4);
}

.header-pricing-btn .material-icons {
    font-size: 18px;
}

.header-signin-btn {
    height: 44px;
    padding: 0 24px;
    background: var(--accent-orange);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 10px 20px -5px rgba(249, 115, 22, 0.3);
}

.header-signin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(249, 115, 22, 0.5);
    background: #fb923c;
}

.header-signin-btn .signin-pulse {
    display: none;
    /* Removed pulse for cleaner look */
}

.header-account {
    position: relative;
}

.account-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--surface-bright);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0;
    overflow: hidden;
}

.account-btn:hover {
    border-color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.1);
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 220px;
    background: #0d0d12;
    backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    z-index: 2000;
    animation: menuAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

@keyframes menuAppear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.account-menu-item:hover {
    background: var(--surface-bright);
    transform: translateX(4px);
}

.account-menu-item .material-icons {
    font-size: 20px;
    color: var(--text-dim);
}

/* =============================================
   MAIN CONTAINER
   ============================================= */
.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 40px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
}

.landing-page,
.dashboard-page {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.carousel-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 480px;
    perspective: 1200px;
    position: relative;
    padding: 20px 0;
}

.step-carousel {
    position: relative;
    width: 280px;
    height: 280px;
    transform-style: preserve-3d;
    display: block;
    margin: 0 auto;
}

.step-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 280px;
    background: #16161c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    position: absolute;
    overflow: hidden;
    transition: all 0.7s cubic-bezier(0.25, 1, 0.3, 1);
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Default hidden state for far cards */
.step-card:not(.active):not(.exit-up) {
    transform: translateY(280px) scale(0.7) translateZ(-200px);
    opacity: 0;
    z-index: 1;
}

.step-card.exit-up {
    transform: translateY(-280px) scale(0.7) translateZ(-200px);
    opacity: 0;
    z-index: 1;
}

/* Offset positioning for peeking cards */
.step-card.step-offset--1 {
    transform: translateY(-110px) scale(0.85) translateZ(-80px) !important;
    opacity: 0.6 !important;
    z-index: 5 !important;
    filter: blur(1px);
}

.step-card.step-offset--2 {
    transform: translateY(-180px) scale(0.75) translateZ(-140px) !important;
    opacity: 0.2 !important;
    z-index: 4 !important;
    filter: blur(2px);
}

.step-card.step-offset-1 {
    transform: translateY(110px) scale(0.85) translateZ(-80px) !important;
    opacity: 0.6 !important;
    z-index: 5 !important;
    filter: blur(1px);
}

.step-card.step-offset-2 {
    transform: translateY(180px) scale(0.75) translateZ(-140px) !important;
    opacity: 0.2 !important;
    z-index: 4 !important;
    filter: blur(2px);
}

.step-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 16px;
    z-index: 2;
}

.step-card.active {
    opacity: 1;
    transform: translateY(0) scale(1) translateZ(0);
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 25px rgba(249, 115, 22, 0.15);
    filter: blur(0);
    z-index: 10;
    pointer-events: auto;
}

/* Conic-gradient border progress — sweeps around the card as time passes */
.step-card.active {
    position: relative;
}

.step-card.active::before {
    content: '';
    position: absolute;
    inset: -1.5px;
    border-radius: 26px;
    background: conic-gradient(from -90deg,
            var(--accent-orange) var(--progress, 0%),
            rgba(255, 255, 255, 0.07) 0%);
    z-index: 0;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    padding: 1.5px;
    transition: background 0.8s ease;
    pointer-events: none;
}

.step-progress-border {
    display: none;
    /* replaced by conic-gradient ::before below */
}

.step-icon {
    font-size: 40px !important;
    color: var(--text-dim);
    transition: var(--transition-smooth);
}

.step-card.active .step-icon {
    color: var(--accent-orange);
    transform: scale(1.1);
}

/* ===== RESULT ACTIONS ===== */
.result-actions-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    padding: 12px 20px;
    border-radius: 14px;
    font-family: var(--font-sans);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn.download {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.action-btn.new {
    background: var(--accent-orange);
    border: 1px solid transparent;
    color: black;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.audio-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-orange);
    font-size: 0.8rem;
    font-weight: 600;
}

/* =============================================
   FOOTER
   ============================================= */
/* Footer styles consolidated at the bottom of the file */
/* =============================================
   MODAL OVERLAYS (shared)
   ============================================= */
.tutorial-overlay,
#authGate,
.onboarding-overlay,
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    z-index: 9000;
    /* Increased to be above everything else */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.4s ease-out both;
}

.tutorial-overlay.visible,
#authGate.visible,
.onboarding-overlay.visible,
.modal-overlay.visible {
    display: flex !important;
    z-index: 9000 !important;
}

.tutorial-modal,
.auth-modal,
.onboarding-modal,
.premium-modal {
    background: #1c1c22;
    /* Fallback for blur */
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: 32px;
    padding: 48px;
    max-width: 500px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-premium);
    animation: modalReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@keyframes modalReveal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.tutorial-icon {
    font-size: 64px;
    color: var(--accent-orange);
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.tutorial-title,
.auth-title,
.onboarding-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tutorial-text,
.auth-subtitle,
.onboarding-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 32px;
}

.tut-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-bright);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: var(--transition-smooth);
}

.tut-step:hover {
    background: var(--surface-highlight);
    border-color: var(--border-bright);
    transform: translateX(6px);
}

.tut-step-num {
    width: 28px;
    height: 28px;
    background: var(--accent-orange);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    flex-shrink: 0;
}

.tut-step-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.tutorial-btn,
.google-signin-btn,
.onboarding-submit-btn {
    width: 100%;
    height: 56px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 10;
    margin: 0;
}

.tutorial-btn:hover,
.google-signin-btn:hover,
.onboarding-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(255, 255, 255, 0.4);
}

/* =============================================
   ERRORS
   ============================================= */
.error-banner {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
    animation: errorShake 0.6s cubic-bezier(.36, .07, .19, .97) both;
}

.error-content {
    display: flex;
    gap: 20px;
    align-items: center;
}

.error-content .material-icons {
    font-size: 32px;
    color: #ef4444;
}

.error-text strong {
    display: block;
    font-size: 1.1rem;
    color: #ef4444;
    margin-bottom: 4px;
}

.error-text p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.retry-btn {
    margin-top: 16px;
    padding: 10px 24px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: #ef4444;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

/* =============================================
   ONBOARDING
   ============================================= */
.onboarding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.onboarding-card {
    background: var(--surface-bright);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.onboarding-card.selected {
    border-color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.05);
}

.onboarding-card-icon {
    font-size: 32px;
    color: var(--accent-orange);
    margin-bottom: 12px;
}

/* =============================================
   LIBRARY SIDEBAR
   ============================================= */
.library-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 4000;
    display: none;
}

.library-sidebar {
    position: fixed;
    top: 0;
    left: -430px;
    width: min(420px, 100vw);
    height: 100%;
    height: 100dvh;
    background: #0f0f14;
    backdrop-filter: blur(32px);
    border-right: 1px solid rgba(249, 115, 22, 0.15);
    border-radius: 0 28px 28px 0;
    bottom: 0;
    z-index: 4001;
    transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.library-sidebar.open {
    left: 0;
}

.library-header {
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.library-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.library-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.library-close-btn:hover {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.3);
    color: #fff;
    transform: rotate(90deg);
}

.library-search-container {
    padding: 24px 32px;
    position: relative;
}

.library-search-input {
    width: 100%;
    height: 44px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 0 44px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.library-search-input:focus {
    outline: none;
    border-color: var(--accent-orange);
    background: var(--surface-highlight);
}

.library-search-icon {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 20px;
}

.library-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.library-item {
    margin: 0 8px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.library-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: rgba(249, 115, 22, 0.12);
    transform: translateX(4px);
}

.library-item::after {
    display: none;
}

.library-item-icon {
    font-size: 20px;
    flex-shrink: 0;
    opacity: 0.85;
}

.library-item-title {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.library-item-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.processing-tag {
    font-size: 0.7rem;
    font-weight: 700;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    animation: blinker 1.5s step-start infinite;
    flex-shrink: 0;
}

@keyframes blinker {
    50% {
        opacity: 0.5;
    }
}

@keyframes pulsing {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.15);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.pulsing {
    animation: pulsing 1.5s ease-in-out infinite;
}

/* =============================================
   MODAL & OVERLAY SYSTEM
   ============================================= */
.quota-overlay,
.modal-overlay,
.auth-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    padding: 24px;
}

.quota-overlay.visible,
.modal-overlay.visible,
.auth-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.quota-modal,
.premium-modal,
.settings-modal,
.auth-modal {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: 32px;
    box-shadow: var(--shadow-premium);
    width: 100%;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: var(--transition-smooth);
    overflow: hidden;
}

.quota-overlay.visible .quota-modal,
.modal-overlay.visible .settings-modal,
.auth-overlay.visible .auth-modal {
    transform: scale(1) translateY(0);
}

.quota-icon {
    font-size: 64px;
    color: var(--accent-orange);
    margin-bottom: 24px;
}

.quota-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
}

.quota-text {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.quota-btn {
    height: 52px;
    padding: 0 32px;
    background: var(--accent-orange);
    color: #000;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.quota-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid var(--border);
}

.quota-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.trial-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    background: rgba(15, 15, 22, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid var(--accent-orange-glow);
    padding: 12px 24px;
    border-radius: 100px;
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-premium);
    z-index: 10000;
}

.trial-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* =============================================
   SETTINGS MODAL
   ============================================= */
.settings-modal {
    max-width: 600px;
    padding: 0;
    overflow: hidden;
}

.settings-header {
    padding: 32px 48px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
}

.settings-header .quota-icon {
    margin: 0;
    font-size: 32px;
}

.settings-content {
    padding: 48px;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 40px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-section-desc {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.voice-select {
    width: 100%;
    height: 52px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 0 20px;
    color: #fff;
    cursor: pointer;
    transition: var(--transition-smooth);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f97316' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
    font-weight: 500;
}

.settings-actions {
    padding: 24px 48px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

.settings-actions button {
    height: 44px;
    padding: 0 24px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-save {
    background: #fff;
    color: #000;
    border: none;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(255, 255, 255, 0.3);
}

.voice-select:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: rgba(0, 0, 0, 0.5);
}

.voice-select:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.voice-select option {
    background: #0d1117;
    color: white;
    padding: 12px;
}

.premium-lock-icon {
    font-size: 14px !important;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0.7;
}

.voice-select option[data-premium="true"] {
    color: rgba(255, 255, 255, 0.5);
}

.theme-item.premium-locked::after {
    content: 'lock';
    font-family: 'Material Icons';
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 14px;
    color: var(--accent-orange);
    opacity: 0.8;
}

/* Theme Carousel */
.theme-carousel-container {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    margin-top: 10px;
}

.theme-carousel {
    display: flex;
    gap: 12px;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding: 4px;
    flex: 1;
    /* FIX: prevent carousel from overflowing parent */
    min-width: 0;
}

.theme-item {
    min-width: 80px;
    height: 32px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    position: relative;
}

.theme-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.theme-item.active {
    border-color: var(--accent-orange);
    background: rgba(249, 115, 22, 0.1);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.15);
}

.theme-preview-box {
    display: none;
}

.theme-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.theme-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-item.active .theme-name {
    color: var(--accent-orange);
}

.carousel-nav {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.carousel-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Transaction History */
.transaction-history-list {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    /* FIX: align items when text wraps */
    align-items: center;
    gap: 12px;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.transaction-date {
    font-size: 11px;
    color: var(--text-muted);
}

.transaction-amount {
    font-weight: 600;
    flex-shrink: 0;
}

.transaction-amount.negative {
    color: #ff4d4d;
}

.transaction-amount.positive {
    color: #4dff4d;
}

/* =============================================
   GUIDED TOUR
   ============================================= */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tour-overlay.hidden {
    opacity: 0;
    display: none;
}

.tour-arrow {
    position: absolute;
    width: 80px;
    height: 80px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 10000;
}

.tour-arrow svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

.tour-label {
    position: absolute;
    color: white;
    font-family: 'Oregano', cursive;
    font-size: 24px;
    font-style: italic;
    white-space: nowrap;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    transition: all 0.4s ease;
    pointer-events: none;
    z-index: 10000;
}

.tour-next-btn {
    position: absolute;
    padding: 12px 24px;
    background: rgba(249, 115, 22, 0.85);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    transition: all 0.2s ease;
}

.tour-next-btn:hover {
    transform: translateY(-2px);
    background: var(--accent-orange);
}

/* =============================================
   FULL-PAGE TOP-UP
   ============================================= */
.pg-topup-container {
    max-width: 900px;
    margin: 0 auto;
    padding-top: 40px;
    align-items: flex-start;
    justify-content: flex-start;
}

.pg-topup-hero {
    text-align: left;
    margin-bottom: 24px;
    transform: none !important;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.2s;
}

.pg-topup-hero .hero-title {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.pg-topup-hero .hero-subtitle {
    font-size: 0.95rem;
    padding-bottom: 0;
}

.pg-topup-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    width: 100%;
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.3s;
}

/* --- Left Column --- */
.pg-topup-left {
    display: flex;
    flex-direction: column;
    gap: 24px;
    /* FIX: prevent overflow */
    min-width: 0;
}

.pg-topup-balance-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.balance-left {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.balance-left .material-icons {
    color: var(--accent-orange);
    font-size: 20px;
}

.balance-label {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.balance-val {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.pg-topup-section-title {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    margin-bottom: 12px;
    display: block;
}

.pg-topup-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.pg-preset-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.pg-preset-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pg-preset-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.04);
}

.pg-preset-btn.active {
    background: rgba(249, 115, 22, 0.08);
    border-color: var(--accent-orange);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.15);
}

.pg-preset-btn.active::before {
    opacity: 1;
}

.pg-preset-main {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.pg-currency {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pg-preset-btn.active .pg-preset-main,
.pg-preset-btn.active .pg-currency {
    color: var(--accent-orange);
}

.pg-preset-sub {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.pg-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 0 16px;
    height: 48px;
    transition: all 0.3s ease;
}

.pg-input-wrapper:focus-within {
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.pg-input-wrapper.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.pg-input-prefix {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-right: 8px;
    flex-shrink: 0;
}

.pg-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
    width: 100%;
    min-width: 0;
}

.pg-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.pg-input::-webkit-outer-spin-button,
.pg-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* FIX: Firefox number input */
.pg-input[type="number"] {
    -moz-appearance: textfield;
}

.pg-error {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 8px;
}

.pg-error .material-icons {
    font-size: 14px;
}

.pg-estimator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(249, 115, 22, 0.05);
    border: 1px solid rgba(249, 115, 22, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--text-muted);
    /* FIX: wrap on small screens */
    flex-wrap: wrap;
}

.pg-estimator .material-icons {
    color: var(--accent-orange);
    font-size: 16px;
    flex-shrink: 0;
}

.pg-accent-text {
    color: var(--text-main);
    font-weight: 600;
}

/* --- Right Column (Checkout Box) --- */
.pg-topup-right {
    position: relative;
}

.pg-checkout-card {
    position: sticky;
    top: 24px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.pg-checkout-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pg-summary-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    align-items: center;
    gap: 8px;
}

.pg-summary-val {
    color: var(--text-main);
    font-family: var(--font-mono);
}

.pg-free-tag {
    color: #4ade80;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(74, 222, 128, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.pg-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 600;
}

.pg-total-val {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    color: var(--accent-orange);
}

.pg-pay-btn {
    width: 100%;
    margin-top: 24px;
    height: 48px;
    font-size: 0.95rem;
}

.pg-pay-btn::before {
    content: none !important;
}

.pg-pay-btn .material-icons {
    font-size: 16px;
    margin-right: 4px;
    transform: none !important;
}

.pg-secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.pg-secure-note .material-icons {
    font-size: 12px;
}

/* =============================================
   SHARED KEYFRAMES
   ============================================= */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes rotating {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: rotating 1.5s linear infinite;
}

/* =============================================
   RESPONSIVE — TABLET
   ============================================= */
@media (max-width: 900px) {
    .processing-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 800px) {
    .pg-topup-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .pg-checkout-card {
        position: static;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .onboarding-grid {
        grid-template-columns: 1fr;
    }

    .onboarding-title {
        font-size: 1.8rem;
    }
}

/* =============================================
   RESPONSIVE — MOBILE
   ============================================= */
@media (max-width: 600px) {
    .header {
        padding: 12px 14px;
    }

    .logo {
        font-size: 1.1rem;
        gap: 6px;
    }

    .logo-img {
        height: 22px;
    }

    .header-signin-btn {
        padding: 8px 14px;
        font-size: 0.78rem;
        gap: 6px;
    }

    .header-signin-btn span:not(.material-icons):not(.signin-pulse) {
        display: none;
    }

    .header-signin-btn .signin-pulse {
        display: none;
    }

    .header-signin-btn .material-icons {
        font-size: 16px;
    }

    .account-btn {
        width: 30px;
        height: 30px;
    }

    .main-container {
        padding: 16px 12px 0;
    }

    .hero-section {
        margin-bottom: 1.5rem;
        padding-top: 10px;
        transform: none !important;
    }

    .hero-title {
        font-size: 1.6rem;
        line-height: 1.15;
    }

    .hero-title .highlight {
        padding: 1px 8px;
    }

    .hero-subtitle {
        font-size: 0.85rem;
        padding-bottom: 20px;
    }

    .input-wrapper {
        padding: 16px;
        border-radius: 16px;
    }

    .input-area {
        font-size: 0.95rem;
        min-height: 56px;
    }

    .input-tools {
        margin-top: 14px;
        padding-top: 14px;
        gap: 8px;
    }

    .audio-chip .chip-content {
        padding: 7px 12px;
        font-size: 0.8rem;
        gap: 6px;
    }

    .audio-chip .chip-content span:last-child {
        display: none;
    }

    .tool-btn {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .submit-btn {
        height: 38px;
        padding: 0 16px;
        border-radius: 10px;
    }

    .submit-btn::before {
        font-size: 0.85rem;
    }

    .examples-container {
        margin-top: 8px;
        gap: 8px;
    }

    .example-pill {
        padding: 7px 14px;
        font-size: 0.78rem;
    }

    .terminal-header {
        font-size: 0.9rem;
        margin-bottom: 24px;
        gap: 6px;
    }

    /* FIX: step cards on mobile */
    .step-card {
        min-width: 240px;
        width: 240px;
        min-height: 240px;
        padding: 20px;
    }

    .step-title {
        font-size: 1.15rem;
    }

    .step-desc {
        font-size: 0.82rem;
    }

    .step-icon {
        font-size: 48px !important;
    }

    .status-container {
        padding: 18px;
        border-radius: 14px;
    }

    .status-item .label {
        font-size: 0.6rem;
        letter-spacing: 0.8px;
    }

    /* TUTORING CHAT */
    .tutoring-toggle-btn {
        position: fixed;
        bottom: 80px;
        right: 24px;
        background: var(--accent-orange);
        color: white;
        border: none;
        border-radius: 999px;
        padding: 12px 20px;
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: inherit;
        font-weight: 600;
        cursor: pointer;
        box-shadow: 0 10px 25px rgba(249, 115, 22, 0.3);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 100;
    }

    .tutoring-toggle-btn:hover {
        transform: translateY(-5px);
        box-shadow: 0 15px 30px rgba(249, 115, 22, 0.4);
    }

    .tutoring-toggle-btn.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateY(20px);
    }

    .tutoring-container {
        position: fixed;
        bottom: 100px;
        right: 40px;
        width: 400px;
        height: 600px;
        background: var(--glass);
        backdrop-filter: var(--glass-blur);
        border: var(--glass-border);
        border-radius: 24px;
        display: flex;
        flex-direction: column;
        box-shadow: var(--shadow-premium);
        z-index: 1001;
        overflow: hidden;
        transition: var(--transition-smooth);
    }

    .tutoring-container.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateY(40px) scale(0.95);
    }

    .tutoring-header {
        padding: 16px;
        background: rgba(255, 255, 255, 0.03);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .tutoring-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: var(--font-serif);
        font-weight: 600;
        font-size: 1.1rem;
    }

    .tutoring-close-btn {
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    .tutoring-messages {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .tutoring-message {
        padding: 10px 14px;
        border-radius: 12px;
        max-width: 85%;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .tutoring-message.ai {
        align-self: flex-start;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-main);
        border-bottom-left-radius: 2px;
    }

    .tutoring-message.user {
        align-self: flex-end;
        background: var(--accent-orange);
        color: white;
        border-bottom-right-radius: 2px;
    }

    .tutoring-input-container {
        padding: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        display: flex;
        gap: 8px;
    }

    .tutoring-input {
        flex: 1;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        padding: 8px 12px;
        color: white;
        font-family: inherit;
        font-size: 0.9rem;
    }

    .tutoring-input:focus {
        outline: none;
        border-color: var(--accent-orange);
    }

    .tutoring-send {
        background: var(--accent-orange);
        color: white;
        border: none;
        border-radius: 10px;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .tutoring-send:hover {
        transform: scale(1.05);
    }

    .tutoring-loading {
        display: flex;
        gap: 4px;
        padding: 4px;
    }

    .tutoring-dot {
        width: 6px;
        height: 6px;
        background: var(--text-muted);
        border-radius: 50%;
        animation: typingPulse 1s infinite ease-in-out;
    }

    .tutoring-dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .tutoring-dot:nth-child(3) {
        animation-delay: 0.4s;
    }

    @keyframes typingPulse {

        0%,
        100% {
            opacity: 0.3;
            transform: scale(0.8);
        }

        50% {
            opacity: 1;
            transform: scale(1.1);
        }
    }

    @media (max-width: 480px) {
        .tutoring-container {
            width: calc(100% - 32px);
            left: 16px;
            right: 16px;
        }
    }

    .status-item .value {
        font-size: 1.1rem;
    }

    .video-container {
        border-radius: 12px;
    }

    .stats-bar {
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
    }

    .stat-icon {
        font-size: 16px;
    }

    .stat-label {
        font-size: 0.55rem;
        letter-spacing: 0.6px;
    }

    .stat-value {
        font-size: 0.82rem;
    }

    .feedback-section {
        gap: 10px;
        padding: 14px 16px;
        border-radius: 12px;
    }

    .feedback-question {
        font-size: 0.85rem;
    }

    .feedback-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .result-actions {
        margin-top: 18px;
        gap: 10px;
    }

    .audio-badge {
        padding: 8px 14px;
        font-size: 0.8rem;
        gap: 6px;
    }

    .new-chat-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
        border-radius: 12px;
        width: 100%;
        justify-content: center;
    }

    .site-footer {
        font-size: 0.6rem;
        padding: 10px 12px;
        gap: 5px;
        flex-direction: column;
    }

    .footer-dot {
        display: none;
    }

    .tutorial-modal {
        padding: 28px 22px;
        border-radius: 20px;
    }

    .tutorial-icon img {
        height: 48px !important;
    }

    .tutorial-title {
        font-size: 1.4rem;
    }

    .tutorial-text {
        font-size: 0.9rem;
        margin-bottom: 24px;
    }

    .tut-step {
        gap: 10px;
        margin-bottom: 14px;
    }

    .tut-step-num {
        width: 22px;
        height: 22px;
        min-width: 22px;
        font-size: 0.72rem;
    }

    .tut-step-text {
        font-size: 0.85rem;
    }

    .tutorial-btn {
        padding: 12px 32px;
        font-size: 0.92rem;
        border-radius: 12px;
        width: 100%;
        justify-content: center;
    }

    .settings-modal {
        max-height: 95vh;
        width: 95% !important;
    }

    .settings-header {
        padding: 24px 20px 12px;
    }

    .settings-content {
        padding: 0 20px;
        margin-bottom: 16px;
    }

    .settings-actions {
        padding: 12px 20px 24px;
    }

    #authGate>div {
        padding: 20px !important;
        border-radius: 14px !important;
    }

    .auth-modal {
        padding: 28px 22px;
        border-radius: 20px;
    }

    .auth-logo {
        height: 48px;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-subtitle {
        font-size: 0.88rem;
        margin-bottom: 24px;
    }

    .google-signin-btn {
        padding: 14px 20px;
        font-size: 0.92rem;
        border-radius: 14px;
    }

    .auth-benefits {
        margin-top: 20px;
        padding-top: 18px;
    }

    .auth-benefit {
        font-size: 0.8rem;
    }

    .thinking-container {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    .thinking-label .thinking-logo {
        height: 14px;
    }

    .launch-badges {
        gap: 16px;
        margin-top: 30px;
    }

    .launch-badges a img {
        height: auto;
        width: 110px;
    }

    .launch-badges a:nth-child(2) img {
        width: 180px;
        height: auto;
    }
}

/* =============================================
   RESPONSIVE — SMALL MOBILE
   ============================================= */
@media (max-width: 480px) {
    .library-sidebar {
        width: 100vw;
        left: -100vw;
    }

    .library-sidebar.open {
        left: 0;
    }
}

@media (max-width: 500px) {
    .pg-topup-hero {
        margin-bottom: 20px;
    }

    .pg-topup-hero .hero-title {
        font-size: 1.8rem;
    }

    .pg-topup-balance-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 16px;
    }

    .balance-val {
        margin-top: 4px;
    }

    .pg-topup-presets {
        gap: 8px;
    }

    .pg-preset-btn {
        padding: 10px 4px;
    }

    .pg-preset-main {
        font-size: 1.1rem;
    }
}

@media (max-width: 380px) {
    .main-container {
        padding: 32px 14px 0;
    }

    .hero-section {
        margin-bottom: 2rem;
    }

    .hero-title {
        font-size: 1.7rem;
    }

    .hero-subtitle {
        font-size: 0.85rem;
    }

    .input-area {
        font-size: 0.9rem;
        min-height: 48px;
    }

    .example-pill {
        padding: 6px 12px;
        font-size: 0.72rem;
    }

    .stats-bar {
        gap: 8px;
        padding: 10px;
    }

    .stat-icon {
        display: none;
    }

    .stat-value {
        font-size: 0.75rem;
    }

    .stat-label {
        font-size: 0.5rem;
    }
}

/* =============================================
   RESPONSIVE — LANDSCAPE
   ============================================= */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        margin-bottom: 1rem;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-subtitle {
        display: none;
    }

    .main-container {
        padding-top: 10px;
    }

    .header {
        padding: 10px 16px;
    }

    .examples-container {
        margin-top: 4px;
    }
}

/* =============================================
   RESPONSIVE — LARGE SCREENS & 4K
   ============================================= */
@media (min-width: 1440px) {
    :root {
        --cell: 8px;
        --dot: 1.5px;
    }

    .main-container {
        padding: 0 40px;
    }

    .hero-title {
        font-size: clamp(2.5rem, 5vw, 3.8rem);
    }

    .hero-subtitle {
        font-size: 1.1rem;
        max-width: 700px;
    }

    .input-wrapper {
        padding: 28px 34px;
        border-radius: 24px;
    }

    .input-area {
        font-size: 1.2rem;
        min-height: 80px;
    }

    .submit-btn {
        height: 50px;
        padding: 0 28px;
        font-size: 1.05rem;
    }

    .tool-btn {
        width: 50px;
        height: 50px;
    }

    .example-pill {
        padding: 10px 22px;
        font-size: 0.95rem;
    }
}

@media (min-width: 2500px) {
    :root {
        --cell: 10px;
        --dot: 1.8px;
    }

    .main-container {
        padding: 0 60px;
    }

    .hero-section {
        margin-bottom: 5rem;
    }

    .hero-title {
        font-size: 4.5rem;
    }

    .hero-subtitle {
        font-size: 1.3rem;
        max-width: 900px;
    }

    .input-wrapper {
        padding: 40px 48px;
        border-radius: 32px;
    }

    .input-area {
        font-size: 1.4rem;
        min-height: 100px;
    }

    .status-container {
        padding: 40px;
    }

    .status-item .value {
        font-size: 1.8rem;
    }

    .step-title {
        font-size: 2rem;
    }

    .step-desc {
        font-size: 1.1rem;
    }
}

@media (min-width: 3800px) {
    html {
        font-size: 120%;
    }

    .hero-title {
        font-size: 6rem;
    }

    .input-wrapper {
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* =============================================
   CORTEX ALERTS
   ============================================= */
.cortex-alert-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10000;
    pointer-events: none;
    width: 380px;
    max-width: calc(100vw - 48px);
}

.cortex-alert {
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    animation: alertSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
    overflow: hidden;
}

@keyframes alertSlideIn {
    from {
        transform: translateX(50px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.cortex-alert.closing {
    animation: alertSlideOut 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes alertSlideOut {
    to {
        transform: translateX(50px);
        opacity: 0;
    }
}

.cortex-alert.premium {
    border-color: rgba(249, 115, 22, 0.4);
    background: linear-gradient(135deg, rgba(15, 15, 20, 0.98), rgba(249, 115, 22, 0.05));
}

.cortex-alert.success .cortex-alert-icon {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.cortex-alert.error .cortex-alert-icon {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.cortex-alert.info .cortex-alert-icon {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.cortex-alert.premium .cortex-alert-icon {
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.cortex-alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cortex-alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cortex-alert-title {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}

.cortex-alert-message {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.cortex-alert-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    height: fit-content;
    transition: all 0.2s;
}

.cortex-alert-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* =============================================
   SAFE AREA SUPPORT
   ============================================= */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .site-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .tutorial-modal {
        margin-bottom: env(safe-area-inset-bottom);
    }
}

/* =============================================
   TUTORING CHATBOT POPUP
   ============================================= */

/* ── Floating toggle button (bottom-right corner) ── */
.tutoring-toggle-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--accent-orange), #ea580c);
    color: #000;
    border: none;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: tutoringBtnEntrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tutoringBtnEntrance {
    from {
        opacity: 0;
        transform: scale(0.6) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tutoring-toggle-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 16px 40px rgba(249, 115, 22, 0.45), 0 6px 18px rgba(0, 0, 0, 0.5);
}

.tutoring-toggle-btn .material-icons {
    font-size: 20px;
}

/* ── Chat panel ── */
.tutoring-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 910;
    width: 360px;
    max-height: 540px;
    display: flex;
    flex-direction: column;
    background: rgba(14, 14, 16, 0.97);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: 20px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 0 40px rgba(249, 115, 22, 0.06);
    backdrop-filter: blur(24px);
    overflow: hidden;
    animation: tutoringSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes tutoringSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Header bar ── */
.tutoring-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(249, 115, 22, 0.06);
    flex-shrink: 0;
}

.tutoring-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.tutoring-title .material-icons {
    font-size: 18px;
    color: var(--accent-orange);
}

.tutoring-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    transition: all 0.25s ease;
}

.tutoring-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.tutoring-close-btn .material-icons {
    font-size: 18px;
}

/* ── Messages area ── */
.tutoring-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    scroll-behavior: smooth;
}

.tutoring-messages::-webkit-scrollbar {
    width: 4px;
}

.tutoring-messages::-webkit-scrollbar-track {
    background: transparent;
}

.tutoring-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* ── Chat bubbles ── */
.tutoring-message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    line-height: 1.55;
    animation: messagePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.tutoring-message p {
    margin-bottom: 0.5rem;
}

.tutoring-message p:last-child {
    margin-bottom: 0;
}

.tutoring-message ul,
.tutoring-message ol {
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
}

.tutoring-message li {
    margin-bottom: 0.25rem;
}

.tutoring-message h1,
.tutoring-message h2,
.tutoring-message h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.5rem 0;
    color: var(--accent-orange);
}

@keyframes messagePop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(6px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tutoring-message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: #ddd;
    border-bottom-left-radius: 4px;
}

.tutoring-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(234, 88, 12, 0.15));
    border: 1px solid rgba(249, 115, 22, 0.25);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ── Typing / loading dots ── */
.tutoring-loading {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 0;
}

.tutoring-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(249, 115, 22, 0.6);
    animation: tutoringDotBounce 1.2s ease-in-out infinite;
}

.tutoring-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.tutoring-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes tutoringDotBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ── Math inline / block ── */
.math-inline {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.07);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #fde68a;
}

.math-block {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.05);
    border-left: 2px solid var(--accent-orange);
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 0 8px 8px 0;
    font-size: 0.85em;
    color: #fde68a;
    overflow-x: auto;
}

/* ── Input row ── */
.tutoring-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.tutoring-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    outline: none;
    transition: all 0.3s ease;
    min-width: 0;
}

.tutoring-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.tutoring-input:focus {
    border-color: rgba(249, 115, 22, 0.4);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.08);
}

.tutoring-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-orange), #ea580c);
    border: none;
    color: #000;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}

.tutoring-send:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.45);
}

.tutoring-send .material-icons {
    font-size: 18px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .tutoring-container {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: 60vh;
    }

    .tutoring-toggle-btn {
        right: 16px;
        bottom: 16px;
        padding: 10px 16px;
        font-size: 0.8rem;
    }
}

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    padding: 12px 20px 16px;
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-dim);
    flex-wrap: wrap;
    margin-top: 40px;
    z-index: 1000;
    position: relative;
    pointer-events: auto !important;
}

/* Highlight Plans & Pricing Link */
.site-footer a[href="/pricing.html"],
.site-footer a[href="pricing.html"] {
    color: var(--accent-orange) !important;
    font-weight: 700;
    background: rgba(249, 115, 22, 0.1);
    padding: 6px 16px;
    border-radius: 100px;
    border: 1px solid rgba(249, 115, 22, 0.3);
    transition: var(--transition-smooth);
    pointer-events: auto !important;
    cursor: pointer !important;
}

.site-footer a[href="/pricing.html"]:hover,
.site-footer a[href="pricing.html"]:hover {
    background: rgba(249, 115, 22, 0.2);
    border-color: rgba(249, 115, 22, 0.5);
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.site-footer a,
.site-footer .footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-smooth);
    font-weight: 500;
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative;
    z-index: 100000;
}

.site-footer a:hover,
.site-footer .footer-link:hover {
    color: var(--accent-orange) !important;
    transform: translateY(-1px);
}

.footer-dot {
    opacity: 0.3;
}

@media (max-width: 768px) {
    .site-footer {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        padding: 24px 20px;
    }

    .footer-dot {
        display: none;
    }
}

/* HERO MOVED FROM LANDING */
.hero-section {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    padding-top: 20px;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(3.5rem, 10vw, 5.5rem);
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: 32px;
    letter-spacing: -0.04em;
    color: #fff;
}

.hero-title .highlight {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(0 0 30px rgba(249, 115, 22, 0.2));
    padding-bottom: 0.15em;
    padding-right: 0.1em;
    margin-bottom: -0.15em;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 48px;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.get-started-btn {
    height: 64px;
    padding: 0 48px;
    background: #fff;
    color: #000;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-smooth);
    box-shadow: 0 20px 40px -10px rgba(255, 255, 255, 0.25);
    border: none;
    cursor: pointer;
}

.get-started-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 30px 60px -10px rgba(255, 255, 255, 0.35);
}

/* ===== PREVIEW SECTION ===== */
.preview-container {
    perspective: 1000px;
}

.preview-card {
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
    transform: rotateX(2deg);
}

.preview-card:hover {
    transform: rotateX(0deg) translateY(-10px);
    border-color: var(--border-bright);
}

.preview-header {
    height: 64px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-subject {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-orange);
}

.preview-content {
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px;
    position: relative;
    background: radial-gradient(circle at center, rgba(249, 115, 22, 0.08), transparent 70%);
}

.preview-input-box {
    font-family: var(--font-sans);
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    line-height: 1.4;
}

.preview-caption {
    margin-top: 32px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    text-align: center;
}

/* =============================================
   NOTEBOOK MODAL — LIGHT PAPER DESIGN
   ============================================= */

/* Root variables for the notebook grid */
.notebook-overlay,
.notebook-modal,
.notebook-page,
.notebook-body,
.notebook-content {
    --lh: 32px;             /* Master Line Height / Grid Unit */
    --line-color: #cbd5e1;
    --margin-color: rgba(220, 80, 80, 0.4);
    --nb-text-color: #1e293b;
    --nb-font: "Computer Modern Serif", "Georgia", serif;
}

/* Overlay backdrop */
.notebook-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* Hidden by default — shown via .visible */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.notebook-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Modal container */
.notebook-modal {
    max-width: 800px;
    width: 90%;
    height: 85vh;
    background: #fdfdfc;
    position: relative;
    border-radius: 4px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
}

.notebook-overlay.visible .notebook-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Red ribbon-close bookmark */
.ribbon-close {
    position: absolute;
    top: 0;
    right: 40px;
    width: 40px;
    height: 65px;
    background: #d9534f;
    z-index: 100;
    cursor: pointer;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 12px;
    transition: transform 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.ribbon-close:hover {
    transform: translateY(4px);
}

.ribbon-close .material-icons {
    color: rgba(255, 255, 255, 0.95);
    font-size: 22px;
}

/* Notebook page — contains the red margin line + body */
.notebook-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

/* Red margin line */
.notebook-page::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 80px;
    width: 2px;
    background: var(--margin-color);
    z-index: 10;
    pointer-events: none;
}

/* Scrollable paper area with horizontal rules */
.notebook-body {
    flex: 1;
    overflow-y: auto;
    padding-left: 100px;
    padding-right: 50px;
    padding-top: var(--lh);
    padding-bottom: calc(var(--lh) * 2);

    /* Horizontal ruled lines that scroll with content */
    background-image: linear-gradient(var(--line-color) 1px, transparent 1px);
    background-size: 100% var(--lh);
    background-attachment: local;

    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.notebook-body::-webkit-scrollbar {
    width: 8px;
}

.notebook-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.notebook-body::-webkit-scrollbar-track {
    background: transparent;
}

/* ── Typography — grid-snapped ── */
.notebook-content {
    color: var(--nb-text-color);
    font-size: 21px;
    font-family: var(--nb-font);
    transform: translateY(6px); /* nudges text baseline onto the ruled line */
}

.notebook-content em,
.notebook-content i {
    font-style: italic !important;
}

.notebook-content p {
    line-height: var(--lh);
    margin: 0 0 var(--lh) 0;
    padding: 0;
}

.notebook-content ul,
.notebook-content ol {
    line-height: var(--lh);
    margin: 0 0 var(--lh) 0;
    padding: 0;
    padding-left: 30px;
}

.notebook-content li {
    line-height: var(--lh);
}

.notebook-content li p {
    margin: 0;
}

.notebook-content h1,
.notebook-content h2,
.notebook-content h3,
.notebook-content h4 {
    line-height: var(--lh);
    margin: var(--lh) 0 var(--lh) 0;
    padding: 0;
    font-weight: bold;
    color: #000;
    font-family: var(--nb-font);
}

.notebook-content h1 {
    font-size: 32px;
}

.notebook-content h2 {
    font-size: 26px;
}

.notebook-content h3 {
    font-size: 22px;
}

.notebook-content strong {
    color: #000;
    font-weight: 700;
}

.notebook-content code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.88em;
    color: #1e293b;
}

.notebook-content pre {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 14px 18px;
    overflow-x: auto;
    margin: 0.8em 0;
}

.notebook-content pre code {
    background: none;
    border: none;
    padding: 0;
}

.notebook-content blockquote {
    border-left: 3px solid rgba(220, 80, 80, 0.5);
    margin: 0.8em 0;
    padding: 10px 20px;
    color: #475569;
    font-style: italic;
}

/* Enforce math element margins to stay on grid */
mjx-container[display="true"] {
    margin: 0 !important;
    padding: 0 !important;
}

mjx-container:not([display="true"]) {
    line-height: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .notebook-modal {
        width: 95%;
        height: 90vh;
    }

    .notebook-body {
        padding-left: 72px;
        padding-right: 24px;
    }

    .notebook-page::before {
        left: 56px;
    }

    .notebook-content {
        font-size: 18px;
    }
}