/* ============================================
   КНЯЗЬ НОВГОРОДА - Стили игры
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Основные цвета */
    --bg-dark: #1a1512;
    --bg-card: #2d2520;
    --bg-light: #3d322a;
    --gold: #c9a227;
    --gold-dark: #8b7019;
    --gold-bright: #e6c84a;
    --text-light: #e8dcc8;
    --text-muted: #9a8b7a;
    --danger: #8b3a3a;
    --success: #3a6b3a;
    --people-color: #5a9a5a;
    --treasury-color: #c9a227;
    --faith-color: #7a7acd;
    --army-color: #cd5a5a;

    /* Премиум текстуры */
    --hud-bg: linear-gradient(180deg, #3a2a1a 0%, #2a1f15 50%, #1a150f 100%);
    --hud-border: #a67c52;
    --hud-inner-shadow: inset 0 2px 4px rgba(255, 215, 130, 0.15), inset 0 -2px 6px rgba(0, 0, 0, 0.4);
    --card-bg: linear-gradient(180deg, #3d2d1f 0%, #2d2318 100%);
    --button-wood: linear-gradient(180deg, #4a3a2a 0%, #3a2a1a 50%, #2a1f15 100%);

    /* Safe areas для iOS */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* STEP 4: Viewport height для мобильных (обновляется через JS) */
    --vh: 1vh;
}

html, body {
    min-height: 100%;
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--bg-dark);
    color: var(--text-light);
    user-select: none;
    -webkit-user-select: none;
    /* Разрешаем вертикальный скролл на мобильных */
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   ЭКРАНЫ
   ============================================ */

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Не центрировать — контент сверху */
    transition: opacity 0.3s ease;
    overflow-y: auto; /* Разрешить скролл внутри экрана */
    -webkit-overflow-scrolling: touch;
}

.screen.hidden {
    display: none;
}

/* ============================================
   ЗАГРУЗКА
   ============================================ */

#loading-screen {
    background: linear-gradient(180deg, var(--bg-dark) 0%, #0d0a08 100%);
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-light);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   МЕНЮ
   ============================================ */

#menu-screen {
    background: linear-gradient(180deg, var(--bg-dark) 0%, #0d0a08 100%);
}

.menu-content {
    text-align: center;
    padding: 2rem;
}

.menu-content h1 {
    font-size: 2.8rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.subtitle {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.btn-primary, .btn-secondary {
    display: block;
    width: 250px;
    padding: 1rem 2rem;
    margin: 1rem auto;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg-dark);
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.btn-primary:hover, .btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-light);
    border: 2px solid var(--gold-dark);
}

.btn-secondary:hover, .btn-secondary:active {
    background: var(--bg-card);
    border-color: var(--gold);
}

/* ============================================
   ТУТОРИАЛ
   ============================================ */

.tutorial-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.tutorial-content h2 {
    color: var(--gold);
    margin-bottom: 2rem;
}

.tutorial-item {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.swipe-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ============================================
   ИГРОВОЙ ЭКРАН
   ============================================ */

#game-screen {
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ============================================
   ТРЁХСЛОЙНАЯ АРХИТЕКТУРА UI
   HUD Layer (z-index: 10) → Scene Layer (z-index: 5) → Card Layer (z-index: 10)
   ============================================ */

/* HUD LAYER - всегда сверху */
.hud-layer {
    position: relative;
    z-index: 10;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    padding-top: max(0.75rem, calc(var(--safe-area-top) + 0.5rem));
    flex-shrink: 0;
}

/* SCENE LAYER - между HUD и Card */
.scene-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

/* Фон сцены - fullscreen на desktop, между HUD и card на mobile */
.scene-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.scene-background video,
.scene-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* Оверлей сцены - затемнение для читаемости */
.scene-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.35) 100%),
        linear-gradient(180deg,
            rgba(0,0,0,0.45) 0%,
            rgba(0,0,0,0.25) 25%,
            rgba(0,0,0,0.2) 50%,
            rgba(0,0,0,0.35) 75%,
            rgba(0,0,0,0.55) 100%);
}

/* Контейнер персонажей */
.scene-characters {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 25%; /* Место для карточки */
}

/* Персонаж на сцене */
.scene-character {
    position: absolute;
    bottom: 20%;
    width: 35%;
    max-width: 280px;
    height: auto;
    max-height: 55%;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
}

.scene-character.visible {
    opacity: 1;
}

.scene-character.entering {
    animation: character-fade-in 0.6s ease forwards;
}

.scene-character.leaving {
    animation: character-fade-out 0.5s ease forwards;
}

@keyframes character-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes character-fade-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(5px);
    }
}

/* Позиционирование персонажей */
.scene-character-left {
    left: 5%;
}

.scene-character-right {
    right: 5%;
}

/* Центральный персонаж (по умолчанию) */
.scene-character.center {
    left: 50%;
    transform: translateX(-50%);
}

.scene-character.center.visible {
    transform: translateX(-50%);
}

.scene-character-img {
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    object-position: bottom center;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.6));
}

/* Табличка с именем персонажа (теперь в card-layer, над карточкой) */
.scene-character-name {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.scene-character-name.visible {
    opacity: 1;
}

.scene-character-name-text {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: linear-gradient(180deg, rgba(50, 40, 30, 0.95) 0%, rgba(35, 28, 20, 0.95) 100%);
    border: 2px solid var(--hud-border);
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0,0,0,0.7);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.6),
        inset 0 1px 2px rgba(255, 215, 130, 0.1);
}

/* CARD LAYER - всегда внизу экрана */
.card-layer {
    position: relative;
    z-index: 10;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.75rem;
    padding-bottom: max(0.75rem, var(--safe-area-bottom));
    flex-shrink: 0;
    margin-top: auto;
}

/* ============================================
   СТАРАЯ ОБЛАСТЬ ПЕРСОНАЖА (deprecated - оставлен для совместимости)
   ============================================ */

.character-area {
    display: none; /* Скрыто - используем scene-layer */
}

/* Портрет персонажа — премиум рамка */
.character-portrait {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-portrait .character-avatar {
    width: 200px;
    height: 260px;
    border-radius: 12px;
    border: 4px solid var(--hud-border);
    background: linear-gradient(180deg, #2a2520 0%, #1a1815 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow:
        0 10px 40px rgba(0,0,0,0.7),
        0 4px 16px rgba(0,0,0,0.5),
        inset 0 2px 4px rgba(255, 215, 130, 0.1),
        inset 0 -4px 8px rgba(0,0,0,0.4);
    position: relative;
}

/* Декоративные уголки на портрете */
.character-portrait .character-avatar::before,
.character-portrait .character-avatar::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: var(--gold);
    border-style: solid;
    opacity: 0.5;
    z-index: 2;
}

.character-portrait .character-avatar::before {
    bottom: 6px;
    left: 6px;
    border-width: 0 0 2px 2px;
    border-radius: 0 0 0 4px;
}

.character-portrait .character-avatar::after {
    bottom: 6px;
    right: 6px;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 4px 0;
}

.character-portrait .character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-portrait .character-avatar-placeholder {
    font-size: 5rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

/* Плашка с именем персонажа — премиум капсула */
.character-name-plate {
    margin-top: 0.75rem;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(180deg, rgba(50, 40, 30, 0.98) 0%, rgba(35, 28, 20, 0.98) 100%);
    border: 2px solid var(--hud-border);
    border-radius: 25px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.6),
        inset 0 1px 2px rgba(255, 215, 130, 0.1);
}

.character-name-plate .character-name {
    font-size: 1.15rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow:
        0 2px 4px rgba(0,0,0,0.7),
        0 0 20px rgba(201, 162, 39, 0.3);
    letter-spacing: 0.5px;
}

/* Скрыть персонажа но сохранить пространство (карточка остаётся внизу) */
.character-area.hidden .character-portrait,
.character-area.hidden .character-name-plate {
    visibility: hidden;
}

/* ============================================
   КАРТОЧКА (внизу экрана)
   ============================================ */

/* Кнопка паузы */
.pause-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--gold-dark);
    color: var(--gold);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pause-button:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: var(--gold);
    transform: scale(1.1);
}

.pause-button:active {
    transform: scale(0.95);
}

/* Меню паузы */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.pause-overlay.hidden {
    display: none;
}

.pause-content {
    background: var(--bg-card);
    border: 2px solid var(--gold-dark);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    min-width: 280px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.pause-content h2 {
    color: var(--gold);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.pause-content button {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
}

.pause-content button:last-child {
    margin-bottom: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Уведомление о сохранении */
.save-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 1rem 2rem;
    color: var(--gold);
    font-size: 1.2rem;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.save-notification.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Фоны по сезонам (с поддержкой изображений) */
#game-screen.season-spring {
    background: linear-gradient(180deg, #1a2518 0%, #151a13 50%, #0d0f0a 100%);
}
#game-screen.season-spring.has-bg-image {
    background: linear-gradient(180deg, rgba(26,37,24,0.7) 0%, rgba(21,26,19,0.8) 50%, rgba(13,15,10,0.9) 100%),
                url('../images/backgrounds/bg_spring.png') center/cover no-repeat;
}

#game-screen.season-summer {
    background: linear-gradient(180deg, #1f1a12 0%, #1a1510 50%, #100d08 100%);
}
#game-screen.season-summer.has-bg-image {
    background: linear-gradient(180deg, rgba(31,26,18,0.7) 0%, rgba(26,21,16,0.8) 50%, rgba(16,13,8,0.9) 100%),
                url('../images/backgrounds/bg_summer.png') center/cover no-repeat;
}

#game-screen.season-autumn {
    background: linear-gradient(180deg, #1f1512 0%, #1a120f 50%, #0f0a08 100%);
}
#game-screen.season-autumn.has-bg-image {
    background: linear-gradient(180deg, rgba(31,21,18,0.7) 0%, rgba(26,18,15,0.8) 50%, rgba(15,10,8,0.9) 100%),
                url('../images/backgrounds/bg_autumn.png') center/cover no-repeat;
}

#game-screen.season-winter {
    background: linear-gradient(180deg, #151820 0%, #12151a 50%, #0a0c10 100%);
}
#game-screen.season-winter.has-bg-image {
    background: linear-gradient(180deg, rgba(21,24,32,0.7) 0%, rgba(18,21,26,0.8) 50%, rgba(10,12,16,0.9) 100%),
                url('../images/backgrounds/bg_winter.png') center/cover no-repeat;
}

/* Пролог - княжий терем (детство) */
#game-screen.location-prolog {
    background: linear-gradient(180deg, #1a1612 0%, #15120f 50%, #0d0a08 100%);
}
#game-screen.location-prolog.has-bg-image {
    background: linear-gradient(180deg, rgba(26,22,18,0.7) 0%, rgba(21,18,15,0.8) 50%, rgba(13,10,8,0.9) 100%),
                url('../images/backgrounds/bg_prolog.png') center/cover no-repeat;
}

/* Состояние набега/войны - поверх сезонного фона */
#game-screen.state-raid {
    background: linear-gradient(180deg, rgba(40,15,10,0.85) 0%, rgba(30,10,8,0.9) 50%, rgba(15,5,3,0.95) 100%) !important;
}
#game-screen.state-raid.has-bg-video,
#game-screen.state-raid.has-bg-image {
    background: linear-gradient(180deg, rgba(40,15,10,0.6) 0%, rgba(30,10,8,0.7) 50%, rgba(15,5,3,0.85) 100%) !important;
}

/* ============================================
   ВИДЕО-ФОН СЦЕНЫ (новая архитектура через scene-layer)
   ============================================ */

/* Фон внутри scene-background */
.scene-bg-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

.scene-bg-element.active {
    opacity: 1;
}

.scene-bg-element.transitioning {
    opacity: 0;
}

/* Старый video-background оставлен для обратной совместимости */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease;
    pointer-events: none;
}

img.video-background {
    object-position: center center;
}

.video-background.active {
    opacity: 1;
}

.video-background.transitioning {
    opacity: 0;
}

/* Старый video-overlay для обратной совместимости */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.4) 100%),
        linear-gradient(180deg,
            rgba(0,0,0,0.5) 0%,
            rgba(0,0,0,0.35) 30%,
            rgba(0,0,0,0.4) 60%,
            rgba(0,0,0,0.65) 100%);
}

/* Когда есть видео - убрать CSS фон у экрана */
#game-screen.has-bg-video {
    background: transparent !important;
}

/* Когда есть сцена - показать её */
#game-screen.has-scene .scene-layer {
    display: block;
}

/* Шкалы статов — средневековый стиль */
.stats-bar {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 420px;
    padding: 0.8rem 0.5rem;
    background: linear-gradient(180deg, rgba(40, 30, 20, 0.95) 0%, rgba(26, 20, 15, 0.95) 100%);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border: 2px solid var(--gold-dark);
    box-shadow:
        inset 0 1px 0 rgba(201, 162, 39, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.5);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 23%;
    position: relative;
}

.stat-icon {
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6));
}

/* Иконка как изображение (если есть) */
.stat-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.stat-bar {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid rgba(201, 162, 39, 0.3);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.stat-fill {
    height: 100%;
    width: 50%;
    transition: width 0.5s ease, background-color 0.3s ease;
    border-radius: 1px;
}

/* Градиенты для шкал — средневековая палитра */
.stat[data-stat="people"] .stat-fill {
    background: linear-gradient(180deg, #5d8a4a 0%, #3d6b2a 50%, #2d5a1a 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(93, 138, 74, 0.6);
}
.stat[data-stat="treasury"] .stat-fill {
    background: linear-gradient(180deg, #d4af37 0%, #c9a227 50%, #a8860d 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.3),
        0 0 8px rgba(201, 162, 39, 0.6);
}
.stat[data-stat="faith"] .stat-fill {
    background: linear-gradient(180deg, #4a7ab8 0%, #2d5a8a 50%, #1e4a7a 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(45, 90, 138, 0.6);
}
.stat[data-stat="army"] .stat-fill {
    background: linear-gradient(180deg, #b83c3c 0%, #8b0000 50%, #6a0000 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(139, 0, 0, 0.6);
}

.stat-value {
    font-size: 0.85rem;
    margin-top: 0.2rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Анимация пульсации шкал при старте игры */
@keyframes stat-pulse {
    0%, 100% {
        transform: scaleY(1);
        filter: brightness(1);
        box-shadow: inherit;
    }
    50% {
        transform: scaleY(1.3);
        filter: brightness(1.5);
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.4),
            0 0 16px rgba(201, 162, 39, 0.8),
            0 0 24px rgba(201, 162, 39, 0.4);
    }
}

@keyframes stat-bar-flash {
    0%, 100% {
        border-color: rgba(201, 162, 39, 0.3);
    }
    50% {
        border-color: rgba(255, 215, 0, 0.8);
        box-shadow:
            inset 0 2px 4px rgba(0,0,0,0.5),
            0 0 12px rgba(255, 215, 0, 0.5);
    }
}

.stats-bar.highlight .stat-bar {
    animation: stat-bar-flash 0.6s ease-in-out 4;
}

.stats-bar.highlight .stat-fill {
    animation: stat-pulse 0.6s ease-in-out 4;
}

.stats-bar.highlight .stat:nth-child(1) .stat-fill,
.stats-bar.highlight .stat:nth-child(1) .stat-bar { animation-delay: 0s; }
.stats-bar.highlight .stat:nth-child(2) .stat-fill,
.stats-bar.highlight .stat:nth-child(2) .stat-bar { animation-delay: 0.15s; }
.stats-bar.highlight .stat:nth-child(3) .stat-fill,
.stats-bar.highlight .stat:nth-child(3) .stat-bar { animation-delay: 0.3s; }
.stats-bar.highlight .stat:nth-child(4) .stat-fill,
.stats-bar.highlight .stat:nth-child(4) .stat-bar { animation-delay: 0.45s; }

/* Превью изменений — точки над иконкой */
.stat-preview {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.stat-preview.visible {
    opacity: 1;
}

/* Цвета ПОСЛЕ выбора (показывают направление) */
.stat-preview.positive {
    color: #4ade80;
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.8);
}

.stat-preview.negative {
    color: #f87171;
    text-shadow: 0 0 6px rgba(248, 113, 113, 0.8);
}

/* Нейтральный белый цвет ДО выбора */
.stat-preview.neutral {
    color: #ffffff;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}

.stat {
    position: relative;
}

/* Подсветка шкалы ТОЛЬКО ПОСЛЕ выбора */
.stat.preview-positive .stat-fill {
    box-shadow: 0 0 8px 2px rgba(74, 222, 128, 0.6);
}

.stat.preview-negative .stat-fill {
    box-shadow: 0 0 8px 2px rgba(248, 113, 113, 0.6);
}

/* Предварительная полоска — только ПОСЛЕ выбора */
.stat-bar {
    position: relative;
}

.stat-preview-bar {
    position: absolute;
    top: 0;
    height: 100%;
    opacity: 0;
    border-radius: 1px;
    transition: width 0.2s ease, left 0.2s ease, opacity 0.2s ease;
}

/* Полоска видна только ПОСЛЕ выбора */
.stat-preview-bar.positive {
    background: linear-gradient(180deg, #7db86a 0%, #5d9a4a 100%);
    opacity: 0.6;
}

.stat-preview-bar.negative {
    background: linear-gradient(180deg, #d85050 0%, #a83030 100%);
    opacity: 0.6;
}

/* Интенсивность эффекта — размер точек */
.stat-preview.intensity-weak {
    font-size: 0.75rem;
    opacity: 0.8;
}

.stat-preview.intensity-medium {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-preview.intensity-strong {
    font-size: 1.1rem;
    opacity: 1;
    animation: pulse-dots 0.6s ease-in-out infinite;
}

@keyframes pulse-dots {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.15); }
}

/* Показ числа после выбора */
.stat-preview.result-shown {
    font-size: 1rem;
    animation: result-pop 0.3s ease-out;
}

@keyframes result-pop {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.2); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Контейнер сезон + год */
.season-year-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

/* Счётчик ходов */
.turn-counter {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* Контейнер карточки (внизу экрана) */
.card-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    perspective: 1000px;
    flex-shrink: 0;
    /* padding-bottom теперь в card-layer */
}

/* Карточка — премиум пергамент с золотой рамкой */
.card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.2rem;
    box-shadow:
        0 -4px 20px rgba(0,0,0,0.3),
        0 10px 40px rgba(0,0,0,0.5),
        inset 0 2px 4px rgba(255, 215, 130, 0.08),
        inset 0 -4px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--hud-border);
    transition: transform 0.3s ease;
    cursor: grab;
    /* Safari swipe fix */
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    position: relative;
}

/* Декоративные уголки на карточке */
.card::before,
.card::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--gold);
    border-style: solid;
    opacity: 0.6;
}

.card::before {
    top: 8px;
    left: 8px;
    border-width: 2px 0 0 2px;
    border-radius: 4px 0 0 0;
}

.card::after {
    top: 8px;
    right: 8px;
    border-width: 2px 2px 0 0;
    border-radius: 0 4px 0 0;
}

.card.dragging {
    cursor: grabbing;
}

.card.swiping-left {
    transform: translateX(-100px) rotate(-10deg);
    opacity: 0.7;
}

.card.swiping-right {
    transform: translateX(100px) rotate(10deg);
    opacity: 0.7;
}

.card-title {
    display: none; /* Убираем заголовки карточек везде */
}

.card-text {
    font-size: 1.05rem;
    line-height: 1.65;
    text-align: center;
    margin-bottom: 1rem;
    min-height: 60px;
    color: var(--text-light);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Прямая речь в кавычках — яркое выделение */
.card-text .speech {
    color: #ffd54f;
    font-weight: 600;
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.card-choices {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
    position: relative;
}

/* Нижние декоративные уголки карточки */
.card-choices::before,
.card-choices::after {
    content: '';
    position: absolute;
    bottom: -12px;
    width: 20px;
    height: 20px;
    border-color: var(--gold);
    border-style: solid;
    opacity: 0.6;
    pointer-events: none;
}

.card-choices::before {
    left: -4px;
    border-width: 0 0 2px 2px;
    border-radius: 0 0 0 4px;
}

.card-choices::after {
    right: -4px;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 4px 0;
}

/* Кнопки выбора — премиум деревянные таблички */
.choice {
    flex: 1;
    padding: 0.9rem 0.8rem;
    background: var(--button-wood);
    border-radius: 10px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(201, 162, 39, 0.3);
    touch-action: manipulation;
    min-height: 52px;
    border: 2px solid rgba(166, 124, 82, 0.7);
    box-shadow:
        inset 0 2px 4px rgba(255, 215, 130, 0.1),
        inset 0 -3px 6px rgba(0, 0, 0, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Блик на кнопке */
.choice::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 10%;
    right: 10%;
    height: 30%;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    border-radius: 8px 8px 50% 50%;
    pointer-events: none;
}

/* Hover состояние */
.choice:hover {
    background: linear-gradient(180deg, #5a4a3a 0%, #4a3a2a 50%, #3a2f25 100%);
    border-color: var(--gold);
    box-shadow:
        inset 0 2px 4px rgba(255, 215, 130, 0.15),
        inset 0 -3px 6px rgba(0, 0, 0, 0.25),
        0 6px 16px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(201, 162, 39, 0.15);
    transform: translateY(-2px);
}

/* Активное состояние при тапе */
.choice:active {
    transform: scale(0.97) translateY(1px);
    background: linear-gradient(180deg, #6a5a4a 0%, #5a4a3a 50%, #4a3f35 100%);
    border-color: var(--gold-bright);
    box-shadow:
        inset 0 3px 6px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

.choice-left:hover, .choice-left.active {
    border-color: var(--gold);
}

.choice-right:hover, .choice-right.active {
    border-color: var(--gold);
}

.choice-arrow {
    font-weight: bold;
    font-size: 1.3rem;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.choice-text {
    flex: 1;
    line-height: 1.3;
}


/* ============================================
   ЭКРАН СМЕРТИ
   ============================================ */

#death-screen {
    background: linear-gradient(180deg, #1a0a0a 0%, #0d0505 100%);
}

.death-content {
    text-align: center;
    padding: 2rem;
}

.death-content h1 {
    font-size: 2.2rem;
    color: var(--danger);
    margin-bottom: 1rem;
}

#death-reason {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-style: italic;
}

.death-stats {
    margin-bottom: 2rem;
    color: var(--text-muted);
}

/* ============================================
   ЭКРАН ПОБЕДЫ
   ============================================ */

#victory-screen {
    background: linear-gradient(180deg, #1a1a0a 0%, #0d0d05 100%);
}

.victory-content {
    text-align: center;
    padding: 2rem;
}

.victory-content h1 {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(201, 162, 39, 0.5);
}

.victory-content p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.victory-stats {
    margin: 1.5rem 0;
    font-size: 1.2rem;
    color: var(--gold);
}

/* STEP 3: Исторический эпилог победы */
.victory-epilogue {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--gold);
    border-radius: 4px;
}

.epilogue-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-style: italic;
    text-align: left;
}

.epilogue-text:last-child {
    margin-bottom: 0;
}

.victory-hint {
    font-style: italic;
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 1.5rem;
    opacity: 0.8;
}

/* ============================================
   АНИМАЦИИ
   ============================================ */

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.stat.warning .stat-fill {
    animation: pulse 0.8s ease infinite;
}

.stat.warning .stat-bar {
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.stat.danger .stat-fill {
    animation: shake 0.3s ease infinite;
    background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.7) !important;
}

.stat.danger .stat-bar {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

/* Мобильные устройства - всё компактнее */
@media (max-height: 800px) {
    /* Статы — компактнее */
    .stats-bar {
        padding: 0.4rem 0.6rem;
        gap: 0.3rem;
        margin-bottom: 0.2rem;
    }

    .stat-icon {
        font-size: 1rem;
        margin-bottom: 0.1rem;
    }

    .stat-icon img {
        width: 20px;
        height: 20px;
    }

    .stat-bar {
        height: 10px;
    }

    .stat-value {
        font-size: 0.7rem;
        margin-top: 0.1rem;
    }

    /* Сезон + год в одну строку */
    .season-year-row {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        margin-bottom: 0.3rem;
    }

    .season-indicator {
        padding: 0.2rem 0.6rem;
        font-size: 0.75rem;
        margin: 0;
    }

    .turn-counter {
        font-size: 0.75rem;
        margin: 0;
    }

    /* Карточка — компактнее */
    .card {
        padding: 0.8rem;
        border-radius: 12px;
    }

    .card-title {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    /* Текст карточки — без прокрутки, страница скроллится */
    .card-text {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 0.6rem;
        min-height: auto;
    }

    .card-choices {
        gap: 0.4rem;
    }

    .choice {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Персонаж — компактнее */
    .character-area {
        padding: 0.5rem;
    }

    .character-portrait .character-avatar {
        width: 150px;
        height: 180px;
    }

    .character-portrait .character-avatar-placeholder {
        font-size: 3.5rem;
    }

    .character-name-plate {
        padding: 0.3rem 0.8rem;
    }

    .character-name-plate .character-name {
        font-size: 0.95rem;
    }
}

/* Очень маленькие экраны */
@media (max-height: 700px) {
    .card-text {
        font-size: 0.85rem;
    }

    /* Персонаж ещё компактнее */
    .character-portrait .character-avatar {
        width: 130px;
        height: 160px;
    }

    .character-portrait .character-avatar-placeholder {
        font-size: 3rem;
    }
}

/* Планшеты */
@media (min-width: 768px) {
    .card-container {
        max-width: 500px;
    }

    .card {
        max-width: 480px;
        padding: 1.2rem;
    }

    .card-text {
        font-size: 1.1rem;
        max-height: none;
        overflow-y: visible;
    }

    /* Персонаж на планшете */
    .character-portrait .character-avatar {
        width: 220px;
        height: 280px;
    }

    .character-portrait .character-avatar-placeholder {
        font-size: 5rem;
    }

    .character-name-plate .character-name {
        font-size: 1.2rem;
    }
}

/* Десктоп — широкая карточка и большой персонаж */
@media (min-width: 1024px) {
    .card-container {
        max-width: 600px;
    }

    .card {
        max-width: 580px;
        padding: 1.5rem;
    }

    .card-text {
        font-size: 1.15rem;
        line-height: 1.7;
    }

    .card-title {
        font-size: 1.4rem;
    }

    .choice {
        padding: 0.9rem 1.2rem;
        font-size: 1rem;
    }

    /* Персонаж на десктопе — крупнее */
    .character-portrait .character-avatar {
        width: 280px;
        height: 350px;
    }

    .character-portrait .character-avatar-placeholder {
        font-size: 6rem;
    }

    .character-name-plate .character-name {
        font-size: 1.3rem;
    }
}


/* ============================================
   ОТЛОЖЕННЫЕ ЭФФЕКТЫ
   ============================================ */

/* Индикатор ожидающих событий */
.delayed-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    margin-bottom: 0.5rem;
    background: rgba(201, 162, 39, 0.15);
    border: 1px solid var(--gold-dark);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--gold);
    animation: pulse-glow 2s ease-in-out infinite;
}

.delayed-indicator.hidden {
    display: none;
}

.delayed-indicator-icon {
    font-size: 1rem;
}

.delayed-indicator-text {
    font-style: italic;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(201, 162, 39, 0.2);
    }
    50% {
        box-shadow: 0 0 15px rgba(201, 162, 39, 0.4);
    }
}

/* Уведомление о сработавшем эффекте */
.delayed-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 1000;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    max-width: 90%;
    width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(201, 162, 39, 0.3);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.delayed-notification.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.delayed-notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.delayed-notification-icon {
    font-size: 2rem;
    animation: hourglass-spin 2s ease-in-out infinite;
}

@keyframes hourglass-spin {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
}

.delayed-notification-text {
    flex: 1;
}

.delayed-notification-text strong {
    display: block;
    color: var(--gold);
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.delayed-notification-text p {
    color: var(--text-light);
    font-size: 1rem;
    margin: 0;
}

/* ============================================
   ДОСТИЖЕНИЯ
   ============================================ */

/* Уведомление о достижении */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: -400px;
    z-index: 1001;
    background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-dark) 100%);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    max-width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 30px rgba(201, 162, 39, 0.5);
    transition: right 0.5s ease;
}

.achievement-notification.visible {
    right: 20px;
}

.achievement-notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.achievement-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.achievement-info {
    flex: 1;
}

.achievement-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--bg-dark);
    opacity: 0.8;
}

.achievement-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--bg-dark);
    margin: 0.2rem 0;
}

.achievement-desc {
    font-size: 0.85rem;
    color: var(--bg-dark);
    opacity: 0.9;
}

/* Панель достижений */
.achievements-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 1002;
    background: var(--bg-card);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.achievements-panel.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.achievements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gold-dark);
}

.achievements-header h2 {
    color: var(--gold);
    font-size: 1.3rem;
    margin: 0;
}

.achievements-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    transition: color 0.2s;
}

.achievements-close:hover {
    color: var(--gold);
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 8px;
    transition: background 0.2s;
}

.achievement-item.unlocked {
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.2) 0%, var(--bg-light) 100%);
    border-left: 3px solid var(--gold);
}

.achievement-item.locked {
    opacity: 0.6;
}

.achievement-item-icon {
    font-size: 1.5rem;
    width: 2rem;
    text-align: center;
}

.achievement-item-info {
    flex: 1;
}

.achievement-item-name {
    font-weight: bold;
    color: var(--text-light);
    font-size: 0.95rem;
}

.achievement-item.unlocked .achievement-item-name {
    color: var(--gold);
}

.achievement-item-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ============================================
   СЕЗОНЫ
   ============================================ */

.season-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.85rem;
    margin: 0;
}

.season-indicator-icon {
    font-size: 1.1rem;
}

.season-indicator-name {
    color: var(--text-light);
    font-weight: 500;
}

.season-indicator-turns {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 0.3rem;
}

/* Цвета по сезонам */
.season-indicator.spring {
    border: 1px solid #7cb342;
    background: linear-gradient(90deg, rgba(124, 179, 66, 0.1) 0%, var(--bg-card) 100%);
}

.season-indicator.summer {
    border: 1px solid #ffa726;
    background: linear-gradient(90deg, rgba(255, 167, 38, 0.1) 0%, var(--bg-card) 100%);
}

.season-indicator.autumn {
    border: 1px solid #8d6e63;
    background: linear-gradient(90deg, rgba(141, 110, 99, 0.1) 0%, var(--bg-card) 100%);
}

.season-indicator.winter {
    border: 1px solid #90caf9;
    background: linear-gradient(90deg, rgba(144, 202, 249, 0.1) 0%, var(--bg-card) 100%);
}

.season-indicator.prolog {
    border: 1px solid #a67c52;
    background: linear-gradient(90deg, rgba(166, 124, 82, 0.15) 0%, var(--bg-card) 100%);
}

/* Уведомление о смене сезона */
.season-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 1003;
    background: var(--bg-card);
    border: 2px solid var(--gold);
    border-radius: 16px;
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.season-notification.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.season-notification-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.season-notification-name {
    font-size: 1.8rem;
    color: var(--gold);
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.season-notification-desc {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   ПРОГРЕСС АРОК
   ============================================ */

.arc-progress {
    display: none; /* Скрыт по умолчанию, показываем на десктопе */
    width: 100%;
    max-width: 500px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

/* Показать прогресс арок только на планшетах и десктопе */
@media (min-width: 768px) and (min-height: 700px) {
    .arc-progress {
        display: block;
    }
}

/* Линия прогресса */
.arc-progress-track {
    position: relative;
    height: 4px;
    background: var(--bg-light);
    border-radius: 2px;
    margin-bottom: 0.5rem;
}

.arc-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark) 0%, var(--gold) 100%);
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Маркеры арок */
.arc-markers {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-top: -12px;
}

.arc-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.arc-marker-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 2px solid var(--bg-light);
    border-radius: 50%;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.arc-marker.completed .arc-marker-icon {
    background: var(--gold-dark);
    border-color: var(--gold);
    opacity: 1;
}

.arc-marker.active .arc-marker-icon {
    background: var(--bg-card);
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.5);
    opacity: 1;
    animation: arc-pulse 2s ease-in-out infinite;
}

@keyframes arc-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(201, 162, 39, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(201, 162, 39, 0.6);
    }
}

/* Название текущей арки — скрыто, показывается только при смене арки */
.arc-current-name {
    display: none;
}

/* ============================================
   ИЗОБРАЖЕНИЯ АРОК
   ============================================ */

.arc-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1010;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.arc-image-overlay.visible {
    opacity: 1;
}

.arc-image-container {
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.5s ease;
}

.arc-image-overlay.visible .arc-image-container {
    transform: scale(1);
}

/* Placeholder для изображения (пока нет картинки) */
.arc-image-placeholder {
    width: 280px;
    height: 200px;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%);
    border: 3px solid var(--gold);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    /* Стиль летописной миниатюры */
    box-shadow:
        inset 0 0 30px rgba(201, 162, 39, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.5);
}

.arc-image-placeholder .arc-image-icon {
    font-size: 5rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Когда изображение загружено */
.arc-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.arc-image-title {
    font-size: 2rem;
    color: var(--gold);
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
}

.arc-image-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   СТАРЫЕ СТИЛИ ПЕРСОНАЖА В КАРТОЧКЕ (deprecated)
   Оставлены для совместимости
   ============================================ */

.card-character {
    display: none; /* Персонаж теперь вне карточки */
}

.card-character-info,
.card-character-name,
.card-character-title {
    display: none;
}

/* ============================================
   БРАУЗЕРНЫЙ РЕЖИМ (Safari, Chrome и др.)
   ============================================ */

/* Большие кнопки управления для браузера */
.browser-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    gap: 1rem;
}

.browser-controls.hidden {
    display: none;
}

.browser-btn {
    flex: 1;
    height: 60px;
    border: 2px solid var(--gold-dark);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%);
    color: var(--gold);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.browser-btn:active {
    transform: scale(0.95);
    background: linear-gradient(180deg, var(--gold-dark) 0%, var(--gold) 100%);
    color: var(--bg-dark);
}

.browser-btn:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(201, 162, 39, 0.3);
}

.browser-btn-arrow {
    font-weight: bold;
    line-height: 1;
}

/* Визуальная связь кнопок с выборами */
.browser-btn-left:active ~ .card-container .choice-left,
.browser-btn-left:hover {
    border-color: var(--gold);
}

.browser-btn-right:active ~ .card-container .choice-right,
.browser-btn-right:hover {
    border-color: var(--gold);
}


/* Адаптивность для кнопок */
@media (max-height: 700px) {
    .browser-controls {
        margin-top: 0.3rem;
        padding: 0.3rem 0.5rem;
    }

    .browser-btn {
        height: 50px;
        font-size: 1.6rem;
    }
}

@media (max-height: 600px) {
    .browser-btn {
        height: 44px;
        font-size: 1.4rem;
    }
}

/* Улучшенные стили для кнопок выбора в браузере */
body.browser-mode .choice {
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

body.browser-mode .choice:active {
    transform: scale(0.95);
    background: var(--gold-dark);
    color: var(--bg-dark);
}

/* Пульсация для привлечения внимания к кнопкам выбора */
@keyframes choicePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(201, 162, 39, 0);
    }
}

body.browser-mode .choice {
    animation: choicePulse 2s ease-in-out 3; /* Пульсирует 3 раза при загрузке */
}

/* ============================================
   БРАУЗЕРНЫЙ РЕЖИМ - КОМПАКТНАЯ РАСКЛАДКА
   Для Safari в Telegram где мало вертикального места
   ============================================ */

/* Компактный персонаж в браузере */
body.browser-mode .character-area {
    padding: 0.3rem;
}

body.browser-mode .character-portrait .character-avatar {
    width: 120px;
    height: 150px;
}

body.browser-mode .character-portrait .character-avatar-placeholder {
    font-size: 3rem;
}

body.browser-mode .character-name-plate {
    margin-top: 0.4rem;
    padding: 0.2rem 0.6rem;
}

body.browser-mode .character-name-plate .character-name {
    font-size: 0.9rem;
}

/* Компактная карточка в браузере */
body.browser-mode .card {
    padding: 0.6rem;
    max-width: 340px;
}

body.browser-mode .card-text {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

body.browser-mode .card-choices {
    gap: 0.3rem;
}

body.browser-mode .choice {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    min-height: 44px;
}

/* Прогресс арок скрыт на мобильных, стили не нужны */

/* Кнопки управления компактнее */
body.browser-mode .browser-controls {
    padding: 0.3rem 0.5rem;
    margin-top: 0.3rem;
    gap: 0.5rem;
}

body.browser-mode .browser-btn {
    height: 50px;
    font-size: 1.5rem;
}

/* Экстра-компактный режим для очень маленьких экранов */
@media (max-height: 650px) {
    body.browser-mode .character-portrait .character-avatar {
        width: 100px;
        height: 120px;
    }

    body.browser-mode .character-portrait .character-avatar-placeholder {
        font-size: 2.5rem;
    }

    body.browser-mode .card-text {
        font-size: 0.8rem;
    }

    body.browser-mode .browser-btn {
        height: 44px;
        font-size: 1.3rem;
    }
}

/* Разрешаем прокрутку в браузерном режиме */
body.browser-mode {
    overflow-y: auto;
    overflow-x: hidden;
}

body.browser-mode #game-screen {
    min-height: 100vh;
    height: auto;
    overflow: visible;
    padding-bottom: 1rem;
}

/* Прокрутка страницы для всех мобильных устройств */
@media (max-width: 768px), (max-height: 800px) {
    html, body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Убираем fixed позиционирование для скролла */
    .screen {
        position: relative;
        min-height: 100vh;
        height: auto;
    }

    #game-screen {
        min-height: 100vh;
        height: auto;
        overflow: visible;
        padding: 0.5rem;
        padding-bottom: 1rem;
    }
}

/* ============================================
   КОМПАКТНЫЙ HUD - Новый дизайн
   ============================================ */

/* Кнопка меню - внутри HUD справа (круглая, премиум) */
.hud-menu-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(180deg, #3a2a1a 0%, #2a1f15 50%, #1a1510 100%);
    border: 2px solid var(--hud-border);
    color: var(--gold);
    font-size: 1.3rem;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 0.4rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 2px 4px rgba(255, 215, 130, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.4),
        0 3px 8px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Блик на кнопке меню */
.hud-menu-btn::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 15%;
    right: 15%;
    height: 35%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    border-radius: 50%;
    pointer-events: none;
}

.hud-menu-btn:hover,
.hud-menu-btn:active {
    background: linear-gradient(180deg, #4a3a2a 0%, #3a2f25 50%, #2a2520 100%);
    border-color: var(--gold);
    box-shadow:
        inset 0 2px 4px rgba(255, 215, 130, 0.25),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Строки HUD — премиальный вид "шкатулка" */
.hud-row {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 360px;
    padding: 0.75rem 1rem;
    background: var(--hud-bg);
    border-radius: 16px;
    border: 3px solid var(--hud-border);
    box-shadow:
        var(--hud-inner-shadow),
        0 6px 20px rgba(0, 0, 0, 0.7),
        0 2px 0 rgba(166, 124, 82, 0.3);
    position: relative;
}

/* Декоративный эмбосс по верхнему краю */
.hud-row::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 215, 130, 0.4) 20%,
        rgba(255, 215, 130, 0.6) 50%,
        rgba(255, 215, 130, 0.4) 80%,
        transparent 100%);
    border-radius: 50%;
}

/* Главная строка: ресурсы по центру, арка и меню по бокам */
.hud-row-main {
    justify-content: center;
    margin-bottom: 0.5rem;
}

/* Иконка арки слева — премиум круглая кнопка */
.hud-arc-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #3a2a1a 0%, #2a1f15 50%, #1a1510 100%);
    border: 2px solid var(--hud-border);
    border-radius: 50%;
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-right: 0.4rem;
    box-shadow:
        inset 0 2px 4px rgba(255, 215, 130, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.4),
        0 3px 8px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Блик на кнопке арки */
.hud-arc-icon::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 15%;
    right: 15%;
    height: 35%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    border-radius: 50%;
}

/* Ресурсы в линию */
.hud-stats {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    flex: 1;
}

/* Каждый ресурс */
.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 58px;
    position: relative;
}

.hud-stat-icon {
    font-size: 1.3rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
    line-height: 1;
    margin-bottom: 2px;
}

.hud-stat-value {
    font-size: 1.15rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow:
        0 1px 2px rgba(0,0,0,0.9),
        0 0 8px rgba(0,0,0,0.5);
    line-height: 1;
    margin: 0.15rem 0;
    letter-spacing: -0.5px;
}

/* Толстый прогресс-бар под значением — премиум вид */
.hud-stat-bar {
    width: 100%;
    height: 14px;
    background: linear-gradient(180deg, #0a0806 0%, #1a1410 50%, #0d0a08 100%);
    border-radius: 7px;
    overflow: hidden;
    border: 2px solid rgba(90, 70, 50, 0.8);
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.8),
        0 1px 0 rgba(255, 215, 130, 0.1);
    position: relative;
}

/* Внутренняя рамка для глубины */
.hud-stat-bar::after {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,0.4);
    pointer-events: none;
}

.hud-stat-fill {
    height: 100%;
    width: 50%;
    transition: width 0.5s ease, background-color 0.3s ease;
    border-radius: 5px;
    position: relative;
}

/* Блик на заливке */
.hud-stat-fill::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    right: 4px;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, transparent 100%);
    border-radius: 4px 4px 50% 50%;
}

/* Градиенты для баров - насыщенные цвета с свечением */
.hud-stat[data-stat="people"] .hud-stat-fill {
    background: linear-gradient(180deg, #8bc34a 0%, #689f38 40%, #558b2f 100%);
    box-shadow:
        0 0 10px rgba(139, 195, 74, 0.6),
        inset 0 -2px 4px rgba(0,0,0,0.3);
}
.hud-stat[data-stat="treasury"] .hud-stat-fill {
    background: linear-gradient(180deg, #ffd54f 0%, #ffb300 40%, #ff8f00 100%);
    box-shadow:
        0 0 10px rgba(255, 193, 7, 0.6),
        inset 0 -2px 4px rgba(0,0,0,0.3);
}
.hud-stat[data-stat="faith"] .hud-stat-fill {
    background: linear-gradient(180deg, #64b5f6 0%, #42a5f5 40%, #1e88e5 100%);
    box-shadow:
        0 0 10px rgba(66, 165, 245, 0.6),
        inset 0 -2px 4px rgba(0,0,0,0.3);
}
.hud-stat[data-stat="army"] .hud-stat-fill {
    background: linear-gradient(180deg, #ef5350 0%, #e53935 40%, #c62828 100%);
    box-shadow:
        0 0 10px rgba(239, 83, 80, 0.6),
        inset 0 -2px 4px rgba(0,0,0,0.3);
}

/* Превью изменений над иконкой */
.hud-stat .stat-preview {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

/* Превью влияния — золотое свечение иконок при наведении на выбор */
.hud-stat.preview-glow-weak .hud-stat-icon {
    animation: preview-pulse 1.2s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(201, 162, 39, 0.4));
}

.hud-stat.preview-glow-medium .hud-stat-icon {
    animation: preview-pulse 0.8s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.6));
}

.hud-stat.preview-glow-strong .hud-stat-icon {
    animation: preview-pulse 0.5s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(230, 200, 74, 0.9));
}

@keyframes preview-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Строка с сезоном — компактная капсула */
.hud-row-season {
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 0.75rem;
    max-width: none;
}

/* Бейдж сезона — премиум капсула */
.hud-season-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 1rem;
    background: linear-gradient(180deg, rgba(50, 40, 30, 0.95) 0%, rgba(35, 28, 20, 0.95) 100%);
    border-radius: 20px;
    border: 2px solid var(--hud-border);
    font-size: 0.9rem;
    box-shadow:
        inset 0 1px 2px rgba(255, 215, 130, 0.1),
        0 3px 10px rgba(0, 0, 0, 0.5);
}

.hud-season-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.hud-season-text {
    color: var(--text-light);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.hud-season-sep {
    color: var(--gold-dark);
    opacity: 0.6;
    margin: 0 0.1rem;
}

.hud-season-year {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Цвета бейджа по сезонам — цветной акцент */
.hud-season-badge.spring {
    border-color: #7cb342;
    box-shadow:
        inset 0 1px 2px rgba(124, 179, 66, 0.2),
        0 3px 10px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(124, 179, 66, 0.15);
}

.hud-season-badge.summer {
    border-color: #ffa726;
    box-shadow:
        inset 0 1px 2px rgba(255, 167, 38, 0.2),
        0 3px 10px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 167, 38, 0.15);
}

.hud-season-badge.autumn {
    border-color: #a1887f;
    box-shadow:
        inset 0 1px 2px rgba(161, 136, 127, 0.2),
        0 3px 10px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(161, 136, 127, 0.15);
}

.hud-season-badge.winter {
    border-color: #90caf9;
    box-shadow:
        inset 0 1px 2px rgba(144, 202, 249, 0.2),
        0 3px 10px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(144, 202, 249, 0.15);
}

.hud-season-badge.prolog {
    border-color: #a67c52;
    box-shadow:
        inset 0 1px 2px rgba(166, 124, 82, 0.2),
        0 3px 10px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(166, 124, 82, 0.15);
}

/* Анимации для HUD */
.hud-stat.warning .hud-stat-fill {
    animation: pulse 0.8s ease infinite;
}

.hud-stat.warning .hud-stat-bar {
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.hud-stat.danger .hud-stat-fill {
    animation: shake 0.3s ease infinite;
    background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%) !important;
}

.hud-stat.danger .hud-stat-bar {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Анимация подсветки при старте игры */
@keyframes hud-stat-pulse {
    0%, 100% {
        transform: scaleY(1);
        filter: brightness(1);
    }
    50% {
        transform: scaleY(1.3);
        filter: brightness(1.5);
    }
}

@keyframes hud-bar-flash {
    0%, 100% {
        border-color: rgba(201, 162, 39, 0.2);
    }
    50% {
        border-color: rgba(255, 215, 0, 0.8);
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    }
}

.hud-row-main.highlight .hud-stat-bar {
    animation: hud-bar-flash 0.6s ease-in-out 4;
}

.hud-row-main.highlight .hud-stat-fill {
    animation: hud-stat-pulse 0.6s ease-in-out 4;
}

.hud-row-main.highlight .hud-stat:nth-child(1) .hud-stat-fill,
.hud-row-main.highlight .hud-stat:nth-child(1) .hud-stat-bar { animation-delay: 0s; }
.hud-row-main.highlight .hud-stat:nth-child(2) .hud-stat-fill,
.hud-row-main.highlight .hud-stat:nth-child(2) .hud-stat-bar { animation-delay: 0.15s; }
.hud-row-main.highlight .hud-stat:nth-child(3) .hud-stat-fill,
.hud-row-main.highlight .hud-stat:nth-child(3) .hud-stat-bar { animation-delay: 0.3s; }
.hud-row-main.highlight .hud-stat:nth-child(4) .hud-stat-fill,
.hud-row-main.highlight .hud-stat:nth-child(4) .hud-stat-bar { animation-delay: 0.45s; }

/* Адаптивность компактного HUD — маленькие экраны */
@media (max-height: 700px) {
    .hud-row {
        max-width: 340px;
        padding: 0.6rem 0.8rem;
        border-width: 2px;
    }

    .hud-row-main {
        padding: 0.5rem 0.7rem;
    }

    .hud-stats {
        gap: 0.4rem;
    }

    .hud-stat {
        min-width: 50px;
    }

    .hud-stat-icon {
        font-size: 1.1rem;
    }

    .hud-stat-value {
        font-size: 1rem;
    }

    .hud-stat-bar {
        height: 10px;
        border-width: 1px;
    }

    .hud-arc-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        margin-right: 0.3rem;
    }

    .hud-menu-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        margin-left: 0.3rem;
    }

    .hud-season-badge {
        padding: 0.25rem 0.7rem;
        font-size: 0.8rem;
    }

    .hud-row-season {
        margin-bottom: 0.5rem;
    }

    /* Карточка компактнее */
    .card {
        padding: 1rem;
        border-width: 2px;
    }

    .choice {
        min-height: 48px;
        padding: 0.7rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* Браузерный режим — компактный премиум */
body.browser-mode .hud-row {
    max-width: 340px;
    border-width: 2px;
}

body.browser-mode .hud-row-main {
    padding: 0.5rem 0.7rem;
}

body.browser-mode .hud-stats {
    gap: 0.35rem;
}

body.browser-mode .hud-stat {
    min-width: 48px;
}

body.browser-mode .hud-stat-icon {
    font-size: 1.1rem;
}

body.browser-mode .hud-stat-value {
    font-size: 0.95rem;
}

body.browser-mode .hud-stat-bar {
    height: 10px;
    border-width: 1px;
}

body.browser-mode .hud-arc-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    margin-right: 0.25rem;
}

body.browser-mode .hud-menu-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
    margin-left: 0.25rem;
}

body.browser-mode .hud-season-badge {
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
}

body.browser-mode .hud-row-season {
    margin-bottom: 0.4rem;
}

/* Браузер — карточка и кнопки */
body.browser-mode .card {
    border-width: 2px;
}

body.browser-mode .choice {
    min-height: 48px;
    border-width: 2px;
}

/* ============================================
   SCENE LAYER - АДАПТИВНОСТЬ
   ============================================ */

/* Маленькие экраны */
@media (max-height: 700px) {
    .scene-character {
        bottom: 25%;
        max-height: 45%;
    }

    .scene-character-name {
        bottom: 27%;
    }

    .scene-character-name-text {
        padding: 0.3rem 0.9rem;
        font-size: 0.85rem;
    }
}

/* Очень маленькие экраны */
@media (max-height: 600px) {
    .scene-character {
        bottom: 30%;
        max-height: 40%;
    }

    .scene-character-name {
        bottom: 32%;
    }
}

/* Планшеты и десктоп - персонажи крупнее */
@media (min-width: 768px) {
    .scene-character {
        width: 30%;
        max-width: 320px;
        max-height: 60%;
    }

    .scene-character-left {
        left: 8%;
    }

    .scene-character-right {
        right: 8%;
    }

    .scene-character-name-text {
        font-size: 1.1rem;
        padding: 0.5rem 1.5rem;
    }
}

/* Десктоп - крупные персонажи */
@media (min-width: 1024px) {
    .scene-character {
        width: 28%;
        max-width: 380px;
        max-height: 65%;
        bottom: 15%;
    }

    .scene-character-left {
        left: 10%;
    }

    .scene-character-right {
        right: 10%;
    }

    .scene-character-name {
        bottom: 18%;
    }
}

/* Браузерный режим - компактные персонажи */
body.browser-mode .scene-character {
    bottom: 30%;
    max-height: 40%;
}

body.browser-mode .scene-character-name {
    bottom: 32%;
}

body.browser-mode .scene-character-name-text {
    padding: 0.25rem 0.8rem;
    font-size: 0.8rem;
}

/* ========================================
   КАСТОМНЫЕ UI ИЗОБРАЖЕНИЯ
   Раскомментируйте когда сгенерируете графику
   ======================================== */

/*
=== ИКОНКИ СТАТОВ ===
Раскомментируйте этот блок когда добавите иконки в images/ui/icons/

.hud-stat[data-stat="people"] .hud-stat-icon {
    background-image: url('../images/ui/icons/icon_people.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 28px;
    height: 28px;
    font-size: 0;
}

.hud-stat[data-stat="treasury"] .hud-stat-icon {
    background-image: url('../images/ui/icons/icon_treasury.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 28px;
    height: 28px;
    font-size: 0;
}

.hud-stat[data-stat="faith"] .hud-stat-icon {
    background-image: url('../images/ui/icons/icon_faith.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 28px;
    height: 28px;
    font-size: 0;
}

.hud-stat[data-stat="army"] .hud-stat-icon {
    background-image: url('../images/ui/icons/icon_army.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 28px;
    height: 28px;
    font-size: 0;
}

=== КОНЕЦ ИКОНОК СТАТОВ ===
*/

/*
=== ФОН КАРТОЧКИ ===
Раскомментируйте когда добавите card_bg.png в images/ui/

.card {
    background-image: url('../images/ui/card_bg.png');
    background-size: cover;
    background-position: center;
}

=== КОНЕЦ ФОНА КАРТОЧКИ ===
*/

/*
=== ФОН КНОПОК ВЫБОРА ===
Раскомментируйте когда добавите button_bg.png в images/ui/

.choice {
    background-image: url('../images/ui/button_bg.png');
    background-size: cover;
    background-position: center;
}

=== КОНЕЦ ФОНА КНОПОК ===
*/

/*
=== ФОН HUD ПАНЕЛИ ===
Раскомментируйте когда добавите hud_bg.png в images/ui/

.hud-row {
    background-image: url('../images/ui/hud_bg.png');
    background-size: cover;
    background-position: center;
}

=== КОНЕЦ ФОНА HUD ===
*/

/* ========================================
   ЛЕТОПИСНАЯ СТРОКА (НАРРАТИВНЫЕ ПРЕДУПРЕЖДЕНИЯ)
   ======================================== */

.chronicle-line {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, rgba(50, 40, 30, 0.98) 0%, rgba(35, 28, 20, 0.98) 100%);
    border: 3px solid #a67c52;
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.8),
        inset 0 2px 4px rgba(255, 215, 130, 0.1);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.chronicle-line.visible {
    opacity: 1;
}

.chronicle-text {
    display: block;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #e8dcc8;
    text-align: center;
    font-style: italic;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

/* Анимация появления */
@keyframes chronicle-fade-in {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.chronicle-line.animating {
    animation: chronicle-fade-in 0.4s ease;
}

/* Мобильная адаптация */
@media (max-height: 800px) {
    .chronicle-line {
        padding: 1rem 1.5rem;
        max-width: 500px;
    }

    .chronicle-text {
        font-size: 1rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .chronicle-line {
        width: 85%;
        padding: 0.8rem 1.2rem;
    }

    .chronicle-text {
        font-size: 0.95rem;
    }
}

/* ============================================
   ХРОНИКА ПРАВЛЕНИЙ
   ============================================ */

#chronicle-screen {
    background: linear-gradient(180deg, #1a1512 0%, #0d0a08 100%);
}

.chronicle-content {
    padding: 1.5rem 1rem;
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
}

.chronicle-content h1 {
    font-size: 1.8rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.chronicle-list {
    margin-bottom: 1.5rem;
}

.chronicle-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 0;
}

.chronicle-entry {
    background: var(--card-bg);
    border: 1px solid var(--gold-dark);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;
    transition: border-color 0.2s;
}

.chronicle-entry.victory {
    border-left: 3px solid var(--gold);
}

.chronicle-entry.death {
    border-left: 3px solid var(--danger);
}

.chronicle-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.chronicle-entry-title {
    font-weight: bold;
    color: var(--text-light);
    font-size: 1rem;
}

.chronicle-entry-score {
    font-size: 0.85rem;
    color: var(--gold);
    font-weight: bold;
}

.chronicle-entry-reason {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.3rem;
}

.chronicle-entry-meta {
    display: flex;
    gap: 0.8rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chronicle-entry-meta span {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

/* ============================================
   ЛИДЕРБОРД
   ============================================ */

#leaderboard-screen {
    background: linear-gradient(180deg, #1a1512 0%, #0d0a08 100%);
}

.leaderboard-content {
    padding: 1.5rem 1rem;
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.leaderboard-content h1 {
    font-size: 1.8rem;
    color: var(--gold);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.leaderboard-list {
    margin-bottom: 1.5rem;
}

.leaderboard-loading {
    color: var(--text-muted);
    font-style: italic;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(166, 124, 82, 0.2);
    gap: 0.8rem;
}

.leaderboard-entry.is-user {
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid var(--gold-dark);
    border-radius: 6px;
}

.leaderboard-rank {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--gold);
    min-width: 30px;
    text-align: center;
}

.leaderboard-rank.top-1 { color: #ffd700; }
.leaderboard-rank.top-2 { color: #c0c0c0; }
.leaderboard-rank.top-3 { color: #cd7f32; }

.leaderboard-name {
    flex: 1;
    text-align: left;
    color: var(--text-light);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-score {
    font-weight: bold;
    color: var(--gold-bright);
    font-size: 1rem;
}

.leaderboard-empty {
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 0;
}

/* ============================================
   ВЫБОР СЛОЖНОСТИ
   ============================================ */

#difficulty-screen {
    background: linear-gradient(180deg, #1a1512 0%, #0d0a08 100%);
}

.difficulty-content {
    padding: 2rem 1.5rem;
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.difficulty-content h2 {
    font-size: 1.8rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.difficulty-subtitle {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.difficulty-option {
    background: var(--card-bg);
    border: 2px solid var(--bg-light);
    border-radius: 10px;
    padding: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
    font-family: inherit;
    color: var(--text-light);
}

.difficulty-option:hover {
    border-color: var(--gold-dark);
}

.difficulty-option.selected {
    border-color: var(--gold);
    background: rgba(201, 162, 39, 0.1);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.2);
}

.difficulty-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.difficulty-name {
    font-weight: bold;
    font-size: 1.1rem;
    display: block;
    color: var(--gold-bright);
}

.difficulty-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.2rem;
}

/* ============================================
   МАГАЗИН "СОКРОВИЩНИЦА КНЯЗЯ"
   ============================================ */

#shop-screen {
    background: linear-gradient(180deg, #1a1510 0%, #0d0a06 100%);
}

.shop-content {
    padding: 1.5rem 1rem;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}

.shop-content h1 {
    font-size: 1.8rem;
    color: var(--gold);
    text-align: center;
    margin-bottom: 0.3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.shop-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.shop-section {
    margin-bottom: 1.5rem;
}

.shop-section-title {
    font-size: 1.1rem;
    color: var(--gold-bright);
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--gold-dark);
}

.shop-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.shop-item {
    background: var(--card-bg);
    border: 1px solid var(--gold-dark);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    display: grid;
    grid-template-columns: 40px 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.2rem 0.6rem;
    align-items: center;
    transition: border-color 0.2s;
}

.shop-item:hover {
    border-color: var(--gold);
}

.shop-item.owned {
    border-color: var(--success);
    opacity: 0.7;
}

.shop-item-icon {
    grid-row: 1 / 3;
    font-size: 1.8rem;
    text-align: center;
}

.shop-item-name {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-light);
}

.shop-item-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.shop-item-uses {
    grid-column: 2;
    font-size: 0.75rem;
    color: var(--gold);
}

.shop-buy-btn {
    grid-column: 3;
    grid-row: 1 / 3;
    background: var(--button-wood);
    border: 1px solid var(--gold-dark);
    color: var(--gold-bright);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.shop-buy-btn:hover {
    background: var(--gold-dark);
    color: var(--bg-dark);
}

.shop-buy-btn.owned-label {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-light);
    cursor: default;
    pointer-events: none;
}

/* ============================================
   КНОПКА "ВТОРОЙ ШАНС" (ЭКРАН СМЕРТИ)
   ============================================ */

.btn-rewarded {
    display: block;
    width: 250px;
    padding: 1rem 2rem;
    margin: 1rem auto;
    border: 2px solid var(--gold);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(180deg, #2a3a1a 0%, #1a2a10 100%);
    color: var(--gold-bright);
    font-weight: bold;
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.2);
    animation: pulseGlow 2s ease-in-out infinite;
}

.btn-rewarded:hover {
    box-shadow: 0 0 25px rgba(201, 162, 39, 0.4);
    transform: translateY(-2px);
}

.btn-rewarded.hidden {
    display: none;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(201, 162, 39, 0.2); }
    50% { box-shadow: 0 0 25px rgba(201, 162, 39, 0.5); }
}

/* ============================================
   КНОПКА СОВЕТНИКА В HUD
   ============================================ */

.hud-advisor-btn {
    background: none;
    border: 1px solid var(--gold-dark);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-right: 4px;
}

.hud-advisor-btn:hover {
    border-color: var(--gold);
    background: rgba(201, 162, 39, 0.15);
}

.hud-advisor-btn.hidden {
    display: none;
}

.hud-advisor-btn .advisor-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--gold);
    color: var(--bg-dark);
    font-size: 0.6rem;
    font-weight: bold;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   ОВЕРЛЕЙ СОВЕТА СОВЕТНИКА
   ============================================ */

.advisor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: fadeIn 0.2s ease;
}

.advisor-content {
    background: var(--bg-card);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 340px;
    width: 90%;
    text-align: center;
}

.advisor-content h3 {
    color: var(--gold);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.advisor-choice {
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border: 1px solid var(--gold-dark);
}

.advisor-choice-label {
    font-weight: bold;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.advisor-stat-change {
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    padding: 0.15rem 0;
}

.advisor-stat-change.positive {
    color: var(--success);
}

.advisor-stat-change.negative {
    color: var(--danger);
}

.advisor-stat-change.neutral {
    color: var(--text-muted);
}

.advisor-dismiss {
    margin-top: 0.8rem;
    background: var(--button-wood);
    border: 1px solid var(--gold-dark);
    color: var(--text-light);
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.advisor-dismiss:hover {
    border-color: var(--gold);
}

@media (max-width: 480px) {
    .shop-content h1 {
        font-size: 1.5rem;
    }

    .shop-item {
        padding: 0.6rem 0.8rem;
    }

    .shop-item-icon {
        font-size: 1.5rem;
    }
}

/* ============================================
   СЕЗОННАЯ ПАУЗА
   ============================================ */

.season-break-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.season-break-overlay.visible {
    opacity: 1;
}

.season-break-content {
    text-align: center;
    padding: 2rem;
    max-width: 340px;
}

.season-break-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: seasonPulse 2s ease-in-out infinite;
}

@keyframes seasonPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.season-break-title {
    font-size: 1.8rem;
    color: var(--gold);
    font-weight: bold;
    margin-bottom: 0.3rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.season-break-year {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.season-break-desc {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    font-style: italic;
}

.season-break-continue,
.season-break-save {
    width: 220px;
}

/* ============================================
   ИНТЕРАКТИВНЫЙ ТУТОРИАЛ (ОВЕРЛЕЙ)
   ============================================ */

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1200;
    pointer-events: none;
}

.tutorial-overlay .tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.tutorial-bubble {
    position: absolute;
    background: var(--bg-card);
    border: 2px solid var(--gold);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    max-width: 280px;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(201, 162, 39, 0.3);
    animation: tutorialFadeIn 0.4s ease;
}

@keyframes tutorialFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tutorial-bubble-text {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 0.6rem;
}

.tutorial-bubble-hint {
    color: var(--gold);
    font-size: 0.85rem;
    font-style: italic;
}

.tutorial-bubble .tutorial-next {
    margin-top: 0.5rem;
    background: var(--gold-dark);
    color: var(--bg-dark);
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.tutorial-highlight {
    animation: tutorialPulse 1.5s ease-in-out infinite;
    position: relative;
    z-index: 1201;
}

@keyframes tutorialPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(201, 162, 39, 0); }
}

.tutorial-swipe-hand {
    position: absolute;
    font-size: 2.5rem;
    animation: swipeRight 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes swipeRight {
    0% { transform: translateX(-40px); opacity: 0.5; }
    50% { transform: translateX(40px); opacity: 1; }
    100% { transform: translateX(-40px); opacity: 0.5; }
}
