:root {
    --bg-color: #1A0D0D;
    --primary-color: #D63031;
    --secondary-color: #FF7675;
    --accent-color: #FDCB6E;
    --text-color: #F5F5F5;
    --glass-bg: rgba(214, 48, 49, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 850px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(214, 48, 49, 0.5);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn:hover, .btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(214, 48, 49, 0.4);
}

main {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.stats-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 25px;
    border-radius: var(--border-radius);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary-color);
}

.value {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-color);
}

.restart-btn {
    background: var(--primary-color);
    border: none;
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.restart-btn:active {
    transform: scale(0.9);
}

.canvas-wrapper {
    position: relative;
    max-width: 100%;
    overflow: auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #000;
}

#game-canvas {
    display: block;
    cursor: pointer;
}

.best-times {
    width: 100%;
    text-align: center;
}

.best-times h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.best-times-grid {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.best-item {
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 12px;
    border-radius: 20px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none;
    opacity: 0;
}

.modal {
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 30px rgba(214, 48, 49, 0.3);
    max-width: 90%;
}

.modal h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.modal p {
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(214, 48, 49, 0.4);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}
