:root {
    --bg-base: #f4f6fa;
    --text-dark: #1b1c21;
    --accent-color: #6b11ff; 
    --word-future: #abaec2;  
}

body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    font-family: 'Montserrat', sans-serif; overflow: hidden; background-color: var(--bg-base);
}

/* --- ФОН --- */
.mesh-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; z-index: 1; }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.35; mix-blend-mode: multiply; will-change: transform; }
.blob1 { width: 650px; height: 650px; background: #ffafbd; top: -10%; left: -10%; }
.blob2 { width: 750px; height: 750px; background: #d4a8f7; bottom: -10%; right: -10%; }
.blob3 { width: 550px; height: 550px; background: #a1c4fd; top: 30%; left: 40%; }
.blob4 { width: 600px; height: 600px; background: #f0b8d9; bottom: 15%; left: 5%; }

/* --- 3D ПЛАТОНОВЫ ТЕЛА --- */
#canvas-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: hidden; }
.glass-canvas canvas { filter: blur(6px); opacity: 0.7; mix-blend-mode: color-burn; }

/* --- СТАРТОВЫЙ ЭКРАН --- */
#start-overlay {
    position: absolute; z-index: 100; display: flex; flex-direction: column; justify-content: center; align-items: center;
    width: 100%; height: 100%;     background: rgba(245, 240, 250, 0.92); backdrop-filter: blur(5px);
}
#start-btn {
    padding: 20px 50px; font-size: 1.5rem; font-weight: 900;     background: linear-gradient(135deg, #5a2d82, #7b4fbf);
    color: white; border: none; border-radius: 50px; cursor: pointer;
    box-shadow: 0 15px 35px rgba(90, 45, 130, 0.3); transition: transform 0.2s, opacity 0.2s;
}
#start-btn:disabled { opacity: 0.5; cursor: wait; }
#start-btn:not(:disabled):hover { transform: scale(1.05) translateY(-5px); }

#overlay-title {
    font-size: 3.2rem; font-weight: 900; text-transform: uppercase;
    letter-spacing: 3px; text-align: center; margin: 0 0 15px 0;
    line-height: 1.3; text-shadow: none;
    background: linear-gradient(to right, #1e3c72, #2E7D32, #D4AF37, #2E7D32, #1e3c72);
    background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: seamless-flow 8s infinite linear;
}

.overlay-link {
    display: block; margin-bottom: 35px; font-size: 2rem; font-weight: 600;
    color: #6b11ff; text-decoration: none;
    transition: color 0.2s, text-shadow 0.2s;
}
.overlay-link:hover { color: #9b4dff; }

.skip-intro {
    margin-top: 20px; padding: 6px 18px; font-size: 0.75rem; font-weight: 600;
    background: transparent; color: #999; border: 1px solid #ccc; border-radius: 20px;
    cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.skip-intro:hover { color: #555; border-color: #999; }

/* --- ГЛАВНЫЙ КОНТЕЙНЕР --- */
#app-container {
    position: relative; z-index: 2; width: 100%; height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    box-sizing: border-box; opacity: 0; padding-bottom: 0px;
}

/* --- ШАПКА --- */
#header-section {
    display: flex; flex-direction: column; align-items: center;
    transition: gap 2s cubic-bezier(0.25, 1, 0.5, 1), margin-top 2s cubic-bezier(0.25, 1, 0.5, 1),
                transform 2s cubic-bezier(0.25, 1, 0.5, 1), opacity 2s cubic-bezier(0.25, 1, 0.5, 1);
}
#logo-img { display: block; height: auto; filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.08)); transition: width 2s cubic-bezier(0.25, 1, 0.5, 1); will-change: transform, width; }
#main-title {
    font-weight: 900; text-transform: uppercase; text-align: center; margin: 0; line-height: 1.2;
    transition: font-size 2s cubic-bezier(0.25, 1, 0.5, 1), opacity 2s cubic-bezier(0.25, 1, 0.5, 1), letter-spacing 2s cubic-bezier(0.25, 1, 0.5, 1);
    background: linear-gradient(to right, #1e3c72, #2E7D32, #D4AF37, #2E7D32, #1e3c72);
    background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: seamless-flow 8s infinite linear;
}

@keyframes seamless-flow { 0% { background-position: 0% center; } 100% { background-position: -200% center; } }

/* === СОСТОЯНИЯ ЧЕРЕЗ CSS === */
body.intro-mode #header-section { margin-top: 50vh; transform: translateY(-50%); gap: 80px; opacity: 1; } 
body.intro-mode #logo-img { width: 560px; } 
body.intro-mode #main-title { font-size: 3.6rem; letter-spacing: 4px; opacity: 1; }
body.intro-mode #subtitles-wrapper { height: 0; opacity: 0; margin-top: 0; transform: translateY(0); }
body.intro-mode #controls { opacity: 0; pointer-events: none; bottom: -50px; }
body.intro-mode #mobile-nav { display: none !important; }

body.main-mode #header-section { margin-top: 4vh; transform: translateY(0); gap: 45px; opacity: 1; } 
body.main-mode #logo-img { width: 380px; } 
body.main-mode #main-title { font-size: 1.85rem; letter-spacing: 6px; opacity: 0.85; }
body.main-mode #subtitles-wrapper { height: 45vh; opacity: 1; margin-top: 0px; transform: translateY(0); }
body.main-mode #controls { opacity: 1; pointer-events: auto; bottom: 15px; }

/* СОСТОЯНИЕ ФИНАЛА (Жёстко фиксируем размеры логотипа и текста, чтобы они не прыгали при исчезновении) */
body.end-mode #header-section { margin-top: 4vh; transform: translateY(-80px); opacity: 0; pointer-events: none; gap: 45px; }
body.end-mode #logo-img { width: 380px; }
body.end-mode #main-title { font-size: 1.45rem; letter-spacing: 6px; opacity: 0; }
body.end-mode #subtitles-wrapper { opacity: 0; pointer-events: none; transform: scale(0.9) translateY(40px); }
body.end-mode #controls { opacity: 0; pointer-events: none; bottom: -50px; }
body.end-mode #mobile-nav { display: none !important; }


/* --- ФИНАЛЬНЫЙ ЭКРАН (ТИТРЫ) --- */
#ending-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transform: scale(0.95) translateY(20px);
    transition: opacity 2s ease 0.5s, transform 2s ease 0.5s; text-align: center;
}
body.end-mode #ending-screen { opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); }

.ending-title { font-size: 2.2rem; font-weight: 800; color: #1e3c72; margin-bottom: 15px; line-height: 1.4; transform: scale(1); }
.ending-title span { background: linear-gradient(135deg, #6b11ff, #00d2ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 3rem; font-weight: 900; }
.ending-subtitle { font-size: 1.3rem; font-weight: 600; color: #555; margin-bottom: 40px; margin-top: 0; transform: scale(1); }
body.end-mode .ending-title { animation: titles-grow 6s ease 1.5s forwards; }
body.end-mode .ending-subtitle { animation: titles-grow 6s ease 1.5s forwards; }
@keyframes titles-grow { 0% { transform: scale(1) translateY(0); } 100% { transform: scale(1.2) translateY(-50px); } }

.support-box { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); padding: 35px 50px; border-radius: 20px; box-shadow: 0 15px 40px rgba(107, 17, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.9); transform: scale(1.1); opacity: 0; transition: opacity 2s ease 1s; }
body.end-mode .support-box { opacity: 1; animation: support-grow 6s ease 1.5s forwards; }
@keyframes support-grow { 0% { transform: scale(1.1); } 100% { transform: scale(1.32); } }
.support-box h3 { margin-top: 0; font-size: 1.3rem; font-weight: 900; color: #333; margin-bottom: 25px; text-transform: uppercase; letter-spacing: 2px; }

.support-table { width: auto; margin: 0 auto; border-collapse: collapse; text-align: left; font-size: 1.15rem; color: #111; }
.support-table td { padding: 12px 25px; border-bottom: 1px solid rgba(0,0,0,0.06); }
.support-table tr:last-child td { border-bottom: none; }
.support-table td:first-child { color: #666; font-weight: 600; text-align: right; white-space: nowrap; }
.support-table td:last-child { font-weight: 900; color: #1e3c72; font-variant-numeric: tabular-nums; }
.support-table small { font-weight: 600; color: #888; font-size: 0.9rem; display: block; margin-top: 3px; }

/* КОПИРОВАНИЕ РЕКВИЗИТОВ */
.copy-val {
    position: relative; display: inline-block; cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease, text-shadow 0.2s ease;
}
.copy-val:hover { color: #6b11ff; transform: scale(1.03); text-shadow: 0 2px 10px rgba(107, 17, 255, 0.3); }

/* ВЫДЕЛЕНИЕ ВАЖНОГО ТЕКСТА */
.support-footer { 
    margin-top: 25px; margin-bottom: 0; font-size: 1.05rem; font-weight: 800; 
    color: #d32f2f;
    /*background: rgba(211, 47, 47, 0.08); border: 1px dashed rgba(211, 47, 47, 0.4);*/
    padding: 12px 20px; border-radius: 12px; display: inline-block;
}

/* --- СУБТИТРЫ --- */
#subtitles-wrapper {
    width: 85%; max-width: 1020px; position: relative; overflow: hidden;
    transition: height 2s cubic-bezier(0.25, 1, 0.5, 1), opacity 2s cubic-bezier(0.25, 1, 0.5, 1), margin-top 2s cubic-bezier(0.25, 1, 0.5, 1), transform 2s cubic-bezier(0.25, 1, 0.5, 1);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%);
}
#subtitles-track { display: flex; flex-direction: column; align-items: center; will-change: transform; }
.paragraph { width: 100%; margin-bottom: 60px; font-size: 2rem; font-weight: 700; line-height: 1.5; text-align: center; opacity: 0.35; transition: opacity 0.8s ease, filter 0.8s ease; }
.paragraph.active { opacity: 1; }
.paragraph.past { opacity: 0.15; filter: blur(2px); }
.word-wrap { position: relative; display: inline-block; margin: 0; font-weight: 900; }
.word-base { color: var(--word-future); opacity: 0.6; transition: opacity 0.3s ease; }
.word-highlight { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #6b11ff; -webkit-background-clip: text; -webkit-text-fill-color: transparent; clip-path: inset(0 100% 0 0); will-change: clip-path; }

/* --- ПАНЕЛЬ УПРАВЛЕНИЯ И КНОПКА ЗАПИСИ --- */
.record-btn { position: absolute; top: 20px; right: 20px; z-index: 9999; padding: 12px 24px; font-size: 14px; font-weight: 900; background: #ff116b; color: white; border: none; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 15px rgba(255, 17, 107, 0.4); }
#controls { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 15px; align-items: center; z-index: 20; background: rgba(255, 255, 255, 0.75); padding: 5px 20px; border-radius: 15px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08); border: 1px solid rgba(255, 255, 255, 0.5); transition: opacity 2s ease, bottom 2s cubic-bezier(0.25, 1, 0.5, 1); width: 60%; max-width: 700px; }
button.control-btn { background: #fff; border: none; padding: 6px 16px; font-size: 0.8rem; font-weight: 900; border-radius: 10px; cursor: pointer; color: #111; box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: transform 0.2s; }
button.control-btn:hover { transform: translateY(-2px); }
#progress-container { flex-grow: 1; height: 20px; display: flex; align-items: center; cursor: pointer; margin: 0 10px; }
#progress-track-bg { width: 100%; height: 5px; background: rgba(0,0,0,0.1); border-radius: 3px; pointer-events: none; }
#progress-bar { width: 0%; height: 100%; background: var(--accent-color); border-radius: 3px; pointer-events: none; }
#time-display { font-weight: 900; font-size: 0.9rem; font-variant-numeric: tabular-nums; color: #111; min-width: 75px; text-align: right; }

/* --- КНОПКИ НАВИГАЦИИ ПО АБЗАЦАМ --- */
.para-nav-btn {
    background: #fff; border: none; width: 32px; height: 32px; border-radius: 50%;
    font-size: 0.7rem; cursor: pointer; color: #555; flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08); transition: transform 0.15s, color 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.para-nav-btn:hover { transform: scale(1.15); color: #111; }

#mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%; z-index: 25;
    padding: 10px 16px; gap: 12px; justify-content: space-between;
    background: rgba(255,255,255,0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0,0,0,0.06);
    max-width: stretch;
}
.mobile-nav-btn {
    flex: 1; padding: 14px 0; font-size: 1rem; font-weight: 700; border: none;
    border-radius: 12px; cursor: pointer; color: #333;
    background: rgba(107, 17, 255, 0.08); transition: background 0.15s;
}
.mobile-nav-btn:active { background: rgba(107, 17, 255, 0.2); }
.mobile-nav-play { flex: 0 0 auto; width: 56px; font-size: 1.2rem; }
/* --- СТИЛЬ ДЛЯ ВВЕДЕНИЯ --- */
.word-wrap.intro-style .word-base {
    color: #b8c4a0;
    opacity: 0.8;
    font-weight: 800;
}

.word-wrap.intro-style .word-highlight {
    background: linear-gradient(180deg, #2E7D32 0%, #D4AF37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    font-weight: 800;
}

/* --- МАГИЧЕСКОЕ СИЯНИЕ --- */
#magic-glow {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.5) 0%, rgba(255, 255, 255, 0.2) 40%, transparent 80%);
    pointer-events: none; opacity: 0; z-index: 1; mix-blend-mode: screen;
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ --- */
@media (max-width: 768px) {
    body.intro-mode #logo-img { width: 180px; }
    body.intro-mode #main-title { font-size: 1.6rem; letter-spacing: 2px; }
    body.intro-mode #header-section { gap: 40px; }

    body.main-mode #logo-img { width: 120px; }
    body.main-mode #main-title { font-size: 1rem; letter-spacing: 3px; }
    body.main-mode #header-section { gap: 20px; margin-top: 2vh; }
    body.main-mode #subtitles-wrapper { height: 50vh; }

    #subtitles-wrapper { width: 95%; }
    .paragraph { font-size: 1.2rem; margin-bottom: 40px; line-height: 1.4; }

    #overlay-title { font-size: 1.8rem; letter-spacing: 2px; margin-bottom: 10px; }
    .overlay-link { font-size: 1rem; margin-bottom: 25px; }
    #start-btn { padding: 14px 35px; font-size: 1.1rem; }
    .skip-intro { font-size: 0.7rem; padding: 5px 14px; }

    #controls { display: none; }
    .para-nav-btn { display: none; }
    #mobile-nav { display: flex; }
    body.main-mode #subtitles-wrapper { padding-bottom: 70px; }

    .ending-title { font-size: 1.4rem; }
    .ending-title span { font-size: 1.8rem; }
    .ending-subtitle { font-size: 1rem; margin-bottom: 25px; }
    .support-box { padding: 20px 25px; border-radius: 14px; }
    .support-box h3 { font-size: 1rem; margin-bottom: 15px; }
    .support-table { font-size: 0.95rem; }
    .support-table td { padding: 8px 12px; }
    .support-table td:first-child { font-size: 0.85rem; }
    .support-footer { font-size: 0.85rem; padding: 8px 14px; }

    .record-btn { top: 10px; right: 10px; padding: 8px 16px; font-size: 12px; }

    .blob { filter: blur(60px); opacity: 0.25; }
    .blob1 { width: 300px; height: 300px; }
    .blob2 { width: 350px; height: 350px; }
    .blob3 { width: 250px; height: 250px; }
    .blob4 { width: 280px; height: 280px; }
}