:root {
    --matrix-green: #b841ff;
    --matrix-dark-green: #7a11a8;
    --matrix-bg: #0e0a14;
    --matrix-card: rgba(20, 0, 40, 0.95);
    --matrix-border: rgba(184, 65, 255, 0.3);
    --matrix-glow: 0 0 20px rgba(184, 65, 255, 0.5);
    --matrix-text: #e0d0ff;
    --matrix-highlight: #ff41ff;
    --section-padding: 2rem;
    --card-radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    background: #000;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(0deg, transparent 24%, rgba(184, 65, 255, 0.02) 25%, rgba(184, 65, 255, 0.02) 26%, transparent 27%, transparent 74%, rgba(184, 65, 255, 0.02) 75%, rgba(184, 65, 255, 0.02) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(184, 65, 255, 0.02) 25%, rgba(184, 65, 255, 0.02) 26%, transparent 27%, transparent 74%, rgba(184, 65, 255, 0.02) 75%, rgba(184, 65, 255, 0.02) 76%, transparent 77%, transparent);
    background-size: 50px 50px;
    z-index: -1;
    animation: matrixGrid 20s linear infinite;
}

@keyframes matrixGrid {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.matrix-container {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 0;
    background: rgba(0, 0, 0, 0.9);
    min-height: calc(100vh - 140px);
}

.matrix-header {
    background: linear-gradient(135deg, rgba(20, 0, 40, 0.95), rgba(40, 0, 80, 0.95));
    border-bottom: 2px solid var(--matrix-border);
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.matrix-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(184, 65, 255, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

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

.matrix-header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 900;
    color: var(--matrix-green);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin: 0;
    text-shadow: 0 0 30px rgba(184, 65, 255, 0.8);
    position: relative;
    z-index: 1;
    text-align: center;
}

.matrix-header .user-info {
    margin-top: 1rem;
    font-family: 'Fira Code', monospace;
    color: rgba(184, 65, 255, 0.7);
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
    text-align: center;
}

.matrix-tabs {
    background: rgba(10, 0, 20, 0.95);
    padding: 0;
    border-bottom: 1px solid var(--matrix-border);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Hide matrix tabs on mobile devices */
@media only screen and (max-width: 768px) {
    .matrix-tabs {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    
    .desktop-only {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }
}

@media only screen and (max-width: 992px) {
    .matrix-tabs {
        display: none !important;
    }
    
    .desktop-only {
        display: none !important;
    }
}

.matrix-tab {
    background: transparent;
    border: none;
    color: rgba(184, 65, 255, 0.6);
    padding: 1rem 1.2rem;
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(184, 65, 255, 0.1);
}

.matrix-tab:last-child {
    border-right: none;
}

.matrix-tab::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--matrix-green);
    transition: width 0.3s ease;
}

.matrix-tab:hover {
    color: var(--matrix-green);
    background: rgba(184, 65, 255, 0.05);
}

.matrix-tab.active {
    color: var(--matrix-green);
    background: rgba(184, 65, 255, 0.1);
    text-shadow: 0 0 10px rgba(184, 65, 255, 0.8);
}

.matrix-tab.active::before {
    width: 100%;
    box-shadow: 0 0 10px var(--matrix-green);
}

.matrix-content {
    padding: 3rem 2rem;
    max-width: 100%;
    margin: 0 auto;
}

.matrix-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 3rem;
    width: 100%;
}

.matrix-card {
    background: var(--matrix-card);
    border: 1px solid var(--matrix-border);
    border-radius: var(--card-radius);
    padding: 1.2rem;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.matrix-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--matrix-green), transparent, var(--matrix-green));
    border-radius: var(--card-radius);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.matrix-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--matrix-glow);
}

.matrix-card:hover::before {
    opacity: 0.3;
}

.matrix-card-description {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.8rem;
    min-height: 2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 0.9rem;
}

.matrix-card-stat {
    margin-bottom: 0.8rem;
}

.matrix-card-command,
.matrix-card-size {
    background: rgba(184, 65, 255, 0.1);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 8px;
    padding: 0.7rem;
    text-align: center;
    position: relative;
}

.matrix-card-command > span:first-child,
.matrix-card-size > span:first-child {
    display: block !important;
    font-size: 1.1rem;
    color: #b841ff;
    font-weight: bold;
    margin-bottom: 0.3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matrix-card-label {
    font-size: 0.7rem;
    color: rgba(184, 65, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.matrix-badge-active {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
    border-color: #4ade80;
}

.matrix-button-danger {
    background: transparent;
    border-color: rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

.matrix-button-danger:hover {
    background: rgba(255, 0, 0, 0.1);
    border-color: #ff4444;
}

.matrix-button-warning {
    background: transparent;
    border-color: rgba(255, 165, 0, 0.3);
    color: #ffa500;
}

.matrix-button-warning:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: #ffa500;
}


.matrix-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(184, 65, 255, 0.2);
}

.matrix-card-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--matrix-green);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.matrix-card-title i {
    font-size: 1.2rem;
    color: rgba(184, 65, 255, 0.7);
}

.matrix-card-content {
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
}

.matrix-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.matrix-stat {
    background: rgba(184, 65, 255, 0.05);
    border: 1px solid rgba(184, 65, 255, 0.2);
    border-radius: 8px;
    padding: 1.2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.matrix-stat:hover {
    background: rgba(184, 65, 255, 0.1);
    border-color: var(--matrix-green);
    transform: scale(1.05);
}

.matrix-stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--matrix-green);
    text-shadow: 0 0 15px rgba(184, 65, 255, 0.8);
}

.matrix-stat-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: rgba(184, 65, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

.matrix-button {
    background: linear-gradient(135deg, rgba(184, 65, 255, 0.1), rgba(184, 65, 255, 0.2));
    border: 1px solid var(--matrix-green);
    color: var(--matrix-green);
    padding: 0.75rem 1.5rem;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.matrix-button-icon {
    background: transparent;
    border: 1px solid rgba(184, 65, 255, 0.3);
    color: var(--matrix-green);
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--matrix-green), transparent);
    transition: all 0.5s ease;
    transform: translate(-50%, -50%);
}

.matrix-button:hover {
    background: linear-gradient(135deg, rgba(184, 65, 255, 0.2), rgba(184, 65, 255, 0.3));
    box-shadow: 0 0 30px rgba(184, 65, 255, 0.5);
    transform: translateY(-2px);
    text-shadow: 0 0 10px var(--matrix-green);
}

.matrix-button-icon:hover {
    background: rgba(184, 65, 255, 0.1);
    border-color: var(--matrix-green);
    transform: scale(1.1);
}

.matrix-button:hover::before {
    width: 300px;
    height: 300px;
    opacity: 0.3;
}

.matrix-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.matrix-list-item {
    background: rgba(184, 65, 255, 0.02);
    border: 1px solid rgba(184, 65, 255, 0.1);
    border-radius: 6px;
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-family: 'Fira Code', monospace;
}

.matrix-list-item:hover {
    background: rgba(184, 65, 255, 0.05);
    border-color: rgba(184, 65, 255, 0.3);
    transform: translateX(5px);
}

.matrix-section {
    background: var(--matrix-card);
    border: 1px solid var(--matrix-border);
    border-radius: var(--card-radius);
    padding: 3rem;
    margin-bottom: 2rem;
    position: relative;
}

.matrix-section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(184, 65, 255, 0.2);
}

.matrix-section-title {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--matrix-green);
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 30px rgba(184, 65, 255, 0.8);
    text-align: center;
    margin-bottom: 1rem;
}

.matrix-form {
    display: grid;
    gap: 1.5rem;
    max-width: 800px;
}

.matrix-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.matrix-form-group label {
    font-family: 'Fira Code', monospace;
    color: rgba(184, 65, 255, 0.8);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.matrix-input,
.matrix-textarea,
.matrix-select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(184, 65, 255, 0.3);
    color: #fff;
    padding: 1rem;
    border-radius: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.matrix-input:focus,
.matrix-textarea:focus,
.matrix-select:focus {
    outline: none;
    border-color: var(--matrix-green);
    background: rgba(184, 65, 255, 0.05);
    box-shadow: 0 0 15px rgba(184, 65, 255, 0.3);
}

.matrix-textarea {
    min-height: 120px;
    resize: vertical;
}

.matrix-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
    justify-content: center;
    margin-top: 0.8rem;
}

.matrix-section-header .matrix-actions {
    margin-top: 0;
}

.matrix-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.matrix-toggle input[type="checkbox"] {
    width: 50px;
    height: 26px;
    appearance: none;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.matrix-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.matrix-toggle input[type="checkbox"]:checked {
    background: rgba(184, 65, 255, 0.2);
    border-color: var(--matrix-green);
}

.matrix-toggle input[type="checkbox"]:checked::before {
    left: 26px;
    background: var(--matrix-green);
    box-shadow: 0 0 10px var(--matrix-green);
}

@media (max-width: 768px) {
    .matrix-header h1 {
        font-size: 2rem;
        letter-spacing: 2px;
    }
    
    .matrix-grid {
        grid-template-columns: 1fr;
    }
    
    .matrix-tabs {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    .matrix-content {
        padding: 2rem 1rem;
    }
    
    .matrix-section {
        padding: 2rem 1.5rem;
    }
    
    /* Template card button adjustments for mobile */
    .template-card .matrix-button,
    .template-card button[onclick*="duplicate"],
    .template-card button[onclick*="edit"],
    .template-card button[onclick*="delete"],
    #templatesTab .matrix-button {
        padding: 0.5rem 0.8rem !important;
        font-size: 0.75rem !important;
        min-height: 36px !important;
        height: auto !important;
    }
    
    .template-card .matrix-button i,
    #templatesTab .matrix-button i {
        font-size: 0.8rem !important;
        margin-right: 0.3rem !important;
    }
    
    /* Make buttons stack better on mobile */
    .template-card .template-actions,
    #templatesTab .template-actions {
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
    }
    
    .template-card .template-actions .matrix-button,
    #templatesTab .template-actions .matrix-button {
        flex: 1 1 calc(50% - 0.25rem) !important;
        min-width: 100px !important;
    }
    
    /* General matrix button size reduction on mobile */
    .matrix-button {
        padding: 0.6rem 1rem !important;
        font-size: 0.8rem !important;
    }
    
    /* Memory stats adjustments for mobile */
    .stat-box {
        padding: 0.75rem 0.5rem !important;
    }
    
    .stat-box .stat-icon {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .stat-box .stat-value {
        font-size: 1.4rem !important;
    }
    
    .stat-box .stat-label {
        font-size: 0.65rem !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Ensure stats stay in one row */
    .lorebook-stats,
    .memory-stats,
    #memoryTab .lorebook-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
        margin: 0.5rem !important;
    }
}

.matrix-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(184, 65, 255, 0.1);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--matrix-green);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.matrix-progress {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(184, 65, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.matrix-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--matrix-dark-green), var(--matrix-green));
    box-shadow: 0 0 10px var(--matrix-green);
    transition: width 0.5s ease;
    position: relative;
}

.matrix-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

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

/* Dashboard Enhancements */
.dashboard-welcome {
    background: linear-gradient(135deg, rgba(184, 65, 255, 0.1), rgba(147, 51, 234, 0.1));
    border: 1px solid var(--matrix-border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.dashboard-welcome::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(184, 65, 255, 0.05) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

.welcome-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.welcome-avatar {
    position: relative;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #b841ff, #7a11a8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 0 30px rgba(184, 65, 255, 0.5);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.avatar-status {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: #4ade80;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: white;
    border: 2px solid var(--matrix-bg);
}

.welcome-text h2 {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    color: var(--matrix-green);
    margin: 0;
    text-shadow: 0 0 20px rgba(184, 65, 255, 0.6);
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0.5rem 0 0 0;
    font-size: 1.1rem;
}

.daily-streak {
    margin-left: auto;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 107, 107, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 165, 0, 0.7); }
}

.daily-streak.fire-animation {
    animation: glow 2s ease-in-out infinite, shake 0.5s ease-in-out infinite;
}

.daily-streak.epic-streak {
    background: linear-gradient(135deg, #ff6b6b, #ffd700, #ff6b6b);
    background-size: 200% 200%;
    animation: glow 2s ease-in-out infinite, epicGradient 3s ease infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

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

/* Level & XP System */
.level-progress-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: rgba(184, 65, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(184, 65, 255, 0.2);
}

.level-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.level-badge {
    background: linear-gradient(135deg, #b841ff, #7a11a8);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    color: white;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 0 20px rgba(184, 65, 255, 0.5);
}

.level-title {
    color: rgba(184, 65, 255, 0.8);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.xp-progress {
    flex: 1;
}

.xp-bar {
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #b841ff, #e94cf5);
    position: relative;
    transition: width 0.5s ease;
}

.xp-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

.xp-text {
    text-align: center;
    margin-top: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Fira Code', monospace;
}

.achievements-row {
    display: flex;
    gap: 1rem;
}

.achievement-badge {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(184, 65, 255, 0.2), rgba(147, 51, 234, 0.2));
    border: 2px solid var(--matrix-green);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--matrix-green);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.achievement-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(184, 65, 255, 0.5);
}

.achievement-badge.locked {
    background: rgba(100, 100, 100, 0.2);
    border-color: rgba(100, 100, 100, 0.5);
    color: rgba(100, 100, 100, 0.5);
}

/* Stats Overview */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-details {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--matrix-green);
    font-family: 'Orbitron', monospace;
}

.stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.stat-change {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: #4ade80;
}

.stat-change.negative {
    color: #ff6b6b;
}

.star-display {
    color: #ffd700;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Chart Container */
.chart-container {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(184, 65, 255, 0.2);
}

.chart-container h4 {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.mini-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 100px;
    gap: 0.5rem;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(to top, #b841ff, #e94cf5);
    border-radius: 5px 5px 0 0;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.25rem;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.chart-bar:hover {
    transform: scaleY(1.1);
    box-shadow: 0 0 15px rgba(184, 65, 255, 0.5);
}

.chart-bar.today {
    background: linear-gradient(to top, #4ade80, #22c55e);
}

.chart-bar::after {
    content: attr(data-day);
    position: absolute;
    bottom: -20px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Popular Content */
.popular-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(184, 65, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.popular-item:hover {
    background: rgba(184, 65, 255, 0.1);
    transform: translateX(5px);
}

.popular-rank {
    font-size: 1.5rem;
}

.popular-info {
    flex: 1;
}

.popular-name {
    color: white;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.popular-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.popular-stats i {
    color: var(--matrix-green);
}

/* Help Portal Progress */
.help-level {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.help-level-badge {
    background: linear-gradient(135deg, #4ecdc4, #44a3aa);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-level-title {
    color: rgba(78, 205, 196, 0.8);
    font-size: 0.9rem;
}

.help-stats {
    margin: 1rem 0;
}

.help-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.help-stat i {
    color: #4ecdc4;
    width: 20px;
}

.help-xp-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 1rem;
}

.help-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #44a3aa);
    transition: width 0.5s ease;
}

.help-xp-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Community Stats */
.community-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.community-stat {
    text-align: center;
}

.community-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.community-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    font-family: 'Orbitron', monospace;
}

.community-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
}

.recent-feedback {
    padding-top: 1rem;
    border-top: 1px solid rgba(184, 65, 255, 0.2);
}

.recent-feedback h4 {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.feedback-item {
    background: rgba(184, 65, 255, 0.05);
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.feedback-user {
    color: var(--matrix-green);
    font-weight: 600;
}

.feedback-text {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.quick-action-btn {
    background: rgba(184, 65, 255, 0.1);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 10px;
    padding: 1rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.quick-action-btn:hover {
    background: rgba(184, 65, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(184, 65, 255, 0.3);
}

.quick-action-btn i {
    font-size: 1.5rem;
    color: var(--matrix-green);
}

.quick-action-btn span {
    font-size: 0.85rem;
    text-align: center;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--matrix-green), transparent);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 5px;
    width: 16px;
    height: 16px;
    background: var(--matrix-green);
    border: 2px solid var(--matrix-bg);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(184, 65, 255, 0.5);
}

.timeline-content {
    background: rgba(184, 65, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(184, 65, 255, 0.2);
}

.timeline-time {
    font-size: 0.85rem;
    color: rgba(184, 65, 255, 0.7);
    margin-bottom: 0.25rem;
}

.timeline-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .welcome-content {
        flex-direction: column;
        text-align: center;
    }
    
    .daily-streak {
        margin: 1rem auto 0;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .community-stats {
        grid-template-columns: 1fr;
    }
}

.matrix-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--matrix-card);
    border: 1px solid var(--matrix-green);
    border-radius: 8px;
    padding: 1.5rem;
    min-width: 300px;
    box-shadow: 0 0 30px rgba(184, 65, 255, 0.5);
    animation: slideIn 0.3s ease;
    z-index: 10000;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.matrix-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.matrix-modal {
    background: var(--matrix-card);
    border: 2px solid var(--matrix-green);
    border-radius: var(--card-radius);
    padding: 2rem;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(184, 65, 255, 0.5);
    animation: modalOpen 0.3s ease;
}

@keyframes modalOpen {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Matrix Lorebook/Draft Cards */
.matrix-lorebook-card {
    background: rgba(20, 0, 40, 0.95);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 15px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}


.matrix-lorebook-card:hover {
    transform: translateY(-5px);
    border-color: var(--matrix-green);
    box-shadow: 0 10px 30px rgba(184, 65, 255, 0.3);
}

.lorebook-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0;
}

.lorebook-icon {
    font-size: 1.5rem;
    opacity: 0.9;
}

.lorebook-title {
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff !important;
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    opacity: 1 !important;
}

.lorebook-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(184, 65, 255, 0.7);
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed rgba(184, 65, 255, 0.2);
}

.lorebook-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: rgba(184, 65, 255, 0.05);
    border: 1px solid rgba(184, 65, 255, 0.2);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--matrix-highlight);
    text-shadow: 0 0 10px rgba(255, 65, 255, 0.6);
}

.stat-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: rgba(184, 65, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.25rem;
}

.lorebook-info {
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(184, 65, 255, 0.1);
    font-family: 'Fira Code', monospace;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: rgba(184, 65, 255, 0.6);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    color: var(--matrix-text);
    font-size: 0.9rem;
}

.draft-code {
    font-family: 'Orbitron', monospace;
    color: var(--matrix-green);
    text-shadow: 0 0 5px rgba(184, 65, 255, 0.5);
}

.badge-draft {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 165, 0, 0.2);
    border: 1px solid rgba(255, 165, 0, 0.5);
    border-radius: 12px;
    color: #ffa500;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge-private {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(184, 65, 255, 0.1);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 12px;
    color: var(--matrix-green);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lorebook-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.action-btn {
    background: rgba(184, 65, 255, 0.1);
    border: 1px solid rgba(184, 65, 255, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--matrix-green);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(184, 65, 255, 0.2);
    border-color: var(--matrix-green);
    box-shadow: 0 0 15px rgba(184, 65, 255, 0.5);
    transform: scale(1.1);
}

.action-btn.edit:hover {
    color: #4ade80;
    border-color: #4ade80;
}

.action-btn.delete:hover {
    color: #f87171;
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

/* Drafts Grid */
.drafts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Horizontal Scrolling Container */
.scroll-container {
    position: relative;
    overflow: hidden;
    margin: 1.5rem 0;
}

.scroll-container::before,
.scroll-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.scroll-container::before {
    left: 0;
    background: linear-gradient(90deg, 
        rgba(14, 10, 20, 1) 0%, 
        rgba(14, 10, 20, 0.8) 20%,
        rgba(14, 10, 20, 0) 100%);
}

.scroll-container::after {
    right: 0;
    background: linear-gradient(270deg, 
        rgba(14, 10, 20, 1) 0%, 
        rgba(14, 10, 20, 0.8) 20%,
        rgba(14, 10, 20, 0) 100%);
}

.scroll-container.at-start::before {
    opacity: 0;
}

.scroll-container.at-end::after {
    opacity: 0;
}

.scroll-wrapper {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 1rem 2rem;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.scroll-wrapper::-webkit-scrollbar {
    height: 8px;
}

.scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(184, 65, 255, 0.1);
    border-radius: 4px;
}

.scroll-wrapper::-webkit-scrollbar-thumb {
    background: var(--matrix-green);
    border-radius: 4px;
}

.scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--matrix-highlight);
}

.scroll-item {
    flex: 0 0 350px;
    min-width: 350px;
    display: flex;
    align-items: stretch;
}

.scroll-item .matrix-card {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.scroll-item .matrix-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.scroll-item .matrix-actions {
    margin-top: auto !important;
}

/* Section Divider */
.section-divider {
    margin: 2rem 0;
    padding: 1.5rem 0;
    border-top: 2px solid rgba(184, 65, 255, 0.2);
    position: relative;
}

.section-label {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--matrix-bg);
    padding: 0 1rem;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--matrix-green);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.content-section {
    margin-bottom: 3rem;
    display: block;
    width: 100%;
    position: relative;
}

.content-section:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(184, 65, 255, 0.3), transparent);
}

.content-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(90deg, rgba(184, 65, 255, 0.1), rgba(184, 65, 255, 0.05));
    border-left: 4px solid var(--matrix-green);
    border-radius: 0 8px 8px 0;
}

.content-section-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--matrix-green);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-count {
    background: rgba(184, 65, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--matrix-text);
}

/* Scroll Navigation Buttons */
.scroll-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, rgba(184, 65, 255, 0.2), rgba(184, 65, 255, 0.3));
    border: 2px solid var(--matrix-green);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    color: var(--matrix-green);
    box-shadow: 0 4px 15px rgba(184, 65, 255, 0.4);
    backdrop-filter: blur(10px);
}

.scroll-nav:hover {
    background: linear-gradient(135deg, rgba(184, 65, 255, 0.4), rgba(184, 65, 255, 0.5));
    box-shadow: 0 0 30px rgba(184, 65, 255, 0.6);
    transform: translateY(-50%) scale(1.15);
    border-color: var(--matrix-highlight);
}

.scroll-nav.prev {
    left: 10px;
}

.scroll-nav.next {
    right: 10px;
}

.scroll-nav.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.8);
}

.scroll-nav i {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 3px currentColor);
}

/* Pulse animation for scroll indicators */
@keyframes scrollPulse {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(184, 65, 255, 0.4);
    }
    50% { 
        box-shadow: 0 4px 25px rgba(184, 65, 255, 0.7);
    }
}

.scroll-nav:not(.hidden) {
    animation: scrollPulse 2s ease-in-out infinite;
}

@media (max-width: 768px) {
    .drafts-grid {
        grid-template-columns: 1fr;
    }
    
    .lorebook-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .scroll-item {
        flex: 0 0 280px;
        min-width: 280px;
    }
    
    .scroll-nav {
        display: none;
    }
}/* Chart Styles */
.chart-container {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(184, 65, 255, 0.2);
}

.chart-container h4 {
    color: rgba(184, 65, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
    font-family: 'Fira Code', monospace;
}

#downloadChartCanvas {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    width: 100%;
    height: 200px;
}

/* Skeleton Loading */
.skeleton-loading {
    position: relative;
    overflow: hidden;
}

.skeleton-loading .skeleton-text {
    display: inline-block;
    background: rgba(184, 65, 255, 0.1);
    border-radius: 4px;
    color: transparent;
    min-width: 60px;
    display: inline-block;
}

.skeleton-star {
    opacity: 0.3;
}


