/* Hide method picker in app shell (always Vision AI UX) */
.ocr-method-selection { display: none; }
/* Minimal helpers for immersive upload */
#uploadHero .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 14px; border: 1px solid #334155; border-radius: 10px;
    background: linear-gradient(180deg, #1f2937, #111827); color: #e5e7eb;
}
#uploadHero .btn:hover { border-color: #93c5fd; }
/* Acting Assistant Styles */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(1000px 600px at 10% -10%, rgba(56, 189, 248, 0.10), rgba(2, 6, 23, 0)) no-repeat,
        radial-gradient(800px 500px at 110% 10%, rgba(139, 92, 246, 0.10), rgba(2, 6, 23, 0)) no-repeat,
        #0b1020;
    min-height: 100vh;
    color: #e5e7eb;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    color: #e5e7eb;
}

.header-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.brand h1 {
    font-size: 2.25rem;
    margin-bottom: 6px;
}

.brand .tagline {
    color: #94a3b8;
}

.hero-accent {
    height: 2px;
    width: 100%;
    margin-top: 14px;
    background: linear-gradient(90deg, rgba(34,211,238,0) 0%, rgba(34,211,238,0.6) 20%, rgba(167,139,250,0.6) 80%, rgba(167,139,250,0) 100%);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.session-status {
    margin-top: 15px;
}

.session-indicator {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: white;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.session-indicator i {
    margin-right: 5px;
}

#sessionId {
    font-family: monospace;
    font-weight: bold;
}

.main-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.card {
    background: #0f172a;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(2, 6, 23, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 28px 80px rgba(2, 6, 23, 0.75);
    border-color: rgba(148, 163, 184, 0.2);
}

.card h2 {
    margin-bottom: 20px;
    color: #e2e8f0;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    padding-bottom: 10px;
}

.card h2 i {
    margin-right: 10px;
    color: #93c5fd;
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(148, 163, 184, 0.05);
}

.upload-area:hover {
    border-color: #93c5fd;
    background: rgba(148, 163, 184, 0.08);
}

.upload-area.drag-over {
    border-color: #93c5fd;
    background: rgba(148, 163, 184, 0.12);
}

.upload-area i {
    font-size: 3rem;
    color: #93c5fd;
    margin-bottom: 15px;
    display: block;
}

.upload-link {
    color: #a5b4fc;
    text-decoration: underline;
    cursor: pointer;
}

/* Default Script Section */
.default-script-section {
    margin-top: 20px;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.divider-text {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-style: italic;
}

.default-script-info {
    display: block;
    margin-top: 8px;
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22d3ee, #a78bfa);
    width: 0%;
    transition: width 0.3s ease;
}

/* Buttons */
.btn {
    padding: 11px 20px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #e5e7eb;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.btn-primary {
    background: linear-gradient(135deg, #22d3ee, #a78bfa);
    color: #0b1020;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.25);
}

.btn-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(148, 163, 184, 0.25);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #e5e7eb;
}

.btn-outline:hover:not(:disabled) {
    border-color: #93c5fd;
    color: #93c5fd;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.audio-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    font-weight: 500;
    color: #cbd5e1;
}

.audio-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.35);
    transition: all 0.3s ease;
}

.audio-indicator.active {
    background: #22c55e;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Script Details */
.script-details > * + * {
    margin-top: 15px;
}

.detail-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.detail-item .label {
    font-weight: 600;
    margin-right: 10px;
    min-width: 100px;
    color: #cbd5e1;
}

.character-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.character-tag {
    background: rgba(20, 184, 166, 0.18);
    color: #5eead4;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.character-selection {
    margin-top: 20px;
}

.character-selection.compact {
    margin-top: 0;
}

.character-selection label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #cbd5e1;
}

.character-selection select {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    font-size: 1rem;
    background: #0b1220;
    color: #e5e7eb;
}

.character-selection.attention label {
    color: #fde68a;
}

.character-selection.attention select {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* Activity Feed */
.activity-feed {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    padding: 15px;
    background: rgba(2, 6, 23, 0.4);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.activity-item i {
    color: #93c5fd;
    min-width: 20px;
}

/* Dialogue Display */
.dialogue-display {
    padding: 20px;
    background: rgba(2, 6, 23, 0.4);
    border-radius: 10px;
}

.dialogue-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.dlg-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.dlg-progress-track {
    width: 180px;
    height: 6px;
    background: rgba(148,163,184,0.2);
    border-radius: 999px;
    overflow: hidden;
}

.dlg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22d3ee, #a78bfa);
    width: 0%;
    transition: width 0.3s ease;
}

.dlg-progress-text {
    color: #cbd5e1;
    font-size: 0.9rem;
}

.dlg-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.next-up {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.next-up .next-label {
    color: #94a3b8;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}

.dialogue-line {
    margin-bottom: 20px;
}

.speaker {
    display: block;
    font-weight: bold;
    color: #93c5fd;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.line-text {
    display: block;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #e5e7eb;
}

.dialogue-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}

.control-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.controls-left { justify-content: flex-start; }
.controls-center { justify-content: center; }
.controls-right { justify-content: flex-end; }

/* Script Viewer */
.script-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.toolbar-spacer { flex: 1; }

.memorization-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
}

/* Fancy switch styling */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(148, 163, 184, 0.25);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(2, 6, 23, 0.2);
}

.slider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: #e5e7eb;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.switch input:checked + .slider {
    background: linear-gradient(90deg, #22d3ee, #a78bfa);
    border-color: rgba(147, 197, 253, 0.6);
}

.switch input:checked + .slider::before {
    transform: translate(20px, -50%);
    background: #0b1020;
}

.switch-label {
    color: #cbd5e1;
    font-size: 0.95rem;
}

.memorized-blur {
    filter: blur(6px);
    transition: filter 0.2s ease;
    cursor: pointer;
}

.memorized-blur.revealed {
    filter: none;
}

.script-scroll {
    height: 54vh;
    overflow: auto;
    background: rgba(2, 6, 23, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
}

.script-scroll + .dialogue-controls {
    margin-top: 12px;
}

.script-lines {
    list-style: none;
    padding: 14px 16px;
}

.script-line {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 8px;
    color: #cbd5e1;
}

.script-line .line-num {
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.script-line .speaker { color: #93c5fd; }

.script-line.active {
    background: rgba(167, 139, 250, 0.14);
    border: 1px solid rgba(167, 139, 250, 0.35);
    color: #e5e7eb;
}

/* Upload Status */
.upload-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.upload-status.success {
    background: rgba(16, 185, 129, 0.18);
    color: #86efac;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.upload-status.error {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.upload-status.processing {
    background: rgba(250, 204, 21, 0.18);
    color: #fde68a;
    border: 1px solid rgba(250, 204, 21, 0.3);
}

/* Settings Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #0b1220;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    color: #e5e7eb;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #94a3b8;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #e5e7eb;
}

.modal-body {
    padding: 25px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #cbd5e1;
}

.setting-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.setting-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    background: #0b1220;
    color: #e5e7eb;
}

/* OCR Method Selection */
.ocr-method-selection, .inspection-ocr-method {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(2, 6, 23, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.ocr-method-selection label, .inspection-ocr-method label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #cbd5e1;
}

.ocr-method-selection select, .inspection-ocr-method select {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    background: #0b1220;
    font-size: 1rem;
    color: #e5e7eb;
}

.ocr-method-info {
    margin-top: 8px;
}

.ocr-method-info small {
    color: #718096;
    font-style: italic;
}

.ocr-method-selection select:focus, .inspection-ocr-method select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Script Inspection */
.inspection-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.inspection-results {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    background: #f7fafc;
}

.inspection-summary {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.inspection-summary h4 {
    margin-top: 0;
    color: #4a5568;
}

.inspection-details {
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.issue-item {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.issue-type {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.issue-type.page_number {
    background: #fed7d7;
    color: #742a2a;
}

.issue-type.header_footer {
    background: #faf089;
    color: #744210;
}

.issue-type.ocr_error {
    background: #fbb6ce;
    color: #702459;
}

.issue-type.character_name_error {
    background: #c6f6d5;
    color: #22543d;
}

.issue-original {
    font-family: monospace;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 0 10px;
    font-size: 0.9rem;
}

.issue-suggestion {
    font-family: monospace;
    background: #dcfce7;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #166534;
}

.confidence-meter {
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #f56565, #ed8936, #48bb78);
    transition: width 0.3s ease;
}

.raw-text-viewer {
    background: #0b1220;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-top: 15px;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

/* Settings Button */
.settings-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22d3ee, #a78bfa);
    border: none;
    color: #0b1020;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.25);
    transition: all 0.3s ease;
    z-index: 100;
}

.settings-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(34, 211, 238, 0.35);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .audio-controls {
        flex-direction: column;
    }
    
    .audio-status {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .dialogue-controls {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
}

/* Text Editor Styles */
.text-editor {
    margin-top: 1.5rem;
}

.text-editor h4 {
    margin-bottom: 1rem;
    color: #e5e7eb;
    font-weight: 600;
}

.editor-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.editor-controls .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

#scriptTextEditor {
    width: 100%;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    background: #0b1220;
    color: #e5e7eb;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#scriptTextEditor:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.15);
}

#scriptTextEditor.modified {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.no-issues {
    text-align: center;
    padding: 2rem;
    color: #86efac;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Quick Upload Overlay (class-based, JS relies on #quickUploadOverlay id) */
.overlay-root {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.96);
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.overlay-panel {
    width: 100%;
    max-width: 880px;
    padding: 32px 20px;
}

.overlay-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.overlay-title {
    margin: 0;
    font-size: 40px;
    line-height: 1.1;
}

.overlay-subtitle {
    margin: 6px 0 0;
    color: #9ca3af;
}

.overlay-dropzone {
    border: 1px dashed #334155;
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
}

.overlay-icon {
    font-size: 36px;
    color: #93c5fd;
}

.overlay-instruction {
    margin: 10px 0 16px;
}

.overlay-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.overlay-hint {
    display: block;
    margin-top: 12px;
    color: #94a3b8;
}
