/* === ПЕРЕМЕННЫЕ === */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2234;
    --bg-panel: rgba(17, 24, 39, 0.9);

    --color-primary: #4a9eff;
    --color-secondary: #4aff9e;
    --color-danger: #ff6b6b;
    --color-warning: #ffaa00;
    --color-text: #e5e7eb;
    --color-text-dim: #9ca3af;

    --glow-blue: 0 0 20px rgba(74, 158, 255, 0.5);
    --glow-green: 0 0 20px rgba(74, 255, 158, 0.5);
    --glow-red: 0 0 20px rgba(255, 107, 107, 0.5);
    --glow-yellow: 0 0 20px rgba(255, 170, 0, 0.5);

    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* === СБРОС И БАЗОВЫЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === АНИМИРОВАННЫЙ ФОН - ПОЛЁТ К КРАСНОЙ ПЛАНЕТЕ === */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #0a0e17 0%, #000008 100%);
    perspective: 1000px;
}

/* Красная планета (Марс) на горизонте */
.stars-bg::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, #ff6b4a 0%, #cc3d2a 30%, #8b2500 70%, #4a1000 100%);
    box-shadow:
        0 0 60px rgba(255, 100, 50, 0.4),
        0 0 120px rgba(255, 50, 0, 0.2),
        inset -15px -10px 30px rgba(0, 0, 0, 0.5),
        inset 5px 5px 20px rgba(255, 150, 100, 0.3);
    animation: planetPulse 8s ease-in-out infinite, planetApproach 120s linear infinite;
}

/* Кольцо вокруг планеты (атмосфера) */
.stars-bg::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: transparent;
    box-shadow:
        0 0 40px rgba(255, 100, 50, 0.15),
        0 0 80px rgba(255, 50, 0, 0.1);
    animation: planetApproach 120s linear infinite;
}

@keyframes planetPulse {
    0%, 100% { box-shadow: 0 0 60px rgba(255, 100, 50, 0.4), 0 0 120px rgba(255, 50, 0, 0.2), inset -15px -10px 30px rgba(0, 0, 0, 0.5), inset 5px 5px 20px rgba(255, 150, 100, 0.3); }
    50% { box-shadow: 0 0 80px rgba(255, 100, 50, 0.5), 0 0 150px rgba(255, 50, 0, 0.3), inset -15px -10px 30px rgba(0, 0, 0, 0.5), inset 5px 5px 20px rgba(255, 150, 100, 0.3); }
}

@keyframes planetApproach {
    0% { transform: translateX(-50%) scale(0.8); opacity: 0.7; }
    50% { transform: translateX(-50%) scale(1.2); opacity: 1; }
    100% { transform: translateX(-50%) scale(0.8); opacity: 0.7; }
}

/* Контейнер для звёзд с эффектом разбегания */
.stars, .stars2, .stars3 {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    transform-style: preserve-3d;
}

/* Слой быстрых звёзд (ближние) */
.stars {
    box-shadow:
        /* Звёзды разлетаются от центра */
        -50vw -30vh 0 1px rgba(255, 255, 255, 0.9),
        60vw -25vh 0 0.5px rgba(255, 255, 255, 0.7),
        -40vw 35vh 0 1px rgba(255, 255, 255, 0.8),
        45vw 40vh 0 0.5px rgba(255, 255, 255, 0.6),
        -70vw -10vh 0 1px white,
        75vw 15vh 0 0.5px rgba(255, 255, 255, 0.7),
        -30vw -50vh 0 1px rgba(255, 255, 255, 0.8),
        35vw 55vh 0 0.5px white,
        -80vw 25vh 0 1px rgba(255, 255, 255, 0.6),
        85vw -35vh 0 1px rgba(255, 255, 255, 0.9),
        -20vw 60vh 0 0.5px rgba(255, 255, 255, 0.7),
        25vw -65vh 0 1px white,
        -90vw -5vh 0 0.5px rgba(255, 255, 255, 0.8),
        95vw 8vh 0 1px rgba(255, 255, 255, 0.6),
        -55vw 45vh 0 1px rgba(255, 255, 255, 0.9),
        50vw -48vh 0 0.5px white;
    animation: starsExpand 20s linear infinite;
}

/* Слой средних звёзд */
.stars2 {
    box-shadow:
        -35vw -20vh 0 1px rgba(74, 158, 255, 0.8),
        40vw -18vh 0 1px rgba(74, 255, 158, 0.7),
        -25vw 22vh 0 1px rgba(255, 255, 255, 0.8),
        30vw 28vh 0 1px rgba(255, 200, 100, 0.7),
        -60vw -8vh 0 1px rgba(74, 158, 255, 0.6),
        55vw 12vh 0 1px white,
        -18vw -40vh 0 1px rgba(255, 255, 255, 0.9),
        22vw 45vh 0 1px rgba(74, 255, 158, 0.6),
        -75vw 18vh 0 1px rgba(255, 170, 100, 0.7),
        70vw -22vh 0 1px rgba(74, 158, 255, 0.8),
        -12vw 52vh 0 1px white,
        15vw -55vh 0 1px rgba(255, 255, 255, 0.7),
        -85vw -15vh 0 1px rgba(74, 255, 158, 0.5),
        80vw 5vh 0 1px rgba(255, 200, 100, 0.8);
    animation: starsExpand 30s linear infinite;
    animation-delay: -10s;
}

/* Слой дальних звёзд (медленные) */
.stars3 {
    box-shadow:
        -20vw -12vh 0 0.5px rgba(255, 255, 255, 0.5),
        25vw -10vh 0 0.5px rgba(255, 255, 255, 0.4),
        -15vw 14vh 0 0.5px rgba(255, 255, 255, 0.5),
        18vw 16vh 0 0.5px rgba(255, 255, 255, 0.4),
        -42vw -6vh 0 0.5px rgba(255, 255, 255, 0.5),
        38vw 8vh 0 0.5px rgba(255, 255, 255, 0.4),
        -10vw -28vh 0 0.5px rgba(255, 255, 255, 0.6),
        12vw 30vh 0 0.5px rgba(255, 255, 255, 0.5),
        -52vw 10vh 0 0.5px rgba(255, 255, 255, 0.4),
        48vw -14vh 0 0.5px rgba(255, 255, 255, 0.5),
        -8vw 38vh 0 0.5px rgba(255, 255, 255, 0.4),
        10vw -42vh 0 0.5px rgba(255, 255, 255, 0.5);
    animation: starsExpand 40s linear infinite;
    animation-delay: -20s;
}

/* Анимация разбегания звёзд от центра */
@keyframes starsExpand {
    0% {
        transform: scale(0) translateZ(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: scale(1.5) translateZ(200px);
        opacity: 0;
    }
}

/* Дополнительные мерцающие звёзды на фоне */
.stars-bg .twinkle {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 50% 40%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 90% 30%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 15% 85%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1px 1px at 85% 60%, rgba(255,255,255,0.3), transparent);
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Космическая туманность */
.nebula {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(100, 50, 150, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(50, 100, 150, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(150, 50, 50, 0.05) 0%, transparent 60%);
    animation: nebulaShift 30s ease-in-out infinite;
}

@keyframes nebulaShift {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* Световые следы звёзд (эффект варпа) */
.star-streaks {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    box-shadow:
        0 0 6px 2px rgba(255, 255, 255, 0.9),
        0 0 15px 4px rgba(74, 158, 255, 0.5);
}

.star-streaks.s1 {
    --angle: 20deg;
    --duration: 9s;
    --delay: 0s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.star-streaks.s2 {
    --angle: -30deg;
    --duration: 11s;
    --delay: -3s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.star-streaks.s3 {
    --angle: 160deg;
    --duration: 10s;
    --delay: -6s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.star-streaks.s4 {
    --angle: -150deg;
    --duration: 12s;
    --delay: -9s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.star-streaks.s5 {
    --angle: 75deg;
    --duration: 8s;
    --delay: -1.5s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.star-streaks.s6 {
    --angle: -85deg;
    --duration: 10.5s;
    --delay: -4.5s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.star-streaks.s7 {
    --angle: 110deg;
    --duration: 9.5s;
    --delay: -7.5s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

.star-streaks.s8 {
    --angle: -120deg;
    --duration: 11.5s;
    --delay: -10.5s;
    animation: streakFly var(--duration) linear infinite;
    animation-delay: var(--delay);
}

@keyframes streakFly {
    0% {
        transform: rotate(var(--angle)) translateY(0);
        opacity: 0;
        width: 2px;
        height: 2px;
    }
    5% {
        opacity: 1;
    }
    30% {
        width: 2px;
        height: 40px;
    }
    70% {
        width: 2px;
        height: 100px;
        opacity: 0.9;
    }
    100% {
        transform: rotate(var(--angle)) translateY(120vmax);
        opacity: 0;
        width: 1px;
        height: 200px;
    }
}

/* Дополнительные разлетающиеся частицы */
.stars-bg .stars::before,
.stars-bg .stars2::before,
.stars-bg .stars3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: centerGlow 4s ease-in-out infinite;
}

@keyframes centerGlow {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* === ЭКРАНЫ === */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* === ГЛАВНОЕ МЕНЮ === */
#main-menu {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.menu-container {
    background: var(--bg-panel);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: var(--border-radius);
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(10px);
}

.game-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--color-primary);
    text-shadow: var(--glow-blue);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.title-icon {
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    color: var(--color-text-dim);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.player-setup {
    margin-bottom: 30px;
}

.player-setup h3 {
    margin-bottom: 15px;
    color: var(--color-text);
}

.player-count-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.player-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--color-primary);
    background: transparent;
    color: var(--color-primary);
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.player-btn:hover, .player-btn.active {
    background: var(--color-primary);
    color: var(--bg-primary);
    box-shadow: var(--glow-blue);
}

.player-names {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-input {
    text-align: left;
}

.player-input label {
    display: block;
    margin-bottom: 5px;
    color: var(--color-text-dim);
    font-size: 0.9rem;
}

.player-input input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-card);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 1rem;
    transition: var(--transition);
}

.player-input input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--glow-blue);
}

/* === КНОПКИ === */
.btn-primary, .btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #2d7dd2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-blue);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--color-text-dim);
    color: var(--color-text-dim);
}

.btn-secondary:hover {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.btn-icon {
    font-size: 1.3rem;
}

/* === ПРОСМОТР КАРТОЧЕК === */
#cards-viewer {
    padding: 20px;
}

.viewer-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-back {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-back:hover {
    background: var(--color-primary);
    color: white;
}

.viewer-header h2 {
    flex: 1;
    color: var(--color-text);
}

.card-filters {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--color-text-dim);
    color: var(--color-text-dim);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding-bottom: 20px;
}

/* === ИГРОВОЙ ЭКРАН === */
#game-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-exit {
    width: 40px;
    height: 40px;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.btn-exit:hover {
    background: var(--color-danger);
    color: white;
}

.turn-info {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    padding: 10px 15px;
    border-radius: 8px;
}

.turn-label {
    color: var(--color-text-dim);
    font-size: 0.8rem;
    margin-right: 5px;
}

.turn-number {
    color: var(--color-primary);
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: var(--glow-blue);
}

.turn-divider {
    color: var(--color-text-dim);
}

.turn-max {
    color: var(--color-text-dim);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.phase-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 15px;
    background: var(--bg-card);
    border-radius: 8px;
    opacity: 0.5;
    transition: var(--transition);
}

.phase.active {
    opacity: 1;
    border: 1px solid var(--color-primary);
    box-shadow: var(--glow-blue);
}

.phase-icon {
    font-size: 1.2rem;
}

.phase-name {
    font-size: 0.75rem;
    color: var(--color-text-dim);
}

.phase.active .phase-name {
    color: var(--color-primary);
}

.phase-arrow {
    color: var(--color-text-dim);
}

.resource {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 10px 15px;
    border-radius: 8px;
}

.resource-icon {
    font-size: 1.2rem;
}

.resource-label {
    color: var(--color-text-dim);
    font-size: 0.8rem;
}

.resource-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.mission-points .resource-value {
    color: var(--color-warning);
    text-shadow: var(--glow-yellow);
}

.action-points .resource-value {
    color: var(--color-secondary);
    text-shadow: var(--glow-green);
}

/* === ОСНОВНАЯ ИГРОВАЯ ОБЛАСТЬ === */
.game-main {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 20px;
    padding: 20px;
    height: 50vh;
    min-height: 250px;
    flex-shrink: 0;
}

.dice-panel {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(74, 158, 255, 0.2);
}

.dice-panel h3 {
    margin-bottom: 15px;
    color: var(--color-text);
}

.dice-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

/* === 3D КУБИКИ === */
.dice-3d {
    width: 60px;
    height: 60px;
    perspective: 300px;
    cursor: pointer;
    position: relative;
}

.dice-cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

.dice-face {
    position: absolute;
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #f5f5f5, #e0e0e0);
    border: 2px solid #ccc;
    border-radius: 8px;
    display: grid;
    padding: 8px;
    box-sizing: border-box;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.dice-face .dot {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 30% 30%, #333, #111);
    border-radius: 50%;
    box-shadow:
        inset 0 2px 3px rgba(255,255,255,0.3),
        0 1px 2px rgba(0,0,0,0.3);
}

/* Грань 1 - центральная точка */
.face-1 {
    transform: rotateY(0deg) translateZ(30px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Грань 6 - противоположная 1 */
.face-6 {
    transform: rotateY(180deg) translateZ(30px);
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    align-items: center;
    justify-items: center;
}

/* Грань 2 - диагональ */
.face-2 {
    transform: rotateY(-90deg) translateZ(30px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: column;
    padding: 10px 25px;
}

/* Грань 5 - противоположная 2 */
.face-5 {
    transform: rotateY(90deg) translateZ(30px);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    align-items: center;
    justify-items: center;
}
.face-5 .dot:nth-child(1) { grid-area: 1 / 1; }
.face-5 .dot:nth-child(2) { grid-area: 1 / 3; }
.face-5 .dot:nth-child(3) { grid-area: 2 / 2; }
.face-5 .dot:nth-child(4) { grid-area: 3 / 1; }
.face-5 .dot:nth-child(5) { grid-area: 3 / 3; }

/* Грань 3 - диагональ */
.face-3 {
    transform: rotateX(90deg) translateZ(30px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: column;
    padding: 8px;
}
.face-3 .dot:nth-child(1) { align-self: flex-end; }
.face-3 .dot:nth-child(2) { align-self: center; }
.face-3 .dot:nth-child(3) { align-self: flex-start; }

/* Грань 4 - противоположная 3 */
.face-4 {
    transform: rotateX(-90deg) translateZ(30px);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    align-items: center;
    justify-items: center;
    padding: 10px;
}

/* Анимация вращения */
.dice-cube.rolling {
    animation: diceRoll3D 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes diceRoll3D {
    0% {
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
    20% {
        transform: rotateX(180deg) rotateY(90deg) rotateZ(45deg);
    }
    40% {
        transform: rotateX(360deg) rotateY(180deg) rotateZ(-30deg);
    }
    60% {
        transform: rotateX(540deg) rotateY(270deg) rotateZ(60deg);
    }
    80% {
        transform: rotateX(680deg) rotateY(340deg) rotateZ(-15deg);
    }
    100% {
        transform: rotateX(720deg) rotateY(360deg) rotateZ(0deg);
    }
}

/* Эффект подпрыгивания после броска */
.dice-3d.landed .dice-cube {
    animation: diceLand 0.3s ease-out;
}

@keyframes diceLand {
    0% { transform: translateY(-15px); }
    50% { transform: translateY(3px); }
    70% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* Финальные позиции для каждого числа */
/* face-1: front, face-6: back, face-2: left, face-5: right, face-3: top, face-4: bottom */
.dice-cube[data-value="1"] { transform: rotateX(0deg) rotateY(0deg); }
.dice-cube[data-value="2"] { transform: rotateX(0deg) rotateY(90deg); }
.dice-cube[data-value="3"] { transform: rotateX(-90deg) rotateY(0deg); }
.dice-cube[data-value="4"] { transform: rotateX(90deg) rotateY(0deg); }
.dice-cube[data-value="5"] { transform: rotateX(0deg) rotateY(-90deg); }
.dice-cube[data-value="6"] { transform: rotateX(0deg) rotateY(180deg); }

/* Подсветка при наведении */
.dice-3d:hover .dice-cube {
    filter: brightness(1.1);
}

/* Тень под кубиком */
.dice-3d::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.3), transparent);
    border-radius: 50%;
}

.dice-total {
    font-size: 1.1rem;
    color: var(--color-text-dim);
    margin-bottom: 15px;
}

.dice-total span {
    color: var(--color-warning);
    font-weight: bold;
    font-size: 1.3rem;
}

.btn-dice {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--color-primary), #2d7dd2);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.btn-dice:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--glow-blue);
}

.btn-dice:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === ВИЗУАЛ КОРАБЛЯ === */
.ship-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: visible;
    position: relative;
}

/* === УВЕДОМЛЕНИЯ О СРАБОТАВШИХ СОБЫТИЯХ === */
.event-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    padding: 20px 30px;
    background: rgba(17, 24, 39, 0.95);
    border-radius: 12px;
    border: 2px solid var(--color-primary);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8), var(--glow-blue);
    z-index: 100;
    text-align: center;
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(10px);
}

.event-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.event-notification.success {
    border-color: var(--color-secondary);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8), var(--glow-green);
}

.event-notification.defect,
.event-notification.crash {
    border-color: var(--color-danger);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8), var(--glow-red);
}

.event-notification.profit {
    border-color: var(--color-secondary);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8), var(--glow-green);
}

.event-notification.breakdown {
    border-color: var(--color-warning);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8), var(--glow-yellow);
}

.event-notification .event-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.event-notification .event-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 8px;
}

.event-notification .event-message {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    line-height: 1.4;
}

.event-notification.defect .event-title {
    color: var(--color-danger);
}

.event-notification.profit .event-title,
.event-notification.success .event-title {
    color: var(--color-secondary);
}

.event-notification.breakdown .event-title {
    color: var(--color-warning);
}

.event-notification.crash .event-title {
    color: var(--color-danger);
}

/* Индикатор изменения очков в уведомлении */
.event-points {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.event-points.points-up {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.2);
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.event-points.points-down {
    color: #f87171;
    background: rgba(248, 113, 113, 0.2);
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.5);
}

/* Анимация ОМ в шапке */
@keyframes flashUp {
    0% { transform: scale(1); color: inherit; }
    50% { transform: scale(1.3); color: #4ade80; text-shadow: 0 0 20px rgba(74, 222, 128, 0.8); }
    100% { transform: scale(1); color: inherit; }
}

@keyframes flashDown {
    0% { transform: scale(1); color: inherit; }
    50% { transform: scale(1.3); color: #f87171; text-shadow: 0 0 20px rgba(248, 113, 113, 0.8); }
    100% { transform: scale(1); color: inherit; }
}

.points-flash-up {
    animation: flashUp 0.6s ease-out;
}

.points-flash-down {
    animation: flashDown 0.6s ease-out;
}

.ship-visual {
    position: relative;
    width: 100%;
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;
}

.ship-svg {
    width: 100%;
    height: auto;
    max-height: 350px;
    filter: drop-shadow(0 0 20px rgba(74, 158, 255, 0.3));
    transition: var(--transition);
}

.ship-svg:hover {
    filter: drop-shadow(0 0 30px rgba(74, 158, 255, 0.5));
    transform: scale(1.02);
}

/* === ПАНЕЛЬ ИГРОКА В DICE-PANEL === */
.current-player-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.player-label {
    color: var(--color-text-dim);
    font-size: 0.9rem;
}

.player-name {
    color: var(--color-primary);
    font-weight: bold;
    font-size: 1.1rem;
}

.btn-end-turn {
    width: 100%;
    padding: 12px 15px;
    background: var(--color-secondary);
    border: none;
    border-radius: 8px;
    color: var(--bg-primary);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-end-turn:hover:not(:disabled) {
    box-shadow: var(--glow-green);
    transform: translateY(-2px);
}

.btn-end-turn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === ЛОГ СОБЫТИЙ === */
.event-log {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid rgba(74, 158, 255, 0.2);
    display: flex;
    flex-direction: column;
}

.event-log h3 {
    margin-bottom: 15px;
    color: var(--color-text);
}

.log-entries {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--color-text-dim);
    border-left: 3px solid var(--color-primary);
}

.log-entry.danger {
    border-left-color: var(--color-danger);
    color: var(--color-danger);
}

.log-entry.success {
    border-left-color: var(--color-secondary);
    color: var(--color-secondary);
}

.log-entry.warning {
    border-left-color: var(--color-warning);
    color: var(--color-warning);
}

/* === ПАНЕЛЬ КАРТОЧЕК (адаптивная) === */
.game-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    padding: 12px 15px;
    background: var(--bg-panel);
    border-top: 1px solid rgba(74, 158, 255, 0.2);
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

.cards-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 12px;
    overflow: visible;
    min-width: 0;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.cards-section:hover {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.cards-section h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--color-text-dim);
}

.defects-section {
    border-left: 3px solid var(--color-danger);
}

.upgrades-section {
    border-left: 3px solid var(--color-secondary);
}

.available-section {
    border-left: 3px solid var(--color-warning);
}

.jokers-section {
    border-left: 3px solid #ffd700;
}

.cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 5px;
}

/* === МИНИ-КАРТОЧКИ (адаптивные) === */
.mini-card {
    position: relative;
    flex: 1 1 140px;
    min-width: 140px;
    max-width: 200px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.mini-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--glow-blue);
}

.mini-card.defect {
    border-left: 3px solid var(--color-danger);
}

.mini-card.upgrade {
    border-left: 3px solid var(--color-secondary);
}

.mini-card.upgrade.broken {
    border-left-color: var(--color-danger);
    border-color: var(--color-danger);
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), var(--bg-secondary));
    animation: broken-pulse 2s ease-in-out infinite;
}

.mini-card.upgrade.broken .mini-card-name {
    color: var(--color-danger);
}

.mini-card.upgrade.broken .mini-card-trigger {
    color: var(--color-danger);
    font-weight: bold;
}

@keyframes broken-pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 0 15px rgba(255, 107, 107, 0.5); }
}

.mini-card.available {
    border-left: 3px solid var(--color-warning);
}

.mini-card.joker {
    border-left: 3px solid #ffd700;
    background: linear-gradient(135deg, var(--bg-secondary), #1a1a2a);
}

.mini-card.joker:hover {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.mini-card.joker .mini-card-cost {
    color: #ffd700;
}

/* Доступные для взятия джокеры */
.mini-card.available-joker {
    border: 2px dashed #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), var(--bg-secondary));
    animation: joker-pulse 1.5s ease-in-out infinite;
}

.mini-card.available-joker:hover {
    border-style: solid;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.mini-card.available-joker .mini-card-type {
    color: #ffd700;
}

.mini-card.available-joker .mini-card-type::after {
    content: ' (взять)';
    font-size: 0.7em;
}

@keyframes joker-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* === УРОВНИ КРИТИЧНОСТИ МИНИ-КАРТОЧЕК === */
/* Уровни критичности - повышенная специфичность для перекрытия стилей типов */
.mini-card.level-easy,
.mini-card.available.level-easy,
.mini-card.feature.level-easy,
.mini-card.upgrade.level-easy {
    border-left: 3px solid #4ade80 !important;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), var(--bg-secondary));
}

.mini-card.level-easy .mini-card-type {
    color: #4ade80;
}

.mini-card.level-medium,
.mini-card.available.level-medium,
.mini-card.feature.level-medium,
.mini-card.upgrade.level-medium {
    border-left: 3px solid #facc15 !important;
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.1), var(--bg-secondary));
}

.mini-card.level-medium .mini-card-type {
    color: #facc15;
}

.mini-card.level-hard,
.mini-card.available.level-hard,
.mini-card.feature.level-hard,
.mini-card.upgrade.level-hard {
    border-left: 3px solid #fb923c !important;
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.1), var(--bg-secondary));
}

.mini-card.level-hard .mini-card-type {
    color: #fb923c;
}

.mini-card.level-extreme,
.mini-card.available.level-extreme,
.mini-card.feature.level-extreme,
.mini-card.upgrade.level-extreme {
    border-left: 3px solid #f87171 !important;
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.15), var(--bg-secondary));
}

.mini-card.level-extreme .mini-card-type {
    color: #f87171;
}

.mini-card.level-special,
.mini-card.available.level-special,
.mini-card.feature.level-special,
.mini-card.upgrade.level-special {
    border-left: 3px solid #c084fc !important;
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.1), var(--bg-secondary));
}

.mini-card.level-special .mini-card-type {
    color: #c084fc;
}

.mini-card.level-joker,
.mini-card.joker.level-joker {
    border-left: 3px solid #ffd700 !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), var(--bg-secondary));
}

.mini-card.level-joker .mini-card-type {
    color: #ffd700;
}

.mini-card-id {
    font-size: 0.7rem;
    color: var(--color-text-dim);
    margin-bottom: 4px;
}

.mini-card-name {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 6px;
    line-height: 1.2;
}

.mini-card-triggers {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.mini-card-trigger {
    font-size: 0.7rem;
    color: var(--color-primary);
    padding: 2px 5px;
    background: rgba(74, 158, 255, 0.15);
    border-radius: 4px;
    display: inline-block;
}

.mini-card-trigger.positive {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
}

.mini-card-trigger.negative {
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
}

.mini-card-effect {
    font-size: 0.75rem;
    color: var(--color-text-dim);
    margin-bottom: 6px;
    line-height: 1.3;
}

.mini-card-cost {
    font-size: 0.8rem;
    color: var(--color-warning);
    font-weight: bold;
}

/* === ЗАГОЛОВКИ СЕКЦИЙ (кликабельные) === */
.cards-section h3 {
    cursor: pointer;
    transition: var(--transition);
    padding: 5px 8px;
    margin: -5px -8px 10px -8px;
    border-radius: 6px;
}

.cards-section h3:hover {
    background: rgba(74, 158, 255, 0.15);
    color: var(--color-primary);
}

.defects-section h3:hover {
    background: rgba(255, 107, 107, 0.15);
    color: var(--color-danger);
}

.upgrades-section h3:hover,
.available-section h3:hover {
    background: rgba(74, 255, 158, 0.15);
    color: var(--color-secondary);
}

.jokers-section h3:hover {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
}

/* === МОДАЛЬНОЕ ОКНО СЕКЦИИ === */
.section-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 5000;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.section-modal.active {
    display: flex;
}

.section-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 25px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(74, 158, 255, 0.3);
    margin: auto;
}

.section-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
}

.section-modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-text);
}

.section-modal-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--color-text-dim);
    color: var(--color-text-dim);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.section-modal-close:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: white;
}

.section-modal-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.section-modal-card {
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius);
    overflow: hidden;
    width: 280px;
    flex-shrink: 0;
}

.section-modal-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-blue);
}

.section-modal-card svg {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 640px) {
    .section-modal-card {
        width: 100%;
        max-width: 300px;
    }
}

/* Цвета модального окна по типам */
.section-modal.defects .section-modal-title {
    color: var(--color-danger);
}

.section-modal.defects .section-modal-content {
    border-color: rgba(255, 107, 107, 0.3);
}

.section-modal.upgrades .section-modal-title,
.section-modal.available .section-modal-title {
    color: var(--color-secondary);
}

.section-modal.upgrades .section-modal-content,
.section-modal.available .section-modal-content {
    border-color: rgba(74, 255, 158, 0.3);
}

.section-modal.jokers .section-modal-title {
    color: #ffd700;
}

.section-modal.jokers .section-modal-content {
    border-color: rgba(255, 215, 0, 0.3);
}

/* === МОДАЛЬНОЕ ОКНО ПРАВИЛ === */
.rules-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 6000;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
}

.rules-modal.active {
    display: flex;
}

.rules-modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 800px;
    width: 100%;
    position: relative;
    border: 1px solid rgba(74, 158, 255, 0.3);
    margin: auto;
}

.rules-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
}

.rules-modal-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--color-primary);
    text-shadow: var(--glow-blue);
}

.rules-modal-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--color-text-dim);
    color: var(--color-text-dim);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.rules-modal-close:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: white;
}

.rules-modal-body {
    color: var(--color-text);
    line-height: 1.6;
}

.rules-section {
    margin-bottom: 25px;
}

.rules-section h3 {
    color: var(--color-primary);
    font-size: 1.2rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
}

.rules-section p {
    margin-bottom: 10px;
    color: var(--color-text-dim);
}

.rules-section ul,
.rules-section ol {
    margin-left: 20px;
    color: var(--color-text-dim);
}

.rules-section li {
    margin-bottom: 8px;
}

.rules-section strong {
    color: var(--color-text);
}

.rules-card-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.rules-card-type {
    padding: 15px;
    border-radius: 10px;
    background: var(--bg-card);
}

.rules-card-type h4 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.rules-card-type p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.rules-card-type.defect {
    border-left: 3px solid var(--color-danger);
}

.rules-card-type.defect h4 {
    color: var(--color-danger);
}

.rules-card-type.upgrade {
    border-left: 3px solid var(--color-secondary);
}

.rules-card-type.upgrade h4 {
    color: var(--color-secondary);
}

.rules-card-type.joker {
    border-left: 3px solid #ffd700;
}

.rules-card-type.joker h4 {
    color: #ffd700;
}

/* === МОДАЛЬНОЕ ОКНО === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 400px;
    width: 100%;
    position: relative;
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid var(--color-text-dim);
    color: var(--color-text-dim);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: white;
}

.modal-card {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action {
    background: var(--color-secondary);
    color: var(--bg-primary);
}

.btn-action:hover:not(:disabled) {
    box-shadow: var(--glow-green);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-hint {
    padding: 10px 15px;
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 8px;
    color: var(--color-primary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 10px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--color-text-dim);
    color: var(--color-text-dim);
}

.btn-cancel:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* === ЭКРАН КОНЦА ИГРЫ === */
#game-over {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-over-container {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 50px;
    text-align: center;
    max-width: 500px;
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.game-over-container h1 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 30px;
    text-shadow: var(--glow-blue);
}

.final-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.score-label {
    color: var(--color-text-dim);
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--color-warning);
    text-shadow: var(--glow-yellow);
}

.score-unit {
    color: var(--color-text-dim);
}

.game-over-message {
    color: var(--color-text-dim);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* === SVG КАРТОЧКА В СЕТКЕ === */
.card-wrapper {
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.card-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-blue);
}

.card-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 1400px) {
    .game-main {
        grid-template-columns: 220px 1fr 280px;
    }
}

@media (max-width: 1200px) {
    .game-main {
        grid-template-columns: 200px 1fr 250px;
    }

    .mini-card {
        min-width: 120px;
        max-width: 160px;
        padding: 8px;
    }

    .mini-card-name {
        font-size: 0.85rem;
    }
}

@media (max-width: 992px) {
    .game-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
        min-height: auto;
    }

    .dice-panel, .event-log {
        order: 1;
    }

    .ship-area {
        order: 0;
    }

    .game-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .mini-card {
        min-width: 130px;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }

    .phase-indicator {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-center {
        order: 3;
        flex-basis: 100%;
        margin-top: 10px;
    }

    .game-header {
        flex-wrap: wrap;
    }

    .game-cards {
        grid-template-columns: 1fr;
        padding: 10px;
    }

    .cards-section {
        padding: 10px;
    }

    .mini-card {
        min-width: 100px;
        flex: 1 1 100px;
    }
}

@media (max-width: 480px) {
    .mini-card {
        min-width: 80px;
        flex: 1 1 80px;
        padding: 6px;
    }

    .mini-card-name {
        font-size: 0.75rem;
    }

    .mini-card-trigger,
    .mini-card-effect,
    .mini-card-cost {
        font-size: 0.65rem;
    }
}

/* === СКРОЛЛБАР === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5aafff;
}

/* === КНОПКИ ИНТЕРАКТИВНЫХ ДЖОКЕРОВ === */
.joker-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.btn-joker-action {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 2px 10px rgba(155, 89, 182, 0.3);
}

.btn-joker-action:hover {
    background: linear-gradient(135deg, #a569bd 0%, #9b59b6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.5);
}

.btn-joker-action:active {
    transform: translateY(0);
}

/* === МОДАЛЬНОЕ ОКНО J02 - МОДУЛЬ КВАНТОВОЙ УДАЧИ === */
.j02-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 7000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.j02-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.j02-modal-content {
    background: linear-gradient(145deg, var(--bg-secondary), #151b2a);
    border-radius: var(--border-radius);
    padding: 30px 40px;
    max-width: 450px;
    width: 100%;
    position: relative;
    border: 2px solid #a855f7;
    box-shadow:
        0 0 30px rgba(168, 85, 247, 0.4),
        0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.j02-modal-content h3 {
    color: #a855f7;
    font-size: 1.4rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.j02-modal-content p {
    color: var(--color-text-dim);
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.4;
}

.j02-dice-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 25px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.j02-dice {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #f5f5f5, #e0e0e0);
    border: 2px solid #ccc;
    border-radius: 10px;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    box-shadow:
        inset 0 0 10px rgba(0, 0, 0, 0.1),
        0 4px 10px rgba(0, 0, 0, 0.3);
}

.j02-plus {
    font-size: 1.5rem;
    color: var(--color-text-dim);
}

.j02-equals {
    font-size: 1.5rem;
    color: var(--color-text-dim);
}

.j02-total {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-warning);
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

.j02-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-j02 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.4);
}

.btn-j02:hover {
    background: linear-gradient(135deg, #a855f7, #8b5cf6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}

.btn-j02:active {
    transform: translateY(0);
}

.btn-j02-skip {
    background: transparent;
    border: 2px solid var(--color-text-dim);
    color: var(--color-text-dim);
    box-shadow: none;
}

.btn-j02-skip:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-text);
    color: var(--color-text);
    box-shadow: none;
}

/* Адаптивность для J02 модала */
@media (max-width: 480px) {
    .j02-modal-content {
        padding: 20px;
    }

    .j02-modal-content h3 {
        font-size: 1.2rem;
    }

    .j02-dice {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
    }

    .j02-dice-display {
        gap: 15px;
        padding: 15px;
    }

    .btn-j02 {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}
