:root {
    /* Цветовая палитра */
    --casino-green: #2a9d8f;
    --casino-dark-green: #226f66;
    --felt-green: #40a886;
    --wood-brown: #b76e40;
    --gold: #ffbe0b;
    --light-gold: #ffe066;
    --dark-gold: #e29400;
    --red: #ff5e5b;
    --black: #2b2b2b;
    --white: #ffffff;
    --gray: #7d8597;
    --light-gray: #f1f3f5;
    --blue: #3a86ff;
    /* Общие эффекты */
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    --button-shadow: 0 6px 0 var(--dark-gold);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Базовая структура страницы */
.casino-background {
    background: linear-gradient(135deg, #2c3e50, #4a6572, #2c3e50);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Poppins', 'Montserrat', sans-serif;
    color: var(--white);
    position: relative;
    overflow-x: hidden;
}

/* Анимация градиентного фона */
@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Текстура фона */
.casino-background::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 25px 25px, rgba(255, 255, 255, 0.1) 2px, transparent 0);
    background-size: 100px 100px;
    pointer-events: none;
}

/* Основной контейнер игры */
.blackjack-container {
    width: 100%;
    max-width: 1000px;
    background: linear-gradient(145deg, var(--casino-green), var(--casino-dark-green));
    border-radius: 20px;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
    padding: 30px;
    position: relative;
    border: 6px solid var(--wood-brown);
    display: flex;
    flex-direction: column;
}

/* Заголовок игры */
.game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

.game-title {
    color: var(--light-gold);
    text-transform: uppercase;
    text-align: center;
    font-size: 3rem;
    margin: 0;
    letter-spacing: 3px;
    font-weight: 800;
    position: relative;
    z-index: 2;
}

    .game-title::after {
        content: '';
        position: absolute;
        bottom: -10px;
        left: 50%;
        transform: translateX(-50%);
        width: 70%;
        height: 3px;
        background: linear-gradient(90deg, transparent, var(--gold), transparent);
    }

/* Стопка фишек - декоративный элемент */
.chip-stack {
    width: 70px;
    height: 70px;
    position: absolute;
    right: 0;
    top: 0;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

    .chip-stack::before {
        content: "";
        width: 60px;
        height: 10px;
        background: linear-gradient(to right, var(--red), var(--gold), var(--blue), var(--black));
        border-radius: 5px;
        position: absolute;
        top: 20px;
        transform: rotate(-15deg);
    }

    .chip-stack::after {
        content: "";
        width: 60px;
        height: 60px;
        background: conic-gradient(var(--gold) 0deg 60deg, var(--blue) 60deg 120deg, var(--red) 120deg 240deg, var(--black) 240deg 360deg);
        border-radius: 50%;
        position: absolute;
        top: 0;
        border: 2px solid rgba(0,0,0,0.2);
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }

/* Область сообщений */
.message-box {
    background-color: var(--white);
    border-left: 5px solid var(--gold);
    padding: 15px 20px;
    margin: 0 auto 25px;
    color: var(--black);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 85%;
    transition: var(--transition);
    z-index: 2;
    position: relative;
}

.message-win {
    border-left: 5px solid #4caf50;
    background-color: #e8f5e9;
    color: #2e7d32;
}

.message-lose {
    border-left: 5px solid var(--red);
    background-color: #ffebee;
    color: #c62828;
}

.message-info {
    border-left: 5px solid var(--blue);
    background-color: #e1f5fe;
    color: #0277bd;
}

.message-content {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Основная игровая область */
.game-area {
    background-color: var(--felt-green);
    border-radius: 16px;
    padding: 25px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
    position: relative;
    border: 3px solid var(--casino-dark-green);
    display: flex;
    flex-direction: column;
}

    /* Текстура игрового стола */
    .game-area::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.03) 4px);
        border-radius: inherit;
        z-index: 1;
        pointer-events: none;
    }

/* Секции игроков */
.player-section {
    position: relative;
    z-index: 2;
    margin-bottom: 15px;
}

.player-section-user {
    margin-top: 15px;
    margin-bottom: 25px;
}

/* Информация об игроке */
.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 3px solid var(--gold);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e8e8e8;
}

/* Аватар дилера */
.dealer-avatar::after {
    content: "♠";
    font-size: 30px;
    color: var(--black);
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
}

.dealer-avatar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, #3f51b5, transparent);
}

/* Аватар игрока */
.player-avatar-user {
    background: linear-gradient(135deg, #e4d9b4, #f8eecc);
}

    .player-avatar-user::after {
        content: "♥";
        font-size: 30px;
        color: var(--red);
        text-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
    }

    .player-avatar-user::before {
        content: "";
        position: absolute;
        bottom: -15px;
        left: 0;
        right: 0;
        height: 30px;
        border-radius: 50% 50% 0 0;
        background: rgba(0,0,0,0.1);
    }

/* Заголовок игрока */
.player-title {
    color: var(--white);
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

/* Значок с очками */
.score-badge {
    background: #ffffff;
    padding: 5px 10px;
    border-radius: 50px;
    font-size: 1.1rem;
    margin-left: 10px;
    color: var(--black);
    border: 2px solid var(--dark-gold);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: inline-block;
}

/* Область для карт */
.hand {
    display: flex;
    flex-wrap: wrap;
    min-height: 160px;
    padding: 10px;
    position: relative;
    justify-content: center;
    gap: 10px;
    z-index: 2;
}

/* Разделитель между дилером и игроком */
.table-divider {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    position: relative;
    z-index: 2;
}

    .table-divider::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 5%;
        right: 5%;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
        z-index: 1;
    }

/* Фишки на столе */
.chip {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

    .chip:hover {
        transform: translateY(-3px);
    }

    .chip::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 1px dashed rgba(255, 255, 255, 0.5);
    }

.red-chip {
    background: radial-gradient(circle at 30% 30%, #ff8a8a 0%, var(--red) 60%);
    border: 2px dashed #ffc7c7;
}

.blue-chip {
    background: radial-gradient(circle at 30% 30%, #94d0ff 0%, var(--blue) 60%);
    border: 2px dashed #c5e5ff;
}

.green-chip {
    background: radial-gradient(circle at 30% 30%, #89e89c 0%, #3cac4c 60%);
    border: 2px dashed #d2f9db;
}

.black-chip {
    background: radial-gradient(circle at 30% 30%, #a6aaaf 0%, var(--black) 60%);
    border: 2px dashed #e2e6eb;
}

/* Контейнер карты */
.card-container {
    position: relative;
    perspective: 1000px;
    margin: 5px;
    z-index: 2;
}

    .card-container.card-hidden {
        transform: rotateY(0deg);
    }

/* Игральная карта - базовый стиль */
.playing-card {
    width: 110px;
    height: 154px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    position: relative;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Удаляем линовку */
    background-image: none;
}

    /* Добавляем декоративную внутреннюю рамку для всех карт */
    .playing-card::before {
        content: "";
        position: absolute;
        top: 5px;
        left: 5px;
        right: 5px;
        bottom: 5px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 4px;
        z-index: 1;
        pointer-events: none;
    }


/* Улучшаем эффект при наведении */
.card-container:hover .playing-card {
    transform: translateY(-5px) rotate(1deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

/* Рубашка карты - полностью переопределяем все стили */
.playing-card.card-back {
    /* Отключаем все ранее определённые фоны */
    background: none;
    background-color: #303f9f;
    background-image: none !important;
    position: relative;
    overflow: hidden;
}

    /* Узор на рубашке */
    .playing-card.card-back::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: repeating-linear-gradient( 45deg, #3949ab, #3949ab 10px, #303f9f 10px, #303f9f 20px );
        opacity: 0.7;
        z-index: 1;
    }

    /* Символ в центре */
    .playing-card.card-back::after {
        content: "?";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 50px;
        color: white;
        z-index: 2;
        text-shadow: 0 0 5px rgba(0,0,0,0.5);
    }

/* Фон для красных карт (червы и бубны) */
.card-red {
    color: #e53935;
    background: linear-gradient(135deg, #fff, #fff8f8);
}

    /* Тонкий узор для красных карт */
    .card-red::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        opacity: 0.05;
        background-image: repeating-linear-gradient(45deg, #e53935, #e53935 10px, transparent 10px, transparent 20px), repeating-linear-gradient(-45deg, #e53935, #e53935 10px, transparent 10px, transparent 20px);
        border-radius: 7px;
        z-index: 1;
    }

/* Фон для черных карт (пики и трефы) */
.card-black {
    color: #212121;
    background: linear-gradient(135deg, #fff, #f8f8ff);
}

    /* Тонкий узор для черных карт */
    .card-black::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        opacity: 0.05;
        background-image: repeating-linear-gradient(45deg, #212121, #212121 10px, transparent 10px, transparent 20px), repeating-linear-gradient(-45deg, #212121, #212121 10px, transparent 10px, transparent 20px);
        border-radius: 7px;
        z-index: 1;
    }


/* Улучшение видимости содержимого карты */
.card-corner, .card-center-suit {
    position: relative;
    z-index: 2;
}

/* Добавляем тень для масти в центре */
.card-center-suit {
    font-size: 3rem;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

/* Эффект при наведении */
.card-container:hover .playing-card {
    transform: translateY(-5px) rotate(1deg);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

/* Углы карт */
.card-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.top-left {
    top: 6px;
    left: 6px;
}

.bottom-right {
    bottom: 6px;
    right: 6px;
    transform: rotate(180deg);
}

.card-rank {
    font-size: 1.4rem;
    font-weight: bold;
}

.card-suit {
    font-size: 1.2rem;
}

.card-center-suit {
    font-size: 3rem;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.1));
}

/* Кнопки действий */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
    flex-wrap: wrap;
    position: relative;
    z-index: 3;
}

/* 3D кнопки */
.btn-3d {
    position: relative;
    padding: 12px 25px;
    background: linear-gradient(to bottom, var(--gold), var(--dark-gold));
    color: var(--black);
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: var(--button-shadow), 0 8px 16px rgba(0, 0, 0, 0.18);
    transition: all 0.25s;
    cursor: pointer;
    outline: none;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 1px;
    z-index: 3;
}

    .btn-3d:hover {
        background: linear-gradient(to bottom, var(--light-gold), var(--gold));
        transform: translateY(-3px);
        box-shadow: 0 9px 0 var(--dark-gold), 0 12px 22px rgba(0, 0, 0, 0.2);
    }

    .btn-3d:active {
        transform: translateY(3px);
        box-shadow: 0 3px 0 var(--dark-gold), 0 4px 8px rgba(0, 0, 0, 0.1);
    }

    .btn-3d:disabled {
        background: linear-gradient(to bottom, var(--gray), #939cad);
        color: var(--light-gray);
        cursor: not-allowed;
        box-shadow: 0 6px 0 #636b7c, 0 8px 16px rgba(0, 0, 0, 0.1);
        opacity: 0.8;
    }

/* Кнопка "Взять карту" */
.btn-hit {
    background: linear-gradient(to bottom, #76cf79, #48a04c);
    box-shadow: 0 6px 0 #3e8942, 0 8px 16px rgba(0, 0, 0, 0.18);
    color: white;
}

    .btn-hit:hover {
        background: linear-gradient(to bottom, #91d994, #53b557);
        box-shadow: 0 9px 0 #3e8942, 0 12px 22px rgba(0, 0, 0, 0.2);
    }

    .btn-hit:active {
        box-shadow: 0 3px 0 #3e8942, 0 4px 8px rgba(0, 0, 0, 0.1);
    }

/* Кнопка "Стоп" */
.btn-stand {
    background: linear-gradient(to bottom, #ff7875, #d63d38);
    box-shadow: 0 6px 0 #c62828, 0 8px 16px rgba(0, 0, 0, 0.18);
    color: white;
}

    .btn-stand:hover {
        background: linear-gradient(to bottom, #ff9793, #e34744);
        box-shadow: 0 9px 0 #c62828, 0 12px 22px rgba(0, 0, 0, 0.2);
    }

    .btn-stand:active {
        box-shadow: 0 3px 0 #c62828, 0 4px 8px rgba(0, 0, 0, 0.1);
    }

/* Кнопка "Новая игра" */
.btn-new-game {
    background: linear-gradient(to bottom, #7986cb, #495cc9);
    color: var(--white);
    box-shadow: 0 6px 0 #3949ab, 0 8px 16px rgba(0, 0, 0, 0.18);
}

    .btn-new-game:hover {
        background: linear-gradient(to bottom, #9aa5d6, #5969d2);
        box-shadow: 0 9px 0 #3949ab, 0 12px 22px rgba(0, 0, 0, 0.2);
    }

    .btn-new-game:active {
        box-shadow: 0 3px 0 #3949ab, 0 4px 8px rgba(0, 0, 0, 0.1);
    }

/* Иконки для кнопок */
.btn-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    position: relative;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* Иконка "Взять карту" */
.hit-icon::before {
    content: "+";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
}

/* Иконка "Стоп" */
.stand-icon::before {
    content: "✋";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #ffffff;
}

/* Иконка "Новая игра" */
.new-game-icon::before {
    content: "↻";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #ffffff;
    font-weight: bold;
}

/* Начальный экран */
.start-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Заменяем старый логотип игры на анимированный */
.game-logo {
    width: 300px;
    height: 200px;
    margin-bottom: 40px;
    position: relative;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
    transition: transform 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

    /* Удаляем старые псевдоэлементы с текстом */
    .game-logo::before,
    .game-logo::after {
        content: none;
    }

/* Создаем анимированную карточную колоду */
.game-logo {
    position: relative;
    perspective: 1000px;
}

    /* Анимированная колода карт */
    .game-logo::before {
        content: "";
        position: absolute;
        width: 120px;
        height: 160px;
        background: linear-gradient(145deg, var(--gold), var(--dark-gold));
        border-radius: 10px;
        box-shadow: 0 15px 25px rgba(0, 0, 0, 0.4);
        transform-style: preserve-3d;
        animation: cardShuffle 3s infinite ease-in-out;
    }

    /* Лицевая карта с символом */
    .game-logo::after {
        content: "♠";
        position: absolute;
        width: 120px;
        height: 160px;
        background: white;
        border-radius: 10px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
        font-size: 70px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--black);
        transform-style: preserve-3d;
        animation: cardFlip 3s infinite ease-in-out;
        border: 2px solid var(--dark-gold);
    }

/* Анимация перемешивания колоды */
@keyframes cardShuffle {
    0% {
        transform: translateX(-80px) rotateY(0) translateZ(0);
    }

    25% {
        transform: translateX(-30px) rotateY(10deg) translateZ(10px);
    }

    50% {
        transform: translateX(30px) rotateY(-10deg) translateZ(20px);
    }

    75% {
        transform: translateX(80px) rotateY(10deg) translateZ(10px);
    }

    100% {
        transform: translateX(-80px) rotateY(0) translateZ(0);
    }
}

/* Анимация переворота карты */
@keyframes cardFlip {
    0% {
        transform: translateZ(20px) rotateY(0);
        opacity: 1;
    }

    45% {
        transform: translateZ(80px) rotateY(180deg);
        opacity: 0.8;
    }

    55% {
        transform: translateZ(80px) rotateY(180deg);
        opacity: 0.8;
    }

    100% {
        transform: translateZ(20px) rotateY(360deg);
        opacity: 1;
    }
}

/* Дополняем анимацию подсветкой */
.game-logo::before {
    animation: cardShuffle 3s infinite ease-in-out, glow 2s infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px 2px var(--gold);
    }

    to {
        box-shadow: 0 0 20px 5px var(--light-gold);
    }
}

/* Адаптивные стили для анимированного логотипа */
@media (max-width: 768px) {
    .game-logo::before,
    .game-logo::after {
        width: 100px;
        height: 140px;
    }

    .game-logo::after {
        font-size: 60px;
    }
}

@media (max-width: 480px) {
    .game-logo::before,
    .game-logo::after {
        width: 80px;
        height: 112px;
    }

    .game-logo::after {
        font-size: 50px;
    }
}

/* Кнопка начала игры */
.btn-start {
    font-size: 1.4rem;
    padding: 16px 40px;
    min-width: 200px;
}

/* Адаптивные стили */
@media (max-width: 768px) {
    .blackjack-container {
        padding: 20px;
        border-width: 4px;
    }

    .game-title {
        font-size: 2rem;
    }

    .playing-card {
        width: 90px;
        height: 126px;
    }

    .card-rank {
        font-size: 1.2rem;
    }

    .card-suit {
        font-size: 1.1rem;
    }

    .card-center-suit {
        font-size: 2.4rem;
    }

    .hand {
        min-height: 130px;
    }

    .action-buttons {
        gap: 15px;
        margin-top: 20px;
    }

    .btn-3d {
        padding: 10px 18px;
        min-width: 130px;
        font-size: 0.9rem;
    }

    .player-title {
        font-size: 1.3rem;
    }

    .message-content {
        font-size: 1.1rem;
    }

    .chip-stack {
        width: 60px;
        height: 60px;
    }

        .chip-stack::after {
            width: 45px;
            height: 45px;
        }

        .chip-stack::before {
            width: 45px;
            height: 8px;
        }

    .game-logo::before {
        font-size: 80px;
    }

    .game-logo::after {
        font-size: 36px;
        bottom: 40px;
    }
}

@media (max-width: 480px) {
    .casino-background {
        padding: 10px;
    }

    .blackjack-container {
        padding: 15px;
        border-width: 3px;
    }

    .game-title {
        font-size: 1.6rem;
    }

    .playing-card {
        width: 70px;
        height: 98px;
    }

    .hand {
        min-height: 105px;
        gap: 5px;
        padding: 5px;
    }

    .card-rank {
        font-size: 1rem;
    }

    .card-suit {
        font-size: 0.9rem;
    }

    .card-center-suit {
        font-size: 1.8rem;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .btn-3d {
        width: 100%;
        max-width: 250px;
    }

    .game-area {
        padding: 15px;
    }

    .message-content {
        font-size: 1rem;
    }

    .player-info {
        gap: 10px;
        margin-bottom: 10px;
    }

    .player-avatar {
        width: 40px;
        height: 40px;
    }

    .player-title {
        font-size: 1.1rem;
    }

    .score-badge {
        font-size: 0.9rem;
        padding: 3px 8px;
    }

    .chip-stack {
        display: none;
    }

    .table-divider {
        margin: 15px 0;
    }

    .game-logo {
        width: 240px;
        height: 160px;
        margin-bottom: 30px;
    }

        .game-logo::before {
            font-size: 60px;
        }

        .game-logo::after {
            font-size: 28px;
            bottom: 35px;
        }

    .btn-start {
        font-size: 1.2rem;
        padding: 14px 30px;
    }
}
