/* ============================================================
   economics.quest v2 - RPG Quest Journal Styles
   ============================================================ */

/* --- Palette --- */
:root {
    --dungeon-black: #08080F;
    --scroll-parchment: #F0E0C8;
    --neon-potion: #00FF88;
    --neon-spell: #FF4488;
    --gold-coin: #FFD040;
    --marble-cream: #E8E0D0;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--dungeon-black);
    color: var(--scroll-parchment);
    font-family: 'Crimson Text', Georgia, serif;
    font-size: clamp(15px, 1.05vw, 18px);
    line-height: 1.8;
    overflow-x: hidden;
}

/* --- Typography --- */
.pixel-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1.6;
}

h1, h2 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
}

strong {
    color: var(--gold-coin);
    font-weight: 700;
}

/* ============================================================
   Quest Opening (Hero)
   ============================================================ */
.quest-opening {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--dungeon-black);
}

/* Floating dungeon particles */
.dungeon-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.dungeon-particles .particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    15% {
        opacity: 0.6;
    }
    85% {
        opacity: 0.4;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) scale(1);
    }
}

/* --- Scroll Container --- */
.scroll-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    z-index: 1;
    opacity: 0;
    transform: scaleY(0);
    transform-origin: center center;
    animation: scrollMaterialize 700ms 300ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    padding: 0 20px;
}

@keyframes scrollMaterialize {
    0% {
        opacity: 0;
        transform: scaleY(0);
    }
    50% {
        opacity: 1;
        transform: scaleY(1.03);
    }
    70% {
        transform: scaleY(0.98);
    }
    100% {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Scroll Rollers (top and bottom) */
.scroll-roller {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    position: relative;
    z-index: 2;
}

.roller-bar {
    flex: 1;
    height: 14px;
    background: linear-gradient(
        180deg,
        #C4A870 0%,
        #A08050 30%,
        #8B6914 50%,
        #A08050 70%,
        #C4A870 100%
    );
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.roller-knob {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--gold-coin), #8B6914);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

/* Scroll Body */
.scroll-body {
    position: relative;
    /* Marble-texture CSS background */
    background:
        linear-gradient(125deg, rgba(232, 224, 208, 0.18) 0%, transparent 40%),
        linear-gradient(245deg, rgba(232, 224, 208, 0.12) 0%, transparent 35%),
        linear-gradient(55deg, rgba(255, 208, 64, 0.06) 0%, transparent 50%),
        linear-gradient(170deg, rgba(240, 224, 200, 0.14) 10%, transparent 60%),
        linear-gradient(310deg, rgba(232, 224, 208, 0.09) 5%, transparent 45%),
        var(--scroll-parchment);
    color: var(--dungeon-black);
    padding: clamp(48px, 7vh, 80px) clamp(28px, 5vw, 56px);
    text-align: center;
    border-left: 4px solid var(--gold-coin);
    border-right: 4px solid var(--gold-coin);
    overflow: hidden;
}

/* Marble veins - subtle diagonal lines for texture */
.scroll-vein {
    position: absolute;
    pointer-events: none;
    opacity: 0.08;
}

.scroll-vein-1 {
    top: 10%;
    left: -5%;
    width: 110%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8B6914, transparent);
    transform: rotate(-8deg);
}

.scroll-vein-2 {
    top: 45%;
    left: -5%;
    width: 110%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #A08050, transparent);
    transform: rotate(5deg);
}

.scroll-vein-3 {
    top: 78%;
    left: -5%;
    width: 110%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8B6914, transparent);
    transform: rotate(-3deg);
}

/* Ornate corner decorations */
.scroll-ornament {
    position: absolute;
    width: 28px;
    height: 28px;
    border-color: var(--gold-coin);
    border-style: solid;
    opacity: 0.6;
}

.scroll-ornament::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: var(--gold-coin);
    border-style: solid;
    opacity: 0.4;
}

.scroll-ornament-tl {
    top: 14px;
    left: 14px;
    border-width: 3px 0 0 3px;
}
.scroll-ornament-tl::after {
    top: 6px;
    left: 6px;
    border-width: 2px 0 0 2px;
}

.scroll-ornament-tr {
    top: 14px;
    right: 14px;
    border-width: 3px 3px 0 0;
}
.scroll-ornament-tr::after {
    top: 6px;
    right: 6px;
    border-width: 2px 2px 0 0;
}

.scroll-ornament-bl {
    bottom: 14px;
    left: 14px;
    border-width: 0 0 3px 3px;
}
.scroll-ornament-bl::after {
    bottom: 6px;
    left: 6px;
    border-width: 0 0 2px 2px;
}

.scroll-ornament-br {
    bottom: 14px;
    right: 14px;
    border-width: 0 3px 3px 0;
}
.scroll-ornament-br::after {
    bottom: 6px;
    right: 6px;
    border-width: 0 2px 2px 0;
}

/* --- Title --- */
.title-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
}

.title-economics {
    font-size: clamp(28px, 4.5vw, 56px);
    color: var(--dungeon-black);
    opacity: 0;
    animation: titleTypeIn 500ms 900ms ease-out forwards;
    text-shadow:
        0 0 20px rgba(0, 255, 136, 0.4),
        0 0 40px rgba(0, 255, 136, 0.2);
}

@keyframes titleTypeIn {
    0% {
        opacity: 0;
        letter-spacing: 0.2em;
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        letter-spacing: 0.04em;
        filter: blur(0);
    }
}

.title-quest {
    font-size: clamp(36px, 5.5vw, 72px);
    color: var(--gold-coin);
    opacity: 0;
    animation: questFlash 500ms 1400ms ease-out forwards;
    text-shadow:
        0 0 30px rgba(255, 208, 64, 0.5),
        0 0 60px rgba(255, 208, 64, 0.3);
}

@keyframes questFlash {
    0% {
        opacity: 0;
        transform: scale(1.4);
        text-shadow:
            0 0 80px rgba(255, 208, 64, 1),
            0 0 160px rgba(255, 208, 64, 0.8);
        filter: brightness(2);
    }
    40% {
        opacity: 1;
        transform: scale(1.05);
        filter: brightness(1.3);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        text-shadow:
            0 0 30px rgba(255, 208, 64, 0.5),
            0 0 60px rgba(255, 208, 64, 0.3);
        filter: brightness(1);
    }
}

.quest-subtitle {
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInUp 500ms 1800ms ease-out forwards;
}

.quest-subtitle .pixel-label {
    color: #6B6050;
    font-size: 10px;
}

.quest-status-bar {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border: 2px solid var(--gold-coin);
    border-radius: 4px;
    opacity: 0;
    animation: fadeInUp 500ms 2000ms ease-out forwards;
    background: rgba(255, 208, 64, 0.04);
}

.status-label {
    color: #6B6050;
    font-size: 10px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neon-potion);
    box-shadow: 0 0 6px var(--neon-potion);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--neon-potion); }
    50% { opacity: 0.5; box-shadow: 0 0 12px var(--neon-potion); }
}

.status-value {
    color: var(--neon-potion);
    font-size: 10px;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

/* Scroll Seal */
.scroll-seal {
    margin-top: 28px;
    opacity: 0;
    animation: sealAppear 600ms 2200ms ease-out forwards;
}

@keyframes sealAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-180deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        opacity: 0.6;
        transform: scale(1) rotate(0deg);
    }
}

/* Scroll down indicator */
.scroll-indicator {
    position: absolute;
    bottom: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 2;
    opacity: 0;
    animation: fadeInUp 500ms 2600ms ease-out forwards;
}

.scroll-indicator .pixel-label {
    color: rgba(240, 224, 200, 0.4);
    font-size: 9px;
}

.scroll-arrow {
    width: 16px;
    height: 16px;
    border-right: 2px solid rgba(240, 224, 200, 0.3);
    border-bottom: 2px solid rgba(240, 224, 200, 0.3);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.3; }
    50% { transform: rotate(45deg) translateY(6px); opacity: 0.7; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Quest Chapters
   ============================================================ */
.quest-chapter {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 6vh, 72px) 24px;
}

.chapter-scroll {
    width: 100%;
    max-width: 640px;
    background:
        linear-gradient(125deg, rgba(232, 224, 208, 0.18) 0%, transparent 40%),
        linear-gradient(245deg, rgba(232, 224, 208, 0.12) 0%, transparent 35%),
        linear-gradient(55deg, rgba(255, 208, 64, 0.06) 0%, transparent 50%),
        var(--scroll-parchment);
    color: var(--dungeon-black);
    padding: clamp(32px, 5vh, 56px) clamp(24px, 4vw, 40px);
    border: 3px solid var(--gold-coin);
    border-radius: 4px;
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.chapter-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Chapter number side badge */
.chapter-scroll::before {
    content: attr(data-chapter-num);
    position: absolute;
    top: -1px;
    right: 24px;
    background: var(--gold-coin);
    color: var(--dungeon-black);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 0 0 4px 4px;
    letter-spacing: 0.05em;
}

/* Chapter Header */
.chapter-header {
    margin-bottom: 28px;
    text-align: center;
}

.chapter-number {
    display: block;
    color: var(--neon-potion);
    font-size: 10px;
    margin-bottom: 12px;
    text-shadow: 0 0 6px rgba(0, 255, 136, 0.3);
}

.chapter-title {
    font-size: clamp(24px, 3.5vw, 48px);
    color: var(--dungeon-black);
    margin-bottom: 16px;
    line-height: 1.2;
}

.chapter-objective {
    display: flex;
    align-items: baseline;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.objective-label {
    color: var(--neon-spell);
    font-size: 10px;
    text-shadow: 0 0 6px rgba(255, 68, 136, 0.3);
}

.objective-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-style: italic;
    font-size: clamp(14px, 1vw, 16px);
    color: #5A5040;
}

/* Chapter progress bar */
.chapter-progress-bar {
    width: 80%;
    max-width: 300px;
    height: 6px;
    background: rgba(8, 8, 15, 0.08);
    border-radius: 3px;
    margin: 16px auto 0;
    overflow: hidden;
}

.chapter-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--neon-potion), var(--gold-coin));
    border-radius: 3px;
    transition: width 800ms cubic-bezier(0.22, 1, 0.36, 1) 200ms;
}

.chapter-scroll.visible .chapter-progress-fill {
    width: 100%;
}

/* Chapter Body */
.chapter-body {
    margin-bottom: 28px;
}

.chapter-body p {
    margin-bottom: 16px;
    text-align: left;
}

.chapter-body p:last-child {
    margin-bottom: 0;
}

/* --- Reward Box --- */
.reward-box {
    border: 2px solid var(--gold-coin);
    border-radius: 4px;
    padding: 20px;
    margin-top: 24px;
    background: rgba(255, 208, 64, 0.06);
    text-align: center;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 300ms ease,
                opacity 400ms ease;
}

.reward-box.visible {
    transform: scale(1);
    opacity: 1;
}

.reward-box:hover {
    box-shadow: 0 0 16px rgba(255, 208, 64, 0.5), 0 0 32px rgba(255, 208, 64, 0.15);
}

.reward-header {
    display: block;
    color: var(--gold-coin);
    font-size: 10px;
    margin-bottom: 14px;
    text-shadow: 0 0 6px rgba(255, 208, 64, 0.3);
}

.reward-list {
    list-style: none;
    text-align: left;
    margin-bottom: 14px;
}

.reward-list li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 8px;
    font-size: clamp(13px, 0.95vw, 15px);
}

.reward-list li::before {
    content: "\25C6";
    position: absolute;
    left: 0;
    color: var(--gold-coin);
    font-size: 10px;
    top: 4px;
}

.xp-reward {
    padding-top: 6px;
    border-top: 1px solid rgba(255, 208, 64, 0.15);
}

.xp-label {
    display: block;
    color: var(--neon-potion);
    font-size: 12px;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

/* ============================================================
   Botanical Treasury
   ============================================================ */
.botanical-treasury {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 6vh, 72px) 24px;
    background: var(--dungeon-black);
    position: relative;
    overflow: hidden;
}

/* Ground line */
.treasury-ground {
    position: absolute;
    bottom: 15%;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.15), rgba(255, 208, 64, 0.15), rgba(0, 255, 136, 0.15), transparent);
}

.treasury-header {
    text-align: center;
    margin-bottom: clamp(40px, 6vh, 64px);
}

.treasury-header .pixel-label {
    color: var(--gold-coin);
    font-size: 10px;
    display: block;
    margin-bottom: 16px;
    text-shadow: 0 0 8px rgba(255, 208, 64, 0.3);
}

.treasury-title {
    font-size: clamp(24px, 3.5vw, 48px);
    color: var(--scroll-parchment);
    text-shadow: 0 0 20px rgba(240, 224, 200, 0.2);
}

/* --- Plant Garden --- */
.treasury-garden {
    display: flex;
    justify-content: center;
    gap: clamp(32px, 5vw, 72px);
    flex-wrap: wrap;
    max-width: 900px;
}

.plant {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100px;
    height: 240px;
    cursor: pointer;
    transition: transform 100ms ease;
}

/* Glow under plant */
.plant-glow {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    border-radius: 50%;
    opacity: 0;
    filter: blur(12px);
    transition: opacity 600ms 900ms ease-out;
}

.plant.grown .plant-glow {
    opacity: 0.4;
}

.plant-wheat .plant-glow { background: var(--gold-coin); }
.plant-cotton .plant-glow { background: var(--neon-potion); }
.plant-spice .plant-glow { background: var(--neon-spell); }
.plant-iron .plant-glow { background: var(--marble-cream); }
.plant-oil .plant-glow { background: var(--gold-coin); }

.plant:hover {
    animation: glitchDisplace 200ms ease-in-out;
}

@keyframes glitchDisplace {
    0% { transform: translateX(0); }
    20% { transform: translateX(-5px) skewX(-2deg); }
    40% { transform: translateX(5px) skewX(2deg); }
    60% { transform: translateX(-3px) skewX(-1deg); }
    80% { transform: translateX(3px) skewX(1deg); }
    100% { transform: translateX(0) skewX(0); }
}

/* Plant Stem */
.plant-stem {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 0;
    transition: height 800ms ease-out;
}

.plant.grown .plant-stem {
    height: 130px;
}

.plant-wheat .plant-stem { background: var(--gold-coin); box-shadow: 0 0 8px rgba(255, 208, 64, 0.4); }
.plant-cotton .plant-stem { background: var(--neon-potion); box-shadow: 0 0 8px rgba(0, 255, 136, 0.4); }
.plant-spice .plant-stem { background: var(--neon-spell); box-shadow: 0 0 8px rgba(255, 68, 136, 0.4); }
.plant-iron .plant-stem { background: var(--marble-cream); box-shadow: 0 0 8px rgba(232, 224, 208, 0.4); }
.plant-oil .plant-stem { background: var(--gold-coin); box-shadow: 0 0 8px rgba(255, 208, 64, 0.4); }

/* Plant Leaves */
.plant-leaf {
    position: absolute;
    width: 22px;
    height: 11px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.plant.grown .plant-leaf {
    opacity: 1;
}

.plant-leaf-1 {
    bottom: 110px;
    left: 26px;
    transform: rotate(-35deg) scale(0.5);
    transition-delay: 500ms;
}

.plant.grown .plant-leaf-1 {
    transform: rotate(-35deg) scale(1);
}

.plant-leaf-2 {
    bottom: 135px;
    right: 26px;
    transform: rotate(35deg) scale(0.5);
    transition-delay: 650ms;
}

.plant.grown .plant-leaf-2 {
    transform: rotate(35deg) scale(1);
}

.plant-leaf-3 {
    bottom: 155px;
    left: 30px;
    transform: rotate(-25deg) scale(0.5);
    transition-delay: 750ms;
    width: 18px;
    height: 9px;
}

.plant.grown .plant-leaf-3 {
    transform: rotate(-25deg) scale(1);
}

.plant-wheat .plant-leaf { background: var(--gold-coin); box-shadow: 0 0 8px rgba(255, 208, 64, 0.4); }
.plant-cotton .plant-leaf { background: var(--neon-potion); box-shadow: 0 0 8px rgba(0, 255, 136, 0.4); }
.plant-spice .plant-leaf { background: var(--neon-spell); box-shadow: 0 0 8px rgba(255, 68, 136, 0.4); }
.plant-iron .plant-leaf { background: var(--marble-cream); box-shadow: 0 0 8px rgba(232, 224, 208, 0.4); }
.plant-oil .plant-leaf { background: var(--gold-coin); box-shadow: 0 0 8px rgba(255, 208, 64, 0.4); }

/* Plant Flower */
.plant-flower {
    position: absolute;
    bottom: 170px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    opacity: 0;
    transition: opacity 400ms 800ms ease-out;
}

.plant.grown .plant-flower {
    opacity: 1;
}

.flower-petal {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: transform 200ms ease;
}

.flower-petal:nth-child(1) { top: 0; left: 50%; transform: translateX(-50%); }
.flower-petal:nth-child(2) { top: 6px; left: 2px; }
.flower-petal:nth-child(3) { top: 6px; right: 2px; }
.flower-petal:nth-child(4) { bottom: 4px; left: 6px; }
.flower-petal:nth-child(5) { bottom: 4px; right: 6px; }

.plant-wheat .flower-petal { background: var(--gold-coin); box-shadow: 0 0 12px rgba(255, 208, 64, 0.5); }
.plant-cotton .flower-petal { background: var(--neon-potion); box-shadow: 0 0 12px rgba(0, 255, 136, 0.5); }
.plant-spice .flower-petal { background: var(--neon-spell); box-shadow: 0 0 12px rgba(255, 68, 136, 0.5); }
.plant-iron .flower-petal { background: var(--marble-cream); box-shadow: 0 0 12px rgba(232, 224, 208, 0.5); }
.plant-oil .flower-petal { background: var(--gold-coin); box-shadow: 0 0 12px rgba(255, 208, 64, 0.5); }

.flower-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dungeon-black);
    z-index: 1;
}

/* Plant Labels */
.plant-label {
    position: absolute;
    bottom: 30px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 400ms 1000ms ease-out;
}

.plant.grown .plant-label {
    opacity: 1;
}

.plant-wheat .plant-label { color: var(--gold-coin); text-shadow: 0 0 6px rgba(255, 208, 64, 0.3); }
.plant-cotton .plant-label { color: var(--neon-potion); text-shadow: 0 0 6px rgba(0, 255, 136, 0.3); }
.plant-spice .plant-label { color: var(--neon-spell); text-shadow: 0 0 6px rgba(255, 68, 136, 0.3); }
.plant-iron .plant-label { color: var(--marble-cream); text-shadow: 0 0 6px rgba(232, 224, 208, 0.3); }
.plant-oil .plant-label { color: var(--gold-coin); text-shadow: 0 0 6px rgba(255, 208, 64, 0.3); }

.plant-value {
    position: absolute;
    bottom: 12px;
    font-size: 8px;
    color: #666;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 400ms 1100ms ease-out;
}

.plant.grown .plant-value {
    opacity: 1;
}

/* Glitch effect on hover - RGB split */
.plant:hover .flower-petal {
    animation: rgbSplit 200ms ease-in-out;
}

.plant:hover .plant-stem {
    animation: stemGlitch 200ms ease-in-out;
}

@keyframes rgbSplit {
    0% { box-shadow: none; }
    25% { box-shadow: -4px 0 0 rgba(255, 68, 136, 0.7), 4px 0 0 rgba(0, 255, 136, 0.7); }
    50% { box-shadow: 4px 0 0 rgba(255, 68, 136, 0.7), -4px 0 0 rgba(0, 255, 136, 0.7); }
    75% { box-shadow: -2px 0 0 rgba(255, 68, 136, 0.5), 2px 0 0 rgba(0, 255, 136, 0.5); }
    100% { box-shadow: none; }
}

@keyframes stemGlitch {
    0% { box-shadow: none; }
    33% { box-shadow: -3px 0 0 rgba(255, 68, 136, 0.5), 3px 0 0 rgba(0, 255, 136, 0.5); }
    66% { box-shadow: 3px 0 0 rgba(255, 68, 136, 0.5), -3px 0 0 rgba(0, 255, 136, 0.5); }
    100% { box-shadow: none; }
}

/* ============================================================
   Boss Encounter
   ============================================================ */
.boss-encounter {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 6vh, 72px) 24px;
    background: var(--dungeon-black);
    position: relative;
    overflow: hidden;
}

.boss-arena {
    width: 100%;
    max-width: 640px;
    position: relative;
    /* Marble-textured arena floor */
    background:
        linear-gradient(145deg, rgba(232, 224, 208, 0.06) 0%, transparent 40%),
        linear-gradient(225deg, rgba(255, 68, 136, 0.05) 0%, transparent 35%),
        linear-gradient(45deg, rgba(232, 224, 208, 0.05) 10%, transparent 50%),
        rgba(8, 8, 15, 0.95);
    border: 3px solid var(--neon-spell);
    border-radius: 4px;
    padding: clamp(32px, 5vh, 56px) clamp(24px, 4vw, 40px);
    box-shadow: 0 0 40px rgba(255, 68, 136, 0.2);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
    overflow: hidden;
}

.boss-arena.visible {
    opacity: 1;
    transform: translateY(0);
}

.boss-arena.visible .boss-glow {
    animation: bossGlowPulse 3s ease-in-out infinite;
}

.boss-glow {
    position: absolute;
    inset: -2px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 0;
}

@keyframes bossGlowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 68, 136, 0.15), inset 0 0 20px rgba(255, 68, 136, 0.05);
    }
    50% {
        box-shadow: 0 0 60px rgba(255, 68, 136, 0.35), inset 0 0 50px rgba(255, 68, 136, 0.12);
    }
}

/* Scan line effect */
.boss-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 68, 136, 0.3), transparent);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.boss-arena.visible .boss-scan-line {
    animation: scanLine 4s linear infinite;
}

@keyframes scanLine {
    0% { top: 0; opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.4; }
    100% { top: 100%; opacity: 0; }
}

/* Arena floor glow */
.boss-arena-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, transparent, rgba(255, 68, 136, 0.03));
    pointer-events: none;
}

/* Boss HP Bar */
.boss-hp-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.boss-hp-label {
    color: var(--neon-spell);
    font-size: 10px;
    flex-shrink: 0;
}

.boss-hp-track {
    flex: 1;
    height: 10px;
    background: rgba(255, 68, 136, 0.1);
    border: 1px solid rgba(255, 68, 136, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.boss-hp-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--neon-spell), #FF6699);
    box-shadow: 0 0 10px rgba(255, 68, 136, 0.5);
    transition: width 2s ease-in-out;
}

.boss-hp-text {
    color: var(--neon-spell);
    font-size: 8px;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Boss Header */
.boss-header {
    text-align: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 2;
}

.boss-label {
    display: block;
    color: var(--neon-spell);
    font-size: 10px;
    margin-bottom: 16px;
    text-shadow: 0 0 8px rgba(255, 68, 136, 0.5);
    animation: bossLabelFlicker 4s ease-in-out infinite;
}

@keyframes bossLabelFlicker {
    0%, 88%, 100% { opacity: 1; }
    90% { opacity: 0.5; }
    92% { opacity: 1; }
    94% { opacity: 0.3; }
    96% { opacity: 1; }
    98% { opacity: 0.6; }
}

.boss-title {
    font-size: clamp(32px, 5vw, 64px);
    color: var(--neon-spell);
    text-shadow:
        0 0 30px rgba(255, 68, 136, 0.6),
        0 0 60px rgba(255, 68, 136, 0.3),
        0 0 100px rgba(255, 68, 136, 0.15);
    margin-bottom: 12px;
    transition: text-shadow 300ms ease, transform 300ms ease;
}

.boss-title:hover {
    text-shadow:
        0 0 40px rgba(255, 68, 136, 0.9),
        0 0 80px rgba(255, 68, 136, 0.6),
        0 0 140px rgba(255, 68, 136, 0.35);
    transform: scale(1.03);
}

.boss-subtitle {
    display: block;
    color: var(--gold-coin);
    font-size: 10px;
    text-shadow: 0 0 6px rgba(255, 208, 64, 0.3);
}

/* Boss Body */
.boss-body {
    position: relative;
    z-index: 2;
    margin-bottom: 28px;
    color: var(--scroll-parchment);
}

.boss-body p {
    margin-bottom: 16px;
    text-align: left;
}

.boss-body p:last-child {
    margin-bottom: 0;
}

.boss-body strong {
    color: var(--neon-spell);
}

/* Boss Rewards */
.boss-rewards {
    border: 2px solid var(--neon-spell);
    border-radius: 4px;
    padding: 20px;
    margin-top: 24px;
    background: rgba(255, 68, 136, 0.06);
    text-align: center;
    position: relative;
    z-index: 2;
}

.boss-rewards .reward-header {
    color: var(--neon-spell);
    text-shadow: 0 0 6px rgba(255, 68, 136, 0.3);
}

.boss-rewards .reward-list li::before {
    color: var(--neon-spell);
}

.boss-rewards .reward-list li {
    color: var(--scroll-parchment);
}

.boss-rewards .xp-reward {
    border-top-color: rgba(255, 68, 136, 0.15);
}

.boss-rewards .xp-label {
    font-size: 14px;
    color: var(--gold-coin);
    text-shadow: 0 0 12px rgba(255, 208, 64, 0.5);
}

/* ============================================================
   Quest Complete Footer
   ============================================================ */
.quest-complete {
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 6vh, 72px) 24px;
    background: var(--dungeon-black);
}

.completion-scroll {
    width: 100%;
    max-width: 640px;
    text-align: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.completion-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Completion banner with stars */
.completion-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
}

.banner-star {
    width: 24px;
    height: 24px;
    position: relative;
}

.banner-star::before,
.banner-star::after {
    content: '';
    position: absolute;
    background: var(--neon-potion);
}

.banner-star::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    transform: translateY(-50%);
    box-shadow: 0 0 10px var(--neon-potion);
}

.banner-star::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    box-shadow: 0 0 10px var(--neon-potion);
}

.completion-title {
    font-size: clamp(28px, 4.5vw, 56px);
    color: var(--neon-potion);
    text-shadow:
        0 0 30px rgba(0, 255, 136, 0.5),
        0 0 60px rgba(0, 255, 136, 0.25);
}

.completion-divider {
    width: 140px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold-coin), transparent);
    margin: 0 auto 32px;
}

.completion-summary {
    margin-bottom: 36px;
}

.completion-summary .pixel-label {
    display: block;
    color: var(--gold-coin);
    font-size: 10px;
    margin-bottom: 16px;
}

.xp-bar {
    width: 100%;
    max-width: 400px;
    height: 18px;
    background: rgba(240, 224, 200, 0.08);
    border: 2px solid var(--gold-coin);
    border-radius: 3px;
    margin: 0 auto 12px;
    overflow: hidden;
    position: relative;
}

.xp-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 18px,
        rgba(8, 8, 15, 0.15) 18px,
        rgba(8, 8, 15, 0.15) 20px
    );
    pointer-events: none;
}

.xp-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--neon-potion), var(--gold-coin));
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
    transition: width 1800ms cubic-bezier(0.22, 1, 0.36, 1);
}

.completion-scroll.visible .xp-fill {
    width: 100%;
}

.xp-total {
    display: block;
    color: var(--neon-potion);
    font-size: 12px;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.completion-insights {
    margin-bottom: 36px;
    text-align: left;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.insights-header {
    display: block;
    color: var(--gold-coin);
    font-size: 10px;
    text-align: center;
    margin-bottom: 16px;
    text-shadow: 0 0 6px rgba(255, 208, 64, 0.3);
}

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

.insights-list li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 10px;
    font-size: clamp(13px, 0.95vw, 15px);
    color: var(--scroll-parchment);
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}

.completion-scroll.visible .insights-list li {
    opacity: 1;
    transform: translateX(0);
}

.completion-scroll.visible .insights-list li:nth-child(1) { transition-delay: 400ms; }
.completion-scroll.visible .insights-list li:nth-child(2) { transition-delay: 550ms; }
.completion-scroll.visible .insights-list li:nth-child(3) { transition-delay: 700ms; }
.completion-scroll.visible .insights-list li:nth-child(4) { transition-delay: 850ms; }
.completion-scroll.visible .insights-list li:nth-child(5) { transition-delay: 1000ms; }
.completion-scroll.visible .insights-list li:nth-child(6) { transition-delay: 1150ms; }
.completion-scroll.visible .insights-list li:nth-child(7) { transition-delay: 1300ms; }

.insights-list li::before {
    content: "\2726";
    position: absolute;
    left: 0;
    color: var(--neon-potion);
    font-size: 10px;
    top: 4px;
}

.completion-footer-text {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 24px;
    border-top: 1px solid rgba(240, 224, 200, 0.15);
}

.footer-domain {
    color: var(--gold-coin);
    font-size: 10px;
}

.footer-tagline {
    color: #555;
    font-size: 10px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 700px) {
    .scroll-body {
        padding: 36px 22px;
    }

    .chapter-scroll {
        padding: 28px 20px;
    }

    .boss-arena {
        padding: 28px 20px;
    }

    .treasury-garden {
        gap: 24px;
    }

    .plant {
        width: 80px;
        height: 200px;
    }

    .chapter-objective {
        flex-direction: column;
        gap: 4px;
    }

    .boss-hp-text {
        display: none;
    }

    .completion-banner {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .pixel-label {
        font-size: 9px;
    }

    .quest-status-bar {
        flex-direction: column;
        gap: 6px;
    }

    .treasury-garden {
        gap: 16px;
    }

    .plant {
        width: 60px;
        height: 170px;
    }

    .plant-leaf-3 {
        display: none;
    }

    .boss-hp-bar {
        flex-wrap: wrap;
    }

    .banner-star {
        width: 16px;
        height: 16px;
    }
}
