* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1e1e1e;
    --bg-card: #272727;
    --bg-card-hover: #3f3f3f;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-red: #ff0000;
    --accent-blue: #3ea6ff;
    --accent-green: #2ba640;
    --accent-yellow: #fbc02d;
    --accent-cyan: #3ea6ff;
    --yt-white: #ffffff;
    --yt-black: #0f0f0f;
    --yt-gray: #272727;
    --yt-light-gray: #3f3f3f;
    --shadow: rgba(0, 0, 0, 0.5);
    --border-radius: 12px;
    --border-radius-pill: 24px;
}

body {
    font-family: 'Roboto', 'Arial', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

.game-container {
    width: 100%;
    height: 100vh;
    position: relative;
}

.screen {
    display: none !important;
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.screen.active {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Настройки */
#settings-screen {
    background: var(--bg-primary);
    padding: 20px;
}

.settings-panel {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
}

.game-title {
    font-size: 2.5em;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.game-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.1em;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

.input-group input,
.input-group select {
    background: #1e1e1e;
    border: 1px solid var(--yt-light-gray);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 1em;
    transition: border-color 0.2s;
}

.input-group select option {
    background: #1e1e1e;
    color: #fff;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.input-group small {
    color: var(--text-secondary);
    font-size: 0.8em;
}

.btn-primary {
    background: #fff;
    border: none;
    border-radius: 18px;
    padding: 10px 24px;
    color: #000;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 12px;
}

.btn-primary:hover {
    background-color: #f2f2f2;
}

.btn-primary:active {
    background-color: #e5e5e5;
}

/* Игровой экран */
#game-screen {
    background: var(--bg-primary);
    padding: 20px;
    overflow-y: auto;
    justify-content: flex-start;
}

/* Статистики */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 32px 12px 12px;
    background: #0f0f0f;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #0f0f0f;
    padding: 8px 16px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    min-width: 70px;
    transition: border-bottom-color 0.2s;
}

.stat-item:hover {
    background: #1e1e1e;
}

.stat-item[data-stat="environment"] { border-bottom-color: #2ba640; }
.stat-item[data-stat="population"] { border-bottom-color: #3ea6ff; }
.stat-item[data-stat="military"] { border-bottom-color: #ff4e45; }
.stat-item[data-stat="economy"] { border-bottom-color: #fbc02d; }

.stat-icon {
    font-size: 1em;
}

.stat-progress {
    display: none; /* Убираем бары, оставляем только цветовое выделение снизу и значение */
}

.stat-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: var(--accent-blue);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left;
}

.stat-item[data-stat="environment"] .stat-fill {
    background: #2ba640;
}

.stat-item[data-stat="population"] .stat-fill {
    background: #3ea6ff;
}

.stat-item[data-stat="military"] .stat-fill {
    background: #ff4e45;
}

.stat-item[data-stat="economy"] .stat-fill {
    background: #fbc02d;
}

.stat-label {
    display: none;
}

.stat-value {
    font-size: 1.1em;
    font-weight: 700;
    color: #fff;
}

.stat-impact {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6em; /* Сделаем еще больше */
    font-weight: 900;
    pointer-events: none;
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
    text-shadow: 0 0 15px rgba(0,0,0,1), 0 0 5px rgba(0,0,0,1);
}

.stat-impact.show {
    opacity: 1;
    top: -20px; /* Вылетает выше над статой */
}

.stat-impact.positive {
    color: var(--accent-green);
}

.stat-impact.negative {
    color: var(--accent-red);
}

/* Год */
.year-display {
    position: absolute;
    top: 24px;
    right: 24px;
    padding: 4px 10px;
    font-size: 0.9em;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    z-index: 10;
}

#year-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Карточка */
.card-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px;
    min-height: auto;
    position: relative;
}

.card {
    width: 100%;
    max-width: 640px;
    min-height: 600px;
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 24px; /* Более скругленные края */
    position: relative;
    overflow: hidden;
    cursor: grab;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

.card:active {
    cursor: grabbing;
}

.card.rotating {
    transition: transform 0.1s ease-out;
}

.card-content {
    position: relative;
    z-index: 2;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #0f0f0f;
}

.card-background {
    display: none;
}

.character-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
}

.character-icon {
    font-size: 6em;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #272727;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.character-name {
    font-size: 1.5em;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-text {
    padding: 40px 32px;
    font-size: 1.4em;
    line-height: 1.6;
    color: #fff;
    font-weight: 400;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.choices-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.choice-left,
.choice-right {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.2em;
    font-weight: 800;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    max-width: 250px;
    text-align: center;
    z-index: 20;
    top: 50%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.choice-left {
    left: 40px;
    transform: translateY(-50%) rotate(-5deg);
}

.choice-right {
    right: 40px;
    transform: translateY(-50%) rotate(5deg);
}

.choice-left.show,
.choice-right.show {
    opacity: 1;
}

/* Кнопки выбора */
.choice-buttons {
    display: flex;
    gap: 16px;
    padding: 32px;
    background: #1e1e1e;
    border-top: 1px solid #333;
    pointer-events: all;
}


.choice-btn:hover {
    background: rgba(62, 166, 255, 0.1);
    border-color: transparent;
}

.choice-btn:active {
    background: rgba(62, 166, 255, 0.2);
}

.choice-btn-left {
    border: 1px solid var(--yt-light-gray);
}

.choice-btn-right {
    border: 1px solid var(--yt-light-gray);
}

.choice-btn {
    flex: 1;
    justify-content: center;
    padding: 16px 24px;
    background: #272727;
    color: #fff;
    border: none;
    font-size: 1.1em;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
}

.choice-btn:hover {
    background: #3f3f3f;
    transform: translateY(-2px);
}

.choice-btn-left {
    background: #272727;
    border: 1px solid #3f3f3f;
}

.choice-btn-right {
    background: #fff;
    color: #000;
}

.choice-btn-right:hover {
    background: #d9d9d9;
}

@media (max-width: 768px) {
    .choice-buttons {
        padding: 0 15px;
        gap: 10px;
    }
    
    .choice-btn {
        padding: 12px 15px;
        font-size: 0.9em;
    }
}

/* Перки */
.perks-bar {
    margin-top: 24px;
    padding: 0;
    background: transparent;
}

.perks-title {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 12px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.perks-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.perk-item {
    background: var(--yt-gray);
    border: 1px solid var(--yt-light-gray);
    border-radius: 8px;
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 0.85em;
    font-weight: 500;
}

.perk-item .perk-uses {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Кнопка рестарта */
.btn-restart {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--yt-light-gray);
    border: none;
    border-radius: var(--border-radius-pill);
    padding: 10px 20px;
    color: var(--text-primary);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 100;
}

.btn-restart:hover {
    background: #4f4f4f;
}

/* Индикатор загрузки */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 24px 40px;
    border-radius: var(--border-radius);
    text-align: center;
    z-index: 1000;
    border: 1px solid var(--yt-light-gray);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--yt-light-gray);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator p {
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* Экран окончания игры */
#game-over-screen {
    background: #000;
    z-index: 1000;
}

.game-over-panel {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 48px 32px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 100px rgba(255, 0, 0, 0.2);
}

.game-over-panel h2 {
    font-size: 3em;
    margin-bottom: 24px;
    color: #ff4e45; /* Красный заголовок как у YouTube Live или предупреждений */
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.game-over-panel p {
    font-size: 1.4em;
    color: #fff;
    margin-bottom: 40px;
    line-height: 1.5;
    font-weight: 500;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

.card.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8em;
    }
    
    .settings-panel {
        padding: 24px 16px;
    }
    
    .stats-bar {
        gap: 8px;
        padding: 8px;
    }
    
    .stat-item {
        min-width: 50px;
    }
    
    .stat-progress {
        width: 32px;
        height: 3px;
    }
    
    .card {
        max-width: 100%;
        min-height: 320px;
    }
    
    .card-text {
        font-size: 1.05em;
    }
    
    .character-icon {
        font-size: 1.8em;
        width: 40px;
        height: 40px;
    }

    .choice-btn {
        font-size: 0.8em;
        padding: 8px 12px;
    }
}

