* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

/* ===== ФОН: КАРТИНКА + ГРАДИЕНТ ПОВЕРХ ===== */
body {
    margin: 0;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    color: white;
    position: relative;
}

/* Слой 1: Картинка (самый нижний) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('img/bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
}

/* Слой 2: Градиент поверх картинки (переливается) */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(30, 60, 114, 0.82) 0%,
        rgba(42, 82, 152, 0.82) 25%,
        rgba(126, 34, 206, 0.82) 50%,
        rgba(194, 65, 12, 0.82) 75%,
        rgba(220, 38, 38, 0.82) 100%
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===== КОНТЕЙНЕР ===== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ===== НАВИГАЦИЯ ===== */
.navigation {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.nav-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ===== ЗАГОЛОВОК ===== */
h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
    font-weight: 700;
}

/* ===== ЛОГОТИП TMDB ===== */
.tmdb-attribution {
    text-align: center;
    margin: -10px auto 30px auto;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    max-width: 300px;
}

.tmdb-attribution p {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

.tmdb-logo {
    height: 20px;
    transition: transform 0.3s;
    filter: brightness(1.2);
}

.tmdb-attribution a:hover .tmdb-logo {
    transform: scale(1.1);
}

/* ===== КВИЗ - СЕТКА 3 КОЛОНКИ ===== */
.question {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.question p {
    grid-column: 1 / -1;
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.question > div {
    grid-column: 1 / -1;
    text-align: center;
}

.question button {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.question button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.question button:active {
    transform: translateY(-1px);
}

/* ===== КНОПКА "МНЕ ПОВЕЗЁТ!" ===== */
.btn-lucky {
    background: linear-gradient(270deg, #ff6b6b, #ee5a6f, #ff8787, #ff6b6b) !important;
    background-size: 400% 400% !important;
    font-size: 1.2rem !important;
    padding: 15px 40px !important;
    margin-top: 10px !important;
    animation: gradientFlow 3s ease infinite, pulseLucky 2s ease-in-out infinite !important;
    width: auto !important;
}

.btn-lucky:hover {
    transform: scale(1.05) translateY(-2px) !important;
}

@keyframes gradientFlow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulseLucky {
    0% {
        box-shadow: 0 0 0 0 rgba(255,107,107,0.9),
                    0 0 20px rgba(255,107,107,0.6),
                    0 0 40px rgba(255,107,107,0.3);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(255,107,107,0),
                    0 0 30px rgba(255,107,107,0.8),
                    0 0 60px rgba(255,107,107,0.5);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255,107,107,0.9),
                    0 0 20px rgba(255,107,107,0.6),
                    0 0 40px rgba(255,107,107,0.3);
    }
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(102,126,234,0.7); }
    50%       { box-shadow: 0 0 0 10px rgba(102,126,234,0); }
}

/* ===== ЛОАДЕР ===== */
.loader {
    border: 5px solid rgba(255,255,255,0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== КАРТОЧКА ФИЛЬМА ===== */
.movie-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.movie-card img {
    width: 100%;
    max-width: 300px;
    border-radius: 15px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.movie-info {
    flex: 1;
}

.movie-type {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.movie-info h2 {
    margin: 10px 0;
    font-size: 2rem;
}

.year {
    color: rgba(255,255,255,0.7);
    font-size: 1rem;
}

.rating {
    font-size: 1.3rem;
    color: #ffd700;
    margin: 10px 0;
}

.genres {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.8);
    margin: 8px 0;
}

.description {
    line-height: 1.6;
    margin: 15px 0;
    color: rgba(255,255,255,0.9);
}

/* ===== КНОПКИ В КАРТОЧКЕ ===== */
.buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.buttons button,
.buttons a {
    flex: 1;
    min-width: 200px;
    padding: 15px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    color: white;
}

.btn-save {
    background: #2ecc71;
    color: white;
}

.btn-save:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.btn-save.saved {
    background: #95a5a6;
    cursor: default;
}

.btn-save.saved:hover {
    transform: none;
}

.btn-another {
    background: #3498db;
    color: white;
}

.btn-another:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-restart {
    background: #e74c3c;
    color: white;
}

.btn-restart:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.trailer-btn {
    background: #e74c3c;
    color: white;
}

.trailer-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-share {
    background: #3498db;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-share:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* ===== КНОПКА "НАЗАД НА ГЛАВНУЮ" ===== */
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    text-decoration: none !important;
    padding: 16px 40px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    margin: 30px auto 0 auto;
}

.btn-back:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-back:active {
    transform: translateY(-1px);
}

.back-button-wrap {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* ===== УВЕДОМЛЕНИЕ ===== */
.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2ecc71;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: slideInRight 0.3s ease;
    z-index: 1000;
    font-weight: 600;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== ВОТЧЛИСТ ===== */
.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.watchlist-item {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    text-align: center;
}

.watchlist-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.watchlist-item img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 10px;
}

.watchlist-item h3 {
    font-size: 1.1rem;
    margin: 10px 0;
}

.watchlist-item p {
    font-size: 0.9rem;
    margin: 5px 0;
}

.btn-remove {
    background: #e74c3c;
    width: 100%;
    margin-top: 10px;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-remove:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.empty-watchlist,
.empty-history {
    text-align: center;
    padding: 60px 20px;
}

.empty-watchlist p,
.empty-history p {
    font-size: 1.3rem;
    margin: 20px 0;
}

/* ===== ИСТОРИЯ ===== */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.history-item {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    text-align: center;
}

.history-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.history-item img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 10px;
}

.history-item h3 {
    font-size: 1.1rem;
    margin: 10px 0;
}

.history-item p {
    font-size: 0.9rem;
    margin: 5px 0;
}

.history-date {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    margin-top: 10px;
}

.btn-view-again {
    background: #3498db;
    width: 100%;
    margin-top: 10px;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-view-again:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-clear-history {
    background: #e74c3c;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: block;
    margin: 20px auto 0 auto;
    font-size: 1rem;
}

.btn-clear-history:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* ===== ФИЛЬТРЫ ===== */
#filters-panel {
    margin-bottom: 30px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filters-container {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.filters-container h3 {
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    text-align: center;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 500;
}

.filter-group select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.9);
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-group select:hover {
    background: white;
    transform: translateY(-2px);
}

.filter-group select:focus {
    outline: 2px solid #667eea;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-close-filters,
.btn-reset-filters {
    flex: 1;
    min-width: 120px;
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    color: white;
    font-weight: 600;
}

.btn-close-filters {
    background: #2ecc71;
}

.btn-close-filters:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.btn-reset-filters {
    background: #95a5a6;
}

.btn-reset-filters:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

/* ===== СТРАНИЦЫ (about, faq, contacts и т.д.) ===== */
.page-content {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    line-height: 1.8;
    text-align: left;
}

.page-content h2 {
    font-size: 1.5rem;
    margin: 30px 0 10px 0;
    color: #64ffda;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding-bottom: 8px;
}

.page-content h2:first-child {
    margin-top: 0;
}

.page-content p {
    margin: 10px 0;
    color: rgba(255,255,255,0.9);
}

.page-content ul {
    padding-left: 20px;
    margin: 10px 0;
}

.page-content ul li {
    margin: 8px 0;
    color: rgba(255,255,255,0.9);
}

.page-content a {
    color: #64ffda;
    text-decoration: none;
    border-bottom: 1px solid rgba(100,255,218,0.3);
    transition: all 0.3s;
}

.page-content a:hover {
    border-bottom-color: #64ffda;
}

.page-content em {
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 2rem;
    }

    .container {
        padding: 20px 15px;
        border-radius: 20px;
    }

    .question {
        grid-template-columns: 1fr;
        padding: 25px 15px;
    }

    .movie-card {
        padding: 20px;
    }

    .buttons {
        flex-direction: column;
    }

    .buttons button,
    .buttons a {
        min-width: 100%;
    }

    .navigation {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
    }

    .filters-container {
        padding: 20px 15px;
    }

    .filter-group select {
        font-size: 0.9rem;
    }

    .page-content {
        padding: 25px 20px;
    }

    .btn-back {
        width: 100%;
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .question p {
        font-size: 1.2rem;
    }

    .question button {
        font-size: 1rem;
        padding: 12px 20px;
    }

    .movie-info h2 {
        font-size: 1.5rem;
    }

    .watchlist-grid,
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
.footer-creator {
    color: #64ffda;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(100, 255, 218, 0.4);
    transition: all 0.3s;
}

.footer-creator:hover {
    color: #ffffff;
    border-bottom-color: #ffffff;
}