:root {
    --primary: #D4AF37; /* Luxury Gold */
    --primary-dark: #AA8B2C;
    --bg-light: #FDFBF7; /* Soft pastel white */
    --text-dark: #1A1A1A;
    --text-light: #7A7A7A;
    --white: #FFFFFF;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-deep: 0 20px 40px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

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

#game-container {
    position: relative;
    width: 100%;
    max-width: 480px; /* Mobile app feel */
    height: 100%;
    max-height: 900px;
    background: var(--bg-light);
    overflow: hidden;
    box-shadow: var(--shadow-deep);
}

@media (min-width: 768px) {
    #game-container {
        height: 90vh;
        border-radius: 40px;
        border: 8px solid var(--white);
    }
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Typography & Components */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
}

.btn-premium {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 30px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
}

.btn-premium:active {
    transform: scale(0.95);
}

.btn-premium.small {
    padding: 10px 20px;
    font-size: 0.8rem;
}

.btn-icon {
    background: var(--white);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}
.btn-icon:active { transform: scale(0.9); }

/* Tutorial Screen */
#tutorial-screen {
    background: linear-gradient(to bottom, #ffffff, #f0ebd8);
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 30px;
    z-index: 50;
}

.logo-3d h1 {
    font-size: 3rem;
    color: var(--text-dark);
    margin-bottom: -10px;
}
.logo-3d h2 {
    font-size: 1.2rem;
    color: var(--primary);
    letter-spacing: 4px;
    margin-bottom: 40px;
}

.tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 50px;
    width: 100%;
}

.step {
    background: var(--glass-bg);
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    transform: translateY(20px);
    animation: slideUp 0.5s forwards;
}
.step:nth-child(2) { animation-delay: 0.1s; }
.step:nth-child(3) { animation-delay: 0.2s; }

.step .icon { font-size: 1.8rem; }
.step p { font-weight: 500; color: var(--text-dark); }

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

/* Main Menu */
#main-menu {
    background: #fdfbf7;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    z-index: 20;
}

.player-stats {
    display: flex;
    gap: 15px;
}

.stat {
    background: var(--white);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 5px;
}

.menu-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.challenge-card {
    background: var(--white);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin-bottom: 30px;
    border: 1px solid rgba(0,0,0,0.02);
}

.challenge-image {
    height: 200px;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    position: relative;
}

.challenge-info {
    padding: 20px;
}

.challenge-info h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}
.challenge-info p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.4;
}

.tags {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tag {
    background: #f0f0f0;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dark);
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-btn {
    background: var(--white);
    border: none;
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-dark);
    cursor: pointer;
    transition: transform 0.2s;
}
.grid-btn:active { transform: scale(0.95); }
.grid-btn .icon { font-size: 2rem; }

/* Studio Interface */
#studio-screen {
    background: #e9e6e1; /* Studio wall color */
    overflow: hidden;
}

.studio-top {
    position: absolute;
    top: 0; left: 0; width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 30;
}

.challenge-brief {
    text-align: center;
    background: var(--glass-bg);
    padding: 10px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
}

.challenge-brief h4 {
    margin-bottom: 5px;
    font-size: 1rem;
}

.progress-bar {
    width: 100px;
    height: 6px;
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
    margin: 0 auto 4px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.viewport-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 65%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Soft 3D lighting background */
    background: radial-gradient(circle at 50% 30%, #ffffff 0%, #e9e6e1 70%);
}

#model-canvas {
    width: auto;
    height: 95%; /* Adjust based on device */
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 20px 20px rgba(0,0,0,0.15));
    transition: filter 0.3s ease;
}

.studio-bottom {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    height: 40%;
    background: var(--white);
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.category-tabs {
    display: flex;
    padding: 15px 20px 10px;
    gap: 15px;
    overflow-x: auto;
    scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    background: transparent;
    border: none;
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--text-light);
    font-size: 1rem;
    padding-bottom: 5px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s;
}

.tab-btn.active {
    color: var(--text-dark);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.items-grid {
    flex: 1;
    padding: 10px 20px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    overflow-y: auto;
    align-content: start;
}

.item-card {
    background: #f9f9f9;
    border-radius: 16px;
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.item-card:active {
    transform: scale(0.95);
}

.item-card.equipped {
    border-color: var(--primary);
    background: #fffdf5;
}

.item-card.equipped::before {
    content: '✓';
    position: absolute;
    top: 5px; right: 5px;
    background: var(--primary);
    color: white;
    width: 18px; height: 18px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.item-thumb {
    width: 80%;
    height: 80%;
    object-fit: contain;
    pointer-events: none;
}

/* Result Screen */
#result-screen {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(15px);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.result-content {
    background: var(--white);
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

#result-title {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.score-display {
    margin-bottom: 30px;
}

.stars {
    font-size: 1.5rem;
    letter-spacing: 5px;
    color: var(--primary);
}

#result-score {
    font-size: 4rem;
    color: var(--primary);
    margin-top: 10px;
    text-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

.rewards {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.reward-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-dark);
    margin-top: 5px;
}
