/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Share Tech Mono', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #00ff88;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 255, 136, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 150, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 0, 150, 0.05) 0%, transparent 50%);
    animation: backgroundPulse 8s ease-in-out infinite;
    z-index: -1;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Game Container */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Header Styles */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #00ff88;
    border-radius: 15px;
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.3),
        inset 0 0 20px rgba(0, 255, 136, 0.1);
    backdrop-filter: blur(10px);
}

.game-title {
    margin-bottom: 20px;
}

.title-main {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 900;
    color: #00ff88;
    text-shadow: 
        0 0 10px #00ff88,
        0 0 20px #00ff88,
        0 0 30px #00ff88;
    display: block;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

.title-sub {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    color: #0096ff;
    display: block;
    margin-top: 5px;
    letter-spacing: 3px;
}

@keyframes titleGlow {
    0% { text-shadow: 0 0 10px #00ff88, 0 0 20px #00ff88, 0 0 30px #00ff88; }
    100% { text-shadow: 0 0 20px #00ff88, 0 0 30px #00ff88, 0 0 40px #00ff88; }
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
}

/* Mission Brief */
.mission-brief {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #0096ff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(5px);
}

.brief-content h3 {
    color: #0096ff;
    font-family: 'Orbitron', monospace;
    margin-bottom: 10px;
    text-align: center;
}

.brief-content p {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 15px;
}

.target-pattern {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pattern-label {
    color: #ff6b6b;
    font-weight: bold;
}

.pattern-display {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ff6b6b;
}

/* Array Display */
.array-container {
    text-align: center;
    margin-bottom: 30px;
}

.array-label {
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    color: #00ff88;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.array-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 2px solid #333;
    min-height: 80px;
}

.array-cell {
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border: 2px solid #444;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #00ff88;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.array-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.3), transparent);
    transition: left 0.5s ease;
}

.array-cell:hover::before {
    left: 100%;
}

.array-cell.filled {
    background: linear-gradient(145deg, #0a3d0a, #1a5a1a);
    border-color: #00ff88;
    box-shadow: 
        0 0 15px rgba(0, 255, 136, 0.5),
        inset 0 0 15px rgba(0, 255, 136, 0.2);
    animation: cellPulse 2s ease-in-out infinite;
}

@keyframes cellPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.array-cell.empty {
    background: linear-gradient(145deg, #2a1a1a, #3a2a2a);
    border-color: #666;
    color: #666;
}

.array-cell.highlight {
    background: linear-gradient(145deg, #3d0a0a, #5a1a1a);
    border-color: #ff6b6b;
    box-shadow: 
        0 0 20px rgba(255, 107, 107, 0.7),
        inset 0 0 20px rgba(255, 107, 107, 0.3);
    animation: highlightPulse 0.5s ease-in-out;
}

@keyframes highlightPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Controls Panel */
.controls-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.control-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.control-section h4 {
    color: #0096ff;
    font-family: 'Orbitron', monospace;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    border-radius: 5px;
    padding: 10px;
    color: #00ff88;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.1);
}

.input-group input::placeholder {
    color: #666;
}

/* Buttons */
.btn {
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border: 1px solid #444;
    border-radius: 5px;
    padding: 12px 20px;
    color: #00ff88;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-insert {
    border-color: #00ff88;
}

.btn-insert:hover {
    background: linear-gradient(145deg, #0a3d0a, #1a5a1a);
}

.btn-delete {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.btn-delete:hover {
    background: linear-gradient(145deg, #3d0a0a, #5a1a1a);
}

.btn-search {
    border-color: #0096ff;
    color: #0096ff;
}

.btn-search:hover {
    background: linear-gradient(145deg, #0a2a3d, #1a4a5a);
}

.btn-reset {
    border-color: #ffa500;
    color: #ffa500;
}

.btn-reset:hover {
    background: linear-gradient(145deg, #3d2a0a, #5a4a1a);
}

.btn-next {
    border-color: #00ff88;
    background: linear-gradient(145deg, #0a3d0a, #1a5a1a);
}

.btn-primary {
    background: linear-gradient(145deg, #0a3d0a, #1a5a1a);
    border-color: #00ff88;
}

.btn-secondary {
    background: linear-gradient(145deg, #3d0a0a, #5a1a1a);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Feedback Panel */
.feedback-panel {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.feedback-icon {
    font-size: 2rem;
    animation: iconPulse 1s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.feedback-text {
    font-size: 1.1rem;
    color: #ccc;
    line-height: 1.4;
}

.feedback-success {
    color: #00ff88;
    border-color: #00ff88;
}

.feedback-error {
    color: #ff6b6b;
    border-color: #ff6b6b;
}

.feedback-warning {
    color: #ffa500;
    border-color: #ffa500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    animation: modalFadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(145deg, #1a1a1a, #2a2a2a);
    border: 2px solid #00ff88;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.5),
        inset 0 0 30px rgba(0, 255, 136, 0.1);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
}

.result-stats {
    margin-bottom: 25px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.result-label {
    color: #ccc;
}

.result-value {
    color: #00ff88;
    font-weight: bold;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@keyframes scaleOut {
    from { transform: scale(1); }
    to { transform: scale(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }
    
    .title-main {
        font-size: 2rem;
    }
    
    .game-stats {
        gap: 20px;
    }
    
    .controls-panel {
        grid-template-columns: 1fr;
    }
    
    .array-cell {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 255, 136, 0.3);
    border-radius: 50%;
    border-top-color: #00ff88;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

