:root {
    /* --- Theme 1: Cyber Neon (Default) --- */
    --body-bg: #050505; /* Darker Desk */
    --body-pattern: radial-gradient(#222 1px, transparent 1px);
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --card-bg: #1e293b;
    --header-bg: rgba(15, 23, 42, 0.8);
    --accent: #38bdf8;
    --border-color: rgba(255,255,255,0.1);
    --card-radius: 12px;
    --font-main: 'Segoe UI', system-ui, sans-serif;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --device-shadow: 0 0 80px rgba(0,0,0,0.8);
    --border-width: 1px;
    
    /* Insight Specific */
    --insight-bg: #000000;
    --insight-text: #ffd700; /* Gold */
    --insight-border: 1px solid #333;
}

/* --- Theme 2: Pop Art (波普) --- */
[data-theme="pop"] {
    --body-bg: #ffeb3b; /* Bright Yellow Desk */
    --body-pattern: radial-gradient(#000 2px, transparent 2px); /* Polka dots */
    --bg-color: #ffffff;
    --text-color: #000000;
    --card-bg: #fff;
    --header-bg: #ffffff;
    --accent: #ff3366;
    --border-color: #000000;
    --card-radius: 0px;
    --font-main: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    --shadow: 8px 8px 0px #000000;
    --device-shadow: 20px 20px 0px rgba(0,0,0,0.2);
    --border-width: 3px;

    /* Insight Specific */
    --insight-bg: #000000;
    --insight-text: #ffffff;
    --insight-border: 4px solid #000;
}

/* --- Theme 3: Zen Paper (水墨) --- */
[data-theme="zen"] {
    --body-bg: #e6e2dd; /* Wood/Table Color */
    --body-pattern: none;
    --bg-color: #fdfbf7;
    --text-color: #2c2c2c;
    --card-bg: #ffffff;
    --header-bg: #fdfbf7;
    --accent: #8b5e3c;
    --border-color: #e5e5e5;
    --card-radius: 2px;
    --font-main: 'Georgia', 'Songti SC', serif;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --device-shadow: 0 10px 40px rgba(0,0,0,0.1);
    --border-width: 1px;

    /* Insight Specific */
    --insight-bg: #f4f4f4;
    --insight-text: #333;
    --insight-border: 1px solid #ddd;
}

body {
    background-color: var(--body-bg);
    background-image: var(--body-pattern);
    background-size: 20px 20px;
    color: var(--text-color);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    
    display: flex;
    justify-content: center;
    min-height: 100vh;
    transition: background 0.3s ease;
}

/* The Book / Device Frame */
#layout-root {
    width: 100%;
    max-width: 800px; /* Golden Reading Width */
    background-color: var(--bg-color);
    min-height: 100vh;
    box-shadow: var(--device-shadow); /* Theme-aware shadow */
    position: relative;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Header */
header.app-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--border-width) solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 { margin: 0; font-size: 1.5rem; color: var(--accent); }

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: var(--border-width) solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}
.theme-toggle:hover {
    background: var(--accent);
    color: var(--bg-color);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

main#app-container {
    padding: 2rem;
}

/* Home List - 2 Column Grid */
.story-list {
    display: grid;
    /* Reduced min-width to 300px to ensure 2 columns fit in 800px container */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.story-card {
    background: var(--card-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 0;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s;
    display: flex; /* Changed for potential horizontal layout */
    flex-direction: column; /* Default vertical */
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* HERO CARD (First Child) */
.story-list .story-card:first-child {
    grid-column: 1 / -1; /* Span full width */
    flex-direction: row; /* Horizontal layout */
    min-height: 350px;
}

.story-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    background: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Hero Thumb override */
.story-list .story-card:first-child .card-thumb {
    width: 60%; /* Take up 60% space */
    aspect-ratio: auto;
    height: 100%;
}

.card-info {
    padding: 1.5rem;
    border-top: var(--border-width) solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Hero Info override */
.story-list .story-card:first-child .card-info {
    border-top: none;
    border-left: var(--border-width) solid var(--border-color);
    padding: 3rem;
}

.story-list .story-card:first-child h3 {
    font-size: 2.5rem; /* Huge title */
    margin-bottom: 1rem;
}

.story-list .story-card:first-child p {
    font-size: 1.2rem;
}

.card-info h3 { margin: 0 0 0.5rem 0; font-size: 1.4rem; font-weight: bold; }
.card-info p { margin: 0; font-size: 1rem; opacity: 0.7; }

/* Responsive: Stack Hero on mobile */
@media (max-width: 768px) {
    .story-list .story-card:first-child {
        flex-direction: column;
    }
    .story-list .story-card:first-child .card-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 4/3;
    }
    .story-list .story-card:first-child .card-info {
        border-left: none;
        border-top: var(--border-width) solid var(--border-color);
        padding: 1.5rem;
    }
    .story-list .story-card:first-child h3 { font-size: 1.5rem; }
}

/* Comic Reader */
.story-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 1rem;
    background: var(--card-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
}

.story-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    line-height: 1.2;
}

.story-desc {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto 1rem auto;
    line-height: 1.5;
}

.story-date {
    display: block;
    color: var(--accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.comic-panels {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.comic-panel {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    width: 100%;
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow);
}

.comic-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-image {
    width: 100%;
    height: auto; /* Allow natural height */
    display: block;
    background-color: rgba(0,0,0,0.1);
}

/* Mobile: Return to Taller Ratio */
@media (max-width: 768px) {
    .comic-panel {
        aspect-ratio: 4/3; /* Mobile: Classic 4:3 (Show full image) */
    }
}

/* Bubbles - Theme Aware */
.bubble {
    position: absolute;
    background: #fff;
    color: #000;
    padding: 0.8rem 1.2rem;
    border-radius: 20px;
    font-size: 1rem; /* Slightly larger font */
    max-width: 280px; /* Wider bubbles for better text wrapping */
    line-height: 1.5; /* Better readability */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    z-index: 10;
    border: 1px solid #000; /* Always ensure readability */
}

/* Pop Theme Bubble Override */
[data-theme="pop"] .bubble {
    border: 2px solid #000;
    box-shadow: 3px 3px 0px #000;
    font-family: 'Comic Sans MS', sans-serif;
}

/* Speech Tail Adjustments */
.bubble-speech.bubble-anchor-center::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    margin-left: -10px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #fff transparent;
}

.bubble-speech.bubble-anchor-left::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px; /* Tail on right */
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #fff transparent;
    transform: skew(20deg);
}

.bubble-speech.bubble-anchor-right::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20px; /* Tail on left */
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #fff transparent;
    transform: skew(-20deg);
}

.bubble-thought {
    border-radius: 50%;
    border: 2px solid #ccc;
}
[data-theme="pop"] .bubble-thought { border-color: #000; }

.bubble-thought::after {
    content: '⚪';
    position: absolute;
    bottom: -15px;
    left: 10px;
    font-size: 10px;
    color: #fff; 
    text-shadow: 0 0 2px #000;
}

/* Shout Style */
.bubble-shout {
    background: #fff;
    border: 3px solid #000;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 0;
}

.bubble-shout.bubble-anchor-center { transform: translate(-50%, -50%) rotate(-2deg); }
.bubble-shout.bubble-anchor-left { transform: translate(-5%, -50%) rotate(-2deg); }
.bubble-shout.bubble-anchor-right { transform: translate(-95%, -50%) rotate(-2deg); }

.bubble-whisper {
    border: 1px dashed #666;
    background: rgba(255,255,255,0.9);
    font-style: italic;
    color: #555;
}

@media (max-width: 600px) {
    .bubble {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
        max-width: 150px;
    }
}

/* --- Insight Section (New: Cinematic Monolith Style) --- */
.insight-section {
    margin-top: 5rem;
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
    
    /* Force Dark Cinematic Look */
    background: #0f0f10; 
    color: #a0a0a0;
    border-radius: 4px; 
    border: none;
    
    /* Center Everything */
    text-align: center;
    
    /* The "Impact" Shadow - Deep and soft */
    box-shadow: 0 20px 60px -10px rgba(0,0,0,0.6);
    
    /* Animation */
    opacity: 0;
    transform: translateY(40px) scale(0.98);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Remove Side Accent Line */
.insight-section::after {
    display: none;
}

/* Subtle Noise Texture */
.insight-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.insight-section.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.insight-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem; /* Reduced margin from 2rem */
    padding-bottom: 0;
    border-bottom: none;
    position: relative;
    z-index: 1;
    opacity: 0.6; /* Subtle title */
}

/* Override theme-specific headers */
[data-theme="pop"] .insight-header,
[data-theme="zen"] .insight-header { 
    border-bottom: none; 
}

.insight-icon {
    font-size: 1rem; /* Smaller icon */
    margin-right: 0.6rem;
    filter: grayscale(1) brightness(1.5);
}

.insight-title {
    font-family: 'Songti SC', 'SimSun', serif; /* Consistent Serif */
    font-size: 0.95rem;
    font-weight: normal;
    letter-spacing: 1px;
    color: #888;
}

.insight-content {
    font-family: 'Songti SC', 'SimSun', serif; /* Consistent Serif */
    font-size: 1.05rem; /* Slightly smaller base text */
    line-height: 1.8; /* Tighter line height */
    position: relative;
    z-index: 1;
    color: #bfbfbf;
    max-width: 90%; /* Prevent too wide text */
    margin: 0 auto;
}

/* The Punchline - Integrated Flow */
.insight-content strong {
    display: block;
    margin-top: 1.2rem; /* Much tighter gap (was 2.5rem) */
    padding-top: 0;
    border-top: none;
    
    font-size: 1.4rem; /* Reduced from 1.8rem for better flow */
    font-weight: bold; 
    font-style: normal;
    color: #eeeeee; /* Soft White, not blinding */
    
    text-shadow: 0 0 15px rgba(255,255,255,0.15); /* Softer glow */
    letter-spacing: 0.5px;
}
