/* Only Murders in the Building — Styles */

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

:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --card: #0f3460;
    --accent: #e94560;
    --text: #eee;
    --text-muted: #999;
    --oliver-color: #e6a817;
    --charles-color: #4a90d9;
    --mabel-color: #d94f8a;
    --input-bg: #1e2a4a;
    --input-border: #2a3a5a;
}

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

/* ── Auth Page ──────────────────────────────── */

.auth-container {
    max-width: 440px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h1 {
    font-size: 1.6em;
    margin-bottom: 4px;
    color: var(--accent);
}

.auth-header .subtitle {
    font-size: 0.85em;
    color: var(--text-muted);
}

.auth-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 32px;
    border: 1px solid var(--input-border);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--input-border);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95em;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: flex;
    gap: 12px;
}

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

.btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg {
    background: rgba(233, 69, 96, 0.15);
    color: var(--accent);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85em;
    margin-bottom: 16px;
    display: none;
}

/* ── Studio Page — Cinematic Redesign ───────────────── */

/* --- Container & Background Layers --- */

.studio-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.studio-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.studio-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 26, 0.55);
    z-index: 1;
}

.studio-hud {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    --transcript-width: clamp(280px, 25vw, 380px);
}

/* --- Top branding — Hulu / Only Murders lockup above the ON AIR badge --- */

.branding.branding-top {
    display: flex;
    justify-content: center;
    padding: 14px 0 6px;
    margin-right: var(--transcript-width, 0px);
    transition: margin-right 0.3s ease;
}
.branding.branding-top img {
    height: 80px;
    opacity: 0.95;
}

/* --- ON AIR Badge (lives inside .main-speaker, sits just above the image) --- */

.on-air-badge {
    z-index: 20;
    transition: opacity 0.3s;
    margin: 0;
}

.on-air-badge img {
    width: 150px;
    height: auto;
    display: block;
}

/* OFF state: dim, desaturated */
.on-air-badge.off img {
    opacity: 0.25;
    filter: grayscale(1) brightness(0.4);
}

/* ON state: full glow */
.on-air-badge.on img {
    opacity: 1;
    filter: none;
}

/* Flicker ON animation (tube light warming up) */
.on-air-badge.flicker-on img {
    animation: flickerOn 1.5s ease-in-out forwards;
}

/* Flicker OFF animation (tube light cooling down) */
.on-air-badge.flicker-off img {
    animation: flickerOff 1.0s ease-in-out forwards;
}

@keyframes flickerOn {
    0%   { opacity: 0.25; filter: grayscale(1) brightness(0.4); }
    10%  { opacity: 0.6;  filter: grayscale(0.5) brightness(0.7); }
    20%  { opacity: 0.2;  filter: grayscale(1) brightness(0.3); }
    30%  { opacity: 0.8;  filter: grayscale(0.2) brightness(0.9); }
    40%  { opacity: 0.3;  filter: grayscale(0.8) brightness(0.5); }
    50%  { opacity: 0.9;  filter: grayscale(0.1) brightness(0.95); }
    60%  { opacity: 0.5;  filter: grayscale(0.4) brightness(0.7); }
    70%  { opacity: 0.95; filter: grayscale(0) brightness(1); }
    80%  { opacity: 0.7;  filter: grayscale(0.1) brightness(0.85); }
    90%  { opacity: 1;    filter: none; }
    100% { opacity: 1;    filter: none; }
}

@keyframes flickerOff {
    0%   { opacity: 1;    filter: none; }
    15%  { opacity: 0.4;  filter: grayscale(0.5) brightness(0.6); }
    30%  { opacity: 0.8;  filter: grayscale(0.2) brightness(0.8); }
    45%  { opacity: 0.2;  filter: grayscale(0.8) brightness(0.4); }
    60%  { opacity: 0.6;  filter: grayscale(0.4) brightness(0.6); }
    75%  { opacity: 0.15; filter: grayscale(1) brightness(0.3); }
    100% { opacity: 0.25; filter: grayscale(1) brightness(0.4); }
}

/* --- Status Bar --- */

.status-bar {
    text-align: center;
    padding: 0 16px;
    font-size: 0.75em;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    /* Lives inside .main-speaker now — parent already reserves
       transcript-panel width via its own margin-right. */
}

/* --- Live interim transcript (Scribe partials) ---
   HIDDEN by design: partials still flow to the orchestrator server-side
   to drive Phase 2 signal priming, but rendering them on screen breaks
   immersion (you're supposed to be talking TO the hosts, not reading
   yourself). Flip back to display: block + opacity:0/active:1 if you
   want the live-caption "wow factor" back for a demo. */
.interim-caption {
    display: none;
}

/* --- Main Speaker Frame --- */

.main-speaker {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px;
    position: relative;
    min-height: 0;
    margin-right: var(--transcript-width, 0px);
    transition: margin-right 0.3s ease;
}

/* Direct-child selector only — so the ON AIR badge img nested inside
   .main-speaker doesn't inherit the 250-420px clamp sizing meant for
   the speaker portrait. */
.main-speaker > img {
    width: clamp(250px, 30vw, 420px);
    height: clamp(250px, 30vw, 420px);
    object-fit: cover;
    border-radius: 20px;
    border: 5px solid #8b1a1a;
    box-shadow: 0 0 40px rgba(139, 26, 26, 0.5), 0 0 80px rgba(139, 26, 26, 0.2);
    transition: all 0.4s ease;
}

/* Speaker frame color matches character */
.main-speaker.speaker-oliver  > img { border-color: var(--oliver-color);  box-shadow: 0 0 40px rgba(230, 168, 23, 0.4), 0 0 80px rgba(230, 168, 23, 0.15); }
.main-speaker.speaker-charles > img { border-color: var(--charles-color); box-shadow: 0 0 40px rgba(74, 144, 217, 0.4), 0 0 80px rgba(74, 144, 217, 0.15); }
.main-speaker.speaker-mabel   > img { border-color: var(--mabel-color);  box-shadow: 0 0 40px rgba(217, 79, 138, 0.4), 0 0 80px rgba(217, 79, 138, 0.15); }
.main-speaker.speaker-user    > img { border-color: #888;                box-shadow: 0 0 40px rgba(136, 136, 136, 0.4), 0 0 80px rgba(136, 136, 136, 0.15); }

/* Idle state: showing logo, no frame */
.main-speaker.idle > img {
    border-color: transparent;
    box-shadow: none;
    object-fit: contain;
    background: transparent;
}

.main-speaker .speaker-name {
    background: rgba(0, 0, 0, 0.72);
    padding: 5px 18px;
    border-radius: 16px;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    white-space: nowrap;
    color: var(--text);
    /* No absolute positioning — flows naturally below the image. */
}

.main-speaker .speaker-name:empty {
    display: none;
}

/* --- Transcript Sidebar --- */

.transcript-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: clamp(280px, 25vw, 380px);
    background: rgba(15, 20, 35, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 15;
    transition: transform 0.3s ease;
}

/* Collapsed state */
.transcript-panel.collapsed {
    transform: translateX(100%);
}

/* Toggle tab — small chevron on the edge */
.transcript-toggle-tab {
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: rgba(15, 20, 35, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65em;
    transition: background 0.2s, color 0.2s;
    z-index: 16;
}

.transcript-toggle-tab:hover {
    background: rgba(30, 40, 60, 0.9);
    color: var(--text);
}

/* Flip arrow when collapsed */
.transcript-panel.collapsed .transcript-toggle-tab {
    transform: translateY(-50%) scaleX(-1);
}

.transcript-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.85em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.transcript-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Scrollbar */
.transcript-messages::-webkit-scrollbar { width: 6px; }
.transcript-messages::-webkit-scrollbar-track { background: transparent; }
.transcript-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.transcript-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.transcript-msg {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.82em;
    line-height: 1.5;
    max-width: 100%;
}

.transcript-msg .msg-speaker {
    font-weight: 700;
    font-size: 0.72em;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transcript-msg.oliver { background: rgba(230, 168, 23, 0.12); border-left: 3px solid var(--oliver-color); }
.transcript-msg.oliver .msg-speaker { color: var(--oliver-color); }

.transcript-msg.charles { background: rgba(74, 144, 217, 0.12); border-left: 3px solid var(--charles-color); }
.transcript-msg.charles .msg-speaker { color: var(--charles-color); }

.transcript-msg.mabel { background: rgba(217, 79, 138, 0.12); border-left: 3px solid var(--mabel-color); }
.transcript-msg.mabel .msg-speaker { color: var(--mabel-color); }

.transcript-msg.user { background: rgba(255, 255, 255, 0.06); border-left: 3px solid #888; }
.transcript-msg.user .msg-speaker { color: #aaa; }

.transcript-msg.system { background: rgba(255, 255, 255, 0.04); border-left: 3px solid #555; }
.transcript-msg.system .msg-speaker { color: #777; }

.transcript-input {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.transcript-input input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(30, 42, 74, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text);
    font-size: 0.85em;
    outline: none;
    transition: border-color 0.2s;
}

.transcript-input input:focus {
    border-color: var(--accent);
}

.send-btn {
    padding: 10px 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.send-btn:hover { opacity: 0.85; }

/* --- Bottom Section --- */

.bottom-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    background: rgba(8, 12, 20, 0.82);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-right: var(--transcript-width, 0px);
    transition: padding-right 0.3s ease;
}

/* --- Character Thumbnails --- */

.thumbnail-strip {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 8px 16px 28px;
}

.thumbnail {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: visible;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.thumbnail img {
    border-radius: 12px;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Permanent character-colored borders */
.thumbnail.oliver  { border: 3px solid var(--oliver-color); }
.thumbnail.charles { border: 3px solid var(--charles-color); }
.thumbnail.mabel   { border: 3px solid var(--mabel-color); }
.thumbnail.user    { border: 3px solid #888; }

/* Active speaker: glow pulse */
.thumbnail.oliver.active  { box-shadow: 0 0 14px 5px rgba(230, 168, 23, 0.6);  animation: pulseGlowOliver 2s ease-in-out infinite; }
.thumbnail.charles.active { box-shadow: 0 0 14px 5px rgba(74, 144, 217, 0.6);  animation: pulseGlowCharles 2s ease-in-out infinite; }
.thumbnail.mabel.active   { box-shadow: 0 0 14px 5px rgba(217, 79, 138, 0.6);  animation: pulseGlowMabel 2s ease-in-out infinite; }
.thumbnail.user.active    { box-shadow: 0 0 14px 5px rgba(136, 136, 136, 0.6);  animation: pulseGlowUser 2s ease-in-out infinite; }

@keyframes pulseGlowOliver {
    0%, 100% { box-shadow: 0 0 10px 3px rgba(230, 168, 23, 0.4); }
    50%      { box-shadow: 0 0 20px 8px rgba(230, 168, 23, 0.7); }
}
@keyframes pulseGlowCharles {
    0%, 100% { box-shadow: 0 0 10px 3px rgba(74, 144, 217, 0.4); }
    50%      { box-shadow: 0 0 20px 8px rgba(74, 144, 217, 0.7); }
}
@keyframes pulseGlowMabel {
    0%, 100% { box-shadow: 0 0 10px 3px rgba(217, 79, 138, 0.4); }
    50%      { box-shadow: 0 0 20px 8px rgba(217, 79, 138, 0.7); }
}
@keyframes pulseGlowUser {
    0%, 100% { box-shadow: 0 0 10px 3px rgba(136, 136, 136, 0.4); }
    50%      { box-shadow: 0 0 20px 8px rgba(136, 136, 136, 0.7); }
}

.thumbnail .thumb-name {
    position: absolute;
    bottom: -20px;
    width: 100%;
    text-align: center;
    font-size: 0.6em;
    padding: 2px 0;
    letter-spacing: 1px;
    font-weight: 700;
    color: #ccc;
}

/* --- Controls ---

   Two stacked rows, each centered as a unit:
     row 1: [ MIC pill ]   [ WRAP UP ]
     row 2:       [pause][volume icon][slider]        ← centered under full row 1 */

.controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
}

.controls-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.controls-subrow {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.ctrl-btn {
    padding: 10px 24px;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 0.8rem;   /* rem — avoids <button> UA font-size cascade */
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.end-btn {
    background: rgba(192, 57, 43, 0.7);
    border: 1px solid rgba(192, 57, 43, 0.9);
}

.end-btn:hover {
    background: rgba(192, 57, 43, 0.9);
}

/* Mic button — entire pill is clickable. Height matched to .ctrl-btn
   (WRAP UP) so the row 1 of controls looks balanced. Default (muted) = red.
   NOTE: do NOT set font-size here. The .mic-label child already has
   font-size: 0.8em; if this parent also has font-size: 0.8em, the em
   compounds (0.64em effective) and START PODCAST reads smaller than
   WRAP UP. */
.mic-control {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: rgba(192, 57, 43, 0.7);
    border: 1px solid rgba(192, 57, 43, 0.9);
    border-radius: 24px;
    padding: 5px 18px 5px 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    color: white;
    font-family: inherit;
}

.mic-control:hover { background: rgba(192, 57, 43, 0.85); }
.mic-control:disabled { cursor: not-allowed; }

/* START state — accent pink (pre-session, no mic active yet) */
.mic-control.start {
    background: rgba(233, 69, 96, 0.85);
    border-color: rgba(233, 69, 96, 1);
    padding-right: 22px;
}
.mic-control.start:hover { background: rgba(233, 69, 96, 1); }

/* COUNTDOWN state — stay red, but show big number in the icon circle */
.mic-control.countdown {
    background: rgba(192, 57, 43, 0.7);
    border-color: rgba(192, 57, 43, 0.9);
    opacity: 1;
}

/* RECORDING state — GREEN (only after countdown finishes) */
.mic-control.recording {
    background: rgba(46, 204, 113, 0.7);
    border-color: rgba(46, 204, 113, 0.9);
}
.mic-control.recording:hover { background: rgba(46, 204, 113, 0.85); }

/* Countdown number displayed in the icon slot */
.mic-countdown-num {
    font-size: 1.6em;
    font-weight: 800;
    line-height: 1;
    color: white;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.mic-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mic-label {
    font-size: 0.8rem;   /* rem — matches .ctrl-btn exactly, no cascade math */
    color: white;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Host volume control — sits directly under the mic button.
   No pill background; just a speaker icon + slider. */
.volume-control {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 0;
    color: white;
    font-family: inherit;
}

.volume-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: color 0.15s ease;
}
.volume-icon-btn:hover { color: white; }
.volume-icon-btn.muted { color: var(--accent); }
.volume-icon-btn.muted:hover { color: var(--accent); opacity: 0.85; }

/* SVG state toggle: default shows waves, hides X; .muted swaps them. */
.volume-icon-btn .vol-x { display: none; }
.volume-icon-btn.muted .vol-waves { display: none; }
.volume-icon-btn.muted .vol-x { display: inline; }

/* Slider — thin bar with accent-red thumb. */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 110px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: transform 0.1s ease;
}
.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

/* Play/Pause button — small circular icon-only button, matched in height
   to the volume speaker icon (28px). VCR convention: show whichever
   action clicking will perform (paused state shows PLAY, playing state
   shows PAUSE). */
.pause-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.pause-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}
.pause-btn .icon-play { display: none; }
.pause-btn.paused .icon-pause { display: none; }
.pause-btn.paused .icon-play { display: inline-block; }

/* --- Floating Settings Gear (top-right) --- */

.settings-float-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(15, 52, 96, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.settings-float-btn:hover {
    background: rgba(15, 52, 96, 0.95);
    border-color: var(--accent);
    transform: rotate(30deg);
}

.settings-float-btn.active {
    background: rgba(233, 69, 96, 0.75);
    border-color: var(--accent);
}

.device-settings-panel {
    display: none;
    position: fixed;
    top: 68px;
    right: 16px;
    z-index: 99;
    background: rgba(15, 52, 96, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 14px 18px;
    width: 300px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.device-settings-panel.open {
    display: block;
}

/* When the transcript panel is open, keep the gear and settings panel
   just to the left of the panel rather than flinging them across the viewport. */
body:has(#transcript-panel:not(.collapsed)) .settings-float-btn,
body:has(#transcript-panel:not(.collapsed)) .device-settings-panel {
    right: calc(var(--transcript-width, clamp(280px, 25vw, 380px)) + 16px);
}

.device-setting {
    margin-bottom: 10px;
}

.device-setting:last-child {
    margin-bottom: 0;
}

.device-setting label {
    display: block;
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.device-setting select {
    width: 100%;
    padding: 8px 12px;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 0.8em;
    font-family: inherit;
    cursor: pointer;
    appearance: auto;
}

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

/* Divider + link row at the bottom of the settings panel */
.device-setting.settings-divider {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-link {
    display: block;
    padding: 8px 12px;
    background: rgba(233, 69, 96, 0.15);
    border: 1px solid rgba(233, 69, 96, 0.4);
    border-radius: 8px;
    color: var(--accent);
    font-size: 0.78em;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.settings-link:hover {
    background: rgba(233, 69, 96, 0.25);
    border-color: rgba(233, 69, 96, 0.7);
    color: #fff;
}

/* Button variant of settings-link (replaces the old <a> for the profile modal). */
button.settings-link {
    width: 100%;
    cursor: pointer;
    font-family: inherit;
}

/* Ghost variant — used for terminal/exit actions (Log Out). De-emphasized
   relative to the primary accent button so the visual hierarchy reads
   "primary action" → "exit". */
.settings-link-ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.7);
}

.settings-link-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.32);
    color: #fff;
}

/* --- Admin-only: voice ID override section in settings panel --- */

.admin-section-label {
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.admin-voice-field {
    margin-bottom: 8px;
}

.admin-voice-input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #fff;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.78em;
    letter-spacing: 0.3px;
    outline: none;
    transition: border-color 0.15s ease;
}

.admin-voice-input:focus {
    border-color: rgba(233, 69, 96, 0.55);
}

.admin-voice-status {
    font-size: 0.72em;
    min-height: 1.2em;
    margin: 6px 0 8px;
    color: rgba(255, 255, 255, 0.55);
}
.admin-voice-status.is-error { color: #ff7a85; }
.admin-voice-status.is-success { color: #7ed8a8; }

/* --- Profile modal — overlays the Arconia studio --- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 26, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-dialog {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--input-border);
    border-radius: 14px;
    padding: 28px 30px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: background 0.15s ease, color 0.15s ease;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.modal-header {
    margin-bottom: 20px;
}
.modal-header h2 {
    font-size: 1.4em;
    color: var(--accent);
    margin: 0 0 4px 0;
}
.modal-subtitle {
    font-size: 0.85em;
    color: var(--text-muted);
}

