:root {
    --bg-primary: #05050a;
    --bg-secondary: #0c0c14;
    --bg-elevated: #12121c;
    --glass-bg: rgba(18, 18, 28, 0.82);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f4f4f8;
    --text-secondary: #b4b4c0;
    --text-muted: #7a7a8a;
    --accent-purple: #9d4edd;
    --accent-cyan: #00d4ff;
    --accent-pink: #ff56a1;
    --accent-orange: #ff9350;
    --gradient-primary: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
    --gradient-warm: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-orange) 100%);
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --content-max: 780px;
    --shadow-card: 0 16px 48px rgba(0, 0, 0, 0.35);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

.background-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 18%, rgba(157, 78, 221, 0.18) 0%, transparent 42%),
        radial-gradient(circle at 88% 12%, rgba(0, 212, 255, 0.12) 0%, transparent 38%),
        radial-gradient(circle at 50% 100%, rgba(255, 86, 161, 0.08) 0%, transparent 45%),
        linear-gradient(180deg,
            rgba(5, 5, 10, 0.62) 0%,
            rgba(5, 5, 10, 0.18) 32%,
            rgba(5, 5, 10, 0.12) 48%,
            rgba(5, 5, 10, 0.55) 72%,
            rgba(8, 8, 16, 0.82) 100%);
}

.hero-fixed-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-color: var(--bg-primary);
    background-image: url("images/hero-workflow.webp");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.hero-fixed-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg,
            rgba(5, 5, 10, 0.65) 0%,
            rgba(5, 5, 10, 0.2) 34%,
            rgba(5, 5, 10, 0.15) 50%,
            rgba(5, 5, 10, 0.75) 78%,
            rgba(5, 5, 10, 0.9) 100%),
        radial-gradient(circle at 50% 22%, rgba(157, 78, 221, 0.14) 0%, transparent 55%);
}

.page-shell {
    position: relative;
    z-index: 0;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
}

/* Hero */
.guide-hero {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: clamp(16rem, 42vh, 28rem);
    padding: 2.5rem 1rem 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.guide-title-wrap {
    display: inline-block;
    max-width: 100%;
    padding: 1rem 1.75rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(5, 5, 10, 0.28);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.guide-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.35));
}

.guide-note {
    max-width: 42rem;
    margin: 0;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 212, 255, 0.22);
    background: rgba(5, 5, 10, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-secondary);
    font-size: clamp(0.92rem, 2.2vw, 1.02rem);
    line-height: 1.65;
    text-align: left;
}

.hero-reveal-gap {
    min-height: clamp(5rem, 16vh, 11rem);
    margin: 1.25rem 0 0.5rem;
}

.core-rule-featured {
    margin-top: 0;
    margin-bottom: 2rem;
}

/* Layout */
.guide-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
}

/* Sidebar */
.guide-sidebar {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    padding-right: 0.5rem;
}

.guide-sidebar::-webkit-scrollbar {
    width: 4px;
}

.guide-sidebar::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

.sidebar-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.sidebar-card h2 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.2);
    color: var(--text-primary);
    font-weight: 600;
}

.phase-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    border-radius: 6px;
    background: rgba(157, 78, 221, 0.2);
    color: var(--accent-cyan);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-nav a.active .phase-num {
    background: var(--gradient-primary);
    color: #fff;
}

/* Main content */
.guide-main {
    min-width: 0;
}

.glass-card {
    background: rgba(18, 18, 28, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-card);
}

.glass-card:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.phase-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    height: 2.75rem;
    border-radius: 14px;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(157, 78, 221, 0.35);
}

.phase-badge--core {
    background: var(--gradient-warm);
    box-shadow: 0 8px 24px rgba(255, 86, 161, 0.3);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.section-header h2 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    padding-top: 0.35rem;
}

.section-intro {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 1.02rem;
}

.glass-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin: 1.5rem 0 0.75rem;
}

.glass-card p,
.glass-card li {
    color: var(--text-secondary);
}

.glass-card ul,
.glass-card ol {
    padding-left: 1.4rem;
    margin-bottom: 1rem;
}

.glass-card li {
    margin-bottom: 0.45rem;
}

.glass-card li::marker {
    color: var(--accent-purple);
}

.glass-card code {
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
    font-size: 0.88em;
    padding: 0.15em 0.45em;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    color: var(--accent-cyan);
}

[data-feature-date] {
    color: var(--accent-cyan);
    font-weight: 600;
}

.rule-list {
    list-style: none;
    padding: 0;
    margin: 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.rule-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin: 0;
    color: var(--text-primary);
}

.rule-list .rule-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent-cyan);
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.callout {
    margin: 1.25rem 0;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-cyan);
    background: rgba(0, 212, 255, 0.06);
    color: var(--text-secondary);
}

.callout strong {
    color: var(--text-primary);
}

/* Guide images */
.guide-figure {
    margin: 1.5rem 0 0;
}

.guide-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-card);
    background: rgba(0, 0, 0, 0.2);
}

/* Prompt blocks */
.prompt-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0 0.65rem;
}

.prompt-label span {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.prompt-block {
    position: relative;
    margin: 0 0 1rem;
}

.prompt-block pre,
.prompt-block .prompt-body {
    margin: 0;
    padding: 1.35rem 1.5rem;
    padding-right: 3.5rem;
    background: #07070e;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
    font-size: 0.82rem;
    line-height: 1.65;
    color: #c8c8d4;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}

.prompt-field {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: var(--text-primary);
    background: rgba(0, 212, 255, 0.06);
    border: 1px solid rgba(0, 212, 255, 0.28);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    resize: vertical;
}

.prompt-field::placeholder {
    color: rgba(200, 200, 212, 0.45);
    font-style: italic;
}

.prompt-field:hover {
    border-color: rgba(0, 212, 255, 0.45);
    background: rgba(0, 212, 255, 0.09);
}

.prompt-field:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
    background: rgba(0, 212, 255, 0.1);
}

.prompt-field--block {
    display: block;
    width: 100%;
    min-height: 4.5rem;
    margin: 0.35rem 0 0.65rem;
}

.prompt-field--inline {
    display: inline-block;
    width: auto;
    min-width: 12rem;
    max-width: 100%;
    margin: 0 0.15rem;
    vertical-align: baseline;
    resize: none;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(0, 212, 255, 0.3);
}

.copy-btn.copied {
    color: var(--accent-cyan);
    border-color: rgba(0, 212, 255, 0.4);
}

.copy-btn svg {
    width: 14px;
    height: 14px;
}

.subsection-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1.25rem 0 0.5rem;
}

.epilogue {
    border-style: dashed;
    opacity: 0.92;
}

.epilogue p {
    font-style: italic;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 960px) {
    .guide-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .guide-sidebar {
        position: static;
        max-height: none;
        padding-right: 0;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.35rem;
    }
}

@media (max-width: 600px) {
    .guide-hero {
        min-height: clamp(13rem, 34vh, 18rem);
        padding: 1.75rem 0.35rem 1.25rem;
    }

    .guide-note {
        padding: 0.8rem 0.9rem;
    }

    .guide-title-wrap {
        padding: 0.85rem 1.1rem;
    }

    .hero-reveal-gap {
        min-height: clamp(3.5rem, 10vh, 6rem);
        margin-top: 1rem;
    }

    .core-rule-featured {
        margin-bottom: 1.5rem;
    }

    .glass-card {
        padding: 1.35rem;
    }

    .section-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .section-header h2 {
        font-size: 1.35rem;
        padding-top: 0;
    }

    .prompt-block pre,
    .prompt-block .prompt-body {
        font-size: 0.76rem;
        padding: 1.1rem;
        padding-right: 1.1rem;
        padding-top: 3rem;
    }

    .prompt-field--inline {
        display: block;
        width: 100%;
        min-width: 0;
        margin: 0.35rem 0;
    }

    .copy-btn {
        top: 0.5rem;
        right: 0.5rem;
    }
}
