/* ===========================
   1. GLOBAL RESET & VARS
   =========================== */
:root {
    --bg-dark: #0b0c10;
    --card-bg: #1f2833;
    --accent: #66fcf1;
    --text-light: #c5c6c7;
    --hover-glow: 0 0 15px rgba(102, 252, 241, 0.3);
}

* {
    box-sizing: border-box; /* Важно: чтобы padding не увеличивал ширину блоков */
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
}

/* ===========================
   2. ГЛАВНАЯ СТРАНИЦА (INDEX)
   =========================== */

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #1f2833 0%, #0b0c10 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #333;
}

.hero h1 {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(102, 252, 241, 0.5);
}

/* Поиск */
.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}
.search-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #45a29e;
    color: #fff;
    border-radius: 50px;
    padding: 12px 20px 12px 45px;
    width: 100%;
    transition: 0.3s;
    outline: none;
}
.search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(69, 162, 158, 0.3);
    border-color: var(--accent);
}
.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #45a29e;
}

/* Карточки игр */
.game-card {
    background: var(--card-bg);
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--hover-glow);
}

.card-img-wrapper {
    height: 200px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0; /* Чтобы картинка не сжималась */
}

.card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.game-card:hover .card-img-top {
    transform: scale(1.1);
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    color: #fff;
    font-weight: 700;
    margin-bottom: 10px;
}

.card-desc {
    font-size: 0.9rem;
    color: #aaa;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 20px;
    flex-grow: 1;
}

.btn-play {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 8px 0;
    transition: 0.3s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.btn-play:hover {
    background: var(--accent);
    color: #0b0c10;
    box-shadow: 0 0 10px var(--accent);
}

/* Footer */
footer {
    margin-top: auto;
    background: #050608;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #222;
}

/* ===========================
   3. СТРАНИЦА ИГРЫ (PLAY.PHP)
   =========================== */

/* Сброс стилей главной страницы для режима игры */
body.play-page {
    display: block; /* Отменяем flex из основного body */
    overflow: hidden; /* Убираем скролл */
    position: relative;
}

/* Фон (Ambience) */
.bg-ambience {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-size: cover;
    background-position: center;
    filter: blur(30px) brightness(0.4);
    z-index: 0;
}

/* Контейнер игры (iframe) */
.game-wrapper {
    position: absolute;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

/* Экран загрузки */
.loader-overlay {
    position: absolute;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: var(--bg-dark);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-out;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(102, 252, 241, 0.2);
    border-top: 5px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 15px var(--accent);
}

.loader-text {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulse 2s infinite;
}

/* Кнопки управления */
.ui-controls {
    position: absolute;
    top: 20px; left: 20px; right: 20px;
    display: flex;
    justify-content: space-between;
    z-index: 100;
    pointer-events: none; /* Пропускаем клики сквозь пустоту */
}

.btn-ui {
    pointer-events: auto; /* Включаем клики на кнопках */
    background: rgba(11, 12, 16, 0.85);
    color: #fff;
    border: 1px solid rgba(102, 252, 241, 0.3);
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(5px);
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

.btn-ui:hover {
    background: var(--accent);
    color: #0b0c10;
    box-shadow: 0 0 15px var(--accent);
    transform: translateY(-2px);
    border-color: var(--accent);
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }