:root {
    /* Deep Zenith Buddhist Palette */
    --bg-base: #181512;           /* Deep dark temple brown */
    --bg-sidebar: #110e0c;        /* Even darker */
    --bg-card: rgba(255, 255, 255, 0.02);
    --border-card: rgba(212, 175, 55, 0.2);
    --text-main: #f4efdf;         /* Aged parchment */
    --text-muted: #a69888;        /* Ash-like muted brown */
    --accent-gold: #ebb140;       /* Bright Buddha gold */
    --accent-crimson: #a02c2d;    /* Temple architectural red */
    --accent-gradient: linear-gradient(135deg, #ebb140 0%, #aa7722 100%);
    --font-heading: 'Noto Serif SC', serif;
    --font-body: 'Noto Sans SC', sans-serif;
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body.dark-zen-theme {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

.serif {
    font-family: var(--font-heading) !important;
}

/* Ambient Background */
.ambient-bg {
    position: fixed;
    top: 50%;
    left: calc(50% + var(--sidebar-width)/2);
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    max-width: 800px;
    max-height: 800px;
    z-index: -1;
    pointer-events: none;
    opacity: 0.15;
    color: var(--accent-gold);
}

.lotus-svg {
    width: 100%;
    height: 100%;
    animation: rotateSlow 180s linear infinite;
    filter: drop-shadow(0 0 40px rgba(235, 177, 64, 0.3));
}

@keyframes rotateSlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Base Panel Styles */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
}

/* Layout Architecture */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 0;
    z-index: 100;
}

.sidebar-header {
    padding: 0 2rem;
    margin-bottom: 3rem;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0px;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.accent {
    color: var(--accent-gold);
}

.domain-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(235, 177, 64, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    display: inline-block;
    margin-top: 0.8rem;
    border: 1px solid rgba(235, 177, 64, 0.2);
}

/* Table of Contents Nav */
.toc {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.toc-link {
    text-decoration: none;
    color: var(--text-muted);
    padding: 1rem 2rem;
    font-size: 1rem;
    position: relative;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.toc-link:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.02);
}

.toc-link.active {
    color: var(--accent-gold);
    border-left-color: var(--accent-gold);
    background: rgba(235, 177, 64, 0.05);
}

.sidebar-footer {
    margin-top: auto;
    padding: 0 2rem;
    text-align: center;
}

/* Elegant Chinese Seal Design */
.chinese-seal {
    display: inline-block;
    padding: 1.2rem 0.8rem;
    border: 3px solid rgba(160, 44, 45, 0.85); /* Deep crimson red */
    position: relative;
    color: rgba(160, 44, 45, 0.9);
    font-family: "Kaiti SC", "STKaiti", var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 2;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 0.4em;
    border-radius: 4px;
    background: rgba(160, 44, 45, 0.05); /* Slight ink bleed background */
    box-shadow: 
        inset 0 0 12px rgba(160, 44, 45, 0.15),
        0 8px 20px rgba(0,0,0, 0.4);
    transform: rotate(-1.5deg); /* Slight natural stamp tilt */
    transition: transform 0.3s ease, filter 0.3s ease;
    cursor: default;
}

.chinese-seal:hover {
    transform: rotate(0deg) scale(1.02);
    filter: brightness(1.2);
}

/* Double inner border effect for the stamp */
.chinese-seal::before {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    border: 1px solid rgba(160, 44, 45, 0.4);
    pointer-events: none;
}

/* Add a subtle worn/ink texture using SVG noise gradient */
.chinese-seal::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.08"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.6" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23noise)"/></svg>');
    pointer-events: none;
    mix-blend-mode: multiply;
}

.mobile-seal {
    margin: 0 auto;
}

/* Top Nav (Mobile Only) */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 0;
    border-bottom: 1px solid var(--border-card);
    flex-direction: column;
}

.mobile-nav-header {
    padding: 1rem 1.5rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-toc {
    display: flex;
    overflow-x: auto;
    padding: 0 1.5rem;
    gap: 1.5rem;
    scrollbar-width: none; /* Firefox */
}
.mobile-toc::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.mobile-toc-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    white-space: nowrap;
    padding: 0.8rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.mobile-toc-link.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    max-width: 1400px; /* Increased for grid layout */
    padding: 6rem 4rem;
}

/* Section Anchor Padding */
.content-section {
    scroll-margin-top: 4rem; /* Offset for anchor jumps */
}

/* Hero Section */
.hero {
    margin-bottom: 6rem;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: rgba(235, 177, 64, 0.1);
    color: var(--accent-gold);
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(235, 177, 64, 0.2);
}

.title {
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--accent-gold);
    margin-bottom: 2rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 750px;
    line-height: 1.8;
}

/* Layout Utilities */
.detailed-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

/* 2-Column Desktop Grid */
@media (min-width: 1200px) {
    .detailed-layout {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
    #stage-4 {
        grid-column: 1 / -1;
    }
}

.mt-large { margin-top: 5rem; }
.detailed-layout > .mt-large { margin-top: 0; } /* Let grid gap handle top level spacing */

.mt-small { margin-top: 0.8rem; }
.mt-top { margin-top: 2rem; }
.text-center { text-align: center; }

/* Stage Cards */
.stage-section {
    padding: 3rem;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    height: 100%; /* Make them equal height in grid rows */
}

.stage-num {
    font-size: 5rem;
    color: rgba(235, 177, 64, 0.08); /* Faint gold */
    line-height: 1;
    position: absolute;
    top: 2.5rem;
    right: 3rem;
    font-weight: 700;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
}

.stage-title {
    font-size: 1.8rem;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stage-date {
    display: inline-block;
    font-size: 0.9rem;
    color: #fff;
    background: var(--accent-crimson);
    padding: 0.3rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    margin-bottom: 2rem;
}

.detail-content {
    font-size: 1.05rem;
    color: var(--text-muted);
}

.feature-list {
    list-style: none;
}

.feature-list li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1.5rem;
}

.feature-list li::before {
    content: "🔸";
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 1rem;
}

.feature-list li strong {
    color: var(--accent-gold);
    font-weight: 600;
}

.highlight-text {
    color: #ffb74d !important;
}

.alert-box {
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent-crimson);
    font-size: 1rem;
    color: var(--text-main);
    margin-top: 1.5rem;
}

.styled-list {
    padding-left: 1.5rem;
    margin-top: 1.5rem;
}

.styled-list li {
    margin-bottom: 1rem;
    padding-left: 0.5rem;
}

/* Timeline */
.timeline-row {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0 1rem;
    margin-bottom: 3.5rem;
}

.timeline-row::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 4rem;
    right: 4rem;
    height: 1px;
    background: rgba(235, 177, 64, 0.2);
    z-index: 0;
}

.time-item {
    position: relative;
    z-index: 1;
    background: var(--bg-sidebar);
    padding: 0.6rem 1.4rem;
    border-radius: 30px;
    border: 1px solid var(--accent-gold);
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 500;
}

.time-item span {
    color: var(--accent-gold);
    font-weight: 700;
    margin-right: 0.5rem;
}

/* IP Master Grid */
.subsection-title {
    color: var(--accent-gold);
    margin-bottom: 1rem;
}

.desc-text {
    color: var(--text-muted);
}

.ip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.ip-card {
    padding: 2rem 1.5rem;
    text-align: left;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.ip-card:hover {
    transform: translateY(-5px);
    border-color: rgba(235, 177, 64, 0.5);
    background: rgba(255, 255, 255, 0.04);
}

.ip-card h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--accent-gold);
    line-height: 1.4;
}

.master-type {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-body);
}

.ip-desc {
    margin-top: 1rem;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.ip-action {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.2rem;
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    border: 1px dashed rgba(235, 177, 64, 0.2);
}

.action-tag {
    display: block;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--accent-gold);
}

.mobile-footer {
    display: none;
    text-align: center;
    margin-top: 5rem;
    padding-bottom: 3rem;
}

/* Animations */
.slide-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }

/* Responsive adjustments */
@media (max-width: 992px) {
    /* Switch to mobile view without sidebar */
    .app-layout { flex-direction: column; }
    .sidebar { display: none; }
    .mobile-nav { display: flex; }
    
    .main-content {
        margin-left: 0;
        padding: 8rem 2rem 2rem; /* Add more top padding because mobile nav has two floors now */
    }
    
    .ambient-bg { left: 50%; }
    .mobile-footer { display: block; }
    
    .stage-section { padding: 2.5rem 2rem; }
    .stage-num { font-size: 4rem; right: 1.5rem; top: 1.5rem; }
    
    .timeline-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .timeline-row::before {
        left: 2rem;
        top: 0;
        height: 100%;
        width: 1px;
    }
}
