/* ═══════════════════════════════════════════════════════════
   DEMODUB — Broadcast Control Room Theme
   Dark studio aesthetic with electric cyan accents
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-deep: #050508;
    --bg-base: #0a0a0f;
    --bg-raised: #0e0e16;
    --bg-surface: #12121c;
    --bg-hover: #161622;
    --border-subtle: #1a1a2e;
    --border-medium: #252540;
    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-dim: #55556a;
    --accent: #f0c840;
    --accent-glow: rgba(212, 160, 32, 0.15);
    --accent-dim: #d4a020;
    --red: #ff3b5c;
    --red-glow: rgba(255, 59, 92, 0.15);
    --yellow: #ffb822;
    --yellow-glow: rgba(255, 184, 34, 0.12);
    --green: #00e676;
    --green-glow: rgba(0, 230, 118, 0.12);
    --font-mono: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, monospace;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 150ms ease;
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* Scanline texture overlay on body */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #f5d660; }

/* ─── NAVIGATION ─── */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 2rem;
    height: 52px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(212, 160, 32, 0.4);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-logo::before { display: none; }

@keyframes rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 0.4rem 0.85rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ─── MAIN CONTENT ─── */

.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.main-wide {
    max-width: 100%;
    padding: 0;
}

/* ─── PAGE HEADER ─── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.page-title .count {
    color: var(--text-dim);
    font-weight: 400;
    margin-left: 0.5rem;
    font-size: 0.9rem;
}

/* ─── BUTTONS ─── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-body);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.3;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.btn-primary:hover {
    background: #f5d660;
    border-color: #f5d660;
    color: #000;
    box-shadow: 0 0 20px rgba(212, 160, 32, 0.3);
}

.btn-danger {
    color: var(--red);
    border-color: transparent;
    background: transparent;
}

.btn-danger:hover {
    background: var(--red-glow);
    border-color: rgba(255, 59, 92, 0.3);
    color: var(--red);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-lg {
    padding: 0.75rem 1.6rem;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
}

.btn-icon {
    padding: 0.45rem;
    min-width: 34px;
    justify-content: center;
}

.btn-record {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    font-weight: 600;
}

.btn-record:hover {
    background: #ff5577;
    border-color: #ff5577;
    color: #fff;
    box-shadow: 0 0 24px rgba(255, 59, 92, 0.3);
}

.btn-stop {
    background: var(--bg-surface);
    color: var(--red);
    border-color: var(--red);
}

.btn-stop:hover {
    background: var(--red-glow);
}

.btn-success {
    background: var(--green);
    color: #000;
    border-color: var(--green);
    font-weight: 600;
}

.btn-success:hover {
    background: #33ff99;
    border-color: #33ff99;
    color: #000;
}

.btn[disabled] {
    opacity: 0.35;
    pointer-events: none;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* ─── STATUS BADGES ─── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 3px;
    font-family: var(--font-mono);
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-recording {
    color: var(--red);
    background: var(--red-glow);
}

.badge-recording::before {
    background: var(--red);
    box-shadow: 0 0 6px var(--red);
    animation: rec-pulse 1.5s ease-in-out infinite;
}

.badge-uploading {
    color: var(--yellow);
    background: var(--yellow-glow);
}

.badge-uploading::before {
    background: var(--yellow);
    animation: rec-pulse 1s ease-in-out infinite;
}

.badge-processing {
    color: var(--yellow);
    background: var(--yellow-glow);
}

.badge-processing::before {
    background: var(--yellow);
    animation: rec-pulse 1.5s ease-in-out infinite;
}

.badge-completed {
    color: var(--green);
    background: var(--green-glow);
}

.badge-completed::before {
    background: var(--green);
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.4);
}

.badge-failed {
    color: var(--red);
    background: var(--red-glow);
}

.badge-failed::before {
    background: var(--red);
}

.badge-mode {
    color: var(--text-secondary);
    background: var(--bg-hover);
    font-weight: 500;
    letter-spacing: 0.03em;
}

.badge-mode::before { display: none; }

/* ─── TABLE ─── */

.table-wrap {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--bg-raised);
}

.table .title-cell {
    font-weight: 500;
}

.table .title-cell a {
    color: var(--text-primary);
}

.table .title-cell a:hover {
    color: var(--accent);
}

.table .meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.table .actions {
    text-align: right;
    white-space: nowrap;
}

/* ─── EMPTY STATE ─── */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-dim);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* ─── CARDS ─── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-medium);
    background: var(--bg-surface);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-title a {
    color: var(--text-primary);
}

.card-title a:hover {
    color: var(--accent);
}

.card-meta {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

/* ─── FORMS ─── */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-family: var(--font-mono);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2388889a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.6rem center;
    background-repeat: no-repeat;
    background-size: 1.2em 1.2em;
    padding-right: 2.2rem;
}

.form-textarea {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 200px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

/* ─── MODE SELECTOR CARDS ─── */

.mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.mode-card {
    position: relative;
    padding: 1.5rem;
    background: var(--bg-raised);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
}

.mode-card:hover {
    border-color: var(--border-medium);
    background: var(--bg-surface);
}

.mode-card.selected {
    border-color: var(--accent);
    background: var(--bg-surface);
    box-shadow: 0 0 24px var(--accent-glow), inset 0 0 24px var(--accent-glow);
}

.mode-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.mode-card-icon {
    font-size: 1.8rem;
    margin-bottom: 0.6rem;
}

.mode-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.mode-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* ─── STUDIO LAYOUT ─── */

.studio {
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: 1fr auto;
    height: calc(100vh - 52px);
    gap: 0;
}

.studio-main {
    padding: 1.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-subtle);
}

.studio-sidebar {
    padding: 1rem;
    overflow-y: auto;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-subtle);
}

.studio-controls {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-base);
    border-top: 1px solid var(--border-subtle);
}

/* ─── FREE MODE STUDIO ─── */

.studio-free {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 52px);
    text-align: center;
    gap: 2rem;
}

.studio-free-status {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.studio-free-timer {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.studio-free-timer.recording {
    color: var(--red);
    text-shadow: 0 0 30px rgba(255, 59, 92, 0.3);
}

.studio-free-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.upload-progress {
    width: 300px;
    margin-top: 1rem;
}

.upload-progress-bar {
    height: 4px;
    background: var(--bg-surface);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 200ms ease;
    box-shadow: 0 0 8px var(--accent);
}

.upload-progress-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
    text-align: center;
}

/* ─── COUNTDOWN OVERLAY ─── */

.countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 8, 0.85);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.countdown-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.countdown-number {
    font-family: var(--font-mono);
    font-size: 12rem;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 60px rgba(212, 160, 32, 0.4), 0 0 120px rgba(212, 160, 32, 0.15);
    animation: countdown-pop 1s ease-out;
    line-height: 1;
}

@keyframes countdown-pop {
    0% { transform: scale(0.5); opacity: 0; }
    40% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ─── TELEPROMPTER ─── */

.teleprompter {
    max-width: 700px;
    margin: 0 auto;
}

.teleprompter-scene-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.teleprompter-scene-label::before {
    content: "";
    width: 16px;
    height: 1px;
    background: var(--accent);
}

.teleprompter-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.25;
}

.teleprompter-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent);
}

.teleprompter-meta-item {
    font-size: 0.82rem;
}

.teleprompter-meta-label {
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 0.15rem;
}

.teleprompter-narration {
    font-size: 1.35rem;
    line-height: 1.65;
    color: var(--text-primary);
    padding: 1.5rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.teleprompter-narration.active {
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

.teleprompter-timer {
    text-align: center;
    margin-top: 1.5rem;
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
}

.teleprompter-timer.recording {
    color: var(--red);
    text-shadow: 0 0 20px rgba(255, 59, 92, 0.3);
}

/* ─── SCENE LIST (Sidebar) ─── */

.scene-list-header {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding-bottom: 0.6rem;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-subtle);
}

.scene-item {
    padding: 0.6rem 0.7rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.scene-item:hover {
    background: var(--bg-hover);
}

.scene-item.active {
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.scene-item.completed {
    opacity: 0.6;
}

.scene-item-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-medium);
    flex-shrink: 0;
}

.scene-item.active .scene-item-indicator {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.scene-item.completed .scene-item-indicator {
    background: var(--green);
}

.scene-item.recording .scene-item-indicator {
    background: var(--red);
    animation: rec-pulse 1s ease-in-out infinite;
}

.scene-item-info {
    flex: 1;
    min-width: 0;
}

.scene-item-name {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scene-item-duration {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
}

.scene-item-status {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.scene-item.completed .scene-item-status {
    color: var(--green);
}

/* ─── REVIEW / SHOW PAGE ─── */

.review-container {
    max-width: 900px;
    margin: 0 auto;
}

.video-player-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    margin-bottom: 1.5rem;
}

.video-player-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-dim);
}

.video-placeholder-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.processing-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.review-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-raised);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.review-meta-item {
    font-size: 0.85rem;
}

.review-meta-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    margin-bottom: 0.15rem;
}

.review-actions {
    display: flex;
    gap: 0.75rem;
}

/* ─── SCRIPT EDITOR ─── */

.editor-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    height: calc(100vh - 52px - 60px);
}

.editor-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-pane:first-child {
    border-right: 1px solid var(--border-subtle);
}

.editor-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    flex-shrink: 0;
}

/* ─── SNIPPET BAR ─── */

.editor-snippets {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.snippet-btn {
    padding: 0.2rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-dim);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-transform: lowercase;
}

.snippet-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
    background: var(--bg-hover);
}

.snippet-btn:first-child {
    color: var(--accent);
    border-color: rgba(212, 160, 32, 0.3);
}

.snippet-btn:first-child:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.snippet-navigate { color: var(--accent) !important; }
.snippet-scroll { color: var(--yellow) !important; }
.snippet-click { color: var(--green) !important; }
.snippet-type { color: #a78bfa !important; }
.snippet-wait { color: var(--text-dim) !important; }
.snippet-hover { color: var(--text-secondary) !important; }

.snippet-sep {
    width: 1px;
    height: 14px;
    background: var(--border-subtle);
    margin: 0 0.15rem;
}

.editor-textarea {
    flex: 1;
    width: 100%;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    background: var(--bg-deep);
    color: var(--text-primary);
    border: none;
    outline: none;
    resize: none;
}

.editor-preview {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-base);
    border-top: 1px solid var(--border-subtle);
    gap: 0.75rem;
}

.editor-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.editor-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ─── PREVIEW SCENE CARDS ─── */

.preview-scene {
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.preview-scene-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.preview-scene-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.preview-scene-order {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    background: var(--bg-deep);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.preview-scene-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.preview-scene-meta span::before {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-right: 0.3rem;
}

.preview-scene-narration {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-secondary);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

.preview-scene-tts {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* ─── SCENE ACTIONS ─── */

.preview-scene-actions {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
}

.actions-header {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.action-time {
    color: var(--text-dim);
    font-size: 0.65rem;
    min-width: 40px;
    text-align: right;
}

.action-label {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 60px;
}

.action-type-navigate .action-label { color: var(--accent); }
.action-type-scroll .action-label { color: var(--yellow); }
.action-type-click .action-label { color: var(--green); }
.action-type-type .action-label { color: #a78bfa; }
.action-type-hover .action-label { color: var(--text-secondary); }

.action-target {
    color: var(--text-secondary);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tts-badge {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tts-badge.ready {
    color: var(--green);
    background: var(--green-glow);
}

.tts-badge.pending {
    color: var(--text-dim);
    background: var(--bg-deep);
}

.tts-duration {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.tts-play-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.7rem;
}

.tts-play-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

/* ─── SCRIPT LIBRARY CARDS ─── */

.script-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all var(--transition);
}

.script-card:hover {
    border-color: var(--border-medium);
    background: var(--bg-surface);
}

.script-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.script-card-title a {
    color: var(--text-primary);
}

.script-card-title a:hover {
    color: var(--accent);
}

.script-card-stats {
    display: flex;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.script-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
}

.script-card-date {
    font-size: 0.78rem;
    color: var(--text-dim);
}

/* ─── TIMELINE ─── */

.timeline {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}

.timeline-total {
    color: var(--text-secondary);
}

.timeline-bar {
    display: flex;
    height: 28px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    gap: 2px;
}

.timeline-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-medium);
    transition: all var(--transition);
    cursor: default;
    min-width: 20px;
}

.timeline-segment.has-tts {
    background: var(--accent-dim);
}

.timeline-segment:hover {
    filter: brightness(1.3);
}

.timeline-segment-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-primary);
    opacity: 0.8;
}

/* ─── MODAL ─── */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 8, 0.8);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 560px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--bg-raised);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(10px);
    transition: transform 200ms ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    font-size: 0.95rem;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

/* ─── TAGS ─── */

.tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    background: var(--accent-glow);
    border: 1px solid rgba(212, 160, 32, 0.15);
    color: var(--accent);
    text-decoration: none;
    line-height: 1.4;
    transition: all var(--transition);
}

.tag:hover {
    color: var(--text-primary);
    background: rgba(212, 160, 32, 0.2);
    border-color: rgba(212, 160, 32, 0.3);
}

.tag-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1;
    margin-left: 0.05rem;
    transition: color var(--transition);
}

.tag-remove:hover { color: var(--red); }

.tag-add {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px dashed rgba(212, 160, 32, 0.2);
    background: none;
    color: var(--text-dim);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    line-height: 1.4;
    transition: all var(--transition);
}

.tag-add:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
}

.tag-input {
    width: 6rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(212, 160, 32, 0.25);
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    outline: none;
    line-height: 1.4;
}

.tag-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ─── UTILITY ─── */

.text-dim { color: var(--text-dim); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* ─── INLINE FORM ROW ─── */

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

/* ─── ANIMATIONS ─── */

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fade-in 400ms ease-out both;
}

.animate-in:nth-child(1) { animation-delay: 0ms; }
.animate-in:nth-child(2) { animation-delay: 50ms; }
.animate-in:nth-child(3) { animation-delay: 100ms; }
.animate-in:nth-child(4) { animation-delay: 150ms; }
.animate-in:nth-child(5) { animation-delay: 200ms; }
.animate-in:nth-child(6) { animation-delay: 250ms; }
.animate-in:nth-child(7) { animation-delay: 300ms; }
.animate-in:nth-child(8) { animation-delay: 350ms; }

/* ─── FOOTER ─── */

.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    font-size: 0.72rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border-subtle);
}

.site-footer a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.15s;
}

.site-footer a:hover { color: var(--text-secondary); }

/* ─── LEGAL PAGES ─── */

.legal {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}

.legal h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.legal .legal-updated {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.legal h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.legal p, .legal li {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.legal ul {
    padding-left: 1.25rem;
    margin-bottom: 0.75rem;
}

.legal a {
    color: var(--accent);
    text-decoration: none;
}

.legal a:hover { text-decoration: underline; }

/* ─── SCROLLBAR ─── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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