/* Fan simple mode (scripts/web/simple-mode.js).
   Spec: docs/superpowers/specs/2026-09-24-fan-simple-mode-design.md
   Visual decisions: docs/prototypes/simple-mode/visual-notes.md (owner, 2026-09-24):
   studio rhythm 24/20 · column 960 · three equal home cards · studio heading 500 ·
   monochrome · outline + pressed wash for choices · .song-progress-step pills ·
   thinking orb on waits and onboarding · gentle rise + 0.98 press · sticky phone CTA ·
   studio sidebar and tab bar kept with simple-mode entries.
   Only existing nordic tokens; artwork swatches are content, not chrome. */

:root {
  --sm-pad: 24px;
  --sm-gap: 20px;
  --sm-col: 960px;
  --sm-sel: var(--glass-ink);
  --sm-sel-fill: var(--nordic-pressed);
  --sm-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── mode switch: which layer and which navigation is on screen ── */
html:not([data-ui-mode="simple"]) :is(#simplePanel, [data-simple-nav], #btnSimpleHelp) { display: none !important; }
html[data-ui-mode="simple"] #studioMain > :not(#simplePanel, #appError, [data-network-panel]) { display: none !important; }
html[data-ui-mode="simple"] #appSidebar :is(.nav-group-studio, .nav-group-team) { display: none !important; }
/* Simple mode keeps «Мой профиль» and «Настройки» from the library group, without its heading. */
html[data-ui-mode="simple"] #appSidebar .nav-group-library > :not(a[href="#u/me"], a[href="#settings"]) { display: none !important; }
html[data-ui-mode="simple"] #studioTabbar .tabbar-item:not([data-simple-nav]) { display: none !important; }
#studioMain.network-route #simplePanel { display: none; }

/* header toggle: segmented, in the .nav-pill pressed language */
.sm-mode {
  display: inline-flex;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini);
  background: var(--nordic-surface);
  flex: none;
}
html[data-theme="nordic"] .sm-mode button {
  min-height: 0;
  border: 0;
  background: transparent;
  border-radius: calc(var(--radius-mini) - 3px);
  padding: 0 12px;
  font-size: 12px;
  color: var(--glass-body);
}
html[data-theme="nordic"] .sm-mode button:hover:not(:disabled) { background: var(--nordic-hover); }
html[data-theme="nordic"] .sm-mode button[aria-pressed="true"] { background: var(--nordic-pressed); color: var(--glass-ink); }
html[data-theme="nordic"] .utilities #btnSimpleHelp { font-weight: 600; }

@media (max-width: 767px) {
  html[data-theme="nordic"] .sm-mode button { padding: 0 8px; font-size: 11.5px; }
  html[data-ui-mode="simple"] #appSidebar .nav-group-simple { display: none; }
}

/* ── layout ── */
.sm-main {
  max-width: var(--sm-col);
  margin: 0 auto;
  padding: var(--sm-pad);
  display: grid;
  gap: var(--sm-gap);
  align-content: start;
}
@media (max-width: 640px) { .sm-main { padding: 20px 16px; } }
.sm-head { display: grid; gap: 8px; }
.sm-head .eyebrow { margin: 0; }
.sm-title {
  margin: 0;
  color: var(--glass-ink);
  font-size: clamp(26px, 2.6vw, 38px);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.sm-title:focus { outline: none; }
.sm-lead { margin: 0; color: var(--glass-body); font-size: 15px; line-height: 1.5; max-width: 60ch; text-wrap: pretty; }
.sm-note { margin: 0; color: var(--glass-label); font-size: 12px; line-height: 1.5; max-width: 60ch; }
.sm-error { margin: 0; color: var(--nordic-error); font-size: 14px; }
html[data-theme="nordic"] .sm-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 13px;
  color: var(--glass-label);
}
html[data-theme="nordic"] .sm-back:hover:not(:disabled) { background: transparent; color: var(--glass-ink); }
.sm-back svg { width: 14px; height: 14px; }
.sm-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sm-row.split { justify-content: space-between; }
html[data-theme="nordic"] .sm-dock-alt { display: inline-flex; align-items: center; gap: 8px; }
.sm-dock-alt svg { flex: none; }
html[data-theme="nordic"] .sm-cta { min-height: 48px; padding: 0 24px; font-size: 14px; font-weight: 600; }
html[data-theme="nordic"] .sm-link {
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--glass-ink);
}
html[data-theme="nordic"] .sm-link:hover:not(:disabled) { background: transparent; }
.sm-cost { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--glass-label); font-variant-numeric: tabular-nums; }

/* stepper reuses .song-progress-steps / .song-progress-step */
.sm-steps .song-progress-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sm-steps .song-progress-step.is-done::before { background: var(--nordic-ok); }
.sm-steps .song-progress-step.is-active::before { animation: none; }

/* ── home actions ── */
.sm-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sm-actions.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
html[data-theme="nordic"] button.sm-action {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 190px;
  padding: 20px;
  text-align: left;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-card);
  background: var(--nordic-surface);
  color: var(--glass-ink);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  transition: background-color 0.12s ease, transform 0.2s var(--sm-ease);
}
html[data-theme="nordic"] button.sm-action:hover:not(:disabled) { background: var(--nordic-hover); }
.sm-action .glyph {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-mini);
  border: 1px solid var(--glass-line);
  display: grid;
  place-items: center;
  color: var(--glass-ink);
}
.sm-action .glyph svg { width: 20px; height: 20px; }
.sm-action b { font-size: 18px; font-weight: 600; line-height: 1.2; }
.sm-action .d { color: var(--glass-body); font-size: 13.5px; line-height: 1.45; }
.sm-action .sm-cost { margin-top: auto; }
.sm-action.is-locked .glyph { border-style: dashed; }
html[data-theme="nordic"] button.sm-action.wide {
  grid-column: 1 / -1;
  min-height: 0;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}
.sm-action.wide b { font-size: 16px; }
.sm-action.wide .sm-cost { margin: 0; }
.sm-action.wide > span:not(.glyph, .sm-cost) { display: grid; gap: 2px; }
@media (max-width: 720px) {
  .sm-actions { grid-template-columns: 1fr; }
  html[data-theme="nordic"] button.sm-action { min-height: 0; }
}

/* ── my works ── */
.sm-works { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 720px) { .sm-works { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sm-work {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-nested);
  background: var(--nordic-surface);
  font-size: 13px;
  color: var(--glass-ink);
  text-decoration: none;
  text-align: left;
}
html[data-theme="nordic"] button.sm-work { min-height: 0; padding: 8px; font-size: 13px; font-weight: 400; letter-spacing: 0; }
html[data-theme="nordic"] button.sm-work:hover:not(:disabled), a.sm-work:hover { background: var(--nordic-hover); }
.sm-work > span:not(.sw) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-work .sw { aspect-ratio: 1; border-radius: calc(var(--radius-nested) - 4px); overflow: hidden; }
.sm-work .sw img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-work small { color: var(--glass-label); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.sm-section { display: grid; gap: 10px; }
.sm-section > h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--glass-ink); }

/* ── choices: one pressed language for single and multi ── */
.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.sm-grid.one { grid-template-columns: 1fr; }
@media (max-width: 480px) { .sm-grid:not(.one) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html[data-theme="nordic"] .sm-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini);
  background: var(--nordic-surface);
  color: var(--glass-ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.2s var(--sm-ease);
}
.sm-choice > span:first-child { min-width: 0; overflow-wrap: anywhere; }
html[data-theme="nordic"] .sm-choice[hidden] { display: none; }
.sm-tick {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--nordic-line-strong);
  flex: none;
  display: grid;
  place-items: center;
}
.sm-tick svg { width: 12px; height: 12px; opacity: 0; }
[aria-pressed="true"] .sm-tick { background: var(--sm-sel); border-color: var(--sm-sel); color: #fff; }
[aria-pressed="true"] .sm-tick svg { opacity: 1; }
html[data-theme="nordic"] :is(.sm-choice, .sm-look)[aria-pressed="true"] {
  border-color: var(--sm-sel);
  background: var(--sm-sel-fill);
  box-shadow: inset 0 0 0 1px var(--sm-sel);
}

.sm-looks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 720px) { .sm-looks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
html[data-theme="nordic"] .sm-look {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 8px 8px 12px;
  text-align: left;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-nested);
  background: var(--nordic-surface);
  color: var(--glass-ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  transition: background-color 0.12s ease, transform 0.2s var(--sm-ease);
}
.sm-look .sw { aspect-ratio: 1; border-radius: calc(var(--radius-nested) - 4px); }
.sm-look .sw.voice { aspect-ratio: 3 / 2; background: var(--nordic-fill); display: grid; place-items: center; color: var(--glass-ink); }
.sm-look .sw.voice svg { width: 44px; height: 24px; }
.sm-look small { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--glass-label); font-weight: 400; }
.sm-look .sm-tick { position: absolute; top: 14px; right: 14px; background: var(--nordic-surface); }
.sm-look[aria-pressed="true"] .sm-tick { background: var(--sm-sel); border-color: var(--sm-sel); }

/* artwork theme swatches: content, not chrome */
.sw.dark-cover { background: radial-gradient(circle at 30% 30%, #5b6c8f, #0d0f16 70%); }
.sw.light-cover { background: radial-gradient(circle at 60% 40%, #fff, #d7dde6 60%, #a9b4c4); }
.sw.dark-campaign { background: linear-gradient(160deg, #2a1b2f, #0b0b10 60%); }
.sw.light-campaign { background: linear-gradient(160deg, #f7efe6, #e3e8ef); }
.sw.lyric { background: var(--nordic-fill); display: grid; place-items: center; font: 400 28px/1 Georgia, serif; color: var(--glass-label); }
.sw.track { background: var(--glass-ink); display: grid; place-items: center; color: #fff; }
.sw.track svg { width: 22px; height: 22px; }

/* summary: reuses .glass-theme-meta (dt label, dd value) */
.sm-summary { display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--radius-nested); background: var(--nordic-fill); }
.sm-summary .glass-theme-meta { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 14px; color: var(--glass-ink); }
.sm-summary .glass-theme-meta dt { align-self: center; }
.sm-summary .glass-theme-meta dd { margin: 0; overflow-wrap: anywhere; }
.sm-summary p { margin: 0; font-size: 13px; color: var(--glass-body); }

/* ── catalogue Song DNA: radar beside the song's colours and rows (owner pick A) ── */
.sm-dna { container-type: inline-size; }
.sm-dna-grid { display: grid; gap: var(--sm-gap); align-items: start; }
.sm-dna-grid.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
@container (max-width: 720px) { .sm-dna-grid.split { grid-template-columns: minmax(0, 1fr); } }
.sm-dna-side { display: grid; gap: 16px; align-content: start; }
.sm-kicker { margin: 0; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--glass-label); }
.sm-print { display: grid; gap: 6px; padding: 16px 12px 12px; border-radius: var(--radius-nested); background: var(--nordic-fill); }
.sm-print .dna-radar-chart { max-width: 360px; }
/* the song's own colours are content, not chrome */
.sm-swatches { display: grid; gap: 10px; }
.sm-band { display: flex; height: 44px; border-radius: var(--radius-mini); overflow: hidden; box-shadow: inset 0 0 0 1px var(--glass-line); }
.sm-band i { flex: 1; }
.sm-swatch-names { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--glass-body); }
.sm-swatch-names li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.sm-swatch-names li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 999px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); }
@container (max-width: 480px) {
  .sm-dna .sm-summary .glass-theme-meta { grid-template-columns: 1fr; gap: 2px; }
  .sm-dna .sm-summary .glass-theme-meta dd { margin-bottom: 10px; }
  .sm-dna .sm-summary .glass-theme-meta dd:last-child { margin-bottom: 0; }
}

/* ── catalogue search by meaning (owner pick A): hits under the title grid ── */
.sm-hits { display: grid; gap: 8px; }
.sm-hits:empty { display: none; }
.sm-hits-head { display: flex; align-items: center; gap: 8px; color: var(--glass-label); }
.sm-hits-head svg { width: 14px; height: 14px; }
html[data-theme="nordic"] .sm-hit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  min-height: 0;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini);
  background: var(--nordic-surface);
  color: var(--glass-ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  transition: background-color 0.12s ease, transform 0.2s var(--sm-ease);
}
html[data-theme="nordic"] .sm-hit:hover:not(:disabled) { background: var(--nordic-hover); }
.sm-hit > span { min-width: 0; overflow-wrap: anywhere; }
.sm-hit q {
  grid-column: 1;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--glass-body);
  quotes: "«" "»";
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sm-hit > svg { grid-row: 1 / span 2; grid-column: 2; width: 16px; height: 16px; color: var(--glass-label); }
.sm-skel { height: 58px; border-radius: var(--radius-mini); background: linear-gradient(90deg, var(--nordic-fill) 0%, var(--nordic-hover) 50%, var(--nordic-fill) 100%); background-size: 200% 100%; }

html[data-theme="nordic"] .sm-main :is(textarea, input[type="email"]) { width: 100%; font: inherit; font-size: 15px; padding: 12px 14px; }
.sm-main textarea { min-height: 110px; resize: vertical; }
.sm-main .input-shell { padding: 0 14px; }
.sm-field { display: grid; gap: 6px; }
.sm-field .eyebrow { margin: 0; }
.sm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
html[data-theme="nordic"] .sm-chips .lyricist-suggestion[aria-pressed="true"] { border-color: var(--sm-sel); background: var(--sm-sel-fill); color: var(--glass-ink); }
.sm-main .pick-count-meta { justify-self: start; }

/* ── visual: caption under the poster-look tiles, own photos on the wish step ── */
.sm-attach { padding: 16px 18px; border: 1px solid var(--glass-line); border-radius: var(--radius-nested); background: var(--nordic-surface); }
.sm-field .eyebrow svg, .sm-refs-head .eyebrow svg { width: 14px; height: 14px; }
.sm-field .eyebrow, .sm-refs-head .eyebrow { display: inline-flex; align-items: center; gap: 8px; }
html[data-theme="nordic"] .sm-main input.sm-caption { width: 100%; font: inherit; font-size: 15px; padding: 12px 14px; letter-spacing: 0.04em; }
.sm-refs { display: grid; gap: 10px; }
.sm-refs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.sm-refs-head .eyebrow { margin: 0; }
.sm-refs-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sm-ref, .sm-ref-add { position: relative; flex: none; width: 76px; height: 76px; margin: 0; border-radius: var(--radius-mini); }
.sm-ref { overflow: hidden; background: var(--nordic-fill); border: 1px solid var(--glass-line); }
.sm-ref img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.2s var(--sm-ease), filter 0.2s var(--sm-ease); }
.sm-refs[data-on="false"] .sm-ref img { opacity: 0.4; filter: grayscale(1); }
html[data-theme="nordic"] .sm-ref-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--nordic-surface);
  color: var(--glass-body);
}
html[data-theme="nordic"] .sm-ref-x:hover:not(:disabled) { background: var(--nordic-hover); color: var(--nordic-error); border-color: var(--nordic-line-strong); }
.sm-ref-x svg { width: 12px; height: 12px; }
.sm-ref-add {
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--glass-ink);
  border: 1px dashed var(--nordic-line-strong);
  background: var(--nordic-surface);
  transition: background-color 0.12s ease, transform 0.2s var(--sm-ease);
}
.sm-ref-add:hover { background: var(--nordic-hover); }
.sm-ref-add:focus-within { outline: 2px solid var(--glass-ink); outline-offset: 2px; }
.sm-ref-add input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sm-ref-add input:disabled { cursor: default; }
.sm-ref-add svg { width: 20px; height: 20px; }
.sm-ref.is-loading { background: linear-gradient(90deg, var(--nordic-fill) 0%, var(--nordic-hover) 50%, var(--nordic-fill) 100%) 0 0 / 200% 100%; } /* the .sm-skel shimmer */
/* switch: the .hc-switch geometry (hit-coach.css) in nordic tokens */
.sm-switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.sm-switch input { position: absolute; inset: -8px; width: auto; height: auto; margin: 0; opacity: 0; cursor: pointer; }
.sm-switch span { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--nordic-line-strong); transition: background 0.2s var(--sm-ease); }
.sm-switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 18%);
  transition: transform 0.2s var(--sm-ease);
}
.sm-switch input:checked + span { background: var(--glass-ink); }
.sm-switch input:checked + span::after { transform: translateX(14px); }
.sm-switch input:focus-visible + span { outline: 2px solid var(--glass-ink); outline-offset: 2px; }

/* ── results ── */
.sm-result { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 720px) { .sm-result { grid-template-columns: 1fr; } }
.sm-art { display: block; aspect-ratio: 1; border-radius: var(--radius-card); overflow: hidden; background: var(--nordic-fill); }
.sm-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-lyrics {
  margin: 0;
  white-space: pre-line;
  padding: 16px 18px;
  border-radius: var(--radius-mini);
  background: var(--nordic-fill);
  color: var(--glass-body);
  font: inherit;
  font-size: 14px;
  line-height: 1.7;
  max-height: 320px;
  overflow: auto;
}
.sm-saved { justify-self: start; margin: 0; }
/* ── work controls: icon buttons, two-tap confirm, ⋯ menu ── */
html[data-theme="nordic"] .sm-ico {
  width: 36px;
  height: 36px;
  min-height: 0;
  min-width: 0;
  padding: 0;
  display: inline-grid;
  grid-auto-flow: column;
  place-items: center;
  gap: 6px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--glass-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
html[data-theme="nordic"] .sm-ico:hover:not(:disabled) { background: var(--nordic-hover); color: var(--glass-ink); transform: none; }
.sm-ico:focus-visible { outline: 2px solid var(--glass-ink); outline-offset: 2px; }
.sm-ico svg { width: 18px; height: 18px; }
/* Armed (publish or delete): ink fill with the confirm text, as .publish-network-btn.is-armed. */
html[data-theme="nordic"] .sm-ico.is-armed,
html[data-theme="nordic"] .sm-ico.is-armed:hover:not(:disabled) {
  width: auto;
  padding: 0 12px;
  background: var(--glass-ink);
  border-color: var(--glass-ink);
  color: #fff;
}
html[data-theme="nordic"] .sm-ico.is-published,
html[data-theme="nordic"] .sm-ico:disabled { color: var(--glass-ink); opacity: 0.55; cursor: default; }
.sm-tools { display: flex; align-items: center; justify-content: flex-end; gap: 2px; min-width: 0; }
/* Desktop: tools show on hover or focus; touch screens and phone widths always show them. */
@media (hover: hover) and (pointer: fine) and (min-width: 481px) {
  .sm-reveal .sm-tools { opacity: 0; transition: opacity 0.15s ease; }
  .sm-reveal:is(:hover, :focus-within) .sm-tools,
  .sm-reveal .sm-tools:has(.is-armed, [aria-expanded="true"]) { opacity: 1; }
}

.sm-more { position: relative; }
.sm-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 220px;
  display: grid;
  padding: 6px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini);
  background: var(--nordic-surface);
  box-shadow: 0 12px 32px rgb(0 0 0 / 14%);
}
.sm-menu[hidden] { display: none; }
html[data-theme="nordic"] .sm-menu button {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-align: left;
  white-space: nowrap;
}
html[data-theme="nordic"] .sm-menu button:hover:not(:disabled) { background: var(--nordic-hover); transform: none; }
.sm-menu svg { width: 16px; height: 16px; flex: none; }

/* ── rows: songs (cover sleeve) and lyrics (open + tools beside it) ── */
.sm-rows { display: grid; gap: 8px; }
.sm-song,
.sm-row-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-mini);
  background: var(--nordic-surface);
}
.sm-row-item { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 4px 6px 4px 4px; }
.sm-meta { display: grid; gap: 2px; min-width: 0; }
.sm-meta b { font-size: 14px; font-weight: 600; color: var(--glass-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-meta :is(time, small) { font-size: 12px; color: var(--glass-label); }
html[data-theme="nordic"] .sm-row-open {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 400;
  letter-spacing: 0;
  text-align: left;
}
html[data-theme="nordic"] .sm-row-open:hover:not(:disabled) { background: var(--nordic-hover); transform: none; }
.sm-row-open .sw { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--nordic-fill); color: var(--glass-label); font-size: 18px; }
.sm-row-open .sm-meta b { font-weight: 500; }

/* The dashboard sleeve (web.css .song-sleeve*), small; the cover is the play button. */
.sm-song .song-sleeve { --sleeve: 56px; }
html[data-theme="nordic"] .sm-song .song-sleeve-cover { min-height: 0; }
.sm-cover-icon {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: var(--sleeve);
  height: var(--sleeve);
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sm-cover-icon > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px; background: rgb(0 0 0 / 55%); backdrop-filter: blur(4px); }
.sm-cover-icon svg { width: 12px; height: 12px; }
.sm-song .song-sleeve:hover .sm-cover-icon,
.sm-song[data-playing="true"] .sm-cover-icon,
.sm-song .song-sleeve-cover:focus-visible + .sm-cover-icon { opacity: 1; }
@media (hover: none) { .sm-cover-icon { opacity: 1; } }

/* ── image cards: picture opens full size; tools under it ── */
.sm-img { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; padding: 6px; border: 1px solid var(--glass-line); border-radius: var(--radius-nested); background: var(--nordic-surface); }
.sm-img .sw { display: block; aspect-ratio: 1; overflow: hidden; border-radius: calc(var(--radius-nested) - 5px); }
.sm-img .sw img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 0.4s var(--sm-ease); }
.sm-img .sw:hover img { transform: scale(1.03); }
.sm-img .sw:focus-visible { outline: 2px solid var(--glass-ink); outline-offset: 2px; }
.sm-img-foot { display: flex; align-items: center; gap: 4px; min-height: 36px; padding-left: 4px; }
.sm-img-foot small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--glass-label); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
/* Armed, the confirm takes the whole foot so a narrow card never grows. */
.sm-img-foot:has(.is-armed) small,
.sm-img .sm-tools:has(.is-armed) > :not(.is-armed) { display: none; }
.sm-img .sm-tools:has(.is-armed) { flex: 1; }
html[data-theme="nordic"] .sm-img .sm-ico.is-armed { flex: 1; min-width: 0; padding: 0 8px; }
.sm-ico.is-armed span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Done screens: the same icons, always shown, left-aligned under the result. */
.sm-done-tools { justify-content: flex-start; margin-left: -8px; }

.sm-gone { animation: sm-gone 0.24s var(--sm-ease) forwards; }
@keyframes sm-gone { to { opacity: 0; transform: scale(0.97); } }

@media (max-width: 480px) {
  .sm-song { grid-template-columns: auto minmax(0, 1fr); row-gap: 4px; }
  .sm-song .sm-tools { grid-column: 2; justify-content: flex-start; margin-left: -8px; }
  .sm-row-item { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .sm-row-item .sm-tools { justify-content: flex-start; padding: 0 0 4px 52px; }
  html[data-theme="nordic"] .sm-img .sm-ico:not(.is-armed) { width: 32px; height: 32px; }
  .sm-img-foot small { display: none; }
  .sm-img .sm-tools { flex: 1; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .sm-song[data-playing="true"] .song-sleeve-disc,
  .sm-song[data-playing="true"] .song-sleeve-disc::after { animation: none; }
  .sm-img .sw img { transition: none; }
  .sm-img .sw:hover img { transform: none; }
}

/* ── waiting: thinking orb (decision 7A) ── */
.sm-wait { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 36px 0 28px; }
.sm-wait .sm-lead { margin-inline: auto; }
.sm-wait .thinking-orb { display: grid; }

/* ── onboarding: native <dialog>, .vocal-polish-dialog tokens ── */
.sm-onboarding {
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-card);
  background: var(--nordic-surface);
  color: var(--glass-ink);
  box-shadow: 0 24px 64px rgb(0 0 0 / 18%);
  overflow: auto;
}
.sm-onboarding::backdrop { background: var(--nordic-scrim, rgb(0 0 0 / 42%)); }
.sm-sheet { display: grid; gap: 16px; padding: 28px; }
.sm-dots { display: grid; grid-auto-flow: column; gap: 4px; }
.sm-dots i { height: 3px; border-radius: 2px; background: var(--glass-line); }
.sm-dots i.on { background: var(--glass-ink); }
.sm-sheet .eyebrow { margin: 0; }
.sm-ob-orb { justify-self: start; margin: 0; }
html[data-theme="nordic"] .sm-ob-orb .thinking-orb-canvas { width: 96px; height: 96px; }
.sm-ob-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sm-ob-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; font-size: 14px; color: var(--glass-body); }
.sm-ob-list li b { color: var(--glass-ink); }
.sm-ob-list .n { width: 34px; height: 34px; border-radius: var(--radius-mini); border: 1px solid var(--glass-line); display: grid; place-items: center; color: var(--glass-ink); }
.sm-ob-list .n svg { width: 16px; height: 16px; }
.sm-ob-list em { font-style: normal; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--glass-label); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .sm-onboarding {
    width: 100vw;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    border-bottom: 0;
  }
  .sm-sheet { padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); }
}

/* ── phone: primary action sticks to the bottom edge (decision 10B) ── */
@media (max-width: 640px) {
  .sm-dock {
    position: sticky;
    bottom: 0;
    margin: 0 -16px -20px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--glass-page);
    border-top: 1px solid var(--glass-line);
    z-index: 2;
  }
  .sm-dock .sm-cta { flex: 1; }
  /* a secondary dock action shrinks to its icon so the primary keeps one line */
  html[data-theme="nordic"] .sm-dock .sm-dock-alt { flex: none; width: 48px; min-height: 48px; padding: 0; justify-content: center; }
  .sm-dock .sm-dock-alt span { display: none; }
  /* the studio tab bar (nordic.css, ≤767px) is fixed at the bottom: dock above it */
  html[data-theme="nordic"] .sm-dock { bottom: calc(63px + env(safe-area-inset-bottom, 0px)); padding-bottom: 12px; }
}

/* ── icon-only buttons (× remove, = even split, ↻ refresh) ── */
html[data-theme="nordic"] .sm-icon {
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--glass-label);
}
html[data-theme="nordic"] .sm-icon:hover:not(:disabled) { background: var(--nordic-hover); color: var(--glass-ink); }
html[data-theme="nordic"] .sm-icon[aria-disabled="true"] { opacity: 0.35; }
html[data-theme="nordic"] .sm-icon[aria-disabled="true"]:hover { background: transparent; color: var(--glass-label); }
.sm-icon svg { width: 16px; height: 16px; }
.sm-mix-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sm-mix-head .eyebrow { margin: 0; }

/* ── song mix: a tray in the sticky dock with the primary button (owner: concept B) ── */
.sm-dock.has-tray {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px 20px;
  margin: 0 calc(-1 * var(--sm-pad)) calc(-1 * var(--sm-pad));
  padding: 14px var(--sm-pad) calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--glass-page);
  border-top: 1px solid var(--glass-line);
  box-shadow: 0 -12px 32px rgb(0 0 0 / 6%);
}
.sm-tray { display: grid; gap: 12px; min-width: 0; }
html[data-theme="nordic"] .sm-tray-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  width: 100%;
  min-height: 0;
  padding: 6px 4px 6px 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--glass-ink);
  font-weight: 400;
  letter-spacing: 0;
}
html[data-theme="nordic"] .sm-tray-bar:hover:not(:disabled) { background: transparent; }
.sm-recipe { grid-column: 1; margin: 0; font-size: 12px; color: var(--glass-label); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sm-tray[data-open="true"] .sm-recipe { display: none; } /* open: the % pills say it */
.sm-chev {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  display: grid;
  place-items: center;
  transition: transform 0.3s var(--sm-ease);
}
.sm-chev svg { width: 16px; height: 16px; }
.sm-tray[data-open="true"] .sm-chev { transform: rotate(180deg); }
.sm-tray-body { display: grid; gap: 10px; }
.sm-tray-body[hidden] { display: none; }

/* read-only proportion bar; the mix is content, drawn in the ink scale (darkest first) */
.sm-mixbar { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; }
.sm-mixbar i { display: block; flex: 0 0 auto; }
.sm-ink-0 { background: var(--glass-ink); }
.sm-ink-1 { background: var(--glass-label); }
.sm-ink-2 { background: var(--nordic-line-strong); }

/* one row per song: name · % pill · × over the slider */
.sm-mix-rows { display: grid; gap: 10px; }
@media (min-width: 721px) { .sm-mix-rows { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 20px; } }
.sm-mix-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0 8px; }
.sm-mix-name { min-width: 0; font-size: 14px; font-weight: 500; color: var(--glass-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-mix-pct { min-width: 3.4em; justify-content: center; font-variant-numeric: tabular-nums; }
html[data-theme="nordic"] .sm-mix-pct { color: var(--glass-ink); border-color: var(--nordic-line-strong); }
/* the dashboard's slider (.song-dna-weight-slider, nordic neutral fill) as a 6 px
   track inside a taller hit area, without the generic nordic input chrome */
html[data-theme="nordic"] .sm-mix-row .song-dna-weight-slider {
  grid-column: 1 / -1;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-size: 100% 6px;
  background-position: center;
  background-repeat: no-repeat;
}
.sm-mix-row .song-dna-weight-slider:focus-visible { outline: 2px solid var(--glass-ink); outline-offset: 2px; border-radius: 6px; }
@media (pointer: coarse) {
  html[data-theme="nordic"] .sm-mix-row .song-dna-weight-slider { height: 36px; }
  .sm-mix-row .song-dna-weight-slider::-webkit-slider-thumb { width: 26px; height: 26px; }
  .sm-mix-row .song-dna-weight-slider::-moz-range-thumb { width: 26px; height: 26px; }
}
@media (max-width: 767px) {
  /* the studio tab bar (nordic.css) is fixed at the bottom: dock above it */
  html[data-theme="nordic"] .sm-dock.has-tray { bottom: calc(63px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  .sm-dock.has-tray { grid-template-columns: 1fr; margin: 0 -16px -20px; padding: 10px 16px 12px; }
  .sm-tray { gap: 10px; }
}

/* idea chips: live suggestions dim while the next set loads */
.sm-chips[aria-busy="true"] .lyricist-suggestion:not([aria-pressed="true"]) { opacity: 0.55; }

/* ── motion: gentle rise and fade, 0.98 press (decision 9B) ── */
@media (prefers-reduced-motion: no-preference) {
  /* only on a screen change; simple-mode.js render() continues it across mid-rise re-renders */
  .sm-main.is-in > * { animation: sm-rise 0.42s var(--sm-ease) var(--sm-rise-delay, 0s) both; }
  :is(.sm-choice, .sm-look, .sm-action, .sm-hit):active { transform: scale(0.98); }
  .sm-skel { animation: sm-shimmer 1.4s linear infinite; }
  .sm-ref.is-loading { animation: sm-shimmer 1.4s linear infinite; }
  .sm-ref-add:active { transform: scale(0.96); }
  .sm-onboarding[open] .sm-sheet.is-in { animation: sm-rise 0.35s var(--sm-ease) both; }
  .sm-dock.has-tray.is-appearing { animation: sm-tray-up 0.42s var(--sm-ease) both; }
  .sm-mixbar i { transition: flex-basis 0.25s var(--sm-ease); }
  .sm-refresh[aria-busy="true"] svg { animation: sm-spin 0.9s linear infinite; }
  .sm-chips.is-fresh .lyricist-suggestion { animation: sm-rise 0.35s var(--sm-ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
}
@media (prefers-reduced-motion: reduce) {
  .sm-chev { transition: none; }
}
@keyframes sm-tray-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@keyframes sm-spin {
  to { transform: rotate(360deg); }
}
@keyframes sm-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@keyframes sm-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
