:root {
    --color-bg: #78350F;
    --color-surface: #2D1B1B;
    --color-primary: #F59E0B;
    --color-secondary: #FBBF24;
    --color-accent: #FDE68A;
    --color-text: #FFFFFF;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

h1 {
    margin: 0 0 10px 0;
    color: var(--color-primary);
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

#hud {
    display: flex;
    justify-content: center;
    gap: 30px;
    background-color: var(--color-surface);
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-item {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--color-accent);
}

.hud-item span {
    color: var(--color-text);
    margin-left: 5px;
}

main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

canvas {
    background-color: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    max-width: 100%;
    max-height: 100%;
    touch-action: none;
}

footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
    flex-shrink: 0;
    flex-wrap: wrap;
}

button {
    background-color: var(--color-surface);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    background-color: var(--color-primary);
    color: var(--color-surface);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

#btn-new-game {
    background-color: var(--color-primary);
    color: var(--color-bg);
}

#btn-new-game:hover {
    background-color: var(--color-secondary);
}

/* Overlay Styles */
#overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.hidden { display: none !important; }

.modal {
    background: var(--color-surface);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid var(--color-primary);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
    max-width: 90%;
    width: 300px;
    animation: slideUp 0.3s ease;
}

.modal h2 {
    color: var(--color-primary);
    margin-top: 0;
    font-size: 2rem;
}

.modal p {
    font-size: 1.2rem;
    margin: 20px 0;
    color: var(--color-text);
}

#overlay-score {
    color: var(--color-accent);
    font-weight: bold;
    font-size: 1.5rem;
}

#btn-next-level {
    background-color: var(--color-primary);
    color: var(--color-bg);
    width: 100%;
    margin-top: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    #hud { padding: 10px 20px; gap: 15px; }
    .hud-item { font-size: 0.9rem; }
    footer { gap: 10px; }
    button { padding: 10px 16px; font-size: 0.9rem; }
}
