/* style.css - Pixel Detective */
:root {
    --color-midnight: #0a0e17;
    --color-deep-purple: #13192b;
    --color-neon-green: #00ff88;
    --color-neon-green-dim: rgba(0, 255, 136, 0.2);
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-glass: rgba(19, 25, 43, 0.85);
    --color-border: rgba(0, 255, 136, 0.3);
    
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-midnight);
    color: var(--color-text);
    font-family: var(--font-ui);
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% 40%, rgba(19, 25, 43, 0.9) 0%, var(--color-midnight) 100%),
        linear-gradient(rgba(0, 255, 136, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.04) 1px, transparent 1px);
    background-size: 100% 100%, 24px 24px, 24px 24px;
    min-height: 100vh;
}

.game-container {
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Header / HUD */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--color-glass);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    margin-top: 50px;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.85rem;
}

.level-info {
    text-align: center;
    flex-grow: 1;
}

#level-title {
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-neon-green);
    font-size: 1.05rem;
}

.progress-bar-container {
    width: 220px;
    height: 8px;
    background: rgba(0,0,0,0.6);
    border-radius: 4px;
    margin: 6px auto 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff88, #00d4ff);
    box-shadow: 0 0 10px var(--color-neon-green);
    transition: width 0.3s ease;
}

.score-container {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
    color: #facc15;
}

/* Screen Container */
.screen-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.screen {
    display: none !important;
    width: 100%;
    max-width: 800px;
}

.screen.active {
    display: block !important;
    animation: fadeIn 0.4s ease forwards;
}

.screen.hidden {
    display: none !important;
}

.level-ui {
    display: none !important;
    width: 100%;
}

.level-ui.active {
    display: block !important;
    animation: fadeIn 0.35s ease forwards;
}

.level-ui.hidden {
    display: none !important;
}

.noir-card {
    border: 1px solid var(--color-border);
    box-shadow: 0 12px 40px rgba(0, 255, 136, 0.1), 0 0 20px rgba(0, 0, 0, 0.8);
    padding: 2.2rem;
    border-radius: 18px;
}

.noir-badge {
    display: inline-block;
    background: rgba(0, 255, 136, 0.12);
    border: 1px solid var(--color-neon-green);
    color: var(--color-neon-green);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.game-title {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    margin-bottom: 0.5rem;
}

.game-description {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.levels-overview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 1.5rem auto;
    max-width: 520px;
    text-align: left;
}

.level-pill {
    background: rgba(10, 15, 29, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.92rem;
}

.start-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.neon-btn {
    background: linear-gradient(135deg, #00ff88 0%, #00b359 100%) !important;
    color: #05140b !important;
    font-weight: 800 !important;
    border: none;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}
.neon-btn:hover {
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.7);
}

.neon-text {
    color: var(--color-neon-green);
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.edu-box {
    background: rgba(10, 15, 29, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-size: 1.1rem;
    line-height: 1.7;
    text-align: left;
}

/* Level UI Styling */
.canvas-wrapper {
    position: relative;
    display: inline-block;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    margin: 12px auto;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 1rem auto 0;
}

.option-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.option-btn:hover {
    background: var(--color-neon-green);
    color: #05140b;
    border-color: var(--color-neon-green);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

/* Level 2 Color Picker */
.color-picker-layout {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.color-comparison {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.color-box {
    text-align: center;
    font-size: 0.85rem;
}

.color-swatch {
    width: 90px;
    height: 70px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin-top: 6px;
}

.magnifier {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid #00ff88;
    border-radius: 50%;
    box-shadow: 0 0 15px #00ff88;
    pointer-events: none;
    transform: translate(-50%, -50%);
    display: none;
}

.sliders {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 280px;
}

.slider-group {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 8px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.slider-group input[type="range"] {
    width: 100%;
    accent-color: var(--color-neon-green);
}
.slider-group.red input[type="range"] { accent-color: #ef4444; }
.slider-group.green input[type="range"] { accent-color: #10b981; }
.slider-group.blue input[type="range"] { accent-color: #3b82f6; }

/* Level 3 Matrix */
.matrix-layout {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.matrix-target, .matrix-builder {
    text-align: center;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(2, 44px);
    gap: 8px;
    margin-top: 8px;
}

.palette-color {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s;
}
.palette-color.selected {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255,255,255,0.6);
}

/* Level 4 Depth Sorting */
.depth-flex {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.depth-item {
    background: rgba(30, 41, 59, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.depth-item:active {
    cursor: grabbing;
    transform: scale(1.05);
    border-color: var(--color-neon-green);
}
.depth-item canvas {
    border-radius: 6px;
    image-rendering: pixelated;
}
.depth-item-controls {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.depth-shift-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.8rem;
}
.depth-shift-btn:hover {
    background: var(--color-neon-green);
    color: #000;
}

/* Level 5 Timer & Resolution */
.timer-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.5);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
    transition: width 0.1s linear;
}

.res-image-box {
    background: #000;
    border: 2px dashed var(--color-neon-green);
    border-radius: 10px;
    padding: 2rem;
    margin: 1rem auto;
    max-width: 350px;
}

.res-label {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-neon-green);
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
}

/* End Summary */
.summary-box {
    background: rgba(10, 15, 29, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}
.summary-box ul {
    margin-top: 0.5rem;
    line-height: 1.7;
}

.final-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: #facc15;
    margin: 1rem 0;
}

@media (max-width: 600px) {
    .options-grid { grid-template-columns: 1fr; }
    .game-title { font-size: 2rem; }
    .color-picker-layout { flex-direction: column; }
}
