/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --light-blue: #1e90ff;
    --dark-blue: #0a1f3a;
    --orange: #ff6b35;
    --blue-btn: #4a90e2;
    --white: #ffffff;
    --text-light: #f8f9fa;
    --text-dark: #333;
    --hero-bg-image: url('assets/fon4.png');
    --hero-bg-opacity: 0.15;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-light);
    background-color: var(--dark-blue);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background-color: var(--light-blue);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo-img {
    height: 50px;
    width: auto;
    max-width: 200px;
}

.nav {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
}

.btn-play {
    background-color: var(--orange);
    color: var(--white);
}

.btn-play:hover {
    background-color: #e55a2b;
    transform: translateY(-2px);
}

.btn-register {
    background-color: var(--blue-btn);
    color: var(--white);
}

.btn-register:hover {
    background-color: #3a7bc8;
    transform: translateY(-2px);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--white);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Main Content Styles */
.main-content {
    min-height: calc(100vh - 200px);
}

/* Hero Section with Background Image */
.hero {
    background: linear-gradient(135deg, var(--dark-blue) 0%, #1a3658 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--hero-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: var(--hero-bg-opacity);
    z-index: 0;
}

/* Fix for mobile background */
@media (max-width: 768px) {
    .hero::before {
        background-attachment: scroll;
        background-size: cover;
    }
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-text h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--white);
    text-align: left;
    line-height: 1.2;
}

.hero-text p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: var(--text-light);
    opacity: 0.9;
    text-align: left;
    line-height: 1.6;
}

/* Text Alignment Styles */
h1, h2, h3, h4, h5, h6 {
    text-align: left;
    line-height: 1.3;
}

ul, ol {
    text-align: left;
    margin-left: 20px;
    margin-bottom: 20px;
}

li {
    text-align: left;
    margin-bottom: 8px;
    line-height: 1.5;
}

p {
    text-align: left;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Center alignment for images, buttons and tables */
.content-section .game-card,
.faq-section .faq-image,
.content-section img:not(.hero-image img),
.content-section .game-buttons,
.faq-section .faq-buttons {
    text-align: center;
}

/* Table Styles */
table {
    border-collapse: collapse;
    margin: 20px auto;
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

th, td {
    border: 1px solid var(--white);
    padding: 12px 15px;
    text-align: center;
}

th {
    background-color: rgba(30, 144, 255, 0.3);
    font-weight: bold;
    color: var(--white);
}

td {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.1);
}

/* TOC Menu */
.toc-menu {
    margin-top: 30px;
    text-align: left;
}

.toc-toggle {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--white);
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    transition: all 0.3s ease;
    text-align: left;
    user-select: none;
}

.toc-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.burger-icon {
    font-size: 1.5rem;
}

.toc-nav {
    display: none;
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    margin-top: 10px;
    padding: 20px;
    text-align: left;
    z-index: 999;
}

.toc-nav.active {
    display: block !important;
}

.toc-nav ul {
    list-style: none;
    text-align: left;
    margin-left: 0;
}

.toc-nav li {
    margin-bottom: 10px;
    text-align: left;
}

.toc-nav a {
    color: var(--dark-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    text-align: left;
    display: block;
    padding: 8px 0;
}

.toc-nav a:hover {
    color: var(--light-blue);
}

/* Images and Buttons */
.hero-image {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.faq-image,
.game-card {
    text-align: center;
}

.faq-image img,
.game-card img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.faq-buttons,
.game-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Content Section */
.content-section {
    padding: 80px 0;
    background: rgba(255,255,255,0.02);
}

.section-header {
    text-align: left;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--white);
    text-align: left;
    margin-bottom: 15px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.game-card {
    background: rgba(255,255,255,0.05);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s ease;
    text-align: center;
}

.game-card:hover {
    transform: translateY(-5px);
}

/* FAQ Block Styles */
.faq-block {
    padding: 80px 0;
    background: rgba(255,255,255,0.02);
}

.faq-block .entry-title {
    font-size: 2.5rem;
    color: var(--white);
    text-align: left;
    margin-bottom: 30px;
    text-transform: uppercase;
    line-height: 1.2;
}

.faq-list {
    width: 100%;
}

.faq-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.faq-question {
    padding: 20px 60px 20px 20px;
    cursor: pointer;
    position: relative;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--white);
    margin: 0;
    transition: background-color 0.3s ease;
    line-height: 1.4;
    user-select: none;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.1);
}

.faq-question::after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: normal;
    transition: transform 0.3s ease;
    color: var(--light-blue);
}

.faq-item.active .faq-question::after {
    content: '−';
    transform: translateY(-50%) rotate(0deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.faq-item.active .faq-answer {
    max-height: 5000px !important;
    padding: 0 20px 20px 20px !important;
}

.faq-answer div[itemprop="text"] {
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    line-height: 1.6;
}

.faq-answer p {
    margin-bottom: 15px;
    text-align: left;
}

.faq-answer strong {
    color: var(--orange);
}

.faq-answer ul, 
.faq-answer ol {
    margin: 15px 0 15px 25px;
    text-align: left;
}

.faq-answer li {
    margin-bottom: 8px;
    text-align: left;
    line-height: 1.5;
}

/* FAQ Section specific styles */
.faq-section .faq-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

.faq-section .faq-image {
    text-align: center;
}

.faq-section .faq-buttons {
    margin-top: 20px;
}

/* Footer Styles */
.footer {
    background-color: var(--light-blue);
    padding: 40px 0 20px;
    color: var(--white);
}

.footer-content {
    text-align: center;
}

.footer-logos {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.footer-logo {
    height: 40px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    display: block;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s ease;
    padding: 8px 12px;
}

.footer-nav a:hover {
    opacity: 0.8;
}

.footer-text {
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
    line-height: 1.8;
    text-align: center;
}

.footer-text p {
    text-align: center;
    margin-bottom: 15px;
}

/* Background Control Panel */
.bg-control-panel {
    position: fixed;
    top: 50%;
    right: -300px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.95);
    padding: 20px;
    border-radius: 10px 0 0 10px;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1000;
    width: 300px;
}

.bg-control-panel.active {
    right: 0;
}

.bg-toggle {
    position: absolute;
    left: -40px;
    top: 20px;
    background: var(--light-blue);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px 0 0 5px;
    cursor: pointer;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 12px;
    font-weight: bold;
}

.bg-control-group {
    margin-bottom: 15px;
    text-align: left;
}

.bg-control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--dark-blue);
    text-align: left;
}

.bg-control-group input[type="url"],
.bg-control-group input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.bg-preview {
    width: 100%;
    height: 100px;
    background-size: cover;
    background-position: center;
    border: 2px dashed #ccc;
    margin-top: 10px;
    border-radius: 5px;
}

.bg-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.bg-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.bg-save {
    background: var(--light-blue);
    color: white;
}

.bg-reset {
    background: #ccc;
    color: #333;
}

.bg-status {
    margin-top: 10px;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    font-size: 12px;
    display: none;
}

.bg-status.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.bg-status.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

/* ===== IMPROVED MOBILE STYLES ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    /* Fixed Mobile Menu */
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--light-blue);
        padding: 20px;
        flex-direction: column;
        gap: 15px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        z-index: 1000;
    }

    .nav.active {
        display: flex !important;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Hero Section Mobile Fix */
    .hero {
        padding: 60px 0;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 2.2rem;
        text-align: center;
        margin-bottom: 15px;
    }

    .hero-text p {
        font-size: 1.1rem;
        text-align: center;
        margin-bottom: 25px;
    }

    .hero-buttons {
        justify-content: center;
        gap: 12px;
    }

    .btn {
        padding: 14px 28px;
        font-size: 14px;
        min-width: 140px;
    }

    /* FAQ Section Mobile Improvements */
    .faq-section .faq-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .faq-block {
        padding: 60px 0;
    }

    .faq-block .entry-title {
        font-size: 2rem;
        text-align: center;
        margin-bottom: 25px;
    }

    .faq-item {
        margin-bottom: 12px;
    }

    .faq-question {
        padding: 18px 50px 18px 18px;
        font-size: 1rem;
        line-height: 1.3;
    }

    .faq-question::after {
        right: 18px;
        font-size: 1.3rem;
    }

    .faq-item.active .faq-answer {
        padding: 0 18px 18px 18px !important;
    }

    .faq-answer p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    /* Content Sections */
    .content-section {
        padding: 60px 0;
    }

    .section-header {
        margin-bottom: 40px;
        text-align: center;
    }

    .section-header h2 {
        font-size: 2rem;
        text-align: center;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .game-card {
        padding: 25px 20px;
    }

    /* Footer Mobile */
    .footer {
        padding: 30px 0 15px;
    }

    .footer-logos {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 25px;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .footer-logo {
        height: 35px;
        max-width: 140px;
        margin: 0 auto;
    }

    .footer-nav {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 25px;
    }

    .footer-nav a {
        padding: 10px 15px;
        font-size: 1rem;
    }

    .footer-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .footer-text p {
        margin-bottom: 12px;
    }

    /* Background Panel Mobile */
    .bg-control-panel {
        width: 280px;
    }

    /* Tables Mobile */
    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .hero-text h1 {
        font-size: 1.8rem;
    }

    .section-header h2 {
        font-size: 1.6rem;
    }

    .faq-block .entry-title {
        font-size: 1.6rem;
    }

    .hero-buttons,
    .faq-buttons,
    .game-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .btn {
        width: 100%;
        max-width: 250px;
        padding: 12px 24px;
    }

    .bg-control-panel {
        width: 260px;
        right: -260px;
    }

    .bg-toggle {
        left: -35px;
        padding: 8px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 6px 8px;
    }

    .faq-question {
        padding: 15px 45px 15px 15px;
        font-size: 0.9rem;
    }

    .faq-question::after {
        right: 15px;
        font-size: 1.2rem;
    }

    /* Improved spacing for very small screens */
    .hero {
        padding: 50px 0;
    }

    .content-section,
    .faq-block {
        padding: 50px 0;
    }

    /* Footer Mobile Small */
    .footer {
        padding: 25px 0 12px;
    }

    .footer-logos {
        gap: 15px;
        margin-bottom: 20px;
    }

    .footer-logo {
        height: 30px;
        max-width: 120px;
    }

    .footer-nav {
        gap: 12px;
        margin-bottom: 20px;
    }

    .footer-nav a {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .footer-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .footer-text p {
        margin-bottom: 10px;
    }
}

/* Loading animation for buttons */
.loading {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Mobile menu animation */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-6px, -6px);
}

/* Specific alignment for different sections */
.hero-text {
    text-align: left;
}

.content-section .section-header,
.faq-section .section-header {
    text-align: left;
}

/* First block hero section */
.hero .hero-text {
    text-align: left;
}

.hero .hero-image {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero .hero-buttons {
    justify-content: center;
    width: 100%;
}

/* Utility classes for better mobile experience */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Дополнительные гарантии для логотипов */
.footer-logo {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

/* Защита от растягивания */
.footer-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
}

@media (max-width: 768px) {
    .footer-logo-container {
        height: 35px;
    }
}

@media (max-width: 480px) {
    .footer-logo-container {
        height: 30px;
    }
}

/* КРИТИЧЕСКИЕ ИСПРАВЛЕНИЯ ДЛЯ FAQ */
.faq-item.active .faq-answer {
    max-height: 5000px !important;
    padding: 0 20px 20px 20px !important;
    display: block !important;
}

/* Гарантируем что TOC открывается */
.toc-nav.active {
    display: block !important;
}

/* Улучшаем видимость активного FAQ */
.faq-item.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.3);
}