:root {
    --primary: #6c5ce7;
    --primary-dark: #4834d4;
    --secondary: #00cec9;
    --accent: #fd79a8;
    --bg-color: #f8f9fa;
    --surface: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border-radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--surface);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.game-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.level-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #f1f2f6;
    padding: 6px 12px;
    border-radius: 20px;
}

#game-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 0 20px;
    position: relative;
    min-height: 70vh;
}

.screen {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.screen.active {
    display: block;
}

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

/* Main Menu */
.welcome-text {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-text h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.welcome-text p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.menu-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 700px;
    margin: 0 auto;
}

.menu-btn {
    background: var(--surface);
    border: none;
    padding: 25px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border: 2px solid transparent;
}

.menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(108, 92, 231, 0.15);
    border-color: var(--primary);
}

.btn-icon {
    font-size: 2.5rem;
}

/* Category Selection Grid */
.category-header {
    text-align: center;
    margin-bottom: 30px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.grid-item {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #edf2f7;
}

.grid-item:hover {
    transform: scale(1.05);
    border-color: var(--secondary);
    box-shadow: 0 10px 20px rgba(0, 206, 201, 0.15);
}

.grid-item-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.grid-item-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.back-btn-large {
    display: block;
    margin: 0 auto;
    background: #f1f2f6;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
}

.back-btn-large:hover {
    background: #dfe4ea;
    color: var(--text-main);
}

/* Gameplay Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#current-drawing-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.icon-btn {
    background: var(--surface);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn:hover {
    background: #f1f2f6;
    transform: scale(1.1);
}

.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02), 0 10px 30px rgba(0,0,0,0.05);
    overflow: hidden;
    touch-action: none; /* Prevent scrolling while drawing */
}

#drawing-canvas, #tracing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#tracing-canvas {
    pointer-events: none; /* Let clicks pass through to drawing canvas */
    opacity: 0.5;
}

#drawing-hint {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    transition: opacity 0.3s;
}

.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.tool-picker {
    display: flex;
    gap: 10px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: 0.2s;
}

.tool-btn.active {
    transform: scale(1.2);
    border-color: var(--surface);
    box-shadow: 0 0 0 2px var(--primary);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.control-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.control-btn.primary:hover {
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
    transform: translateY(-2px);
}

/* Success Screen */
.overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.overlay-screen.hidden {
    display: none;
}

.success-card {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

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

.highlight {
    color: var(--accent);
    font-weight: bold;
}

.art-frame {
    width: 200px;
    height: 200px;
    margin: 20px auto;
    border: 8px solid #f1f2f6;
    border-radius: 12px;
    background: white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

#result-canvas {
    width: 100%;
    height: 100%;
}

.stars {
    font-size: 2.5rem;
    margin: 20px 0;
    color: #f1c40f;
}

.success-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.game-btn.primary {
    background: var(--primary);
    color: white;
}

.game-btn.secondary {
    background: #f1f2f6;
    color: var(--text-main);
}

.game-btn:hover {
    transform: translateY(-2px);
}

/* SEO Section */
.seo-section {
    background: white;
    padding: 50px 20px;
    margin-top: 50px;
    border-top: 1px solid #eee;
}

.seo-content {
    max-width: 800px;
    margin: 0 auto;
}

.seo-content h2, .seo-content h3 {
    color: var(--text-main);
    margin-bottom: 20px;
}

.seo-content p {
    line-height: 1.8;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.seo-content ul {
    line-height: 2;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.seo-content strong {
    color: var(--text-main);
}
