/** crisisStyles.css - Uplink-inspired crisis overlay and mini-games */

/* Crisis Overlay */
#crisis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

#crisis-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Crisis Modal - Uplink Style */
#crisis-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 500px;
    background: linear-gradient(135deg, #0a0a1a 0%, #0d1525 100%);
    border: 2px solid #00a8ff;
    border-radius: 8px;
    box-shadow: 
        0 0 40px rgba(0, 168, 255, 0.4),
        0 0 80px rgba(0, 168, 255, 0.2),
        inset 0 0 60px rgba(0, 168, 255, 0.05);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#crisis-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.crisis-header {
    background: linear-gradient(90deg, rgba(0, 168, 255, 0.2) 0%, transparent 100%);
    border-bottom: 1px solid rgba(0, 168, 255, 0.3);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 2;
}

.crisis-icon {
    font-size: 36px;
    filter: drop-shadow(0 0 10px rgba(0, 168, 255, 0.8));
    animation: iconPulse 1.5s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(0, 168, 255, 0.8)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(0, 168, 255, 1)); }
}

.crisis-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    color: #00a8ff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
}

/* Modal Body */
.crisis-body {
    padding: 20px;
    position: relative;
    z-index: 2;
}

.crisis-desc {
    font-size: 14px;
    color: #a0c4e8;
    margin-bottom: 20px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

/* Mini-game Container */
#crisis-game {
    min-height: 150px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 168, 255, 0.2);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

/* Crisis Preview Text */
.crisis-preview {
    text-align: center;
    color: #00a8ff;
    font-size: 16px;
    font-weight: 600;
    padding: 40px 20px;
    animation: previewPulse 2s ease-in-out infinite;
}

@keyframes previewPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Timer Bar */
.crisis-timer-container {
    height: 4px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

#crisis-timer {
    height: 100%;
    background: linear-gradient(90deg, #00a8ff, #00f0ff);
    box-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
    width: 100%;
    transform-origin: left;
}

/* Warning Bar */
#crisis-warning {
    display: none;
    height: 4px;
    background: linear-gradient(90deg, #ff4757, #ff6b7a);
    margin-bottom: 20px;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

/* Crisis Buttons */
.crisis-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.crisis-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 30px;
    border: 2px solid;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    background: transparent;
}

.crisis-btn-resolve {
    border-color: #00a8ff;
    color: #00a8ff;
    box-shadow: 0 0 15px rgba(0, 168, 255, 0.3);
}

.crisis-btn-resolve:hover {
    background: rgba(0, 168, 255, 0.15);
    box-shadow: 0 0 25px rgba(0, 168, 255, 0.5);
    transform: translateY(-2px);
}

.crisis-btn-ignore {
    border-color: #ff4757;
    color: #ff4757;
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.3);
}

.crisis-btn-ignore:hover {
    background: rgba(255, 71, 87, 0.15);
    box-shadow: 0 0 25px rgba(255, 71, 87, 0.5);
}

/* ==================== MINI-GAME STYLES ==================== */

/* Click Bar Game */
.click-bar-game {
    text-align: center;
}

.click-target {
    font-size: 48px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 20px;
    transition: transform 0.05s;
    filter: drop-shadow(0 0 15px rgba(0, 168, 255, 0.6));
}

.click-target:active {
    transform: scale(0.9);
}

.progress-container {
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 168, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00a8ff, #00f0ff);
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.5);
    width: 0%;
    transition: width 0.1s linear;
}

.click-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    color: #00a8ff;
    font-weight: 700;
}

/* Whack-a-Mole Game */
.whack-game {
    text-align: center;
}

.whack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 200px;
    margin: 0 auto 20px;
}

.whack-hole {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(0, 168, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.whack-hole::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0, 168, 255, 0.1) 0%, transparent 70%);
}

.whack-target {
    font-size: 32px;
    cursor: pointer;
    animation: targetPop 0.3s ease-out;
    filter: drop-shadow(0 0 10px rgba(255, 71, 87, 0.8));
    z-index: 2;
}

@keyframes targetPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.whack-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    color: #00a8ff;
    font-weight: 700;
}

/* Type Code Game */
.type-code-game {
    text-align: center;
}

.code-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 36px;
    font-weight: 800;
    color: #00f0ff;
    letter-spacing: 8px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.8);
    animation: codeGlow 1.5s ease-in-out infinite;
}

@keyframes codeGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(0, 240, 255, 0.8); }
    50% { text-shadow: 0 0 30px rgba(0, 240, 255, 1), 0 0 40px rgba(0, 240, 255, 0.5); }
}

.code-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    color: #00a8ff;
    letter-spacing: 4px;
    margin-bottom: 15px;
    min-height: 40px;
}

.type-hint {
    font-size: 12px;
    color: #5a7a9a;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Choose Game */
.choose-game {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choose-option {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(0, 168, 255, 0.3);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.choose-option:hover {
    background: rgba(0, 168, 255, 0.1);
    border-color: #00a8ff;
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.3);
}

.option-title {
    font-size: 16px;
    font-weight: 700;
    color: #00a8ff;
    margin-bottom: 5px;
}

.option-desc {
    font-size: 12px;
    color: #5a7a9a;
}

.choose-or {
    text-align: center;
    font-size: 14px;
    color: #5a7a9a;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Hold Charge Game */
.hold-game {
    text-align: center;
}

.hold-target {
    font-size: 64px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 20px;
    transition: transform 0.1s;
    filter: drop-shadow(0 0 20px rgba(0, 168, 255, 0.6));
}

.hold-target.holding {
    transform: scale(0.95);
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.9));
}

.charge-container {
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 168, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.charge-bar {
    height: 100%;
    background: linear-gradient(90deg, #00a8ff, #00f0ff, #ffffff);
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.5);
    width: 0%;
    transition: width 0.05s linear;
}

/* Crisis Warning Phase */
.crisis-warning {
    text-align: center;
    padding: 30px 20px;
}

.warning-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: warningPulse 0.8s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.warning-text {
    font-size: 20px;
    font-weight: 700;
    color: #ff4757;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}

.warning-sub {
    font-size: 12px;
    color: #5a7a9a;
}

/* Crisis Result */
.crisis-result {
    text-align: center;
    padding: 30px 20px;
}

.crisis-result.success {
    animation: successPulse 0.5s ease-out;
}

.crisis-result.failure {
    animation: failureShake 0.5s ease-out;
}

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

@keyframes failureShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

.result-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.result-text {
    font-size: 24px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.crisis-result.success .result-text {
    color: #00f064;
    text-shadow: 0 0 20px rgba(0, 240, 100, 0.5);
}

.crisis-result.failure .result-text {
    color: #ff4757;
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
}

.result-reward {
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    color: #ffd700;
    font-weight: 700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* Screen Effects */
body.crisis-active {
    overflow: hidden;
}

.screen-shake {
    animation: screenShake 0.5s ease-in-out infinite;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2px, 1px); }
    20% { transform: translate(2px, -1px); }
    30% { transform: translate(-1px, 2px); }
    40% { transform: translate(1px, -2px); }
    50% { transform: translate(-2px, -1px); }
    60% { transform: translate(2px, 1px); }
    70% { transform: translate(-1px, -1px); }
    80% { transform: translate(1px, 1px); }
    90% { transform: translate(-1px, 2px); }
}

.crisis-pulse {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 71, 87, 0.5);
    box-shadow: inset 0 0 100px rgba(255, 71, 87, 0.3);
    pointer-events: none;
    z-index: 950;
    animation: borderPulse 1s ease-in-out infinite;
}

@keyframes borderPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Responsive */
@media (max-width: 500px) {
    #crisis-modal {
        width: 95%;
        max-width: none;
    }
    
    .crisis-title {
        font-size: 16px;
    }
    
    .crisis-icon {
        font-size: 28px;
    }
    
    .code-display {
        font-size: 28px;
        letter-spacing: 4px;
    }
    
    .crisis-btn {
        padding: 10px 20px;
        font-size: 12px;
    }
}
