/* Add song chooser (spec 2026-10-16 §7.2) and processing stages (§7.3).
   Loaded only when recipes are enabled. The chooser is a light sheet that sits in the
   always-dark hero; the one bold moment is the dark "What you'll get" panel, where the
   recording splits into the lanes you picked. Everything else stays quiet. */

.ss-as {
    --as-sheet: #f6f5fb;
    --as-card: #ffffff;
    --as-line: #e4e1ef;
    --as-ink: #16122b;
    --as-muted: #475569;
    --as-violet: #7c3aed;
    --as-violet-deep: #5b21b6;
    --as-lavender: #ede9fe;
    --as-night: #1e1438;
    --as-night-ink: #f5f3ff;
    --as-night-soft: #c4b5fd;

    box-sizing: border-box;
    width: 100%;
    margin-top: 4px;
    padding: 28px;
    border-radius: 22px;
    background: var(--as-sheet);
    color: var(--as-ink);
    text-align: left;
    font-family: inherit;
    box-shadow: 0 24px 60px rgba(10, 6, 30, 0.35);
}
.ss-as *, .ss-as *::before, .ss-as *::after { box-sizing: border-box; }

/* The hero's upload column is 600px; the chooser needs room for cards beside the panel. */
.ss-upload-section--dark.ss-upload-section--wide { max-width: 1080px; }

.ss-as-header { margin-bottom: 24px; }
.ss-as-h2 {
    margin: 0 0 6px;
    font-size: 30px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--as-ink);
}
.ss-as-lede { margin: 0; max-width: 62ch; font-size: 15px; line-height: 1.55; color: var(--as-muted); }

.ss-as-step + .ss-as-step { margin-top: 28px; }
.ss-as-step-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 8px 20px; margin-bottom: 14px;
}
.ss-as-h3 {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 12px;
    font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--as-ink);
}
.ss-as-step-head .ss-as-h3 { margin: 0; }
.ss-as-num {
    flex: none; width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--as-lavender); color: var(--as-violet-deep);
    font-size: 13px; font-weight: 700;
}

/* ── 1. The file ─────────────────────────────────────────────────────────────── */
.ss-as-file {
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px;
    padding: 14px 16px;
    background: var(--as-card);
    border: 1px solid var(--as-line);
    border-radius: 14px;
}
.ss-as-file-text { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ss-as-label { font-size: 12px; font-weight: 600; color: var(--as-muted); }
.ss-as-title {
    width: 100%; min-height: 44px;
    padding: 8px 10px;
    font: inherit; font-size: 16px; font-weight: 600; color: var(--as-ink);
    background: #fff; border: 1px solid #ddd6fe; border-radius: 9px;
}
.ss-as-title:focus { outline: 2px solid var(--as-violet); outline-offset: 1px; border-color: var(--as-violet); }
.ss-as-meta { font-size: 13px; color: var(--as-muted); overflow-wrap: anywhere; }
.ss-as-filename { color: var(--as-ink); }
.ss-as-wave {
    flex: 2 1 280px; min-width: 0; height: 52px; display: block;
    border-radius: 8px;
    /* Placeholder stripes until the real peaks are drawn. */
    background: repeating-linear-gradient(90deg, #e9e4fb 0 3px, transparent 3px 6px) center / 100% 40% no-repeat;
}
.ss-as-wave.is-drawn { background: none; }
.ss-as-replace {
    flex: none; min-height: 44px; padding: 0 16px;
    font: inherit; font-size: 14px; font-weight: 600; color: #6d28d9;
    background: transparent; border: 1px solid #ddd6fe; border-radius: 9px; cursor: pointer;
}
.ss-as-replace:hover { background: var(--as-lavender); }

/* ── 2. The choice ───────────────────────────────────────────────────────────── */
.ss-as-key { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--as-muted); }
.ss-as-key-item { display: inline-flex; align-items: center; gap: 6px; }
.ss-as-key-dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.ss-as-key-dot.is-isolated { background: var(--as-violet); }

.ss-as-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.ss-as-choose { min-width: 0; }
.ss-as-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

.ss-as-card {
    position: relative;
    display: flex; flex-direction: column; gap: 9px;
    width: 100%; min-height: 44px;
    padding: 15px 16px;
    font: inherit; text-align: left; color: var(--as-ink);
    background: var(--as-card);
    border: 1px solid var(--as-line);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ss-as-card:hover { border-color: #c4b5fd; }
.ss-as-card.is-selected {
    padding: 14px 15px;              /* keeps the box the same size with the 2px border */
    background: #faf8ff;
    border: 2px solid var(--as-violet);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.14);
}
.ss-as-card.is-locked { background: #fbfbfd; }
.ss-as-card.is-locked .ss-as-card-title,
.ss-as-card.is-locked .ss-as-card-desc,
.ss-as-card.is-locked .ss-as-pills { opacity: 0.62; }
.ss-as-card:focus-visible,
.ss-as-opt:focus-visible,
.ss-as-replace:focus-visible,
.ss-as-split:focus-visible,
.ss-as-back:focus-visible,
.ss-as-tracks:focus-visible { outline: 3px solid #a78bfa; outline-offset: 2px; }

.ss-as-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ss-as-card-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.ss-as-card-desc { font-size: 14px; line-height: 1.45; color: var(--as-muted); }
.ss-as-card-tick {
    flex: none; width: 22px; height: 22px; padding: 4px;
    border-radius: 50%; background: var(--as-violet);
    fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
    visibility: hidden;
}
.ss-as-card.is-selected .ss-as-card-tick { visibility: visible; }
.ss-as-plus {
    flex: none; padding: 3px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 700; color: var(--as-violet-deep); background: var(--as-lavender);
}
.ss-as-card.is-unavailable,
.ss-as-card.is-unavailable:hover { background: #fbfbfd; border-color: var(--as-line); cursor: not-allowed; }
.ss-as-card.is-unavailable .ss-as-card-title,
.ss-as-card.is-unavailable .ss-as-card-desc,
.ss-as-card.is-unavailable .ss-as-pills { opacity: 0.5; }
.ss-as-unavailable {
    flex: none; padding: 3px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 700; color: #475569; background: #f1f5f9;
}

.ss-as-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ss-as-pill {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 1.4;
    background: #f1f5f9; color: #475569;
}
.ss-as-pill.is-isolated { background: #ede9fe; color: #5b21b6; }

.ss-as-follow {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
    margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--as-line);
}
.ss-as-q { margin: 0; font-size: 15px; font-weight: 600; color: var(--as-ink); }
.ss-as-opts { display: flex; gap: 8px; }
.ss-as-opt {
    min-height: 44px; min-width: 64px; padding: 0 18px;
    font: inherit; font-size: 15px; font-weight: 600; color: #334155;
    background: #fff; border: 1px solid #ddd6fe; border-radius: 10px; cursor: pointer;
}
.ss-as-opt.is-selected { background: var(--as-violet); border-color: var(--as-violet); color: #fff; }

/* ── The panel: the recording splitting into your lanes ──────────────────────── */
.ss-as-panel {
    min-width: 0;
    padding: 22px;
    border-radius: 18px;
    background: var(--as-night);
    color: var(--as-night-ink);
    align-self: start;
}
.ss-as-panel-h { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--as-night-soft); }
.ss-as-gets { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ss-as-gets li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.45; color: #e9e5fb; }
.ss-as-get-tick {
    flex: none; width: 18px; height: 18px; margin-top: 1px;
    fill: none; stroke: #a78bfa; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}

.ss-as-flow { display: flex; align-items: center; gap: 10px; }
.ss-as-source { flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ss-as-source-wave {
    width: 64px; height: 44px; border-radius: 9px; opacity: 0.85;
    background: repeating-linear-gradient(90deg, #8b7bc8 0 3px, transparent 3px 6px);
    animation: ss-as-flow 1.6s linear infinite;
}
.ss-as-source-label { font-size: 11px; line-height: 1.2; font-weight: 600; text-align: center; color: var(--as-night-soft); }
.ss-as-arrow { flex: none; fill: none; stroke: #a78bfa; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ss-as-lanes-wrap { flex: 1; min-width: 0; }
.ss-as-lane-count { display: block; margin-bottom: 6px; font-size: 12px; color: #a5a0c8; }
.ss-as-lanes { display: flex; flex-direction: column; gap: 6px; }
.ss-as-lane {
    display: flex; align-items: center; gap: 8px; min-width: 0;
    animation: ss-as-lane-in .45s ease-out both;     /* delay is set inline per lane */
}
.ss-as-lane-name {
    flex: none; width: 96px;
    font-size: 12.5px; font-weight: 600; color: var(--as-night-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ss-as-lane-bars { flex: 1; min-width: 0; height: 22px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.ss-as-lane-bars i { flex: none; width: 3px; border-radius: 2px; background: #64748b; opacity: 0.6; }
.ss-as-lane.is-isolated .ss-as-lane-bars i { background: #a78bfa; opacity: 0.95; }
.ss-as-lane.is-isolated:nth-child(3n+2) .ss-as-lane-bars i { background: #c4b5fd; }
.ss-as-lane.is-isolated:nth-child(3n+3) .ss-as-lane-bars i { background: #8b5cf6; }

@keyframes ss-as-lane-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes ss-as-flow { from { background-position: 0 0; } to { background-position: -48px 0; } }

/* ── Actions ─────────────────────────────────────────────────────────────────── */
.ss-as-actions {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 20px;
    margin-top: 24px;
}
/* `.ss-as a.…`: the platform layout's `.ss-container a` (0,1,1) would otherwise win. */
.ss-as a.ss-as-back,
.ss-as a.ss-as-tracks {
    min-height: 44px; display: inline-flex; align-items: center;
    font-size: 14px; font-weight: 600; color: #6d28d9; text-decoration: none;
}
.ss-as a.ss-as-tracks { font-weight: 500; }
.ss-as a.ss-as-back:hover, .ss-as a.ss-as-tracks:hover { color: #5b21b6; text-decoration: underline; }
/* Links sit left, Split song right. */
.ss-as-actions > a:last-of-type { margin-right: auto; }
.ss-as-split {
    min-height: 50px; padding: 0 30px;
    font: inherit; font-size: 16px; font-weight: 700; color: #fff;
    background: var(--as-violet); border: 0; border-radius: 12px; cursor: pointer;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}
.ss-as-split:hover { background: #6d28d9; }

/* ── Processing stages, inside the hand-off panel ───────────────────────────── */
.ss-upload-zone.ss-as-staged { padding: 0; min-height: 0; }
.ss-upload-zone.ss-as-staged .ss-upload-done { position: relative; inset: auto; min-height: 280px; }

.ss-as-progress { width: 100%; max-width: 420px; margin-top: 18px; text-align: left; }
.ss-as-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ss-as-stage { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; }
.ss-as-stage-dot {
    flex: none; width: 22px; height: 22px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid rgba(139, 92, 246, 0.45);
}
.ss-as-stage-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ss-as-stage-label { font-size: 14px; line-height: 1.4; font-weight: 500; }
.ss-as-stage-detail { font-size: 12px; line-height: 1.4; opacity: 0.7; }

.ss-as-stage.is-done .ss-as-stage-dot { background: #8b5cf6; border-color: #8b5cf6; }
.ss-as-stage-tick { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ss-as-stage.is-active .ss-as-stage-dot {
    border-color: #a78bfa; border-top-color: transparent;
    animation: ss-as-spin .8s linear infinite;
}
.ss-as-stage.is-active .ss-as-stage-label { font-weight: 700; }
.ss-as-stage.is-pending { opacity: 0.55; }
.ss-as-stage.is-failed .ss-as-stage-dot { background: #dc2626; border-color: #dc2626; }
.ss-as-stage.is-failed .ss-as-stage-label { font-weight: 700; }
.ss-as-stage.is-failed .ss-as-stage-detail { color: #dc2626; opacity: 1; }

.ss-as-live-lanes { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(139, 92, 246, 0.25); }
.ss-as-live-lane { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.ss-as-live-dot { width: 10px; height: 10px; border-radius: 50%; background: #a78bfa; }

@keyframes ss-as-spin { to { transform: rotate(360deg); } }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
@media (min-width: 769px) {
    .ss-as-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 22px; }
    .ss-as-cards { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
    .ss-as-card { min-height: 150px; }
    .ss-as-panel { position: sticky; top: 16px; }
}

/* The viewport is the wrong ruler for this grid: with the 256px teacher sidebar, a 1024px
   window leaves the sheet ~580px inside, so the side panel left the cards ~200px and they
   ran under it (UAT 2 Nov). Where container queries exist, size the grid from the sheet. */
@supports (container-type: inline-size) {
    .ss-as { container-type: inline-size; }
    @media (min-width: 769px) {
        .ss-as-grid { grid-template-columns: minmax(0, 1fr); }
        .ss-as-panel { position: static; }
    }
    @container (min-width: 640px) {
        .ss-as-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 22px; }
        .ss-as-panel { position: sticky; top: 16px; }
    }
}

@media (max-width: 600px) {
    /* Phones: the hero already gives a 16px gutter, so the sheet runs edge to edge
       of it and the cards keep that same 16px. */
    .ss-as { padding: 20px 16px; margin-left: -16px; margin-right: -16px; width: calc(100% + 32px); border-radius: 18px; }
    .ss-as-h2 { font-size: 26px; }
    .ss-as-wave { display: none; }
    .ss-as-file { padding: 12px 14px; }
    .ss-as-split { width: 100%; }
    .ss-as-back, .ss-as-tracks { width: 100%; justify-content: center; text-align: center; }
    .ss-as-actions > a:last-of-type { margin-right: 0; }
    .ss-as-lane-name { width: 104px; font-size: 12px; }
    .ss-as-flow { gap: 8px; }
    .ss-as-source { width: 44px; }
    .ss-as-source-wave { width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .ss-as-lane,
    .ss-as-source-wave,
    .ss-as-stage.is-active .ss-as-stage-dot { animation: none; }
    .ss-as-card { transition: none; }
}
