/* Загальні стилі для сторінки */
body {
    background-color: #2c2c2c;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
}

/* Адаптивний контейнер гри */
#game-wrapper {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    padding: 1vh;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

#game-container {
    width: 100%;
    height: 100%;
    border: 5px solid #5a4d41;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background: #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Стилі для повноекранного режиму */
#game-container:fullscreen {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    border: none;
    padding: 0;
}


/* Ігрове поле */
canvas {
    width: 100%;
    flex-grow: 1;
    min-height: 0;
    display: block;
    cursor: crosshair;
    background-color: #5b8e44;
}

/* Верхня та нижня панелі */
#top-panel, #bottom-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 15px;
    background-color: #4a3f35;
    font-size: 1em;
    flex-shrink: 0;
}

#top-panel {
    border-bottom: 3px solid #5a4d41;
    gap: 15px;
}

#bottom-panel {
    border-top: 3px solid #5a4d41;
}

#base-hp-container {
    flex-grow: 1;
    height: 22px;
    background-color: #c0392b;
    border-radius: 5px;
    border: 2px solid #333;
    position: relative;
    overflow: hidden;
}

#base-hp-bar {
    height: 100%;
    width: 100%;
    background-color: #2ecc71;
    border-radius: 3px;
    transition: width 0.3s ease-in-out;
}

#base-hp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px black;
    font-size: 0.9em;
}

#wave-info-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#start-wave-btn {
    background-color: #27ae60;
    border-color: #2ecc71;
    padding: 4px 8px;
    font-size: 0.8em;
    font-weight: bold;
}
#start-wave-btn:hover {
    background-color: #2ecc71;
}

/* Стилі кнопок */
button {
    background-color: #7a6a5d;
    color: white;
    border: 2px solid #5a4d41;
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, border-color 0.2s;
}

button:hover {
    background-color: #9c8b7e;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
    transform: none;
}

#fullscreen-btn {
    padding: 8px;
    font-size: 1em;
}

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

/* Модальні вікна */
#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s;
}

.modal {
    background-color: #4a3f35;
    padding: 20px 40px;
    border-radius: 10px;
    border: 3px solid #7a6a5d;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    position: relative;
    min-width: 400px;
}

.modal h1 { font-size: 4em; margin: 0; color: #e0d6cc; }
.modal h2 { font-size: 2.5em; margin-top: 0; margin-bottom: 20px; }
.modal p { font-size: 1.2em; }
#play-btn { font-size: 3em; padding: 20px 40px; }
.hidden { display: none !important; }

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #e0d6cc;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}
.close-btn:hover {
    color: white;
    transform: none;
}

.summary-stats {
    margin-bottom: 20px;
    border-top: 2px solid #7a6a5d;
    border-bottom: 2px solid #7a6a5d;
    padding: 10px 0;
}
.summary-stats p {
    margin: 8px 0;
    font-size: 1.1em;
}
/* NEW: Стиль для тексту бонусу */
#summary-bonus {
    color: #ffd700; /* Золотий колір */
    font-weight: bold;
}

.summary-records {
    text-align: left;
}
.summary-records h3 {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 10px;
}
#summary-records-list {
    list-style-type: decimal;
    padding-left: 40px;
    margin: 0;
}
#summary-records-list li {
    font-size: 1.1em;
    margin-bottom: 5px;
}
#summary-records-list li.new-record {
    color: #2ecc71;
    font-weight: bold;
}


/* Анімація для таймера */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.pulsing-timer {
    color: #e74c3c !important;
    animation: pulse 1s infinite;
}
