.bookshelf .nerdy-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 90%;
    max-width: 650px;
    animation: loaderEntrance 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loaderEntrance {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotateX(30deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateX(0);
    }
}

.loader-terminal {
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f3a 100%);
    border: 2px solid #00ff88;
    border-radius: 8px;
    box-shadow: 
        0 0 40px rgba(0, 255, 136, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 255, 136, 0.1);
    overflow: hidden;
    font-family: 'Courier New', 'SF Mono', 'Monaco', monospace;
}

.terminal-header {
    background: linear-gradient(90deg, #1a1f3a 0%, #2a2f4a 100%);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #00ff88;
}

.terminal-title {
    color: #00ff88;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.terminal-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn.minimize {
    background: #ffd700;
    color: #000;
}

.control-btn.maximize {
    background: #00ff88;
    color: #000;
}

.control-btn.close {
    background: #ff4444;
    color: #fff;
}

.control-btn:hover {
    transform: scale(1.2);
    filter: brightness(1.3);
}

.terminal-body {
    padding: 20px;
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.terminal-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 136, 0.03) 2px,
            rgba(0, 255, 136, 0.03) 4px
        );
    pointer-events: none;
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

.terminal-line {
    margin-bottom: 10px;
    font-size: 14px;
    animation: typewriter 0.5s steps(20, end);
    overflow: hidden;
    white-space: nowrap;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

.prompt {
    color: #00ff88;
    font-weight: 700;
    margin-right: 8px;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
}

.command {
    color: #ffffff;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.3);
}

.info-text {
    color: #00bfff;
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.progress-container {
    margin: 25px 0;
}

.progress-bar-wrapper {
    background: #0a0e1a;
    border: 2px solid #00ff88;
    border-radius: 20px;
    padding: 3px;
    position: relative;
    overflow: hidden;
    height: 30px;
    box-shadow: 
        inset 0 0 10px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 255, 136, 0.2);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #00bfff, #ff00ff, #00ff88);
    background-size: 400% 100%;
    border-radius: 17px;
    width: 0%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    animation: gradientShift 3s linear infinite;
}

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

.progress-glow {
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: glowMove 1.5s linear infinite;
}

@keyframes glowMove {
    0% { transform: translateX(-100px); }
    100% { transform: translateX(100px); }
}

.progress-stripes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
    animation: stripeMove 1s linear infinite;
}

@keyframes stripeMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    color: #00ff88;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.stat-value {
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.matrix-rain {
    color: #00ff88;
    font-size: 12px;
    letter-spacing: 3px;
    opacity: 0.6;
    margin: 20px 0;
    text-align: center;
    animation: matrixFlicker 0.5s ease-in-out infinite;
}

@keyframes matrixFlicker {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

.ascii-art {
    color: #00ff88;
    font-size: 10px;
    line-height: 1.2;
    white-space: pre;
    display: block;
    text-align: center;
    margin-top: 20px;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.7);
    animation: asciiGlow 2s ease-in-out infinite;
}

@keyframes asciiGlow {
    0%, 100% { 
        text-shadow: 0 0 15px rgba(0, 255, 136, 0.7);
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 25px rgba(0, 255, 136, 1);
        transform: scale(1.02);
    }
}

/* Glitch effect */
.loader-terminal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        rgba(255, 0, 255, 0.03),
        transparent,
        rgba(0, 255, 255, 0.03)
    );
    pointer-events: none;
    animation: glitch 5s linear infinite;
}

@keyframes glitch {
    0%, 90%, 100% {
        opacity: 0;
    }
    92% {
        opacity: 1;
        transform: translateX(2px) scaleY(1.01);
    }
    94% {
        opacity: 1;
        transform: translateX(-2px) scaleY(0.99);
    }
}

/* No background overlay for bookshelf loader */
.bookshelf .nerdy-loader::before {
    display: none;
}

/* Style bookshelf when loading */
.bookshelf {
    position: relative;
    min-height: 400px;
}

.bookshelf.loading .lorebook-card {
    opacity: 0;
    transition: opacity 0.3s ease;
}