/* Общие стили. */

/* Цвета */
:root {
    --bg-dark: #333B65;
    --accent-orange: #FF7A00;
    --section-orange: #D5791C;
    --pill-dark: #293563;
}

/* Базовые настройки */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg-dark); color: #fff; overflow-x: hidden; }

/* Шапка и логотип */
.header-wrapper {
    padding: 20px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo-box { 
    background: #000; color: var(--accent-orange); text-decoration: none;
    padding: 8px 18px 8px 12px; border-radius: 10px; display: inline-flex;
    align-items: center; gap: 8px;
    font: 900 clamp(18px, 2.5vw, 22px) 'Inter', sans-serif;
    letter-spacing: -0.5px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.logo-box:hover { opacity: 0.88; transform: translateY(-1px); }

/* WS-индикатор */
#ws-status {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #ff4d4d;
    box-shadow: 0 0 8px #ff4d4d;
    flex-shrink: 0;
    margin-left: auto;
}

/* Главный экран */
.hero { 
    position: relative; padding: 60px 50px 120px 80px; 
    min-height: 550px; display: flex; flex-direction: column; justify-content: center; 
}
.hero-left {
    max-width: 55%;
    z-index: 10;
    position: relative;
    display: flex;
    flex-direction: column;
}
.hero h1 { 
    font: 900 clamp(40px, 5.5vw, 86px) 'Inter', sans-serif; 
    color: var(--accent-orange); 
    display: flex; 
    align-items: center; 
    gap: 20px; 
    margin-bottom: 30px; 
}
.hero h1 img { width: 70px; }

/* Подзаголовок */
.sub-pill { 
    background: var(--pill-dark); 
    padding: clamp(20px, 2.5vw, 30px) clamp(25px, 3vw, 40px); 
    border-radius: 40px; 
    max-width: 100%; 
    width: 480px; 
    margin-bottom: 50px; 
    text-align: center; 
    box-shadow: 0 10px 30px rgba(0,0,0,.4); 
}
.sub-pill p { font: 800 clamp(18px, 1.8vw, 22px)/1.2 'Inter', sans-serif; }

/* Кнопки */
.hero-btns { display: flex; gap: 30px; }
.btn-pill { 
    background: var(--accent-orange); color: #000; text-decoration: none;
    padding: clamp(12px, 1.5vw, 18px) clamp(25px, 3.5vw, 45px); 
    border-radius: 50px; 
    font: 800 clamp(18px, 2.2vw, 28px) 'Inter', sans-serif; 
    transition: .2s ease;
    text-align: center;
    white-space: nowrap;
}
.btn-pill:hover { transform: scale(1.05); }

/* Декорации */
.hero-right { position: absolute; top: 0; right: 0; width: 50%; height: 100%; }
.quiz-card-decor { 
    background: var(--pill-dark); width: 340px; padding: 35px; border-radius: 30px; 
    transform: rotate(25deg); position: absolute; top: 40px; right: 60px; box-shadow: 30px 30px 60px rgba(0,0,0,.5); z-index: 1; 
}
.quiz-card-decor .q-text { font: 800 14px 'Inter', sans-serif; margin-bottom: 15px; text-align: right; }
.quiz-card-decor .a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font: 700 12px 'Inter', sans-serif; }
.joystick-icon { width: 260px; height: auto; aspect-ratio: 1 / 1; position: absolute; top: 270px; right: 180px; z-index: 2; }

/* Фичи */
.features-section { background: var(--section-orange); padding: 80px 40px 120px; }
.features-grid { display: flex; gap: 25px; max-width: 1300px; margin: 0 auto 100px; }
.feature-item { 
    background: var(--bg-dark); flex: 1; padding: 50px 30px; border-radius: 20px; 
    font: 700 20px 'Inter', sans-serif; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.2);
    display: grid; place-items: center; min-height: 160px; 
}

/* Слайдер */
.slider-area { display: flex; align-items: center; justify-content: center; gap: 40px; }
.carousel { position: relative; width: 900px; height: 400px; }
.slide { 
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%); 
    width: 400px; 
    max-width: 85%;
    aspect-ratio: 8 / 5; 
    object-fit: contain; 
    cursor: pointer;
    transition: transform .5s, opacity .5s, filter 0.3s ease; 
    opacity: 0;
    border-radius: 12px;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}
.slide:hover {
    box-shadow: none;
}
.slide.active { left: 50%; transform: translate(-50%, -50%) scale(1.15); opacity: 1; z-index: 2; }
.slide.left { left: 15%; transform: translate(-50%, -50%) scale(0.8); opacity: .35; z-index: 1; }
.slide.right { left: 85%; transform: translate(-50%, -50%) scale(0.8); opacity: .35; z-index: 1; }
.arrow-btn { font-size: 80px; color: #fff; cursor: pointer; font-weight: 300; user-select: none; }

/* Адаптивность */
@media (max-width: 1200px) {
    .features-grid { flex-direction: column; width: 100%; }
    .carousel { width: 100%; max-width: 720px; height: 350px; }
    .slide { max-width: 320px; }
    .hero { padding: 40px 20px; text-align: center; align-items: center; }
    .hero-left { max-width: 100%; width: 100%; align-items: center; }
    .hero h1 { font-size: 42px; flex-direction: column; }
    .hero-right { display: none; } 
    .sub-pill { padding: 25px 30px; border-radius: 30px; margin-bottom: 35px; }
    .hero-btns { flex-direction: column; width: 100%; gap: 15px; }
    .btn-pill { width: 100%; }
    .header-wrapper { padding: 20px; }
    .logo-box { font-size: 20px; padding: 8px 18px; }
}

@media (max-width: 600px) {
    .header-wrapper { padding: 12px 15px; }
    .logo-box { font-size: 18px; padding: 6px 12px; border-radius: 8px; }
    #ws-status { width: 10px; height: 10px; }
    
    .hero { padding: 30px 15px 60px 15px; min-height: auto; }
    .hero h1 { font-size: 32px; gap: 10px; margin-bottom: 20px; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; }
    .hero h1 img { width: 36px; }
    
    .sub-pill { padding: 20px 15px; border-radius: 20px; margin-bottom: 30px; max-width: 100%; }
    .sub-pill p { font-size: 16px; line-height: 1.3; }
    
    .hero-btns { gap: 15px; width: 100%; }
    .btn-pill { padding: 14px 20px; font-size: 20px; border-radius: 30px; text-align: center; width: 100%; }
    
    .features-section { padding: 40px 15px 60px; }
    .features-grid { gap: 15px; margin-bottom: 50px; }
    .feature-item { padding: 30px 15px; font-size: 16px; min-height: 110px; border-radius: 12px; }
    
    .slider-area { gap: 15px; }
    .carousel { width: 100%; height: 260px; }
    .slide { max-width: 85%; }
    .arrow-btn { font-size: 40px; }
}

/* Изображения */
.retro-insert-coin { 
    display: block; margin: 0 auto 20px; max-width: 200px; width: 100%; height: auto; 
    image-rendering: pixelated; filter: drop-shadow(0 0 15px rgba(255, 122, 0, 0.4)); 
    animation: insert-pulse 1.5s infinite alternate;
}
@keyframes insert-pulse { 
    0% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(255, 122, 0, 0.3)); } 
    100% { transform: scale(1.05); filter: drop-shadow(0 0 20px rgba(255, 122, 0, 0.7)); } 
}

.retro-icon { 
    width: 22px !important; height: 22px !important; vertical-align: middle; margin-left: 8px; 
    image-rendering: pixelated; filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.8)); 
}

.retro-avatar { 
    width: 34px !important; height: 34px !important; 
    min-width: 34px !important; min-height: 34px !important;
    max-width: 34px !important; max-height: 34px !important;
    vertical-align: middle; margin-right: 12px; 
    border-radius: 4px; border: 2px solid var(--accent-orange); 
    box-shadow: 2px 2px 0 #000; image-rendering: pixelated; object-fit: cover !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.retro-avatar:hover { 
    transform: scale(1.3) rotate(-5deg); z-index: 10; position: relative; 
    box-shadow: 4px 4px 0 var(--accent-orange);
}

.retro-waiting-icon { 
    display: block; margin: 40px auto; max-width: 80px; width: 100%; height: auto;
    image-rendering: pixelated; filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.6));
    animation: retro-spin 3s steps(8) infinite; 
}
@keyframes retro-spin { 100% { transform: rotate(360deg); } }

.state-img { 
    display: block; margin: 20px auto; max-width: 150px; width: 100%; height: auto;
    image-rendering: pixelated; filter: drop-shadow(5px 5px 0 rgba(0,0,0,0.5));
    animation: float-pulse 2.5s infinite ease-in-out; 
}
@keyframes float-pulse { 
    0% { transform: translateY(0) scale(1); filter: drop-shadow(5px 5px 0 rgba(0,0,0,0.5)); } 
    50% { transform: translateY(-10px) scale(1.05); filter: drop-shadow(10px 15px 0 rgba(0,0,0,0.2)); } 
    100% { transform: translateY(0) scale(1); filter: drop-shadow(5px 5px 0 rgba(0,0,0,0.5)); } 
}

.medal-img { 
    width: 70px !important; height: 70px !important; display: inline-block; margin-bottom: 15px; 
    image-rendering: pixelated; filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.8));
    animation: medal-bob 2s infinite ease-in-out;
}
@keyframes medal-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); filter: drop-shadow(3px 8px 0 rgba(255, 122, 0, 0.5)); } }

@media (max-width: 600px) {
    .retro-insert-coin { max-width: 150px; }
    .state-img { max-width: 100px; }
    .retro-waiting-icon { max-width: 60px; }
    .medal-img { width: 50px !important; height: 50px !important; }
    .retro-avatar { 
        width: 28px !important; height: 28px !important; 
        min-width: 28px !important; min-height: 28px !important;
        max-width: 28px !important; max-height: 28px !important;
    }
}

/* Большие экраны */
@media (min-width: 1600px) {
    .header-wrapper { padding: 40px 0 0 80px; max-width: 1800px; margin: 0 auto; }
    
    .hero { max-width: 1800px; margin: 0 auto; padding: 100px 80px 180px 120px; min-height: 700px; }
    .hero h1 { font-size: 110px; gap: 30px; margin-bottom: 40px; }
    .hero h1 img { width: 90px; }
    
    .sub-pill { max-width: 600px; padding: 40px 50px; border-radius: 50px; margin-bottom: 70px; }
    .sub-pill p { font-size: 28px; }
    
    .hero-btns { gap: 40px; }
    .btn-pill { padding: 25px 60px; font-size: 36px; border-radius: 60px; }
    
    .quiz-card-decor { width: 450px; padding: 45px; right: 100px; border-radius: 40px; top: 60px; }
    .quiz-card-decor .q-text { font-size: 18px; margin-bottom: 20px; }
    .quiz-card-decor .a-grid { font-size: 16px; gap: 15px; }
    
    .joystick-icon { width: 350px; height: auto; aspect-ratio: 1 / 1; position: absolute; top: 310px; right: 250px; z-index: 2; }
    
    .features-grid { max-width: 1800px; gap: 40px; }
    .feature-item { font-size: 26px; padding: 60px 40px; min-height: 220px; border-radius: 30px; }
    
    .slider-area { gap: 60px; }
    .carousel { width: 1300px; height: 500px; }
    .slide { max-width: 550px; }
    .arrow-btn { font-size: 100px; }
}

/* Фокус */
.logo-box:focus-visible,
.btn-pill:focus-visible,
.arrow-btn:focus-visible,
.feature-item:focus-visible,
.footer-logo:focus-visible,
.footer-icon:focus-visible,
.footer-legal a:focus-visible {
    outline: 4px solid var(--accent-orange) !important;
    outline-offset: 4px;
}

/* ================================================================
   КАСТОМНЫЕ СТРАНИЦЫ ОШИБОК
   ================================================================ */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px - 200px);
    padding: 60px 20px;
    text-align: center;
    box-sizing: border-box;
}

.error-container {
    max-width: 600px;
    width: 100%;
    background: rgba(41, 53, 99, 0.4);
    border: 3px solid var(--accent-orange);
    border-radius: 30px;
    padding: 50px 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 20px rgba(255, 122, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.error-code-glow {
    font: 900 clamp(60px, 8vw, 100px) 'Poppins', sans-serif;
    color: #fff;
    text-shadow: 0 0 10px var(--accent-orange), 0 0 20px var(--accent-orange);
    line-height: 1;
    margin-bottom: -5px;
    letter-spacing: 2px;
    animation: error-text-pulse 2s infinite alternate;
}

@keyframes error-text-pulse {
    0% {
        text-shadow: 0 0 10px var(--accent-orange), 0 0 20px var(--accent-orange);
        transform: scale(1);
    }
    100% {
        text-shadow: 0 0 15px var(--accent-orange), 0 0 30px var(--accent-orange), 0 0 40px #ff3c00;
        transform: scale(1.05);
    }
}

.error-retro-img {
    width: 120px;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.5));
}

.error-title {
    font: 900 28px 'Inter', sans-serif;
    color: var(--accent-orange);
    margin-bottom: 5px;
}

.error-description {
    font: 500 16px/1.6 'Inter', sans-serif;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 10px;
}

.error-actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.error-actions .btn-pill {
    padding: 12px 30px;
    font-size: 18px;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.error-actions .btn-secondary {
    background: #000;
    color: var(--accent-orange);
    border: 2px solid var(--accent-orange);
    box-shadow: 3px 3px 0 var(--accent-orange);
    border-radius: 50px;
    font: 800 18px 'Inter', sans-serif;
    transition: .2s ease;
    text-align: center;
    white-space: nowrap;
}

.error-actions .btn-secondary:hover {
    background: var(--accent-orange);
    color: #000;
    box-shadow: none;
    transform: translate(3px, 3px);
}

@media (max-width: 768px) {
    .error-page {
        padding: 40px 15px;
    }
    .error-container {
        padding: 35px 25px;
        border-radius: 20px;
    }
    .error-title {
        font-size: 22px;
    }
    .error-description {
        font-size: 14px;
    }
    .error-actions {
        flex-direction: column;
        gap: 15px;
    }
    .error-actions .btn-pill {
        width: 100%;
    }
}

/* Progressive Image Loading */
.progressive-img {
    filter: blur(10px);
    transition: filter 0.4s ease-out;
}
.progressive-img.loaded {
    filter: blur(0) !important;
}

/* Lightbox Modal (Retro style) */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 20, 45, 0.93);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.lightbox-overlay.active .lightbox-content {
    transform: scale(1);
}
.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    border: none !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    background: transparent !important;
}
.lightbox-img.no-border {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 12px !important;
}
.lightbox-img.pixelated {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.lightbox-close {
    position: absolute;
    top: -45px;
    right: -10px;
    background: none;
    border: none;
    color: #fff;
    font-size: 45px;
    cursor: pointer;
    font-weight: 300;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    text-shadow: 2px 2px 0 #000;
}
.lightbox-close:hover {
    color: var(--accent-orange);
    transform: scale(1.1) rotate(90deg);
}

/* Avatar cursor and transitions */
.retro-avatar {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.3s ease !important;
}