/* MegaMix AI Web App – purple/dark theme */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #fff;
    min-height: 100vh;
    padding-top: 60px;
}

.hidden { display: none !important; }
@keyframes viewFadeIn { to { opacity: 1; } }
.view.view-visible { opacity: 0; animation: viewFadeIn 0.3s ease forwards; }

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(8, 27, 56, 0.94);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 188, 235, 0.22);
}
.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
}
.navbar-logo {
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
}
.navbar-logo img {
    height: 60px;
    width: auto;
    display: block;
    object-fit: contain;
}
.navbar-logo:hover { color: #00BCEB; }
.navbar-logo a:hover { opacity: 0.9; }
.navbar-links {
    display: flex;
    gap: 30px;
    align-items: center;
}
.navbar-links a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}
.navbar-links a:hover { color: #00BCEB; }
.navbar-links a.nav-active {
    color: #00BCEB;
}
.navbar-links a.nav-active::after {
    transform: scaleX(1);
    opacity: 1;
}
.navbar-credits {
    font-size: 0.9rem;
    color: #ccc;
}
.navbar-credits strong { color: #8b5cf6; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}
.btn-primary {
    background: linear-gradient(135deg, #F20F79 0%, #00BCEB 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(242, 15, 121, 0.35);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #FF2A8E 0%, #22D3EE 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(242, 15, 121, 0.45);
}
.btn-primary:active {
    transform: translateY(0) scale(0.98);
}
.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
    border-color: #8b5cf6;
}
.btn-ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.btn-ghost:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.08);
}
.btn-ghost:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.4);
}
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-hero { padding: 16px 40px; font-size: 1.1rem; margin-top: 0; }
.hero-cta-center {
    text-align: center;
    margin-top: 16px;
}
.hero-cta-center .btn-hero { margin-top: 0; }
.hero-free-trial-bottom {
    text-align: center;
    padding: 48px 20px 56px;
}
.hero-free-trial-bottom .btn-hero {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Views */
.view {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* Landing – Hero */
.hero {
    text-align: center;
    padding: 40px 0 60px;
}
.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}
.hero-sub {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 24px;
    line-height: 1.5;
}
.hero-plugin-note {
    font-size: 1rem;
    opacity: 0.85;
    margin-bottom: 24px;
    line-height: 1.5;
    color: #c4b5fd;
}
.hero-benefits {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 32px;
    margin-bottom: 24px;
}
.hero-benefits li {
    font-size: 1rem;
    color: #a78bfa;
}
.hero-benefit-emoji {
    margin-right: 0.35em;
}
.hero-benefits-below-btn {
    margin-top: 1.25rem;
}

/* How it works */
.how-it-works {
    padding: 60px 0;
}
.how-it-works h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 40px;
}
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
}
.step {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid rgba(255,255,255,0.08);
}
.step-num {
    display: inline-block;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background: #8b5cf6;
    border-radius: 50%;
    font-weight: 700;
    margin-bottom: 12px;
}
.step h3 { font-size: 1.1rem; margin-bottom: 8px; }
.step p { font-size: 0.95rem; opacity: 0.85; line-height: 1.5; }

/* Testimonials */
.testimonials {
    text-align: center;
    padding: 40px 0 60px;
}
.testimonials h2 { font-size: 1.5rem; margin-bottom: 24px; }
.testimonial-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}
.testimonial-strip blockquote {
    font-size: 1rem;
    opacity: 0.9;
    font-style: italic;
    max-width: 280px;
}

/* Workspace – App view */
#view-app .workspace {
    padding: 0;
    animation: workspaceIn 0.5s ease backwards;
}
/* Fill "backwards", not "forwards": a transform kept after the animation makes the workspace a containing
   block + stacking context, which trapped fixed overlays (the mobile project drawer) under the site header. */
@keyframes workspaceIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    #view-app .workspace { animation: none; }
}

/* Upload and file list – collapsible */
.flow-step {
    font-size: 1.035rem;
    font-weight: 600;
    color: #8b5cf6;
    margin-bottom: 12px;
    margin-top: 24px;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    animation: flowStepIn 0.4s ease forwards;
}
.flow-step:first-child { margin-top: 0; }
@keyframes flowStepIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .flow-step { animation: none; }
}
.upload-and-files { margin-bottom: 24px; }
.upload-and-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.upload-and-files-header h2 { font-size: 1.25rem; font-weight: 600; margin: 0; }
.upload-and-files-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.upload-and-files-body.collapsed .file-list { display: none; }
.upload-and-files-body.collapsed .upload-zone {
    padding: 12px 16px;
    min-height: 0;
}
.upload-and-files-body.collapsed .upload-zone p:first-child { display: none; }
.upload-and-files-body.collapsed .upload-hint { margin: 0; font-size: 0.85rem; }

.upload-section { margin-bottom: 24px; }
.upload-section h2 { font-size: 1.25rem; margin-bottom: 12px; font-weight: 600; }
.upload-zone {
    border: 2px dashed rgba(139, 92, 246, 0.5);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    background: rgba(139, 92, 246, 0.06);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.upload-zone:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.15);
}
.upload-zone.dragover {
    background: rgba(139, 92, 246, 0.18);
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25), 0 0 24px rgba(139, 92, 246, 0.15);
}
.upload-zone p { margin: 4px 0; }
.upload-hint { font-size: 0.9rem; opacity: 0.7; }
.file-list {
    list-style: none;
    margin-top: 12px;
}
.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid rgba(255,255,255,0.06);
}
.file-list li:nth-child(even) { background: rgba(255,255,255,0.06); }
.file-list .remove-file {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #f87171;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
.file-list .remove-file:hover {
    background: #f87171;
    color: #fff;
    border-color: #f87171;
}

/* Mode toggle */
.mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
    width: fit-content;
}
.mode-btn {
    padding: 12px 28px;
    border: none;
    background: rgba(255,255,255,0.06);
    color: #a0a0a0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}
.mode-btn.active {
    background: #8b5cf6;
    color: #fff;
}
.mode-btn:not(.active):hover { background: rgba(255,255,255,0.12); color: #fff; }

/* DAW wrap – Advanced: mixer + transport in one block */
.daw-wrap {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-bottom: 24px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 28px;
    box-sizing: border-box;
}
.daw-wrap .panel { margin-bottom: 0; }
.daw-wrap .before-after-card { margin-top: 20px; }

/* Panels */
.panel {
    background: rgba(255,255,255,0.04);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid rgba(255,255,255,0.08);
}
.panel h3 { margin-bottom: 20px; font-size: 1.15rem; font-weight: 600; }
.panel label { display: block; margin-bottom: 6px; font-size: 0.9rem; opacity: 0.9; }
.panel select {
    width: 100%;
    max-width: 280px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3);
    color: #fff;
    margin-bottom: 16px;
}
.preset-prompts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.preset-prompts-grid .preset-prompt-btn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    min-height: 2.8em;
    padding: 12px 10px;
}
.panel .guidance-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3);
    color: #fff;
    margin-bottom: 16px;
    box-sizing: border-box;
}
.panel .guidance-input::placeholder { color: #94a3b8; }
.panel .guidance-input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.panel .guidance-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
#btn-mix-it { margin-bottom: 20px; }

.mix-reference-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 16px 0 18px;
    padding: 18px 16px;
    text-align: center;
}
.mix-reference-open-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.mix-reference-open-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(139, 92, 246, 0.38);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.mix-reference-open-btn:hover,
.mix-reference-open-btn:focus-visible {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(139, 92, 246, 0.5);
    outline: none;
}
.mix-reference-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #e2e8f0;
}
.mix-reference-optional {
    font-weight: 500;
    color: #94a3b8;
    font-size: 0.9em;
}
.mix-reference-hint {
    margin: 0 0 12px;
}
.mix-reference-drop {
    border: 2px dashed rgba(139, 92, 246, 0.45);
    border-radius: 10px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    background: rgba(139, 92, 246, 0.05);
    transition: background 0.2s ease, border-color 0.2s ease;
}
.mix-reference-drop:hover,
.mix-reference-drop:focus-visible {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(167, 139, 250, 0.75);
    outline: none;
}
.mix-reference-drop.dragover {
    background: rgba(139, 92, 246, 0.16);
    border-color: #a78bfa;
}
.mix-reference-drop-title {
    margin: 0 0 4px;
    font-weight: 600;
    color: #f8fafc;
    font-size: 0.98rem;
}
.mix-reference-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 440px;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}
.mix-reference-card-body { min-width: 0; flex: 1; }
.mix-reference-card-title {
    margin: 0;
    font-weight: 600;
    color: #f8fafc;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mix-reference-card-meta {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #94a3b8;
}
.btn-ai-mastering-sparkle {
    position: relative;
    overflow: hidden;
    animation: ai-master-glow 2s ease-in-out infinite;
}
.btn-ai-mastering-sparkle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent, rgba(255,255,255,0.1), transparent);
    animation: ai-master-shimmer 3s linear infinite;
    pointer-events: none;
}
@keyframes ai-master-glow {
    0%, 100% { box-shadow: 0 0 16px rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 28px rgba(139, 92, 246, 0.7); }
}
@keyframes ai-master-shimmer {
    0% { transform: translateX(-50%) rotate(0deg); }
    100% { transform: translateX(50%) rotate(0deg); }
}
.progress-wrap {
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}
.progress-bar {
    height: 100%;
    width: 0%;
    background: #8b5cf6;
    transition: width 0.15s linear;
}

.mix-it-loading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 12px 0 20px 0;
    padding: 14px 20px;
    background: rgba(139, 92, 246, 0.12);
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    animation: mixItPulse 2.5s ease-in-out infinite;
}
@keyframes mixItPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(139, 92, 246, 0); }
    50% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.2); }
}
@media (prefers-reduced-motion: reduce) {
    .mix-it-loading { animation: none; }
}
.mix-it-loading-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mix-it-loading .loading-spinner {
    width: 28px;
    height: 28px;
    border-width: 2px;
    flex-shrink: 0;
}
.mix-it-loading-status {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.mix-it-loading-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #c4b5fd;
}
.mix-it-loading-estimate {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
}
.mix-it-progress-track {
    height: 6px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    overflow: hidden;
}
.mix-it-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 3px;
    transition: width 0.25s ease;
}
.mix-done-check {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
}
.mix-done-check.hidden { display: none; }
.mix-done-checkmark {
    width: 64px;
    height: 64px;
    color: #10b981;
    animation: mix-done-pop 0.4s ease-out;
}
.mix-done-circle {
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: mix-done-circle 0.5s ease-out 0.2s forwards;
}
.mix-done-path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: mix-done-path 0.35s ease-out 0.5s forwards;
}
.mix-done-label {
    font-size: 1rem;
    font-weight: 600;
    color: #10b981;
}
.mix-done-check.mix-done-fade {
    opacity: 0;
    transition: opacity 0.5s ease;
}
@keyframes mix-done-pop {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes mix-done-circle {
    to { stroke-dashoffset: 0; }
}
@keyframes mix-done-path {
    to { stroke-dashoffset: 0; }
}
.josh-avatar-wrap {
    position: fixed;
    left: 6.74%;
    bottom: 5.33%;
    top: auto;
    z-index: 50;
    pointer-events: auto;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.35s ease, bottom 0.35s ease;
}
.josh-avatar-wrap:active { cursor: grabbing; }
.josh-avatar-help {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.5);
    background: rgba(30, 30, 30, 0.95);
    color: #a78bfa;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: auto;
    box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}
.josh-avatar-help:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}
.josh-thought-wrap {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    min-width: 240px;
    max-width: 240px;
    pointer-events: auto;
}
.josh-thought-wrap.josh-bubble-empty .josh-thought-simple {
    display: none;
}
.josh-thought-wrap.josh-bubble-empty {
    min-height: 0;
    margin-bottom: 0;
}
.josh-thought-simple {
    display: block;
    animation: josh-bubble-fade-in 0.35s ease-out;
}
.josh-thought-simple.hidden { display: none; }
.josh-thought-input-row {
    animation: josh-bubble-fade-in 0.3s ease-out;
}
.josh-thought-chat:not(.hidden) {
    animation: josh-bubble-fade-in 0.3s ease-out;
}
@keyframes josh-bubble-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.josh-avatar-thought {
    position: relative;
    display: inline-block;
    padding: 6px 12px;
    min-width: 100%;
    max-width: 240px;
    text-align: center;
    background: rgba(30, 30, 30, 0.98);
    border: 2px solid rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a78bfa;
    white-space: normal;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    box-sizing: border-box;
    cursor: pointer;
}
.josh-avatar-thought::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -10px;
    margin-left: -8px;
    border: 8px solid transparent;
    border-top-color: rgba(139, 92, 246, 0.4);
    border-bottom: none;
}
.josh-avatar-thought::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -7px;
    margin-left: -6px;
    border: 6px solid transparent;
    border-top-color: rgba(30, 30, 30, 0.98);
    border-bottom: none;
}
.josh-thought-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 12px;
    background: rgba(30, 30, 30, 0.98);
    border: 2px solid rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    box-sizing: border-box;
}
.josh-thought-input-row.hidden { display: none; }
.josh-thought-input {
    flex: 1;
    min-width: 0;
    padding: 6px 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 0.8rem;
    outline: none;
}
.josh-thought-input::placeholder { color: rgba(167, 139, 250, 0.6); }
.josh-thought-send {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(139, 92, 246, 0.6);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.josh-thought-send:hover { background: rgba(139, 92, 246, 0.9); }
.josh-thought-chat {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    width: min(420px, calc(100vw - 32px));
    max-width: 320px;
    max-height: min(50vh, 380px);
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 30, 0.98);
    border: 2px solid rgba(139, 92, 246, 0.4);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 100;
}
.josh-thought-chat.hidden { display: none; }
.josh-thought-close {
    position: absolute;
    left: 12px;
    top: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.josh-thought-close:hover { color: #fff; }
.josh-thought-messages {
    flex: 1;
    overflow-y: auto;
    padding: 44px 16px 12px;
    min-height: 120px;
    max-height: 40vh;
}
.josh-thought-messages .josh-msg {
    margin-bottom: 10px;
    font-size: 0.9rem;
    animation: josh-msg-fade-in 0.35s ease-out;
}
@keyframes josh-msg-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.josh-thought-messages .josh-msg.user { color: #a78bfa; }
.josh-thought-messages .josh-msg.bot { color: #94a3b8; }
.josh-thought-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.josh-thought-chat-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}
.josh-thought-chat-input::placeholder { color: rgba(167, 139, 250, 0.6); }
.josh-thought-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(139, 92, 246, 0.7);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.josh-thought-chat-send:hover { background: rgba(139, 92, 246, 0.95); }
.josh-avatar-bubble {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 0 3px rgba(139, 92, 246, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: josh-float 4s ease-in-out infinite;
}
.josh-avatar-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
}
@keyframes josh-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.loading-block {
    margin: 12px 0;
    text-align: center;
}
.loading-block-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
}
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
}
@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

.one-file-master-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 16px;
    min-height: 120px;
}
.one-file-master-loading.hidden { display: none; }
.one-file-separate-progress-wrap {
    width: 100%;
    max-width: 320px;
}
.one-file-separate-progress-wrap.hidden { display: none; }
.one-file-separate-progress-track {
    height: 10px;
    width: 100%;
    background: rgba(255,255,255,0.12);
    border-radius: 6px;
    overflow: hidden;
}
.one-file-separate-progress-fill {
    height: 100%;
    width: 0%;
    background: #8b5cf6;
    border-radius: 6px;
    transition: width 0.3s ease;
}
.one-file-separate-timer {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    margin: 10px 0 0 0;
    text-align: center;
}
.one-file-master-loading-spinner-wrap {
    display: flex;
    justify-content: center;
}
.one-file-master-loading-spinner-wrap.hidden { display: none; }
.one-file-master-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
}
.one-file-master-loading-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #c4b5fd;
    margin: 0;
}

.loading-bar-indeterminate {
    height: 6px;
    width: 100%;
    max-width: 240px;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
}
.loading-bar-indeterminate::after {
    content: '';
    display: block;
    height: 100%;
    width: 40%;
    background: #8b5cf6;
    border-radius: 4px;
    animation: loading-bar-shuttle 1.2s ease-in-out infinite;
}
@keyframes loading-bar-shuttle {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}
#mastering-loading-block .loading-block-inner { margin-top: 8px; }

/* Chat (shared section) */
.chat-section { margin-bottom: 24px; }
.chat-section.chat-attached {
    margin-top: 20px;
    padding-top: 0;
    border-top: none;
}
.chat-wrap { margin-top: 0; }
.chat-wrap.chat-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    animation: chat-card-in 0.35s ease-out;
}
@keyframes chat-card-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.chat-wrap h4 { font-size: 1.05rem; margin-bottom: 8px; font-weight: 600; }
.iterate-card .chat-header-right { text-align: right; margin-bottom: 12px; }
.iterate-card .chat-header-right .chat-purpose { margin-bottom: 0; }
.step3-chat-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.step3-chat-header-row h4 { margin: 0; }
.chat-purpose {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    line-height: 1.4;
}
.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 12px;
}
.quick-prompts .quick-prompt,
#view-mastering .quick-prompts .quick-prompt-mastering {
    font-size: 0.85rem;
    padding: 14px 16px;
    min-height: 44px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.quick-prompts .quick-prompt:hover,
#view-mastering .quick-prompts .quick-prompt-mastering:hover {
    transform: scale(1.02);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3), 0 0 12px rgba(139, 92, 246, 0.2);
}
.quick-prompts .quick-prompt:focus-visible,
#view-mastering .quick-prompts .quick-prompt-mastering:focus-visible {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}
.chat-messages {
    min-height: 72px;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-messages .msg {
    margin-bottom: 8px;
    animation: chat-msg-in 0.25s ease-out;
}
@keyframes chat-msg-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.chat-messages .msg.user { color: #a78bfa; }
.chat-messages .msg.bot { color: #94a3b8; }
.josh-transparency-wrap {
    margin-top: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(0,0,0,0.2);
}
.josh-transparency-wrap.hidden { display: none; }
.josh-transparency-toggle {
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    background: transparent;
    border: none;
    color: #a78bfa;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.josh-transparency-toggle:hover { background: rgba(139,92,246,0.1); }
.josh-transparency-toggle[aria-expanded="true"]::after { content: '−'; }
.josh-transparency-toggle[aria-expanded="false"]::after { content: '+'; }
.josh-transparency-body {
    padding: 0 14px 12px;
}
.josh-transparency-body.collapsed { display: none; }
.josh-transparency-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.6;
}
.josh-transparency-list .josh-transparency-step-label {
    font-weight: 600;
    color: #a78bfa;
    margin-top: 0.5em;
    list-style: none;
    margin-left: -1.25rem;
}
.josh-transparency-list .josh-transparency-step-label:first-child { margin-top: 0; }
.chat-input-wrap {
    display: flex;
    gap: 10px;
}
#chat-input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#chat-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
#chat-input::placeholder { color: #94a3b8; }

/* Advanced – tabs */
.advanced-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}
.adv-tab {
    padding: 8px 16px;
    border: none;
    background: rgba(255,255,255,0.05);
    color: #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.adv-tab.active { background: #8b5cf6; color: #fff; }
.adv-tab:not(.active):hover { background: rgba(255,255,255,0.1); }
.adv-panel { margin-bottom: 16px; }
.adv-panel.active { display: block; }
.slider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.slider-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.slider-row label {
    font-size: 0.8rem;
    opacity: 0.9;
}
.slider-row input[type="range"] {
    width: 100%;
    accent-color: #8b5cf6;
}
.slider-row .value {
    font-size: 0.8rem;
    color: #a78bfa;
}
.preset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
}
.preset-actions .btn-small,
.preset-actions input,
.preset-actions select {
    height: 36px;
    line-height: 1;
}
#preset-name-input {
    width: 140px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 0.9rem;
}
#load-preset-select {
    width: 160px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 0.9rem;
}

/* Before/After playback card – shared in both Simple and Advanced */
.playback-section { margin-bottom: 24px; }
.josh-section .josh-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #c4b5fd;
    margin: 0 0 8px 0;
}
.josh-section .josh-section-position {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    margin: 0 0 14px 0;
}
.josh-section .chat-wrap {
    margin-top: 20px;
}
/* Step 3: one unified card (Before/After + Refine with Josh) */
.step3-unified-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    margin-top: 12px;
    transition: box-shadow 0.3s ease;
}
.step3-unified-card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.playback-section .step3-unified-card .before-after-card-header {
    justify-content: flex-end;
    margin-bottom: 14px;
}
.playback-section .step3-unified-card .before-after-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 20px 0;
    margin-top: 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.playback-section .step3-unified-card .chat-wrap.chat-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 20px 0 0;
    animation: none;
}

.playback-section.shared-playback .before-after-card {
    padding: 20px;
    border-radius: 16px;
}
.before-after-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.before-after-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}
.before-after-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}
.before-after-tabs {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 3px;
    flex-shrink: 0;
}
.before-after-tabs button {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: rgba(255,255,255,0.8);
    transition: background 0.2s ease, color 0.2s ease;
}
.before-after-tabs button.active {
    background: #fff;
    color: #111;
}
.before-after-tabs button:not(.active):hover { color: #fff; }
.before-after-tabs-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.btn-icon-info {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-icon-info:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}
/* Toast notifications: appear from the info button you clicked */
.toast {
    pointer-events: auto;
    padding: 14px 18px;
    max-width: min(420px, calc(100vw - 32px));
    background: rgba(20, 20, 25, 0.97);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.95);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: toast-in 0.25s ease-out;
}
.toast-anchored {
    position: fixed;
    z-index: 9999;
}
.toast p { margin: 0 0 8px 0; }
.toast p:last-child { margin-bottom: 0; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.mixer-collapsible-header-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.mixer-collapsible-header-wrap .mixer-collapsible-header { flex: 1; }
.mixer-info-btn { flex-shrink: 0; }
.before-after-instruction,
.before-after-building {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.65);
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.35;
}
.before-after-play-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 8px 0;
}
.before-after-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.before-after-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.45), 0 4px 20px rgba(16, 185, 129, 0.4);
}
.before-after-play-btn.playing {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}
.before-after-play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.before-after-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    width: 100%;
}
.before-after-time,
.before-after-duration {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    min-width: 40px;
    font-variant-numeric: tabular-nums;
}
.before-after-duration { text-align: right; }
.before-after-progress {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    outline: none;
}
.before-after-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}
.before-after-progress::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    border: none;
}
.before-after-progress::-webkit-slider-runnable-track,
.before-after-progress::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.2);
}

/* Mixer collapsible (Step 3) */
.mixer-collapsible {
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    background: rgba(0,0,0,0.2);
    overflow: hidden;
}
.mixer-collapsible-header {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}
.mixer-collapsible-header::before {
    content: '\25B8';
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}
.mixer-collapsible:not(.collapsed) .mixer-collapsible-header::before {
    transform: rotate(90deg);
}
.mixer-collapsible-header:hover { background: rgba(255,255,255,0.05); }
.mixer-collapsible-body {
    padding: 0 16px 16px;
}
.mixer-collapsible.collapsed .mixer-collapsible-body {
    display: none;
}

/* Mixer – horizontal sound board with vertical faders */
.mixer-hint {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 16px;
}
.mixer-hint-live { margin-bottom: 12px; }
.mixer-strips {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 340px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 12px;
    scroll-behavior: smooth;
    width: 100%;
    contain: layout paint;
}
.mixer-strips::-webkit-scrollbar { height: 8px; }
.mixer-strips::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); border-radius: 4px; }
.mixer-strips::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.5); border-radius: 4px; }
.mixer-strips::-webkit-scrollbar-thumb:hover { background: #8b5cf6; }
.mixer-strip {
    flex: 0 0 auto;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 10px;
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    will-change: transform;
    contain: layout;
}
.mixer-strip-name-wrap {
    margin-bottom: 10px;
    text-align: center;
    min-width: 0;
    width: 100%;
}
.mixer-strip-name {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    color: rgba(255,255,255,0.9);
}
.mixer-strip-analysis {
    display: block;
    font-size: 0.65rem;
    color: rgba(148, 163, 184, 0.9);
    margin-top: 2px;
}
.mixer-strip-fader {
    height: 132px;
    width: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 3px;
    margin-right: 3px;
    margin-bottom: 12px;
}
.mixer-strip-fader input[type="range"] {
    width: 132px;
    height: 24px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    transform: rotate(-90deg);
    transform-origin: center center;
}
.mixer-strip-fader input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.2);
}
.mixer-strip-fader input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}
.mixer-strip-fader input[type="range"]::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.2);
}
.mixer-strip-fader input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}
.mixer-strip-pan {
    width: 100%;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.mixer-pan-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.5);
}
.mixer-strip-pan input[type="range"] {
    width: 100%;
    height: 6px;
    accent-color: #8b5cf6;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}
.mixer-strip-pan input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #a78bfa;
    cursor: pointer;
}
.mixer-fx-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}
.mixer-fx-slot {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    position: relative;
    width: 100%;
    justify-content: center;
}
.mixer-fx-slot.disabled .mixer-fx-power,
.mixer-fx-slot.disabled .mixer-fx-name {
    background: rgba(255,255,255,0.04);
    color: #666;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.08);
    opacity: 0.5;
    pointer-events: none;
}
.mixer-fx-slot.disabled .mixer-fx-name:hover {
    border-color: rgba(255,255,255,0.08);
}
.mixer-fx-power {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 4px;
    background: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.5);
    font-size: 0.7rem;
    cursor: pointer;
    flex-shrink: 0;
}
.mixer-fx-power[aria-pressed="true"] {
    color: #8b5cf6;
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.25);
}
.mixer-fx-name {
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(139, 92, 246, 0.2);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 52px;
}
.mixer-fx-name:hover {
    border-color: #8b5cf6;
}
.mixer-fx-mini-panel {
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 4px;
    top: auto;
    z-index: 100;
    min-width: 160px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: #1a1a1a;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.mixer-fx-mini-bg {
    width: 100%;
    height: 60px;
    border-radius: 6px;
    margin-bottom: 10px;
    background-size: cover;
    background-position: center;
    background-color: rgba(0,0,0,0.4);
}
.mixer-fx-mini-bg-eq {
    background-image: url("/assets/JoshEQ%20Interface.png");
}
.mixer-fx-mini-bg-comp {
    background-image: url("/assets/JoshSquash%20Interface.png");
}
.mixer-fx-mini-knobs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.9);
}
.mixer-fx-mini-knobs label { min-width: 36px; }
.mixer-fx-mini-knobs input[type="range"] {
    width: 70px;
    accent-color: #8b5cf6;
}
.mixer-fx-btn {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(139, 92, 246, 0.2);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.mixer-fx-btn.on {
    background: #8b5cf6;
    border-color: #8b5cf6;
}
.mixer-fx-btn.disabled {
    background: rgba(255,255,255,0.04);
    color: #666;
    cursor: not-allowed;
    border-color: rgba(255,255,255,0.08);
    opacity: 0.5;
    pointer-events: none;
}
.mixer-fx-btn:not(.disabled):hover { border-color: #8b5cf6; }

.mixer-solo-mute-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
}
.mixer-solo-mute-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.mixer-solo-mute-btn:hover {
    border-color: #8b5cf6;
    color: #fff;
}
.mixer-solo-mute-btn[aria-pressed="true"] {
    background: rgba(139, 92, 246, 0.35);
    border-color: #8b5cf6;
    color: #c4b5fd;
}

.mixer-fx-popover {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 10px;
    bottom: 100%;
    margin-bottom: 4px;
    top: auto;
    z-index: 100;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.mixer-fx-popover .row { margin-bottom: 6px; }
.mixer-fx-popover .row label { display: inline-block; width: 70px; }
.mixer-fx-popover input[type="range"] { width: 80px; accent-color: #8b5cf6; }

/* Automation panel per strip */
.mixer-automation-panel {
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.7rem;
}
.automation-curve-header {
    margin-bottom: 4px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}
.automation-keyframes { margin-bottom: 8px; }
.automation-keyframe-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}
.automation-keyframe-row input[type="number"] {
    width: 36px;
    padding: 2px 4px;
    font-size: 0.7rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    color: #fff;
}
.automation-keyframe-row button.mixer-fx-btn { padding: 2px 6px; font-size: 0.65rem; }
.mixer-automation-panel .btn-small { margin-top: 4px; margin-right: 6px; }

/* Export */
.export-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding-top: 8px;
}
.undo-redo { display: flex; gap: 10px; }
.undo-redo-above-chat { margin-bottom: 12px; }
.export-section .btn-small { height: 36px; }
.mastered-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.mastering-status {
    margin: 8px 0 4px;
    font-size: 0.95rem;
    opacity: 0.9;
}
.mastering-loading-estimate {
    margin: 0 0 10px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
}
.mastering-progress-track {
    height: 6px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.mastering-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
    border-radius: 3px;
    transition: width 0.25s ease;
}

/* Mastering view */
.mastering-workspace { padding: 0; }
.mastering-top-bar {
    margin-bottom: 16px;
    display: flex;
    justify-content: flex-start;
}
.mastering-intro { margin-bottom: 24px; }
.mastering-intro h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.mastering-sub { font-size: 1rem; opacity: 0.9; }
.mastering-unified-card { margin-top: 12px; }
.mastering-player-section { margin-bottom: 0; }
.mastering-card { margin-bottom: 0; }
.mastering-workspace .step3-unified-card .mastering-controls-collapsible {
    margin-bottom: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
}
.mastering-workspace .step3-unified-card .mastering-player-section .before-after-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: none;
    padding: 20px;
    margin-top: 0;
    border-radius: 12px;
    border-bottom: none;
    overflow: hidden;
}
.mastering-workspace .step3-unified-card .chat-section.mastering-chat-section {
    margin-top: 0;
    margin-bottom: 0;
}
.mastering-workspace .step3-unified-card .chat-wrap.chat-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 20px 0 0;
}
.mastering-controls-collapsible {
    margin-bottom: 24px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    background: rgba(0,0,0,0.2);
    overflow: hidden;
}
.mastering-controls-header {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mastering-controls-header::before {
    content: '\25B8';
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}
.mastering-controls-collapsible:not(.collapsed) .mastering-controls-header::before {
    transform: rotate(90deg);
}
.mastering-controls-header:hover { background: rgba(255,255,255,0.05); }
.mastering-controls-body { padding: 0 16px 16px; }
.mastering-controls-collapsible.collapsed .mastering-controls-body { display: none; }
.mastering-controls-hint {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 14px;
}
.mastering-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 640px) {
    .mastering-controls-grid { grid-template-columns: 1fr; }
}
.mastering-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.mastering-controls-row label { min-width: 110px; font-size: 0.9rem; }
.mastering-controls-row input[type="range"] { flex: 1; max-width: 200px; accent-color: #8b5cf6; }
.mastering-controls-value { min-width: 44px; font-size: 0.85rem; color: #a78bfa; }
.mastering-knob-input-sync {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    pointer-events: none;
}
.rotary-knob {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}
.rotary-knob:active { cursor: grabbing; }
.rotary-knob-dial {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
}
.rotary-knob-needle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 3px;
    height: 22px;
    margin-left: -1.5px;
    margin-top: -22px;
    background: linear-gradient(to top, #8b5cf6, #a78bfa);
    border-radius: 2px;
    transform-origin: 50% 100%;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}
.mastering-knobs-row {
    display: flex;
    gap: 24px;
    align-items: flex-end;
}
.mastering-knob-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.mastering-knob-wrap label { font-size: 0.9rem; font-weight: 600; }
.mastering-knob { width: 64px; accent-color: #8b5cf6; }
.mastering-knob-label { font-size: 0.8rem; color: #a78bfa; min-width: 3em; text-align: center; }
.waveform-wrap-mastering {
    width: 100%;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.25);
    cursor: grab;
    touch-action: none;
}
.waveform-canvas-mastering {
    display: block;
    width: 100%;
    height: 70px;
    border-radius: 8px;
}
.mastering-download-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1); }
.mastering-download-section h3 { font-size: 1.25rem; margin-bottom: 8px; }
.mastering-download-sub { font-size: 0.95rem; opacity: 0.85; margin-bottom: 16px; }

.slowed-reverb-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1); }
.slowed-reverb-section h3 { font-size: 1.25rem; margin-bottom: 8px; }
.slowed-reverb-section h4 { font-size: 1.1rem; margin-bottom: 8px; }
.slowed-reverb-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(139, 92, 246, 0.95);
    background: rgba(139, 92, 246, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 12px;
}
.slowed-reverb-section #btn-generate-slowed-reverb { margin-bottom: 20px; }
.slowed-reverb-download-wrap {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.slowed-reverb-download-wrap h4,
.slowed-reverb-download-wrap .mastering-download-sub {
    flex: 1 1 100%;
    margin-bottom: 0;
}
.slowed-reverb-download-wrap .mastering-download-sub {
    margin-bottom: 0;
}
.slowed-reverb-download-wrap [data-save-to-project] {
    margin-left: 0;
    margin-top: 0;
}
.slowed-reverb-section > [data-save-to-project] {
    display: inline-flex;
    margin-top: 10px;
    margin-left: 0;
}

.slowed-reverb-unified-card { margin-top: 12px; }
.slowed-reverb-section .slowed-reverb-unified-card .mastering-player-section .before-after-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: none;
}
.slowed-reverb-section .slowed-reverb-unified-card .chat-section.slowed-reverb-chat-section {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    border-top: none;
}
.slowed-reverb-section .slowed-reverb-unified-card .chat-wrap.chat-card {
    background: transparent;
    border: none;
    box-shadow: none;
}
.slowed-reverb-chat-section { margin-top: 0; padding-top: 0; border-top: none; }
#chat-messages-slowed-reverb {
    min-height: 72px;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.06);
}
#chat-messages-slowed-reverb .msg { margin-bottom: 8px; }
#chat-messages-slowed-reverb .msg.user { color: #a78bfa; }
#chat-messages-slowed-reverb .msg.bot { color: #94a3b8; }
#view-mastering .quick-prompt-slowed-reverb {
    font-size: 0.85rem;
    padding: 14px 16px;
    min-height: 44px;
}
#chat-input-slowed-reverb {
    flex: 1;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: 0.95rem;
}
#chat-input-slowed-reverb:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.mastered-label { font-size: 0.95rem; font-weight: 600; margin-right: 8px; }

/* Mastering chat – on-brand (same visual language as mixing chat) */
#chat-messages-mastering {
    min-height: 72px;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.06);
}
#chat-messages-mastering .msg { margin-bottom: 8px; }
#chat-messages-mastering .msg.user { color: #a78bfa; }
#chat-messages-mastering .msg.bot { color: #94a3b8; }
#view-mastering .chat-input-wrap {
    display: flex;
    gap: 10px;
}
#chat-input-mastering {
    flex: 1;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#chat-input-mastering:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
#chat-input-mastering::placeholder { color: #94a3b8; }
#view-mastering .quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 12px;
}
#view-mastering .quick-prompt-mastering {
    font-size: 0.85rem;
    padding: 14px 16px;
    min-height: 44px;
}

/* Manage Subscription view */
.manage-subscription-section {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: left;
}
.manage-subscription-section h1 { font-size: 1.75rem; color: #8b5cf6; margin-bottom: 8px; }
.manage-subscription-sub { color: #94a3b8; font-size: 0.95rem; margin-bottom: 24px; }
.manage-subscription-section label { display: block; margin-bottom: 8px; font-size: 0.95rem; }
.manage-subscription-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1rem;
    margin-bottom: 16px;
    box-sizing: border-box;
}
.manage-subscription-input::placeholder { color: #94a3b8; }
.manage-subscription-verify { margin-bottom: 8px; }
.manage-subscription-error {
    color: #f87171;
    font-size: 0.9rem;
    margin-top: 8px;
    margin-bottom: 8px;
}
.manage-subscription-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.manage-subscription-actions .btn {
    display: block;
    width: 100%;
    margin-bottom: 16px;
    text-align: center;
}
.manage-subscription-actions .btn-cancel-subscription {
    display: block;
    width: 100%;
    background: #dc2626;
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}
.manage-subscription-actions .btn-cancel-subscription:hover {
    background: #b91c1c;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 24px;
}
.footer a:not(.site-social-link) { color: #94a3b8; text-decoration: none; font-size: 0.9rem; }
.footer a:not(.site-social-link):hover { color: #8b5cf6; }

/* Contact Support modal (app) */
.contact-modal-app {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}
.contact-modal-app-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    margin: 5% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.contact-modal-app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.contact-modal-app-header h3 {
    color: #8b5cf6;
    margin: 0;
    font-size: 1.5rem;
}
.contact-modal-app-close {
    color: #999;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}
.contact-modal-app-close:hover { color: #fff; }
.contact-modal-app-body { padding: 30px; }
.contact-modal-app .form-group { margin-bottom: 25px; }
.contact-modal-app .form-group label {
    display: block;
    color: #fff;
    margin-bottom: 8px;
    font-weight: 500;
}
.contact-modal-app .form-group input,
.contact-modal-app .form-group textarea,
.contact-modal-app .form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1rem;
    transition: all 0.2s ease;
}
.contact-modal-app .form-group select option { background: #2d2d2d; color: #fff; }
.contact-modal-app .form-group input:focus,
.contact-modal-app .form-group textarea:focus,
.contact-modal-app .form-group select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}
.contact-modal-app .form-group textarea {
    resize: vertical;
    min-height: 100px;
}
.contact-modal-app-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}
.contact-modal-app .cancel-btn,
.contact-modal-app .submit-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}
.contact-modal-app .cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.contact-modal-app .cancel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.contact-modal-app .submit-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: #fff;
}
.contact-modal-app .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

/* Auth overlay: blur app until logged in (full viewport to avoid slit).
   Top padding clears fixed header so the login modal is never cut off. */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 20px 40px 20px;
    box-sizing: border-box;
}
.auth-overlay.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (max-width: 768px) {
    .auth-overlay {
        align-items: flex-start;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 88px 14px 24px 14px;
        -webkit-overflow-scrolling: touch;
    }
    .login-modal {
        max-height: 88vh;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 22px 18px;
        margin: 12px auto 32px;
        box-sizing: border-box;
    }
    .login-modal h2 {
        font-size: 1.35rem;
        line-height: 1.25;
    }
    .buy-button {
        padding: 14px 18px;
        letter-spacing: 1px;
        font-size: 1rem;
    }
    body {
        padding-top: 72px;
    }
    .view {
        padding-left: 12px;
        padding-right: 12px;
    }
    .workspace {
        padding-left: 0;
        padding-right: 0;
    }
    .quick-prompt-chips {
        gap: 8px;
    }
    .chat-compose,
    .export-section,
    .mastering-download-section {
        flex-wrap: wrap;
    }
}

.login-modal {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-modal h2 { margin-bottom: 8px; font-size: 1.5rem; }
.login-modal .login-welcome { color: #e2e8f0; font-size: 0.95rem; margin-bottom: 16px; line-height: 1.5; }
.login-modal .login-hint { color: #94a3b8; font-size: 0.9rem; margin-bottom: 20px; }
.login-modal label { display: block; margin-bottom: 6px; font-size: 0.9rem; }
.login-modal input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1rem;
}
.login-modal input::placeholder { color: #94a3b8; }
.login-modal form button[type="submit"] { width: 100%; margin-top: 8px; }
.login-modal .login-trial-copy {
    text-align: center;
    margin: 24px 0 12px;
    font-size: 1rem;
    color: #e2e8f0;
}
.login-preview-wrap {
    text-align: center;
    margin-top: 20px;
}

.login-forgot-wrap {
    text-align: center;
    margin: 12px 0 0;
}

.login-forgot-link {
    border: none;
    background: transparent;
    color: #a78bfa;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0;
}

.login-forgot-link:hover,
.login-forgot-link:focus-visible {
    color: #c4b5fd;
    outline: none;
}

.forgot-license-panel .btn {
    width: 100%;
    margin-top: 8px;
}

.forgot-license-message {
    margin: 12px 0 0;
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.45;
    text-align: center;
}

.buy-button {
    border: none;
    padding: 16px 40px;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    display: block;
    text-align: center;
}
.buy-button-preview {
    background: #facc15;
    color: #000;
    font-size: 1.1rem;
    text-transform: uppercase;
    box-shadow: 0 8px 20px rgba(250, 204, 21, 0.35);
}
.buy-button-preview:hover {
    background: #fde047;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(250, 204, 21, 0.45);
}
.buy-button-preview .buy-button-preview-main {
    display: block;
}
.buy-button-preview .buy-button-preview-catch {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 4px;
    opacity: 0.9;
}

.buy-button-trial {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
    width: 100%;
    display: block;
}
.buy-button-trial:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Pre-checkout modal must sit above auth overlay (999); keep below fixed header */
.precheckout-modal-app {
    z-index: 1100;
    align-items: flex-start;
    padding-top: 100px;
    overflow-y: auto;
    justify-content: center;
}
.precheckout-modal-app .email-modal-app-header {
    flex-wrap: wrap;
    gap: 8px;
}
.precheckout-modal-app .email-modal-app-header h3 {
    font-size: 1.05rem;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

.plan-picker-modal {
    z-index: 1095;
    align-items: flex-start;
    padding-top: 88px;
    overflow-y: auto;
}
.plan-picker-content {
    max-width: 520px;
    width: 100%;
}
.plan-picker-intro {
    margin-bottom: 16px;
}
.plan-picker-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}
.plan-picker-option {
    display: block;
    cursor: pointer;
    margin: 0;
}
.plan-picker-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.plan-picker-card {
    display: block;
    position: relative;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.25);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.plan-picker-option.is-selected .plan-picker-card,
.plan-picker-option input:checked + .plan-picker-card {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.12);
}
.plan-picker-option-popular .plan-picker-card {
    padding-top: 22px;
}
.plan-picker-badge {
    position: absolute;
    top: -10px;
    left: 16px;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 999px;
}
.plan-picker-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 4px;
}
.plan-picker-price-today {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #34d399;
    margin: 6px 0 4px;
    letter-spacing: -0.02em;
}
.plan-picker-after-trial {
    display: block;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #94a3b8;
    font-weight: 500;
}
.plan-picker-actions {
    justify-content: stretch;
}
.plan-picker-actions .btn-primary {
    width: 100%;
}

/* Email signup modal (before download) */
.email-modal-app {
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.email-modal-app-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.email-modal-app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.email-modal-app-header h3 { margin: 0; font-size: 1.25rem; color: #8b5cf6; }
.email-modal-app-close {
    font-size: 1.75rem;
    color: #94a3b8;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 4px;
    line-height: 1;
    line-height: 1;
}
.email-modal-app-close:hover { color: #fff; }
.email-modal-app-body { padding: 24px; }
.email-modal-app-body label { display: block; margin-bottom: 8px; font-size: 0.95rem; }
.email-modal-app-body input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1rem;
}
.email-modal-app-p { font-size: 1rem; line-height: 1.5; margin-bottom: 12px; opacity: 0.95; }
.email-modal-app-coming { font-size: 0.95rem; opacity: 0.85; margin-bottom: 24px; }
.email-modal-app-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.email-modal-app-note { font-size: 0.85rem; color: #94a3b8; font-style: italic; line-height: 1.4; }
.email-modal-app-consent { font-size: 0.8rem; color: #94a3b8; line-height: 1.4; margin: 8px 0 12px; }
.email-modal-app-error { font-size: 0.85rem; color: #f87171; margin-top: 8px; }

/* Free download upsell reviews section */
.free-download-upsell-reviews {
    margin: 16px 0;
    max-height: 200px;
    overflow-y: auto;
}
.free-download-upsell-review {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.free-download-upsell-review:last-child { margin-bottom: 0; }
.free-download-upsell-review-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.free-download-upsell-review-name {
    font-weight: 600;
    color: #f8fafc;
    font-size: 0.9rem;
}
.free-download-upsell-review-stars {
    color: #fbbf24;
    font-size: 0.85rem;
    letter-spacing: 1px;
}
.free-download-upsell-review-text {
    color: #cbd5e1;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0;
}
.free-download-upsell-review-active {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #34d399;
}
.free-download-upsell-review-active-dot {
    width: 6px;
    height: 6px;
    background: #34d399;
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.free-download-content,
.free-download-upsell-content {
    max-width: 440px;
}

/* Agent Mode production workflow */
.agent-mode-modal-content,
.megamix-setup-modal-content {
    max-width: 520px;
}
.megamix-setup-modal-content {
    max-width: 560px;
}
.megamix-setup-mode-fieldset {
    border: none;
    margin: 0 0 18px;
    padding: 0;
}
.megamix-setup-legend {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #cbd5e1;
    font-weight: 600;
}
.megamix-setup-mode-options {
    display: grid;
    gap: 10px;
}
.megamix-setup-mode-option {
    display: block;
    cursor: pointer;
}
.megamix-setup-mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.megamix-setup-mode-card {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.5);
    transition: border-color 0.15s, background 0.15s;
}
.megamix-setup-mode-option input:checked + .megamix-setup-mode-card {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.12);
}
.megamix-setup-mode-title {
    display: block;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 4px;
}
.megamix-setup-mode-desc {
    display: block;
    font-size: 0.88rem;
    color: #94a3b8;
    line-height: 1.4;
}
.megamix-setup-project-wrap {
    margin-bottom: 20px;
}
.megamix-setup-project-select {
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.6);
    color: #f1f5f9;
    font-size: 0.95rem;
}
.megamix-setup-project-hint {
    margin: 8px 0 0;
    font-size: 0.85rem;
    color: #64748b;
}
.megamix-setup-actions {
    margin-bottom: 0;
}
.megamix-project-gate-content {
    max-width: 420px;
}
.megamix-project-gate-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    margin: 12px 0;
}
.megamix-project-gate-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #f1f5f9;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.megamix-project-gate-item:hover,
.megamix-project-gate-item:focus-visible {
    border-color: rgba(139, 92, 246, 0.55);
    background: rgba(139, 92, 246, 0.12);
    outline: none;
}
.megamix-project-gate-play {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}
.megamix-project-gate-play:hover {
    background: rgba(139, 92, 246, 0.4);
    color: #f1f5f9;
    transform: scale(1.05);
}
.megamix-project-gate-play:active {
    transform: scale(0.95);
}
.megamix-project-gate-play.is-playing {
    background: rgba(139, 92, 246, 0.5);
    color: #fff;
}
.megamix-project-gate-play.is-loading {
    opacity: 0.6;
    pointer-events: none;
}
.megamix-project-gate-play--empty {
    background: rgba(255, 255, 255, 0.06);
    cursor: default;
    pointer-events: none;
}
.megamix-project-gate-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.megamix-project-gate-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.megamix-project-gate-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #94a3b8;
}
.megamix-project-gate-item-sub {
    font-size: 0.8rem;
    color: #94a3b8;
}
.megamix-project-gate-item-time {
    font-size: 0.75rem;
    color: #64748b;
}
.megamix-project-gate-item-time::before {
    content: '•';
    margin-right: 8px;
}
.megamix-project-gate-new-link {
    margin-top: 4px;
}
.megamix-project-gate-status {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #94a3b8;
}
.agent-workflow-panel {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(30, 41, 59, 0.9) 100%);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 24px;
}
.agent-workflow-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.agent-selected-tracks {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: rgba(15, 23, 42, 0.55);
}
.agent-selected-tracks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.agent-selected-tracks-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
}
.agent-selected-tracks-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #c4b5fd;
}
.agent-selected-tracks-loading.hidden {
    display: none;
}
.agent-project-pick-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.agent-project-pick-row.hidden {
    display: none;
}
.agent-project-pick-label {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
}
.agent-project-select {
    flex: 1 1 200px;
    min-width: 0;
    max-width: 100%;
    padding: 10px 36px 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.45);
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.92rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a78bfa' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.agent-project-select:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.75);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
.agent-project-select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.agent-selected-tracks.has-tracks .agent-project-pick-row,
.agent-selected-tracks.is-loading .agent-project-pick-row {
    display: none;
}
.agent-selected-tracks #agent-track-card-mount .voxswap-track-card {
    margin: 0;
}
body.agent-mode .upload-and-files-header {
    display: none;
}
.loading-spinner--small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}
.loading-spinner--inline {
    width: 14px;
    height: 14px;
    border-width: 2px;
    display: inline-block;
    vertical-align: -2px;
    margin-right: 6px;
}
.project-dropdown-loading {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}
.btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
}
.megamix-project-gate-status.is-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.tool-sidebar-project-row.is-loading .tool-sidebar-project-item {
    opacity: 0.7;
    pointer-events: none;
}
.tool-sidebar-project-row.is-loading .tool-sidebar-project-item::after {
    content: '';
    width: 14px;
    height: 14px;
    margin-left: auto;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
    flex-shrink: 0;
}
.tool-sidebar-project-row.is-loading .tool-sidebar-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.project-setup-save-btn.is-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loading-spin 0.8s linear infinite;
    vertical-align: -2px;
}
.agent-workflow-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.agent-workflow-title {
    margin: 0;
    font-size: 1.35rem;
    color: #e2e8f0;
}
.agent-workflow-badge {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.25);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 999px;
    padding: 3px 8px;
}
.agent-workflow-intro {
    margin: 0 0 14px;
    color: #94a3b8;
    font-size: 0.92rem;
    line-height: 1.5;
}
.agent-mix-goal-label {
    display: block;
    margin: 0 0 10px;
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.45;
}
.agent-workflow-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #cbd5e1;
}
.agent-workflow-optional {
    color: #64748b;
    font-weight: normal;
}
.agent-goal-input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.6);
    color: #f1f5f9;
    font-size: 0.95rem;
}
.agent-mix-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 16px;
}
.agent-mix-preset-btn {
    appearance: none;
    width: 100%;
    min-height: 44px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.12);
    color: #ddd6fe;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.agent-mix-preset-btn:hover,
.agent-mix-preset-btn:focus-visible {
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(167, 139, 250, 0.8);
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}
.agent-mix-preset-btn.is-selected {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.35);
}
.agent-mix-preset-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}
@media (max-width: 640px) {
    .agent-mix-presets {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.agent-goal-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}
.agent-workflow-steps {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: grid;
    gap: 6px;
}
.agent-workflow-steps.agent-workflow-steps--hidden {
    display: none;
}
.agent-workflow-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #64748b;
    padding: 6px 8px;
    border-radius: 6px;
}
.agent-workflow-step-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid currentColor;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}
.agent-workflow-step--active {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.1);
}
.agent-workflow-step--active .agent-workflow-step-icon {
    border-color: #a78bfa;
    animation: agent-pulse 1.2s ease-in-out infinite;
}
.agent-workflow-step--done {
    color: #86efac;
}
.agent-workflow-step--done .agent-workflow-step-icon {
    border-color: #86efac;
    background: #86efac;
    color: #0f172a;
}
.agent-workflow-step--done .agent-workflow-step-icon::after {
    content: '✓';
    font-weight: 700;
}
.agent-workflow-step--error {
    color: #fca5a5;
}
.agent-workflow-step--error .agent-workflow-step-icon {
    border-color: #f87171;
    background: #f87171;
    color: #0f172a;
}
.agent-workflow-step--error .agent-workflow-step-icon::after {
    content: '!';
    font-weight: 700;
}
@keyframes agent-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
.agent-workflow-status {
    margin: 0 0 12px;
    font-size: 0.92rem;
    color: #e2e8f0;
    min-height: 1.4em;
}
.agent-workflow-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
#agent-stop-split-btn {
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}
#agent-stop-split-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}
.agent-goal-input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
body.agent-mode #flow-step-upload,
body.agent-mode #upload-and-files,
body.agent-mode [data-project-library-mount] {
    display: none !important;
}
body.agent-mode #flow-step-mix,
body.agent-mode #panel-simple,
body.agent-mode #flow-step-refine,
body.agent-mode #playback-section,
body.agent-mode #flow-step-master,
body.agent-mode .export-section {
    display: none;
}
body.agent-mode.agent-refine-active #flow-step-refine,
body.agent-mode.agent-refine-active #playback-section {
    display: block;
}
.agent-mix-approval-modal .email-modal-app-content {
    max-width: 560px;
}
.agent-mix-approval-intro {
    margin: 0 0 16px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #cbd5e1;
}
.agent-mix-approval-player {
    margin-bottom: 18px;
}
.agent-mix-approval-modal .before-after-card {
    margin-top: 0;
}
.agent-mix-approval-modal .mix-waveform-wrap {
    margin: 8px 0 12px;
}
.agent-mix-approval-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.agent-mix-approve-btn {
    flex: 1 1 200px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 10px;
}
.agent-mix-approve-btn:hover {
    filter: brightness(1.08);
}
.agent-mix-deny-btn {
    flex: 1 1 160px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.55);
    color: #fca5a5;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 10px;
}
.agent-mix-deny-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fecaca;
}
.agent-master-approval-modal .email-modal-app-content {
    max-width: 560px;
}
.agent-master-approval-intro {
    margin: 0 0 16px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #cbd5e1;
}
.agent-master-approval-player {
    margin-bottom: 18px;
}
.agent-master-approval-modal .before-after-card {
    margin-top: 0;
}
.agent-master-approval-modal .waveform-wrap-mastering {
    margin: 8px 0 12px;
}
.agent-master-approval-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.agent-master-approve-btn {
    flex: 1 1 200px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 10px;
}
.agent-master-approve-btn:hover {
    filter: brightness(1.08);
}
.agent-master-deny-btn {
    flex: 1 1 160px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.55);
    color: #fca5a5;
    font-weight: 600;
    padding: 12px 18px;
    border-radius: 10px;
}
.agent-master-deny-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fecaca;
}
body.agent-mode.agent-master-refine-active #view-mastering,
body.agent-mode.agent-production-complete #view-mastering {
    display: none !important;
}
.agent-complete-workspace,
.agent-master-refine-workspace,
.agent-slowed-reverb-workspace {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 16px 40px;
}
.agent-complete-player-home,
.agent-master-refine-player-home {
    margin: 16px 0 20px;
}
.agent-complete-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}
.agent-complete-actions .btn {
    flex: 1 1 180px;
}
.agent-slowed-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.agent-slowed-reverb-section-mount .slowed-reverb-section {
    margin-top: 0;
}
.agent-master-refine-chat-mount .mastering-chat-section {
    margin-top: 20px;
}
.project-setup-exports {
    margin-top: 16px;
}
.project-setup-export-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.project-setup-export-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.2);
}
.project-setup-export-play {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.18);
    color: #f1f5f9;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}
.project-setup-export-play:hover,
.project-setup-export-play.is-playing {
    background: rgba(139, 92, 246, 0.38);
    border-color: rgba(167, 139, 250, 0.8);
}
.project-setup-export-play:disabled {
    opacity: 0.65;
    cursor: wait;
}
.project-setup-export-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.project-setup-export-name {
    font-weight: 600;
    color: #f8fafc;
    font-size: 0.9rem;
}
.project-setup-export-file {
    font-size: 0.78rem;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.agent-workflow-panel .mix-reference-block {
    margin-bottom: 14px;
}
.megamix-mode-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.55);
}
.megamix-mode-toolbar-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.megamix-mode-toolbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
}
.megamix-mode-toolbar-sub {
    font-size: 0.88rem;
    color: #94a3b8;
}
.megamix-agent-mode-btn {
    flex-shrink: 0;
    white-space: nowrap;
}
.agent-mode-badge-mastering {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 999px;
    padding: 4px 10px;
}
.agent-workflow-panel--mastering {
    margin-bottom: 18px;
}
.mastering-chat-hint {
    font-size: 0.88rem;
    color: #86efac;
    margin: 0 0 10px;
    padding: 8px 10px;
    background: rgba(34, 197, 94, 0.08);
    border-radius: 6px;
    border-left: 3px solid #86efac;
}

/* ===== Finish-in-chat session (agent mode redesign) ===== */
body.agent-mode .app-workspace-title,
body.agent-mode .app-workspace-lead,
body.agent-mode #megamix-mode-toolbar,
body.agent-mode #flow-step-upload,
body.agent-mode #upload-and-files,
body.agent-mode [data-project-library-mount],
body.agent-mode #flow-step-mix,
body.agent-mode #panel-simple,
body.agent-mode #flow-step-refine,
body.agent-mode #playback-section,
body.agent-mode #flow-step-master,
body.agent-mode .export-section,
body.agent-mode #agent-workflow-panel-mastering,
body.agent-mode #view-mastering,
body.agent-mode .finish-chat-stubs {
    display: none !important;
}
body.agent-mode #view-app.view {
    display: flex !important;
    flex-direction: column;
    min-height: calc(100vh - 120px);
    padding: 0;
}
body.agent-mode #view-app .workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}
body.agent-mode .finish-chat-panel,
body.agent-mode #agent-workflow-panel.finish-chat-panel {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
.finish-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: calc(100vh - 140px);
    max-height: calc(100vh - 100px);
    background: #0b1220;
}
.finish-chat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.finish-chat-title {
    margin: 0;
    font-size: 1.05rem;
    color: #f8fafc;
    font-weight: 700;
}
.finish-chat-sub {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #94a3b8;
}
.finish-chat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    -webkit-overflow-scrolling: touch;
}
.finish-chat-thread.is-drop {
    outline: 2px dashed #34d399;
    outline-offset: -8px;
    background: rgba(16,185,129,0.06);
}
.finish-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 42vh;
    text-align: center;
    padding: 24px 12px;
}
.finish-chat-empty.hidden { display: none; }
.finish-chat-empty-line {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #e2e8f0;
    max-width: 16em;
    line-height: 1.35;
}
.finish-chat-empty-attach {
    cursor: pointer;
}
.finish-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.finish-msg { display: flex; flex-direction: column; max-width: 100%; }
.finish-msg--user { align-items: flex-end; }
.finish-msg--bot { align-items: flex-start; }
.finish-msg-bubble {
    background: rgba(139,92,246,0.28);
    border: 1px solid rgba(196,181,253,0.35);
    color: #f8fafc;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    max-width: 90%;
}
.finish-msg-line {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.45;
    margin: 0 0 8px;
    max-width: 92%;
}
.finish-msg-line--check {
    white-space: pre-line;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    padding: 10px 12px;
}
.finish-outcomes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 8px;
}
.finish-outcome-btn {
    appearance: none;
    border: 1px solid rgba(52,211,153,0.45);
    background: rgba(16,185,129,0.12);
    color: #6ee7b7;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}
.finish-outcome-btn:hover { background: rgba(16,185,129,0.22); color: #fff; }

.finish-outcomes .finish-card-secondary {
    border: 1px solid rgba(167, 139, 250, 0.45);
    background: transparent;
    color: #ddd6fe;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.85rem;
    cursor: pointer;
}
.finish-outcomes .finish-card-secondary:hover {
    background: rgba(167, 139, 250, 0.15);
    color: #fff;
}

.finish-chat-composer {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(10,15,26,0.96);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
}
.finish-chat-composer-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.finish-chat-attach {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    font-size: 1.1rem;
}
.finish-chat-input {
    flex: 1;
    min-width: 0;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: #f8fafc;
    padding: 0 12px;
    font-size: 1rem;
}
.finish-chat-input:focus {
    outline: none;
    border-color: rgba(52,211,153,0.55);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.finish-chat-send {
    flex: 0 0 auto;
    height: 42px;
    padding: 0 16px;
    white-space: nowrap;
}
.finish-chat-hint {
    margin: 6px 2px 0;
    font-size: 0.75rem;
    color: #64748b;
}
@media (max-width: 600px) {
    body.agent-mode #view-app.view { min-height: calc(100vh - 96px); }
    .finish-chat { min-height: calc(100vh - 110px); max-height: none; }
    .finish-chat-top { padding: 12px 12px 8px; }
    .finish-chat-sub { display: none; }
    .finish-chat-send { padding: 0 14px; }
}

/* Finish-chat CTAs: MegaMix green (marketing match), not purple */
.finish-chat .btn-primary,
.finish-chat-empty-attach.btn-primary,
.finish-chat-send.btn-primary {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}
.finish-chat .btn-primary:hover,
.finish-chat-empty-attach.btn-primary:hover,
.finish-chat-send.btn-primary:hover {
    background: linear-gradient(135deg, #34d399, #10b981) !important;
}
.finish-msg-bubble {
    background: rgba(16,185,129,0.18);
    border-color: rgba(52,211,153,0.35);
}

/* ===== Finish-chat polish: modal-style audio cards ===== */
/* Same visual language as the "Review your AI mix/master" approve/deny modals. */
.finish-audio-card {
    width: min(100%, 460px);
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    color: #e2e8f0;
}
.finish-audio-card.is-current {
    border-color: rgba(34, 197, 94, 0.35);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 24px rgba(34, 197, 94, 0.12);
}
.finish-audio-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.finish-audio-card-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.finish-audio-tag {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}
.finish-audio-card-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #8b5cf6;
    line-height: 1.25;
}
.finish-audio-current {
    display: none;
    flex-shrink: 0;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #86efac;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.45);
}
.finish-audio-card.is-current .finish-audio-current { display: inline-block; }
.finish-audio-card-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px 18px;
}
.finish-audio-card-note {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #cbd5e1;
}
.finish-card-details { margin: -8px 0 0; font-size: 0.78rem; color: #94a3b8; }
.finish-card-details summary {
    display: inline-flex; align-items: center; gap: 4px; cursor: pointer; list-style: none;
    color: #8b93a7; font-weight: 500; letter-spacing: 0.01em; user-select: none;
}
.finish-card-details summary::-webkit-details-marker { display: none; }
.finish-card-details summary::after { content: '›'; transition: transform 0.2s ease; display: inline-block; }
.finish-card-details[open] summary::after { transform: rotate(90deg); }
.finish-card-details summary:hover, .finish-card-details summary:focus-visible { color: #c4b5fd; outline: none; }
.finish-card-details ul { margin: 6px 0 0; padding: 0 0 0 14px; line-height: 1.5; }
.finish-card-details li { margin: 2px 0; }
.finish-player {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
}
.finish-player .finish-player-btn {
    flex: 0 0 48px;
    padding: 0;
    padding-left: 2px;
}
.finish-player .finish-player-btn.playing { padding-left: 0; }
.finish-player-main {
    flex: 1;
    min-width: 0;
}
.finish-player-wave-wrap {
    height: 56px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: visible;
    position: relative;
}
.finish-player-wave {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}
/* Speed Wheel (slowed + reverb cards): glass knob, 270deg arc, detent at 1.00x at the top */
.finish-speed {
    --speed-track: rgba(255, 255, 255, 0.09);
    --speed-fill: #a78bfa;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.finish-speed-wheel {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.finish-speed.is-dragging .finish-speed-wheel { cursor: grabbing; }
.finish-speed-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
    filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.35));
}
.finish-speed-detent {
    position: absolute;
    top: -4px;
    left: 50%;
    width: 2px;
    height: 4px;
    margin-left: -1px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.finish-speed.is-detent .finish-speed-detent { background: #ddd6fe; box-shadow: 0 0 6px rgba(167, 139, 250, 0.9); }
.finish-speed-knob {
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    background: radial-gradient(120% 120% at 30% 18%, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.06) 48%, rgba(10, 8, 24, 0.35) 100%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -8px 14px rgba(0, 0, 0, 0.28), 0 6px 16px rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    will-change: transform;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.finish-speed-pointer {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 3px;
    height: 11px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: #f5f3ff;
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.9);
}
.finish-speed-wheel:hover .finish-speed-knob,
.finish-speed.is-dragging .finish-speed-knob { border-color: rgba(196, 181, 253, 0.5); }
.finish-speed-wheel:focus-visible .finish-speed-knob {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -8px 14px rgba(0, 0, 0, 0.28), 0 0 0 3px rgba(167, 139, 250, 0.45);
}
.finish-speed-value {
    position: relative;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.72);
    transition: color 0.15s ease;
}
.finish-speed.is-pending .finish-speed-value { color: #c4b5fd; }
.finish-speed.is-pending .finish-speed-value::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    width: 5px;
    height: 5px;
    margin-top: -2.5px;
    border-radius: 50%;
    background: #a78bfa;
    box-shadow: 0 0 6px rgba(167, 139, 250, 0.9);
}
@media (max-width: 720px) {
    .finish-speed-wheel { width: 52px; height: 52px; }
}
.finish-player .before-after-progress { min-width: 0; }
.finish-player .finish-player-progress {
    margin-top: 8px;
    gap: 8px;
}
.finish-player .before-after-time,
.finish-player .before-after-duration {
    font-size: 0.75rem;
    min-width: 32px;
    color: rgba(255, 255, 255, 0.75);
}
.finish-player .before-after-progress { height: 6px; }
.finish-audio-card-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.finish-audio-card .finish-card-primary,
.finish-audio-card .finish-card-secondary {
    min-height: 44px;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: filter 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.finish-audio-card .finish-card-primary {
    flex: 1 1 170px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: #fff;
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.22);
}
.finish-audio-card .finish-card-primary:hover { filter: brightness(1.08); }
.finish-audio-card .finish-card-secondary {
    flex: 1 1 130px;
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.6);
    color: #ddd6fe;
}
.finish-audio-card .finish-card-secondary:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.24);
    color: #ede9fe;
}
.finish-audio-card .finish-card-secondary:disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    cursor: default;
}
.finish-ab-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    margin-top: 6px;
}
@media (min-width: 900px) {
    .finish-ab-row { grid-template-columns: 1fr 1fr; }
    .finish-ab-row .finish-audio-card { width: 100%; }
}
.finish-msg--working {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 0.9rem;
}
.finish-working-dots { display: inline-flex; gap: 4px; }
.finish-working-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    animation: finishDot 1.2s ease-in-out infinite;
}
.finish-working-dots i:nth-child(2) { animation-delay: 0.15s; }
.finish-working-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes finishDot {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* ===== Finish-chat polish: project rail (agent mode only) ===== */
body.agent-mode #tool-sidebar,
body.agent-mode #tool-sidebar-toggle,
body.agent-mode .tool-sidebar-toggle {
    display: none !important;
}
body.agent-mode .tool-app-shell {
    max-width: none;
    padding: 0;
}
body.agent-mode #view-app .workspace {
    max-width: 1180px;
}
.finish-shell {
    display: flex;
    flex: 0 0 auto;
    height: calc(100vh - 120px);
    min-height: 520px;
    background: #0b1220;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
}
.finish-shell .finish-chat {
    flex: 1;
    min-width: 0;
    min-height: 0;
    max-height: none;
}
.finish-rail {
    flex: 0 0 248px;
    width: 248px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: rgba(10, 10, 14, 0.96);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.finish-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px 8px 16px;
}
.finish-rail-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}
.finish-rail-new {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.finish-rail-new:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.finish-rail-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 12px;
}
.finish-rail-item {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.finish-rail-item:hover { background: rgba(255, 255, 255, 0.04); }
.finish-rail-item.is-active {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.08);
}
.finish-rail-item.is-active .finish-rail-name { color: #fff; }
.finish-rail-item:focus-visible {
    outline: 2px solid rgba(52, 211, 153, 0.6);
    outline-offset: 1px;
}
.finish-rail-cover {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
}
.finish-rail-art {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(30, 41, 59, 0.9));
    font-size: 1.1rem;
    color: #f8fafc;
}
.finish-rail-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.finish-rail-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.finish-rail-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.finish-rail-sub {
    margin-top: 2px;
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.finish-rail-sub.is-busy { color: #6ee7b7; }

/* Working animation: rotating light around the cover + soft breathing glow */
@property --finish-ring-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
.finish-rail-ring {
    position: absolute;
    inset: -3px;
    border-radius: 13px;
    padding: 2px;
    pointer-events: none;
    background: conic-gradient(from var(--finish-ring-angle),
        rgba(52, 211, 153, 0) 0deg,
        rgba(52, 211, 153, 0) 200deg,
        rgba(52, 211, 153, 0.9) 300deg,
        rgba(167, 139, 250, 0.95) 360deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    animation: finishRingSpin 1.6s linear infinite;
}
.finish-rail-cover.is-working .finish-rail-art {
    animation: finishArtBreath 2.4s ease-in-out infinite;
}
.finish-rail-eq {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    padding-bottom: 3px;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
    pointer-events: none;
}
.finish-rail-eq i {
    width: 3px;
    height: 9px;
    border-radius: 2px;
    background: #6ee7b7;
    transform-origin: bottom;
    animation: finishEq 0.9s ease-in-out infinite;
}
.finish-rail-eq i:nth-child(2) { animation-delay: 0.2s; }
.finish-rail-eq i:nth-child(3) { animation-delay: 0.4s; }
.finish-rail-cover.is-queued .finish-rail-ring {
    background: none;
    -webkit-mask: none;
    mask: none;
    padding: 0;
    border: 1.5px dashed rgba(167, 139, 250, 0.55);
    animation: finishQueuePulse 2.2s ease-in-out infinite;
}
.finish-rail-cover.is-queued .finish-rail-art { opacity: 0.75; }
@keyframes finishRingSpin { to { --finish-ring-angle: 360deg; } }
@keyframes finishArtBreath {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(52, 211, 153, 0); }
    50% { transform: scale(0.94); box-shadow: 0 0 16px rgba(52, 211, 153, 0.45); }
}
@keyframes finishEq {
    0%, 100% { transform: scaleY(0.35); }
    50% { transform: scaleY(1); }
}
@keyframes finishQueuePulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
    .finish-rail-ring,
    .finish-rail-cover.is-working .finish-rail-art,
    .finish-rail-eq i,
    .finish-working-dots i { animation: none !important; }
    .finish-rail-cover.is-working .finish-rail-art { box-shadow: 0 0 12px rgba(52, 211, 153, 0.45); }
}

/* Mobile: rail becomes a horizontal project switcher above the thread */
@media (max-width: 720px) {
    body.agent-mode.logged-in,
    body.agent-mode.logged-in.has-app-announcement { padding-top: 60px; }
    .finish-shell {
        flex-direction: column;
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        min-height: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .finish-rail {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .finish-rail-head {
        order: 2;
        padding: 8px 10px 8px 4px;
    }
    .finish-rail-title { display: none; }
    .finish-rail-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding: 8px 4px 8px 10px;
        scrollbar-width: none;
    }
    .finish-rail-list::-webkit-scrollbar { display: none; }
    .finish-rail-item {
        flex: 0 0 auto;
        width: auto;
        max-width: 150px;
        gap: 8px;
        padding: 4px 10px 4px 4px;
    }
    .finish-rail-cover { flex-basis: 34px; width: 34px; height: 34px; }
    .finish-rail-art { border-radius: 9px; }
    .finish-rail-ring { border-radius: 12px; }
    .finish-rail-name { font-size: 0.8rem; }
    .finish-rail-sub { font-size: 0.68rem; }
    .finish-shell .finish-chat { min-height: 0; }
    .finish-audio-card-header { padding: 12px 14px; }
    .finish-audio-card-body { padding: 14px; }
    .finish-player { padding: 12px; gap: 12px; }
}

/* ---- Finish chat: "+" picker (new mix/master chat vs Generate Sound Effects) ---- */
.finish-new-picker {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.finish-new-picker.hidden { display: none; }
.finish-new-picker-card {
    width: 100%;
    max-width: 420px;
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 16px;
    background: #0f172a;
    border: 1px solid rgba(139, 92, 246, 0.35);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    animation: finishPickerIn 0.16s ease-out;
}
@keyframes finishPickerIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.finish-new-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
}
.finish-new-picker-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f1f5f9;
}
.finish-new-picker-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.finish-new-picker-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.finish-new-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 72px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(30, 41, 59, 0.55);
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.finish-new-option:hover,
.finish-new-option:focus-visible {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.14);
    outline: none;
}
.finish-new-option:active { transform: scale(0.99); }
.finish-new-option--sfx:hover,
.finish-new-option--sfx:focus-visible {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
}
.finish-new-option-icon {
    flex: 0 0 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(139, 92, 246, 0.18);
    font-size: 1.35rem;
}
.finish-new-option--sfx .finish-new-option-icon { background: rgba(34, 197, 94, 0.16); }
.finish-new-option-copy { display: grid; gap: 3px; min-width: 0; }
.finish-new-option-title { font-weight: 650; font-size: 0.98rem; color: #f1f5f9; }
.finish-new-option-sub { font-size: 0.85rem; line-height: 1.35; color: #94a3b8; }
body.finish-picker-open { overflow: hidden; }

/* Inline chat buttons (Attach audio / Start free trial / + Start something new) */
.finish-msg .finish-inline-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    margin-right: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
.finish-msg .finish-inline-btn.finish-card-secondary {
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.6);
    color: #ddd6fe;
}
.finish-take-list {
    display: grid;
    gap: 12px;
    margin-top: 10px;
}
.finish-audio-card--sfx .finish-audio-tag { color: #86efac; }
.finish-chat-attach.hidden { display: none; }

@media (max-width: 720px) {
    .finish-new-picker {
        align-items: flex-end;
        padding: 0;
    }
    .finish-new-picker-card {
        max-width: none;
        border-radius: 18px 18px 0 0;
        padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        border-left: none;
        border-right: none;
        border-bottom: none;
        animation: finishSheetIn 0.2s ease-out;
    }
    @keyframes finishSheetIn {
        from { transform: translateY(100%); }
        to { transform: none; }
    }
}

/* Sound effect takes: compact cards so all three fit in view */
.finish-msg .finish-take-list { width: 100%; max-width: 580px; gap: 10px; }
.finish-take-list .finish-audio-card { width: 100%; border-radius: 14px; }
.finish-take-list .finish-audio-card-header { padding: 9px 14px; }
.finish-take-list .finish-audio-card-title { font-size: 1rem; }
.finish-take-list .finish-audio-card-note { display: none; }
.finish-take-list .finish-audio-card-body {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 12px;
}
.finish-take-list .finish-player { flex: 1 1 260px; min-width: 0; padding: 8px 10px; gap: 10px; }
.finish-take-list .finish-player-wave-wrap { height: 34px; }
.finish-take-list .finish-player-btn { width: 40px; height: 40px; min-width: 40px; font-size: 0.9rem; }
.finish-take-list .finish-audio-card-actions { flex: 0 0 auto; flex-direction: column; gap: 6px; }
.finish-take-list .finish-audio-card .finish-card-primary,
.finish-take-list .finish-audio-card .finish-card-secondary {
    flex: none;
    min-height: 36px;
    padding: 7px 14px;
    font-size: 0.85rem;
}
@media (max-width: 520px) {
    .finish-take-list .finish-audio-card-actions { flex-direction: row; width: 100%; }
    .finish-take-list .finish-audio-card .finish-card-primary,
    .finish-take-list .finish-audio-card .finish-card-secondary { flex: 1 1 0; }
}

/* ---- Unified project chat: mode chips, @ references ---- */
.finish-mode-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.finish-mode-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    margin-right: 2px;
}
.finish-mode-chip {
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.finish-mode-chip:hover:not(:disabled) { border-color: rgba(167, 139, 250, 0.6); color: #fff; }
.finish-mode-chip.is-on {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.2);
    color: #ede9fe;
}
.finish-mode-chip[data-mode="sfx"].is-on {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.16);
    color: #dcfce7;
}
.finish-mode-chip:disabled { opacity: 0.6; cursor: default; }

.finish-rail-mode {
    position: absolute;
    right: -4px;
    bottom: -4px;
    z-index: 3;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #0f172a;
    border: 1px solid rgba(34, 197, 94, 0.6);
    font-size: 0.62rem;
    line-height: 1;
}

.finish-chat-composer { position: relative; }
.finish-chat-mention {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #c4b5fd;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
}
.finish-chat-mention:hover:not(:disabled) { background: rgba(139, 92, 246, 0.18); color: #fff; }
.finish-chat-mention:disabled { opacity: 0.5; cursor: default; }

.finish-mention-menu {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(100% + 6px);
    z-index: 20;
    max-width: 420px;
    max-height: min(360px, 55vh);
    overflow-y: auto;
    padding: 6px;
    border-radius: 14px;
    background: #0f172a;
    border: 1px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}
.finish-mention-menu.hidden { display: none; }
.finish-mention-head {
    padding: 6px 8px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}
.finish-mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 6px 8px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.finish-mention-item:hover,
.finish-mention-item.is-active { background: rgba(139, 92, 246, 0.16); }
.finish-mention-art,
.finish-ref-art {
    position: relative;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.06);
    background-size: cover;
    background-position: center;
}
.finish-mention-art img,
.finish-ref-art img { width: 100%; height: 100%; object-fit: cover; }
.finish-mention-meta { display: grid; gap: 2px; min-width: 0; }
.finish-mention-name { font-weight: 600; font-size: 0.92rem; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finish-mention-sub { font-size: 0.76rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finish-mention-tip { padding: 8px 8px 4px; font-size: 0.74rem; color: #64748b; line-height: 1.35; }

.finish-ref-card {
    width: min(100%, 460px);
    margin-top: 8px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #e2e8f0;
}
.finish-ref-head { display: flex; align-items: center; gap: 10px; }
.finish-ref-art { flex-basis: 40px; width: 40px; height: 40px; }
.finish-ref-titles { min-width: 0; }
.finish-ref-name { font-weight: 700; color: #f8fafc; }
.finish-ref-mode { font-size: 0.78rem; color: #a5b4fc; }
.finish-ref-lines { margin: 10px 0 0; padding: 0 0 0 18px; display: grid; gap: 3px; font-size: 0.86rem; color: #cbd5e1; line-height: 1.4; }
.finish-ref-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.finish-ref-actions .btn {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}
.finish-ref-actions .finish-card-primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: #fff;
}
.finish-ref-actions .finish-card-secondary {
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(139, 92, 246, 0.6);
    color: #ddd6fe;
}

@media (max-width: 720px) {
    .finish-mode-chips { margin-top: 6px; }
    .finish-mode-label { display: none; }
    .finish-chat-mention { width: 38px; }
    .finish-chat-attach { width: 38px; }
    .finish-mention-menu { left: 8px; right: 8px; max-width: none; }
}

/* =====================================================================
   Finish chat — Round 7: glass UI + motion
   Palette stays MegaMix: deep navy, purple #8b5cf6, green #22c55e/#10b981.
   Blur only on a few surfaces (composer, rail, cards, menu); none on
   long lists on mobile. All motion is off under prefers-reduced-motion.
   ===================================================================== */
.finish-shell, body.agent-mode .finish-chat-panel {
    --mm-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --mm-glass: rgba(22, 24, 44, 0.55);
    --mm-glass-strong: rgba(17, 20, 38, 0.72);
    --mm-glass-border: rgba(255, 255, 255, 0.09);
    --mm-glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --mm-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
}
.finish-chat {
    background:
        radial-gradient(900px 420px at 12% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
        radial-gradient(700px 380px at 100% 110%, rgba(16, 185, 129, 0.10), transparent 60%),
        #0b1220;
}
.finish-chat-top {
    background: linear-gradient(180deg, rgba(11, 18, 32, 0.72), rgba(11, 18, 32, 0.35));
    border-bottom-color: var(--mm-glass-border);
}

/* Bubbles */
.finish-msg-bubble {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.34) 0%, rgba(109, 40, 217, 0.22) 55%, rgba(16, 185, 129, 0.16) 100%);
    border: 1px solid rgba(196, 181, 253, 0.28);
    box-shadow: var(--mm-glass-hi), 0 6px 20px rgba(76, 29, 149, 0.25);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
}
.finish-msg-line {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
    border: 1px solid var(--mm-glass-border);
    border-radius: 16px 16px 16px 4px;
    padding: 9px 13px;
    color: #dbe4f0;
    box-shadow: var(--mm-glass-hi);
}
.finish-msg-line--check {
    background: linear-gradient(160deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.04));
    border-color: rgba(52, 211, 153, 0.28);
}
.finish-msg--ai .finish-msg-line { border-color: rgba(167, 139, 250, 0.22); }

/* Chips (genre picks, quick actions, attach choices) */
.finish-outcome-btn,
.finish-prompt-chip {
    appearance: none;
    border: 1px solid rgba(52, 211, 153, 0.35);
    background: linear-gradient(160deg, rgba(16, 185, 129, 0.16), rgba(16, 185, 129, 0.06));
    color: #a7f3d0;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.1;
    cursor: pointer;
    box-shadow: var(--mm-glass-hi);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--mm-ease), box-shadow 0.2s ease;
}
.finish-outcome-btn:hover,
.finish-prompt-chip:hover:not(:disabled) {
    background: linear-gradient(160deg, rgba(16, 185, 129, 0.28), rgba(16, 185, 129, 0.12));
    border-color: rgba(110, 231, 183, 0.6);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--mm-glass-hi), 0 6px 16px rgba(16, 185, 129, 0.18);
}
.finish-outcome-btn:active, .finish-prompt-chip:active { transform: translateY(0) scale(0.98); }
.finish-genres .finish-genre-btn {
    border-color: rgba(167, 139, 250, 0.38);
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.07));
    color: #e9d5ff;
}
.finish-genres .finish-genre-btn:hover {
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.34), rgba(139, 92, 246, 0.14));
    border-color: rgba(196, 181, 253, 0.65);
    box-shadow: var(--mm-glass-hi), 0 6px 16px rgba(139, 92, 246, 0.22);
}

/* Composer + preset prompts */
.finish-chat-composer {
    position: relative;
    background: linear-gradient(180deg, rgba(15, 20, 38, 0.55), rgba(11, 18, 32, 0.82));
    border-top: 1px solid var(--mm-glass-border);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
}
.finish-chat-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--mm-glass-hi);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.finish-chat-input:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(167, 139, 250, 0.7);
    box-shadow: var(--mm-glass-hi), 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.finish-prompt-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding: 2px 2px 10px;
    margin: 0 -2px;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
}
.finish-prompt-chips::-webkit-scrollbar { display: none; }
@media (min-width: 1024px) {
    .finish-prompt-chips.is-wrap { flex-wrap: wrap; overflow-x: visible; -webkit-mask-image: none; mask-image: none; }
}
.finish-prompt-chips:empty { display: none; }
.finish-prompt-chip {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 7px 12px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
    border-color: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
}
.finish-prompt-chip.is-primary {
    border-color: rgba(52, 211, 153, 0.5);
    background: linear-gradient(160deg, rgba(16, 185, 129, 0.24), rgba(16, 185, 129, 0.08));
    color: #bbf7d0;
}
.finish-prompt-chips.is-busy .finish-prompt-chip { opacity: 0.45; cursor: default; }

/* Audio cards: glass, Approve / Deny / Adjust / Export */
.finish-audio-card {
    background: linear-gradient(150deg, rgba(36, 31, 64, 0.78) 0%, rgba(17, 24, 39, 0.7) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--mm-glass-hi), var(--mm-shadow);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    transition: border-color 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease, filter 0.35s ease;
}
.finish-audio-card-header { border-bottom-color: rgba(255, 255, 255, 0.07); }
.finish-audio-card.is-current { border-color: rgba(139, 92, 246, 0.35); box-shadow: var(--mm-glass-hi), var(--mm-shadow), 0 0 26px rgba(139, 92, 246, 0.12); }
.finish-audio-card.is-approved { border-color: rgba(34, 197, 94, 0.45); box-shadow: var(--mm-glass-hi), var(--mm-shadow), 0 0 26px rgba(34, 197, 94, 0.14); }
.finish-audio-card.is-denied { opacity: 0.62; filter: saturate(0.6); }
.finish-audio-card.is-denied:hover { opacity: 0.85; }
.finish-audio-badge {
    flex-shrink: 0;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.finish-audio-badge.is-approved { color: #86efac; background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(34, 197, 94, 0.45); }
.finish-audio-badge.is-denied { color: #fca5a5; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); }
.finish-review-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 10px !important;
}
.finish-audio-card .finish-review-approve,
.finish-audio-card .finish-review-deny,
.finish-review-actions .finish-card-export {
    min-height: 44px;
    padding: 11px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: filter 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.2s var(--mm-ease);
}
.finish-review-approve {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: #fff;
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.22);
}
.finish-review-deny {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.55);
    color: #fca5a5;
}
.finish-review-deny:hover:not(:disabled) { background: rgba(239, 68, 68, 0.22); color: #fecaca; }
.finish-review-approve:hover:not(:disabled) { filter: brightness(1.08); }
.finish-review-actions .finish-card-export {
    flex: none;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
    border: none;
    color: #fff;
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25) !important;
}
.finish-review-actions .btn:hover:not(:disabled) { transform: translateY(-1px); }
.finish-review-approve:disabled, .finish-review-deny:disabled {
    filter: none;
    opacity: 0.7;
    cursor: default;
    box-shadow: none;
}
.finish-audio-card.is-approved .finish-review-approve:disabled { background: rgba(34, 197, 94, 0.18); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.45); opacity: 1; }

/* Slowed + reverb: Approve and Deny share the row; Export WAV appears full width once approved */
.finish-review-actions.finish-review-actions--pair { grid-template-columns: 1fr 1fr; }
.finish-slowed-export { margin-top: 10px; }
.finish-slowed-export .finish-card-export {
    width: 100%;
    min-height: 46px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.28) !important;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.2s var(--mm-ease);
}
.finish-slowed-export .finish-card-export:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.finish-slowed-export.is-reveal { animation: mm-export-reveal 0.42s var(--mm-ease) both; }
@keyframes mm-export-reveal {
    from { opacity: 0; transform: translateY(-6px); max-height: 0; }
    to { opacity: 1; transform: none; max-height: 80px; }
}

/* Before / After toggle: one player, sliding thumb */
.finish-ba-toggle {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    align-self: flex-start;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--mm-glass-hi);
    isolation: isolate;
}
.finish-ba-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    padding: 6px 16px;
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color 0.25s ease;
}
.finish-ba-btn.is-on { color: #fff; }
.finish-ba-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.finish-ba-thumb {
    position: absolute;
    z-index: 0;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 999px;
    background: linear-gradient(135deg, #8b5cf6, #22c55e);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transform: translateX(100%);
    transition: transform 0.32s var(--mm-ease), background 0.32s ease;
}
.finish-ba-toggle.is-before .finish-ba-thumb { transform: translateX(0); background: linear-gradient(135deg, #475569, #64748b); box-shadow: none; }
.finish-audio-card.is-before .finish-player-wave { filter: grayscale(0.7) brightness(0.9); }
.finish-player-wave { transition: filter 0.3s ease; }

/* Project rail */
.finish-rail {
    background: linear-gradient(180deg, rgba(17, 20, 38, 0.72), rgba(11, 18, 32, 0.6));
    border-right: 1px solid var(--mm-glass-border);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.finish-rail-item { transition: background 0.22s ease, box-shadow 0.22s ease, transform 0.22s var(--mm-ease); }
.finish-rail-item:hover { transform: translateX(2px); }
.finish-rail-item.is-active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(16, 185, 129, 0.08));
    box-shadow: var(--mm-glass-hi), inset 0 0 0 1px rgba(167, 139, 250, 0.25);
}

/* @ menu */
.finish-mention-menu {
    background: var(--mm-glass-strong);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--mm-glass-hi), 0 18px 40px rgba(2, 6, 23, 0.55);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    transform-origin: 0 100%;
}

/* Working line */
.finish-msg--working .finish-working-text {
    background: linear-gradient(90deg, #94a3b8 0%, #e9d5ff 50%, #94a3b8 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: mm-shimmer 1.8s linear infinite;
}


/* ---------- Motion ---------- */
@keyframes mm-rise { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes mm-rise-right { from { opacity: 0; transform: translate(12px, 6px); } to { opacity: 1; transform: none; } }
@keyframes mm-card-in { from { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes mm-chip-in { from { opacity: 0; transform: translateY(6px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes mm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mm-thread-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes mm-rail-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes mm-pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes mm-glow { 0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.0); } 35% { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.28); } 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); } }
@keyframes mm-active { from { background-color: rgba(139, 92, 246, 0.35); } to { background-color: transparent; } }
@keyframes mm-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.finish-msg.is-new { animation: mm-rise 0.45s var(--mm-ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
.finish-msg--user.is-new { animation-name: mm-rise-right; }
.finish-msg.is-new .finish-audio-card { animation: mm-card-in 0.55s var(--mm-ease) both; animation-delay: calc(var(--i, 0) * 70ms + 90ms); }
.finish-msg.is-new .finish-outcome-btn { animation: mm-chip-in 0.38s var(--mm-ease) both; animation-delay: calc(var(--i, 0) * 45ms + 160ms); }
.finish-msg--working.is-new { animation: mm-fade 0.3s ease both; }
.finish-chat-messages.is-switching { animation: mm-thread-in 0.34s var(--mm-ease) both; }
.finish-audio-card.is-updated { animation: mm-glow 0.9s ease-out; }
.finish-prompt-chips.is-in .finish-prompt-chip { animation: mm-chip-in 0.36s var(--mm-ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.finish-rail-item.is-new { animation: mm-rail-in 0.4s var(--mm-ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.finish-rail-item.is-just-active { animation: mm-active 0.6s ease-out; }
.finish-mention-menu:not(.hidden) { animation: mm-pop 0.22s var(--mm-ease) both; }
.finish-chat-empty:not(.hidden) { animation: mm-thread-in 0.45s var(--mm-ease) both; }

/* Mobile: keep blur off long lists (bubbles/cards), keep it on composer/menu only */
@media (max-width: 720px) {
    .finish-msg-bubble, .finish-audio-card {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .finish-audio-card { background: linear-gradient(150deg, rgba(36, 31, 64, 0.94) 0%, rgba(17, 24, 39, 0.92) 100%); }
    .finish-msg.is-new .finish-audio-card { animation-name: mm-rise; }
    .finish-review-actions { grid-template-columns: 1fr 1fr 1.6fr; gap: 8px !important; }
    .finish-review-actions.finish-review-actions--pair { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
    .finish-review-actions { grid-template-columns: 1fr 1fr; }
    .finish-review-actions .finish-card-export { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    .finish-shell *, .finish-shell *::before, .finish-shell *::after,
    .finish-chat-panel *, .finish-mention-menu {
        animation: none !important;
        transition: none !important;
    }
    .finish-msg--working .finish-working-text { color: #94a3b8; background: none; }
}

/* =====================================================================
   Finish chat — desktop width (R7b)
   Wider shell beside the rail; the messages, cards and input bar share
   one centered ~1040px column so they stay aligned. Never edge-to-edge
   (shell caps at 1400px). Mobile (<1024px) is untouched.
   ===================================================================== */
@media (min-width: 1024px) {
    body.agent-mode #view-app.view {
        max-width: min(1400px, calc(100vw - 64px));
    }
    body.agent-mode #view-app .workspace {
        max-width: none;
    }
    .finish-shell {
        --mm-col: 1040px;
        --mm-gutter: max(24px, calc((100% - var(--mm-col)) / 2));
    }
    .finish-shell .finish-chat-top,
    .finish-shell .finish-chat-thread,
    .finish-shell .finish-chat-composer {
        padding-left: var(--mm-gutter);
        padding-right: var(--mm-gutter);
    }
    .finish-shell .finish-chat-thread { padding-top: 22px; }
    .finish-msg .finish-audio-card { width: min(100%, 620px); }
    .finish-ab-row .finish-audio-card { width: 100%; }
    .finish-msg-bubble { max-width: min(80%, 720px); }
    .finish-msg-line { max-width: min(92%, 760px); }
    .finish-msg .finish-take-list { max-width: 680px; }
}

/* =====================================================================
   Finish chat R8: "Adjust in chat" (tweak a card's mix from the input)
   ===================================================================== */
.finish-chat-composer.is-attention .finish-chat-input {
    border-color: rgba(167, 139, 250, 0.85);
    animation: mm-attention 1.6s var(--mm-ease, ease) both;
}
@keyframes mm-attention {
    0%   { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.0), inset 0 1px 0 rgba(255,255,255,0.06); }
    25%  { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.35), 0 0 28px rgba(139, 92, 246, 0.35); }
    100% { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16), 0 0 0 rgba(139, 92, 246, 0); }
}
.finish-tweak-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    padding: 5px 6px 5px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ede9fe;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(16, 185, 129, 0.14));
    border: 1px solid rgba(196, 181, 253, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: mm-chip-in 0.35s var(--mm-ease, ease) both;
}
.finish-tweak-pill-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #a78bfa;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.9);
}
.finish-tweak-pill-x {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    border-radius: 50%;
    border: none;
    color: #ddd6fe;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
}
.finish-tweak-pill-x:hover { background: rgba(255, 255, 255, 0.16); }
.finish-audio-card.is-tweak-target {
    border-color: rgba(167, 139, 250, 0.7);
    box-shadow: var(--mm-glass-hi, none), 0 0 0 1px rgba(167, 139, 250, 0.35), 0 0 34px rgba(139, 92, 246, 0.28);
}
@media (prefers-reduced-motion: reduce) {
    .finish-chat-composer.is-attention .finish-chat-input, .finish-tweak-pill { animation: none !important; }
}

/* =====================================================================
   Finish chat R8: project info panel (right column, modeled on a chat
   info pane: round cover, name, subtle label, pill tabs, soft cards).
   Docked at >= 1280px (collapsible); a drawer below that.
   ===================================================================== */
.finish-chat-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.finish-info-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--mm-glass-border, rgba(255,255,255,0.09));
    background: rgba(255, 255, 255, 0.03);
    color: #cbd5e1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--mm-ease, ease);
}
.finish-info-toggle:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.finish-info-toggle:active { transform: scale(0.94); }
.finish-info-toggle.is-on { background: rgba(139, 92, 246, 0.16); border-color: rgba(167, 139, 250, 0.4); color: #ddd6fe; }
.finish-info-toggle:focus-visible, .finish-info-close:focus-visible, .finish-info-tab:focus-visible,
.finish-info-play:focus-visible, .finish-info-dl:focus-visible, .finish-info-cover:focus-visible {
    outline: 2px solid rgba(167, 139, 250, 0.9);
    outline-offset: 2px;
}

.finish-info {
    display: flex;
    flex-direction: column;
    min-height: 0;
    color: #e2e8f0;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(139, 92, 246, 0.10), transparent 60%),
        linear-gradient(180deg, rgba(15, 18, 36, 0.92), rgba(10, 14, 28, 0.96));
}
.finish-info-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 26px 16px 28px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.finish-info-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.finish-info-close:hover { background: rgba(255,255,255,0.09); color: #fff; }

/* Hero */
.finish-info-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    margin-bottom: 20px;
}
.finish-info-cover {
    position: relative;
    width: 104px;
    height: 104px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    margin-bottom: 8px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 14px 34px rgba(76, 29, 149, 0.45);
    transition: transform 0.35s var(--mm-ease, ease), box-shadow 0.35s ease;
}
.finish-info-cover:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 0 0 1px rgba(196,181,253,0.35), 0 18px 40px rgba(76, 29, 149, 0.55); }
.finish-info-cover-art {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1b4b;
}
.finish-info-cover-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.finish-info-cover-art.is-fresh { animation: mm-info-pop 0.5s var(--mm-ease, ease) both; }
.finish-info-initials {
    position: relative;
    z-index: 1;
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 2px 12px rgba(0,0,0,0.25);
    transform: translateY(-6px);
}
.finish-info-wave {
    position: absolute;
    left: 50%;
    bottom: 14px;
    width: 64%;
    transform: translateX(-50%);
    fill: rgba(255,255,255,0.38);
}
.finish-info-cover-edit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 600;
    color: #fff;
    background: rgba(8, 10, 24, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.finish-info-cover:hover .finish-info-cover-edit,
.finish-info-cover:focus-visible .finish-info-cover-edit { opacity: 1; }
.finish-info-name {
    width: 100%;
    max-width: 260px;
    margin: 0;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #f8fafc;
    font: inherit;
    font-size: 1.12rem;
    font-weight: 600;
    text-align: center;
    text-overflow: ellipsis;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.3s ease;
}
.finish-info-name:hover { border-color: rgba(255,255,255,0.08); }
.finish-info-name:focus { outline: none; border-color: rgba(167,139,250,0.7); background: rgba(255,255,255,0.04); }
.finish-info-name.is-saved { animation: mm-info-saved 1.2s ease both; }
.finish-info-label {
    margin: 0;
    font-size: 0.78rem;
    color: #8b93a7;
}

/* Sections and cards */
.finish-info-section {
    margin: 0 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #a3acbf;
}
.finish-info-card {
    margin: 0 0 18px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.finish-info-details { padding: 4px 14px; }
.finish-info-drow {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.finish-info-drow:last-child { border-bottom: none; }
.finish-info-drow dt { margin: 0; font-size: 0.76rem; color: #8b93a7; flex-shrink: 0; }
.finish-info-drow dd { margin: 0; font-size: 0.8rem; color: #e5e7eb; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.finish-info-drow.is-live dd { color: #c4b5fd; }
.finish-info-drow.is-live dt::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: #a78bfa;
    vertical-align: 1px;
    animation: mm-info-pulse 1.4s ease-in-out infinite;
}

/* Pill tabs */
.finish-info-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin: 0 0 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.06);
}
.finish-info-tab {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.25s var(--mm-ease, ease), color 0.2s ease, box-shadow 0.25s ease;
}
.finish-info-tab:hover { color: #e2e8f0; }
.finish-info-tab.is-on {
    background: rgba(255,255,255,0.10);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 14px rgba(2,6,23,0.35);
}

/* File rows */
.finish-info-list.is-swap .finish-info-card,
.finish-info-list.is-swap .finish-info-empty { animation: mm-info-in 0.32s var(--mm-ease, ease) both; }
.finish-info-rows { padding: 2px 0; overflow: hidden; }
.finish-info-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 10px;
    padding: 9px 10px 9px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s ease;
}
.finish-info-row:last-child { border-bottom: none; }
.finish-info-row:hover { background: rgba(255,255,255,0.03); }
.finish-info-row.is-new { animation: mm-info-in 0.36s var(--mm-ease, ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.finish-info-row.is-muted .finish-info-row-name { color: #8b93a7; }
.finish-info-play {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.18);
    color: #ddd6fe;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s var(--mm-ease, ease), box-shadow 0.3s ease;
}
.finish-info-play svg { margin-left: 1px; }
.finish-info-play:hover { background: rgba(139, 92, 246, 0.32); transform: scale(1.06); }
.finish-info-row.is-playing .finish-info-play {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}
.finish-info-row.is-playing .finish-info-play svg { margin-left: 0; }
.finish-info-play:disabled, .finish-info-dl:disabled { opacity: 0.4; cursor: default; transform: none; }
.finish-info-row-main { min-width: 0; }
.finish-info-row-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.finish-info-row-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.finish-info-row-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 0.72rem;
    color: #8b93a7;
    white-space: nowrap;
    overflow: hidden;
}
.finish-info-row-sub > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.finish-info-stage {
    flex-shrink: 0;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: #cbd5e1;
}
.finish-info-stage.is-mix { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; }
.finish-info-stage.is-tweak { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
.finish-info-stage.is-master { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.finish-info-stage.is-slowed { background: rgba(56, 189, 248, 0.14); color: #7dd3fc; }
.finish-info-stage.is-sfx { background: rgba(236, 72, 153, 0.14); color: #f9a8d4; }
.finish-info-badge {
    flex-shrink: 0;
    font-size: 0.64rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
}
.finish-info-badge.is-approved { background: rgba(34, 197, 94, 0.14); color: #4ade80; }
.finish-info-badge.is-denied { background: rgba(248, 113, 113, 0.12); color: #fca5a5; }
.finish-info-dl {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s var(--mm-ease, ease);
}
.finish-info-dl:hover { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); }
.finish-info-dl:active { transform: scale(0.92); }
.finish-info-dl.is-busy { animation: mm-info-pulse 0.9s ease-in-out infinite; }
.finish-info-empty {
    margin: 4px 4px 0;
    padding: 18px 14px;
    border-radius: 14px;
    border: 1px dashed rgba(255,255,255,0.10);
    text-align: center;
    font-size: 0.8rem;
    color: #8b93a7;
}
.finish-info.is-swap .finish-info-hero,
.finish-info.is-swap .finish-info-details { animation: mm-info-in 0.36s var(--mm-ease, ease) both; }

@keyframes mm-info-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
@keyframes mm-info-pop {
    0%   { transform: scale(0.92); opacity: 0.4; }
    100% { transform: none; opacity: 1; }
}
@keyframes mm-info-saved {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); border-color: rgba(16,185,129,0.0); }
    30%  { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.22); border-color: rgba(16,185,129,0.6); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes mm-info-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

/* Desktop: docked right column, collapses to zero width (inner keeps its width, no reflow). */
@media (min-width: 1280px) {
    .finish-shell .finish-info {
        flex: 0 0 0px;
        width: 0;
        overflow: hidden;
        opacity: 0;
        border-left: 1px solid transparent;
        transition: flex-basis 0.42s var(--mm-ease, ease), width 0.42s var(--mm-ease, ease), opacity 0.3s ease, border-color 0.3s ease;
    }
    .finish-shell.has-info-docked .finish-info {
        flex-basis: 320px;
        width: 320px;
        opacity: 1;
        border-left-color: rgba(255,255,255,0.06);
    }
    .finish-shell .finish-info-scroll { width: 320px; flex: 1 1 auto; min-height: 0; }
    .finish-info-close, .finish-info-backdrop { display: none; }
}
/* Narrower screens and phones: a drawer from the right, opened from the header button. */
@media (max-width: 1279px) {
    .finish-info {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(360px, 92vw);
        z-index: 10041;
        border-left: 1px solid rgba(255,255,255,0.09);
        box-shadow: -24px 0 60px rgba(2, 6, 23, 0.6);
        transform: translateX(104%);
        visibility: hidden;
        transition: transform 0.42s var(--mm-ease, ease), visibility 0s linear 0.42s;
    }
    .finish-info.is-open {
        transform: none;
        visibility: visible;
        transition: transform 0.42s var(--mm-ease, ease), visibility 0s;
    }
    .finish-info-scroll { padding-top: 52px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
    .finish-info-backdrop {
        position: fixed;
        inset: 0;
        z-index: 10040;
        background: rgba(3, 6, 18, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .finish-info-backdrop.is-open { opacity: 1; pointer-events: auto; }
    @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
        .finish-info { background: rgba(13, 16, 32, 0.86); -webkit-backdrop-filter: blur(20px) saturate(1.2); backdrop-filter: blur(20px) saturate(1.2); }
        .finish-info-backdrop { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
    }
}
@media (max-width: 720px) {
    .finish-chat-top-actions { gap: 6px; }
    .finish-chat-top-actions #agent-switch-manual { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .finish-info, .finish-info *, .finish-info-backdrop, .finish-info-toggle { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Finish chat R9: compact project details + a panel that always scrolls
   ===================================================================== */
@media (min-width: 1280px) {
    .finish-shell .finish-info { align-self: stretch; max-height: 100%; }
}
.finish-info-scroll { -webkit-overflow-scrolling: touch; }
.finish-info-hero { margin-bottom: 14px; }
.finish-info-section { margin-bottom: 6px; }
.finish-info-details { padding: 2px 12px; margin-bottom: 10px; }
.finish-info-details .finish-info-drow { padding: 6px 0; }
.finish-info-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 0 0 16px;
}
.finish-info-stat {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 6px 10px 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: mm-info-in 0.3s var(--mm-ease, ease) both;
}
.finish-info-stat.is-wide { grid-column: 1 / -1; }
.finish-info-stat-k {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #7c859a;
}
.finish-info-stat-v {
    font-size: 0.78rem;
    font-weight: 600;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.finish-info-stat.is-live .finish-info-stat-v { color: #c4b5fd; }
.finish-info-stat.is-live .finish-info-stat-k::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 5px;
    border-radius: 50%;
    background: #a78bfa;
    vertical-align: 1px;
    animation: mm-info-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .finish-info-stat { animation: none !important; }
}

/* Mobile project drawer: viewport fixed above the site header, clear of notches and home indicators. */
@media (max-width: 1279px) {
    .finish-info { padding-top: env(safe-area-inset-top, 0px); }
    .finish-info-scroll { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
}

/* =====================================================================
   /app chat fills exactly the viewport; the page itself never scrolls.
   html.mm-app-locked + --mm-shell-h come from app/app-viewport.js (visualViewport aware).
   Fallbacks: 100dvh, then 100vh. Manual mode and logged-out views scroll normally.
   ===================================================================== */
.finish-shell { height: calc(100dvh - 120px); }
html.mm-app-locked,
html.mm-app-locked body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}
html.mm-app-locked body { min-height: 0; }
html.mm-app-locked body.agent-mode #view-app.view { min-height: 0; }
html.mm-app-locked .finish-shell {
    height: calc(100vh - 120px);
    height: calc(100dvh - 120px);
    height: var(--mm-shell-h, calc(100dvh - 120px));
    min-height: 0;
}
html.mm-app-locked .finish-chat { min-height: 0; max-height: none; }
html.mm-app-locked .finish-chat-thread { min-height: 0; overscroll-behavior: contain; }
html.mm-app-locked .finish-chat-composer { flex-shrink: 0; }
html.mm-app-locked .finish-rail-list { overscroll-behavior: contain; }
@media (max-width: 720px) {
    html.mm-app-locked .finish-shell {
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        height: var(--mm-shell-h, calc(100dvh - 60px));
    }
}
/* Very short viewports (mobile keyboard open): keep the thread and input, drop secondary chrome. */
@media (max-width: 720px) and (max-height: 520px) {
    html.mm-app-locked .finish-chat-hint,
    html.mm-app-locked .finish-prompt-chips,
    html.mm-app-locked .finish-rail { display: none !important; }
    html.mm-app-locked .finish-chat-top { padding-top: 8px; padding-bottom: 6px; }
}

/* Raw upload card: the untouched "before" (no Before/After, no review actions). */
.finish-audio-card--raw { border-color: rgba(148, 163, 184, 0.18); }
.finish-audio-card--raw .finish-audio-card-header { background: linear-gradient(180deg, rgba(148, 163, 184, 0.07), transparent); }
.finish-audio-card--raw .finish-audio-card-title { color: #e2e8f0; }
.finish-audio-card--raw .finish-raw-badge {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.22);
}
.finish-raw-stems {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 0;
    padding: 0;
}
.finish-raw-stems li {
    max-width: 180px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #aeb6c7;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.finish-player-wave-wrap { position: relative; overflow: visible; }
.finish-wave-mark-tip { left: 10px; transform: none; top: 4px; bottom: auto; }
.finish-wave-marks { position: absolute; inset: 0; pointer-events: none; }
.finish-wave-region {
    position: absolute; top: 0; bottom: 0;
    background: rgba(139, 92, 246, 0.22);
    pointer-events: none;
}
.finish-wave-mark {
    pointer-events: auto;
    position: absolute; top: 0; bottom: 0; width: 14px; margin-left: -7px;
    background: transparent; border: 0; padding: 0; cursor: pointer;
}
.finish-wave-mark::before {
    content: "";
    position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px;
    background: #fbbf24; border-radius: 1px;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.7);
}
.finish-wave-mark-tip {
    position: absolute; left: 12px; top: 4px; transform: none;
    background: rgba(15, 12, 28, 0.92); color: #fff;
    font-size: 11px; line-height: 1.2; padding: 3px 6px; border-radius: 6px;
    white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity 0.15s ease;
}
.finish-wave-mark:hover .finish-wave-mark-tip,
.finish-wave-mark:focus .finish-wave-mark-tip,
.finish-wave-mark.is-on .finish-wave-mark-tip { opacity: 1; }
/* r24: arrangement dropouts on the version waveform */
.finish-wave-region.is-mute { background: rgba(56, 189, 248, 0.20); box-shadow: inset 0 -2px 0 rgba(56, 189, 248, 0.75); }
.finish-wave-region.is-filter { background: linear-gradient(90deg, rgba(52, 211, 153, 0.05), rgba(52, 211, 153, 0.32)); box-shadow: inset 0 -2px 0 rgba(52, 211, 153, 0.8); }
.finish-wave-region.is-stop { background: rgba(248, 113, 113, 0.38); box-shadow: inset 0 -2px 0 rgba(248, 113, 113, 0.95); }
.finish-wave-region.is-gate { background: repeating-linear-gradient(90deg, rgba(251, 191, 36, 0.28) 0 4px, transparent 4px 8px); }
.finish-wave-region.is-only { background: rgba(244, 114, 182, 0.24); box-shadow: inset 0 -2px 0 rgba(244, 114, 182, 0.85); }
.finish-wave-mark.is-arrange::before { background: #38bdf8; box-shadow: 0 0 8px rgba(56, 189, 248, 0.7); }
.finish-preview-card .finish-player-wave-wrap { height: 46px; }
.finish-preview-kicker {
    font-size: 12px; letter-spacing: 0.02em; color: rgba(255,255,255,0.72); margin: 0 0 6px;
}

/* r14: Start over (agent chat header) + confirm modal */
.finish-start-over-btn[hidden] { display: none; }
.finish-confirm {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: finishConfirmFade 0.18s ease-out;
}
.finish-confirm.hidden { display: none; }
.finish-confirm-card {
    width: 100%;
    max-width: 400px;
    padding: 22px 22px 18px;
    border-radius: 18px;
    background: linear-gradient(160deg, rgba(30, 27, 75, 0.78), rgba(15, 23, 42, 0.86));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    animation: finishPickerIn 0.22s ease-out;
}
.finish-confirm-title { margin: 0 0 8px; font-size: 1.15rem; font-weight: 700; color: #f8fafc; }
.finish-confirm-body { margin: 0 0 18px; font-size: 0.95rem; line-height: 1.5; color: #cbd5e1; }
.finish-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.finish-confirm-actions .btn { min-height: 42px; padding: 0 18px; border-radius: 12px; font-weight: 600; cursor: pointer; }
.finish-confirm-cancel { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; border: 1px solid rgba(255, 255, 255, 0.14); }
.finish-confirm-cancel:hover { background: rgba(255, 255, 255, 0.14); }
.finish-confirm-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; border: 1px solid rgba(248, 113, 113, 0.6); box-shadow: 0 8px 24px rgba(239, 68, 68, 0.28); }
.finish-confirm-danger:hover { filter: brightness(1.08); }
.finish-confirm-actions .btn:focus-visible { outline: 2px solid #a78bfa; outline-offset: 2px; }
@keyframes finishConfirmFade { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 560px) {
    .finish-confirm { align-items: flex-end; padding: 12px; }
    .finish-confirm-card { max-width: none; border-radius: 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
    .finish-confirm-actions { flex-direction: column-reverse; }
    .finish-confirm-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .finish-confirm, .finish-confirm-card { animation: none; } }

/* ---- r17: Edit pencil on /app project rail ---- */
.finish-rail-row { position: relative; display: flex; align-items: center; }
.finish-rail-row > .finish-rail-item { padding-right: 40px; }
.finish-rail-edit {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: rgba(226, 232, 240, 0.85);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.finish-rail-row:hover .finish-rail-edit,
.finish-rail-row.is-active .finish-rail-edit,
.finish-rail-edit:focus-visible { opacity: 1; transform: none; }
.finish-rail-edit:hover { background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.45); color: #fff; }
.finish-rail-edit:focus-visible { outline: 2px solid rgba(52, 211, 153, 0.6); outline-offset: 2px; }
@media (hover: none) {
    .finish-rail-edit { opacity: 1; transform: none; }
}
@media (max-width: 900px) {
    .finish-rail-row { flex: 0 0 auto; }
    .finish-rail-row > .finish-rail-item { padding-right: 34px; }
    .finish-rail-edit { right: 4px; width: 26px; height: 26px; margin-top: -13px; border-radius: 8px; opacity: 1; transform: none; }
}

/* ---- r17: split failed / interrupted card ---- */
.finish-job-card {
    margin-top: 10px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.66), rgba(15, 23, 42, 0.6));
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
    max-width: 520px;
}
.finish-job-card--splitFailed { border-color: rgba(251, 191, 36, 0.32); }
.finish-job-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    color: #f8fafc;
    margin-bottom: 12px;
}
.finish-job-card-title::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}
.finish-job-card--interrupted .finish-job-card-title::before { background: #60a5fa; box-shadow: 0 0 10px rgba(96, 165, 250, 0.6); }
.finish-job-card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.finish-job-card-actions .finish-inline-btn { margin: 0; flex: 1 1 150px; min-height: 42px; border-radius: 10px; }
.finish-job-card-actions .finish-card-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
}
.finish-job-card-actions .finish-card-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); }
.finish-job-card.is-used { opacity: 0.6; }
.finish-job-card.is-used button { cursor: default; }

/* r18: highlight a section on slowed + reverb cards (snaps to the beat), then slow or export just that part */
.finish-player-wave-wrap.has-region-select { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.finish-region-layer { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.finish-region-grid {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; transition: opacity 0.25s var(--mm-ease, ease);
}
.finish-region-layer.is-hover .finish-region-grid,
.finish-region-layer.is-dragging .finish-region-grid { opacity: 1; }
.finish-region {
    position: absolute; top: -3px; bottom: -3px;
    border-radius: 9px;
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.30) 0%, rgba(124, 58, 237, 0.20) 100%);
    border: 1px solid rgba(196, 181, 253, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 1px rgba(124, 58, 237, 0.18), 0 8px 24px rgba(124, 58, 237, 0.25);
    -webkit-backdrop-filter: blur(1.5px) saturate(1.2);
    backdrop-filter: blur(1.5px) saturate(1.2);
    pointer-events: auto;
    cursor: grab;
    animation: mm-region-in 0.28s var(--mm-ease, ease) both;
}
.finish-region-layer.is-dragging .finish-region { cursor: grabbing; transition: none; }
.finish-region.is-saved {
    background: linear-gradient(180deg, rgba(52, 211, 153, 0.20) 0%, rgba(16, 185, 129, 0.12) 100%);
    border-color: rgba(110, 231, 183, 0.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 18px rgba(16, 185, 129, 0.18);
}
.finish-region-handle {
    position: absolute; top: 0; bottom: 0; width: 14px;
    cursor: ew-resize; touch-action: none; outline: none;
}
.finish-region-handle.is-start { left: -7px; }
.finish-region-handle.is-end { right: -7px; }
.finish-region-handle::before {
    content: ""; position: absolute; left: 50%; top: 50%;
    width: 4px; height: 22px; margin: -11px 0 0 -2px; border-radius: 2px;
    background: #f5f3ff; box-shadow: 0 0 10px rgba(167, 139, 250, 0.95), 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s var(--mm-ease, ease);
}
.finish-region-handle:hover::before, .finish-region-handle:focus-visible::before { transform: scaleY(1.25); }
.finish-region.is-saved .finish-region-handle::before { background: #ecfdf5; box-shadow: 0 0 10px rgba(52, 211, 153, 0.9); }
.finish-region-label {
    position: absolute; left: 50%; top: -24px; transform: translateX(-50%);
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
    color: #f5f3ff; background: rgba(20, 14, 40, 0.82);
    border: 1px solid rgba(196, 181, 253, 0.35);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}
.finish-region-bar {
    margin-top: 12px; padding: 10px 12px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(196, 181, 253, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.finish-region-bar[hidden] { display: none; }
.finish-region-bar.is-in { animation: mm-region-bar-in 0.36s var(--mm-ease, ease) both; }
.finish-region-bar-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.finish-region-bar-size { font-size: 0.82rem; font-weight: 600; color: #ede9fe; font-variant-numeric: tabular-nums; }
.finish-region-bar-hint { font-size: 0.7rem; color: rgba(255, 255, 255, 0.5); }
.finish-region-bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.finish-region-bar .btn {
    min-height: 38px; padding: 8px 14px; border-radius: 10px;
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    transition: filter 0.15s ease, transform 0.2s var(--mm-ease, ease), background 0.15s ease;
}
.finish-region-apply {
    color: #ede9fe; background: rgba(139, 92, 246, 0.16) !important;
    border: 1px solid rgba(167, 139, 250, 0.45) !important;
}
.finish-region-export {
    color: #fff; border: none !important;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.28) !important;
}
.finish-region-bar .btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.finish-region-bar .btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.finish-region-export.is-busy { animation: mm-region-busy 1.2s ease-in-out infinite; }
.finish-region-clear {
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: rgba(255, 255, 255, 0.7); cursor: pointer;
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14);
    transition: background 0.15s ease, color 0.15s ease;
}
.finish-region-clear:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.finish-audio-card.is-before .finish-region-layer,
.finish-audio-card.is-before .finish-region-bar { display: none; }
@keyframes mm-region-in { from { opacity: 0; transform: scaleY(0.85); } to { opacity: 1; transform: none; } }
@keyframes mm-region-bar-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes mm-region-busy { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
@media (max-width: 720px) {
    .finish-region-handle { width: 28px; }
    .finish-region-handle.is-start { left: -14px; }
    .finish-region-handle.is-end { right: -14px; }
    .finish-region-handle::before { height: 26px; margin-top: -13px; width: 5px; margin-left: -2.5px; }
    .finish-region-bar { padding: 10px; }
    /* Export on its own full width row (thumb friendly), then Slow this part and Clear */
    .finish-region-bar-actions { width: 100%; display: grid; grid-template-columns: 1fr auto; }
    .finish-region-bar-actions .btn { width: 100%; min-height: 44px; padding: 8px 10px; white-space: nowrap; }
    .finish-region-bar-actions .finish-region-export { grid-column: 1 / -1; order: -1; }
    .finish-region-bar-actions .finish-region-clear { width: 44px; height: 44px; }
    .finish-region-bar-actions .finish-region-apply[hidden] ~ .finish-region-clear { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
    .finish-region, .finish-region-bar.is-in { animation: none; }
}
.finish-region-bar .btn[hidden] { display: none !important; }

/* r19: Highlight Section is a mode. The card starts as the plain full track player; the pill turns the tools on. */
.finish-review-actions.finish-review-actions--pair.has-highlight { grid-template-columns: 1fr 1fr 1.35fr; }
.finish-audio-card-actions.has-highlight:not(.finish-review-actions) { flex-wrap: wrap; }
.finish-region-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 44px; padding: 10px 14px; border-radius: 999px !important;
    font-size: 0.88rem; font-weight: 600; white-space: nowrap; cursor: pointer;
    color: #ede9fe !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.04) 100%) !important;
    border: 1px solid rgba(196, 181, 253, 0.38) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 4px 14px rgba(0, 0, 0, 0.18) !important;
    -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease, transform 0.2s var(--mm-ease, ease);
}
.finish-region-toggle:hover { border-color: rgba(196, 181, 253, 0.7) !important; transform: translateY(-1px); }
.finish-region-toggle-icon {
    width: 16px; height: 11px; flex: 0 0 auto; border-radius: 3px;
    border-left: 2px solid currentColor; border-right: 2px solid currentColor;
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.75), rgba(124, 58, 237, 0.55));
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.6);
}
.finish-region-toggle.is-on {
    color: #fff !important;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.55) 0%, rgba(124, 58, 237, 0.42) 100%) !important;
    border-color: rgba(221, 214, 254, 0.75) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 3px rgba(139, 92, 246, 0.18), 0 8px 22px rgba(124, 58, 237, 0.32) !important;
}
.finish-region-layer[hidden] { display: none; }
.finish-audio-card.is-highlighting .finish-player-wave-wrap { box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.35), 0 0 18px rgba(124, 58, 237, 0.18); border-radius: 8px; }
.finish-region-bar.is-empty .finish-region-apply,
.finish-region-bar.is-empty .finish-region-export,
.finish-region-bar.is-empty .finish-region-loop,
.finish-region-bar.is-empty .finish-region-clear { display: none !important; }
.finish-region-bar.is-empty .finish-region-bar-size { color: rgba(237, 233, 254, 0.85); font-weight: 500; }
.finish-region-loop {
    display: inline-flex; align-items: center; gap: 5px;
    height: 30px; padding: 0 11px; border-radius: 999px; cursor: pointer;
    font-size: 0.74rem; font-weight: 600; color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.14);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.finish-region-loop.is-on { color: #ede9fe; background: rgba(139, 92, 246, 0.22); border-color: rgba(196, 181, 253, 0.5); }
/* Live preview of just the section */
.finish-region-preview {
    margin-top: 8px; padding: 8px 12px 8px 8px;
    display: flex; align-items: center; gap: 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.12) 0%, rgba(124, 58, 237, 0.06) 100%);
    border: 1px solid rgba(196, 181, 253, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    animation: mm-region-bar-in 0.36s var(--mm-ease, ease) both;
}
.finish-region-preview[hidden] { display: none; }
.finish-region-preview-play {
    width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem;
    color: #fff; border: none;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.finish-region-preview-play:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.finish-region-preview-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.finish-region-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.finish-region-preview-title { font-size: 0.74rem; font-weight: 600; color: #ede9fe; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finish-region-preview-status { font-size: 0.7rem; color: rgba(255, 255, 255, 0.5); white-space: nowrap; }
.finish-region-preview-wave-wrap { position: relative; height: 28px; border-radius: 6px; overflow: hidden; cursor: pointer; }
.finish-region-preview-wave { display: block; width: 100%; height: 100%; transition: opacity 0.2s ease; }
.finish-region-preview-time { flex: 0 0 auto; font-size: 0.72rem; color: rgba(255, 255, 255, 0.65); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.finish-region-preview.is-updating .finish-region-preview-status { color: #c4b5fd; }
.finish-region-preview.is-updating .finish-region-preview-wave { opacity: 0.45; }
.finish-region-preview.is-updating .finish-region-preview-wave-wrap::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 0%, rgba(221, 214, 254, 0.28) 45%, transparent 70%);
    background-size: 220% 100%;
    animation: mm-preview-shimmer 1.1s linear infinite;
}
@keyframes mm-preview-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.finish-audio-card.is-before .finish-region-preview { display: none; }
@media (max-width: 720px) {
    .finish-region-bar-actions { grid-template-columns: auto 1fr auto; }
    .finish-region-bar-actions .finish-region-export { grid-column: 1 / -1; }
    .finish-region-bar-actions .finish-region-loop { height: 44px; }
    .finish-region-bar-actions .finish-region-apply[hidden] ~ .finish-region-clear { grid-column: 3; }
    .finish-region-preview-play { width: 40px; height: 40px; }
}
@media (max-width: 520px) {
    .finish-review-actions.finish-review-actions--pair.has-highlight { grid-template-columns: 1fr 1fr; }
    .finish-review-actions--pair.has-highlight .finish-region-toggle { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
    .finish-region-preview, .finish-region-preview.is-updating .finish-region-preview-wave-wrap::after { animation: none; }
}

/* r20: background render indicator on a slowed card (never blocks the player). */
.finish-rendering-chip { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 2px 9px; border-radius: 999px; font-size: 11px; line-height: 16px; color: var(--text-muted, #9aa0aa); background: rgba(127, 127, 127, 0.14); }
.finish-rendering-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: finishRenderPulse 1s ease-in-out infinite; }
@keyframes finishRenderPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .finish-rendering-chip::before { animation: none; } }

/* r21: small status line in the project info panel (stem play / download errors). */
.finish-info-toast {
    position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 5;
    padding: 9px 12px; border-radius: 12px; font-size: 0.85rem; color: #fde68a;
    background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(251, 191, 36, 0.35);
    opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.finish-info-toast.is-on { opacity: 1; transform: none; }
/* r21: a deleted project's rail row fades out */
.finish-rail-row.is-removing, .finish-rail-item.is-removing { opacity: 0; transform: translateX(-10px); max-height: 0; overflow: hidden; transition: opacity .26s ease, transform .26s ease, max-height .26s ease .1s; pointer-events: none; }

/* ---------------------------------------------------------------- r23: trim the section preview */
.finish-region-preview-wave-wrap { height: 34px; overflow: visible; }
.finish-region-preview-wave { border-radius: 6px; }
.finish-trim { position: absolute; inset: 0; pointer-events: none; }
.finish-trim[hidden] { display: none; }
.finish-trim-shade { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: rgba(10, 6, 24, 0.62); }
.finish-trim-shade.is-left { border-radius: 6px 0 0 6px; }
.finish-trim-shade.is-right { border-radius: 0 6px 6px 0; }
.finish-trim-span { position: absolute; top: -1px; bottom: -1px; border-top: 1.5px solid transparent; border-bottom: 1.5px solid transparent; transition: border-color 0.15s ease; }
.finish-trim.is-trimmed .finish-trim-span { border-color: rgba(221, 214, 254, 0.75); }
.finish-trim-handle {
    position: absolute; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px;
    display: flex; align-items: center; justify-content: center;
    pointer-events: auto; cursor: ew-resize; touch-action: none; outline: none; z-index: 2;
    -webkit-tap-highlight-color: transparent;
}
.finish-trim-grip {
    width: 10px; height: 36px; border-radius: 6px; position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(196, 181, 253, 0.26) 100%);
    border: 1px solid rgba(237, 233, 254, 0.75);
    box-shadow: 0 2px 10px rgba(76, 29, 149, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    transition: transform 0.12s ease, background 0.12s ease;
}
.finish-trim-grip::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; height: 14px; margin: -7px 0 0 -1px; border-radius: 1px; background: rgba(255, 255, 255, 0.9); }
.finish-trim-handle.is-start .finish-trim-grip { transform: translateX(-4px); }
.finish-trim-handle.is-end .finish-trim-grip { transform: translateX(4px); }
.finish-trim-handle:hover .finish-trim-grip, .finish-trim-handle.is-active .finish-trim-grip { background: linear-gradient(180deg, rgba(196, 181, 253, 0.7) 0%, rgba(139, 92, 246, 0.6) 100%); }
.finish-trim-handle:focus-visible .finish-trim-grip { box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.55), 0 2px 10px rgba(76, 29, 149, 0.45); }
.finish-trim-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 2px; min-height: 16px; }
.finish-trim-row[hidden] { display: none; }
.finish-trim-info { font-size: 0.7rem; color: rgba(237, 233, 254, 0.72); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finish-trim-reset { flex: 0 0 auto; padding: 0; border: none; background: none; cursor: pointer; font-size: 0.7rem; color: #c4b5fd; text-decoration: underline; text-underline-offset: 2px; }
.finish-trim-reset:hover { color: #ede9fe; }
.finish-region-preview { padding-top: 10px; padding-bottom: 10px; }
@media (max-width: 720px) {
    .finish-region-preview-wave-wrap { height: 40px; margin: 0 6px; }
    .finish-trim-grip { width: 12px; height: 40px; }
    .finish-trim-reset { padding: 6px 0; }
}
@media (prefers-reduced-motion: reduce) { .finish-trim-grip { transition: none; } }
