@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #f4f4f5;
    --primary-dark: #d7d7da;
    --secondary: #212126;
    --success: #1faa59;
    --danger: #ff3b30;
    --accent: #ff4f46;
    --accent-glow: rgba(255, 79, 70, 0.15);
    --bg-dark: #09090b;
    --bg-card: #111114;
    --bg-input: #141419;
    --bg-elevated: #17171d;
    --text: #f5f5f7;
    --text-muted: #a7a7b0;
    --border-radius: 16px;
}

body {
    font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
    background:
        radial-gradient(1400px 600px at 20% -20%, rgba(255, 255, 255, 0.06), transparent 60%),
        radial-gradient(900px 600px at 100% 0%, rgba(255, 59, 48, 0.08), transparent 45%),
        var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior: none;
}

.hidden {
    display: none !important;
}

.startup-splash {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    background: rgba(9, 9, 11, 0.96);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.startup-splash.show {
    opacity: 1;
    transform: scale(1);
}

.startup-splash.hide {
    opacity: 0;
    transform: scale(1.04);
}

.startup-splash-card {
    width: min(86vw, 360px);
    border-radius: 24px;
    padding: 28px 24px;
    background: linear-gradient(160deg, #16161b, #0f0f12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    text-align: center;
}

.startup-logo {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.8rem;
    background: radial-gradient(circle, #ff584f 30%, #c11d1d 100%);
    box-shadow: 0 0 0 8px rgba(255, 59, 48, 0.12);
}

.startup-splash-card h2 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 0.14em;
    font-size: 1rem;
    margin-bottom: 8px;
}

.startup-splash-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.startup-pills {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.startup-pills span {
    font-size: 0.75rem;
    color: #f2f2f2;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 4px 10px;
    border-radius: 999px;
}

.login-gate {
    position: fixed;
    inset: 0;
    z-index: 1900;
    background: rgba(8, 8, 10, 0.82);
    backdrop-filter: blur(5px);
    display: grid;
    place-items: center;
    padding: 18px;
    animation: fadeIn 0.3s ease-out;
}

.login-gate-card {
    width: min(92vw, 420px);
    background: linear-gradient(180deg, #17171d, #121218);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.32);
    animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-gate-card h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.08rem;
    margin-bottom: 6px;
}

.login-gate-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.login-gate-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.auth-feedback-info {
    color: #9ea6b7;
}

.auth-feedback-success {
    color: #7ad79b;
}

.auth-feedback-error {
    color: #ff8d88;
}

.translate-sheet {
    position: fixed;
    inset: 0;
    z-index: 1880;
    background: rgba(7, 7, 9, 0.78);
    backdrop-filter: blur(5px);
    display: grid;
    place-items: end center;
    padding: 12px;
    animation: fadeIn 0.25s ease-out;
}

.translate-sheet-card {
    width: min(96vw, 560px);
    border-radius: 16px;
    background: linear-gradient(180deg, #18181f, #121218);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
    padding: 14px;
    animation: sheetSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.translate-sheet-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    margin-bottom: 8px;
}

.translate-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.translate-grid.single {
    grid-template-columns: 1fr;
}

.translate-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.translate-actions .btn {
    flex: 1;
    min-width: 120px;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    position: relative;
}

header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.34rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.header-mark {
    display: inline-block;
    color: var(--accent);
    margin-right: 4px;
    text-shadow: 0 0 16px rgba(255, 79, 70, 0.45);
    animation: headerMarkPulse 3s ease-in-out infinite;
}

@keyframes headerMarkPulse {
    0%, 100% { text-shadow: 0 0 16px rgba(255, 79, 70, 0.45); }
    50% { text-shadow: 0 0 22px rgba(255, 79, 70, 0.7), 0 0 6px rgba(255, 79, 70, 0.3); }
}

.menu-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: #17171d;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    cursor: pointer;
}

.menu-btn span {
    display: block;
    height: 3px;
    border-radius: 999px;
    background: #f2f2f6;
}

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(6, 6, 8, 0.72);
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.menu-drawer {
    width: min(86vw, 340px);
    height: 100%;
    background: linear-gradient(180deg, #17171d, #121218);
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: drawerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-drawer-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-sheet {
    position: fixed;
    inset: 12px;
    z-index: 1450;
    overflow: auto;
    max-width: 700px;
    margin: 0 auto;
    max-height: calc(100dvh - 24px);
}

.panel-sheet.hidden {
    display: none;
}

.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-block {
    background: linear-gradient(180deg, #141419, #101015);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 2px solid rgba(255, 79, 70, 0.3);
    border-radius: 14px;
    padding: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-block h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #f0f0f4;
}

.settings-block .danger-zone {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.panel-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.panel-actions .btn {
    flex: 1;
}

.info-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.info-stack p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    margin-top: 6px;
}

.info-changelog-list {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.45;
    display: grid;
    gap: 6px;
}

.budget-table {
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.budget-row {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr 1fr;
    gap: 8px;
    padding: 8px 10px;
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease;
}

.budget-row:first-child {
    border-top: none;
}

.budget-row [role="cell"]:first-child {
    font-size: 0.85rem;
    font-weight: 600;
}

.budget-row:nth-child(3) {
    background: rgba(255, 79, 70, 0.06);
    border-left: 2px solid var(--accent);
}

.budget-head {
    background: rgba(255, 255, 255, 0.06);
    color: #f3f3f7;
    font-weight: 600;
}

#info-budget-footnote {
    font-size: 0.78rem;
    opacity: 0.9;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100%;
    animation: contentFadeIn 0.5s ease-out;
}

.hero-card {
    order: 1;
    background: linear-gradient(165deg, #15151a, #111116);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    padding: 10px 14px;
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.22);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--border-radius);
    padding: 1px;
    background: linear-gradient(160deg, rgba(255, 79, 70, 0.3), rgba(255, 255, 255, 0.12) 40%, rgba(255, 79, 70, 0.15));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.workflow-hints {
    order: 2;
    background: linear-gradient(180deg, #131318, #101015);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 8px 12px;
}

.workflow-hints h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.workflow-hints p {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.3;
}

.workflow-version {
    margin-top: 2px;
    font-size: 0.72rem;
    color: rgba(238, 238, 244, 0.58);
    letter-spacing: 0.02em;
}

.hint-pills {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.hint-pills span {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #f2f2f6;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-card p {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.3;
}

.hero-card h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.hero-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.hero-tags span {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: #ebebef;
}

/* Panels */
.panel {
    background: linear-gradient(180deg, #15151a, #111114);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--border-radius);
    padding: 24px;
}

.panel.hidden {
    display: none;
}

.panel h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: #8f8f98;
    font-size: 0.8rem;
}

.settings-note {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.settings-note small {
    color: #aaa;
}

.settings-note strong {
    color: #f2f2f5;
}

.auth-plan-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(88, 180, 255, 0.18);
    border: 1px solid rgba(88, 180, 255, 0.42);
    color: #dceefe;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-actions {
    display: flex;
    gap: 8px;
}

.auth-actions .btn {
    flex: 1;
}

.danger-zone {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #333;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.danger-btn {
    margin-top: 10px;
}

.backup-zone {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.backup-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hidden-file-input {
    display: none;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 11px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: #101013;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn:active:not(:disabled) {
    transform: scale(0.96);
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--secondary);
    color: #f4f4f7;
}

.btn-icon {
    background: #17171d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* ── Mode Switch (Normal / Live) ── */
.mode-switch-container {
    order: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: -4px;
}

.mode-switch-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    transition: color 0.2s, font-weight 0.2s;
    cursor: pointer;
    user-select: none;
}

.mode-switch-label.active {
    color: var(--text);
    font-weight: 600;
}

.mode-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 21px;
    cursor: pointer;
}

.mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-switch-slider {
    position: absolute;
    inset: 0;
    background: #2a2a32;
    border-radius: 999px;
    transition: background 0.25s;
}

.mode-switch-slider::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    left: 3px;
    bottom: 3px;
    background: #f2f2f6;
    border-radius: 50%;
    transition: transform 0.25s;
}

.mode-switch input:checked + .mode-switch-slider {
    background: var(--accent, #ff4f46);
}

.mode-switch input:checked + .mode-switch-slider::before {
    transform: translateX(19px);
}

/* ── Live Transcription Display ── */
.live-transcribe-container {
    background: linear-gradient(180deg, #131318, #101015);
    border: 1px solid rgba(255, 79, 70, 0.2);
    border-radius: var(--border-radius);
    padding: 16px;
    animation: fadeIn 0.3s ease-out;
}

.live-transcribe-container.hidden {
    display: none;
}

.live-transcribe-display {
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.live-transcribe-final {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.live-transcribe-interim {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-muted);
    opacity: 0.65;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-style: italic;
}

.live-transcribe-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Record Button */
.record-container {
    order: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}

.record-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(circle at 25% 20%, #23232b, #17171d 68%);
    color: #f2f2f6;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    animation: idleBreathing 3.5s ease-in-out infinite;
}

.record-btn:hover {
    transform: scale(1.05);
    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.55),
        0 0 0 6px rgba(255, 79, 70, 0.1),
        0 0 0 12px rgba(255, 79, 70, 0.05);
    animation: none;
}

.record-btn.recording {
    background: radial-gradient(circle at 30% 20%, #ff5a52, #d12522 70%);
    box-shadow:
        0 0 0 0 rgba(255, 59, 48, 0.4),
        0 16px 30px rgba(209, 37, 34, 0.35);
    color: #fff;
    animation: recordingPulse 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.record-btn .icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d8d8de;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.06), 0 0 8px rgba(255, 79, 70, 0.15);
    transition: box-shadow 0.3s ease;
}

.record-btn:not(.recording) .icon {
    animation: iconIdleGlow 3.5s ease-in-out infinite;
}

.record-btn.recording .icon {
    background: #fff;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.15), 0 0 12px rgba(255, 255, 255, 0.3);
    animation: none;
}

.record-btn .text {
    font-size: 0.75rem;
    font-weight: 500;
}

@keyframes idleBreathing {
    0%, 100% {
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(255, 79, 70, 0);
    }
    50% {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 5px rgba(255, 79, 70, 0.08);
    }
}

@keyframes iconIdleGlow {
    0%, 100% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.06), 0 0 6px rgba(255, 79, 70, 0.1); }
    50% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.06), 0 0 12px rgba(255, 79, 70, 0.25); }
}

@keyframes recordingPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 0 0 0 rgba(255, 59, 48, 0.35),
            0 16px 30px rgba(209, 37, 34, 0.35);
    }
    50% {
        transform: scale(1.06);
        box-shadow:
            0 0 0 14px rgba(255, 59, 48, 0),
            0 18px 36px rgba(209, 37, 34, 0.4);
    }
}

@keyframes pulse-red {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 0 0 0 rgba(255, 59, 48, 0.35),
            0 16px 30px rgba(209, 37, 34, 0.35);
    }
    50% {
        transform: scale(1.08);
        box-shadow:
            0 0 0 12px rgba(255, 59, 48, 0),
            0 16px 36px rgba(209, 37, 34, 0.4);
    }
}

@keyframes wobble {
    0%, 100% { transform: rotate(0deg) scale(1.02); }
    25% { transform: rotate(-1deg) scale(1.04); }
    75% { transform: rotate(1deg) scale(1.04); }
}

/* Timer */
.timer {
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    color: var(--danger);
}

.timer.hidden {
    display: none;
}

/* Status */
.status {
    order: 6;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 24px;
}

/* Progress */
.progress-container {
    order: 7;
    background: linear-gradient(180deg, #141419, #121217);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 16px;
}

.progress-container.hidden {
    display: none;
}

.progress-bar {
    height: 4px;
    background: #2a2a30;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar::after {
    content: '';
    display: block;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, #f6f6f8, #d8d8dc);
    animation: progress 1.5s ease-in-out infinite;
}

@keyframes progress {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    display: block;
}

.progress-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.failed-audio-panel {
    order: 8;
    background: rgba(255, 143, 107, 0.12);
    border: 1px solid rgba(255, 128, 89, 0.45);
    border-radius: var(--border-radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.failed-audio-panel.hidden {
    display: none;
}

.failed-audio-info {
    font-size: 0.84rem;
    color: #ffd4c5;
    line-height: 1.4;
}

.failed-audio-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Result */
.result-container {
    order: 9;
    background: linear-gradient(180deg, #141419, #111115);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3), 0 8px 16px rgba(0, 0, 0, 0.2);
}

.result-container.hidden {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.result-container h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.result-text {
    width: 100%;
    min-height: 50vh;
    max-height: 80vh;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
}

.result-text:focus {
    outline: none;
    border-color: var(--primary);
}

.result-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.result-variants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.result-variants.hidden {
    display: none;
}

.variant-chip {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.78rem;
    cursor: pointer;
}

.variant-chip.active {
    color: #111114;
    border-color: #f3f3f6;
    background: #f3f3f6;
}

.result-chip {
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.mode-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.mode-btn {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.35s ease, color 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
}

.mode-btn:hover {
    border-color: rgba(255, 255, 255, 0.32);
    color: var(--text);
}

.mode-btn:active {
    transform: scale(0.96);
}

.mode-btn.active {
    background: #f3f3f6;
    border-color: #f3f3f6;
    color: #111114;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.tier-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.tier-option {
    cursor: pointer;
    display: block;
}
.tier-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.tier-card {
    background: rgba(20, 22, 28, 0.5);
    border: 1px solid rgba(80, 90, 110, 0.3);
    border-left: 3px solid rgba(120, 140, 200, 0.4);
    border-radius: 6px;
    padding: 10px 8px;
    transition: border-color 0.15s, background 0.15s;
}
.tier-option input[type="radio"]:checked + .tier-card {
    border-left-color: rgba(80, 200, 120, 0.9);
    background: rgba(40, 70, 50, 0.45);
}
.tier-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}
.tier-price {
    font-size: 0.85rem;
    color: rgba(180, 200, 220, 0.85);
    margin-bottom: 4px;
}
.tier-desc {
    font-size: 0.8rem;
    color: #8f8f98;
    line-height: 1.4;
}

details.advanced-models {
    margin-top: 10px;
    padding: 8px;
    background: rgba(15, 17, 22, 0.45);
    border-radius: 4px;
}
details.advanced-models summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: rgba(160, 175, 190, 0.85);
    padding: 4px;
}
details.advanced-models summary:hover {
    color: rgba(200, 215, 230, 0.95);
}

/* Modell-Übersicht — uses the app's design tokens (settings-block gradient,
   Space Grotesk for headings, IBM Plex Sans body, red left-accent for default,
   green left-accent for the user's current plan). */
.models-tier-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 28px 0 6px;
}
@media (max-width: 600px) {
    .models-tier-summary { grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }
}
.tier-card-mini {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 16px 16px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, background 0.15s;
}
.tier-card-mini.is-current {
    background: rgba(80, 200, 120, 0.05);
    border-color: rgba(80, 200, 120, 0.45);
    box-shadow: 0 0 0 1px rgba(80, 200, 120, 0.18) inset;
}
.tier-card-mini-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.tier-card-mini-desc {
    margin: 0 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    color: #8f8f98;
    line-height: 1.45;
}
.tier-card-mini-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    color: #f0f0f4;
    letter-spacing: 0.01em;
}
.tier-card-mini-price {
    font-size: 0.85rem;
    color: rgba(180, 200, 220, 0.85);
    white-space: nowrap;
}
.tier-card-mini-quota {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
    font-size: 0.88rem;
    line-height: 1.4;
}
.tier-card-mini-quota li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}
.tier-card-mini-quota-label {
    font-size: 0.72rem;
    color: #8f8f98;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.tier-card-mini-quota-value {
    color: #f0f0f4;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
}
.tier-card-mini-quota-sub {
    font-size: 0.7rem;
    color: rgba(180, 200, 220, 0.7);
    font-weight: 500;
    margin-top: 1px;
}
/* How-it-works list (Info-Panel "So funktioniert's") */
.how-it-works-list {
    list-style: none;
    margin: 14px 0 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.how-it-works-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
.how-it-works-list li > div {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.how-it-works-list strong {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    color: #f0f0f4;
    font-weight: 600;
}
.how-it-works-list span {
    font-size: 0.85rem;
    color: #8f8f98;
    line-height: 1.45;
}
.how-it-works-step {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 79, 70, 0.18);
    color: rgba(255, 130, 120, 0.95);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.how-it-works-cta {
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
}

.tier-card-mini-fallback {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.78rem;
    color: #8f8f98;
    line-height: 1.4;
    font-style: italic;
}

/* Boot-Diagnose — eingeklappter Bereich unten im Info-Panel */
.boot-diag-details {
    padding: 0;
}
.boot-diag-details summary {
    cursor: pointer;
    font-size: 0.88rem;
    color: rgba(200, 215, 230, 0.85);
    padding: 6px 0;
    user-select: none;
    list-style: none;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
}
.boot-diag-details summary::before {
    content: '▸ ';
    display: inline-block;
    transition: transform 0.15s;
    margin-right: 4px;
}
.boot-diag-details[open] summary::before {
    transform: rotate(90deg);
}
.boot-diag-details summary::-webkit-details-marker { display: none; }
.boot-diag-actions {
    display: flex;
    gap: 8px;
    margin: 10px 0 8px;
    flex-wrap: wrap;
}
.boot-diag-output {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    font-family: 'SF Mono', Consolas, 'Courier New', monospace;
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgba(200, 215, 230, 0.9);
    max-height: 50vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    resize: vertical;
}

/* Stale-Client-Banner — fest oben am Bildschirm wenn Frontend zu alt für Backend */
.stale-client-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10000;
    background: linear-gradient(180deg, #c44, #a33);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
    font-size: 0.88rem;
}
.stale-client-banner-text {
    flex: 1;
    line-height: 1.4;
}
.stale-client-banner .btn {
    flex-shrink: 0;
    background: #fff;
    color: #c44;
    font-weight: 600;
}

/* Live-Modus: aktive Modelle (ASR / Translate / TTS) während einer V2-Session */
.live-active-models {
    margin-top: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.live-active-models.hidden { display: none; }
.live-active-model-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 0.85rem;
}
.live-active-model-label {
    color: #8f8f98;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
}
.live-active-model-value {
    color: #f0f0f4;
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.82rem;
    text-align: right;
    word-break: break-word;
    max-width: 70%;
}
.tier-card-mini-quota-accuracy {
    background: rgba(120, 165, 230, 0.06) !important;
    border-color: rgba(120, 165, 230, 0.18) !important;
}
.tier-card-mini-quota-na {
    color: rgba(160, 160, 170, 0.7) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
}

.models-lang-details {
    margin-top: 18px;
    padding: 0;
    background: transparent;
    border: none;
}
.models-lang-details summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: #8f8f98;
    padding: 6px 8px;
    list-style: none;
    user-select: none;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.models-lang-details summary:hover {
    color: rgba(220, 230, 245, 0.95);
    background: rgba(255, 255, 255, 0.03);
}
.models-lang-details summary::before {
    content: '▸ ';
    display: inline-block;
    transition: transform 0.15s;
    margin-right: 4px;
}
.models-lang-details[open] summary::before {
    transform: rotate(90deg);
}
.models-lang-details summary::-webkit-details-marker { display: none; }
.models-lang-details > .models-table-wrap {
    margin-top: 10px;
}

/* Sprach-Tabelle */
.models-table-wrap {
    margin-top: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    background: rgba(15, 17, 22, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.models-lang-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.models-lang-table th,
.models-lang-table td {
    padding: 10px 12px;
    text-align: center;
    vertical-align: middle;
}
.models-lang-table thead th {
    background: rgba(20, 22, 28, 0.6);
    color: rgba(200, 215, 230, 0.95);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.models-lang-table tbody tr + tr td {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.models-lang-table th:first-child,
.models-lang-table td.lang-name-cell {
    text-align: left;
}
.models-lang-table td.lang-name-cell {
    color: #f0f0f4;
    font-weight: 500;
}
.models-lang-table .wer-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(80, 200, 120, 0.16);
    color: rgba(170, 240, 195, 0.95);
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 56px;
    font-variant-numeric: tabular-nums;
}
.models-lang-table .wer-pill.warn { background: rgba(220, 180, 60, 0.16); color: rgba(245, 220, 140, 0.95); }
.models-lang-table .wer-pill.crit { background: rgba(220, 90, 60, 0.16); color: rgba(245, 185, 165, 0.95); }
.models-lang-table .wer-pill.unavailable {
    background: transparent;
    color: rgba(140, 140, 150, 0.6);
    font-weight: 400;
    min-width: 0;
}

/* Verbrauch */
.usage-summary {
    font-size: 0.92rem;
    color: rgba(200, 215, 230, 0.9);
}
.usage-summary-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    color: rgba(180, 200, 220, 0.75);
    font-size: 0.82rem;
}
.usage-summary-head strong {
    color: #f0f0f4;
}
.usage-summary-total {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    color: #f0f0f4;
    margin: 10px 0 14px;
    letter-spacing: 0.01em;
}
.usage-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.usage-feature-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.usage-feature-list li:last-child { border-bottom: none; }
.usage-feature-list li > span:first-child {
    color: rgba(200, 215, 230, 0.85);
}
.usage-feature-list li > span:last-child {
    color: #f0f0f4;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.live-v2-quota {
    margin: 8px 0;
    padding: 8px 10px;
    background: rgba(20, 22, 28, 0.5);
    border-left: 2px solid rgba(120, 180, 220, 0.5);
    border-radius: 4px;
}
.live-v2-quota-bar {
    margin-top: 6px;
    height: 6px;
    background: rgba(40, 45, 55, 0.7);
    border-radius: 3px;
    overflow: hidden;
}
.live-v2-quota-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(80, 200, 120, 0.85), rgba(220, 180, 60, 0.85));
    transition: width 0.3s ease;
}
.live-v2-quota-fill.warn { background: linear-gradient(90deg, rgba(220, 180, 60, 0.85), rgba(220, 90, 60, 0.85)); }
.live-v2-quota-fill.crit { background: rgba(220, 90, 60, 0.9); }

.diag-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.diag-output {
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.4;
    color: rgba(200, 210, 220, 0.85);
    background: rgba(15, 17, 22, 0.85);
    border: 1px solid rgba(80, 90, 110, 0.4);
    border-radius: 6px;
    padding: 10px;
    margin: 0 0 8px;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    user-select: text;
    word-break: break-word;
}

.result-model-badge {
    font-size: 0.72rem;
    color: rgba(160, 165, 175, 0.85);
    font-family: 'SF Mono', Consolas, monospace;
    margin: 4px 2px 8px;
    padding: 4px 8px;
    background: rgba(20, 22, 28, 0.45);
    border-radius: 4px;
    border-left: 2px solid rgba(120, 140, 200, 0.4);
    user-select: text;
    word-break: break-all;
}
.result-model-badge.paid {
    border-left-color: rgba(220, 160, 60, 0.7);
    color: rgba(220, 200, 160, 0.9);
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.result-actions .btn {
    flex: 1 1 calc(50% - 8px);
}

.result-actions-compact {
    gap: 6px;
    margin-top: 12px;
}

.result-actions-compact .btn {
    flex: 1 1 calc(33% - 6px);
    padding: 10px 8px;
    font-size: 0.8rem;
}

/* Footer */
footer {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #f2f2f5;
    color: #0f0f12;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
    border-left: 3px solid var(--accent);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive */
@media (max-width: 400px) {
    header h1 {
        font-size: 1.25rem;
    }
    
    .record-btn {
        width: 100px;
        height: 100px;
    }
    
    .record-btn .icon {
        font-size: 2rem;
    }
    
    .result-actions {
        flex-direction: column;
    }
}

/* History */
.history-container {
    order: 10;
    background: linear-gradient(180deg, #141419, #111115);
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.history-container.history-focus-pulse {
    animation: historyFocusPulse 0.46s ease;
}

@keyframes historyFocusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    45% {
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16), 0 18px 30px rgba(0, 0, 0, 0.22);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.history-toggle {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.history-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-count {
    background: #f2f2f6;
    color: #0e0e11;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
}

.history-arrow {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.history-panel {
    min-height: 52vh;
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.history-panel.hidden {
    display: none;
}

.history-list {
    padding: 8px;
}

.history-search-wrap {
    padding: 10px 12px 0;
}

#history-search {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-input);
    color: var(--text);
}

#history-search:focus {
    outline: none;
    border-color: var(--primary);
}

.history-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.history-actions.hidden {
    display: none;
}

.history-backup-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px 0;
}

.history-selection-info {
    margin-right: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.history-item {
    padding: 12px;
    background: var(--bg-input);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.2s, background 0.2s, transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
    .history-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        border-color: rgba(255, 255, 255, 0.14);
    }
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-item-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-item-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.history-tag {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: #e8e8ec;
    font-size: 0.75rem;
}

.history-item-copy {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #f0f0f4;
    opacity: 0.9;
    transition: opacity 0.2s, background 0.2s;
    padding: 4px 8px;
}

.history-item-copy:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 640px) {
    .history-panel {
        min-height: 56vh;
        max-height: calc(100dvh - 135px);
    }

    .translate-grid {
        grid-template-columns: 1fr;
    }
}

.history-item-preview {
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    line-height: 1.4;
}

.history-item-preview:hover {
    color: #ffffff;
}

.history-item.selection-mode {
    cursor: pointer;
}

.history-item.selection-mode .history-item-preview:hover {
    color: var(--text);
}

.history-item.selected {
    border-color: var(--danger);
    background: rgba(220, 53, 69, 0.18);
}

.history-item-full {
    font-size: 0.9rem;
    color: var(--text);
    white-space: pre-wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.5;
}

.history-item-full.hidden {
    display: none;
}

.btn-danger {
    background: rgba(255, 59, 48, 0.15) !important;
    color: #ff6b63;
    border-color: rgba(255, 59, 48, 0.25);
}

.btn-danger:active {
    background: rgba(255, 59, 48, 0.3) !important;
}

/* ── Success button (Free continue) ── */
.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    font-weight: 600;
}

.btn-success:hover {
    background: #17964e;
    border-color: #17964e;
}

.btn-success:active {
    transform: scale(0.98);
}

.btn-free-continue {
    font-size: 1.05rem;
    padding: 14px 24px;
}

.login-gate-free-subtitle {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: -2px;
    margin-bottom: 6px;
}

/* ── Upload button ── */
.record-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    width: 100%;
}

.record-row .upload-btn {
    position: absolute;
    right: calc(50% + 78px);
    bottom: 0;
}

.upload-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: radial-gradient(circle at 25% 20%, #23232b, #17171d 68%);
    color: #e4e4ea;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.upload-btn:hover {
    transform: scale(1.07);
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.45),
        0 0 0 4px rgba(255, 79, 70, 0.08),
        0 0 0 8px rgba(255, 79, 70, 0.04);
    border-color: rgba(255, 79, 70, 0.3);
}

.upload-btn .upload-icon {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    display: inline-block;
    transition: transform 0.2s ease;
}

.upload-btn:hover .upload-icon {
    transform: translateY(-1px);
}

.upload-btn .text {
    font-size: 0.62rem;
    font-weight: 500;
}

.upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.upload-btn:active:not(:disabled) {
    transform: scale(0.96);
}

/* ── Progress step indicator ── */
.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    position: relative;
}

.progress-step {
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.45;
    transition: opacity 0.3s, color 0.3s;
    white-space: nowrap;
}

.progress-step.active {
    opacity: 1;
    color: var(--text);
    font-weight: 600;
    animation: stepPulse 1.4s ease-in-out infinite;
}

.progress-step.done {
    opacity: 1;
    color: var(--success);
    font-weight: 600;
    text-shadow: 0 0 8px rgba(31, 170, 89, 0.4);
}

.progress-step-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.35;
    transition: opacity 0.3s, color 0.3s;
}

.progress-step.done + .progress-step-arrow {
    opacity: 0.7;
    color: var(--success);
}

@keyframes stepPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-elapsed {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 4px;
    min-height: 1em;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ── Pricing toggle ── */
.pricing-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 12px 0 10px;
}

.pricing-toggle-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    transition: color 0.2s;
    cursor: pointer;
}

.pricing-toggle-label.pricing-toggle-active {
    color: var(--text);
    font-weight: 600;
}

.pricing-toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
    cursor: pointer;
}

.pricing-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pricing-toggle-slider {
    position: absolute;
    inset: 0;
    background: #2a2a32;
    border-radius: 999px;
    transition: background 0.25s;
}

.pricing-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #f2f2f6;
    border-radius: 50%;
    transition: transform 0.25s;
}

.pricing-toggle-switch input:checked + .pricing-toggle-slider {
    background: var(--success);
}

.pricing-toggle-switch input:checked + .pricing-toggle-slider::before {
    transform: translateX(20px);
}

.pricing-save-badge {
    margin-top: 8px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--success);
    font-weight: 600;
}

.pricing-save-badge.hidden {
    display: none;
}

/* ── Shared keyframe animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes sheetSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes drawerSlideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Desktop hover lift for cards/panels ── */
@media (hover: hover) {
    .hero-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 26px 48px rgba(0, 0, 0, 0.28);
    }

    .settings-block:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* ── Record button larger on bigger screens (>500px) ── */
@media (min-width: 501px) {
    .record-btn {
        width: 140px;
        height: 140px;
    }

    .record-btn .icon {
        width: 18px;
        height: 18px;
    }

    .record-btn .text {
        font-size: 0.8rem;
    }
}

/* ── Tablet responsive (640px-1024px) ── */
@media (min-width: 640px) and (max-width: 1024px) {
    .record-btn {
        width: 140px;
        height: 140px;
    }

    .app {
        padding: 20px 24px;
    }

    #main-content {
        gap: 28px;
    }

    .hero-card {
        padding: 20px 24px;
    }

    .history-item {
        padding: 14px;
    }

    .history-item-preview {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .history-item-copy {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ── History touch targets (mobile) ── */
@media (max-width: 639px) {
    .history-item-preview {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .history-item-copy {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .history-toggle {
        min-height: 48px;
    }
}

/* ── Respect prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .record-btn,
    .record-btn .icon,
    .record-btn:not(.recording) .icon {
        animation: none;
    }

    .record-btn.recording {
        animation: none;
        box-shadow:
            0 0 0 6px rgba(255, 59, 48, 0.25),
            0 16px 30px rgba(209, 37, 34, 0.35);
    }

    .header-mark {
        animation: none;
    }

    .startup-splash {
        transition: none;
    }

    .login-gate,
    .login-gate-card,
    .translate-sheet,
    .translate-sheet-card,
    .menu-overlay,
    .menu-drawer {
        animation: none;
    }

    #main-content {
        animation: none;
    }
}

/* ─── Live Translation ─── */
.live-translate-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 0.78rem;
}

.live-translate-btn.active {
    background: var(--accent, #ff4f46);
    color: #fff;
    border-color: var(--accent, #ff4f46);
}

.live-translate-container {
    background: var(--bg-card, #111114);
    border-radius: 16px;
    padding: 20px;
    margin: 0;
}

.live-translate-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.live-translate-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.live-translate-langs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-lang-select {
    flex: 1;
    background: var(--bg-input, #141419);
    color: var(--text, #f5f5f7);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    appearance: none;
    cursor: pointer;
}

.live-translate-arrow {
    color: var(--text-muted, #a7a7b0);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.live-headphone-warning {
    background: rgba(255, 200, 50, 0.08);
    border: 1px solid rgba(255, 200, 50, 0.2);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: #ffc832;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.live-translate-display {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.live-original, .live-translated {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.live-original label, .live-translated label {
    font-size: 0.75rem;
    color: var(--text-muted, #a7a7b0);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.live-text-box {
    background: var(--bg-input, #141419);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 14px;
    min-height: 60px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text, #f5f5f7);
    word-wrap: break-word;
}

.live-translated .live-text-box {
    border-color: rgba(31, 170, 89, 0.2);
    background: rgba(31, 170, 89, 0.04);
}

.live-translate-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted, #a7a7b0);
}

.live-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted, #a7a7b0);
    transition: background 0.3s;
}

.live-status-dot.live-status-listening {
    background: #1faa59;
    animation: statusPulse 1.5s ease-in-out infinite;
}

.live-status-dot.live-status-translating {
    background: #f0ad4e;
    animation: statusPulse 0.8s ease-in-out infinite;
}

.live-status-dot.live-status-speaking {
    background: #4a9eff;
    animation: statusPulse 0.5s ease-in-out infinite;
}

.live-status-dot.live-status-error {
    background: var(--accent, #ff4f46);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* ── Live Debug Log ── */
.live-debug {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    background: #0a0a0c;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    line-height: 1.4;
    color: #8f8f98;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Close X Button ── */
.btn-close-x {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: var(--text-muted, #a7a7b0);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.btn-close-x:hover {
    background: rgba(255,255,255,0.12);
    color: var(--text, #f5f5f7);
}

.btn-close-x:active {
    transform: scale(0.92);
}

/* ── Sticky Panel Header (Info, Settings) ── */
.panel-header-sticky {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
    background: inherit;
    padding: 12px 0 8px;
    margin-bottom: 8px;
}

.panel-header-sticky h2 {
    margin: 0;
}

/* ── Voice selector ── */
.live-voice-select {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.live-voice-select label {
    font-size: 0.75rem;
    color: var(--text-muted, #a7a7b0);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

/* ── Live Translation Setup Popup ── */
.live-setup-popup {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.live-setup-card {
    background: var(--bg-card, #111114);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 24px;
    width: min(90vw, 360px);
}

.live-setup-card h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    margin: 0 0 4px;
}

.live-setup-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 16px;
}

.live-setup-row {
    margin-bottom: 14px;
}

.live-setup-row label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.live-setup-row select {
    width: 100%;
}

.live-setup-popup .live-headphone-warning {
    margin-bottom: 16px;
}

.live-setup-actions {
    display: flex;
    gap: 10px;
}

.live-setup-actions .btn {
    flex: 1;
    padding: 12px;
}

/* ── Sticky result top bar (X + mode buttons) ── */
.result-sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, #141419, #111115);
    padding: 0 0 8px;
    margin-bottom: 8px;
}

/* ── Plan model info ── */
.auth-plan-models {
    font-size: 0.65rem;
    color: rgba(167, 167, 176, 0.6);
    margin: 2px 0 6px;
    line-height: 1.3;
    font-family: 'Courier New', monospace;
}

.budget-footnote-small {
    font-size: 0.65rem;
    color: rgba(167,167,176,0.5);
    margin-top: 6px;
    line-height: 1.3;
}

/* ── Diff highlight overlay (Live transcription comparison) ── */
.diff-highlight-overlay {
    width: 100%;
    min-height: 50vh;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    font-family: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    cursor: text;
}

.diff-highlight-overlay.hidden {
    display: none;
}

.result-text.diff-mode-hidden {
    display: none;
}

.diff-word {
    background: rgba(255, 200, 50, 0.15);
    border-bottom: 1px dashed rgba(255, 200, 50, 0.4);
    cursor: pointer;
    padding: 0 2px;
    border-radius: 2px;
    transition: background 0.15s ease;
}

.diff-word:hover {
    background: rgba(255, 200, 50, 0.3);
}

.diff-word.alt-active {
    background: rgba(100, 200, 100, 0.15);
    border-bottom-color: rgba(100, 200, 100, 0.4);
}
