/* ============================================
   ASS/SSA Subtitle Viewer - Amber Theme
   Dark mode support with light mode default
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    --transition-speed: 0.25s;
    
    /* Primary Colors - Amber Theme */
    --primary: #D97706;
    --primary-light: #FEF3C7;
    --primary-dark: #B45309;
    --accent: #F59E0B;
    
    /* Status Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    
    /* Section Colors */
    --script-info-color: #8B5CF6;
    --styles-color: #D97706;
    --events-color: #10B981;
    
    /* Background Colors */
    --bg: #FFFBEB;
    --bg-elevated: #FFFFFF;
    --bg-secondary: #FEF3C7;
    --bg-tertiary: #FDE68A;
    
    /* Text Colors */
    --text: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    
    /* Border Colors */
    --border: #FDE68A;
    --border-light: #FEF3C7;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --shadow-primary: 0 4px 14px rgba(217, 119, 6, 0.25);
    --shadow-primary-hover: 0 6px 20px rgba(217, 119, 6, 0.35);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Input */
    --input-bg: #FFFFFF;
    --input-border: #FDE68A;
    
    /* Scrollbar */
    --scrollbar-track: var(--bg);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --primary: #FBBF24;
    --primary-light: rgba(251, 191, 36, 0.15);
    --primary-dark: #F59E0B;
    --accent: #FCD34D;
    
    /* Section Colors */
    --script-info-color: #A78BFA;
    --styles-color: #FBBF24;
    --events-color: #34D399;
    
    /* Background Colors */
    --bg: #0F172A;
    --bg-elevated: #1E293B;
    --bg-secondary: #334155;
    --bg-tertiary: #475569;
    
    /* Text Colors */
    --text: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    
    /* Border Colors */
    --border: rgba(251, 191, 36, 0.2);
    --border-light: rgba(255,255,255,0.05);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
    --shadow-primary: 0 4px 14px rgba(251, 191, 36, 0.2);
    --shadow-primary-hover: 0 6px 20px rgba(251, 191, 36, 0.3);
    
    /* Input */
    --input-bg: #334155;
    --input-border: #475569;
    
    /* Status */
    --success: #34D399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #FBBF24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --danger: #F87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --info: #60A5FA;
    --info-light: rgba(96, 165, 250, 0.15);
    
    /* Scrollbar */
    --scrollbar-track: var(--bg-elevated);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
}

/* Base Styles */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Container */
.tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tool-icon-wrapper {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
}

.tool-icon-wrapper svg,
.tool-icon-wrapper i {
    width: 28px;
    height: 28px;
}

.tool-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.tool-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Main Tool Area */
.tool-main {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    transition: background-color var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

/* Upload Section */
.upload-section {
    padding: 3rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-light);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-area:hover::before,
.upload-area.drag-over::before {
    opacity: 0.5;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-5px);
}

.upload-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.upload-subtitle {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    font-size: 1rem;
}

.file-types {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.file-type-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* File Info Bar */
.file-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.file-info-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.file-info-details i {
    color: var(--primary);
}

.file-name {
    font-weight: 600;
    color: var(--text);
}

.file-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--danger);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-item i {
    color: var(--primary);
}

/* View Tabs */
.view-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.view-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.view-tab:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.view-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.view-tab i {
    width: 16px;
    height: 16px;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.search-bar i {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
}

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

.search-count {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}

/* View Content */
.view-content {
    max-height: 600px;
    overflow-y: auto;
}

.view-panel {
    display: none;
    padding: 1.5rem;
}

.view-panel.active {
    display: block;
}

/* Timeline View */
.dialogue-entry {
    display: flex;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    transition: background-color 0.2s ease;
    align-items: flex-start;
}

.dialogue-entry:hover {
    background: var(--primary-light);
}

.dialogue-entry.highlight {
    background: var(--warning-light);
}

.dialogue-index {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.dialogue-body {
    flex: 1;
    min-width: 0;
}

.dialogue-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    align-items: center;
}

.dialogue-time {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}

.dialogue-style-badge {
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.1);
    color: var(--script-info-color);
}

[data-theme="dark"] .dialogue-style-badge {
    background: rgba(167, 139, 250, 0.15);
}

.dialogue-actor {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.dialogue-duration-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin: 0.35rem 0;
    overflow: hidden;
}

.dialogue-duration-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.dialogue-text {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
}

.dialogue-text .override-tag {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Styles View */
.style-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.style-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.style-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.style-preview {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.style-properties {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.style-prop {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.style-prop-label {
    color: var(--text-muted);
    white-space: nowrap;
}

.style-prop-value {
    color: var(--text);
    font-weight: 500;
    font-family: monospace;
    font-size: 0.8rem;
}

.color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--border);
    display: inline-block;
    vertical-align: middle;
}

/* Script Info View (within styles) */
.script-info-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.script-info-section h3 {
    color: var(--script-info-color);
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.script-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.script-info-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.script-info-item .label {
    color: var(--text-muted);
    white-space: nowrap;
}

.script-info-item .value {
    color: var(--text);
    font-weight: 500;
}

/* Raw View */
.raw-content {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    max-height: none;
    overflow: visible;
}

.raw-section-header {
    color: var(--primary);
    font-weight: 700;
}

.raw-key {
    color: var(--script-info-color);
}

.raw-comment {
    color: var(--text-muted);
    font-style: italic;
}

/* Analysis View */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.analysis-stat {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: background-color var(--transition-speed);
}

.analysis-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.analysis-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.analysis-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.analysis-section h3 {
    color: var(--primary);
    font-size: 1rem;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.style-usage-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.style-usage-name {
    width: 120px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.style-usage-track {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.style-usage-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.style-usage-count {
    width: 60px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
    font-family: monospace;
}

/* Reading Speed Distribution */
.speed-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.speed-label {
    width: 80px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
}

.speed-track {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.speed-fill {
    height: 100%;
    border-radius: 3px;
}

.speed-fill.slow { background: var(--success); }
.speed-fill.normal { background: var(--primary); }
.speed-fill.fast { background: var(--warning); }
.speed-fill.very-fast { background: var(--danger); }

.speed-count {
    width: 40px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Action Bar */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Error Section */
.error-section {
    padding: 3rem;
    text-align: center;
}

.error-content {
    max-width: 400px;
    margin: 0 auto;
}

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

.error-content h3 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.error-content p {
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.error-contact {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.error-contact a {
    color: var(--primary);
    text-decoration: none;
}

.error-contact a:hover {
    text-decoration: underline;
}

/* Related Tools */
.related-tools {
    margin-bottom: 2rem;
}

.related-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: var(--text);
    margin: 0 0 1rem 0;
}

.related-title i {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.related-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.related-link svg,
.related-link i {
    width: 16px;
    height: 16px;
}

/* Info Sections */
.info-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.3rem;
    color: var(--text);
    margin: 0 0 1.5rem 0;
}

.info-card h2 svg,
.info-card h2 i {
    color: var(--primary);
    width: 24px;
    height: 24px;
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.info-card p a {
    color: var(--primary);
    text-decoration: none;
}

.info-card p a:hover {
    text-decoration: underline;
}

/* Steps List */
.steps-list {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 0;
}

.steps-list li {
    position: relative;
    padding-left: 3.25rem;
    margin-bottom: 1rem;
    counter-increment: step;
    color: var(--text-secondary);
    line-height: 1.6;
}

.steps-list li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(1rem - 1px);
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: var(--primary-light);
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 1;
}

.steps-list li:last-child { margin-bottom: 0; }

.steps-list li a {
    color: var(--primary);
    text-decoration: none;
}

.steps-list li a:hover { text-decoration: underline; }

/* Mode Explanations */
.mode-explanations {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mode-explain {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.mode-tag {
    flex-shrink: 0;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.mode-tag.script-info {
    background: rgba(139, 92, 246, 0.1);
    color: var(--script-info-color);
}

.mode-tag.styles-tag {
    background: var(--primary-light);
    color: var(--primary);
}

.mode-tag.events-tag {
    background: var(--success-light);
    color: var(--success);
}

[data-theme="dark"] .mode-tag.script-info {
    background: rgba(167, 139, 250, 0.15);
}

.mode-explain p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-speed);
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    transition: all 0.2s ease;
}

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

.faq-question svg,
.faq-question i {
    flex-shrink: 0;
    color: var(--primary);
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.faq-item.open .faq-question svg,
.faq-item.open .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 1rem 1.25rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.faq-answer a {
    color: var(--primary);
    text-decoration: none;
}

.faq-answer a:hover { text-decoration: underline; }

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: var(--bg-elevated);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .tool-container { padding: 1rem; }

    .tool-title-row { gap: 0.75rem; }

    .tool-icon-wrapper {
        width: 50px;
        height: 50px;
    }

    .tool-icon-wrapper svg,
    .tool-icon-wrapper i {
        width: 24px;
        height: 24px;
    }

    .upload-section { padding: 2rem 1.5rem; }
    .upload-area { padding: 2.5rem 1.5rem; }

    .file-info-bar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .stats-bar {
        gap: 1rem;
        padding: 0.75rem 1rem;
    }

    .view-tabs {
        overflow-x: auto;
    }

    .view-tab {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .view-panel { padding: 1rem; }

    .dialogue-entry {
        flex-direction: column;
        gap: 0.5rem;
    }

    .dialogue-index {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.65rem;
    }

    .style-properties {
        grid-template-columns: 1fr;
    }

    .analysis-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-bar {
        flex-direction: column;
        padding: 1.25rem 1rem;
    }

    .btn { width: 100%; justify-content: center; }

    .mode-explain {
        flex-direction: column;
        gap: 0.5rem;
    }

    .info-card { padding: 1.5rem; }
}

@media (max-width: 480px) {
    .tool-title-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Selection */
::selection {
    background: rgba(217, 119, 6, 0.2);
    color: var(--text);
}

[data-theme="dark"] ::selection {
    background: rgba(251, 191, 36, 0.3);
}

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

.viewer-section { animation: fadeIn 0.4s ease; }

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
