/* Verba — Ultra-modern UI */

/* =================== THEMES =================== */

/* Obsidian Glass — glassmorphism dark */
:root,
[data-theme="obsidian"] {
    --bg: #0c0c14;
    --bg-subtle: #12121c;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --surface-solid: #16162a;
    --text: #e4e4e7;
    --text-secondary: #71717a;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-gradient: linear-gradient(135deg, #6366f1, #a78bfa);
    --primary-glow: rgba(99, 102, 241, 0.25);
    --success: #34d399;
    --error: #f87171;
    --warning: #fbbf24;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --shadow-lg: rgba(0, 0, 0, 0.3);
    --input-bg: rgba(255, 255, 255, 0.04);
    --login-bg: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(167, 139, 250, 0.08) 0%, transparent 50%),
                #0c0c14;
    --page-bg: radial-gradient(1200px 700px at 10% -10%, rgba(99, 102, 241, 0.12), transparent 60%),
               radial-gradient(900px 600px at 100% 20%, rgba(167, 139, 250, 0.08), transparent 65%),
               #0c0c14;
    --modal-overlay: rgba(0, 0, 0, 0.6);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
}

/* Neon Noir — cyber dark */
[data-theme="neon"] {
    --bg: #09090b;
    --bg-subtle: #0f0f12;
    --surface: #18181b;
    --surface-hover: #202024;
    --surface-solid: #18181b;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --primary: #22d3ee;
    --primary-light: #67e8f9;
    --primary-gradient: linear-gradient(135deg, #22d3ee, #a78bfa);
    --primary-glow: rgba(34, 211, 238, 0.3);
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
    --border: #27272a;
    --border-hover: #3f3f46;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --input-bg: #111113;
    --login-bg: radial-gradient(ellipse at 50% 0%, rgba(34, 211, 238, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 100%, rgba(167, 139, 250, 0.04) 0%, transparent 50%),
                #09090b;
    --page-bg: radial-gradient(900px 520px at 15% 0%, rgba(34, 211, 238, 0.08), transparent 62%),
               radial-gradient(980px 620px at 85% 15%, rgba(167, 139, 250, 0.06), transparent 68%),
               #09090b;
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --scrollbar-thumb: #3f3f46;
}

/* Velvet Ember — warm luxury dark */
[data-theme="ember"] {
    --bg: #0a0a0a;
    --bg-subtle: #111111;
    --surface: #151515;
    --surface-hover: #1c1c1c;
    --surface-solid: #151515;
    --text: #e5e5e5;
    --text-secondary: #737373;
    --primary: #f59e0b;
    --primary-light: #fbbf24;
    --primary-gradient: linear-gradient(135deg, #f59e0b, #ef4444);
    --primary-glow: rgba(245, 158, 11, 0.2);
    --success: #34d399;
    --error: #f87171;
    --warning: #fbbf24;
    --border: #1f1f1f;
    --border-hover: #2e2e2e;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);
    --input-bg: #0f0f0f;
    --login-bg: radial-gradient(ellipse at 40% 30%, rgba(245, 158, 11, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 60% 70%, rgba(239, 68, 68, 0.04) 0%, transparent 50%),
                #0a0a0a;
    --page-bg: radial-gradient(980px 580px at 12% 0%, rgba(245, 158, 11, 0.07), transparent 60%),
               radial-gradient(1000px 640px at 88% 20%, rgba(239, 68, 68, 0.06), transparent 65%),
               #0a0a0a;
    --modal-overlay: rgba(0, 0, 0, 0.65);
    --scrollbar-thumb: #2e2e2e;
}

/* =================== RESET =================== */

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

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--page-bg);
    z-index: -1;
    pointer-events: none;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* =================== BUTTONS =================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-gradient);
    border-color: transparent;
    box-shadow: 0 0 32px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-danger {
    color: var(--error);
    border-color: rgba(248, 113, 113, 0.3);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--error);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-large {
    min-height: 56px;
    padding: 14px 22px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 14px;
}

.btn-ghost {
    border: none;
    background: none;
    font-size: 18px;
    padding: 4px 8px;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.btn-full {
    width: 100%;
    padding: 16px 18px;
    font-size: 17px;
    font-weight: 700;
    border-radius: calc(var(--radius) + 2px);
    letter-spacing: 0.01em;
}

/* =================== CONFIRM MODAL =================== */

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--modal-overlay);
    backdrop-filter: blur(2px);
}

.confirm-modal-dialog {
    position: relative;
    width: min(92vw, 520px);
    margin: 14vh auto 0;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
    box-shadow: 0 18px 48px var(--shadow-lg);
}

.confirm-modal-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
}

.confirm-modal-text {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 16px;
}

.confirm-modal-actions {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* =================== LOGIN PAGE =================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--login-bg);
    position: relative;
    overflow: hidden;
}

.login-container {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    width: 100%;
    max-width: 640px;
    position: relative;
    z-index: 1;
}

.login-logo {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    color: #fff;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 34px;
    font-size: 20px;
    line-height: 1.35;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    min-height: 58px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    font-size: 18px;
    outline: none;
    transition: all 0.2s ease;
    background: var(--input-bg);
    color: var(--text);
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.error-message {
    color: var(--error);
    font-size: 14px;
    text-align: center;
}

/* =================== HEADER =================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 0;
    box-shadow: 0 1px 8px var(--shadow-color);
}

.header-logo {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
}

.logo-name {
    color: inherit;
}

.logo-version {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: color-mix(in srgb, #fff 74%, var(--text-secondary) 26%);
    padding: 1px 5px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, #fff 16%, transparent);
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    box-shadow: none;
    transform: translateY(-8px);
    line-height: 1.1;
    opacity: 0.78;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: var(--text-secondary);
}

.header-user .btn-small {
    min-height: 42px;
    padding: 10px 14px;
    font-size: 14px;
}

/* Theme switcher */

.theme-switcher {
    display: flex;
    gap: 6px;
    align-items: center;
}

.theme-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    outline: none;
}

.theme-dot:hover {
    transform: scale(1.2);
}

.theme-dot.active {
    border-color: var(--text);
    transform: scale(1.15);
}

.theme-dot[data-theme="obsidian"] {
    background: linear-gradient(135deg, #6366f1, #a78bfa);
}

.theme-dot[data-theme="neon"] {
    background: linear-gradient(135deg, #22d3ee, #a78bfa);
}

.theme-dot[data-theme="ember"] {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

/* =================== MAIN =================== */

.main {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 16px;
}

/* =================== UPLOAD =================== */

.upload-section {
    margin-bottom: 40px;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--surface-hover);
    box-shadow: 0 0 24px var(--primary-glow);
}

.drop-zone-icon {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.drop-zone:hover .drop-zone-icon {
    transform: scale(1.1);
}

.drop-zone-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.drop-zone-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

.selected-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

#selectedFileName {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#clearFileBtn {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-hover) 86%, transparent);
    color: var(--text);
    font-size: 34px;
    font-weight: 500;
    line-height: 1;
    flex: 0 0 auto;
}

#clearFileBtn:hover {
    background: color-mix(in srgb, var(--surface-hover) 94%, var(--primary) 6%);
    color: #fff;
}

.upload-options {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.checkbox-label:hover {
    color: var(--text);
}

.select-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.select-group select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s;
}

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

/* =================== PROGRESS =================== */

.progress {
    margin-top: 16px;
    position: relative;
    height: 32px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    background-size: 200% 100%;
    transition: width 0.3s ease;
    border-radius: var(--radius-sm);
    animation: shimmer 2s infinite linear;
}

.progress-fill.error {
    background: var(--error);
    animation: none;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =================== TRANSCRIPTION LIST =================== */

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.transcriptions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.transcription-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s ease;
}

.item-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.transcription-item.clickable {
    cursor: pointer;
}

.transcription-item.clickable:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    box-shadow: 0 2px 12px var(--shadow-color);
}

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

.item-summary {
    color: var(--text-secondary);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-done {
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
}

.status-error {
    color: var(--error);
    font-size: 12px;
    font-weight: 600;
}

.status-processing {
    color: var(--warning);
    font-size: 12px;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 32px;
    font-size: 14px;
}

.list-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 120px;
    color: var(--text-secondary);
}

.list-loading-text {
    font-size: 14px;
    letter-spacing: 0.1px;
}

.loader-tri {
    width: fit-content;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    font-size: 30px;
    line-height: 1;
    color: var(--primary);
    background: linear-gradient(90deg, currentColor 50%, #0000 0) right/200% 100%;
    animation: loaderTriSpin 2s infinite linear;
    filter: drop-shadow(0 0 14px color-mix(in srgb, var(--primary) 45%, transparent));
}

.loader-tri::before {
    content: "Загрузка...";
    background: inherit;
    color: #0000;
    padding: 0 5px;
    background-image: linear-gradient(90deg, #fff 50%, currentColor 0);
    -webkit-background-clip: text;
    background-clip: text;
}

@keyframes loaderTriSpin {
    100% { background-position: left; }
}

.inline-loading {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text-secondary);
}

.inline-loading-text {
    font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .loader-tri,
    .loader-tri::before {
        animation-duration: 0.001ms;
        animation-iteration-count: 1;
    }
}

/* Processing state */

.transcription-item.processing {
    border-left: 3px solid var(--warning);
    animation: processingGlow 2.5s ease-in-out infinite;
}

@keyframes processingGlow {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 12px rgba(251, 191, 36, 0.12); }
}

.pulse-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--warning);
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
    animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.75); }
}

.elapsed-timer {
    font-size: 11px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    margin-left: 3px;
}

/* User stats */

.user-stats {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    white-space: nowrap;
    opacity: 0.9;
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =================== MODAL =================== */

.modal {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}

.modal-content {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px var(--shadow-lg);
    animation: modalSlideIn 0.2s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 10px;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-meta {
    display: flex;
    gap: 16px;
    padding: 0 24px 14px;
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px 14px;
}

.tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    min-height: 36px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.tab.active {
    background: var(--primary-gradient);
    color: #fff;
    border-color: transparent;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 20px;
    min-height: 200px;
}

.result-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
}

.timestamp-segment {
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.6;
}

.timestamp {
    display: inline-block;
    background: var(--primary-glow);
    color: var(--primary-light);
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
}

.timestamp-segment strong {
    color: var(--primary-light);
    margin-right: 4px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* =================== ANIMATIONS =================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* =================== THEME OVERRIDES =================== */

/* Obsidian: glassmorphism */
[data-theme="obsidian"] .transcription-item,
[data-theme="obsidian"] .selected-file,
[data-theme="obsidian"] .modal-content {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

[data-theme="obsidian"] .header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

[data-theme="obsidian"] .drop-zone {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

[data-theme="obsidian"] .login-container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* Neon: glow on focus/hover */
[data-theme="neon"] .form-group input:focus {
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15), 0 0 16px rgba(34, 211, 238, 0.1);
}

[data-theme="neon"] .btn-primary {
    box-shadow: 0 0 24px rgba(34, 211, 238, 0.3);
}

[data-theme="neon"] .btn-primary:hover:not(:disabled) {
    box-shadow: 0 0 36px rgba(34, 211, 238, 0.4);
}

/* Ember: gradient borders */
[data-theme="ember"] .modal-content {
    border: 1px solid transparent;
    background:
        linear-gradient(#151515, #151515) padding-box,
        linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(239, 68, 68, 0.15)) border-box;
}

/* =================== RESPONSIVE =================== */

@media (max-width: 480px) {
    .header {
        min-height: 66px;
        padding: 12px 16px;
    }

    .main {
        padding: 20px 12px;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .upload-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-actions {
        flex-wrap: wrap;
    }

    .theme-switcher {
        gap: 4px;
    }

    .theme-dot {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 640px) {
    .header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 10px;
        min-height: 64px;
        padding: 10px 12px;
    }

    .header-logo {
        font-size: 20px;
        justify-self: start;
    }

    .header-logo .logo-version {
        font-size: 7px;
        letter-spacing: 0.04em;
        padding: 1px 4px;
        transform: translateY(-5px);
    }

    .header-right {
        display: contents;
    }

    .header-user {
        display: contents;
    }

    #userStats {
        grid-column: 2;
        justify-self: center;
        text-align: center;
        max-width: 100%;
        font-size: 12px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 6px;
    }

    #userName {
        display: none;
    }

    #logoutBtn {
        grid-column: 3;
        justify-self: end;
        min-height: 38px;
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* =================== V2 WORKSPACE (Fitts + Compact) =================== */

.main-v2 {
    max-width: 1160px;
    padding-top: 24px;
}

.workspace-card {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
}

.upload-card,
.result-card {
    padding: 20px;
    min-width: 0;
}

.upload-card {
    border-right: 0;
}

.section-hint {
    margin-top: -8px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.subsection-title {
    font-size: 16px;
    font-weight: 600;
    margin: 2px 0 12px;
}

.drop-zone {
    min-height: 200px;
    padding: 34px 24px;
}

.drop-zone-icon {
    font-size: 42px;
    margin-bottom: 12px;
}

.drop-zone-text {
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.drop-zone-hint {
    font-size: 14px;
}

.btn,
.select-group select,
.speaker-toggle,
.transcription-item,
.selected-file {
    min-height: 48px;
}

.btn-full {
    min-height: 56px;
}

.compact-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: stretch;
    margin-top: 14px;
    margin-bottom: 12px;
}

.compact-select {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    justify-content: flex-end;
}

.compact-select > label {
    font-size: 12px;
    line-height: 1.2;
    color: var(--text-secondary);
    min-height: 14px;
}

.compact-select select {
    min-height: 48px;
    height: 48px;
    padding: 10px 40px 10px 14px;
    background: var(--input-bg);
    color: var(--text);
    border-color: var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
        linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 1px),
        calc(100% - 12px) calc(50% - 1px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.speaker-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    min-height: 48px;
    height: 48px;
    padding: 10px 12px 10px 14px;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

.speaker-toggle span {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.speaker-toggle:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
}

.speaker-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--primary);
}

.inline-details-bar {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-solid);
    padding: 10px 12px;
    margin-bottom: 10px;
    position: relative;
}

.inline-details-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
}

.inline-title-meta {
    display: flex;
    align-items: baseline;
    gap: 14px;
    min-width: 0;
}

.inline-title {
    font-size: 14px;
    font-weight: 600;
    min-width: 0;
    white-space: nowrap;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inline-details-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
    justify-content: flex-start;
    max-width: 100%;
}

.inline-details-actions .btn-small {
    min-height: 56px;
    padding: 10px 18px;
    font-size: 15px;
    border-radius: 12px;
}

#inlineCollapseBtn {
    width: 186px;
    white-space: nowrap;
}

#inlineCollapseBtn.is-expand-action {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    box-shadow: 0 0 16px var(--primary-glow);
}

#inlineCollapseBtn:not(.is-expand-action):hover {
    background: var(--primary-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 16px var(--primary-glow);
}

#inlineCopyBtn {
    position: relative;
    overflow: hidden;
}

#inlineCopyBtn:focus,
#inlineCopyBtn:focus-visible {
    outline: none;
    border-color: var(--border);
    box-shadow: none;
}

#inlineCopyBtn.copy-success {
    border-color: var(--border);
    box-shadow: none;
    background: color-mix(in srgb, var(--surface-hover) 72%, white 28%);
    filter: brightness(1.16);
}

.copy-firework-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
    overflow: visible;
}

.copy-spark {
    position: absolute;
    left: var(--x, 0px);
    top: var(--y, 0px);
    width: var(--size, 5px);
    height: var(--size, 5px);
    margin-left: calc(var(--size, 5px) * -0.5);
    margin-top: calc(var(--size, 5px) * -0.5);
    pointer-events: none;
    z-index: 4;
    border-radius: 999px;
    background: hsl(var(--hue, 268), 96%, 72%);
    box-shadow: 0 0 9px hsla(var(--hue, 268), 96%, 72%, 0.9);
    animation: copy-spark var(--dur, 560ms) ease-out var(--delay, 0ms) forwards;
}

@keyframes copy-spark {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.5);
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(0.7);
    }
}

.inline-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inline-details-subrow {
    display: block;
    margin-top: 10px;
}

.inline-tabs {
    display: flex;
    gap: 6px;
    margin-top: 0;
    flex-wrap: nowrap;
    max-width: none;
    justify-self: end;
}

.inline-preview {
    min-height: 170px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-solid);
    padding: 14px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text);
    margin-bottom: 16px;
}

.inline-preview.mode-timestamps {
    white-space: normal;
}

.inline-preview.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
}

.inline-preview.collapsed {
    display: none;
}

.inline-preview.mode-timestamps .timestamp-segment {
    margin-bottom: 8px;
    line-height: 1.45;
}

.inline-preview.mode-timestamps .timestamp-segment:last-child {
    margin-bottom: 0;
}

.inline-preview.mode-timestamps .timestamp-segment strong {
    margin-right: 6px;
}

@media (max-width: 980px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .upload-card {
        border-right: 0;
        border-bottom: 0;
    }

    .compact-row {
        grid-template-columns: 1fr;
    }

    .btn-full {
        position: sticky;
        bottom: 10px;
        z-index: 2;
    }

    .drop-zone-text {
        font-size: 18px;
    }

    .drop-zone-hint {
        font-size: 13px;
    }

    .inline-details-actions {
        justify-content: flex-start;
    }

    .inline-details-head {
        grid-template-columns: 1fr;
    }

    .inline-title-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .inline-details-subrow {
        margin-top: 8px;
    }
}
