:root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-red: #ff4d4d;
    --accent-purple: #9b59b6;
    --accent-gold: #f1c40f;
    --accent-green: #2ecc71;
    --panel-bg: rgba(0, 0, 0, 0.85);
    --border-tribal: 4px solid #5d4037;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: #111;
    color: var(--text-color);
    font-family: 'Cinzel', serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: radial-gradient(circle at center, #222 0%, #000 100%);
}

/* GAME CONTAINER */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 1200px;
    max-height: 900px;
    background: #000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    border: 2px solid #333;
}

/* CANVAS – corrigido! */
canvas {
    display: block;
    image-rendering: pixelated;
}

/* UI LAYER */
#ui-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* STATS PANEL */
#stats-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.stat-box {
    background: var(--panel-bg);
    padding: 10px 15px;
    border: 2px solid #444;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

.stat-box.red { border-color: var(--accent-red); color: var(--accent-red); }
.stat-box.purple { border-color: var(--accent-purple); color: var(--accent-purple); }
.stat-box.gold { border-color: var(--accent-gold); color: var(--accent-gold); }
.stat-box.blue { border-color: #3498db; color: #3498db; }

/* MESSAGE LOG */
#message-log {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 400px;
    height: 150px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    font-size: 0.9rem;
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;
}

.log-entry { margin-bottom: 4px; opacity: 0.8; }
.log-entry:last-child { font-weight: bold; color: #fff; opacity: 1; font-size: 1rem; }

/* MODALS */
.modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    border: 4px solid var(--accent-gold);
    background: radial-gradient(circle, #2c1e1e 0%, #1a0f0f 100%);
    box-shadow: 0 0 30px var(--accent-red);
    clip-path: polygon(5% 0%, 95% 0%, 100% 5%, 100% 95%, 95% 100%, 
                       5% 100%, 0% 95%, 0% 5%);
}

h1 {
    font-family: 'Rye', serif;
    font-size: 4rem;
    color: var(--accent-red);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--accent-red);
}

.subtitle {
    font-size: 1.5rem;
    color: var(--accent-gold);
    margin-bottom: 30px;
    font-style: italic;
}

.lore {
    margin-bottom: 40px;
    line-height: 1.6;
    color: #ccc;
}

button.tribal-btn {
    background: linear-gradient(45deg, #8e44ad, #c0392b);
    border: none;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-family: 'Rye', serif;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-shadow: 1px 1px 2px #000;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0% 100%);
}

button.tribal-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--accent-purple);
}

/* SHAKE EFFECT */
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
    animation: shake 0.5s;
    animation-iteration-count: 1;
}
