:root {
    /* Color Palette - Tech Light/Mixed Theme */
    --bg-base: #f0f4f8; /* Very Light Blue/Grey */
    --bg-surface: #ffffff;
    --bg-surface-hover: #e2e8f0;
    --bg-surface-glass: rgba(255, 255, 255, 0.85);
    
    --primary-color: #0284c7; /* Vivid Blue */
    --primary-hover: #0369a1;
    --primary-glow: rgba(2, 132, 199, 0.3);
    
    --accent-color: #7c3aed; /* Vibrant Purple */
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.3);
    
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    
    --text-main: #0f172a; /* Deep Dark Blue for strong contrast */
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: rgba(15, 23, 42, 0.1);
    --border-hover: rgba(15, 23, 42, 0.2);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px var(--primary-glow);
    --shadow-glow-accent: 0 0 20px var(--accent-glow);
    
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(2, 132, 199, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.05), transparent 25%);
    background-attachment: fixed;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
}

ul {
    list-style: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-surface-hover);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.flex { display: flex; }
.flex-1 { flex: 1; }
.justify-center { justify-content: center; }
.items-center, .align-center { align-items: center; }
.gap-4 { gap: 4px; }
.gap-sm { gap: 12px; }
.gap-md { gap: 24px; }
.gap-lg { gap: 48px; }

.d-none { display: none !important; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-md { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-3xl { font-size: 1.875rem; }

.font-500 { font-weight: 500; }
.font-600 { font-weight: 600; }
.font-bold { font-weight: 700; }

.color-primary { color: var(--primary-color); }
.color-secondary { color: var(--text-secondary); }
.color-warning { color: var(--warning-color); }
.color-danger { color: var(--danger-color); }
.color-accent { color: var(--accent-color); }

.m-0 { margin: 0; }
.mb-sm { margin-bottom: 12px; }
.mb-md { margin-bottom: 24px; }
.mb-lg { margin-bottom: 48px; }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 24px; }
.mt-lg { margin-top: 48px; }
.mr-sm { margin-right: 12px; }

.p-xs { padding: 4px 8px; }
.p-sm { padding: 12px; }
.p-md { padding: 24px; }

.w-100 { width: 100%; }
.max-w-160 { max-width: 160px; }
.h-28 { height: 28px; }
.white-space-nowrap { white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.overflow-y-auto { overflow-y: auto; }
.border-t { border-top: 1px solid var(--border-color); }
.bg-transparent { background-color: transparent; }

/* Typography */
h1, h2, h3, h4, h5 {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 { font-size: 3rem; letter-spacing: -0.02em; }
h2 { font-size: 2.25rem; letter-spacing: -0.01em; }
h3 { font-size: 1.5rem; }

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo span {
    -webkit-text-fill-color: initial; /* Emoji fix */
}

.nav-links {
    display: flex;
    gap: 32px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    padding: 4px 0;
}

.nav-link:hover {
    color: var(--text-main);
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: inherit;
    outline: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-color), #6d28d9);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-accent);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(2, 132, 199, 0.05);
}

.btn-outline.border-danger {
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--danger-color);
}
.btn-outline.border-danger:hover:not(:disabled) {
    border-color: var(--danger-color);
    background: rgba(220, 38, 38, 0.05);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-input, .form-select, .range-slider {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.inline {
    display: flex;
    gap: 12px;
}

.helper {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}
.helper.is-error { color: var(--danger-color); }
.helper.is-success { color: var(--success-color); }

/* Range Slider Styling */
.range-slider {
    -webkit-appearance: none;
    padding: 0;
    height: 6px;
    background: var(--bg-surface-hover);
    border-radius: var(--radius-full);
    border: none;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    transition: transform 0.1s;
}
.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

/* Hero Section */
.hero {
    padding: 100px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(2, 132, 199, 0.05) 0%, transparent 50%);
    z-index: -1;
    animation: rotate 30s linear infinite;
}

.hero h1 {
    font-size: 4rem;
    background: linear-gradient(to right, var(--text-main), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 40px;
}

/* Features */
.features {
    padding: 60px 0;
}
.feature-card {
    text-align: center;
    background: var(--bg-surface);
    backdrop-filter: blur(10px);
}
.feature-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: inline-block;
    padding: 16px;
    background: rgba(2, 132, 199, 0.05);
    border-radius: 20px;
    box-shadow: inset 0 0 20px rgba(2, 132, 199, 0.05);
}

/* Workflow Section */
.workflow-section {
    padding: 80px 0;
    background: linear-gradient(180deg, var(--bg-base) 0%, rgba(2, 132, 199, 0.03) 100%);
}
.workflow-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 40px;
}
.step-item {
    flex: 1;
    min-width: 200px;
    text-align: center;
    position: relative;
}
.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 20px;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 2;
}
.step-item h4 {
    margin-bottom: 12px;
    color: var(--text-main);
}
.step-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.step-divider {
    flex: 0 0 40px;
    height: 2px;
    background: var(--border-color);
    margin-top: 30px;
    position: relative;
}
@media (max-width: 768px) {
    .step-divider { display: none; }
    .workflow-steps { flex-direction: column; align-items: center; gap: 40px; }
}

/* Audience Section */
.audience-section {
    padding: 60px 0;
}
.audience-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}
.audience-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}
.audience-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.audience-img {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, 0.05);
    border-radius: 16px;
    flex-shrink: 0;
}
.audience-content h4 { margin-bottom: 8px; }
.audience-content p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }

/* Stats Section */
.stats-section {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 60px 0;
}
.stats-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 40px;
    text-align: center;
}
.stat-num {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    line-height: 1;
}
.stat-desc {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1.1rem;
}

/* Pricing Preview */
.pricing-preview {
    padding: 60px 0 100px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 60px 0 24px;
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 48px;
    margin-bottom: 48px;
}

.footer-col {
    flex: 1;
    min-width: 200px;
}
.footer-col h4 {
    color: var(--text-main);
}

.footer-links li {
    margin-bottom: 12px;
}
.footer-links a {
    color: var(--text-secondary);
}
.footer-links a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Auth Pages */
.auth-container {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}
.auth-logo {
    font-size: 2.5rem;
    display: inline-block;
    margin-bottom: 16px;
}

/* Workshop Layout */
.workshop-container {
    display: flex;
    height: calc(100vh - 70px); /* Minus navbar */
    overflow: auto;
    background: var(--bg-base);
    align-items: stretch;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
}

.sidebar {
    flex: 0 0 20%;
    max-width: 20%;
    min-width: 280px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.workspace {
    flex: 0 0 80%;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    min-width: 0;
    background: radial-gradient(circle at top right, rgba(2, 132, 199, 0.03), transparent 40%),
                radial-gradient(circle at bottom left, rgba(124, 58, 237, 0.03), transparent 40%);
}

.sidebar-title {
    margin-bottom: 20px;
}

.step-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.step-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

.tabs {
    display: flex;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
    border: 1px solid var(--border-color);
}
.tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.tab.active {
    background: var(--bg-surface);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.usage-info {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    text-align: left;
}

.usage-line {
    margin-bottom: 8px;
}

.novel-search-inline {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.novel-search-status {
    display: block;
    width: 100%;
}

.btn-nowrap {
    white-space: nowrap;
}

.generate-action-btn {
    font-size: 14px;
}

/* Workspace Settings Panel */
.top-settings-panel {
    flex: 0 0 25%;
    max-width: 25%;
    height: 100%;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.settings-panel-header {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.settings-panel-title {
    margin: 0;
    font-size: 1rem;
}

.settings-panel-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.settings-row {
    display: flex;
    min-width: 0;
}

.settings-row-inline {
    gap: 8px;
    align-items: flex-end;
}

.settings-row-inline > .compact-group {
    min-width: 0;
    flex: 1;
}

.settings-row-inline.two-col > .compact-group {
    flex: 1 1 0;
}

.settings-group-chapter {
    flex: 0 0 88px;
}

.settings-group-length {
    flex: 0 0 82px;
}

.settings-tag-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.compact-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.compact-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.2;
}

.settings-input {
    width: 100%;
    padding: 7px 10px;
    min-height: 36px;
}

.chapter-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}

.chapter-number-input {
    width: 42px;
    padding: 7px 2px;
}

.compact-tabs {
    padding: 3px;
    gap: 3px;
    min-height: 36px;
}

.compact-tabs .tab {
    padding: 6px 0;
    font-size: 0.82rem;
}

.section-disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
}

.outline-wrapper textarea {
    min-height: 58px;
    height: 58px;
    transition: height 0.2s;
    width: 100%;
}
.outline-wrapper textarea:focus {
    height: 96px;
}

.outline-input {
    padding: 8px 10px;
    resize: vertical;
}

.similarity-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.range-slider {
    margin: 0;
}

/* Editor/Chat Panel */
.editor-panel {
    flex: 0 0 75%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-base);
}
.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.editor-body {
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    background: var(--bg-surface);
}

.chat-container-inner {
    min-height: 0;
}

.chat-message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease forwards;
}

.ai-message .message-content {
    background: rgba(2, 132, 199, 0.05);
    border: 1px solid rgba(2, 132, 199, 0.15);
    border-radius: 0 16px 16px 16px;
    padding: 16px;
    color: var(--text-main);
    align-self: flex-start;
    max-width: 85%;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-message .message-content.rich-text p {
    margin: 0 0 14px;
    text-indent: 2em;
}

.ai-message .message-content.rich-text p:last-child {
    margin-bottom: 0;
}

.ai-message .message-content.rich-text .story-heading {
    font-weight: 600;
    margin-bottom: 16px;
    text-indent: 0;
}

.ai-message .message-content.rich-text .loading-line {
    text-indent: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.loading-dots {
    display: inline-flex;
    min-width: 30px;
}

.loading-dots span {
    opacity: 0.2;
    animation: loadingDotPulse 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(4) {
    animation-delay: 0.45s;
}

@keyframes loadingDotPulse {
    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-1px);
    }
}

.user-message .message-content {
    background: var(--primary-color);
    color: #fff;
    border-radius: 16px 0 16px 16px;
    padding: 12px 16px;
    align-self: flex-end;
    max-width: 80%;
}

.chat-input-area {
    background: var(--bg-surface);
    backdrop-filter: blur(5px);
    flex-shrink: 0;
}

@media (max-width: 1200px) {
    .workshop-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 70px);
    }

    .sidebar,
    .workspace,
    .top-settings-panel,
    .editor-panel {
        flex: none;
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .workspace {
        flex-direction: column;
    }

    .sidebar,
    .top-settings-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .editor-panel {
        min-height: 60vh;
    }
}

/* Works Grid */
.works-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.work-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}
.work-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.work-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.work-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.work-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.work-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
}
.col-span-full { grid-column: 1 / -1; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}
.modal-close:hover { color: var(--text-main); }

.work-modal-topbar {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.work-modal-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.work-toc {
    width: 250px;
    border-right: 1px solid var(--border-color);
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
}
.work-toc-title {
    padding: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}
#modal-chapter-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
#modal-chapter-list a {
    display: block;
    padding: 10px 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 0.9rem;
}
#modal-chapter-list a:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}
.work-toc-pagination {
    padding: 12px
}

/* 会员提示框样式 */
.member-notice {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
}

.member-notice-content {
    background: var(--bg-surface);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: 0 10px 30px -10px rgba(2, 132, 199, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 400px;
}

.member-notice-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.member-notice-text {
    flex: 1;
    min-width: 0;
}

.member-notice-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.member-notice-message {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}

.member-notice-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.member-notice.fade-out {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* 调整章节、标题、字数对齐 */
.settings-row-inline > .compact-group {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.settings-group-chapter {
    flex: 0 0 100px;
}

.settings-group-length {
    flex: 0 0 100px;
}

.compact-group.flex-1 {
    flex: 1;
}

.compact-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 4px;
    min-height: 18px;
    display: flex;
    align-items: flex-end;
}

.chapter-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-start;
    height: 36px;
}

.chapter-number-input {
    width: 60px;
    text-align: center;
    padding: 7px 4px;
}

.settings-input {
    width: 100%;
    padding: 7px 10px;
    min-height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.work-toc-pageinfo { font-size: 0.85rem; color: var(--text-muted); }

#modal-chapters {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chapter {
    margin-bottom: 48px;
    padding-bottom: 48px;
    border-bottom: 1px dashed var(--border-color);
}
.chapter h4 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 24px;
}
.chapter-block-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 1px;
}
.chapter-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-main);
    white-space: pre-wrap;
}
.chapter-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

/* Pricing Page */
.pricing-header {
    text-align: center;
    margin: 60px 0 40px;
}
.max-w-600 { max-width: 600px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-bottom: 80px;
}
.pricing-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
}
.pricing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
    border-color: var(--primary-color);
}
.pricing-card.popular {
    border: 2px solid var(--accent-color);
    transform: scale(1.05);
    background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(139, 92, 246, 0.05) 100%);
}
.pricing-card.popular:hover {
    transform: scale(1.05) translateY(-8px);
}
.popular-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--accent-color), #d946ef);
    color: #fff;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
}
.price-tag {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 24px 0;
    line-height: 1;
}
.price-period {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}
.features-list {
    text-align: left;
    margin-bottom: 32px;
}
.features-list li {
    margin-bottom: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
}
.check-icon {
    color: var(--success-color);
    font-weight: bold;
}

.faq-section {
    max-width: 800px;
    margin: 0 auto 80px;
}
.faq-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    padding: 20px 24px;
}
.faq-question {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--primary-color);
}
.faq-answer {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Profile Page */
.profile-container {
    max-width: 900px;
    margin-top: 40px;
    margin-bottom: 80px;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
    padding: 32px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}
.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}
.user-info h2 { margin: 0 0 8px 0; }
.user-email { color: var(--text-muted); font-size: 1.1rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--primary-color); }
.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1;
}
.stat-label { color: var(--text-secondary); font-size: 0.95rem; }

.subscription-card {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px -10px rgba(124, 58, 237, 0.4);
}
.subscription-card h3 { color: #fff; margin-bottom: 24px; }
.plan-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Terms / Privacy */
.max-w-900 { max-width: 900px; margin-left: auto; margin-right: auto; }
.my-lg-mb-md { margin-top: 48px; margin-bottom: 24px; }
.line-height-lg { line-height: 1.8; color: var(--text-secondary); }



/* Dark Theme Overrides */
html[data-theme='dark'] {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --bg-surface-glass: rgba(30, 41, 59, 0.85);
    
    --primary-color: #38bdf8;
    --primary-hover: #7dd3fc;
    
    --accent-color: #a78bfa;
    --accent-hover: #c4b5fd;
    
    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
}

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}
