:root { --bg-color: #050505; --text-main: #FFFFFF; }
body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-color); 
    /* UPDATED BACKGROUND: Deep radial gradient for depth */
    background-image: radial-gradient(circle at 50% 0%, #0d1610 0%, #050505 85%);
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keeps the gradient fixed while scrolling */
    color: var(--text-main); 
    overflow-x: hidden; 
    -webkit-font-smoothing: antialiased; 
    position: relative; /* Ensure body is a positioning context */
    transition: background-image 0.5s ease; /* *** НОВОЕ: Плавный переход фона *** */
}

/* *** НОВОЕ: Стиль для красного свечения при ошибке *** */
body.error-state {
    background-image: radial-gradient(circle at 50% 0%, #1a0a0a 0%, #050505 85%);
}


/* --- NEW: DOT PATTERN BACKGROUND --- */
.bg-dots {
    position: fixed; /* Fixed to viewport so mask stays centered */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through */
    z-index: -1; /* Behind content, but normally on top of body background */
    opacity: 0.4; /* MADE MORE TRANSPARENT AS REQUESTED */
    
    /* The dot pattern */
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 30px 30px; /* Grid spacing */
    
    /* The Fade/Mask Effect */
    /* Standard property */
    mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 100%);
    /* Webkit prefix for Chrome/Safari compatibility */
    -webkit-mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 100%);
}

/* --- Animations & UI --- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-up { animation: fadeUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; }

/* *** ИСПРАВЛЕНИЕ: Убраны min-height и align-items, чтобы убрать отступ *** */
.slide-container { 
    position: relative; 
    width: 100%; 
    z-index: 20; 
    /* min-height: 550px; */ /* <-- УБРАНО */
    display: flex;
    /* align-items: center; */ /* <-- УБРАНО */
    padding-top: 2rem; /* <-- ИЗМЕНЕНИЕ: Возвращаем 2rem, 4rem не помогло */
}

@media (max-width: 1023px) {
    .slide-container { min-height: auto; display: block; padding-top: 0; }
}

/* Force vertical layout on portrait monitors even if they are wide */
@media (orientation: portrait) {
    .slide-container { min-height: auto; display: block; padding-top: 0; }
}


.content-step { 
    width: 100%; 
    position: absolute; 
    top: 0; 
    left: 0;
    opacity: 0; 
    visibility: hidden;
    display: none; 
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
/* *** ИЗМЕНЕНИЕ: Убран padding-top, он теперь в .slide-container *** */
.content-step.active { 
    display: block;
    visibility: visible; 
    opacity: 1; 
    transform: translateX(0);
    position: relative; 
    z-index: 10;
    /* padding-top: 2rem; */ /* <-- УБРАНО */
}
/* Для intro оставляем как было, он сам себя позиционирует */
#step-intro.content-step.active {
    padding-top: 0;
}


/* Canvas Wrapper - Responsive Heights */
.canvas-wrapper { width: 100%; position: relative; display: flex; justify-content: center; align-items: center; }

/* Default Desktop */
@media (min-width: 1024px) { .canvas-wrapper { height: 600px; } }

/* Mobile / Tablet */
/* *** ИЗМЕНЕНИЕ: min-height изменен на 250px *** */
@media (max-width: 1023px) { .canvas-wrapper { height: 35vh; min-height: 250px; margin-bottom: 1rem; } }

/* Portrait Desktop Fix */
@media (orientation: portrait) and (min-width: 1024px) {
     .canvas-wrapper { height: 50vh; min-height: 500px; }
}

canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

/* *** НОВОЕ: Свечение канваса управляется через CSS *** */
#canvas-glow {
    /* bg-green-900/10 */
    background-color: rgba(16, 185, 129, 0.1); 
    transition: background-color 0.5s ease;
}
body.error-state #canvas-glow {
    /* red-900/10 */
    background-color: rgba(185, 16, 16, 0.1); 
}


/* Subtitle */
.subtitle-container { 
    position: absolute; left: 50%; transform: translateX(-50%); display: flex; justify-content: center; 
    pointer-events: none; opacity: 0; transition: opacity 0.5s ease; z-index: 10; 
    width: max-content; max-width: 90%; 
}
.subtitle-text { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; color: #4ADE80; background: transparent; padding: 4px 0; overflow: hidden; white-space: nowrap; border-right: 2px solid transparent; width: 0; text-align: center; }
@media (min-width: 768px) { .subtitle-text { font-size: 13px; } }
.subtitle-container.active { opacity: 1; }
.subtitle-container.active .subtitle-text { border-right-color: #4ADE80; animation: typing 2.5s steps(45, end) forwards, blink-caret .75s step-end infinite; }
.subtitle-container:not(.active) .subtitle-text { width: 0; animation: none; border-color: transparent; }
.subtitle-container.finished .subtitle-text { border-right-color: transparent; width: 100%; animation: none; }

/* *** НОВОЕ: Стиль субтитров в состоянии ошибки *** */
body.error-state .subtitle-container.active .subtitle-text,
body.error-state .subtitle-container.finished .subtitle-text {
    color: #EF4444; /* red-500 */
}
body.error-state .subtitle-container.active .subtitle-text {
    border-right-color: #EF4444;
}
body.error-state .subtitle-container.finished .subtitle-text {
    border-right-color: transparent;
}

@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: #4ADE80; } }

/* *** НОВОЕ: Каретка мигает красным при ошибке *** */
body.error-state .subtitle-container.active .subtitle-text {
    animation: typing 2.5s steps(45, end) forwards, blink-caret-error .75s step-end infinite;
}
@keyframes blink-caret-error { from, to { border-color: transparent } 50% { border-color: #EF4444; } }


/* Inputs & Buttons */
.input-field { width: 100%; background: #111; border: 1px solid #333; color: white; padding: 14px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; transition: all 0.2s; outline: none; }
.input-field:focus { border-color: #4ADE80; background: #0A0A0A; box-shadow: 0 0 0 1px #4ADE80; }
.input-field:disabled { background: #1a1a1a; color: #555; border-color: #333; cursor: not-allowed; }

.input-label { display: block; font-size: 11px; font-weight: 600; color: #9CA3AF; margin-bottom: 8px; text-align: left; }
.btn-primary { background-color: #FFF; color: #000; transition: all 0.2s; }
.btn-primary:hover { background-color: #E5E5E5; transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background-color: transparent; border: 1px solid #333; color: #FFF; transition: all 0.2s; }
.btn-secondary:hover { border-color: #FFF; }

.custom-scroll::-webkit-scrollbar { width: 6px; height: 4px; }
.custom-scroll::-webkit-scrollbar-track { background: #111; border-radius: 4px; }
.custom-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #444; }

.network-option { cursor: pointer; transition: all 0.2s; opacity: 0.4; filter: grayscale(100%); position: relative; }
.network-option:hover { opacity: 0.8; }
.network-option.selected { opacity: 1; filter: grayscale(0%); transform: scale(1.1); z-index: 2; }

.card-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.back-btn { color: #6B7280; cursor: pointer; transition: color 0.2s; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #1A1A1A; border: 1px solid #333; }
.back-btn:hover { color: #FFF; border-color: #555; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; display: flex; align-items: center; justify-content: center; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-content { background: #111; border: 1px solid #333; width: 90%; max-width: 500px; padding: 2rem; border-radius: 24px; transform: scale(0.95); transition: transform 0.3s ease; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.modal-overlay.open .modal-content { transform: scale(1); }

@keyframes slideIn { from { opacity: 0; transform: translateY(-30px); max-height: 0; margin-bottom: 0; } to { opacity: 1; transform: translateY(0); max-height: 80px; margin-bottom: 12px; } }
@keyframes slideOut { from { opacity: 1; transform: translateY(0); max-height: 80px; margin-bottom: 12px; } to { opacity: 0; transform: translateY(30px); max-height: 0; margin-bottom: 0; } }
.feed-item-enter { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.feed-item-exit { animation: slideOut 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* *** НОВАЯ АНИМАЦИЯ СПИННЕРА *** */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
}

/* *** НОВЫЕ СТИЛИ ДЛЯ TOAST *** */
#toast-notification {
    background-color: rgba(17, 17, 17, 0.8); /* #111 with 80% opacity */
    backdrop-filter: blur(5px);
    border: 1px solid #333;
    color: #4ADE80; /* green-400 */
    border-radius: 12px; /* Более скругленный, как у карточек */
    padding: 12px 20px; /* text-sm py-3 px-6 */
    font-size: 14px;
    /* Стили из Tailwind, которые были в HTML */
    position: fixed;
    bottom: 40px; /* bottom-10 */
    left: 50%;
    transform: translateX(-50%) translateY(16px); /* -translate-x-1/2 translate-y-4 */
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* duration-300 ease-out-in */
    pointer-events: none;
    z-index: 110;
}
#toast-notification.error {
    color: #EF4444; /* red-500 */
}
#toast-notification.show {
    opacity: 1;
    transform: translateY(0) translateX(-50%);
    pointer-events: auto;
}

/* === СТИЛИ ДЛЯ КАСТОМНОГО ДРОПДАУНА ЯЗЫКОВ === */
#lang-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.lang-option {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 12px;
    color: #9CA3AF; /* gray-400 */
    transition: all 0.2s;
    border-left: 2px solid transparent;
}
.lang-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #FFF;
    border-left-color: #4ADE80; /* Зеленый акцент при наведении */
}