Skip to content

Local AI BGM and sound effects for Claude Code and any MCP client. Stable Audio 3 on Apple Silicon (MLX) and Windows NVIDIA GPUs (PyTorch). No cloud, no API key.

34.1 KB
Raw Blame
/* Audio Studio web UI.
   Art direction (taste-skill "framed sheet"): the chrome is one quiet frame,
   the work sits on a sheet with a 1px edge and no shadows. Neutral greys carry
   everything; Kana's hoodie yellow is the one hue, kept for the primary
   action, the waveform you are working on (played part, selection, playing
   button) and search highlights. Status colours only mean status. Every text
   colour is >= 4.5:1 on the surface it sits on. */

@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url("/static/fonts/ibm-plex-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --frame: #f3f4f5;         /* top bar and the margin around the sheet */
  --sheet: #ffffff;
  --surface: #ffffff;       /* cards */
  --surface-2: #f3f4f5;     /* hover, wells, tracks */
  --active: #e8e9eb;
  --border: #e3e5e8;        /* sheet and card edges */
  --rule: #eeeff1;          /* row rules */
  --border-strong: #b9bdc3; /* controls */
  --text: #131416;
  --muted: #5b5e63;
  --ink-btn: #131416;       /* filled neutral buttons (play) */
  --ink-btn-text: #ffffff;
  --brand: #f5b301;         /* Kana's hoodie */
  --brand-hover: #ffc21f;
  --brand-edge: #d39a00;
  --brand-text: #131416;
  --focus: #131416;
  --ok: #1e7b4f;
  --warn: #8a5a00;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --warn-soft: #fff8e6;
  --pill-bg: #e8e9eb;
  --pill-text: #34373b;
  --radius: 10px;
  --radius-sm: 6px;
  --wave: #8b9097;          /* graphics: >= 3:1 on --track-bg */
  --wave-played: #9a6c00;   /* Kana yellow, darkened to read on white */
  --wave-axis: #dfe1e4;
  --sel-bg: rgba(245, 179, 1, .26);
  --sel-edge: #131416;
  --track-bg: #f6f7f8;
  --bg: var(--sheet);       /* kept for the toast */
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%235b5e63' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --frame: #0c0c0d; --sheet: #141416; --surface: #1a1a1d; --surface-2: #232327; --active: #2e2e33;
    --border: #2a2a2f; --rule: #242428; --border-strong: #4c4c53;
    --text: #f2f2f3; --muted: #b0b0b7; --ink-btn: #f2f2f3; --ink-btn-text: #131416;
    --brand: #ffc23d; --brand-hover: #ffd068; --brand-edge: #ffc23d; --brand-text: #131416; --focus: #ffc23d;
    --ok: #5cc38a; --warn: #e8b453; --danger: #ff8f84; --danger-soft: #34191a; --warn-soft: #2c2412;
    --pill-bg: #2e2e33; --pill-text: #d4d4d9;
    --wave: #7d8087; --wave-played: #ffc23d; --wave-axis: #2e2e33;
    --sel-bg: rgba(255, 194, 61, .17); --sel-edge: #ffc23d; --track-bg: #111113;
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23b0b0b7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --frame: #0c0c0d; --sheet: #141416; --surface: #1a1a1d; --surface-2: #232327; --active: #2e2e33;
  --border: #2a2a2f; --rule: #242428; --border-strong: #4c4c53;
  --text: #f2f2f3; --muted: #b0b0b7; --ink-btn: #f2f2f3; --ink-btn-text: #131416;
  --brand: #ffc23d; --brand-hover: #ffd068; --brand-edge: #ffc23d; --brand-text: #131416; --focus: #ffc23d;
  --ok: #5cc38a; --warn: #e8b453; --danger: #ff8f84; --danger-soft: #34191a; --warn-soft: #2c2412;
  --pill-bg: #2e2e33; --pill-text: #d4d4d9;
  --wave: #7d8087; --wave-played: #ffc23d; --wave-axis: #2e2e33;
  --sel-bg: rgba(255, 194, 61, .17); --sel-edge: #ffc23d; --track-bg: #111113;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23b0b0b7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--frame); color: var(--text);
  font: 14px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
:lang(ja) body, body:lang(ja) { font-family: "IBM Plex Sans", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif; }
:lang(zh) body, body:lang(zh) { font-family: "IBM Plex Sans", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
h1, h2 { margin: 0; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--sel-bg); }

/* frame: the top bar sits on the frame tint with no rule under it */
.topbar {
  position: sticky; top: 0; z-index: 10; min-height: 56px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  padding: 0 16px 0 14px; background: var(--frame);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 32px; height: 32px; border-radius: 50%; display: block; flex: none; }
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.version { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; align-self: stretch; }
.tabs button {
  appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 500;
  padding: 0 10px; cursor: pointer; position: relative;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--text);
}
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
.model-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; padding-right: 6px; }
.model-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.model-state[data-state="loaded"] .dot { background: var(--ok); }
.model-state[data-state="busy"] .dot { background: var(--warn); }
.model-state[data-state="error"] .dot { background: var(--danger); }

/* the sheet: everything you work on */
main {
  background: var(--sheet); border: 1px solid var(--border); border-radius: 16px;
  margin: 0 8px 8px; padding: 28px 24px 40px; min-height: calc(100vh - 64px);
}
.page { max-width: 1280px; margin: 0 auto; }

/* controls */
input[type="text"], input[type="number"], input[type="search"], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 36px;
}
textarea { resize: vertical; min-height: 68px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
/* own chevron with room on the right (the native arrow sits against the edge) */
select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: var(--chev); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
.select-sm { width: auto; min-height: 32px; padding: 5px 30px 5px 10px; font-size: 12px; background-position: right 9px center; }
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--active); }
.theme-switch button {
  appearance: none; width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; padding: 0;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-checked="true"] { color: var(--text); background: var(--surface); }
.theme-switch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch svg .fill { fill: currentColor; stroke: none; }
.btn {
  appearance: none; font: inherit; font-weight: 500; border-radius: var(--radius-sm); padding: 5px 14px; min-height: 34px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand-edge); color: var(--brand-text); font-weight: 600; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text); }
.btn-quiet:hover { color: var(--text); background: var(--active); }
.btn-sm { padding: 3px 10px; font-size: 13px; min-height: 30px; }
.btn-lg { padding: 8px 20px; font-size: 14px; min-height: 42px; }
.link-btn {
  appearance: none; border: 0; background: none; color: var(--text); font: inherit; font-size: 12px; padding: 2px 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }

/* layout */
#page-generate { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { #page-generate { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.form { padding: 20px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
.panel-title { font-size: 20px; letter-spacing: -0.01em; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.other-len { display: inline-flex; align-items: center; gap: 6px; }
.other-len input.num { width: 80px; min-height: 30px; padding: 4px 8px; }
.submit-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--rule); padding-top: 16px; }
.submit-row .versions { flex: none; width: 152px; }
.submit-row .btn-primary { flex: 1; min-width: 180px; }
.kbd-hint { margin: -8px 0 0; text-align: right; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > label, .field > legend { font-weight: 600; font-size: 13px; padding: 0; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
/* No one-character last lines ("す。"): balance short help texts, and break
   Japanese at phrase boundaries where the browser can. */
.hint, .note, .mode-desc, .summary, .empty-state p, .tip { text-wrap: pretty; }
:lang(ja) :is(.hint, .note, .mode-desc, .summary, .empty-state p, .tip) { word-break: auto-phrase; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; align-items: end; }
/* segmented control: a grey track, the chosen option a raised white key */
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--active); }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 5px 8px; border-radius: 6px; font-weight: 500; color: var(--muted); white-space: nowrap; transition: background-color .12s, color .12s; }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 0; }
.segmented.compact span { padding: 5px 0; min-width: 30px; font-variant-numeric: tabular-nums; }
.advanced { border-top: 1px solid var(--rule); padding-top: 12px; }
.form .advanced + .form-error, .form .advanced + .submit-row { margin-top: 0; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.advanced summary:hover { color: var(--text); }
.advanced[open] summary { margin-bottom: 10px; color: var(--text); }
.advanced > .field { margin-top: 12px; }
.form-error { margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); white-space: pre-wrap; word-break: break-word; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.clear-btn { margin-left: auto; }
.steps { list-style: none; padding: 0; margin: 4px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; width: 100%; text-align: left; }
.steps li { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 8px; background: var(--surface-2); }
.steps strong { color: var(--text); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.num { width: 96px; flex: none; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips-label { margin-right: 2px; }
.chip {
  appearance: none; font: inherit; line-height: 1.2; cursor: pointer; white-space: nowrap;
  padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13px; transition: background-color .12s, border-color .12s;
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--sheet); }
.sfx-fields { border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.sfx-fields summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.sfx-fields[open] summary { margin-bottom: 10px; color: var(--text); }
.row.top { align-items: start; }
.sfx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mod-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-edge); margin-left: 6px; vertical-align: middle; }
.advanced .link-btn { margin-top: 10px; }

/* results */
.results-head { display: flex; align-items: baseline; gap: 12px; margin: 2px 0 12px; }
.results-head h2 { font-size: 16px; }
.jobs { display: flex; flex-direction: column; gap: 16px; }
.empty-state { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-state p { margin: 0; max-width: 560px; }
.empty-title { color: var(--text); font-weight: 600; font-size: 16px; }
.starter { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; width: 100%; margin-top: 6px; }
.starter-card, .recent-item {
  appearance: none; font: inherit; text-align: left; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  transition: border-color .12s;
}
.starter-card:hover, .recent-item:hover { border-color: var(--text); }
.starter-name, .recent-name { font-weight: 600; }
.recent { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; width: 100%; max-width: 900px; }
.recent-head { grid-column: 1 / -1; text-align: left; }
.recent-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.job-head { display: flex; gap: 10px; align-items: flex-start; }
.job-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.job-prompt { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.job-text:has(.job-sub) .job-prompt { font-weight: 600; }  /* the user's title, the prompt under it */
.job-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-state { font-size: 12px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.job[data-status="error"] .job-state { color: var(--danger); }
.job[data-status="done"] .job-state { color: var(--ok); }
.spinner { width: 12px; height: 12px; border: 2px solid var(--active); border-top-color: var(--text); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.progress { height: 3px; background: var(--active); border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; width: 30%; background: var(--wave-played); animation: slide 1.4s ease-in-out infinite; }
.progress.determinate > div { animation: none; transition: width .8s linear; }
@media (prefers-reduced-motion: reduce) { .progress > div { animation: none; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.job-error { margin: 0; color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.candidates { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border-strong);
  font: 500 11px/16px "IBM Plex Sans", system-ui, sans-serif; text-align: center; color: var(--muted); background: var(--surface);
}
.cand-head { align-items: center; }
.cand-head strong { margin-right: auto; }
.orig { border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; border: 1px dashed var(--border-strong); }
.orig .mini-wave-track { background: var(--surface-2); }
.foot-actions { display: flex; gap: 6px; margin-left: auto; }
.tip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px;
  padding: 10px 12px 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--text); font-size: 13px;
}
.cand { border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.cand-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.cand-head strong { font-weight: 600; font-size: 13px; }
.cand-actions, .item-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* Edit page results: one row per sound (original, then A, B, …) so any number
   of versions line up in the narrower column and the original, which has no
   actions, simply lets its waveform run to the end of the row. */
#edit-jobs .candidates { grid-template-columns: 1fr; gap: 8px; }
#edit-jobs .cand, #edit-jobs .orig { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 12px; }
#edit-jobs .orig .mini-wave { grid-column: 2 / -1; }
#edit-jobs .cand { border: 1px solid transparent; }  /* same inset as the original's dashed edge */
#edit-jobs .cand-actions { flex-wrap: nowrap; }
#edit-jobs { container-type: inline-size; }
@container (max-width: 540px) {  /* a narrow results column: label, waveform and actions stack */
  #edit-jobs .cand, #edit-jobs .orig { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; }
  #edit-jobs .orig .mini-wave { grid-column: auto; }
  #edit-jobs .cand-actions { flex-wrap: wrap; }
}
.job-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.job-steps { margin: 0; }

/* compact player: button + waveform thumbnail + time */
.mini-wave { display: flex; align-items: center; gap: 10px; min-width: 0; }
.play-btn {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink-btn); position: relative; transition: background-color .12s, transform .12s;
}
.play-btn::before, .icon-play {  /* triangle */
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-35%, -50%);
  border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent var(--ink-btn-text);
}
.play-btn.playing { background: var(--brand); }
.play-btn.playing::before, .play-main.playing .icon-play {  /* pause bars */
  transform: translate(-50%, -50%); width: 8px; height: 11px; border-style: solid; border-width: 0 3px; border-color: var(--ink-btn-text);
}
.play-btn.playing::before { border-color: var(--brand-text); }
.play-btn:hover { transform: scale(1.06); }
@media (prefers-reduced-motion: reduce) { .play-btn:hover, .btn:active { transform: none; } }
.mini-wave-track { flex: 1; min-width: 60px; height: 36px; cursor: pointer; border-radius: 4px; background: var(--track-bg); }
.cand .mini-wave-track { background: var(--surface); }
.mini-wave-canvas { width: 100%; height: 100%; display: block; }
.mini-time { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }

/* ⋯ menu */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-btn { cursor: pointer; padding: 3px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 700; border: 1px solid transparent; }
.menu-btn:hover, .menu[open] .menu-btn { background: var(--active); color: var(--text); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 180px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  display: flex; flex-direction: column;
}
.menu-list button { appearance: none; font: inherit; font-size: 13px; text-align: left; border: 0; background: none; color: var(--text); padding: 7px 10px; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--surface-2); }
.badge { display: inline-block; flex: none; font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 4px; background: var(--pill-bg); color: var(--pill-text); white-space: nowrap; }

/* library: one list, rows split by rules */
.page-title { font-size: 22px; letter-spacing: -0.01em; margin-bottom: 16px; }
.library-bar { display: flex; gap: 10px; align-items: center; }
.library-bar input { max-width: 440px; }
.folder { margin: 10px 0 16px; word-break: break-all; }
.library { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.library:empty { display: none; }
.library .panel.item { border: 0; border-radius: 0; background: none; }
.library .item + .item { border-top: 1px solid var(--rule); }
.item { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 420px); gap: 8px 24px; align-items: center; transition: background-color .12s; }
.library .item:hover { background: var(--surface-2); }
.library .item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.library .item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 760px) { .item { grid-template-columns: 1fr; } }
.item-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-file { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-kinds { margin-top: 12px; }
.item-side { display: flex; flex-direction: column; gap: 8px; }
.item-details { grid-column: 1 / -1; margin: 6px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 12px; border-top: 1px solid var(--rule); padding-top: 10px; }
.item-details dt { color: var(--muted); }
.item-details dd { margin: 0; word-break: break-word; }
.more { text-align: center; margin-top: 16px; }
mark { background: var(--sel-bg); color: inherit; border-radius: 2px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; gap: 14px; align-items: center;
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast .toast-act { color: var(--bg); font-weight: 600; text-decoration: underline; font-size: 13px; }

/* edit page */
.edit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.edit-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.edit-title h1 { font-size: 22px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.edit-source { display: flex; gap: 4px; align-items: baseline; }
.wave-panel { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.wave-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.play-main, .play-main:hover { position: relative; padding-left: 36px; min-width: 110px; background: var(--ink-btn); border-color: var(--ink-btn); color: var(--ink-btn-text); }
.play-main .icon-play { left: 19px; }
.play-main.playing { background: var(--brand); border-color: var(--brand-edge); color: var(--brand-text); }
.play-main.playing .icon-play { border-color: var(--brand-text); }
.clock { font-variant-numeric: tabular-nums; font-size: 13px; }
.spacer { flex: 1; }
.zoom { display: flex; gap: 4px; flex-wrap: wrap; }
.zoom .btn:disabled { opacity: .55; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.toggle input, .check input { width: 16px; height: 16px; accent-color: var(--text); margin: 0; }
.ruler { width: 100%; height: 20px; display: block; }
.wave {
  position: relative; height: 184px; background: var(--track-bg); border-radius: 8px;
  cursor: text; touch-action: none; user-select: none; overflow: hidden;
}
.wave:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wave-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.region-label {
  position: absolute; top: 8px; left: 8px; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 2px 8px; border-radius: 4px; background: var(--sel-edge); color: var(--sheet); font-size: 12px; font-weight: 600;
}
/* a selection the chosen task does not use stays visible but steps back */
.wave:not(.sel-used) .sel { opacity: .45; }
.wave-hint {
  position: absolute; top: 8px; left: 8px; z-index: 1; pointer-events: none;
  padding: 3px 10px; border-radius: 4px; background: var(--surface); color: var(--text); font-size: 12px; border: 1px solid var(--border);
}
.wave-hint.center { top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 8px 14px; font-size: 14px; font-weight: 500; }
.ghost {
  position: absolute; top: 0; bottom: 0; right: 0; width: clamp(48px, 6%, 80px); display: flex; align-items: center; justify-content: center; text-align: center;
  border-left: 2px dashed var(--sel-edge); background: var(--sel-bg); color: var(--text); font-size: 12px; font-weight: 600; pointer-events: none;
}
.sel { position: absolute; top: 0; bottom: 0; background: var(--sel-bg); border-left: 2px solid var(--sel-edge); border-right: 2px solid var(--sel-edge); pointer-events: none; }
.handle { position: absolute; top: 0; bottom: 0; width: 14px; cursor: ew-resize; pointer-events: auto; }
.handle::after { content: ""; position: absolute; top: 50%; width: 8px; height: 28px; margin-top: -14px; border-radius: 3px; background: var(--sel-edge); }
.handle.start { left: -8px; } .handle.start::after { left: 2px; }
.handle.end { right: -8px; } .handle.end::after { right: 2px; }
.handle:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
.overview { position: relative; height: 34px; background: var(--track-bg); border-radius: 6px; cursor: pointer; touch-action: none; }
.overview canvas { width: 100%; height: 100%; display: block; }
.view-box { position: absolute; top: 0; bottom: 0; border: 2px solid var(--sel-edge); border-radius: 5px; background: var(--sel-bg); pointer-events: none; }
.sel-bar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; font-size: 13px; padding-top: 6px; }
.sel-label { font-weight: 600; }
.sel-field { display: inline-flex; align-items: center; gap: 6px; }
.sel-field input { width: 92px; min-height: 32px; padding: 4px 8px; }
.sel-len { color: var(--muted); font-variant-numeric: tabular-nums; }
.sel-bar { position: relative; }
.wave-help summary { cursor: pointer; color: var(--muted); }
.wave-help summary:hover { color: var(--text); }
.wave-help[open] > p {
  position: absolute; right: 0; top: 100%; z-index: 5; margin: 6px 0 0; max-width: 520px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); color: var(--text);
}
.edit-body { display: grid; grid-template-columns: minmax(340px, 480px) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 24px; }
@media (max-width: 900px) { .edit-body { grid-template-columns: minmax(0, 1fr); } }
.edit-tools { overflow: visible; }
.subtabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); }
.subtabs button {
  appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 500;
  padding: 12px 8px; cursor: pointer; position: relative;
}
.subtabs button:hover { color: var(--text); }
.subtabs button[aria-selected="true"] { color: var(--text); font-weight: 600; }
.subtabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--text); }
.form-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
/* one row of tasks under the waveform: three AI edits and Export */
.task-bar { margin-top: 24px; }
.task-title { font-size: 16px; margin-bottom: 10px; }
.mode-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .mode-cards { grid-template-columns: repeat(2, 1fr); } }
button.mode-card { appearance: none; font: inherit; color: inherit; text-align: left; align-items: stretch; }
.mode-card { padding: 12px 14px; gap: 4px; }
.mode-scope { margin-top: auto; padding-top: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.mode-scope::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--border-strong); }
.mode-card.checked .mode-scope::before { background: var(--brand-edge); }
.tool-title { font-size: 16px; padding: 18px 20px 0; }
.mode-card, .preset {
  position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); transition: border-color .12s;
}
.mode-card input, .preset input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mode-card:hover, .preset:hover { border-color: var(--text); }
.mode-card.checked, .preset.checked { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.mode-card.checked { background: var(--surface-2); }
.mode-card:focus-within, .preset:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.mode-name, .preset-name { font-weight: 600; font-size: 13px; }
.mode-desc { font-size: 13px; color: var(--muted); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
input[type="range"] { width: 100%; accent-color: var(--text); }
.range-labels { display: flex; justify-content: space-between; }
.note { margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 13px; }
.note.warn { background: var(--warn-soft); }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13px; }
.check.disabled { color: var(--muted); cursor: not-allowed; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.summary { margin: 0; color: var(--muted); }
#x-custom .row, #x-custom > .field { margin-bottom: 10px; }
@media (max-width: 560px) { .wave-help { display: none; } }

/* phone: the frame folds away, the sheet becomes the screen */
@media (max-width: 640px) {
  .topbar { gap: 4px 16px; padding: 6px 12px 0; }
  .tabs { order: 3; width: 100%; height: 40px; }
  .status { padding: 4px 0; }
  .model-state { display: none; }
  main { margin: 0; border-radius: 0; border-width: 1px 0 0; padding: 20px 16px 32px; }
  .form { position: static; }
}