.twvrc-recorder {
    border: 1px solid #d7e4f4;
    background: #f8fbff;
    border-radius: 14px;
    padding: 8px 10px;
    box-sizing: border-box;
}
.twvrc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    flex-wrap: nowrap;
}
.twvrc-label {
    color: #64748b;
    font-size: 16px;
}
.twvrc-title {
    font-size: 13px;
    color: #334155;
    white-space: nowrap;
}
.twvrc-btn,
.twvrc-mini {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.twvrc-btn {
    padding: 9px 12px;
    font-size: 12px;
}
.twvrc-btn:disabled,
.twvrc-mini:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.twvrc-rec {
    background: #dc2626;
    color: #fff;
}
.twvrc-stop {
    background: #111827;
    color: #fff;
}
.twvrc-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #d4e1f4;
    border-radius: 999px;
    color: #111827;
}
.twvrc-progress {
    flex: 1 1 140px;
    height: 8px;
    min-width: 100px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    overflow: hidden;
}
.twvrc-progress span {
    display: block;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    transition: width .2s linear;
}
.twvrc-limit {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}
.twvrc-status {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #64748b;
}
.twvrc-status.twvrc-error {
    color: #9a3412;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 5px 8px;
    border-radius: 999px;
}
.twvrc-pending {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #fde68a;
    border-radius: 12px;
    background: #fffbeb;
    color: #92400e;
    font-size: 12px;
}
.twvrc-mini {
    padding: 6px 9px;
    background: #fff;
    border: 1px solid #fbbf24;
    color: #92400e;
}
.twvrc-audio-block {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #d7e4f4;
    border-radius: 14px;
    background: #fff;
    max-width: 560px;
}
.twvrc-audio-block audio {
    width: 100%;
    display: block;
}
.twvrc-audio-block figcaption {
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
}
.twvrc-settings-wrap {
    max-width: 1180px;
}
.twvrc-settings-form,
.twvrc-settings-card {
    background: #fff;
    border: 1px solid #d7e4f4;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 35px rgba(15, 23, 42, .05);
    margin: 16px 0;
}
.twvrc-settings-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 16px;
}
.twvrc-settings-head h2,
.twvrc-settings-card h3 {
    margin: 0 0 6px;
    color: #0f172a;
}
.twvrc-settings-head p,
.twvrc-settings-card p {
    margin: 0;
    color: #64748b;
}
.twvrc-head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}
.twvrc-grid-2,
.twvrc-grid-3 {
    display: grid;
    gap: 14px;
}
.twvrc-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.twvrc-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.twvrc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fbff;
}
.twvrc-field-label {
    font-weight: 700;
    color: #334155;
    font-size: 13px;
}
.twvrc-field input[type="number"],
.twvrc-field input[type="url"],
.twvrc-field select {
    width: 100%;
    max-width: 100%;
    min-height: 38px;
    border-radius: 10px;
    border-color: #cbd5e1;
}
.twvrc-field small {
    color: #64748b;
    line-height: 1.35;
}
.twvrc-checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
}
.twvrc-checkline input {
    margin: 0;
}
.twvrc-recommendation {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-weight: 600;
}
.twvrc-demo-output {
    margin-top: 12px;
}
@media (max-width: 900px) {
    .twvrc-grid-3,
    .twvrc-grid-2 {
        grid-template-columns: 1fr;
    }
    .twvrc-settings-head {
        flex-direction: column;
    }
    .twvrc-row {
        flex-wrap: wrap;
    }
}

/* 0.1.1: safer compact recorder state, voice level meter and blocking processing dialog. */
.twvrc-recorder.is-processing .twvrc-rec,
.twvrc-recorder.is-processing .twvrc-stop {
    opacity: .55;
}
.twvrc-bars {
    flex: 1 1 180px;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.twvrc-bars .twvrc-progress {
    width: 100%;
    flex: 0 0 auto;
}
.twvrc-level {
    height: 4px;
    width: 100%;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}
.twvrc-level span {
    display: block;
    width: 0%;
    height: 100%;
    background: #22c55e;
    transition: width .08s linear;
}
.twvrc-status:empty {
    display: none;
}
.twvrc-status {
    max-width: 180px;
}
.twvrc-pending {
    margin-top: 5px;
    padding: 5px 8px;
    border-radius: 10px;
    font-weight: 700;
}
.twvrc-pending[hidden] {
    display: none !important;
}
.twvrc-busy-modal[hidden] {
    display: none !important;
}
.twvrc-busy-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(2px);
}
.twvrc-busy-dialog {
    width: min(420px, calc(100vw - 36px));
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(15,23,42,.24);
    padding: 22px 24px;
    text-align: center;
    color: #0f172a;
}
.twvrc-busy-dialog strong {
    display: block;
    font-size: 18px;
    margin: 8px 0 6px;
}
.twvrc-busy-dialog p {
    margin: 0 0 8px;
    color: #334155;
    font-weight: 700;
}
.twvrc-busy-dialog small {
    color: #64748b;
}
.twvrc-spinner {
    width: 34px;
    height: 34px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    margin: 0 auto;
    animation: twvrc-spin .8s linear infinite;
}
@keyframes twvrc-spin {
    to { transform: rotate(360deg); }
}
@media (max-width: 700px) {
    .twvrc-bars {
        flex-basis: 100%;
        order: 20;
    }
}


/* 0.1.2: less invasive processing state + corrected input level meter colors. */
.twvrc-recorder.is-processing .twvrc-status {
    display: inline-flex;
    align-items: center;
    max-width: 160px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #c2410c;
    font-weight: 800;
    letter-spacing: .01em;
    animation: twvrc-processing-pulse 1s ease-in-out infinite;
}
.twvrc-recorder.is-processing .twvrc-progress span,
.twvrc-recorder.is-processing .twvrc-level span {
    width: 0% !important;
}
.twvrc-level {
    background: #e5e7eb;
}
.twvrc-level span {
    background: #22c55e;
}
.twvrc-level span[data-level-zone="green"] {
    background: #22c55e;
}
.twvrc-level span[data-level-zone="yellow"] {
    background: #eab308;
}
.twvrc-level span[data-level-zone="orange"] {
    background: #f97316;
}
.twvrc-level span[data-level-zone="red"] {
    background: #dc2626;
}
.twvrc-busy-modal {
    display: none !important;
}
@keyframes twvrc-processing-pulse {
    0%, 100% { opacity: 1; transform: translateY(0); }
    50% { opacity: .62; transform: translateY(-1px); }
}

/* 0.1.3: calmer meter, de-esser-off profile, cleaner settings layout. */
.twvrc-level span[data-level-zone="green"] { background: #22c55e; }
.twvrc-level span[data-level-zone="yellow"] { background: #eab308; }
.twvrc-level span[data-level-zone="orange"] { background: #eab308; }
.twvrc-level span[data-level-zone="red"] { background: #dc2626; }

.twvrc-page-titlebar {
    max-width: 1180px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin: 10px 0 14px;
}
.twvrc-page-titlebar h1 {
    margin-bottom: 6px;
}
.twvrc-page-titlebar p {
    margin: 0;
    color: #64748b;
    max-width: 820px;
}
.twvrc-back-btn {
    margin-top: 6px !important;
    border-radius: 999px !important;
}
.twvrc-settings-clean {
    padding: 0;
    overflow: hidden;
}
.twvrc-settings-clean .twvrc-settings-card {
    box-shadow: none;
    margin: 14px 18px;
}
.twvrc-sticky-head {
    position: sticky;
    top: 32px;
    z-index: 5;
    background: #ffffff;
    margin: 0;
    padding: 16px 18px;
    border-bottom: 1px solid #dbeafe;
}
.twvrc-sticky-head h2 {
    font-size: 22px;
}
.twvrc-head-actions .button {
    border-radius: 999px;
    min-height: 40px;
    padding-inline: 18px;
    font-weight: 700;
}
.twvrc-head-actions .button-primary {
    background: #16a34a;
    border-color: #16a34a;
}
.twvrc-profile-strip {
    margin: 16px 18px 4px;
    padding: 12px 14px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    border-radius: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: #14532d;
}
.twvrc-profile-strip strong {
    white-space: nowrap;
}
.twvrc-compact-card {
    padding: 16px;
    background: #ffffff;
}
.twvrc-section-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.twvrc-section-head h3 {
    margin: 0 0 3px;
    font-size: 18px;
}
.twvrc-section-head p {
    margin: 0;
    color: #64748b;
}
.twvrc-section-kicker {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0369a1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: 0 0 auto;
}
.twvrc-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.twvrc-grid-tight {
    margin-top: 0;
}
.twvrc-feature-list {
    display: grid;
    gap: 12px;
}
.twvrc-feature-row {
    display: grid;
    grid-template-columns: minmax(260px, 1.2fr) minmax(220px, .8fr);
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fbfdff;
}
.twvrc-feature-row-muted {
    background: #fff7ed;
    border-color: #fed7aa;
}
.twvrc-feature-row .twvrc-field {
    margin: 0;
    border-color: transparent;
    background: transparent;
    padding: 2px;
}
.twvrc-field {
    min-width: 0;
}
.twvrc-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.twvrc-checkline {
    justify-content: flex-start;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 8px 10px;
}
.twvrc-checkline input[type="checkbox"] {
    transform: scale(1.08);
}
.twvrc-bottom-actions {
    padding: 0 18px 18px;
    display: flex;
    justify-content: flex-end;
}
.twvrc-bottom-actions .button {
    border-radius: 999px;
}
@media (max-width: 782px) {
    .twvrc-page-titlebar,
    .twvrc-settings-head,
    .twvrc-profile-strip {
        flex-direction: column;
    }
    .twvrc-feature-row {
        grid-template-columns: 1fr;
    }
    .twvrc-sticky-head {
        position: static;
    }
    .twvrc-head-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}


/* 0.1.4: compact waveform playback, playback speed and delete controls. */
.twvrc-audio-block {
    position: relative;
}
.twvrc-audio-block .twvrc-native-audio,
.twbn-voice-note .twvrc-native-audio,
.twbn-doc-audio .twvrc-native-audio {
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 1px !important;
}
.twvrc-player {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    display: flex;
    gap: 8px;
    max-width: 760px;
    min-height: 44px;
    padding: 6px 8px;
    box-sizing: border-box;
}
.twvrc-player button,
.twvrc-player a {
    align-items: center;
    border: 0;
    border-radius: 999px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    justify-content: center;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.twvrc-player-play {
    background: #111827;
    color: #fff;
    flex: 0 0 34px;
    height: 34px;
    width: 34px;
}
.twvrc-player-time {
    color: #334155;
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 800;
    min-width: 88px;
}
.twvrc-player-wave {
    background: transparent;
    border-radius: 12px !important;
    flex: 1 1 180px;
    height: 38px;
    min-width: 130px;
    overflow: hidden;
    padding: 0;
}
.twvrc-player-wave canvas {
    display: block;
    height: 38px;
    width: 100%;
}
.twvrc-player-speed,
.twvrc-player-download,
.twvrc-player-delete {
    background: #fff;
    border: 1px solid #dbeafe !important;
    color: #1e3a8a;
    height: 30px;
    min-width: 34px;
    padding: 0 9px;
}
.twvrc-player-delete {
    background: #fff7ed;
    border-color: #fed7aa !important;
    color: #9a3412;
    font-size: 18px !important;
}
.twvrc-player-delete:disabled {
    opacity: .55;
    cursor: not-allowed;
}
@media (max-width: 700px) {
    .twvrc-player {
        border-radius: 18px;
        flex-wrap: wrap;
    }
    .twvrc-player-wave {
        flex-basis: 100%;
        order: 5;
    }
}


/* 0.1.5: real waveform data, wider seek area, calmer meter end zones and clearer return action. */
.twvrc-audio-block {
    max-width: 100%;
}
.twvrc-player {
    width: 100%;
    max-width: none;
}
.twvrc-player-wave {
    flex: 1 1 360px;
    min-width: 280px;
}
.twvrc-player-wave-missing .twvrc-player-wave {
    opacity: .75;
}
.twvrc-player-wave-missing .twvrc-player-wave::after {
    content: "";
}
.twvrc-level span[data-level-zone="green"] { background: #22c55e; }
.twvrc-level span[data-level-zone="yellow"] { background: #eab308; }
.twvrc-level span[data-level-zone="orange"] { background: #eab308; }
.twvrc-level span[data-level-zone="red"] { background: #dc2626; }
.twvrc-head-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.twvrc-back-btn-inline {
    background: #fff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
    font-weight: 700 !important;
}


/* 0.1.6: one clear return button, not a duplicate top/back-to-plugins trap. */
.twvrc-page-titlebar {
    justify-content: flex-start;
}
.twvrc-page-titlebar > .button.twvrc-back-btn {
    display: none !important;
}


/* 0.1.8: visual-normalised real waveform and duplicate-player cleanup. */
.twvrc-player-wave-real .twvrc-player-wave canvas {
    opacity: 1;
}
.twvrc-player-wave-missing .twvrc-player-wave canvas {
    opacity: .55;
}


/* 0.1.9 / Business Notes 0.10.14: reliable legacy playback.
   Old recordings without stored waveform data use the browser audio element,
   not a fake/dead waveform player. New recordings still use compact waveform. */
.twvrc-audio-block.twvrc-legacy-native,
.twbn-voice-note.twvrc-legacy-native,
.twbn-doc-audio.twvrc-legacy-native {
    background: #ffffff;
}
.twvrc-audio-block.twvrc-legacy-native audio,
.twbn-voice-note.twvrc-legacy-native audio,
.twbn-doc-audio.twvrc-legacy-native audio,
.twvrc-audio-block.twvrc-legacy-native .twvrc-native-audio,
.twbn-voice-note.twvrc-legacy-native .twvrc-native-audio,
.twbn-doc-audio.twvrc-legacy-native .twvrc-native-audio {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 760px !important;
    height: 42px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    margin: 0 !important;
}
.twvrc-legacy-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 7px;
}
.twvrc-legacy-actions a,
.twvrc-legacy-actions button {
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #fff;
    color: #1e3a8a;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    padding: 7px 10px;
    text-decoration: none;
}
.twvrc-legacy-actions button {
    border-color: #fed7aa;
    color: #9a3412;
}

/* 0.1.14: keep a stable compact player for legacy audio while real waveform is being rebuilt. */
.twvrc-player.twvrc-player-wave-missing .twvrc-player-wave canvas {
    opacity: .75;
}

/* 0.1.15: no dead invisible waveform lines. Missing/legacy data still renders a visible compact wave. */
.twvrc-player.twvrc-player-wave-missing .twvrc-player-wave canvas {
    opacity: 1;
}
.twvrc-player-wave-missing .twvrc-player-wave {
    opacity: 1;
}

/* 0.1.16: waveform must always be visible; no almost-invisible dead bars. */
.twvrc-player-wave canvas {
    opacity: 1 !important;
    filter: none !important;
}
.twvrc-player.twvrc-player-wave-missing .twvrc-player-wave,
.twvrc-player.twvrc-player-wave-missing .twvrc-player-wave canvas {
    opacity: 1 !important;
}
.twvrc-player-wave {
    background: #eff6ff !important;
}


/* 0.1.17 / BN 0.10.25: waveform is always visibly drawn, including fallback legacy audio. */
.twvrc-player-wave canvas {
    opacity: 1 !important;
}
.twvrc-player-wave {
    background: #eff6ff !important;
}
.twvrc-player.twvrc-player-wave-missing .twvrc-player-wave {
    background: #dbeafe !important;
}
