/* Modern CSS Variables */
:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #475569;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: all 0.3s ease;
}

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    position: fixed;
    height: 100vh;
    transition: all 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Navigation */
.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-section ul {
    list-style: none;
}

.nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Content Sections */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header h2 i {
    color: var(--primary);
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-content {
    padding: 1.5rem;
}

.card-content p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.card-content ul {
    list-style: none;
}

.card-content li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.card-content li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 600;
}

/* Stats */
.stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Welcome Card */
.welcome-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    margin-bottom: 2rem;
}

.welcome-card .card-content {
    padding: 2rem;
}

.welcome-message h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: white;
}

.welcome-message p {
    font-size: 1.125rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
}

/* Story Generation */
.story-generation {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.generation-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    transition: all 0.3s ease;
}

.generation-step:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.generation-step.final {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left-color: white;
}

.generation-step.final .step-detail strong {
    color: white;
}

.step-number {
    background: var(--primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.generation-step.final .step-number {
    background: white;
    color: var(--primary);
}

.step-icon {
    font-size: 1.5rem;
    background: white;
    color: var(--primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-detail {
    flex: 1;
}

.step-detail strong {
    color: var(--primary);
    font-weight: 600;
}

.step-detail em {
    color: var(--text-secondary);
    font-style: italic;
}

.generation-step.final .step-detail em {
    color: rgba(255, 255, 255, 0.9);
}

.step-detail small {
    display: block;
    margin-top: 0.25rem;
    color: var(--warning);
    font-weight: 600;
}

/* Process Diagram - manteniamo per altre sezioni */
.process-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    flex-wrap: wrap;
}

.process-step {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    min-width: 150px;
    transition: all 0.3s ease;
}

.process-step:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.process-step h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.process-step p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.process-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Steps */
.steps {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.step {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.step-number {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.step-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Code Block */
.code-block {
    background: #1e293b;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    color: #e2e8f0;
}

/* Highlight Box */
.highlight-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 1rem 0;
}

[data-theme="dark"] .highlight-box {
    background: rgba(14, 165, 233, 0.1);
    border-color: rgba(14, 165, 233, 0.3);
}

.highlight-box i {
    color: var(--primary);
    font-size: 1.125rem;
    margin-top: 2px;
}

/* Demo Output */
.demo-output {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
}

.demo-output em {
    color: var(--text-secondary);
    font-style: italic;
}

/* Our System Example */
.our-system-example {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
    color: white;
}

.our-system-example h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: white;
}

.our-system-example p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.our-system-example strong {
    color: white;
    font-weight: 600;
}

/* Path Example */
.path-example {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.path-line {
    padding: 1rem;
    border-radius: var(--radius);
    border-left: 4px solid;
    background: var(--bg-secondary);
}

.path-line.epic {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.path-line.normal {
    border-left-color: var(--primary);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(14, 165, 233, 0.05) 100%);
}

.path-line strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Story Example - manteniamo per compatibilità */
.story-example {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
    color: white;
}

.story-example h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: white;
}

.story-example p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
}

/* Tab System */
.example-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Narrative Flow */
.narrative-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.narrative-node {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    min-width: 300px;
    transition: all 0.3s ease;
}

.narrative-node:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.node-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
}

.narrative-node p {
    margin-bottom: 1rem;
    font-style: italic;
    color: var(--text-secondary);
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.choice {
    background: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.choice:hover {
    background: var(--primary);
    color: white;
    transform: translateX(5px);
}

/* Real Flow Examples */
.real-flow {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flow-step {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    transition: all 0.3s ease;
}

.flow-step:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.flow-step.final {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left-color: white;
}

.flow-step strong {
    color: var(--primary);
    font-weight: 600;
}

.flow-step.final strong {
    color: white;
}

.flow-step em {
    color: var(--text-secondary);
    font-style: italic;
    display: block;
    margin-top: 0.25rem;
}

.flow-step.final em {
    color: rgba(255, 255, 255, 0.9);
}

.weight {
    font-size: 0.875rem;
    color: var(--warning);
    font-weight: 600;
}

.jump {
    background: var(--warning);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-block;
}

.continue {
    color: var(--primary);
    font-weight: 600;
    margin-top: 0.5rem;
    display: block;
}

/* Conditions Demo */
.conditions-demo h4 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.condition-group {
    margin-bottom: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.condition-trigger {
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.condition-options {
    padding: 1rem 1.5rem;
}

.option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
    transition: all 0.2s ease;
}

.option:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.option:last-child {
    margin-bottom: 0;
}

/* Conditional Story - manteniamo per compatibilità */
.conditional-story {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.condition-block {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.condition-block h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.story-branch {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.story-branch p {
    margin: 0;
    padding-left: 1rem;
    color: var(--text-secondary);
    border-left: 2px solid var(--border);
}

/* Story Impact */
.story-impact {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.impact-level {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.impact-level.high {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.impact-level.medium {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.impact-level.low {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.impact-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.impact-content h4 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.impact-content p {
    margin: 0;
    opacity: 0.9;
}

.flow-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .architecture-diagram {
        flex-direction: column;
    }
    
    .arch-arrow {
        transform: rotate(90deg);
    }
    
    .step {
        flex-direction: column;
        text-align: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Weight Example */
.weight-example {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.weight-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.weight-bar {
    height: 8px;
    background: var(--primary);
    border-radius: 4px;
    display: block;
    min-width: 20px;
}

/* Troubleshooting */
.troubleshooting-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.troubleshooting-item:last-child {
    border-bottom: none;
}

.troubleshooting-item h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.troubleshooting-item p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Checklist */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checklist-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}

.checklist-item label {
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.checklist-item:hover label {
    color: var(--text-primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border);
}

th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

td {
    color: var(--text-secondary);
}

/* Algorithms Section */
.algorithm-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.algorithm-steps ol {
    padding-left: 1.5rem;
}

.algorithm-steps li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Mobile Improvements */
@media (max-width: 768px) {
    .weight-example {
        gap: 0.75rem;
    }
    
    .weight-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .weight-bar {
        width: 100%;
        max-width: 200px;
    }
    
    .checklist-item {
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .checklist-item input[type="checkbox"] {
        margin-top: 0.125rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
}

/* Story Design Components */
.story-pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.pillar {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.pillar:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.pillar-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.pillar h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.pillar p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Scene Structure */
.scene-structure {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scene-part {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.scene-part strong {
    color: var(--primary);
    font-weight: 600;
}

.scene-part p {
    margin: 0.5rem 0 0 0;
    color: var(--text-secondary);
}

/* Mapping Steps */
.mapping-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mapping-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-icon {
    font-size: 1.5rem;
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.step-content p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Narrative Structures */
.narrative-structures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.structure {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.3s ease;
}

.structure:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.structure h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.structure p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Manual Drawing */
.manual-drawing p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.manual-drawing ul {
    list-style: none;
    padding-left: 0;
}

.manual-drawing li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.manual-drawing li::before {
    content: "✨";
    position: absolute;
    left: 0;
    color: var(--primary);
}

/* Diagram Symbols */
.diagram-symbols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.symbol {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.symbol-shape {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    width: 30px;
    text-align: center;
}

.symbol p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design for New Components */
@media (max-width: 768px) {
    .story-pillars {
        grid-template-columns: 1fr;
    }
    
    .narrative-structures {
        grid-template-columns: 1fr;
    }
    
    .diagram-symbols {
        grid-template-columns: 1fr;
    }
    
    .mapping-step {
        flex-direction: column;
        text-align: center;
    }
    
    .pillar {
        padding: 1rem;
    }
}

/* Additional Animations */
.weight-bar {
    animation: expandBar 0.8s ease-out;
}

@keyframes expandBar {
    from {
        width: 0;
    }
    to {
        width: var(--bar-width, 50%);
    }
}

.troubleshooting-item {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Balance Principles */
.balance-principles {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.principle {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.principle:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.principle-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
}

.principle-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.principle-content p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Weight System */
.weight-system h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.weight-tier {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.weight-number {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    color: white;
    min-width: 60px;
    text-align: center;
}

.weight-number.high {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.weight-number.medium {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.weight-number.low {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.weight-desc strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    font-weight: 600;
}

.weight-desc p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive for Balance Components */
@media (max-width: 768px) {
    .balance-principles {
        gap: 1rem;
    }
    
    .principle {
        flex-direction: column;
        text-align: center;
    }
    
    .weight-tier {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
}

/* New Animations */
.pillar {
    animation: fadeInUp 0.6s ease-out;
}

.structure {
    animation: bounceIn 0.8s ease-out;
}

.principle {
    animation: slideInLeft 0.5s ease-out;
}

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Utility */
html { scroll-behavior: smooth; }
::selection { background: var(--primary); color: white; }
button:focus, a:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Design Philosophy Styles */
.design-philosophy {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.philosophy-principle {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.principle-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.principle-text h4 {
    color: #667eea;
    margin-bottom: 8px;
    font-weight: 600;
}

.principle-text p {
    margin: 0;
    line-height: 1.6;
}

/* Questionnaire Architecture Styles */
.questionnaire-architecture {
    padding: 20px 0;
}

.questionnaire-architecture h4 {
    color: #667eea;
    margin-bottom: 16px;
    font-weight: 600;
}

.question-layer {
    padding: 12px 16px;
    margin: 8px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-weight: 500;
}

/* Weight Science Styles */
.weight-science {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.weight-tier-explanation {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.weight-value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    min-width: 60px;
    text-align: center;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.weight-meaning h4 {
    color: #667eea;
    margin-bottom: 4px;
    font-weight: 600;
}

.weight-meaning p {
    margin: 0;
    line-height: 1.5;
}

/* Path Logic Styles */
.path-logic {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.logic-rule {
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.logic-rule strong {
    color: #667eea;
    font-weight: 600;
}

.logic-rule p {
    margin: 8px 0 0 0;
    line-height: 1.5;
}

/* Systematic Process Styles */
.systematic-process {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.process-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.step-number {
    font-size: 20px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 8px 12px;
    border-radius: 50%;
    min-width: 40px;
    text-align: center;
}

.step-content h4 {
    color: #667eea;
    margin-bottom: 8px;
    font-weight: 600;
}

.step-content p {
    margin: 0;
    line-height: 1.6;
}

/* Modular Principles Styles */
.modular-principles {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.principle {
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.principle h4 {
    color: #667eea;
    margin-bottom: 8px;
    font-weight: 600;
}

.principle p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

/* Jump Management Styles */
.jump-management {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.jump-rule {
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.jump-rule strong {
    color: #667eea;
    font-weight: 600;
}

.jump-rule p {
    margin: 8px 0 0 0;
    line-height: 1.5;
}

.jump-logic-example {
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

/* Logic Flow Styles */
.logic-flow {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.logic-node {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
}

.logic-node.high-weight {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #333;
}

.logic-arrow {
    font-size: 18px;
    color: #667eea;
    font-weight: 600;
}

.logic-skip {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Code Example Styles */
.code-example {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.code-example code {
    color: #667eea;
    font-weight: 600;
}

/* Responsive adjustments for new styles */
@media (max-width: 768px) {
    .philosophy-principle,
    .weight-tier-explanation,
    .process-step {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .principle-icon,
    .weight-value,
    .step-number {
        margin-bottom: 8px;
    }
    
    .logic-flow {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .logic-arrow {
        transform: rotate(90deg);
        margin: 8px 0;
    }
}

/* Generation Example Styles */
.generation-example {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    border-left: 4px solid #667eea;
}

.generation-example p {
    margin: 8px 0;
    line-height: 1.6;
}

.generation-example strong {
    color: #667eea;
    font-weight: 600;
}

/* Universal Principles Styles */
.universal-principles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.universal-principles .principle {
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.universal-principles .principle h4 {
    color: #667eea;
    margin-bottom: 8px;
    font-weight: 600;
}

.universal-principles .principle p {
    margin: 0;
    line-height: 1.5;
}

/* Responsive adjustments for universal applications */
@media (max-width: 768px) {
    .universal-principles {
        grid-template-columns: 1fr;
    }
    
    .generation-example {
        padding: 12px;
    }
}

/* Interactive Flowchart Styles */
.flowchart-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--shadow);
    position: relative;
}

.flowchart-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.flow-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.flow-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.flow-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.flowchart-interactive {
    background: white;
    border-radius: 12px;
    min-height: 550px;
    height: 550px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.flowchart-interactive svg {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.flowchart-interactive svg:active {
    cursor: grabbing;
}

.flowchart-legend {
    margin-top: 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    padding: 16px;
}

.legend-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s ease;
}

.legend-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.legend-item.active {
    background: var(--primary);
    color: white;
}

.legend-node {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-node.question-node {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    border: 2px solid #1e3a8a;
}

.legend-node.answer-node {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 2px solid #047857;
}

.legend-node.epic-node {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: 2px solid #d97706;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.legend-edge {
    width: 30px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-edge.jump-edge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    position: relative;
}

.legend-edge.jump-edge::after {
    content: '⚡';
    position: absolute;
    right: -10px;
    top: -8px;
    font-size: 12px;
    color: #ef4444;
}

.legend-edge.condition-edge {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border: 2px dashed #6d28d9;
    height: 2px;
}

.legend-item span {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

/* SVG Node Styles */
.flow-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.flow-node:hover {
    transform: scale(1.05);
}

.flow-node.question {
    fill: url(#questionGradient);
    stroke: #1e3a8a;
    stroke-width: 2;
}

.flow-node.answer {
    fill: url(#answerGradient);
    stroke: #047857;
    stroke-width: 2;
}

.flow-node.epic {
    fill: url(#epicGradient);
    stroke: #d97706;
    stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

.flow-node.highlighted {
    stroke: #ef4444;
    stroke-width: 4;
    filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.6));
}

.flow-link {
    stroke: #64748b;
    stroke-width: 2;
    fill: none;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.flow-link.jump {
    stroke: #ef4444;
    stroke-width: 3;
    stroke-dasharray: 5,5;
    animation: dash 2s linear infinite;
}

.flow-link.condition {
    stroke: #8b5cf6;
    stroke-width: 2;
    stroke-dasharray: 8,4;
}

.flow-link.highlighted {
    stroke: #ef4444;
    stroke-width: 4;
    opacity: 1;
}

@keyframes dash {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 20; }
}

.flow-text {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: middle;
    fill: white;
    pointer-events: none;
}

.flow-text.question {
    font-size: 14px;
    font-weight: 700;
}

.flow-text.weight {
    font-size: 10px;
    font-weight: 700;
    fill: #1f2937;
}

.flow-label {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    fill: var(--text-secondary);
    text-anchor: middle;
    dominant-baseline: middle;
}

/* Fullscreen modal for interactive flowchart */
.flowchart-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.flowchart-fullscreen .flowchart-controls {
    margin-bottom: 20px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Dark theme fullscreen controls */
[data-theme="dark"] .flowchart-fullscreen .flowchart-controls {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid #4b5563;
}

.flowchart-fullscreen .flowchart-interactive {
    flex: 1;
    min-height: 0;
}

.flowchart-fullscreen .legend-items {
    justify-content: center;
}

/* Fullscreen legend fixes */
.flowchart-fullscreen .flowchart-legend {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #e5e7eb;
    margin-top: 15px;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.flowchart-fullscreen .legend-title {
    color: #1f2937;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.flowchart-fullscreen .legend-item {
    background: white;
    border: 2px solid #d1d5db;
    color: #374151;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flowchart-fullscreen .legend-item:hover {
    background: #f3f4f6;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.flowchart-fullscreen .legend-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.flowchart-fullscreen .legend-item span {
    color: inherit;
    font-weight: 600;
}

/* Dark theme fullscreen adjustments */
[data-theme="dark"] .flowchart-fullscreen .flowchart-legend {
    background: rgba(31, 41, 55, 0.95);
    border-color: #4b5563;
}

[data-theme="dark"] .flowchart-fullscreen .legend-title {
    color: #f9fafb;
}

[data-theme="dark"] .flowchart-fullscreen .legend-item {
    background: #374151;
    border-color: #6b7280;
    color: #e5e7eb;
}

[data-theme="dark"] .flowchart-fullscreen .legend-item:hover {
    background: #4b5563;
    border-color: var(--primary);
    color: white;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    color: #333;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.fullscreen-close:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
}

/* Dark theme fullscreen close button */
[data-theme="dark"] .fullscreen-close {
    background: #374151;
    color: #f9fafb;
    border-color: #6b7280;
}

[data-theme="dark"] .fullscreen-close:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* Responsive Design */
@media (max-width: 768px) {
    .flowchart-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .flow-btn {
        justify-content: center;
    }
    
    .flowchart-interactive {
        min-height: 500px;
        height: 500px;
    }
    
    .legend-items {
        flex-direction: column;
        gap: 8px;
    }
    
    .legend-item {
        justify-content: center;
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .flowchart-interactive {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .legend-item {
    background: var(--bg-tertiary);
    border-color: #374151;
}

[data-theme="dark"] .legend-item:hover {
    background: rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .flow-text {
    fill: var(--text-primary);
}

[data-theme="dark"] .flow-text.question,
[data-theme="dark"] .flow-text.weight {
    fill: white;
}

[data-theme="dark"] .flowchart-fullscreen {
    background: rgba(0, 0, 0, 0.98);
}

/* Diagram Legend */
.diagram-legend {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.legend-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.legend-text strong {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.legend-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Usage Steps */
.usage-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.usage-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.step-num {
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.usage-step p {
    margin: 0;
    line-height: 1.5;
}

.usage-step strong {
    color: var(--primary);
    font-weight: 600;
}

/* Path Examples */
.path-examples {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.path-example-item {
    padding: 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.path-example-item h4 {
    color: var(--primary);
    margin-bottom: 16px;
    font-weight: 600;
}

.path-flow {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.path-node {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

.path-node.epic {
    background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%);
    color: #333;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.path-arrow {
    font-size: 18px;
    color: var(--primary);
    font-weight: 600;
}

.path-arrow.jump {
    color: #ef4444;
    font-size: 24px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.path-example-item p {
    margin: 12px 0 0 0;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Responsive Design for Flowchart */
@media (max-width: 768px) {
    .flowchart-container {
        padding: 16px;
        margin: 16px 0;
    }
    
    .flowchart-wrapper {
        padding: 12px;
    }
    
    .fullscreen-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .legend-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .legend-icon {
        margin-bottom: 8px;
    }
    
    .usage-step {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .step-num {
        margin-bottom: 8px;
    }
    
    .path-flow {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .path-arrow {
        transform: rotate(90deg);
    }
    
    .path-arrow.jump {
        transform: rotate(90deg) scale(1);
    }
    
    .path-node {
        text-align: center;
        min-width: 120px;
    }
}

/* Dark theme adjustments for flowchart */
[data-theme="dark"] .flowchart-wrapper {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .flowchart-image {
    filter: brightness(0.9) contrast(1.1);
}

[data-theme="dark"] .fullscreen-modal {
    background: rgba(0, 0, 0, 0.98);
}

/* CSV Table Styles */
.csv-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--shadow);
}

.csv-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.csv-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.csv-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.csv-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    min-width: 1200px;
}

.csv-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    position: relative;
    cursor: help;
}

.csv-table th i {
    margin-right: 6px;
    opacity: 0.9;
}

.csv-table th[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: fixed;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 300px;
    white-space: normal;
    line-height: 1.4;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease-out;
}

.csv-table th[data-tooltip]:hover::before {
    content: '';
    position: fixed;
    border: 8px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    pointer-events: none;
}

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

/* Custom tooltip styles */
.custom-tooltip {
    font-family: 'Inter', sans-serif;
    word-wrap: break-word;
    box-sizing: border-box;
}

/* Enhanced table container to ensure tooltips work */
.table-wrapper {
    position: relative;
    z-index: 1;
}

.csv-container {
    position: relative;
    z-index: 2;
}

/* Dark theme tooltip adjustments */
[data-theme="dark"] .custom-tooltip {
    background: rgba(17, 24, 39, 0.95) !important;
    border-color: rgba(75, 85, 99, 0.3) !important;
}

[data-theme="dark"] .csv-table th[data-tooltip]:hover::after {
    background: rgba(17, 24, 39, 0.95);
    border-color: rgba(75, 85, 99, 0.3);
}

[data-theme="dark"] .csv-table th[data-tooltip]:hover::before {
    border-top-color: rgba(17, 24, 39, 0.95);
}

.csv-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    line-height: 1.5;
}

.csv-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* Question grouping */
.csv-table .row-q1 { border-left: 4px solid #3b82f6; }
.csv-table .row-q2 { border-left: 4px solid #10b981; }
.csv-table .row-q3 { border-left: 4px solid #f59e0b; }
.csv-table .row-q4 { border-left: 4px solid #ef4444; }
.csv-table .row-q5 { border-left: 4px solid #8b5cf6; }
.csv-table .row-q6 { border-left: 4px solid #ec4899; }
.csv-table .row-q7 { border-left: 4px solid #14b8a6; }
.csv-table .row-q8 { border-left: 4px solid #f97316; }
.csv-table .row-q9 { border-left: 4px solid #84cc16; }
.csv-table .row-q10 { border-left: 4px solid #6366f1; }

/* Column styling */
.csv-table .question-id {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    text-align: center;
    background: rgba(102, 126, 234, 0.1);
}

.csv-table .question-text {
    font-weight: 500;
    color: var(--text-primary);
    max-width: 200px;
}

.csv-table .answer-id {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #6b7280;
    background: #f9fafb;
    text-align: center;
}

.csv-table .answer-text {
    font-weight: 500;
    color: var(--text-primary);
}

.csv-table .answer-text.epic {
    color: #dc2626;
    font-weight: 700;
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Weight styling */
.csv-table .weight {
    font-weight: 700;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
}

.csv-table .weight.weak {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.csv-table .weight.normal {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.csv-table .weight.slightly-strong {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.csv-table .weight.strong {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.csv-table .weight.very-strong {
    background: linear-gradient(135deg, #7c2d12 0%, #92400e 100%);
}

.csv-table .weight.epic {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1f2937;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4); }
    to { box-shadow: 0 4px 16px rgba(251, 191, 36, 0.8); }
}

.csv-table .snippet {
    font-style: italic;
    color: #6b7280;
    max-width: 250px;
    word-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 4px;
    background: rgba(107, 114, 128, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(107, 114, 128, 0.2);
    position: relative;
    cursor: help;
}

.csv-table .snippet:hover {
    background: rgba(102, 126, 234, 0.15);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
    z-index: 1000;
    position: relative;
    overflow: visible;
}

.csv-table .condition {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #059669;
    background: #ecfdf5;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

.csv-table .condition.empty {
    color: #9ca3af;
    background: #f9fafb;
}

.csv-table .next-question {
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.csv-table .next-question.jump {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    color: #dc2626;
    font-weight: 700;
}

.csv-table .next-question.end {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #059669;
    font-weight: 700;
}

/* Column Guide */
.column-guide {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.column-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.column-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.column-text strong {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.column-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Logic Examples */
.logic-examples {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.logic-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.logic-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.logic-icon.condition {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.logic-icon.jump {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.logic-icon.snippet {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.logic-text strong {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.logic-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Creation Guide */
.creation-guide {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.creation-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.step-number {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.step-content h4 {
    color: var(--primary);
    margin: 0 0 8px 0;
    font-weight: 600;
}

.step-content p {
    margin: 0 0 12px 0;
    line-height: 1.6;
    color: var(--text-primary);
}

.step-example {
    background: rgba(16, 185, 129, 0.1);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #10b981;
    font-size: 0.875rem;
    margin-top: 8px;
}

.step-example strong {
    color: #059669;
    font-weight: 600;
}

/* Column visibility controls */
.csv-table th,
.csv-table td {
    display: table-cell;
}

/* Show All mode - default, show everything */
.csv-table.show-all th,
.csv-table.show-all td {
    display: table-cell !important;
}

/* Essential mode - hide some columns */
.csv-table.show-essential .col-question-text,
.csv-table.show-essential .col-answer-id,
.csv-table.show-essential .col-condition,
.csv-table.show-essential .col-next {
    display: none !important;
}

/* Advanced mode - hide basic columns, show technical ones */
.csv-table.show-advanced .col-question-text,
.csv-table.show-advanced .col-answer-text,
.csv-table.show-advanced .col-weight,
.csv-table.show-advanced .col-snippet {
    display: none !important;
}

/* Debug styles */
.csv-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4) !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .csv-container {
        padding: 16px;
        margin: 16px 0;
    }
    
    .csv-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .csv-btn {
        justify-content: center;
    }
    
    .csv-table {
        min-width: 800px;
        font-size: 0.8rem;
    }
    
    .csv-table th,
    .csv-table td {
        padding: 8px 6px;
    }
    
    .csv-table .question-text,
    .csv-table .snippet {
        max-width: 150px;
    }
    
    .column-item,
    .logic-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .column-icon,
    .logic-icon {
        margin-bottom: 8px;
    }
    
    .creation-step {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .step-number {
        margin-bottom: 12px;
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .csv-table {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .csv-table td {
    border-bottom-color: #374151;
}

[data-theme="dark"] .csv-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.1);
}

[data-theme="dark"] .csv-table .answer-id {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

[data-theme="dark"] .csv-table .condition {
    background: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .csv-table .condition.empty {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

[data-theme="dark"] .step-example {
    background: rgba(16, 185, 129, 0.2);
}

[data-theme="dark"] .csv-table .snippet {
    background: rgba(107, 114, 128, 0.2);
    border-color: rgba(107, 114, 128, 0.3);
    color: var(--text-secondary);
}

[data-theme="dark"] .csv-table .snippet:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: var(--primary);
    color: var(--text-primary);
}

/* Improved readability for system examples */
.our-system-example {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #cbd5e1;
    padding: 16px;
    border-radius: 12px;
    margin: 12px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.our-system-example.lore-example {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    border-left: 6px solid #f59e0b;
}

.our-system-example.character-example {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
    border-left: 6px solid #10b981;
}

.our-system-example h4 {
    color: #1f2937;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 1rem;
}

.our-system-example p {
    color: #374151;
    font-weight: 600;
    line-height: 1.6;
    margin: 0;
}

.our-system-example strong {
    color: #111827;
    font-weight: 700;
}

/* Dark theme adjustments for system examples */
[data-theme="dark"] .our-system-example {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border-color: #6b7280;
}

[data-theme="dark"] .our-system-example.lore-example {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    border-color: #f59e0b;
}

[data-theme="dark"] .our-system-example.character-example {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    border-color: #10b981;
}

[data-theme="dark"] .our-system-example h4 {
    color: #f9fafb;
}

[data-theme="dark"] .our-system-example p {
    color: #e5e7eb;
}

[data-theme="dark"] .our-system-example strong {
    color: #ffffff;
}

/* Animations for new elements */
.philosophy-principle, .question-layer, .weight-tier-explanation, .logic-rule, .process-step, .principle, .jump-rule, .generation-example, .legend-item, .usage-step, .path-example-item, .column-item, .logic-item, .creation-step, .our-system-example {
    animation: fadeInUp 0.6s ease-out;
}

/* Existing code for other sections */

/* Weight Calculator Styles */
.weight-calculator-tool {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 1.5rem 0;
}

.calculator-input h4 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.input-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.calc-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.2s ease;
}

.calc-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.calculator-result {
    background: var(--bg-primary);
    border: 2px solid var(--success);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.recommended-weight {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success);
    text-align: center;
    margin-bottom: 1rem;
}

.recommendation-explanation {
    text-align: center;
    color: var(--text-secondary);
}

.weight-reference-table {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.weight-tier {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.weight-tier.epic {
    border-left-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.tier-weight {
    background: var(--primary);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.tier-info h4 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.tier-info p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.balancing-tips {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tip {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.tip-icon {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.tip-content h4 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

/* Template Styles */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.template-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.template-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.template-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.template-card h4 {
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.template-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s ease;
}

.template-btn:hover {
    background: var(--primary-dark);
}

.template-details {
    margin-top: 2rem;
}

.question-template {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.q-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.q-num {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.q-content strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.q-content small {
    color: var(--warning);
    font-weight: 600;
    display: block;
    margin-top: 0.5rem;
}

.template-example {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.output-example {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1.125rem;
    line-height: 1.6;
}

.worksheet {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.checklist-item input[type="checkbox"] {
    margin-top: 0.25rem;
    transform: scale(1.2);
    accent-color: var(--primary);
}

.checklist-item label {
    flex: 1;
    line-height: 1.5;
    cursor: pointer;
}

.quick-formula {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.formula-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.step-num {
    background: var(--success);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.step-text strong {
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

/* Case Studies Styles */
.case-study {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    overflow: hidden;
}

.case-header {
    background: var(--primary);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.case-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.875rem;
}

.case-content {
    padding: 2rem;
}

.case-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.case-challenge, .case-solution {
    padding: 1rem;
    border-radius: var(--radius);
}

.case-challenge {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--error);
}

.case-solution {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success);
}

.case-flow {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
}

.flow-step-case {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.step-label {
    background: var(--primary);
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    flex-shrink: 0;
}

.case-results {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
}

.output-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.output-sample {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-style: italic;
    color: var(--text-secondary);
}

.output-sample.intensity-high {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.output-sample.intensity-low {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.case-lessons ul {
    list-style: none;
    padding: 0;
}

.case-lessons li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.case-lessons li:last-child {
    border-bottom: none;
}

.case-innovation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
}

.innovation-point {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.innov-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.pattern-analysis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.pattern {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
}

.pattern-icon {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.inspiration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.inspiration-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: all 0.3s ease;
}

.inspiration-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.inspiration-item h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Best Practices Styles */
.best-practices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.practice-category {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.5rem;
    border-top: 4px solid var(--primary);
}

.practice-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.practice-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.practice-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    font-weight: 600;
}

.practice-icon.good {
    background: var(--success);
    color: white;
}

.practice-icon.bad {
    background: var(--error);
    color: white;
}

.practice-icon.warning {
    background: var(--warning);
    color: white;
}

.practice-content h4 {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.common-mistakes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.mistake {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    border-left: 4px solid var(--error);
}

.mistake-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.mistake-content h4 {
    color: var(--error);
    margin-bottom: 1rem;
}

.advanced-principles {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.principle-advanced {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.principle-number {
    background: var(--primary);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.principle-example {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 0.75rem;
    font-family: monospace;
    font-size: 0.875rem;
}

.validation-checklist {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.validation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.validation-item input[type="checkbox"] {
    margin-top: 0.25rem;
    transform: scale(1.2);
    accent-color: var(--success);
}

.validation-item label {
    flex: 1;
    line-height: 1.5;
    cursor: pointer;
}

/* FAQ Styles */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.faq-category {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.5rem;
    border-top: 4px solid var(--primary);
}

.faq-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.faq-question {
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.faq-question:hover {
    background: var(--bg-tertiary);
}

.faq-question h4 {
    margin: 0;
    color: var(--primary);
}

.faq-question i {
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.faq-question.active i {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 1rem 1rem 1rem;
    display: none;
    border-top: 1px solid var(--border);
}

.faq-answer.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.faq-answer ol, .faq-answer ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.example-comparison {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.weight-decision-tree {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.decision-step {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.debug-example {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
    font-family: monospace;
    font-size: 0.875rem;
}

.common-csv-errors {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.emergency-toolkit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.emergency-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--warning);
}

.step-icon {
    background: var(--warning);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.step-content h4 {
    color: var(--warning);
    margin-bottom: 0.5rem;
}

.help-indicators {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.help-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.help-icon {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Glossary Styles */
.glossary-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.glossary-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 2rem;
    border-top: 4px solid var(--primary);
}

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.glossary-term {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.glossary-term:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.term-letter {
    background: var(--primary);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.term-content h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.term-example {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    border-left: 3px solid var(--success);
}

.search-helper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-helper input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.search-helper input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-tips {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.quick-refs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.ref-section h4 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.weight-quick-ref {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.weight-ref {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.875rem;
}

.weight-ref.weak {
    background: rgba(156, 163, 175, 0.2);
    color: var(--text-secondary);
}

.weight-ref.normal {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}

.weight-ref.strong {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.weight-ref.very-strong {
    background: rgba(124, 58, 237, 0.2);
    color: #7c3aed;
}

.weight-ref.epic {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.id-format, .balance-rule {
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

.format-example {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.rule-part {
    background: var(--success);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Responsive Design for New Sections */
@media (max-width: 768px) {
    .best-practices-grid {
        grid-template-columns: 1fr;
    }
    
    .case-overview {
        grid-template-columns: 1fr;
    }
    
    .glossary-grid {
        grid-template-columns: 1fr;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .weight-reference-table {
        gap: 0.75rem;
    }
    
    .tier-weight {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .quick-refs {
        grid-template-columns: 1fr;
    }
    
    .emergency-toolkit {
        grid-template-columns: 1fr;
    }
    
    .pattern-analysis {
        grid-template-columns: 1fr;
    }
}

/* Dark theme adjustments for new sections */
[data-theme="dark"] .weight-calculator-tool {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .calculator-result {
    background: var(--bg-secondary);
    border-color: var(--success);
}

[data-theme="dark"] .template-card:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .faq-question:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .glossary-term:hover {
    background: var(--bg-secondary);
}
