/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    --primary: #863bbf;
    --primary-gradient: linear-gradient(135deg, #863bbf 0%, #602a8f 100%);
    --secondary: #ff3d67;
    --secondary-gradient: linear-gradient(135deg, #ff3d67 0%, #d91c45 100%);
    --gold: #ffc107;
    --dark: #1a1a1a;
    --light: #f4f4f4;
    --text: #333;
    --border: #e0e0e0;
}

/* FIX: overflow-x: hidden запрещает горизонтальный скролл сайта */
body { 
    margin: 0; padding: 0; 
    font-family: 'Roboto', sans-serif; 
    background: #f0f2f5; 
    color: var(--text); 
    line-height: 1.6; 
    overflow-x: hidden; 
    width: 100%;
    position: relative;
    scroll-behavior: smooth; 
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
img { max-width: 100%; height: auto; border-radius: 8px; }
h1, h2, h3, h4 { color: var(--dark); margin-top: 1.5em; margin-bottom: 0.5em; line-height: 1.2; }
h1 { color: var(--primary); font-size: 2rem; text-align: center; margin-bottom: 20px; }
h2 { border-left: 5px solid var(--secondary); padding-left: 15px; font-size: 1.6rem; margin-top: 30px; }
h3 { font-size: 1.3rem; color: #5e2887; }

/* =========================================
   2. HEADER & NAVIGATION
   ========================================= */
header { background: #fff; box-shadow: 0 4px 15px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1000; width: 100%; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; }
.logo img { height: 32px; width: auto; display: block; }

.main-menu { display: flex; gap: 20px; align-items: center; }
.main-menu a { font-weight: 600; font-size: 15px; color: #333; display: flex; align-items: center; gap: 5px; }
.main-menu a:hover { color: var(--primary); }
.menu-icon { color: var(--secondary); margin-right: 5px; }
.menu-hot { color: #d35400 !important; }

.header-right { display: flex; align-items: center; gap: 10px; }
.header-buttons { display: flex; gap: 8px; }
.btn { padding: 8px 16px; border-radius: 50px; font-weight: 700; font-size: 14px; border: none; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; text-align: center; }
.btn-login { background: #fff; color: #3958d7; border: 1px solid #3958d7; }
.btn-signup { background: var(--secondary-gradient); color: #fff; box-shadow: 0 4px 10px rgba(255, 61, 103, 0.3); }
.btn:hover { opacity: 0.9; transform: translateY(-2px); }

.burger-btn { display: none; font-size: 24px; cursor: pointer; color: #333; margin-left: 5px; padding: 5px; }
.mobile-nav { display: none; position: absolute; top: 100%; left: 0; width: 100%; background: #fff; border-top: 1px solid #eee; box-shadow: 0 10px 20px rgba(0,0,0,0.1); z-index: 999; }
.mobile-nav a { display: block; padding: 15px 20px; border-bottom: 1px solid #f5f5f5; font-weight: 500; color: #333; }

/* =========================================
   3. CONTENT BLOCKS
   ========================================= */
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }
.content-wrap { background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 5px 25px rgba(0,0,0,0.05); margin: 30px 0; overflow: hidden; /* Обрезает контент внутри, если он вылезает */ }
.hero { background: #fff; padding: 20px 0; text-align: center; border-bottom: 1px solid #eee; margin-bottom: 20px; }
.breadcrumbs { font-size: 0.8rem; color: #888; margin-bottom: 10px; }

/* TABLES FIX (Для App Page) */
table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.95rem; }
table td, table th { padding: 12px; border: 1px solid var(--border); }
table tr:nth-child(even) { background-color: #fcfcfc; }
table td:first-child { font-weight: bold; width: 35%; color: var(--dark); background: #f9f9f9; }

/* Lists */
.pros-list li, ul.space-mark li { list-style: none; padding-left: 25px; position: relative; margin-bottom: 10px; }
.pros-list li:before { content: '\f00c'; font-family: 'Font Awesome 5 Free'; font-weight: 900; color: var(--secondary); position: absolute; left: 0; top: 3px; }
ul.space-mark li:before { content: '✔'; color: var(--secondary); position: absolute; left: 0; font-weight: bold; }
ol li { margin-bottom: 10px; font-weight: 500; }

/* FAQ */
details { background: #f9f9f9; padding: 15px; margin-bottom: 10px; border-radius: 8px; cursor: pointer; border: 1px solid #eee; }
summary { font-weight: bold; color: var(--primary); outline: none; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; float: right; font-weight: bold; color: var(--secondary); }
details[open] summary::after { content: '-'; }

/* Image Captions */
figure { margin: 20px 0; text-align: center; }
figcaption { font-size: 0.85rem; color: #666; margin-top: 5px; font-style: italic; }

/* =========================================
   4. SPECIAL BLOCKS
   ========================================= */
/* Offer Block */
.offer-block { background: #fff; border-radius: 12px; padding: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin: 30px 0; box-shadow: 0 15px 35px rgba(0,0,0,0.1); border: 1px solid #eee; position: relative; overflow: hidden; }
.offer-block::before { content: ''; position: absolute; top: 0; left: 0; width: 6px; height: 100%; background: var(--secondary-gradient); }
.offer-info { flex: 2; min-width: 250px; }
.offer-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); margin-bottom: 5px; }
.offer-cta { flex: 1; text-align: center; min-width: 200px; }
.btn-play { background: linear-gradient(180deg, #dbeb5b 0%, #b8cc1c 100%); color: #2b3a05; width: 100%; display: block; padding: 14px; border-radius: 8px; font-weight: 900; font-size: 1.1rem; text-transform: uppercase; box-shadow: 0 4px 0 #9cae14; margin-bottom: 8px; box-sizing: border-box; }
.btn-play:active { transform: translateY(2px); box-shadow: 0 2px 0 #9cae14; }

/* App Buttons */
.app-btn-container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin: 30px 0; }
.btn-app { padding: 15px 30px; border-radius: 8px; font-weight: bold; font-size: 18px; color: #fff; display: inline-flex; align-items: center; gap: 10px; width: 100%; max-width: 350px; justify-content: center; text-align: center; }
.btn-android { background-color: #28a745; }
.btn-ios { background-color: #1A77E2; }
.btn-app:hover { opacity: 0.9; transform: translateY(-3px); }

/* Wager Calculator */
.wager-calculator, .bonus-calculator { background-color: #fff9fa; border: 2px solid var(--secondary); border-radius: 12px; padding: 25px; max-width: 600px; margin: 30px auto; box-shadow: 0 10px 30px rgba(255, 61, 103, 0.1); }
.calculator-form-group input, .calculator-form-group select { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; }
.calculate-button { width: 100%; padding: 12px; background: var(--secondary-gradient); color: white; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; }
#calculator-results, #wager-results { margin-top: 20px; padding: 20px; background-color: #fff; border: 1px solid #eee; border-radius: 8px; display: none; }

/* Game Grid */
.ex-games-grid, .games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; margin: 20px 0; }
.ex-game-item img { width: 100%; border-radius: 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.ex-game-title { display: block; margin-top: 5px; font-size: 0.9rem; font-weight: bold; text-align: center; }

/* Footer */
footer { background: #fff; padding: 30px 0; margin-top: 50px; border-top: 1px solid #eee; text-align: center; color: #666; font-size: 0.9rem; }

/* =========================================
   5. RESPONSIVE FIXES
   ========================================= */
@media(max-width: 900px) {
    .main-menu { display: none; }
    .burger-btn { display: block; }
    .header-buttons .btn { padding: 6px 12px; font-size: 12px; }
    .logo img { height: 28px; }
    .offer-block { flex-direction: column; text-align: center; padding: 25px 15px; }
    .offer-block::before { width: 100%; height: 6px; } 
    .content-wrap { padding: 20px 15px; } /* Чуть меньше отступы */
    h1 { font-size: 1.6rem; }
    
    /* FIX: Таблица на мобильном будет скроллиться внутри, не ломая сайт */
    table { display: block; overflow-x: auto; white-space: nowrap; }
    
    /* FIX: Кнопки на App странице */
    .btn-app { font-size: 14px; padding: 12px; max-width: 100%; }
}

/* --- FIXES (License & Icons) --- */

/* 1. Бронебойный стиль для кнопки лицензии */
a.license-btn, .license-btn {
    background-color: #2ecc71 !important;
    background: #2ecc71 !important; /* Дублируем */
    color: #ffffff !important;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(46, 204, 113, 0.3);
    margin: 0 auto; /* Центровка */
}
a.license-btn:hover { background-color: #27ae60 !important; transform: translateY(-2px); }

/* 2. Иконки в мобильном меню */
.mobile-nav a i { width: 25px; text-align: center; margin-right: 10px; color: var(--secondary); }

/* Chicken Road Specific */
.game-stats { display: flex; justify-content: space-around; background: #fff; padding: 20px; border-radius: 12px; margin: 20px 0; border: 1px solid #eee; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.stat-box { text-align: center; }
.stat-box strong { display: block; color: var(--primary); font-size: 1.4rem; font-weight: 900; }
.stat-box span { font-size: 0.9rem; color: #666; text-transform: uppercase; }
.promo-box { background: linear-gradient(135deg, #2c3e50, #000); color: #fff; padding: 30px; border-radius: 12px; text-align: center; margin: 30px 0; }
.promo-box h2 { color: var(--gold); border: none; padding: 0; margin-top: 0; }

/* =========================================
   EMERGENCY FIXES (Calculator & App Button)
   ========================================= */

/* 1. Исправляем Калькулятор (Bonuses) */
.wager-calculator, .bonus-calculator {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 20px !important;
}

.wager-calculator input, 
.wager-calculator select,
.bonus-calculator input, 
.bonus-calculator select {
    width: 100% !important; /* Растянуть поля ввода на всю ширину */
    box-sizing: border-box !important; /* Чтобы рамки не расширяли элемент */
    height: 45px !important; /* Фиксированная высота для красоты */
    margin-bottom: 10px !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
}

/* 2. Исправляем Кнопку Приложения (App Page) */
/* Это заставит кнопку не вылезать за пределы экрана */
.btn-app {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important; /* Самое важное правило! */
    white-space: normal !important; /* Если текст длинный - перенести на 2 строки */
    text-align: center !important;
    padding: 15px 10px !important; /* Уменьшим боковые отступы */
    font-size: 16px !important; /* Чуть меньше шрифт, чтобы влезло */
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Контейнер кнопок на мобильном ставим в колонку */
@media(max-width: 600px) {
    .app-btn-container {
        flex-direction: column !important;
        width: 100% !important;
    }
}

/* --- FIX: Calculator Button Color --- */
button.calc-btn, 
button.calculate-button {
    background: linear-gradient(135deg, #ff3d67 0%, #d91c45 100%) !important;
    background-color: #ff3d67 !important; /* На всякий случай */
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 15px !important;
    width: 100% !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    box-shadow: 0 4px 10px rgba(255, 61, 103, 0.3) !important;
}

button.calc-btn:hover, 
button.calculate-button:hover {
    opacity: 0.9 !important;
    transform: translateY(-2px) !important;
}

/* --- ULTIMATE BUTTON FIX --- */
#wager-calc button, 
#bonus-calculator-anchor button,
.wager-calculator button {
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: linear-gradient(135deg, #ff3d67 0%, #d91c45 100%) !important;
    background-color: #ff3d67 !important;
    color: #fff !important;
    border: 0 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    width: 100% !important;
    display: block !important;
    cursor: pointer !important;
}

/* --- FIX: Checkbox Size (Галочка стала нормальной) --- */
.bonus-calculator input[type="checkbox"],
.wager-calculator input[type="checkbox"] {
    width: 20px !important;      /* Маленькая ширина */
    height: 20px !important;     /* Маленькая высота */
    display: inline-block !important;
    margin-right: 10px !important;
    box-shadow: none !important;
    flex: none !important;       /* Чтобы не растягивалась */
}

/* Выравнивание текста рядом с галочкой */
.calculator-form-group .checkbox-label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

/* --- FOOTER FIXES --- */
footer .footer-logo img {
    width: auto !important;       /* Запрещаем растягиваться на всю ширину */
    height: 40px !important;      /* Фиксированная высота */
    max-width: 200px !important;  /* Ограничение ширины */
    display: inline-block !important;
    margin-bottom: 15px;
}

footer .footer-links {
    margin-bottom: 20px;
}

footer .footer-links a {
    margin: 0 10px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

footer .footer-links a:hover {
    text-decoration: underline;
    color: var(--secondary);
}

/* === Стили для контейнера игры Chicken Road === */
.game-container {
    margin: 40px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #d35400; /* Оранжевая полоска, как в меню */
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.game-container h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-container h2 i {
    color: #d35400;
}

/* Обертка для iframe с адаптивностью */
.game-iframe-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    margin: 25px 0;
    /* Соотношение сторон ~16:9 для высоты 650px */
    padding-top: min(56.25%, 650px);
    height: 0;
}

.game-iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Блок с уведомлением */
.game-notice {
    background: linear-gradient(135deg, #fff8e1 0%, #ffeaa7 100%);
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid #ffd54f;
    font-size: 0.95rem;
    margin-top: 20px;
}

.game-notice i {
    color: #e67e22;
    margin-right: 10px;
}

.game-notice a {
    color: #2980b9;
    font-weight: bold;
    text-decoration: underline;
}

.game-notice a:hover {
    color: #1a5276;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .game-container {
        padding: 20px 15px;
        margin: 30px 0;
    }
    .game-container h2 {
        font-size: 1.5rem;
    }
    .game-iframe-wrapper {
        padding-top: 75%; /* Более квадратное соотношение для мобильных */
    }
}

/* === Стили для блока быстрой инструкции === */
.quick-guide {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #eaeaea;
    border-radius: 12px;
    padding: 20px 25px;
    margin: 25px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.quick-guide h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px dashed #eee;
    padding-bottom: 10px;
}

.quick-guide h3 i {
    color: #d35400; /* Оранжевый, как в меню Chicken Road */
}

.quick-guide ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: none;
}

.quick-guide li {
    margin-bottom: 12px;
    padding-left: 30px;
    position: relative;
    line-height: 1.5;
}

.quick-guide li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #27ae60;
    font-weight: bold;
    background: #eafaf1;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.quick-guide li strong {
    color: #2c3e50;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .quick-guide {
        padding: 18px 20px;
        margin: 20px 0;
    }
    
    .quick-guide h3 {
        font-size: 1.2rem;
    }
    
    .quick-guide li {
        font-size: 0.95rem;
        padding-left: 28px;
    }
}

/* === Стили для блока попытки загрузки игры === */
.game-try-container {
    margin: 40px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 1px solid #e9ecef;
}

.game-try-container h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-try-container h2 i {
    color: #d35400;
}

.game-try-iframe {
    position: relative;
    width: 100%;
    margin: 20px 0;
    border-radius: 10px;
    overflow: hidden;
    min-height: 600px;
    background: #f5f5f5;
}

.iframe-fallback {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.alert-warning {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 20px;
    border-radius: 0 8px 8px 0;
}

.alert-warning h4 {
    color: #856404;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bonus-promo-box {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: white;
    border-radius: 12px;
    text-align: center;
}

.bonus-promo-box h3 {
    color: #FFD700;
    margin-top: 0;
}

.btn-play-large {
    display: inline-block;
    background: linear-gradient(90deg, #FF9800, #FF5722);
    color: white;
    padding: 18px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 6px 0 #E64A19;
}

.btn-play-large:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 0 #E64A19;
    background: linear-gradient(90deg, #FFB74D, #FF9800);
}

.small-note {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 15px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .game-try-container {
        padding: 20px 15px;
    }
    
    .game-try-iframe {
        min-height: 400px;
    }
    
    .btn-play-large {
        padding: 15px 30px;
        font-size: 1.1rem;
    }
}