/* style.css - Compress Quest (Cyberpunk / Terminal Neon Theme) */
:root {
    --color-bg: #061325;
    --color-surface: #0f2744;
    --color-accent: #00d4ff;
    --color-accent-dim: rgba(0, 212, 255, 0.15);
    --color-text: #f8fafc;
    --color-text-muted: #94a3b8;
    --color-error: #f43f5e;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-glass: rgba(15, 39, 68, 0.85);
    --color-border: rgba(0, 212, 255, 0.3);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 50% 30%, rgba(15, 39, 68, 0.8) 0%, var(--color-bg) 90%),
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px, 30px 30px;
}

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

.hidden {
    display: none !important;
}

/* Screen Management */
.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: 900px;
}

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

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

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

.level-ui.active {
    display: block !important;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Top 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;
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

#level-title {
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-accent);
    font-size: 1.05rem;
    font-family: 'JetBrains Mono', monospace;
}

.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, var(--color-accent) 0%, #10b981 100%);
    box-shadow: 0 0 10px var(--color-accent);
    transition: width 0.3s ease;
}

.score-container {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #facc15;
}

/* Card Containers */
.cq-card {
    background: linear-gradient(135deg, rgba(15, 39, 68, 0.92) 0%, rgba(6, 19, 37, 0.95) 100%);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 18px;
    padding: 2.2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 212, 255, 0.12);
    margin: auto;
    width: 100%;
}

.cq-badge {
    display: inline-block;
    background: var(--color-accent-dim);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 0.8rem;
}

.cq-title {
    font-size: clamp(2rem, 3.5vw, 2.8rem);
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 25px rgba(0, 212, 255, 0.5);
    margin: 0.4rem 0 0.8rem 0;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    line-height: 1.5;
    max-width: 680px;
    margin: 0 auto 1.5rem auto;
}

.controls-legend-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    line-height: 1.7;
    font-size: 0.95rem;
}

.levels-list-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.cq-level-pill {
    background: rgba(15, 39, 68, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.2);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* In-Game Concept Box */
.in-game-concept-box {
    background: rgba(15, 39, 68, 0.85);
    border-left: 4px solid var(--color-accent);
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.concept-icon {
    font-size: 1.4rem;
}

/* Level UI & Canvas Layouts */
.level-header-box h2 {
    color: var(--color-accent);
    font-size: 1.5rem;
    margin: 0.4rem 0;
}

.instruction-text {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-bottom: 1.2rem;
}

.canvas-container {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.compare-card {
    background: rgba(15, 39, 68, 0.7);
    border: 2px solid rgba(0, 212, 255, 0.25);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 248px;
}

.compare-card:hover:not(.locked) {
    border-color: var(--color-accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
}

.compare-card.locked {
    cursor: default;
}

.compare-card.correct-choice {
    border-color: var(--color-success) !important;
    background: rgba(16, 185, 129, 0.15);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5) !important;
}

.compare-card.wrong-choice {
    border-color: var(--color-error) !important;
    background: rgba(244, 63, 94, 0.15);
    box-shadow: 0 0 30px rgba(244, 63, 94, 0.5) !important;
}

.card-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 8px;
    font-size: 1rem;
}

.canvas-wrapper canvas {
    background: #000;
    border-radius: 8px;
    display: block;
}

.card-hint-text {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

/* Level 2 Slider */
.preview-box canvas {
    background: #000;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.slider-container {
    max-width: 440px;
    margin: 1.2rem auto;
    background: rgba(0,0,0,0.4);
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider-container input[type=range] {
    width: 100%;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.slider-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.95rem;
}

/* Level 3 & 4 Scenario Cards */
.scenario-details-card {
    background: rgba(15, 39, 68, 0.65);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 14px;
    padding: 1.8rem;
    max-width: 580px;
    margin: 1.2rem auto;
}

.scenario-formula-tip {
    background: rgba(0, 212, 255, 0.1);
    border-left: 3px solid var(--color-accent);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.88rem;
    text-align: left;
    margin-bottom: 1rem;
}

.case-study-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.format-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 1rem;
}

.format-btn {
    background: rgba(15, 39, 68, 0.9);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #fff;
    padding: 14px 10px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.format-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    background: rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
}

.format-btn.btn-correct {
    border-color: var(--color-success) !important;
    background: rgba(16, 185, 129, 0.25) !important;
    color: #34d399 !important;
}

.format-btn.btn-wrong {
    border-color: var(--color-error) !important;
    background: rgba(244, 63, 94, 0.25) !important;
    color: #fb7185 !important;
}

.loss-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn-lossless {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    color: #34d399;
    padding: 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lossless:hover {
    background: rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.btn-lossy {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid #f59e0b;
    color: #fbbf24;
    padding: 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-lossy:hover {
    background: rgba(245, 158, 11, 0.3);
    transform: translateY(-2px);
}

/* Feedback Box */
.feedback {
    margin-top: 1.2rem;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    min-height: 24px;
    font-size: 0.95rem;
    display: none;
}

.feedback.correct {
    display: block;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--color-success);
    color: #34d399;
}

.feedback.wrong {
    display: block;
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid var(--color-error);
    color: #fb7185;
}

/* End Screen */
.final-score-box {
    font-size: 1.6rem;
    font-weight: 700;
    color: #facc15;
    margin: 1.2rem 0;
}

.results-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
}

.learning-summary {
    line-height: 1.8;
    padding-left: 1.2rem;
    color: var(--color-text);
}

.learning-summary li {
    margin-bottom: 0.6rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

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

.pulse-anim {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 15px rgba(0, 212, 255, 0.4); }
    50% { box-shadow: 0 0 30px rgba(0, 212, 255, 0.8); }
    100% { box-shadow: 0 0 15px rgba(0, 212, 255, 0.4); }
}
