:root {
    --bg-dark: #0a0a0f;
    --glass-bg: rgba(20, 20, 30, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --neon-blue: #00f3ff;
    --neon-red: #ff3366;
    --neon-cyan: #00e5ff;
    --neon-cyan-glow: rgba(0, 229, 255, 0.5);
    --primary-text: #ffffff;
    --secondary-text: #8b8b99;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--primary-text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 1;
}

.ambient-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle, rgba(0,243,255,0.15) 0%, rgba(10,10,15,0) 70%);
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    transition: background 1s ease;
}

.ambient-glow.hot {
    background: radial-gradient(circle, rgba(255,51,102,0.15) 0%, rgba(10,10,15,0) 70%);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #fff, var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header h1 span {
    color: var(--neon-red);
    -webkit-text-fill-color: initial;
    text-shadow: 0 0 10px rgba(255,51,102,0.5);
}

main {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

/* Thermometers */
.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.thermo-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.thermo-label {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--secondary-text);
}

.bar-bg {
    height: 24px;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,0.05);
}

.bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 12px;
}

.heat-gradient {
    background: linear-gradient(90deg, #ff9a44, var(--neon-red));
    box-shadow: 0 0 10px var(--neon-red);
}

.ice-gradient {
    background: linear-gradient(90deg, #00c6ff, var(--neon-blue));
    box-shadow: 0 0 10px var(--neon-blue);
}

.temp-readout {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 800;
    text-align: right;
}

.heat-text { color: var(--neon-red); }
.ice-text { color: var(--neon-blue); }

/* Center Stage & 3D Cube */
.stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#ice-cube-container {
    width: 200px;
    height: 200px;
    perspective: 1000px;
}

#ice-cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(45deg);
    transition: transform 0.5s ease;
    animation: rotateCube 15s infinite linear;
}

@keyframes rotateCube {
    0% { transform: rotateX(-20deg) rotateY(0deg); }
    100% { transform: rotateX(-20deg) rotateY(360deg); }
}

.cube-face {
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(0, 243, 255, 0.2);
    border: 2px solid rgba(0, 243, 255, 0.5);
    box-shadow: inset 0 0 40px rgba(0, 243, 255, 0.4), 0 0 20px rgba(0, 243, 255, 0.2);
    backdrop-filter: blur(4px);
}

.front  { transform: translateZ(100px); }
.back   { transform: rotateY(180deg) translateZ(100px); }
.right  { transform: rotateY(90deg) translateZ(100px); }
.left   { transform: rotateY(-90deg) translateZ(100px); }
.top    { transform: rotateX(90deg) translateZ(100px); }
.bottom { transform: rotateX(-90deg) translateZ(100px); }


/* Winter Coat Layers */
#coat-container {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 240px;
    height: 240px;
    transform-style: preserve-3d;
    pointer-events: none; /* Let clicks pass only to individual layers via pointer-events:auto */
}

.coat-layer {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateZ(110px);
}

.coat-layer:hover {
    transform: translateZ(120px) scale(1.05);
}

.coat-layer.ripped {
    opacity: 0;
    transform: translateZ(200px) translateY(-100px) scale(1.2) rotate(20deg);
    pointer-events: none;
}

#coat-1 { background: #5a5a66; border: 2px solid #777; z-index: 10; transform: translateZ(110px);}
#coat-2 { background: #3d5a4a; border: 2px solid #4a755b; z-index: 20; transform: translateZ(115px);}
#coat-3 { background: #b34d4d; border: 4px solid #803030; z-index: 30; transform: translateZ(120px);} /* Week 3 Parka */

#coat-3::after {
    content: '';
    position: absolute;
    top: 5px; right: 5px; bottom: 5px; left: 5px;
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 15px;
    pointer-events: none;
}

.coat-name {
    font-weight: 800;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 0.5rem;
}

.click-hint {
    font-size: 0.7rem;
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Visual Cooling Elements */
#cooling-zone {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 5;
}

.placed-cooler {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--neon-cyan);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan-glow);
    animation: float 3s infinite ease-in-out;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Inventory */
.inventory {
    position: relative;
    display: flex;
    flex-direction: column;
}

.inventory h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--neon-cyan);
}

.lock-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10,10,15,0.8);
    backdrop-filter: blur(4px);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1rem;
    border-radius: 16px;
    color: var(--neon-red);
    font-weight: 600;
    transition: opacity 0.5s ease;
}

.inventory.unlocked .lock-overlay {
    opacity: 0;
    pointer-events: none;
}

.tools {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.glass-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.glass-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.glass-btn:hover::before {
    left: 150%;
}

.glass-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan-glow);
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tool-btn .icon {
    font-size: 1.8rem;
}

.tool-btn .details {
    display: flex;
    flex-direction: column;
}

.tool-btn .name {
    font-weight: 600;
    font-size: 1rem;
}

.tool-btn .power {
    font-size: 0.8rem;
    color: var(--neon-cyan);
    font-family: monospace;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    text-align: center;
    max-width: 400px;
    padding: 2.5rem;
    border-color: var(--neon-red);
    box-shadow: 0 0 50px rgba(255,51,102,0.3);
}

#modal-title {
    font-size: 2.5rem;
    color: var(--neon-red);
    margin-bottom: 1rem;
}

.score-display {
    font-size: 1.2rem;
    margin: 1.5rem 0;
    color: var(--secondary-text);
}

.glass-btn.primary {
    background: rgba(255,51,102,0.1);
    border-color: var(--neon-red);
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    width: 100%;
}

.glass-btn.primary:hover {
    background: rgba(255,51,102,0.3);
    box-shadow: 0 0 20px rgba(255,51,102,0.5);
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        overflow-y: auto;
    }
    .stage {
        min-height: 350px;
    }
}
