/* Atmo Audio Tools — sidebar layout */
/* Deep navy/black with royal blue AND warm gold accents */

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

:root {
    --blue:          #0099ff;
    --blue-dark:     #0066cc;
    --cyan:          #00d4ff;
    --gold:          #c8960c;
    --gold-bright:   #f0c040;
    --gold-soft:     #e8d090;
    --gold-dim:      #7a5a10;
    --gold-glow:     rgba(200, 150, 12, 0.22);
    --blue-glow:     rgba(0, 153, 255, 0.16);
    --bg:            #06090f;
    --sidebar-bg:    #04060c;
    --card-bg:       rgba(8, 14, 28, 0.80);
    --card-border:   rgba(200, 150, 12, 0.18);
    --card-border-h: rgba(200, 150, 12, 0.42);
    --text-1:        #f0e8d0;
    --text-2:        #9a8860;
    --text-3:        #4a3e28;
    --success:       #10b981;
    --error:         #ef4444;
    --border:        rgba(200, 150, 12, 0.10);
    --sidebar-width: 220px;
    /* Tungsten / incandescent CTA */
    --tungsten:      #c06818;
    --tungsten-hot:  #ff9a30;
    --tungsten-dim:  #3d1800;
    --tungsten-glow: rgba(255, 148, 40, 0.55);
    --tungsten-text: #fff5dc;
}

html, body { height: 100%; }

body {
    font-family: 'Josefin Slab', Georgia, serif;
    background: var(--bg);
    color: var(--text-1);
    overflow: hidden;
}

/* Dual-glow background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 110%,
            rgba(0, 80, 180, 0.18) 0%, transparent 65%),
        radial-gradient(ellipse 80% 50% at 80% 110%,
            rgba(180, 120, 10, 0.16) 0%, transparent 65%),
        radial-gradient(ellipse 120% 30% at 50% 115%,
            rgba(30, 20, 5, 0.60) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── App shell: sidebar + main ────────────────────────────────────────────── */

.app-shell {
    position: relative; z-index: 1;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Subtle blue glow on sidebar right edge */
.sidebar::after {
    content: '';
    position: absolute; top: 0; right: -1px; bottom: 0; width: 1px;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(0, 153, 255, 0.25) 30%,
        rgba(200, 150, 12, 0.20) 70%,
        transparent 100%);
}

/* Logo area */
.sidebar-logo {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.logo-img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 0 18px rgba(200, 150, 12, 0.40))
            drop-shadow(0 0 36px rgba(0, 100, 220, 0.28));
}

.logo-wordmark {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.logo-title {
    font-size: 1.0rem;
    font-weight: 300;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    background: linear-gradient(100deg,
        var(--cyan) 0%, var(--blue) 30%,
        var(--gold-bright) 65%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0 0.5rem 0.6rem;
    margin-bottom: 0.1rem;
}

/* Nav groups — sectioned sub-boxes */
.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: rgba(255, 255, 255, 0.018);
    border: 1px solid rgba(200, 150, 12, 0.09);
    border-radius: 5px;
    padding: 0.55rem 0.4rem 0.4rem;
}

.nav-group-premium {
    border-color: rgba(200, 0, 0, 0.14);
    background: rgba(40, 0, 0, 0.18);
}

.nav-group-label {
    font-size: 0.56rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: rgba(200, 150, 12, 0.45);
    padding: 0 0.35rem 0.45rem;
}

.nav-group-label-premium {
    color: rgba(255, 90, 90, 0.45);
}

/* Disabled/coming-soon nav button */
.tab-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-coming-soon {
    font-size: 0.52rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(200, 150, 12, 0.45);
    margin-left: auto;
    background: rgba(200, 150, 12, 0.08);
    border: 1px solid rgba(200, 150, 12, 0.18);
    border-radius: 2px;
    padding: 0.1rem 0.35rem;
}

/* Tab buttons — studio console LED, blue */
.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #040d1c;
    border-top:    2px solid rgba(80, 140, 255, 0.12);
    border-bottom: 2px solid rgba(0, 0, 0, 0.45);
    border-left:   1px solid rgba(40, 80, 200, 0.18);
    border-right:  1px solid rgba(40, 80, 200, 0.18);
    border-radius: 3px;
    color: rgba(120, 170, 255, 0.42);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    text-shadow: none;
    box-shadow:
        0 0 6px rgba(0, 100, 255, 0.07),
        inset 0 1px 0 rgba(80, 140, 255, 0.07),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.tab-btn:hover:not(.active) {
    color: rgba(160, 200, 255, 0.65);
    background: #060f22;
    box-shadow:
        0 0 10px rgba(0, 100, 255, 0.18),
        inset 0 1px 0 rgba(80, 140, 255, 0.10);
}

.tab-btn.active {
    background: #001a55;
    color: #e8f4ff;
    text-shadow: 0 0 12px rgba(140, 200, 255, 1.0);
    border-top:    2px solid rgba(140, 200, 255, 0.42);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(80, 140, 255, 0.42);
    border-right:  1px solid rgba(80, 140, 255, 0.42);
    box-shadow:
        0 0 28px rgba(0, 140, 255, 0.66),
        0 0 60px rgba(0, 140, 255, 0.24),
        0 0 18px rgba(255, 148, 40, 0.22),
        inset 0 1px 0 rgba(140, 200, 255, 0.24),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

/* Premium tab buttons — red LED, same structure as blue but red */
.tab-btn.premium {
    background: #1a0000;
    color: rgba(255, 100, 100, 0.42);
    border-top:    2px solid rgba(255, 80, 80, 0.12);
    border-bottom: 2px solid rgba(0, 0, 0, 0.45);
    border-left:   1px solid rgba(180, 0, 0, 0.18);
    border-right:  1px solid rgba(180, 0, 0, 0.18);
    box-shadow:
        0 0 6px rgba(200, 0, 0, 0.07),
        inset 0 1px 0 rgba(255, 80, 80, 0.07),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.tab-btn.premium:hover:not(.active) {
    color: rgba(255, 160, 160, 0.65);
    background: #220000;
    box-shadow:
        0 0 10px rgba(200, 0, 0, 0.20),
        inset 0 1px 0 rgba(255, 80, 80, 0.10);
}

.tab-btn.premium.active {
    background: #440000;
    color: #ffe8e8;
    text-shadow: 0 0 12px rgba(255, 140, 140, 1.0);
    border-top:    2px solid rgba(255, 140, 140, 0.42);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(220, 60, 60, 0.42);
    border-right:  1px solid rgba(220, 60, 60, 0.42);
    box-shadow:
        0 0 28px rgba(220, 0, 0, 0.66),
        0 0 60px rgba(220, 0, 0, 0.24),
        0 0 18px rgba(255, 148, 40, 0.28),
        inset 0 1px 0 rgba(255, 140, 140, 0.24),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

.nav-icon {
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.75;
}

.nav-label { flex: 1; }

/* Sidebar footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-3);
    text-align: center;
    line-height: 1.8;
}

.sidebar-footer a { color: var(--text-2); text-decoration: none; transition: color 0.2s; }
.sidebar-footer a:hover { color: var(--gold); }

/* ── Main content ─────────────────────────────────────────────────────────── */

.main-content {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 2.5rem 2.5rem 8rem;
}

.tab-content { max-width: 1060px; }

/* ── Upload ───────────────────────────────────────────────────────────────── */

.upload-section {
    display: flex; flex-direction: column; align-items: center;
    gap: 1.25rem; padding: 3rem 0;
}

.upload-box {
    width: 100%; max-width: 600px;
    border: 1px solid var(--card-border-h); border-radius: 6px;
    padding: 3rem 2.5rem; text-align: center; cursor: pointer;
    transition: all 0.3s;
    background: var(--card-bg);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    position: relative; overflow: hidden;
}

.upload-box::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 40% at 50% 120%,
        rgba(200, 150, 12, 0.07) 0%, transparent 70%);
    pointer-events: none;
}

.upload-box:hover, .upload-box.drag-over {
    border-color: var(--gold);
    box-shadow: 0 0 30px var(--gold-glow), 0 0 60px var(--blue-glow);
    background: rgba(20, 14, 4, 0.85);
}

.upload-icon { font-size: 2.8rem; margin-bottom: 1rem; opacity: 0.7; }

.upload-box h2 {
    font-size: 1.3rem; font-weight: 300; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--text-1); margin-bottom: 0.6rem;
}

.upload-box p {
    font-size: 0.88rem; color: var(--text-2);
    margin-bottom: 1.4rem; letter-spacing: 0.04em;
}

.upload-hint { font-size: 0.8rem !important; margin-top: 0.75rem !important; margin-bottom: 0 !important; color: var(--text-3) !important; }
.upload-hint a { color: var(--gold); text-decoration: none; }
.upload-hint a:hover { color: var(--gold-bright); }

.file-name {
    font-size: 0.85rem; color: var(--text-2); letter-spacing: 0.05em;
    padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 3px;
    background: var(--card-bg);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    padding: 0.65rem 1.8rem;
    border: 1px solid var(--card-border-h); border-radius: 3px;
    font-family: inherit; font-size: 0.78rem; font-weight: 400;
    letter-spacing: 0.2em; text-transform: uppercase;
    cursor: pointer; transition: all 0.2s;
    backdrop-filter: blur(6px);
}

.btn-primary {
    background: #006600;
    color: #d4ffd4;
    font-weight: 800;
    border-top:    2px solid rgba(120, 255, 120, 0.35);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(0, 120, 0, 0.55);
    border-right:  1px solid rgba(0, 120, 0, 0.55);
    text-shadow: 0 0 10px rgba(80, 255, 80, 0.8);
    box-shadow:
        0 0 22px rgba(0, 220, 0, 0.55),
        0 0 50px rgba(0, 220, 0, 0.20),
        0 0 18px rgba(255, 148, 40, 0.25),
        inset 0 1px 0 rgba(120, 255, 120, 0.20),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}
.btn-primary:hover {
    background: #00aa00;
    color: #ffffff;
    text-shadow: 0 0 12px rgba(80, 255, 80, 1);
    box-shadow:
        0 0 35px rgba(0, 220, 0, 0.85),
        0 0 70px rgba(0, 220, 0, 0.40),
        0 0 22px rgba(255, 148, 40, 0.30),
        inset 0 1px 0 rgba(140, 255, 140, 0.35);
}
.btn-primary:active {
    transform: translateY(1px);
    box-shadow:
        0 0 14px rgba(0, 200, 0, 0.5),
        inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* ── Tungsten CTA — shared by all primary action buttons ────────── */
.btn-cta,
.btn-analyze {
    background: var(--tungsten);
    color: var(--tungsten-text);
    font-weight: 700;
    letter-spacing: 0.12em;
    border-top:    2px solid rgba(255, 200, 120, 0.35);
    border-bottom: 2px solid rgba(0, 0, 0, 0.50);
    border-left:   1px solid rgba(160, 80, 10, 0.55);
    border-right:  1px solid rgba(160, 80, 10, 0.55);
    border-radius: 3px;
    text-shadow: 0 0 10px rgba(255, 180, 80, 0.8);
    box-shadow:
        0 0 18px var(--tungsten-glow),
        0 0 40px rgba(255, 148, 40, 0.20),
        inset 0 1px 0 rgba(255, 200, 120, 0.20),
        inset 0 -1px 0 rgba(0, 0, 0, 0.30);
    padding: 0.75rem 3rem;
    font-size: 0.82rem;
}
.btn-cta:hover,
.btn-analyze:hover {
    background: var(--tungsten-hot);
    color: #fff;
    text-shadow: 0 0 14px rgba(255, 220, 130, 1);
    box-shadow:
        0 0 32px rgba(255, 160, 50, 0.85),
        0 0 70px rgba(255, 148, 40, 0.35),
        inset 0 1px 0 rgba(255, 220, 140, 0.30);
}
.btn-cta:active,
.btn-analyze:active {
    transform: translateY(1px);
    box-shadow:
        0 0 10px var(--tungsten-glow),
        inset 0 2px 5px rgba(0, 0, 0, 0.45);
}

.btn-secondary {
    background: #0d0d0d;
    color: rgba(190, 190, 190, 0.55);
    font-weight: 800;
    border-top:    2px solid rgba(200, 200, 200, 0.10);
    border-bottom: 2px solid rgba(0, 0, 0, 0.45);
    border-left:   1px solid rgba(150, 150, 150, 0.12);
    border-right:  1px solid rgba(150, 150, 150, 0.12);
    text-shadow: none;
    box-shadow:
        0 0 4px rgba(150, 150, 150, 0.06),
        0 0 14px rgba(255, 148, 40, 0.18),
        inset 0 1px 0 rgba(200, 200, 200, 0.06),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}
.btn-secondary:hover {
    color: rgba(220, 220, 220, 0.85);
    background: #141414;
    box-shadow:
        0 0 12px rgba(180, 180, 180, 0.15),
        0 0 20px rgba(255, 148, 40, 0.25),
        inset 0 1px 0 rgba(200, 200, 200, 0.10);
}
.btn-secondary:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.btn-humanize {
    background: #005533;
    color: #b8ffe0;
    font-weight: 800;
    border-top:    2px solid rgba(80, 255, 160, 0.30);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(0, 160, 80, 0.45);
    border-right:  1px solid rgba(0, 160, 80, 0.45);
    text-shadow: 0 0 10px rgba(50, 255, 140, 0.75);
    box-shadow:
        0 0 18px rgba(0, 200, 100, 0.45),
        0 0 40px rgba(0, 200, 100, 0.15),
        0 0 16px rgba(255, 148, 40, 0.22),
        inset 0 1px 0 rgba(80, 255, 160, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}
.btn-humanize:hover {
    background: #007744;
    color: #ffffff;
    text-shadow: 0 0 12px rgba(50, 255, 140, 1);
    box-shadow:
        0 0 28px rgba(0, 200, 100, 0.75),
        0 0 60px rgba(0, 200, 100, 0.30),
        0 0 20px rgba(255, 148, 40, 0.28),
        inset 0 1px 0 rgba(100, 255, 160, 0.30);
}
.btn-humanize:active {
    transform: translateY(1px);
    box-shadow: 0 0 10px rgba(0, 200, 100, 0.4), inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.btn-normalize {
    background: var(--tungsten-dim);
    color: var(--tungsten-text);
    font-weight: 800;
    border-top:    2px solid rgba(255, 200, 120, 0.28);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(160, 80, 10, 0.45);
    border-right:  1px solid rgba(160, 80, 10, 0.45);
    text-shadow: 0 0 8px rgba(255, 160, 60, 0.65);
    box-shadow:
        0 0 16px rgba(255, 148, 40, 0.35),
        0 0 35px rgba(255, 148, 40, 0.12),
        inset 0 1px 0 rgba(255, 200, 120, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}
.btn-normalize:hover {
    background: var(--tungsten);
    color: #fff;
    text-shadow: 0 0 12px rgba(255, 180, 80, 1);
    box-shadow:
        0 0 28px var(--tungsten-glow),
        0 0 60px rgba(255, 148, 40, 0.30),
        inset 0 1px 0 rgba(255, 220, 140, 0.25);
}
.btn-normalize:active {
    transform: translateY(1px);
    box-shadow: 0 0 10px var(--tungsten-glow), inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* ── Spinner & ripple ─────────────────────────────────────────────────────── */

.spinner { display: flex; justify-content: center; align-items: center; min-height: 400px; }
.spinner-content { text-align: center; }

/* Wide pond ripple — perspective view from near ground level */
.ripple-pond {
    position: relative;
    width: 480px;
    height: 60px;
    margin: 0 auto 2rem;
}

.ripple-ring {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%) scale(0.15);
    border-radius: 50%; opacity: 0;
    animation: ripple-expand 2.8s ease-out infinite;
}

/* Each ring scales wider relative to height — flat ellipse perspective */
.ripple-ring:nth-child(1) { width: 120px; height: 14px; animation-delay: 0s;   border: 2px solid rgba(220, 240, 255, 0.95); }
.ripple-ring:nth-child(2) { width: 240px; height: 28px; animation-delay: 0.6s; border: 2px solid rgba(60, 180, 255, 0.80); }
.ripple-ring:nth-child(3) { width: 360px; height: 42px; animation-delay: 1.2s; border: 1.5px solid rgba(20, 80, 210, 0.60); }
.ripple-ring:nth-child(4) { width: 480px; height: 56px; animation-delay: 1.8s; border: 1px solid rgba(10, 30, 120, 0.35); }

@keyframes ripple-expand {
    0%   { transform: translate(-50%, -50%) scale(0.15); opacity: 0; }
    12%  { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1);    opacity: 0; }
}

.spinner-content p {
    color: var(--text-2); font-size: 0.85rem;
    letter-spacing: 0.18em; text-transform: uppercase;
}

/* ── Results ──────────────────────────────────────────────────────────────── */

.results-section { animation: fadeUp 0.5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.results-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem; margin-bottom: 1.5rem;
    align-items: start;
}

.full-width { grid-column: 1 / -1; }

.file-info-line {
    display: flex; flex-wrap: wrap; align-items: baseline;
    gap: 0.5rem 0.75rem; padding: 0.75rem 0 1.25rem;
    font-size: 0.88rem; color: var(--text-2);
}
.fi-name {
    font-size: 0.95rem; font-weight: 400;
    color: var(--gold-soft); letter-spacing: 0.04em;
}
.fi-sep { color: var(--text-3); }
.fi-label {
    font-size: 0.68rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-2);
    margin-right: 0.25rem;
}
.fi-item { display: inline-flex; align-items: baseline; gap: 0.25rem; }
.fi-item > span:not(.fi-label) { color: var(--gold-soft); }

.results-actions {
    display: flex; gap: 1rem; flex-wrap: wrap;
    align-items: center; margin-top: 0.5rem; margin-bottom: 2rem;
}

.energy-chart-wide { height: 120px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */

.result-card {
    background: var(--card-bg);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: 6px; padding: 1.2rem 1.4rem;
    transition: border-color 0.25s, box-shadow 0.25s;
    position: relative; overflow: hidden;
}

.result-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 153, 255, 0.45) 20%,
        rgba(200, 150, 12, 0.55) 80%,
        transparent 100%);
}

.result-card:hover {
    border-color: var(--card-border-h);
    box-shadow: 0 0 28px var(--gold-glow), 0 0 16px var(--blue-glow);
}

.result-card h3 {
    font-size: 0.72rem; font-weight: 400;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--gold-dim); margin-bottom: 1.2rem;
    padding-bottom: 0.75rem; border-bottom: 1px solid var(--border);
}

/* ── Info grid ────────────────────────────────────────────────────────────── */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.85rem 1.25rem;
}

.info-item { display: flex; flex-direction: column; gap: 0.2rem; }

.info-item .label {
    font-size: 0.68rem; letter-spacing: 0.16em;
    text-transform: uppercase; color: var(--text-3); font-weight: 400;
}

.info-item .value {
    font-size: 1rem; font-weight: 300;
    color: var(--gold-soft); letter-spacing: 0.03em; line-height: 1.2;
}

/* ── Charts ───────────────────────────────────────────────────────────────── */

.vel-chart, .energy-chart {
    display: flex; align-items: flex-end; gap: 2px; height: 80px;
}

.energy-chart-wide {
    position: relative;
}
.energy-bars {
    display: flex; align-items: flex-end; gap: 2px;
    width: 100%; height: calc(100% - 20px);
}
.energy-section-line {
    position: absolute; top: 0; height: calc(100% - 20px);
    width: 1px;
    background: rgba(200, 150, 12, 0.55);
    transform: translateX(-50%);
    pointer-events: none;
}
.energy-section-label {
    position: absolute; bottom: 0; height: 18px;
    transform: translateX(-50%);
    font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase;
    color: rgba(60, 180, 255, 0.90); white-space: nowrap;
}

.vel-bar {
    flex: 1; min-height: 2px; border-radius: 2px 2px 0 0;
    background: linear-gradient(to top, var(--gold-dim), var(--gold-bright));
    opacity: 0.75; transition: height 0.4s ease;
}
.vel-bar:hover { opacity: 1; }

.energy-bar {
    flex: 1; min-height: 2px; border-radius: 2px 2px 0 0;
    background: linear-gradient(to top, rgba(160,100,8,0.5), rgba(240,192,60,0.8));
}

.spectrum-bar {
    height: 6px; background: rgba(255,255,255,0.07);
    border-radius: 3px; overflow: hidden;
}
.spectrum-fill {
    height: 100%;
    background: linear-gradient(to right, var(--gold-dark, #7a5a10), var(--gold-bright));
    border-radius: 3px; transition: width 0.5s ease;
}

.candidate-row {
    display: flex; align-items: center; gap: 0.6rem;
    margin-bottom: 0.55rem; font-size: 0.82rem; color: var(--text-2);
}
.candidate-row .c-label { width: 105px; flex-shrink: 0; font-size: 0.78rem; letter-spacing: 0.04em; }
.candidate-row .c-bar-track { flex: 1; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.candidate-row .c-bar-fill { height: 100%; background: linear-gradient(to right, var(--gold-dim), var(--gold)); border-radius: 2px; }
.candidate-row.selected .c-label { color: #5dfc8a; }
.candidate-row.selected .c-bar-fill { background: linear-gradient(to right, #10b981, #5dfc8a); }
.candidate-row .c-score { width: 38px; text-align: right; font-size: 0.75rem; color: var(--text-3); flex-shrink: 0; }

.radar-row { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: space-around; }
.radar-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; flex: 1; min-width: 150px; }
.radar-title { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }

.visual-charts-row {
    display: flex; gap: 1.25rem; margin-top: 1.25rem;
    border-top: 1px solid var(--border); padding-top: 1.1rem;
}
.chart-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.chart-label {
    font-size: 0.68rem; letter-spacing: 0.16em;
    text-transform: uppercase; color: var(--text-3);
}

.tonal-cols {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0 1.75rem;
}
.tonal-col { padding-top: 0.5rem; }
.tonal-col-label {
    font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--gold-dim); margin-bottom: 0.7rem;
    padding-bottom: 0.35rem; border-bottom: 1px solid var(--border);
}
.tonal-col .info-grid { grid-template-columns: 1fr; gap: 0.7rem 0; }

.fi-btn {
    padding: 0.3rem 0.9rem; font-size: 0.68rem;
    letter-spacing: 0.14em; margin-left: 0.5rem;
}

#stereoWidthBar svg { display: block; width: 100%; }

.instruments-list { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; }
.instrument-item { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-2); padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.instrument-item:last-child { border-bottom: none; }

.tempo-changes-list { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.3rem; }
.tempo-change-item { font-size: 0.8rem; color: var(--text-2); padding: 0.3rem 0; border-bottom: 1px solid var(--border); }

#sectionsList { margin-top: 0.9rem; }
.section-item {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.8rem; padding: 0.45rem 0.6rem; margin-bottom: 0.3rem;
    background: rgba(0,0,0,0.2); border-radius: 3px;
    border-left: 2px solid var(--gold-dim); color: var(--text-2);
}

.json-display {
    font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.72rem; line-height: 1.6;
    color: var(--text-2); background: rgba(0,0,0,0.35);
    border: 1px solid var(--border); border-radius: 4px; padding: 1rem;
    overflow-x: auto; white-space: pre-wrap; max-height: 360px; margin-bottom: 0.75rem;
}

.error-section { display: flex; justify-content: center; padding: 3rem 0; }
.error-box {
    background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.30);
    border-radius: 6px; padding: 2rem; text-align: center; max-width: 480px;
}
.error-box h3 { color: #f87171; margin-bottom: 0.75rem; font-size: 1rem; font-weight: 400; letter-spacing: 0.1em; }
.error-box p  { color: var(--text-2); font-size: 0.9rem; margin-bottom: 1.25rem; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(4, 6, 12, 0.88);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
    background: var(--card-bg); border: 1px solid var(--card-border-h);
    border-radius: 8px; padding: 2.25rem; width: 90%; max-width: 400px;
    text-align: center;
    box-shadow: 0 0 40px var(--gold-glow), 0 0 60px var(--blue-glow);
}
.modal-box h3 { font-size: 0.85rem; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-soft); margin-bottom: 0.6rem; }
.modal-box p  { color: var(--text-2); font-size: 0.88rem; margin-bottom: 1.5rem; }

.intensity-options { display: flex; gap: 0.75rem; justify-content: center; margin-bottom: 0.5rem; }
.btn-intensity {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
    padding: 0.9rem 1.4rem; min-width: 80px;
    background: rgba(160, 100, 8, 0.15); border-color: var(--card-border-h);
    color: var(--text-1); border-radius: 4px;
}
.btn-intensity:hover {
    background: rgba(200, 140, 12, 0.28); border-color: var(--gold);
    box-shadow: 0 0 14px var(--gold-glow);
}
.intensity-num   { font-size: 1.4rem; font-weight: 300; color: var(--gold-soft); line-height: 1; }
.intensity-label { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }

.sub-panel {
    margin-top: 1.1rem; padding: 0.9rem 1rem;
    background: rgba(0,0,0,0.28); border: 1px solid var(--border); border-radius: 4px;
}
.sub-panel-label {
    font-size: 0.68rem; letter-spacing: 0.16em;
    text-transform: uppercase; color: var(--text-3); margin-bottom: 0.65rem;
}

.help-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    background: rgba(200, 150, 12, 0.10); color: var(--text-3);
    font-size: 8px; font-weight: 700; cursor: pointer;
    border: 1px solid rgba(200, 150, 12, 0.18); margin-left: 5px;
    vertical-align: middle; transition: all 0.15s;
}
.help-icon:hover, .help-icon.active {
    background: rgba(200, 150, 12, 0.28); color: var(--gold-soft);
    border-color: var(--gold);
}
.help-popover {
    position: fixed; z-index: 9999; max-width: 240px;
    background: rgba(6, 5, 1, 0.97); border: 1px solid rgba(200, 150, 12, 0.30);
    border-radius: 6px; padding: 9px 13px;
    font-family: 'Josefin Slab', Georgia, serif;
    font-size: 0.78rem; line-height: 1.55; color: var(--text-2);
    opacity: 0; pointer-events: none; transition: opacity 0.12s;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 0 20px var(--gold-glow);
}
.help-popover.visible { opacity: 1; pointer-events: auto; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .app-shell { flex-direction: column; overflow: auto; height: auto; }
    body { overflow: auto; }

    .sidebar {
        width: 100%; height: auto;
        border-right: none; border-bottom: 1px solid var(--border);
    }
    .sidebar-logo { padding: 0.5rem 1rem; }
    .logo-img { max-width: 120px; margin: 0 auto; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 0.75rem; gap: 0.4rem; }
    .nav-section-label { display: none; }
    .tab-btn { width: auto; }
    .sidebar-footer { display: none; }

    .main-content { height: auto; overflow-y: visible; padding: 1.5rem 1rem 3rem; }
    .page-banner { width: calc(100% + 2rem); margin-left: -1rem; margin-top: -1.5rem; height: 180px; }
    .results-container { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: repeat(2, 1fr); }
    .tonal-cols { grid-template-columns: 1fr; gap: 1rem 0; }
    .ripple-pond { width: 280px; }
    .ripple-ring:nth-child(1) { width: 70px;  height: 14px; }
    .ripple-ring:nth-child(2) { width: 140px; height: 28px; }
    .ripple-ring:nth-child(3) { width: 210px; height: 42px; }
    .ripple-ring:nth-child(4) { width: 280px; height: 56px; }
}

/* ── Global loading banner ─────────────────────────────────────── */

#globalLoadingBanner {
    width: 100%;
    padding: 1.8rem 0 1.2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.global-loading-text {
    text-align: center;
    color: var(--text-2);
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    margin-bottom: 1.2rem;
}

.master-log-stream {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 180px;
    overflow-y: auto;
    padding: 0.7rem 1.5rem;
    background: rgba(8, 6, 2, 0.92);
    border-top: 1px solid var(--border);
    font-family: 'Courier New', monospace;
    font-size: 0.76rem;
    color: var(--text-2);
    line-height: 1.6;
    backdrop-filter: blur(6px);
}

.master-log-stream div + div {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

/* ── Page banner ───────────────────────────────────────────────── */

.page-banner {
    position: relative;
    width: calc(100% + 5rem);   /* bleed past the main-content padding */
    margin-left: -2.5rem;
    margin-top: -2.5rem;
    margin-bottom: 2.4rem;
    height: 300px;
    overflow: hidden;
    display: block;
    border-bottom: 1px solid var(--border);
}

/* Gradient fade from page background into the image top — gives the text
   visual breathing room without needing blank pixels in the source file */
.page-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        var(--bg) 0%,
        transparent 38%
    );
    z-index: 1;
    pointer-events: none;
}

.page-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* ── Tool intro description ────────────────────────────────────── */

.tool-intro {
    margin-bottom: 2.2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.tool-intro-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: 0.04em;
    margin-bottom: 1.1rem;
}

.tool-intro-body p {
    font-size: 0.95rem;
    color: var(--text-2);
    line-height: 1.75;
    margin-bottom: 0.85rem;
    max-width: 72ch;
}

.tool-intro-body p:last-child {
    margin-bottom: 0;
}

.tool-intro-analogy {
    color: var(--gold-soft) !important;
    font-style: italic;
    border-left: 2px solid var(--card-border-h);
    padding-left: 1rem;
}

/* ── Master tab layout ─────────────────────────────────────────── */

.section-heading {
    font-size: 1.4rem;
    color: var(--text-1);
    margin-bottom: 0.4rem;
}

.section-sub {
    color: var(--text-2);
    font-size: 0.9rem;
    margin-bottom: 1.8rem;
}

/* Three-row stage layout */
.master-three-col {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.master-slot {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
}

.master-slot-label {
    flex: 0 0 200px;
    font-size: 0.95rem;
    color: var(--text-2);
    font-style: italic;
    line-height: 1.5;
}

.master-slot .upload-box {
    flex: 1;
    max-width: none;
    width: 100%;
    padding: 1.5rem 2rem;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1.25rem;
    text-align: left;
}

.master-slot .upload-box .upload-icon { margin-bottom: 0; font-size: 2rem; opacity: 0.65; }
.master-slot .upload-box h3          { margin-bottom: 0; font-size: 1rem; }
.master-slot .upload-box p           { margin-bottom: 0; }

.master-col-arrow {
    font-size: 1.4rem;
    color: var(--gold);
    align-self: center;
    padding: 0.2rem 0;
}

/* Upload box — file selected state */
.upload-box.has-file .upload-icon,
.upload-box.has-file h3,
.upload-box.has-file > p,
.upload-box.has-file .btn {
    display: none;
}

.upload-box.has-file {
    cursor: pointer;
    justify-content: center;
}

.master-slot .upload-box.has-file {
    justify-content: flex-start;
    padding-left: 2rem;
}

.master-selected-name {
    display: none;
    font-size: clamp(1.4rem, 3.5vw, 2.8rem);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-1);
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.15;
    padding: 0 1rem;
    hyphens: auto;
}

.upload-box.has-file .master-selected-name {
    display: block;
}

/* Master CTA button — studio console LED, bright red body, tungsten text + glow */
.btn-master-cta {
    background: #cc0000;
    color: var(--tungsten-text);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.18em;
    border-top:    2px solid rgba(255, 120, 120, 0.45);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(180, 0, 0, 0.6);
    border-right:  1px solid rgba(180, 0, 0, 0.6);
    border-radius: 3px;
    text-shadow: 0 0 10px rgba(255, 180, 80, 0.9);
    box-shadow:
        0 0 22px var(--tungsten-glow),
        0 0 50px rgba(255, 148, 40, 0.20),
        inset 0 1px 0 rgba(255, 140, 140, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

.btn-master-cta.flashing {
    animation: master-led-flash 2.34s ease-in-out infinite;
}

.btn-master-cta:hover {
    animation: none;
    background: #ff1a1a;
    box-shadow:
        0 0 35px var(--tungsten-glow),
        0 0 70px rgba(255, 148, 40, 0.35),
        inset 0 1px 0 rgba(255, 160, 160, 0.35);
}

.btn-master-cta:active {
    transform: translateY(1px);
    box-shadow:
        0 0 14px rgba(255, 148, 40, 0.4),
        inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

@keyframes master-led-flash {
    0%, 100% {
        background: #cc0000;
        box-shadow:
            0 0 22px var(--tungsten-glow),
            0 0 50px rgba(255, 148, 40, 0.20),
            inset 0 1px 0 rgba(255, 140, 140, 0.25);
        color: var(--tungsten-text);
        text-shadow: 0 0 10px rgba(255, 180, 80, 0.9);
    }
    50% {
        background: #4a0000;
        box-shadow:
            0 0 5px rgba(255, 148, 40, 0.10),
            inset 0 2px 4px rgba(0, 0, 0, 0.5);
        color: rgba(255, 200, 120, 0.45);
        text-shadow: none;
    }
}

/* Result box — same border style as upload boxes but distinct pending state */
.master-result-box {
    cursor: default;
}

.master-result-pending {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
}

.master-result-pending .upload-icon,
.master-result-pending h3,
.master-result-pending p {
    opacity: 0.45;
}

.master-result-complete {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0;
}

.master-done-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 0.35rem;
}

.master-done-sub {
    font-size: 0.72rem;
    color: var(--text-2);
    text-align: center;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* Compact metrics table inside result box */
.mrm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin-bottom: 0.9rem;
}

.mrm-table th {
    font-size: 0.65rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0 0.3rem 0.35rem;
    text-align: right;
}

.mrm-table th:first-child { text-align: left; }

.mrm-label {
    color: var(--text-2);
    font-size: 0.72rem;
    padding: 0.2rem 0.3rem 0.2rem 0;
    white-space: nowrap;
}

.mrm-before {
    color: var(--text-2);
    text-align: right;
    padding: 0.2rem 0.3rem;
    font-variant-numeric: tabular-nums;
}

.mrm-arr {
    color: var(--gold);
    text-align: center;
    padding: 0.2rem 0.1rem;
    font-size: 0.7rem;
}

.mrm-after {
    color: var(--gold-bright);
    text-align: right;
    padding: 0.2rem 0 0.2rem 0.3rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.master-dl-btn {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
}

.master-reset-btn {
    width: 100%;
}

/* ── Loudness tab ────────────────────────────────────────────────────────── */

.loudness-platform-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1.5rem;
}

.loudness-select-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.loudness-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-2);
    white-space: nowrap;
}

.loudness-select {
    flex: 1;
    min-width: 220px;
    padding: 0.6rem 1rem;
    background: #050d1a;
    color: #cce0ff;
    border-top:    2px solid rgba(120, 180, 255, 0.20);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(60, 120, 255, 0.20);
    border-right:  1px solid rgba(60, 120, 255, 0.20);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow:
        0 0 10px rgba(0, 100, 255, 0.10),
        inset 0 1px 0 rgba(80, 140, 255, 0.08);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2366aaff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.loudness-select:focus {
    outline: none;
    border-color: rgba(100, 160, 255, 0.50);
    box-shadow: 0 0 18px rgba(0, 120, 255, 0.30);
}

.loudness-select option {
    background: #080e1c;
    color: #cce0ff;
}

.loudness-result {
    margin-top: 2rem;
}

.loudness-result-inner {
    background: var(--card-bg);
    border: 1px solid var(--card-border-h);
    border-radius: 6px;
    padding: 2rem;
    max-width: 560px;
}

.loudness-done-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 0.4rem;
    letter-spacing: 0.06em;
}

.loudness-done-sub {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 1.2rem;
    letter-spacing: 0.04em;
}

.loudness-clamped-msg {
    font-size: 0.8rem;
    color: var(--gold-soft);
    margin-bottom: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-left: 2px solid var(--gold);
    background: rgba(200, 150, 12, 0.06);
    border-radius: 0 3px 3px 0;
}

.loudness-dl-btn {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
    display: block;
}

/* ── Convert tab ─────────────────────────────────────────────────────────── */

.convert-format-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1.5rem;
}

.convert-select-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.convert-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-2);
    white-space: nowrap;
}

.convert-select {
    flex: 1;
    min-width: 220px;
    padding: 0.6rem 1rem;
    background: #050d1a;
    color: #cce0ff;
    border-top:    2px solid rgba(120, 180, 255, 0.20);
    border-bottom: 2px solid rgba(0, 0, 0, 0.55);
    border-left:   1px solid rgba(60, 120, 255, 0.20);
    border-right:  1px solid rgba(60, 120, 255, 0.20);
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 100, 255, 0.10), inset 0 1px 0 rgba(80, 140, 255, 0.08);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2366aaff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.convert-select:focus {
    outline: none;
    border-color: rgba(100, 160, 255, 0.50);
    box-shadow: 0 0 18px rgba(0, 120, 255, 0.30);
}

.convert-select option { background: #080e1c; color: #cce0ff; }
.convert-select option:disabled { color: rgba(100, 140, 200, 0.35); }

.convert-result { margin-top: 2rem; }

.convert-result-inner {
    background: var(--card-bg);
    border: 1px solid var(--card-border-h);
    border-radius: 6px;
    padding: 2rem;
    max-width: 560px;
}

.convert-done-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 0.4rem;
    letter-spacing: 0.06em;
}

.convert-done-sub {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 1.2rem;
    letter-spacing: 0.04em;
}

.convert-dl-btn {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
    display: block;
}

/* ── Spectrogram tab ─────────────────────────────────────────────────────── */

.spectrogram-result {
    animation: fadeUp 0.5s ease both;
}

.spectrogram-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 0 1.25rem;
    font-size: 0.88rem;
    color: var(--text-2);
}

.spectrogram-wrap {
    width: 100%;
    background: #020508;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(0, 100, 255, 0.12),
        0 0 80px rgba(0, 180, 255, 0.06),
        inset 0 0 0 1px rgba(0, 153, 255, 0.06);
}

.spectrogram-canvas {
    display: block;
    width: 100%;
    /* height set by JS */
}

/* ── Sheet music tab ─────────────────────────────────────────────────────── */

.sheet-result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sheet-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: 0.06em;
}

.sheet-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sheet-page-info {
    font-size: 0.78rem;
    color: var(--text-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sheet-pages {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sheet-page {
    background: #ffffff;
    border-radius: 4px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.5),
        0 1px 4px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 100%;
}

.sheet-page svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Stems tab ───────────────────────────────────────────────────────────── */

.premium-badge {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffdddd;
    background: #550000;
    border: 1px solid rgba(255, 100, 100, 0.4);
    border-radius: 3px;
    padding: 0.15rem 0.5rem;
    vertical-align: middle;
    margin-left: 0.6rem;
    text-shadow: 0 0 8px rgba(255, 80, 80, 0.7);
    box-shadow: 0 0 10px rgba(200, 0, 0, 0.35);
    position: relative;
    top: -2px;
}

.stems-warning {
    margin-top: 1rem;
    padding: 0.65rem 1rem;
    border-left: 2px solid rgba(255, 180, 0, 0.5);
    background: rgba(255, 160, 0, 0.06);
    font-size: 0.82rem;
    color: var(--gold-soft);
    border-radius: 0 3px 3px 0;
}

.stems-result {
    margin-top: 2rem;
}

.stems-done-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 0.4rem;
    letter-spacing: 0.06em;
}

.stems-done-sub {
    font-size: 0.8rem;
    color: var(--text-3);
    margin-bottom: 1.2rem;
    letter-spacing: 0.04em;
}

.stems-download-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-width: 560px;
}

.stems-dl-btn {
    width: 100%;
    text-align: center;
}

.stems-zip-btn {
    display: block;
    width: 100%;
    max-width: 560px;
    text-align: center;
    margin-top: 0.9rem;
}

/* Wide ripple below the three columns */
.master-loading {
    width: 100%;
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.master-ripple-pond {
    position: relative;
    width: 100%;
    height: 56px;
    overflow: visible;
}

.master-ripple-pond .ripple-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--blue);
    box-shadow: 0 0 8px var(--blue-glow);
    animation: ripple-expand 2.4s ease-out infinite;
}

.master-ripple-pond .ripple-ring:nth-child(1) { width: 25%;  height: 14px; animation-delay: 0s; }
.master-ripple-pond .ripple-ring:nth-child(2) { width: 50%;  height: 28px; animation-delay: 0.6s; }
.master-ripple-pond .ripple-ring:nth-child(3) { width: 75%;  height: 42px; animation-delay: 1.2s; }
.master-ripple-pond .ripple-ring:nth-child(4) { width: 100%; height: 56px; animation-delay: 1.8s; }

.master-loading-text {
    color: var(--text-2);
    font-size: 0.9rem;
}

@media (max-width: 700px) {
    .master-three-col { flex-direction: column; }
    .master-col-arrow { transform: rotate(90deg); align-self: center; padding: 0.5rem 0; }
}

/* ── Synth tab ───────────────────────────────────────────────────────────── */

.synth-engine {
    margin-top: 0.25rem;
}

.synth-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.synth-preset-btn {
    font-size: 0.70rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.32rem 0.85rem;
    background: rgba(0, 30, 80, 0.35);
    border: 1px solid rgba(0, 80, 200, 0.22);
    border-radius: 3px;
    color: rgba(100, 155, 230, 0.65);
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
}

.synth-preset-btn:hover,
.synth-preset-btn.active {
    background: rgba(0, 60, 160, 0.42);
    border-color: rgba(0, 140, 255, 0.48);
    color: #99ccff;
    box-shadow:
        0 0 10px rgba(0, 100, 255, 0.22),
        0 0 18px rgba(255, 148, 40, 0.20);
}

.synth-random-btn {
    font-size: 0.70rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    padding: 0.32rem 0.85rem;
    background: rgba(60, 30, 0, 0.45);
    border: 1px solid rgba(255, 148, 40, 0.38);
    border-radius: 3px;
    color: rgba(255, 185, 80, 0.78);
    cursor: pointer;
    margin-left: auto;   /* push to right end of preset row */
    transition: background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
}

.synth-random-btn:hover {
    background: rgba(90, 45, 0, 0.55);
    border-color: rgba(255, 170, 60, 0.58);
    color: #ffd080;
    box-shadow:
        0 0 10px rgba(220, 120, 0, 0.30),
        0 0 18px rgba(255, 148, 40, 0.28);
}

/* Controls row */

.synth-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.synth-panel {
    background: rgba(2, 8, 22, 0.65);
    border: 1px solid rgba(0, 70, 180, 0.18);
    border-radius: 4px;
    padding: 0.55rem 0.65rem 0.65rem;
    flex: 1;
    min-width: 110px;
}

.synth-panel-title {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: rgba(60, 120, 210, 0.65);
    margin-bottom: 0.5rem;
    padding-bottom: 0.22rem;
    border-bottom: 1px solid rgba(0, 70, 180, 0.14);
}

.synth-panel-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Knobs */

.synth-knob-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.22rem;
}

.synth-knob {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    user-select: none;
}

.synth-knob svg {
    display: block;
}

.synth-knob-label {
    font-size: 0.56rem;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(80, 135, 210, 0.65);
    text-align: center;
    line-height: 1.2;
}

.synth-knob-value {
    font-size: 0.57rem;
    color: rgba(0, 190, 255, 0.82);
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    min-width: 28px;
    line-height: 1.3;
}

/* Wave selector */

.synth-wave-sel {
    display: flex;
    gap: 2px;
}

.synth-wave-btn {
    background: rgba(0, 20, 60, 0.55);
    border: 1px solid rgba(0, 70, 180, 0.18);
    border-radius: 3px;
    padding: 2px 3px;
    color: rgba(70, 120, 200, 0.50);
    cursor: pointer;
    transition: all 0.12s;
    line-height: 0;
}

.synth-wave-btn:hover {
    background: rgba(0, 40, 110, 0.55);
    color: rgba(110, 170, 255, 0.88);
}

.synth-wave-btn.active {
    background: rgba(0, 70, 190, 0.38);
    border-color: rgba(0, 140, 255, 0.42);
    color: #77aaff;
    box-shadow: 0 0 6px rgba(0, 110, 255, 0.18);
}

/* LFO dest */

.synth-dest-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.synth-dest-label {
    font-size: 0.56rem;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(80, 130, 200, 0.55);
    margin-right: 1px;
}

.synth-dest-btn {
    background: rgba(0, 20, 60, 0.55);
    border: 1px solid rgba(0, 70, 180, 0.18);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.56rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(70, 120, 200, 0.55);
    cursor: pointer;
    transition: all 0.12s;
}

.synth-dest-btn:hover {
    background: rgba(0, 40, 110, 0.55);
    color: rgba(110, 170, 255, 0.88);
}

.synth-dest-btn.active {
    background: rgba(0, 70, 190, 0.38);
    border-color: rgba(0, 140, 255, 0.42);
    color: #77aaff;
}

/* Keyboard */

.synth-keyboard-wrap {
    overflow-x: auto;
    padding: 0.6rem 0 0.4rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,100,220,0.25) transparent;
}

.synth-key {
    position: absolute;
    border-radius: 0 0 3px 3px;
    cursor: pointer;
    user-select: none;
    transition: background 0.04s, box-shadow 0.04s;
    touch-action: none;
}

.synth-key.white {
    background: linear-gradient(to bottom, #d0e2f6 0%, #eef5ff 100%);
    border: 1px solid rgba(0, 70, 180, 0.28);
    border-top-width: 2px;
    box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.08);
    z-index: 1;
}

.synth-key.white:hover {
    background: linear-gradient(to bottom, #b8d4f4 0%, #ddeeff 100%);
}

.synth-key.white.active {
    background: linear-gradient(to bottom, #0055bb 0%, #0099ff 100%);
    box-shadow:
        0 0 14px rgba(0, 140, 255, 0.55),
        inset 0 2px 5px rgba(0, 0, 0, 0.22);
}

.synth-key.black {
    background: linear-gradient(to bottom, #080c1e 0%, #151c38 100%);
    border: 1px solid rgba(0, 50, 160, 0.38);
    box-shadow:
        2px 4px 10px rgba(0, 0, 0, 0.55),
        inset 0 1px 2px rgba(255, 255, 255, 0.04);
    z-index: 2;
    top: 0;
}

.synth-key.black:hover {
    background: linear-gradient(to bottom, #0c1228 0%, #1a2240 100%);
}

.synth-key.black.active {
    background: linear-gradient(to bottom, #002870 0%, #0055cc 100%);
    box-shadow:
        0 0 12px rgba(0, 120, 255, 0.50),
        inset 0 1px 3px rgba(0, 0, 0, 0.30);
}

.synth-key-label {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.52rem;
    letter-spacing: 0.05em;
    color: rgba(0, 70, 180, 0.48);
    user-select: none;
    pointer-events: none;
    white-space: nowrap;
}

/* Transport */

.synth-transport {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(0, 70, 180, 0.12);
}

.synth-midi-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.synth-midi-upload-btn {
    font-size: 0.70rem;
    padding: 0.32rem 0.80rem;
    cursor: pointer;
    letter-spacing: 0.08em;
}

.synth-midi-name {
    font-size: 0.72rem;
    color: var(--text-3);
    letter-spacing: 0.04em;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.synth-play-btn {
    font-size: 0.72rem;
    padding: 0.32rem 1.3rem;
    letter-spacing: 0.12em;
    min-width: 72px;
}

/* Demos button — red / premium */
.synth-demos-wrap {
    position: relative;
}

.synth-demos-btn {
    font-size: 0.72rem;
    padding: 0.32rem 0.90rem;
    letter-spacing: 0.12em;
    background: rgba(120, 0, 0, 0.45);
    border-color: rgba(255, 80, 80, 0.45);
    color: #ffaaaa;
    box-shadow:
        inset 0 1px 0 rgba(255, 100, 100, 0.15),
        0 0 10px rgba(200, 0, 0, 0.28),
        0 0 18px rgba(255, 148, 40, 0.18);
}

.synth-demos-btn:hover {
    background: rgba(160, 10, 10, 0.55);
    border-color: rgba(255, 100, 100, 0.60);
    color: #ffcccc;
    box-shadow:
        inset 0 1px 0 rgba(255, 130, 130, 0.20),
        0 0 14px rgba(220, 0, 0, 0.38),
        0 0 22px rgba(255, 148, 40, 0.22);
}

.synth-demos-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 200;
    min-width: 200px;
    max-width: 280px;
    max-height: 260px;
    overflow-y: auto;
    background: rgba(6, 10, 26, 0.97);
    border: 1px solid rgba(255, 70, 70, 0.30);
    border-radius: 4px;
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.60),
        0 0 16px rgba(180, 0, 0, 0.18);
    scrollbar-width: thin;
    scrollbar-color: rgba(200, 50, 50, 0.30) transparent;
}

.synth-demos-loading {
    padding: 0.6rem 0.9rem;
    font-size: 0.72rem;
    color: rgba(200, 150, 150, 0.65);
    letter-spacing: 0.06em;
}

.synth-demos-item {
    display: block;
    width: 100%;
    padding: 0.42rem 0.9rem;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 60, 60, 0.08);
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    color: rgba(220, 170, 170, 0.80);
    cursor: pointer;
    transition: background 0.10s, color 0.10s;
    font-family: inherit;
}

.synth-demos-item:last-child {
    border-bottom: none;
}

.synth-demos-item:hover {
    background: rgba(180, 0, 0, 0.22);
    color: #ffcccc;
}

/* Loop button — green */
.synth-loop-btn {
    font-size: 0.72rem;
    padding: 0.32rem 0.90rem;
    letter-spacing: 0.12em;
    background: rgba(0, 60, 30, 0.40);
    border-color: rgba(50, 200, 100, 0.30);
    color: rgba(100, 210, 140, 0.75);
    box-shadow:
        inset 0 1px 0 rgba(80, 220, 120, 0.10),
        0 0 8px rgba(0, 180, 70, 0.15),
        0 0 18px rgba(255, 148, 40, 0.14);
    transition: background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
}

.synth-loop-btn:hover {
    background: rgba(0, 80, 40, 0.50);
    border-color: rgba(60, 220, 110, 0.45);
    color: rgba(140, 240, 170, 0.90);
}

.synth-loop-btn.active {
    background: rgba(0, 100, 45, 0.52);
    border-color: rgba(60, 230, 120, 0.60);
    color: #88ffb8;
    box-shadow:
        inset 0 1px 0 rgba(100, 255, 150, 0.18),
        0 0 14px rgba(0, 210, 80, 0.38),
        0 0 22px rgba(0, 180, 60, 0.22),
        0 0 18px rgba(255, 148, 40, 0.18);
}

.synth-tempo {
    font-size: 0.70rem;
    color: var(--text-3);
    letter-spacing: 0.06em;
}
