:root {
    --primary: #F39C12;
    --secondary: #F1C40F;
    --accent: #E74C3C;
    --bg: #1A1400;
    --text: #F5F5F5;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --radius: 12px;
}

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

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

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.hidden {
    display: none !important;
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Menu Screen */
#menu-screen {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.menu-content {
    max-width: 800px;
    width: 100%;
    padding: 40px;
    text-align: center;
}

h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 30px 0;
    max-height: 40vh;
    overflow-y: auto;
    padding: 10px;
}

.image-grid::-webkit-scrollbar {
    width: 8px;
}

.image-grid::-webkit-scrollbar-track {
    background: var(--bg);
}

.image-grid::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.image-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.image-item:hover {
    transform: scale(1.05);
}

.image-item.selected {
    border-color: var(--primary);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.difficulty-select {
    margin-bottom: 30px;
}

.difficulty-select label {
    margin-right: 10px;
}

.difficulty-select select {
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--primary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
    transform: translateY(-2px);
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary { 
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--bg); 
}
.secondary { 
    background: var(--glass);
    color: var(--text);
    border: 1px solid var(--glass-border);
}
.secondary:hover {
    background: var(--glass-border);
}
.accent { 
    background: linear-gradient(135deg, var(--accent), #C0392B);
    color: white; 
}

/* Game Screen */
#game-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

header {
    margin: 20px;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

#timer {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin: 0 20px 20px;
}

canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    touch-action: none;
}

/* Overlays */
#preview-overlay, #win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.preview-content, .win-content {
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#preview-img {
    max-width: 80vw;
    max-height: 70vh;
    border-radius: 8px;
}

.win-content h2 {
    font-size: 2.5rem;
    color: var(--primary);
}

/* Loader */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.loader-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--glass);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
