/* ============================================================================
   CDARS ACADEMY - THE 7 GRAND PILLARS
   ULTIMATE LEGENDARY · NEW AMBASSY ETERNAL ORDER
   QUANTUM REALITY · 3D CARDS · SMART CROWN · LIVING PRESENCE
   ============================================================================ */

:root {
    /* Academy Identity - Royal Blue */
    --academy-blue: #2F5BFF;
    --academy-blue-dim: rgba(47, 91, 255, 0.15);
    --academy-blue-glow: rgba(47, 91, 255, 0.4);
    --academy-blue-soft: rgba(47, 91, 255, 0.05);
    --academy-blue-glow-intensity: 1;
    --academy-gold: #FFD700;
    
    /* GATE FOUNDATION */
    --void: #05070c;
    --void-deep: #03040a;
    --abyss: #020308;
    --starlight: rgba(255, 255, 255, 0.98);
    --stardust: rgba(255, 255, 255, 0.82);
    --nebula-mist: rgba(255, 255, 255, 0.62);
    
    /* Surface Layers */
    --panel: rgba(12, 16, 24, 0.85);
    --panel-deep: rgba(8, 12, 20, 0.95);
    --panel-edge: rgba(255, 255, 255, 0.08);
    --panel-edge-academy: rgba(47, 91, 255, 0.15);
    
    /* Typography */
    --text-primary: rgba(255, 255, 255, 0.98);
    --text-secondary: rgba(255, 255, 255, 0.82);
    --text-tertiary: rgba(255, 255, 255, 0.62);
    
    /* Spacing */
    --radius-large: 32px;
    --radius-medium: 20px;
    --radius-small: 12px;
    --radius-pill: 999px;
    
    /* Shadows */
    --shadow-cosmic: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    --shadow-academy: 0 0 40px rgba(47, 91, 255, calc(0.2 * var(--academy-blue-glow-intensity)));
    
    /* Transitions */
    --curve-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --curve-breathe: cubic-bezier(0.87, 0, 0.13, 1);
    --curve-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --curve-3d: cubic-bezier(0.23, 1, 0.32, 1);
    
    /* Mouse position */
    --mouse-x: 50%;
    --mouse-y: 50%;
    
    /* Card index */
    --card-index: 0;
}

/* ============================================================================
   REALM BASE
   ============================================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    background: var(--void-deep);
    color: var(--text-primary);
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    background: var(--void-deep);
    opacity: 0;
    animation: reality-manifest 1.2s var(--curve-smooth) forwards;
    line-height: 1.6;
    padding-bottom: 50px;
    position: relative;
    overflow-x: hidden;
}

@keyframes reality-manifest {
    0% { opacity: 0; filter: blur(10px); }
    100% { opacity: 1; filter: blur(0); }
}

/* ============================================================================
   ULTIMATE QUANTUM REALITY LAYER - VISIBLE EVERYWHERE
   ============================================================================ */
.quantum-reality-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.reality-thread {
    position: fixed;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: screen;
    will-change: transform, opacity;
    opacity: 0.5 !important;
    filter: blur(0.8px) brightness(1.3);
    box-shadow: 0 0 15px currentColor;
}

.quantum-particle {
    position: fixed;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--academy-blue);
    filter: blur(2px);
    animation: particle-drift linear infinite;
    pointer-events: none;
    z-index: 4;
    opacity: 0.4;
    mix-blend-mode: screen;
}

@keyframes particle-drift {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(100vw, 100vh) rotate(360deg); }
}

.quantum-entanglement {
    position: fixed;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: screen;
    opacity: 0.3;
    filter: blur(1px);
    will-change: transform, opacity;
}

.dimensional-echo {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    opacity: 0.03;
    filter: blur(4px);
    mix-blend-mode: overlay;
    animation: echo-drift 40s ease-in-out infinite;
    background: radial-gradient(circle at 30% 30%, var(--academy-blue), transparent 70%);
}

@keyframes echo-drift {
    0%, 100% { transform: scale(1.002) translate(0, 0); opacity: 0.03; }
    25% { transform: scale(1.005) translate(10px, 10px); opacity: 0.05; }
    50% { transform: scale(1.002) translate(20px, 0); opacity: 0.03; }
    75% { transform: scale(1.005) translate(10px, -10px); opacity: 0.05; }
}

/* ============================================================================
   REAL-TIME PRESENCE INDICATORS
   ============================================================================ */
.presence-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.presence-bubble {
    background: var(--panel-deep);
    border: 1px solid var(--academy-blue);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 20px var(--academy-blue-glow);
    animation: bubble-appear 0.3s var(--curve-spring);
    pointer-events: auto;
    cursor: pointer;
}

.presence-bubble:hover {
    transform: scale(1.05);
    border-color: var(--academy-gold);
}

.presence-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--academy-blue), var(--academy-gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #000;
}

.presence-name {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.presence-location {
    font-size: 0.7rem;
    color: var(--academy-blue);
}

@keyframes bubble-appear {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.presence-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-pill);
    border: 1px solid var(--academy-blue);
}

.presence-pulse {
    width: 8px;
    height: 8px;
    background: #50ffb4;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.presence-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================================================
   REAL PRESENCE BUBBLES - UPDATED
   ============================================================================ */
.presence-bubble {
    background: var(--panel-deep);
    border: 1px solid var(--academy-blue);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(8px);
    box-shadow: 0 0 20px var(--academy-blue-glow);
    animation: bubble-appear 0.3s var(--curve-spring);
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.presence-bubble:hover {
    transform: scale(1.05) translateX(-5px);
    border-color: var(--academy-gold);
    box-shadow: 0 0 30px var(--academy-gold);
}

.presence-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #000;
    box-shadow: 0 0 15px currentColor;
}

.presence-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.presence-location {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.presence-role {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--panel-deep);
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    border: 1px solid currentColor;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.presence-bubble:hover .presence-role {
    opacity: 1;
}

@keyframes bubble-appear {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}
/* ============================================================================
   JOURNEY VISUALIZATION
   ============================================================================ */
.journey-path {
    position: fixed;
    top: 100px;
    left: 20px;
    z-index: 9998;
    background: var(--panel-deep);
    border: 1px solid var(--academy-blue);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    backdrop-filter: blur(8px);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 20px var(--academy-blue-glow);
    animation: journey-appear 0.5s var(--curve-spring);
    pointer-events: none;
}

.journey-icon {
    color: var(--academy-blue);
    font-size: 1rem;
}

.journey-steps {
    display: flex;
    gap: 5px;
    color: var(--text-secondary);
}

.journey-step {
    display: flex;
    align-items: center;
    gap: 5px;
}

.journey-step.active {
    color: var(--academy-blue);
    font-weight: 700;
}

.journey-step::after {
    content: '→';
    margin-left: 5px;
    color: var(--text-tertiary);
}

.journey-step:last-child::after {
    display: none;
}

@keyframes journey-appear {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================================================
   MAIN CONTAINER
   ============================================================================ */
.wrap {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 0.8rem 1.5rem;
    background: rgba(10, 14, 22, 0.6);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-academy);
    border-radius: var(--radius-pill);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sigil {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--academy-blue), #1a3a9f);
    border: 1px solid rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.sigil::after {
    content: '';
    position: absolute;
    inset: -40%;
    background: 
        radial-gradient(6px 6px at 18% 30%, rgba(255,255,255,0.45), transparent 55%),
        radial-gradient(3px 3px at 65% 65%, rgba(255,255,255,0.30), transparent 55%);
    opacity: 0.8;
    animation: sigilSpin 18s linear infinite;
}

@keyframes sigilSpin {
    to { transform: rotate(360deg); }
}

.brand h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #fff, var(--academy-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sub {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.nav {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.nav-item {
    padding: 0.6rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.nav-item:hover {
    border-color: var(--academy-blue);
    background: var(--academy-blue-dim);
    transform: translateY(-2px);
}

.user-badge {
    background: var(--academy-blue-dim);
    border: 1px solid var(--academy-blue);
    color: var(--academy-blue);
    padding: 0.3rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
}

/* ============================================================================
   HERO SECTION
   ============================================================================ */
.hero {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2rem;
    margin-bottom: 4rem;
    align-items: center;
}

.hero-left {
    padding: 2rem;
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-academy);
    border-radius: var(--radius-large);
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--curve-smooth);
    animation: legendary-breathe 4.5s var(--curve-breathe) infinite;
    --card-index: 1;
}

.hero-left:hover {
    border-color: var(--academy-blue);
    box-shadow: var(--shadow-academy);
    transform: translateY(-4px) scale(1.02);
    animation-play-state: paused;
}

.hero-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/domains/academy/academyhero.webp') center/cover no-repeat;
    opacity: 0.1;
    z-index: 0;
}

.hero-left::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                var(--academy-blue-glow), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.hero-left:hover::after {
    opacity: 0.4;
}

.hero-left > * {
    position: relative;
    z-index: 2;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: var(--academy-blue-dim);
    border: 1px solid rgba(47, 91, 255, 0.3);
    border-radius: var(--radius-pill);
    color: var(--academy-blue);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--academy-blue);
    box-shadow: 0 0 15px var(--academy-blue);
}

.title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff, var(--academy-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 600px;
}

.stats {
    display: flex;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--academy-blue);
    text-shadow: 0 0 20px var(--academy-blue-glow);
}

.stat-label {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.hero-right {
    padding: 2rem;
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-academy);
    border-radius: var(--radius-large);
    transition: all 0.4s var(--curve-smooth);
    animation: legendary-breathe 4.5s var(--curve-breathe) infinite;
    animation-delay: 0.2s;
    --card-index: 2;
}

.hero-right:hover {
    border-color: var(--academy-blue);
    box-shadow: var(--shadow-academy);
    transform: translateY(-4px) scale(1.02);
    animation-play-state: paused;
}

.seal {
    aspect-ratio: 1/1;
    background: url('/assets/domains/academy/academyseat.webp') center/contain no-repeat;
    opacity: 0.9;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.seal:hover {
    opacity: 1;
    transform: scale(1.05);
    filter: drop-shadow(0 0 30px var(--academy-blue));
}

.seal-meta {
    display: grid;
    gap: 0.8rem;
}

.meta-line {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-tertiary);
}

.meta-line span:last-child {
    color: var(--academy-blue);
    font-weight: 600;
}

/* ============================================================================
   ULTIMATE LEGENDARY CROWN - SMART POSITIONING
   ============================================================================ */
.legendary-crown {
    margin: 2rem 0 3rem;
    padding: 2rem 0 1.5rem;
    background: var(--panel-deep);
    border-top: 2px solid var(--panel-edge-academy);
    border-bottom: 2px solid var(--panel-edge-academy);
    border-radius: var(--radius-large);
    position: relative;
    overflow: visible;
    z-index: 50;
}

.crown-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle at 50% 50%, var(--academy-blue-dim), transparent 70%);
    opacity: 0.3;
    pointer-events: none;
    animation: crown-pulse 8s ease-in-out infinite;
}

@keyframes crown-pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

.crown-header {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--academy-blue);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 1.2rem;
    border-radius: var(--radius-pill);
    letter-spacing: 0.2em;
    white-space: nowrap;
    box-shadow: 0 0 20px var(--academy-blue);
    z-index: 55;
}

.crown-track-container {
    position: relative;
    overflow: visible;
    padding: 0 2rem;
}

.crown-gradient-left,
.crown-gradient-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    pointer-events: none;
    z-index: 52;
}

.crown-gradient-left {
    left: 0;
    background: linear-gradient(90deg, var(--panel-deep), transparent);
}

.crown-gradient-right {
    right: 0;
    background: linear-gradient(-90deg, var(--panel-deep), transparent);
}

.crown-track {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 0.5rem 2rem;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--academy-blue) var(--panel-edge);
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 51;
}

.crown-track::-webkit-scrollbar {
    height: 4px;
}

.crown-track::-webkit-scrollbar-track {
    background: var(--panel-edge);
    border-radius: 10px;
}

.crown-track::-webkit-scrollbar-thumb {
    background: var(--academy-blue);
    border-radius: 10px;
}

.crown-jewel {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.4s var(--curve-spring);
    filter: drop-shadow(0 0 10px var(--jewel-color));
    z-index: 53;
}

.crown-jewel::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: var(--jewel-color);
    opacity: 0;
    transition: opacity 0.3s ease;
    filter: blur(10px);
    z-index: -1;
}

.crown-jewel:hover::before {
    opacity: 0.5;
}

.crown-jewel:hover {
    transform: scale(1.2) translateY(-8px);
    z-index: 200;
}

.crown-jewel.active {
    transform: scale(1.1);
    filter: drop-shadow(0 0 20px var(--jewel-color));
}

.crown-jewel.active::after {
    content: '✦';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--jewel-color);
    font-size: 1rem;
    animation: active-star 2s ease-in-out infinite;
}

@keyframes active-star {
    0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.2); }
}

.jewel-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--jewel-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    box-shadow: 0 0 30px var(--jewel-color), inset 0 0 15px rgba(255,255,255,0.6);
    border: 2px solid rgba(255,255,255,0.4);
    position: relative;
    overflow: hidden;
}

.jewel-face::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.crown-jewel:hover .jewel-face::after {
    opacity: 0.6;
}

.jewel-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.crown-jewel:hover .jewel-icon {
    transform: scale(1.1);
}

.jewel-name {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #000;
    text-shadow: 0 1px 3px rgba(255,255,255,0.8);
}

/* FLOATING HOVER PORTAL - SMART POSITIONING (NEVER OFF SCREEN) */
.crown-hover-portal {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.crown-hover-portal.visible {
    opacity: 1;
}

.hover-card {
    background: var(--panel-deep);
    border: 2px solid var(--hover-color);
    border-radius: var(--radius-medium);
    padding: 1.5rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 40px var(--hover-color);
    backdrop-filter: blur(12px);
    width: 280px;
    transform-origin: center;
    animation: hover-appear 0.3s var(--curve-spring);
}

.hover-card.below {
    transform-origin: top center;
}

@keyframes hover-appear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hover-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--panel-deep);
    border-right: 2px solid var(--hover-color);
    border-bottom: 2px solid var(--hover-color);
}

.hover-arrow.above {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.hover-arrow.below {
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(225deg);
}

.hover-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--hover-color);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
}

.hover-domain {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.hover-meaning {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.hover-preview {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.hover-preview span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.hover-preview i {
    color: var(--hover-color);
    font-size: 0.9rem;
}

/* ============================================================================
   SEARCH SYSTEM
   ============================================================================ */
.search-section {
    margin: 2rem 0 3rem;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--academy-blue);
    font-size: 1.2rem;
    opacity: 0.7;
    pointer-events: none;
    z-index: 2;
}

.search-input {
    width: 100%;
    padding: 1.5rem 1.5rem 1.5rem 4rem;
    background: var(--panel-deep);
    border: 2px solid var(--panel-edge-academy);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: all 0.3s var(--curve-smooth);
    box-shadow: 0 0 30px rgba(0,0,0,0.3);
}

.search-input:focus {
    outline: none;
    border-color: var(--academy-blue);
    box-shadow: 0 0 0 4px var(--academy-blue-dim), 0 0 40px var(--academy-blue-glow);
    transform: scale(1.02);
}

.search-input::placeholder {
    color: var(--text-tertiary);
    font-size: 1rem;
    font-style: italic;
}

.search-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.search-filter {
    padding: 0.6rem 1.5rem;
    background: transparent;
    border: 1px solid var(--panel-edge-academy);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-filter:hover {
    border-color: var(--academy-blue);
    background: var(--academy-blue-dim);
    color: #fff;
}

.search-filter.active {
    background: var(--academy-blue);
    border-color: var(--academy-blue);
    color: #000;
    font-weight: 700;
}

.search-results-count {
    margin-top: 2rem;
    padding: 1rem;
    text-align: center;
    font-size: 1.1rem;
    border-top: 1px solid var(--panel-edge-academy);
    color: var(--academy-blue);
}

.search-results {
    margin-top: 2rem;
    max-height: 500px;
    overflow-y: auto;
    background: var(--panel);
    border-radius: var(--radius-large);
    padding: 1.5rem;
    border: 1px solid var(--panel-edge-academy);
}

.result-group {
    margin-bottom: 1.5rem;
}

.result-group h4 {
    color: var(--academy-blue);
    margin-bottom: 0.8rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-item:hover {
    background: var(--academy-blue-dim);
    transform: translateX(5px);
}

.result-type {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    background: var(--academy-blue);
    color: #000;
    border-radius: 4px;
    text-transform: uppercase;
}

.result-title {
    color: var(--text-primary);
    font-weight: 500;
}

.result-more {
    padding: 0.5rem;
    color: var(--text-tertiary);
    font-style: italic;
    text-align: center;
}

.no-results {
    text-align: center;
    padding: 3rem;
}

.no-results-icon {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
    display: block;
}

.no-results h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-tertiary);
}

/* ============================================================================
   COLOR MEANING PANEL
   ============================================================================ */
.color-meaning {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-academy);
    border-radius: var(--radius-large);
    position: relative;
    overflow: hidden;
    animation: legendary-breathe 4.5s var(--curve-breathe) infinite;
    animation-delay: 0.3s;
    --card-index: 3;
}

.color-meaning:hover {
    animation-play-state: paused;
    border-color: var(--academy-blue);
    transform: scale(1.02);
}

.color-meaning::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 30%, var(--academy-blue-dim), transparent 70%);
    opacity: 0.5;
}

.meaning-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.meaning-color {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--academy-blue);
    box-shadow: 0 0 30px var(--academy-blue);
}

.meaning-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--academy-blue);
}

.meaning-text {
    position: relative;
    z-index: 2;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 800px;
}

.meaning-text strong {
    color: var(--academy-blue);
}

/* ============================================================================
   3D CARDS - LEGENDARY FLIP ANIMATION
   ============================================================================ */
.pillar-card, .school-card, .program-card {
    position: relative;
    transition: transform 0.6s var(--curve-3d);
    transform-style: preserve-3d;
    cursor: pointer;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: inherit;
    padding: inherit;
    background: inherit;
    border: inherit;
    box-shadow: inherit;
}

.card-back {
    transform: rotateY(180deg);
    background: var(--panel-deep);
    border-color: var(--academy-blue);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card-back h4 {
    color: var(--academy-blue);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.card-back p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.card-back .btn {
    background: var(--academy-blue-dim);
    border: 1px solid var(--academy-blue);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    color: var(--academy-blue);
    text-decoration: none;
    transition: all 0.3s ease;
}

.card-back .btn:hover {
    background: var(--academy-blue);
    color: #000;
}

.pillar-card.flipped, .school-card.flipped, .program-card.flipped {
    transform: rotateY(180deg);
}

/* Ensure cards have height for 3D effect */
.pillar-card, .school-card, .program-card {
    min-height: 250px;
}

/* ============================================================================
   🎴 CARD BREATHING ANIMATION - ADDED FOR LIVING EFFECT
   ============================================================================ */
.pillar-card {
    animation: card-breathe 4s var(--curve-breathe) infinite;
    animation-delay: calc(var(--card-index) * 0.2s);
}

.school-card, .program-card {
    animation: card-breathe 4.5s var(--curve-breathe) infinite;
    animation-delay: calc(var(--card-index) * 0.15s);
}

@keyframes card-breathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 0 0px var(--academy-blue-glow);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 8px 30px var(--academy-blue-dim), 0 0 30px var(--academy-blue-glow);
    }
}

/* Pause breathing on hover for better interaction */
.pillar-card:hover, .school-card:hover, .program-card:hover {
    animation-play-state: paused;
}

/* ============================================================================
   LIVING BREATH - LEGENDARY PULSE ON ACTIVE ELEMENTS
   ============================================================================ */
@keyframes legendary-breathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    50% {
        transform: scale(1.015);
        box-shadow: 0 8px 24px var(--academy-blue-dim);
    }
}

.pillar-card.active, .school-card.active, .program-card.active {
    animation: legendary-pulse 3s ease-in-out infinite;
    box-shadow: 0 0 30px var(--academy-blue), 0 0 60px var(--academy-blue-dim);
    border-color: var(--academy-blue);
    z-index: 20;
}

@keyframes legendary-pulse {
    0%, 100% { 
        filter: brightness(1); 
        transform: scale(1);
        box-shadow: 0 0 30px var(--academy-blue), 0 0 60px var(--academy-blue-dim);
    }
    50% { 
        filter: brightness(1.2); 
        transform: scale(1.02);
        box-shadow: 0 0 50px var(--academy-blue), 0 0 90px var(--academy-blue-glow);
    }
}

/* ============================================================================
   PILLARS GRID
   ============================================================================ */
.pillars-section {
    margin: 3rem 0;
}

.pillars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.pillar-card {
    background: var(--panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--panel-edge-academy);
    border-radius: var(--radius-large);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.4s var(--curve-smooth);
    position: relative;
    overflow: hidden;
}

.pillar-card:nth-child(1) { --card-index: 1; }
.pillar-card:nth-child(2) { --card-index: 2; }
.pillar-card:nth-child(3) { --card-index: 3; }
.pillar-card:nth-child(4) { --card-index: 4; }
.pillar-card:nth-child(5) { --card-index: 5; }
.pillar-card:nth-child(6) { --card-index: 6; }
.pillar-card:nth-child(7) { --card-index: 7; }

.pillar-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(800px 400px at 30% 30%, var(--academy-blue-dim), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.pillar-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                var(--academy-blue-glow), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.pillar-card:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--academy-blue);
    box-shadow: var(--shadow-academy);
}

.pillar-card:hover::before {
    opacity: 0.3;
}

.pillar-card:hover::after {
    opacity: 0.4;
}

.pillar-number {
    font-size: 0.8rem;
    color: var(--academy-blue);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.pillar-title {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    position: relative;
    z-index: 2;
}

.pillar-desc {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.pillar-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1rem;
    position: relative;
    z-index: 2;
}

.pillar-meta span:last-child {
    color: var(--academy-blue);
    font-weight: 600;
}

/* ============================================================================
   SCHOOLS GRID
   ============================================================================ */
.schools-panel {
    display: none;
    margin-top: 2rem;
    animation: slide-up 0.5s var(--curve-smooth);
}

.schools-panel.active {
    display: block;
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.back-button {
    padding: 0.6rem 1.2rem;
    background: var(--academy-blue-dim);
    border: 1px solid var(--academy-blue);
    border-radius: var(--radius-pill);
    color: var(--academy-blue);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: var(--academy-blue);
    color: #000;
    transform: translateX(-4px);
}

.panel-title {
    font-size: 2rem;
    font-family: 'Cinzel', serif;
    color: var(--academy-blue);
}

.schools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.2rem;
}

.school-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-medium);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.school-card:hover {
    border-color: var(--academy-blue);
    transform: translateY(-4px) scale(1.02);
    background: rgba(47, 91, 255, 0.05);
}

.school-number {
    font-size: 0.7rem;
    color: var(--academy-blue);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.school-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.school-programs {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* ============================================================================
   PROGRAMS GRID
   ============================================================================ */
.programs-panel {
    display: none;
    margin-top: 2rem;
}

.programs-panel.active {
    display: block;
}

.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.program-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-medium);
    padding: 1.2rem;
    transition: all 0.3s ease;
}

.program-card:hover {
    border-color: var(--academy-blue);
    transform: translateY(-2px) scale(1.02);
}

.program-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--academy-blue);
    margin-bottom: 0.5rem;
}

.program-phases {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* ============================================================================
   HIGHLIGHT ANIMATION
   ============================================================================ */
@keyframes pulse-highlight {
    0%, 100% { 
        box-shadow: 0 0 0 0 var(--academy-blue); 
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 10px var(--academy-blue-dim), 0 0 30px var(--academy-blue);
        transform: scale(1.02);
    }
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(47, 91, 255, 0.2);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.quantum-signature {
    margin-top: 1rem;
    font-size: 0.7rem;
    color: var(--academy-blue);
    letter-spacing: 0.2em;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1000px) {
    .hero {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pillars-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .wrap { padding: 1rem; }
    .title { font-size: 2rem; }
    .stats { flex-direction: column; gap: 1rem; }
    .meaning-header { flex-direction: column; text-align: center; }
    
    .search-filters {
        flex-direction: column;
        align-items: center;
    }
    
    .search-filter {
        width: 100%;
        max-width: 300px;
    }
    
    .crown-jewel {
        width: 70px;
        height: 70px;
    }
    
    .jewel-icon {
        font-size: 1.6rem;
    }
    
    .jewel-name {
        font-size: 0.65rem;
    }
    
    .hover-card {
        width: 240px;
        padding: 1.2rem;
    }
    
    .journey-path {
        top: auto;
        bottom: 20px;
        left: 20px;
    }
}

@media (max-width: 480px) {
    .crown-jewel {
        width: 60px;
        height: 60px;
    }
    
    .jewel-icon {
        font-size: 1.4rem;
    }
    
    .jewel-name {
        font-size: 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    
    .quantum-reality-layer {
        display: none;
    }
}

/* ============================================================================
   🚨 HOTFIX: Card Display Issues - Double Line & Missing Text
   ============================================================================ */
.pillar-card, .school-card, .program-card {
    transform-style: flat !important; /* Disable 3D */
    min-height: auto !important;
    padding: 2rem !important;
}

.card-front, .card-back {
    position: relative !important;
    backface-visibility: visible !important;
    transform: none !important;
    height: auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.card-back {
    display: none !important; /* Hide back until flip is fixed */
}

/* Force all text to be visible */
.pillar-number,
.pillar-title,
.pillar-desc,
.pillar-meta,
.school-number,
.school-title,
.school-programs,
.program-title,
.program-phases {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    color: var(--text-primary) !important;
}

/* Fix double border/lines */
.pillar-card::before,
.pillar-card::after {
    content: none !important; /* Remove double overlay effects temporarily */
}

/* Ensure text colors are correct */
.pillar-desc {
    color: var(--text-tertiary) !important;
}

.pillar-meta span:last-child {
    color: var(--academy-blue) !important;
}