@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Noto+Serif+SC:wght@400;700&family=Long+Cang&family=ZCOOL+XiaoWei&display=swap');

:root {
    /* Palette - The Forbidden City */
    --ink-black: #1a1a1a;
    --ink-grey: #4a4a4a;
    --paper-light: #f7f2e6;
    --paper-dark: #e6dcc3;
    --seal-red: #8b0000;
    --imperial-gold: #cba052;
    --jade-green: #5f7c68;
    --wood-brown: #3d2b1f;
    
    /* Fonts */
    --font-title: "Ma Shan Zheng", cursive;
    --font-subtitle: "Long Cang", cursive;
    --font-body: "Noto Serif SC", "Songti SC", serif;
}

body {
    background-color: #2a2522; /* Dark Wood Background */
    background-image: 
        repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 1px, transparent 1px, transparent 20px),
        url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%233d2b1f' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
    
    color: var(--ink-black);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* --- Scroll Container (The Juanzhou) --- */
.container {
    max-width: 900px;
    margin: 40px auto;
    background-color: var(--paper-light);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    position: relative;
    padding: 60px 80px;
    border-left: 10px solid var(--paper-dark);
    border-right: 10px solid var(--paper-dark);
}

/* Texture overlay for paper */
.container::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Top and Bottom Rollers */
.container::after {
    /* Bottom Roller */
    content: "";
    position: absolute;
    bottom: -30px;
    left: -20px;
    right: -20px;
    height: 40px;
    background: var(--wood-brown);
    border-radius: 20px;
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.3);
    z-index: 1;
}

.scroll-top {
    position: absolute;
    top: -30px;
    left: -20px;
    right: -20px;
    height: 40px;
    background: var(--wood-brown);
    border-radius: 20px;
    box-shadow: inset 0 -5px 10px rgba(0,0,0,0.5), 0 5px 10px rgba(0,0,0,0.3);
    z-index: 1;
}

/* --- Navigation --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--ink-black);
    padding-bottom: 10px;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

nav a {
    color: var(--ink-black);
    text-decoration: none;
    font-family: var(--font-title);
    font-size: 1.4rem;
    position: relative;
    padding: 0 10px;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--seal-red);
}

nav a::before {
    content: "◈";
    color: var(--imperial-gold);
    margin-right: 5px;
    font-size: 0.8em;
}

/* --- Typography --- */
h1 {
    font-family: var(--font-title);
    font-size: 4rem;
    text-align: center;
    color: var(--ink-black);
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

h2 {
    font-family: var(--font-subtitle);
    font-size: 2.2rem;
    color: var(--wood-brown);
    border-bottom: 1px solid var(--imperial-gold);
    padding-bottom: 10px;
    margin-top: 3rem;
}

h3 {
    font-family: var(--font-body);
    font-weight: bold;
    color: var(--seal-red);
    font-size: 1.5rem;
}

p, li {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* --- Seal (The Chop) --- */
.seal {
    width: 100px;
    height: 100px;
    border: 4px solid var(--seal-red);
    color: var(--seal-red);
    position: absolute;
    top: 60px;
    right: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "ZCOOL XiaoWei", serif; /* Seal script style */
    font-size: 2rem;
    line-height: 1;
    text-align: center;
    border-radius: 12px;
    transform: rotate(8deg);
    opacity: 0.8;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.3'/%3E%3C/svg%3E");
    z-index: 0;
    box-shadow: 0 0 0 2px var(--paper-light), inset 0 0 0 2px var(--paper-light); /* Rough edge simulation */
}

/* --- Comic Panel (Lianhuanhua) --- */
.comic-panel {
    border: 3px double var(--ink-black);
    background: #fff;
    padding: 20px;
    margin: 30px 0;
    position: relative;
    box-shadow: 5px 5px 0 rgba(0,0,0,0.2);
}

.comic-panel::before {
    content: "江湖绘卷";
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--paper-light);
    padding: 0 10px;
    font-family: var(--font-subtitle);
    font-weight: bold;
    color: var(--ink-grey);
}

.dialogue {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.dialogue.right {
    flex-direction: row-reverse;
}

.avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid var(--ink-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
    font-size: 0; /* Hide text */
    color: transparent; /* Hide text */
    flex-shrink: 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    background-size: cover;
    background-position: center;
}

/* Character Avatars (Pixel Art Style) */
.avatar.feng { 
    background-color: #546e7a;
    border-color: #2c3e50;
    /* Sage with white beard */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' fill='%23546e7a'/%3E%3Crect x='20' y='16' width='24' height='30' fill='%23ffdbac'/%3E%3Cpath d='M16,16 H48 V28 H16 Z' fill='%23eee'/%3E%3Cpath d='M16,16 Q32,0 48,16' fill='%23eee'/%3E%3Cpath d='M20,40 Q32,60 44,40 L44,30 H20 Z' fill='%23eee'/%3E%3Crect x='24' y='26' width='4' height='2' fill='%23333'/%3E%3Crect x='36' y='26' width='4' height='2' fill='%23333'/%3E%3C/svg%3E");
}

.avatar.linghu { 
    background-color: #e74c3c;
    border-color: #c0392b;
    /* Hero with blue headband */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' fill='%23e74c3c'/%3E%3Crect x='20' y='18' width='24' height='26' fill='%23ffdbac'/%3E%3Cpath d='M16,14 H48 V24 H46 V18 H18 V24 H16 Z' fill='%232c3e50'/%3E%3Cpath d='M16,14 Q32,4 48,14' fill='%232c3e50'/%3E%3Crect x='16' y='14' width='32' height='4' fill='%233498db'/%3E%3Crect x='24' y='26' width='4' height='4' fill='%23333'/%3E%3Crect x='36' y='26' width='4' height='4' fill='%23333'/%3E%3Cpath d='M28,38 Q32,42 36,38' stroke='%23333' fill='none'/%3E%3C/svg%3E");
}

.avatar.yue { 
    background-color: #8e44ad;
    border-color: #5b2c6f;
    /* Gentleman with bun */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' fill='%238e44ad'/%3E%3Crect x='22' y='18' width='20' height='28' fill='%23ffe0bd'/%3E%3Ccircle cx='32' cy='12' r='6' fill='%232c3e50'/%3E%3Cpath d='M20,16 H44 V24 H20 Z' fill='%232c3e50'/%3E%3Crect x='26' y='26' width='4' height='2' fill='%23333'/%3E%3Crect x='34' y='26' width='4' height='2' fill='%23333'/%3E%3Cpath d='M28,36 H36' stroke='%23333' stroke-width='1'/%3E%3C/svg%3E");
}

.avatar.ren { 
    background-color: #27ae60;
    border-color: #1e8449;
    /* Wild hair */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' fill='%2327ae60'/%3E%3Crect x='20' y='18' width='24' height='28' fill='%23d2b48c'/%3E%3Cpath d='M12,12 H52 V28 H12 Z' fill='%237f8c8d'/%3E%3Crect x='24' y='26' width='5' height='3' fill='%23000'/%3E%3Crect x='35' y='26' width='5' height='3' fill='%23000'/%3E%3Crect x='28' y='38' width='8' height='2' fill='%23000'/%3E%3C/svg%3E");
}

.bubble {
    background: #fff;
    border: 2px solid var(--ink-black);
    border-radius: 10px;
    padding: 10px 15px;
    margin: 10px 15px 0 15px;
    position: relative;
    max-width: 70%;
    font-family: "ZCOOL XiaoWei", serif;
}

/* --- Code Blocks --- */
pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: 5px;
    border: 5px solid var(--wood-brown); /* Wood Frame */
    position: relative;
    overflow-x: auto;
    font-family: 'Consolas', monospace;
    box-shadow: inset 0 0 20px #000;
}

pre::before {
    content: "无字天书";
    position: absolute;
    top: 0;
    right: 0;
    background: var(--wood-brown);
    color: #d4c5a3;
    padding: 2px 10px;
    font-family: var(--font-title);
    font-size: 0.8rem;
    border-bottom-left-radius: 5px;
}

/* --- Action Box --- */
.action-box {
    background: #fffbf0;
    border: 2px dashed var(--imperial-gold);
    padding: 2rem;
    margin-top: 3rem;
    text-align: center;
    position: relative;
}

.action-box h3 {
    font-family: var(--font-title);
    font-size: 2rem;
}

.floating-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
    display: block;
    margin-bottom: 10px;
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* --- Unit Blocks (Bamboo Slips) --- */
.unit-block {
    background: #fff;
    border-left: 5px solid var(--wood-brown);
    margin-bottom: 2rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    position: relative;
}

.unit-block:hover {
    transform: translateX(10px);
}

.unit-block h3 {
    margin-top: 0;
    border-bottom: 1px dashed var(--ink-grey);
    padding-bottom: 0.5rem;
}

.unit-block ul {
    list-style: none;
    padding: 0;
}

.unit-block li {
    margin: 0.5rem 0;
}

.unit-block a {
    color: var(--ink-black);
    text-decoration: none;
    display: block;
    padding: 5px 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.unit-block a:hover {
    border-bottom-color: var(--seal-red);
    color: var(--seal-red);
}

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 4rem;
    font-family: var(--font-subtitle);
    color: var(--ink-grey);
    border-top: 1px solid var(--imperial-gold);
    padding-top: 2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .container {
        padding: 40px 20px;
        margin: 20px 10px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    .seal {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
        top: 20px;
        right: 10px;
    }
}
