/* =========================================
   APPLE STYLE DESIGN & LAYOUT
   ========================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #FFFFFF;
    color: #1d1d1f;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.header-placeholder {
    width: 100%;
    height: 70px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: #137fec;
}

.back-link svg {
    width: 20px;
    height: 20px;
}

.split-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 40px 60px;
    max-width: 1280px;
    margin: 0 auto;
    gap: 80px;
    box-sizing: border-box;
}

.left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
}

.left-column h1 {
    font-size: 46px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0 0 20px 0;
    color: #1d1d1f;
    text-align: center;
    transform: translateX(20px);
}

.right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 71px;
    max-width: 500px;
}

.right-column .subtitle {
    font-size: 28px;
    line-height: 1.4;
    color: #333336;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0 0 32px 0;
}

.logo-inline {
    display: inline-block;
    font-weight: 700;
    color: #1d1d1f;
    padding: 0 2px;
    text-decoration: none;
    vertical-align: baseline;
    position: relative;
}

.logo-inline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #137fec;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.logo-inline:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.berlingvo-logo-wrapper {
    display: inline-block;
    width: 26px;
    height: 24px;
    position: relative;
    margin-right: 6px;
    vertical-align: middle;
}

.berlingvo-logo-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.4);
    transform-origin: top left;
    position: absolute;
    top: 0;
    left: 0;
}

.berlingvo-logo-icon .part {
    width: 64px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: -0.05em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.part-ber {
    background: #000;
    color: #fff;
    transform: translateX(-4px);
    z-index: 3;
}

.part-lin {
    background: #FFCC00;
    color: #000;
    margin-top: -2px;
    z-index: 2;
}

.part-gvo {
    background: #DD0000;
    color: #fff;
    margin-top: -2px;
    transform: translateX(4px);
    z-index: 1;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #f5f5f7;
    border-radius: 50%;
    color: #1d1d1f;
    transition: all 0.2s ease;
}

.social-icon:hover {
    background: #1d1d1f;
    color: #fff;
    transform: translateY(-2px);
}

.social-icon svg {
    width: 24px;
    height: 24px;
}

.phone-wrapper {
    display: flex;
    flex-direction: column;
    width: 280px; /* Same as phone frame */
    gap: 16px;
}

.phone-controls {
    display: flex;
    justify-content: center;
    width: 100%;
}

.phone-frame {
    position: relative;
    width: 280px;
    height: 560px;
    border-radius: 40px;
    background: #000;
    border: 12px solid #1d1d1f;
    box-shadow: 0 30px 60px rgba(0,0,0,0.15);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.phone-frame:hover {
    transform: scale(1.02);
}

.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background: #1d1d1f;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    z-index: 10;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.phone-screen video, .phone-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hidden {
    display: none !important;
}

/* =========================================
   CONTROLS PANEL
   ========================================= */
.controls-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.controls-panel button {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    text-align: center;
}

.controls-panel button:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.controls-panel button:active {
    transform: translateY(0);
}

.mute-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1d1d1f;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mute-btn:hover {
    background: #333336;
}

.mute-btn svg {
    width: 20px;
    height: 20px;
}

/* =========================================
   СТИЛИ МАСКОТА 
   ========================================= */

#mascot-container {
    position: fixed;
    z-index: 9999;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none; /* Чтобы не перекрывал клики на элементы под ним */
}

/* Positioning Classes */
.pos-default {
    bottom: 0px;
    right: 20px;
    transform: none;
    top: auto;
    left: auto;
}

.pos-right {
    top: 50%;
    right: 0px;
    transform: translateY(-50%) rotate(-90deg);
    bottom: auto;
    left: auto;
}

.pos-left {
    top: 50%;
    left: 0px;
    transform: translateY(-50%) rotate(90deg);
    bottom: auto;
    right: auto;
}

.pos-top {
    top: 0px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    bottom: auto;
    right: auto;
}

.pos-bottom {
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%) rotate(0deg);
    top: auto;
    right: auto;
}

#mascot-sprite {
    width: 100%;
    height: 100%;
    background-image: url('bo_spritesheet.png');
    background-size: 400% 100%; /* 4 кадра по горизонтали */
    background-repeat: no-repeat;
    background-position: 0% 0%; /* По умолчанию первый кадр */
    transition: transform 0.5s ease-in-out, filter 0.5s ease;
    pointer-events: auto; /* Возвращаем кликабельность самому коту */
    cursor: pointer;
    transform-origin: bottom center;
}



/* --- Анимации состояний (CSS-трюки для статичной картинки) --- */

/* 1. Базовое дыхание (Idle) */
@keyframes breathe {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.03, 0.97) translateY(3px); }
}

.mascot-idle #mascot-sprite {
    background-position: 0% 0%;
    animation: breathe 3s infinite ease-in-out;
}

/* 2. Сон (Sleeping) - используем новый спрайт-лист на 17 кадров */
@keyframes sleep-frames {
    100% { background-position: -2550px 0; }
}

.mascot-sleeping #mascot-sprite {
    background-image: url('bo_sleep_spritesheet.png');
    background-size: 2550px 100%;
    background-position: 0 0;
    /* Добавляем плавное покачивание (breathe) поверх смены кадров для дополнительной плавности */
    animation: sleep-frames 4s steps(17) infinite, breathe 4s infinite ease-in-out;
    scale: -1 1; /* Разворот справа налево */
}

/* 3. Погладить (Petting) - анимация из 2 кадров (bo_1 и bo_2) */
@keyframes pet-frames {
    0%, 49.9% { background-image: url('bo_1.png'); }
    50%, 100% { background-image: url('bo_2.png'); }
}

.mascot-petting #mascot-sprite {
    background-size: 100% 100%;
    background-position: 0 0;
    animation: pet-frames 1.6s infinite, breathe 4s infinite ease-in-out;
    scale: -1 1;
}

/* 4. Музыка (Music) - мягкое покачивание */
@keyframes rock-music {
    0%, 100% { transform: rotate(-1.5deg) scale(1); }
    50% { transform: rotate(1.5deg) scale(1.01); }
}

.mascot-music #mascot-sprite {
    /* Меняем фон на одиночную картинку музыки вместо спрайт-листа */
    background-image: url('bo_music_1.png');
    background-size: 100% 100%;
    background-position: 0 0;
    animation: rock-music 2s infinite ease-in-out;
    scale: -1 1; /* Разворот справа налево */
}

/* 5. Успех / Класс (Thumbs Up) - подпрыгивание с эффектом Squash & Stretch */
@keyframes jump-joy {
    0%, 100% { transform: translateY(0) scale(1, 1); }
    10% { transform: translateY(3px) scale(1.05, 0.95); } /* Легкое приседание */
    30% { transform: translateY(-20px) scale(0.95, 1.05); } /* Высшая точка прыжка стала ниже */
    50% { transform: translateY(0) scale(1.05, 0.95); } /* Приземление */
    65% { transform: translateY(-8px) scale(0.98, 1.02); } /* Небольшой отскок */
    80% { transform: translateY(0) scale(1.02, 0.98); } /* Финальное приземление */
}

.mascot-thumbs-up #mascot-sprite {
    background-position: 100% 0%;
    animation: jump-joy 1.2s ease-in-out;
}

/* 6. Скука (Bored) - смена картинок (зевание) */
@keyframes bored-frames {
    0%, 33.33% { background-image: url('bo_bored_1.png'); }
    33.34%, 66.66% { background-image: url('bo_bored_2.png'); }
    66.67%, 100% { background-image: url('bo_bored_3.png'); }
}

.mascot-bored #mascot-sprite {
    /* Поскольку это одиночные картинки, а не спрайт-лист на 4 кадра, сбрасываем background-size */
    background-size: 100% 100%;
    background-position: 0 0;
    /* Комбинируем смену кадров с плавным дыханием для реалистичности */
    animation: bored-frames 3s infinite, breathe 4s infinite ease-in-out;
    scale: -1 1; /* Разворот справа налево */
}

/* 7. Злость (Angry) */
.mascot-angry #mascot-sprite {
    background-image: url('bo_angry_1.png');
    background-size: 100% 100%;
    background-position: 0 0;
    /* Тряска стала медленнее */
    animation: angry-shake 0.8s infinite ease-in-out;
}

@keyframes angry-shake {
    0%, 100% { transform: translateX(0) scale(1.02); }
    25% { transform: translateX(-0.5px) rotate(-0.5deg) scale(1.02); }
    75% { transform: translateX(0.5px) rotate(0.5deg) scale(1.02); }
}

/* 8. В телефоне (Handy) - одиночная картинка с покачиванием */
.mascot-handy #mascot-sprite {
    background-image: url('bo_handy_1.png');
    background-size: 100% 100%;
    background-position: 0 0;
    /* Плавно покачивается, имитируя чтение с экрана */
    animation: breathe 4s infinite ease-in-out;
    scale: -1 1; /* Разворот справа налево */
}

/* --- 9. Искать (Searching) --- */
.mascot-searching #mascot-sprite {
    background-image: url('bo_sucht_spritesheet_2.png');
    background-size: 100% 2400px;
    background-position: 0 0;
    animation: sucht-frames 2.5s steps(16) forwards, breathe 4s infinite ease-in-out;
    scale: -1 1;
}

@keyframes sucht-frames {
    100% { background-position: 0 -2400px; }
}

/* =========================================
   MOBILE ADAPTATION
   ========================================= */
@media (max-width: 850px) {
    .split-layout {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
        align-items: center;
    }

    .left-column, .right-column {
        display: contents;
    }

    /* Reorder elements */
    .left-column h1 {
        order: 1;
        font-size: 32px;
        margin-bottom: 10px;
        text-align: center;
        transform: none;
    }

    .right-column .subtitle {
        order: 2;
        font-size: 20px;
        margin-bottom: 20px;
        text-align: center;
        margin-top: 0;
    }

    .social-icons {
        order: 3;
        justify-content: center;
        margin-bottom: 20px;
        width: 100%;
    }

    .phone-wrapper {
        order: 4;
        margin: 0 auto 30px auto;
        /* Shift left to balance the mascot on the right */
        transform: translateX(-40px) scale(0.9);
        transform-origin: top center;
    }
    
    #mascot-container {
        order: 5; /* For when it becomes relative on small screens */
    }

    .controls-panel {
        order: 6;
        width: max-content;
        max-width: 70%;
        align-self: flex-start;
        justify-content: flex-start;
    }
    
    .controls-panel button {
        font-size: 14px;
        padding: 10px 16px;
    }

    /* Keep mascot fixed to viewport, shifted slightly right and down */
    #mascot-container.pos-default {
        position: fixed !important;
        right: 0px !important;
        bottom: 10px !important;
        top: auto !important;
        left: auto !important;
        transform: scale(0.75) !important;
        transform-origin: bottom right;
    }
    
    .pos-right {
        transform: translateY(-50%) rotate(-90deg) scale(0.85);
    }
    
    .pos-left {
        transform: translateY(-50%) rotate(90deg) scale(0.85);
    }
    
    .pos-top {
        transform: translateX(-50%) rotate(180deg) scale(0.85);
    }
    
    .pos-bottom {
        transform: translateX(-50%) rotate(0deg) scale(0.85);
    }
}

/* Very narrow screens (e.g. iPhone SE) */
@media (max-width: 400px) {
    .phone-wrapper {
        transform: scale(0.85) translateX(0); /* Center phone normally */
    }
    
    #mascot-container.pos-default {
        position: relative !important;
        right: auto !important;
        bottom: auto !important;
        transform: scale(0.85) !important;
        margin: -10px auto 30px auto !important;
    }
}
