@font-face {
    font-family: 'BulbasaurFont';
    /* Используем абсолютный путь от корня сайта, это надежнее */
    src: url('/fonts/Bulbasaur.ttf') format('truetype');
}

body {
    margin: 0;
    overflow: hidden;
    background-color: #1e1e1e;
}

canvas {
    display: block;
    /* ЗАДАЕМ ФОН ЗДЕСЬ. Это будет цвет за пределами круга. */
    background-color: transparent;
    /* --- ИЗМЕНЕНИЕ: УДАЛЯЕМ ПЕРЕХОД, ЧТОБЫ РАЗМЫТИЕ БЫЛО МГНОВЕННЫМ --- */
    /* transition: filter 0.5s ease-out; */
}

/* --- ИЗМЕНЕНИЕ: Новый класс для размытия --- */
canvas.blurred {
    filter: blur(5px);
}

.hidden {
    display: none !important;
}

/* --- НОВЫЕ СТИЛИ ДЛЯ ИГРОВОГО ИНТЕРФЕЙСА --- */
#gameHud {
    /* Эти элементы не должны мешать кликать по игре */
    pointer-events: none;
    color: white;
    z-index: 10; /* Поверх всего */
}

#gameTitle {
    position: absolute;
    top: 20px;
    left: 20px;

    /* Применяем тот же стиль, что и в меню, но чуть меньше */
    font-family: 'BulbasaurFont', sans-serif;
    font-size: 3em;
    color: #ffcb05;
    -webkit-text-stroke: 1.5px #3d7dca;
    text-shadow: 3px 3px 0px rgba(0,0,0,0.4);
}

#demoModeText {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);

    font-family: Arial, sans-serif;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.4); /* Полупрозрачный белый */
}
/* --- КОНЕЦ НОВЫХ СТИЛЕЙ --- */


#startMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    color: white;
    width: 90%;
    max-width: 500px;
}

#startMenu h1 {
    font-family: 'BulbasaurFont', sans-serif;
    font-size: 5em;
    color: #ffcb05;
    -webkit-text-stroke: 2px #3d7dca;
    text-shadow: 4px 4px 0px rgba(0,0,0,0.5);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

/*#exitButton {*/
/*    position: absolute;*/
/*    top: 90px;*/
/*    left: 20px;*/
/*    pointer-events: auto; !* Позволяет нажимать на кнопку *!*/
/*    cursor: pointer;*/
/*    background: #d9534f;*/
/*    color: white;*/
/*    border: none;*/
/*    border-radius: 5px;*/
/*    padding: 10px 20px;*/
/*    font-size: 1em;*/
/*    font-weight: bold;*/
/*    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);*/
/*    transition: background-color 0.2s;*/
/*}*/
/*#exitButton:hover {*/
/*    background: #c9302c;*/
/*}*/


.bottom-hud {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    pointer-events: none; /* Контейнер не кликабельный */
}

#cashOutButton {
    pointer-events: auto; /* Кнопка кликабельная */
    cursor: pointer;
    background: linear-gradient(145deg, #ffd700, #fca500);
    color: #4a2c00;
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 12px 25px;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(255,255,255,0.5);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    transition: all 0.2s ease-in-out;
    margin-bottom: 10px; /* Отступ до "демо режим" */
    display: flex;
    align-items: center;
    justify-content: center;
}

#cashOutButton:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

#cashOutButton:disabled {
    cursor: not-allowed;
    background: #777;
    color: #ccc;
    border-color: #999;
}


#cashOutButton .icon {
    margin-right: 8px;
    font-size: 1.1em;
}

#demoModeText {
    position: static; /* Убираем абсолютное позиционирование */
    transform: none; /* Убираем transform */
    font-family: Arial, sans-serif;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.4);
}


#balanceHudDisplay {
    position: absolute;
    top: 25px;
    right: 20px;
    font-size: 1.8em;
    color: #00ff00;
    text-shadow: 2px 2px 0px #000;
}


#startMenu .subtitle {
    font-size: 1.2em;
    color: #cccccc;
    margin-top: -5px;
    margin-bottom: 25px;
}

#startMenu input, #startMenu button {
    width: 80%;
    padding: 15px;
    font-size: 1.5em;
    border-radius: 10px;
    box-sizing: border-box;
    margin-bottom: 20px;
}

#startMenu input {
    border: 2px solid white;
    background: #333;
    color: white;
}

#startMenu button {
    cursor: pointer;
    background: #00FF00;
    color: black;
    border: none;
    font-weight: bold;
}
#startMenu button:hover {
    background: #00AA00;
}

#menuLogo {
    position: absolute; /* Позволяет точно позиционировать логотип */
    top: -50px;         /* Сдвигаем на 50px выше верхнего края меню */
    left: -70px;        /* Сдвигаем на 30px левее левого края меню */
    width: 200px;       /* Устанавливаем ширину логотипа */
    height: auto;       /* Высота подстроится автоматически */
    transform: rotate(-10deg); /* Немного наклоняем для более живого вида */
}


#errorMessage {
    color: red;
    height: 20px;
    font-size: 1.2em;
}


/* --- ИЗМЕНЕНИЕ: Стили для единого финального экрана --- */
#finalScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent !important;  /* Полностью прозрачный фон для окна — салют будет виден сквозь */
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;  /* Явно задаём z-index ниже, чем у confetti */
    pointer-events: none;  /* Окно не мешает салюту, но кнопка внутри — auto */
}

.final-screen-content {
    background: rgba(0,0,0,0.7);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;

    /* Выравниваем блочные элементы (иконку, заголовок) по центру */
    display: flex;
    flex-direction: column;
    align-items: center;
}


#finalScreenIcon {
    width: 80px;
    height: 80px;
    /* --- ИЗМЕНЕНИЕ: Делаем иконку золотой --- */
    background: linear-gradient(145deg, #ffd700, #fca500);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 48px;
    font-weight: bold;
    /* --- ИЗМЕНЕНИЕ: Цвет символа '₽' для контраста с золотым фоном --- */
    color: #4a2c00;
    margin-bottom: 20px;
    /* --- ИЗМЕНЕНИЕ: Тень тоже делаем золотой --- */
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
}


#finalScreen.visible {
    opacity: 1;
    visibility: visible;
}

#finalScreen h1 {
    font-size: 2.5em; /* Уменьшаем размер для компактности */
    text-shadow: 2px 2px 5px #000;
    margin: 0; /* Убираем отступы */
}

#finalScreen p {
    font-size: 2.2em; /* Увеличиваем для акцента на сумме */
    margin-top: 10px;
    margin-bottom: 30px;
    font-weight: bold;

}

#finalScreen button {
    pointer-events: auto;
    font-size: 1.5em; /* Уменьшаем размер */
    padding: 15px 30px;
    border: 2px solid rgba(255, 255, 255, 0.5); /* Полупрозрачная граница */
    background-color: transparent; /* Прозрачный фон */
    color: white;
    cursor: pointer;
    border-radius: 12px; /* Более скругленные края */
    transition: background-color 0.2s, border-color 0.2s; /* Плавный переход */
    pointer-events: auto
}

#finalScreen button:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Легкая подсветка при наведении */
    border-color: rgba(255, 255, 255, 0.8);
}

/* Старые стили для deathScreen и winScreen больше не нужны, но можно их пока оставить или удалить */
#deathScreen, #winScreen {
    display: none !important; /* Прячем старые элементы на всякий случай */
}


#deathScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(38, 38, 38, 0.8);
    background-image:
        linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
    background-size: 30px 30px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s, visibility 0.5s;
    /* --- ИЗМЕНЕНИЕ: Убираем класс .hidden, чтобы visibility работало --- */
}



#winScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* --- ИЗМЕНЕНИЕ: Убираем фон, чтобы салют был виден на фоне размытой игры --- */
    background-color: transparent;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s, visibility 0.5s;
    z-index: 20;
    /* --- ИЗМЕНЕНИЕ: Добавляем pointer-events, чтобы не мешать салюту --- */
    pointer-events: none;
}

#winScreen h1 {
    font-size: 4em;
    color: #ffd700;
    text-shadow: 2px 2px 5px #000;
}

#winningsDisplay {
    font-size: 2em;
    color: #00ff00;
    margin-top: -20px;
    margin-bottom: 30px;
}

#winScreen button {
    pointer-events: auto;
    font-size: 2em;
    padding: 15px 30px;
    border: 2px solid white;
    background-color: #333;
    color: white;
    cursor: pointer;
    border-radius: 10px;
}

#winScreen button:hover {
    background-color: #555;
}


#balanceDisplay {
    font-size: 1.2em;
    color: #00FF00;
    margin-bottom: 15px;
}
#scoreDisplay {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2em;
    color: white;
    text-shadow: 2px 2px 0px #000;
}
#finalScore {
    font-size: 1.5em;
    color: #FFF;
    margin-top: -20px;
    margin-bottom: 30px;
}


#deathScreen.visible {
    visibility: visible;
    opacity: 1;
}

#deathScreen h1, #deathScreen button {
    font-size: 4em;
    margin-bottom: 20px;
}

#deathScreen button {
    font-size: 2em;
    padding: 15px 30px;
    border: 2px solid white;
    background-color: #333;
    color: white;
    cursor: pointer;
    border-radius: 10px;
}
#deathScreen button:hover {
    background-color: #555;
}