/* ============================================
   MISSION SYSTEM UI - Madness Combat Style
   Borderlands 2-inspired checklist layout
   ============================================ */

/* Mission Panel Container - PC default */
#mission-panel {
    width: 220px;
    margin-top: 8px;
    background: rgba(10, 10, 10, 0.88);
    border: 1px solid #333;
    border-left: 3px solid #c00;
    padding: 10px 12px;
    font-family: 'Share Tech Mono', 'Orbitron', monospace;
    pointer-events: auto;
    cursor: default;
    animation: mission-slide-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
    z-index: 15;
}

#mission-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 8px,
        rgba(200, 0, 0, 0.03) 8px,
        rgba(200, 0, 0, 0.03) 16px
    );
    pointer-events: none;
}

/* Mission Header - shows mission name directly + count */
.mission-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(200, 0, 0, 0.3);
    padding-bottom: 5px;
}

.mission-label {
    font-size: 12px;
    color: #c00;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(200, 0, 0, 0.4);
    flex: 1;
    line-height: 1.2;
}

.mission-count {
    font-size: 10px;
    color: #555;
    letter-spacing: 1px;
    white-space: nowrap;
    margin-left: 6px;
}

/* Objectives List - directly after header, no separate title */
.mission-objectives {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
}

.mission-objective {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 12px;
    color: #999;
    line-height: 1.3;
    transition: color 0.3s, transform 0.3s;
}

.mission-objective.completed {
    color: #0c0;
}

.mission-objective.completed .obj-check {
    color: #0f0;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}

.obj-check {
    font-size: 13px;
    min-width: 14px;
    text-align: center;
    color: #444;
    margin-top: 1px;
    transition: color 0.3s, transform 0.3s, text-shadow 0.3s;
}

.obj-desc {
    flex: 1;
}

.obj-progress {
    color: #c00;
    font-weight: bold;
    white-space: nowrap;
    font-size: 11px;
    min-width: 32px;
    text-align: right;
}

.mission-objective.completed .obj-progress {
    color: #0c0;
}

/* Death Reset Warning */
.mission-death-warning {
    font-size: 9px;
    color: #c44;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 5px;
    opacity: 0.8;
}

/* Rewards Section */
.mission-rewards {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #888;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 5px;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 2px;
}

.reward-item.xp { color: #ff0; }
.reward-item.metal { color: #888; }
.reward-item.energy { color: #0af; }

/* Claim Button */
.mission-claim-btn {
    display: none;
    width: 100%;
    padding: 7px 0;
    margin-top: 7px;
    background: linear-gradient(180deg, #c00 0%, #800 100%);
    border: 1px solid #f44;
    color: #fff;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    text-align: center;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.6);
    animation: claim-pulse 1.5s ease-in-out infinite;
    transition: background 0.2s, transform 0.1s;
    pointer-events: auto;
}

.mission-claim-btn:hover {
    background: linear-gradient(180deg, #e00 0%, #a00 100%);
    transform: scale(1.03);
}

.mission-claim-btn:active {
    transform: scale(0.97);
}

.mission-claim-btn.visible {
    display: block;
}

/* ENTER key hint */
.mission-enter-hint {
    font-size: 9px;
    color: #555;
    text-align: center;
    margin-top: 3px;
    letter-spacing: 1px;
    font-family: 'Share Tech Mono', monospace;
}

/* All Missions Complete */
.mission-all-done {
    font-size: 12px;
    color: #0f0;
    text-align: center;
    padding: 6px 0;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    letter-spacing: 2px;
    font-weight: bold;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes mission-slide-in {
    0% {
        transform: translateX(120%);
        opacity: 0;
    }
    60% {
        transform: translateX(-5px);
        opacity: 1;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes claim-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.6), 0 0 30px rgba(255, 0, 0, 0.2);
    }
}

@keyframes obj-complete-flash {
    0% {
        background: rgba(0, 255, 0, 0.3);
        transform: scale(1.05);
    }
    100% {
        background: transparent;
        transform: scale(1);
    }
}

.mission-objective.just-completed {
    animation: obj-complete-flash 0.6s ease-out;
}

/* ============================================
   MISSION COMPLETE OVERLAY
   ============================================ */

#mission-complete-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    pointer-events: none;
    justify-content: center;
    align-items: center;
}

#mission-complete-overlay.visible {
    display: flex;
}

.mission-complete-box {
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95) 0%, rgba(30, 0, 0, 0.95) 100%);
    border: 2px solid #c00;
    padding: 24px 40px;
    text-align: center;
    animation: complete-box-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
}

.mission-complete-box::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, #c00, transparent, #c00, transparent);
    background-size: 200% 200%;
    animation: border-glow 2s linear infinite;
    z-index: -1;
}

@keyframes complete-box-in {
    0% {
        transform: scale(0.3) rotate(-5deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.05) rotate(1deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes border-glow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.complete-title {
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 28px;
    color: #c00;
    letter-spacing: 6px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(200, 0, 0, 0.6);
    margin-bottom: 6px;
    animation: complete-title-glow 1s ease-in-out infinite alternate;
}

@keyframes complete-title-glow {
    0% { text-shadow: 0 0 10px rgba(200, 0, 0, 0.4); }
    100% { text-shadow: 0 0 30px rgba(200, 0, 0, 0.8), 0 0 60px rgba(200, 0, 0, 0.3); }
}

.complete-mission-name {
    font-family: 'Share Tech Mono', monospace;
    font-size: 16px;
    color: #fff;
    margin-bottom: 16px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.complete-rewards {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 18px;
}

.complete-reward {
    display: flex;
    align-items: center;
    gap: 4px;
    animation: reward-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

.complete-reward:nth-child(1) { animation-delay: 0.3s; }
.complete-reward:nth-child(2) { animation-delay: 0.5s; }
.complete-reward:nth-child(3) { animation-delay: 0.7s; }

.complete-reward.xp { color: #ff0; }
.complete-reward.metal { color: #aaa; }
.complete-reward.energy { color: #0af; }

.complete-reward .reward-icon {
    font-size: 20px;
}

@keyframes reward-pop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes complete-fade-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

.mission-complete-box.fade-out {
    animation: complete-fade-out 0.4s ease-in forwards;
}

/* ============================================
   MOBILE LAYOUT
   Hide compass, mission panel takes its spot at top center
   ============================================ */

/* Hide compass on mobile when mission panel exists */
.is-mobile.missions-active #day-night-hud {
    display: none !important;
}

/* Mobile wrapper: top center, replacing compass position */
.is-mobile #mission-panel-mobile {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
}

.is-mobile #mission-panel-mobile #mission-panel {
    width: 190px;
    padding: 5px 8px;
    background: rgba(10, 10, 10, 0.8);
    border-width: 1px;
    border-left-width: 2px;
    margin-top: 0;
    animation: none;
}

/* Mobile: collapse/expand toggle */
.mission-toggle-btn {
    display: none;
}

.is-mobile .mission-toggle-btn {
    display: inline-block;
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    pointer-events: auto;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.is-mobile .mission-toggle-btn:active {
    color: #c00;
}

/* Mobile collapsed state */
.is-mobile #mission-panel.collapsed .mission-objectives,
.is-mobile #mission-panel.collapsed .mission-rewards,
.is-mobile #mission-panel.collapsed .mission-death-warning,
.is-mobile #mission-panel.collapsed .mission-claim-btn {
    display: none !important;
}

/* Mobile font sizes */
.is-mobile #mission-panel-mobile .mission-label {
    font-size: 9px;
}

.is-mobile #mission-panel-mobile .mission-count {
    font-size: 8px;
}

.is-mobile #mission-panel-mobile .mission-objective {
    font-size: 9px;
    gap: 5px;
}

.is-mobile #mission-panel-mobile .obj-check {
    font-size: 10px;
    min-width: 11px;
}

.is-mobile #mission-panel-mobile .obj-progress {
    font-size: 8px;
}

.is-mobile #mission-panel-mobile .mission-rewards {
    font-size: 8px;
    gap: 6px;
}

.is-mobile #mission-panel-mobile .mission-claim-btn {
    font-size: 11px;
    padding: 5px 0;
}

.is-mobile #mission-panel-mobile .mission-death-warning {
    font-size: 7px;
}

/* Mobile complete overlay */
.is-mobile .complete-title {
    font-size: 20px;
    letter-spacing: 4px;
}

.is-mobile .complete-mission-name {
    font-size: 12px;
}

.is-mobile .complete-rewards {
    font-size: 14px;
    gap: 12px;
}

.is-mobile .mission-complete-box {
    padding: 16px 24px;
}
