/* ==========================================================================
   Pillars of Knowledge - Glitch Effect Dark Web Theme
   ========================================================================== */

/* --- 1. Root Variables & Theme --- */
:root {
    --color-background: #000000;
    --color-terminal-glow: #0ff200;
    --color-text: #0af800;
    --color-text-dim: #078a00;
    --color-glitch-red: #ff003c;
    --color-glitch-blue: #00fff9;
    --sidebar-width: 320px;

    --font-ui: 'VT323', monospace;
    --font-body: 'Share Tech Mono', monospace;
}

/* --- 2. Global Resets & Body Styles --- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text);
    text-shadow: 0 0 5px var(--color-terminal-glow);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    text-align: center;
    padding: 15px;
    overflow-x: hidden;
    position: relative;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: 
        repeating-linear-gradient(0deg, rgba(0,0,0,0.5) 0, rgba(0,0,0,0.5) 1px, transparent 1px, transparent 3px),
        radial-gradient(ellipse at center, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%);
    z-index: 100;
}

/* --- 3. Main Container --- */
.container {
    max-width: 1200px;
    width: 100%;
}

/* --- 4. Header & Glitch Title Styles --- */
header h1 {
    font-family: var(--font-ui);
    font-size: clamp(2.5rem, 10vw, 3.5rem);
    margin-bottom: 0.5rem;
    line-height: 1.2;
    text-transform: uppercase;
}

.glitch {
    position: relative;
    animation: glitch-flicker 4s linear infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-background);
    overflow: hidden;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--color-glitch-red);
    clip-path: inset(50% 0 21% 0);
    animation: noise-1 2s linear infinite alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--color-glitch-blue), 2px 2px var(--color-glitch-red);
    clip-path: inset(17% 0 67% 0);
    animation: noise-2 3s linear infinite alternate-reverse;
}

.subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 4vw, 1.1rem);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2rem;
    color: var(--color-text-dim);
}

.subtitle::after {
    content: '_';
    animation: blink-caret 1s step-end infinite;
}

/* --- 5. App Layout (Mobile First) --- */
.app-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar {
    width: 100%;
}

.sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.main-content {
    width: 100%;
}

/* --- 6. Category Button Styles --- */
.category-btn {
    border: 1px solid var(--color-text);
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: 1.1rem;
    padding: 10px 15px;
    background-color: rgba(0, 255, 115, 0.05);
    cursor: pointer;
    border-radius: 0;
    text-transform: uppercase;
    transition: all 0.2s ease;
    text-shadow: 0 0 5px var(--color-text);
    flex-grow: 1;
    flex-basis: 120px;
}

.category-btn:hover:not(:disabled) {
    background-color: var(--color-text);
    color: var(--color-background);
    text-shadow: none;
    box-shadow: 0 0 20px var(--color-text);
    animation: button-glitch 0.3s linear;
}

.category-btn:disabled {
    cursor: not-allowed;
    opacity: 0.3;
    filter: saturate(0);
}

/* Special colors for specific buttons */
[data-category="manipulation"], [data-category="seduction"] {
    --btn-color: #ff3d3d;
    color: var(--btn-color);
    border-color: var(--btn-color);
    text-shadow: 0 0 5px var(--btn-color);
}
[data-category="manipulation"]:hover:not(:disabled),
[data-category="seduction"]:hover:not(:disabled) {
    background-color: var(--btn-color);
    color: var(--color-background);
    box-shadow: 0 0 20px var(--btn-color);
}

/* UPDATED: Simplified Random button styling */
[data-category="random"] {
    --random-color: #9400d3; /* Vibrant purple */
    border-color: var(--random-color);
    color: var(--random-color);
    text-shadow: 0 0 5px var(--random-color);
}
[data-category="random"]:hover:not(:disabled) {
    background-color: var(--random-color);
    color: var(--color-background);
    box-shadow: 0 0 20px var(--random-color);
}


/* --- 7. Knowledge Display & Typing Animation --- */
#knowledge-display {
    background-color: rgba(0, 20, 0, 0.5);
    border: 1px solid var(--color-text-dim);
    padding: 1.5rem;
    text-align: left;
    min-height: 300px;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#knowledge-display.visible { 
    opacity: 1; 
    transform: scale(1); 
}

#knowledge-display h2 {
    font-family: var(--font-ui);
    font-size: clamp(1.5rem, 6vw, 2rem);
    line-height: 1.2;
    margin-bottom: 1rem;
    text-transform: uppercase;
    color: var(--color-text);
}

[data-category-color="manipulation"] h2,
[data-category-color="seduction"] h2 {
    color: #ff3d3d;
}

/* ADDED: Style for the random category title */
[data-category-color="random"] h2 {
    color: #9400d3;
}

#knowledge-display p { 
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--color-text);
    word-wrap: break-word;
}

.typing-cursor {
    display: inline-block;
    background-color: var(--color-text);
    width: 10px;
    height: 1.2rem;
    animation: blink-caret 1s step-end infinite;
    margin-left: 2px;
}

.hidden { 
    display: none; 
}

/* --- 8. Footer --- */
footer { 
    margin-top: 2rem; 
    color: var(--color-text-dim);
    font-size: 0.9rem;
}

/* --- 9. Desktop Layout --- */
@media (min-width: 1024px) {
    body {
        padding: 40px;
    }

    .app-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: 30px;
    }

    .sidebar {
        flex-basis: var(--sidebar-width);
        flex-shrink: 0;
        position: sticky;
        top: 40px;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    /* REMOVED: The rule making the random button span two columns is gone */

    .main-content {
        flex-grow: 1;
    }

    #knowledge-display {
        padding: 2.5rem;
    }
}

/* --- 10. Glitch Animations --- */
@keyframes blink-caret {
    from, to { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes noise-1 {
  0%, 20%, 40%, 60%, 70%, 90% {clip-path: inset(95% 0 2% 0);}
  10%, 30%, 50%, 80%, 99% {clip-path: inset(2% 0 92% 0);}
}

@keyframes noise-2 {
  0%, 20%, 40%, 60%, 70%, 90% {clip-path: inset(2% 0 95% 0);}
  10%, 30%, 50%, 80%, 99% {clip-path: inset(90% 0 3% 0);}
}

@keyframes glitch-flicker {
  0%, 100% {opacity: 1;}
  50% {opacity: 0.8;}
  52% {opacity: 1;}
  55% {opacity: 0.7;}
  56% {opacity: 1;}
}

@keyframes button-glitch {
  0% {transform: translate(0);}
  25% {transform: translate(2px, -2px);}
  50% {transform: translate(-2px, 2px);}
  75% {transform: translate(2px, 2px);}
  100% {transform: translate(0);}
}