:root {
    --grass: #88aa33;
    --dirt: #b8864c;
    --water: #3388aa;
    --text: #f0f0d8;
    --win-color: #ffd700;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #2a2a2a;
    color: var(--text);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    max-width: 1200px;
    width: 100%;
}

.map {
    display: grid;
    grid-template-columns: repeat(20, 30px);
    grid-template-rows: repeat(15, 30px);
    gap: 1px;
    background: var(--dirt);
    border: 2px solid #666;
}

.tile {
    width: 30px;
    height: 30px;
    background: var(--grass);
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}

.tile:hover {
    transform: scale(1.1);
    z-index: 1;
}

.tile.available {
    outline: 2px solid #fff;
}

.tile[data-type="temple"] { 
    background: #ffd700; 
}
.tile[data-type="temple"]::before {
    content: "🏛️";
}

.tile[data-type="water"] { 
    background: var(--water); 
}
.tile[data-type="water"]::before {
    content: "🌊";
    animation: wave 2s infinite;
}

.tile[data-type="castle"] { 
    background: #aa3333; 
}
.tile[data-type="castle"]::before {
    content: "🏰";
}

.tile[data-type="farm"] { 
    background: #aaff33; 
}
.tile[data-type="farm"]::before {
    content: "🌾";
}

.tile[data-type="barracks"] { 
    background: #666666; 
}
.tile[data-type="barracks"]::before {
    content: "⚔️";
}

.tile[data-type="wall"] { 
    background: #999999; 
}
.tile[data-type="wall"]::before {
    content: "🧱";
}

.tile[data-type="mine"] { 
    background: #8B4513; 
}
.tile[data-type="mine"]::before {
    content: "⛏️";
}

.tile[data-type="lumbercamp"] { 
    background: #556B2F; 
}
.tile[data-type="lumbercamp"]::before {
    content: "🪵";
}

@keyframes wave {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    50% { transform: translate(-50%, -50%) rotate(10deg); }
}

.tile[data-type]::before {
    font-size: 16px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.info-panel {
    background: #333333;
    padding: 20px;
    border-radius: 5px;
    border: 2px solid #666;
    display: flex;
    flex-direction: column;
}

.resources {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.resource {
    background: #444;
    padding: 10px;
    border-radius: 3px;
    text-align: center;
}

.build-options {
    margin-top: 20px;
}

.build-button {
    background: #555;
    border: none;
    color: white;
    padding: 10px;
    margin: 5px 0;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.build-button:hover {
    background: #666;
}

.build-button.selected {
    background: #777;
}

.status-message {
    padding: 10px;
    background-color: #aa3333;
    color: white;
    margin-top: 10px;
    text-align: center;
    border-radius: 3px;
    font-weight: bold;
    display: none;
}

.event-log {
    margin-top: 20px;
    height: 200px;
    overflow-y: auto;
    background: #222;
    padding: 10px;
    border-radius: 3px;
    flex-grow: 1;
}

.event {
    margin: 5px 0;
    padding: 5px;
    background: #333;
    border-radius: 3px;
    font-size: 14px;
}

#game-timer {
    font-weight: bold;
    color: var(--win-color);
}

.hidden {
    display: none;
}

audio {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 250px;
}

.win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--win-color);
    text-align: center;
    z-index: 10;
}

.win-screen h2 {
    font-size: 3em;
    text-shadow: 2px 2px 4px #000;
}

.win-screen button {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    background: var(--win-color);
    border: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.win-screen button:hover {
    background: #ffcc00;
}

/* Estilos do Tutorial */
.tutorial-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text);
    text-align: center;
    z-index: 100;
    padding: 20px;
    box-sizing: border-box;
    /* Adicione estas três linhas para centralizar o conteúdo */
    display: flex;
    justify-content: center;
    align-items: center;
}

.tutorial-screen h2 {
    font-size: 2.5em;
    color: var(--win-color);
}

.tutorial-screen p, .tutorial-screen li {
    font-size: 1.1em;
    line-height: 1.5;
    max-width: 800px;
    margin: 10px 0;
    text-align: left;
}

.tutorial-tips {
    background: #333;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.tutorial-screen ul {
    list-style-type: none;
    padding: 0;
}

.tutorial-screen li {
    margin-bottom: 5px;
}

#start-game-button {
    margin-top: 30px;
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    background: var(--win-color);
    border: none;
    border-radius: 5px;
    transition: background 0.3s;
}

#start-game-button:hover {
    background: #ffcc00;
}

/* Novos Estilos para Animações de Eventos */
#event-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99;
    transition: background 0.2s ease-out;
}

#event-icon {
    font-size: 10em;
    opacity: 0;
    transition: opacity 0.5s;
    text-shadow: 0 0 15px rgba(0,0,0,0.8);
}

.event-good #event-icon {
    color: #4CAF50;
    animation: pulse-good 0.7s forwards;
}

.event-bad #event-icon {
    color: #F44336;
    animation: pulse-bad 0.7s forwards;
}

/* Animações de fundo da tela */
.flash-good {
    animation: flash-good 0.5s ease-in-out;
}

.flash-bad {
    animation: flash-bad 0.5s ease-in-out;
}

@keyframes flash-good {
    0% { background: rgba(0, 255, 0, 0); }
    50% { background: rgba(0, 255, 0, 0.1); }
    100% { background: rgba(0, 255, 0, 0); }
}

@keyframes flash-bad {
    0% { background: rgba(255, 0, 0, 0); }
    50% { background: rgba(255, 0, 0, 0.1); }
    100% { background: rgba(255, 0, 0, 0); }
}

/* Animações de ícones */
@keyframes pulse-good {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes pulse-bad {
    0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 0; }
}