:root {
    --bg-color: #F8D359;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-primary: #333333;
    --text-secondary: #555555;
    --primary-btn: #FF6B6B;
    --primary-btn-hover: #FF5252;
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(-45deg, #FFDE6A, #F8D359, #FFC837, #FFD15C);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-primary);
    overflow: hidden;
    touch-action: none;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(20px) scale(0.98);
    padding: 20px;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Glassmorphism Components */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: none;
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* Typography */
.title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.tagline {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.highlight {
    color: var(--primary-btn);
    font-weight: 800;
}

.emoji {
    display: inline-block;
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Buttons */
.primary-btn {
    background: var(--primary-btn);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s;
}

.primary-btn:hover {
    background: var(--primary-btn-hover);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 30px rgba(255, 107, 107, 0.5);
}

.primary-btn:active {
    transform: translateY(1px) scale(0.98);
}

.tool-btn {
    background: #f0f0f0;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.tool-btn:active {
    transform: translateY(0);
}

/* Game Screen Layout */
#game-screen {
    justify-content: center;
    gap: 10px;
    padding: 20px;
    max-width: 800px;
    left: 0;
    right: 0;
    margin: 0 auto;
}

.game-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
    margin-bottom: 16px;
    font-size: 1.5rem;
    font-weight: 600;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prompt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.timer {
    font-variant-numeric: tabular-nums;
    color: #FF3B30;
    font-weight: 800;
}

.canvas-container {
    flex-grow: 1;
    width: 100%;
    max-height: 65vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
}

canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    display: block;
}

.guess-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 600;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.guess-success {
    background: #34C759;
    animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    0% { transform: translateX(-50%) scale(0.9); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.toolbar {
    width: 100%;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.color-picker {
    display: flex;
    gap: 12px;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s;
}

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

#result-drawing-container {
    margin: 20px 0;
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

#result-image {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin: 0 auto;
}

/* Review Screen Styles */
.review-panel {
    width: 90%;
    max-width: 800px;
    height: 90%;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.review-grid {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, 130px);
    justify-content: center;
    gap: 20px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 10px;
}

/* Detail Modal Styles */
.detail-overlay {
    background: rgba(0,0,0,0.8);
    z-index: 100;
}

.detail-card {
    width: 95%;
    max-width: 1000px;
    height: 90%;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 40px;
}

.btn-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-primary);
    z-index: 10;
}

.detail-content {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
    justify-content: center;
}

.detail-drawing-box {
    flex: 1;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    padding: 10px;
}

.detail-image {
    max-width: 100%;
    max-height: 350px;
}

/* Responsive Media Queries */
@media (max-width: 600px) {
    .glass-card, .detail-card {
        padding: 20px;
        width: 95%;
        margin: 0 auto;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .tagline {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .game-header {
        padding: 12px 16px;
        font-size: 1.2rem;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .color-picker {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .guess-overlay {
        font-size: 1rem;
        padding: 8px 16px;
        width: 90%;
        text-align: center;
    }

    .review-panel {
        padding: 15px;
        width: 95%;
    }

    .review-grid {
        grid-template-columns: repeat(auto-fit, 100px);
        justify-content: center;
        gap: 10px;
    }

    .detail-drawing-box {
        max-width: 100%;
    }

    .detail-image {
        max-height: 250px;
    }
}
