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

:root {
    --bg: #0d0d0f;
    --bg-2: #16161a;
    --bg-3: #1e1e24;
    --text: #e8e8e8;
    --text-2: #888;
    --accent: #6ee7b7;
    --accent-dim: rgba(110, 231, 183, 0.15);
    --red: #f87171;
    --yellow: #fbbf24;
    --border: #2a2a30;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-2);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    width: 280px;
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 24px;
}

.modal-content input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    margin-bottom: 12px;
    text-align: center;
}

.modal-content input:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-content .error {
    color: var(--red);
    font-size: 13px;
    margin-top: 12px;
}

/* Help Modal */
.help-content {
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-2);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.close-btn:hover {
    background: var(--bg-3);
    color: var(--text);
}

.help-content h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    padding-right: 40px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
}

.help-section p {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
}

.help-tips {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-tips li {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    padding-left: 16px;
    position: relative;
    margin-bottom: 6px;
}

.help-tips li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    width: 100%;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

/* Notifications */
.notifications {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    animation: fadeUp 0.2s ease;
}

.notification.success { border-color: var(--accent); }
.notification.error { border-color: var(--red); }

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

/* App Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    gap: 20px;
}

.header-left, .header-right {
    flex: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

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

/* Model Tabs */
.model-tabs {
    display: flex;
    gap: 4px;
}

.model-tab {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.model-tab:hover {
    border-color: var(--text-2);
    color: var(--text);
}

.model-tab.active {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--text);
}

.model-tab .tab-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.model-tab .tab-desc {
    font-size: 10px;
    opacity: 0.6;
}

/* Live badge на модели */
.live-badge {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--accent);
    color: #000;
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.model-tab.no-live {
    opacity: 0.7;
}

.model-tab.no-live .tab-desc::after {
    content: ' •';
    color: var(--text-2);
}

.model-tab.has-live:hover .live-badge {
    background: #fff;
}

/* Record Button */
.record-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--red);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.record-btn:hover {
    background: rgba(248, 113, 113, 0.1);
}

.record-btn .record-icon {
    width: 18px;
    height: 18px;
    background: var(--red);
    border-radius: 50%;
    transition: all 0.15s;
}

.record-btn.recording {
    border-color: var(--accent);
    animation: pulse 1.5s infinite;
}

.record-btn.recording .record-icon {
    background: var(--accent);
    border-radius: 4px;
    width: 16px;
    height: 16px;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(110, 231, 183, 0); }
}

.record-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 220px;
}

.status {
    font-size: 13px;
    color: var(--text-2);
}

.status.recording { color: var(--accent); }
.status.processing { color: var(--yellow); }
.status.error { color: var(--red); }

.timer {
    font-size: 12px;
    font-family: monospace;
    color: var(--accent);
}

.processing-progress {
    margin-top: 6px;
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.processing-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    overflow: hidden;
}

.processing-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8ff5cb 0%, var(--accent) 100%);
    transition: width 0.2s linear;
}

.processing-progress-text {
    font-size: 11px;
    color: var(--text-2);
    font-family: monospace;
}

/* Live Toggle */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-2);
    user-select: none;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--bg-3);
    border-radius: 10px;
    position: relative;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--text-2);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
}

.toggle-label input:checked + .toggle-switch {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(16px);
    background: var(--accent);
}

.toggle-label.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toggle-label.live-active {
    animation: livePulse 1.5s infinite;
}

.toggle-label.live-active .toggle-text {
    color: var(--accent);
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Language Select */
.lang-select-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-label {
    font-size: 12px;
    color: var(--text-2);
}

.lang-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    min-width: 70px;
}

.lang-select:hover {
    border-color: var(--text-2);
}

.lang-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Help Button */
.help-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Visualizer */
.visualizer-wrap {
    height: 40px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
}

#visualizer {
    width: 100%;
    height: 100%;
    display: block;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Transcript Panel */
.transcript-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#transcript {
    flex: 1;
    width: 100%;
    padding: 20px;
    border: none;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.7;
    resize: none;
    font-family: inherit;
}

#transcript::placeholder {
    color: var(--text-2);
}

#transcript:focus {
    outline: none;
}

.transcript-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.tool-btn:hover {
    background: var(--bg-3);
    color: var(--text);
}

.char-count {
    font-size: 12px;
    color: var(--text-2);
    font-family: monospace;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.font-size-display {
    font-size: 11px;
    color: var(--text-2);
    font-family: monospace;
    min-width: 20px;
    text-align: center;
}

/* Recordings Panel */
.recordings-panel {
    width: 240px;
    background: var(--bg-2);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.2s;
}

.recordings-panel.collapsed {
    width: 48px;
}

.recordings-panel.collapsed .panel-content,
.recordings-panel.collapsed .badge {
    display: none;
}

.recordings-panel.collapsed .panel-header span:first-child {
    display: none;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.panel-header:hover {
    background: var(--bg-3);
}

.badge {
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
}

.chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.recordings-panel.collapsed .chevron {
    transform: rotate(-90deg);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.panel-footer {
    padding: 8px;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
}

.panel-upload-btn {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-3);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.panel-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#recordingsList {
    list-style: none;
}

#recordingsList:empty::after {
    content: 'No recordings';
    display: block;
    text-align: center;
    padding: 20px;
    color: var(--text-2);
    font-size: 13px;
}

#recordingsList li {
    padding: 10px 12px;
    background: var(--bg);
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

#recordingsList li:hover {
    border-color: var(--border);
}

#recordingsList li.playing {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.rec-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rec-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.rec-num {
    color: var(--text);
    font-weight: 500;
}

.rec-duration {
    font-size: 11px;
    font-family: monospace;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 5px;
    border-radius: 4px;
}

.rec-status {
    font-size: 11px;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rec-status.success { color: var(--accent); }
.rec-status.error { color: var(--red); }
.rec-status.pending { color: var(--yellow); }

.rec-player {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 6px;
    min-width: 0;
}

.rec-play-toggle {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-3);
    color: var(--text);
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rec-play-toggle:hover {
    border-color: var(--accent);
}

.rec-time {
    width: 32px;
    font-size: 10px;
    color: var(--text-2);
    font-family: monospace;
}

.rec-seek {
    flex: 1;
    min-width: 0;
    accent-color: var(--accent);
    height: 4px;
}

.rec-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

#recordingsList li:hover .rec-actions {
    opacity: 1;
}

.rec-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: var(--bg-3);
    color: var(--text-2);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-2);
}

.footer-left {
    display: flex;
    gap: 24px;
}

.footer-right {
    display: flex;
    align-items: center;
}

.footer span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* UI Language Select */
.ui-lang-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-2);
    font-size: 11px;
    cursor: pointer;
}

.ui-lang-select:hover {
    border-color: var(--text-2);
}

.ui-lang-select:focus {
    outline: none;
    border-color: var(--accent);
}

kbd {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 10px;
    border: 1px solid var(--border);
}

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

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

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

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

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-left, .header-right {
        order: 2;
        flex: auto;
    }

    .header-center {
        order: 1;
        width: 100%;
        justify-content: center;
    }

    .record-info {
        min-width: 170px;
    }

    .processing-progress {
        width: 170px;
    }

    .model-tabs {
        flex-wrap: wrap;
    }

    .recordings-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.2s;
    }

    .recordings-panel.open {
        transform: translateX(0);
    }

    .footer {
        display: none;
    }
}
