/* Main CSS Styling for Solstice Protocol - Game Jam Edition */

:root {
    --bg-dark: #070913;
    --neon-cyan: #00f0ff;
    --neon-gold: #ffbd00;
    --neon-red: #ff2e63;
    --neon-green: #39ff14;
    --panel-border: rgba(0, 240, 255, 0.2);
    --panel-bg: rgba(7, 9, 19, 0.75);
    --font-header: 'Orbitron', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --crt-glow: 0 0 10px rgba(0, 240, 255, 0.4);
}

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

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    font-family: var(--font-mono);
    color: #ffffff;
    overflow: hidden;
}

/* App Container */
#app {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    overflow: hidden;
}

/* Phaser Container */
#game-container {
    flex: 1;
    height: 100%;
    position: relative;
    z-index: 1;
    background: #030408;
}

/* --- High-Tech HUD Sidebar (Side Material) --- */
#hud {
    order: -1; /* Place on the left of the game canvas */
    width: 290px;
    height: 100%;
    background: #060810;
    border-right: 2px solid var(--neon-cyan);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.8), inset -5px 0 15px rgba(0, 240, 255, 0.02);
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
    gap: 24px;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: all 0.5s ease;
}

.hud-hidden {
    display: none !important;
}

.hud-panel {
    background: rgba(12, 16, 30, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.left-panel {
    border-left: 4px solid var(--neon-cyan);
    width: 100%;
}

.system-status {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    font-weight: bold;
    text-shadow: var(--crt-glow);
}

.level-indicator {
    font-family: var(--font-header);
    font-size: 20px;
    font-weight: 700;
}

.node-counter {
    font-size: 14px;
    color: #8fa0b5;
}

/* Central Daylight Progress */
.center-panel {
    width: 100%;
    max-width: 100%;
    align-items: stretch;
    border-left: 4px solid var(--neon-gold);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.daylight-label {
    font-family: var(--font-header);
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255, 189, 0, 0.4);
}

.daylight-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 189, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    margin: 4px 0;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8);
}

#daylight-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff5e00, var(--neon-gold), #ffe600);
    box-shadow: 0 0 10px var(--neon-gold);
    transition: width 0.3s linear, background 0.5s ease;
}

.daylight-percentage {
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
}

#alert-ticker {
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    width: 100%;
    margin-top: 3px;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-normal {
    color: var(--neon-cyan);
}

.alert-warning {
    color: var(--neon-gold);
    animation: alert-blink 1s infinite alternate;
}

.alert-critical {
    color: var(--neon-red);
    text-shadow: 0 0 8px var(--neon-red);
    animation: alert-blink-fast 0.5s infinite alternate;
}

/* Right buttons panel */
.right-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.hud-btn {
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.hud-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--neon-cyan);
    text-shadow: var(--crt-glow);
    box-shadow: var(--crt-glow);
}

.glow-btn {
    border-color: var(--neon-gold);
    color: var(--neon-gold);
    background: rgba(255, 189, 0, 0.05);
}

.glow-btn:hover {
    background: rgba(255, 189, 0, 0.2);
    border-color: var(--neon-gold);
    box-shadow: 0 0 10px rgba(255, 189, 0, 0.5);
    text-shadow: 0 0 5px var(--neon-gold);
}

/* --- Gemini Oracle Sidebar (AI Element) --- */
#oracle-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: rgba(5, 7, 15, 0.95);
    border-left: 2px solid var(--neon-cyan);
    z-index: 30;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.8);
}

.oracle-closed {
    transform: translateX(100%);
}

.oracle-header {
    padding: 18px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 240, 255, 0.03);
}

.oracle-title {
    font-family: var(--font-header);
    font-size: 15px;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: var(--crt-glow);
    letter-spacing: 1px;
}

.oracle-close-x {
    background: none;
    border: none;
    color: #8fa0b5;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.oracle-close-x:hover {
    color: var(--neon-red);
}

/* Terminal Screen with CRT Vibes */
.oracle-terminal {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #030409;
    position: relative;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
}

/* CRT Screen Scanlines & Curve Overlay */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
    z-index: 5;
}

.oracle-log-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: flex-end;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
}

.log-entry {
    position: relative;
}

.system-msg {
    color: #4f6b8c;
    font-style: italic;
}

.loading-msg {
    animation: loader-pulse 1.2s infinite ease-in-out;
    color: var(--neon-cyan) !important;
}

@keyframes loader-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; text-shadow: 0 0 8px var(--neon-cyan); }
}

.oracle-msg {
    color: var(--neon-cyan);
    text-shadow: 0 0 4px rgba(0, 240, 255, 0.3);
    border-left: 2px solid var(--neon-cyan);
    padding-left: 8px;
}

.user-msg {
    color: var(--neon-gold);
    text-align: right;
    align-self: flex-end;
    background: rgba(255, 189, 0, 0.05);
    padding: 6px 10px;
    border-radius: 4px;
    border-right: 2px solid var(--neon-gold);
    max-width: 85%;
}

.oracle-input-area {
    display: flex;
    align-items: center;
    background: #070912;
    padding: 12px 18px;
    gap: 10px;
    z-index: 10;
}

.prompt-arrow {
    color: var(--neon-cyan);
    font-weight: bold;
    font-size: 16px;
    animation: blink-cursor 0.8s infinite steps(2, start);
}

#oracle-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 14px;
    outline: none;
    width: 100%;
}

#oracle-submit-btn {
    background: var(--neon-cyan);
    color: #030409;
    border: none;
    font-family: var(--font-header);
    font-weight: bold;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: var(--crt-glow);
    transition: all 0.3s;
}

#oracle-submit-btn:hover {
    background: #ffffff;
    box-shadow: 0 0 15px #ffffff;
}

/* --- Puzzle Overlay Modal --- */
#puzzle-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(3, 4, 8, 0.8);
    backdrop-filter: blur(5px);
    transition: opacity 0.4s ease;
}

.modal-hidden {
    opacity: 0;
    pointer-events: none !important;
}

.glassmorphism {
    background: rgba(10, 15, 30, 0.92);
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.25), inset 0 0 20px rgba(0, 240, 255, 0.05);
    border-radius: 12px;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 680px;
    height: auto;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 240, 255, 0.05);
}

.modal-title {
    font-family: var(--font-header);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--neon-cyan);
    text-shadow: var(--crt-glow);
}

.modal-sector {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--neon-gold);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.puzzle-description {
    font-size: 14px;
    line-height: 1.6;
    color: #b2c9e3;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 18px;
    border-radius: 6px;
    border-left: 3px solid var(--neon-gold);
}

/* Dynamic workspace container */
.puzzle-workspace {
    flex: 1;
    min-height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px dashed rgba(0, 240, 255, 0.25);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(0, 240, 255, 0.02);
}

.modal-btn {
    font-family: var(--font-header);
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background: var(--neon-cyan);
    color: #030409;
    border: 1px solid var(--neon-cyan);
    box-shadow: var(--crt-glow);
}

.primary-btn:hover {
    background: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 0 15px #ffffff;
}

.secondary-btn {
    background: rgba(255, 189, 0, 0.05);
    border: 1px solid rgba(255, 189, 0, 0.4);
    color: var(--neon-gold);
}

.secondary-btn:hover {
    background: rgba(255, 189, 0, 0.2);
    border-color: var(--neon-gold);
    box-shadow: 0 0 10px rgba(255, 189, 0, 0.4);
}

.bypass-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #a0aab8;
}

.bypass-btn:hover {
    background: rgba(255, 46, 99, 0.15);
    border-color: var(--neon-red);
    color: var(--neon-red);
}

/* --- General Overlay Cards --- */
#pause-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 4, 8, 0.85);
    z-index: 25;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease;
}

.overlay-hidden {
    opacity: 0;
    pointer-events: none !important;
}

.overlay-card {
    padding: 40px;
    border-radius: 12px;
    border: 2px solid var(--neon-gold);
    max-width: 440px;
    width: 90%;
    box-shadow: 0 0 30px rgba(255, 189, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.overlay-card h2 {
    font-family: var(--font-header);
    font-size: 24px;
    color: var(--neon-gold);
    letter-spacing: 3px;
    text-shadow: 0 0 8px rgba(255, 189, 0, 0.4);
}

.overlay-card p {
    font-size: 14px;
    color: #a0b6d2;
    text-align: center;
    line-height: 1.6;
}

.button-group {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 10px;
}

.menu-btn {
    flex: 1;
    background: rgba(255, 189, 0, 0.05);
    border: 1px solid rgba(255, 189, 0, 0.5);
    color: var(--neon-gold);
    font-family: var(--font-header);
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.menu-btn:hover {
    background: var(--neon-gold);
    color: #030409;
    box-shadow: 0 0 15px rgba(255, 189, 0, 0.5);
}

.reset-btn {
    border-color: rgba(255, 46, 99, 0.5);
    color: var(--neon-red);
    background: rgba(255, 46, 99, 0.05);
}

.reset-btn:hover {
    background: var(--neon-red);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 46, 99, 0.5);
}

/* --- Puzzle Type Specific Styles --- */

/* Logic Pattern styles */
.logic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}
.logic-row {
    display: flex;
    gap: 12px;
}
.logic-cell {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 6px;
    font-family: var(--font-header);
    font-size: 20px;
    font-weight: bold;
    color: var(--neon-cyan);
}
.logic-input {
    width: 50px;
    height: 50px;
    background: rgba(0, 240, 255, 0.1);
    border: 2px solid var(--neon-cyan);
    border-radius: 6px;
    font-family: var(--font-header);
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    outline: none;
    box-shadow: var(--crt-glow);
}

/* Binary puzzle styles */
.binary-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}
.binary-equation {
    font-size: 16px;
    color: var(--neon-gold);
    margin-bottom: 10px;
}
.binary-row {
    display: flex;
    gap: 10px;
}
.binary-bit-btn {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #8fa0b5;
    font-family: var(--font-header);
    font-size: 18px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.binary-bit-btn.bit-active {
    background: rgba(57, 255, 20, 0.15);
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}
.binary-target {
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
    color: #ffffff;
}

/* Code Debugging styles */
.debug-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}
.code-window {
    background: #020306;
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    padding: 15px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.7;
    overflow-x: auto;
}
.code-keyword { color: #f97316; }
.code-type { color: #3b82f6; }
.code-string { color: #10b981; }
.code-comment { color: #64748b; }
.code-select {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-family: inherit;
    font-size: 13px;
    border-radius: 3px;
    outline: none;
    padding: 1px 4px;
    cursor: pointer;
}

/* Cipher puzzle styles */
.cipher-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}
.cipher-encoded {
    font-family: var(--font-header);
    font-size: 20px;
    letter-spacing: 3px;
    color: var(--neon-red);
    text-shadow: 0 0 6px rgba(255, 46, 99, 0.4);
    margin-bottom: 10px;
    text-align: center;
}
.cipher-shift-info {
    font-size: 12px;
    color: #8fa0b5;
    margin-bottom: 10px;
}
.cipher-input {
    width: 80%;
    max-width: 300px;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 4px;
    color: #ffffff;
    font-family: var(--font-header);
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
    padding: 10px;
    outline: none;
    text-transform: uppercase;
}
.cipher-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: var(--crt-glow);
}

/* --- Animations --- */
@keyframes blink-cursor {
    from, to { opacity: 0 }
    50% { opacity: 1 }
}

@keyframes alert-blink {
    from { opacity: 0.6; }
    to { opacity: 1; text-shadow: 0 0 10px rgba(255, 189, 0, 0.8); }
}

@keyframes alert-blink-fast {
    from { opacity: 0.3; }
    to { opacity: 1; text-shadow: 0 0 15px rgba(255, 46, 99, 0.9); }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }
    
    #hud {
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        gap: 10px;
        border-right: none;
        border-bottom: 2px solid var(--neon-cyan);
    }
    
    .hud-panel {
        padding: 8px 12px;
        gap: 4px;
        flex: 1;
        background: var(--panel-bg);
        border: 1px solid var(--panel-border);
    }
    
    .left-panel {
        width: auto;
        min-width: 120px;
    }
    
    .center-panel {
        width: auto;
        max-width: 40%;
        border-left: none;
        border-top: 2px solid var(--neon-gold);
    }
    
    .right-panel {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    
    .hud-btn {
        padding: 6px 10px;
        font-size: 10px;
    }
    
    #oracle-panel {
        width: 100%;
        max-width: 100%;
    }
    
    .modal-content {
        max-height: 95%;
        width: 95%;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .puzzle-workspace {
        min-height: 200px;
        padding: 10px;
    }
}

@media (max-width: 580px) {
    .system-status {
        display: none;
    }
    .daylight-label {
        display: none;
    }
    #hud {
        padding: 6px;
        gap: 6px;
    }
    .hud-panel {
        padding: 6px 8px;
    }
    .hud-btn {
        padding: 4px 6px;
        font-size: 9px;
    }
}
