/* umuzika-saas — minimalist washi/sumi design system (ADR-021, replaces the
   vintage cassette chrome of ADR-015). Three pigments (paper, ink, vermillion)
   arrive as theme tokens from themes.css; the design language here is quiet:
   1px hairlines, flat surfaces, generous whitespace, no gradients, no offset
   shadows, no display font. Cassette-deck specifics live in cassette.css and
   cassette-shell.css; the speaker in speaker.css; fonts in fonts.css. */

:root {
  --player-height: 64px;
  --titlebar-height: 73px; /* sticky-column math must clear it at scroll 0 */
  --wash-accent: color-mix(in srgb, var(--accent) 8%, transparent);
  --wash-strong: color-mix(in srgb, var(--accent-strong) 10%, transparent);
  /* Soft app-chrome neutrals (ADR-016 deck vocabulary, shared since ADR-017). */
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --soft: color-mix(in srgb, var(--text) 4%, transparent);
  /* Radius scale (ADR-031): names the geometry already in use across
     controls/panels — no values changed, just the @mobayilo/ui pattern of a
     small named token scale instead of repeated magic numbers. Circles (50%)
     stay literal; cassette/speaker illustration CSS keeps its own --cab-*
     vocabulary and is out of scope. */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-full: 999px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-weight: 400; }
h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}
h2 {
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 2.5rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}
.dim { color: var(--text-dim); }
.nowrap { white-space: nowrap; }

button, input[type="submit"] {
  font: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* the native webkit clear button is blue — off-palette; kill it everywhere */
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem calc(var(--player-height) + 2.5rem);
}
.page--cassette { max-width: 1400px; }

/* --- title bar (shared chrome) ------------------------------------------- */
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.titlebar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--text);
}
.titlebar__brand:hover { color: var(--text); text-decoration: none; }
/* Hanko seal — the one place vermillion is always present */
.titlebar__seal {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--paper);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0;
}
.titlebar__kana {
  font-size: 0.62rem;
  letter-spacing: 0.42em;
  color: var(--text-dim);
  font-weight: 400;
}
.titlebar__center {
  flex: 1;
  display: flex;
  justify-content: center;
}
.titlebar__center form { width: 100%; max-width: 320px; }
.titlebar__search {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}
.titlebar__search::placeholder { color: var(--text-dim); }
.titlebar__search:focus { border-color: var(--text); background: var(--bg-raised); }
.titlebar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- avatar + user menu --------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.8rem;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.avatar--button { padding: 0; }
.avatar:hover { opacity: 0.85; }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 100;
}
.user-menu__name {
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.25rem;
}
.user-menu__item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  text-align: left;
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
}
.user-menu__item:hover { background: var(--soft); color: var(--text); text-decoration: none; }
.user-menu__item--button { color: var(--accent); }
.user-menu__switch { padding: 0.25rem 0.75rem 0.5rem; }

/* --- flash ------------------------------------------------------------ */
.flash {
  margin: 0.75rem auto; max-width: 1100px;
  padding: 0.6rem 1rem; border-radius: var(--radius-sm);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.flash--alert { border-left-color: var(--danger); }
/* set by flash_controller when the auto-dismiss timer fires */
.flash--leaving { opacity: 0; transform: translateY(-4px); }

/* --- buttons ----------------------------------------------------------- */
.button {
  display: inline-block;
  background: var(--accent-2);
  color: var(--bg);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.2rem;
  font-weight: 700;
  font-size: 0.9rem;
  transition: opacity 0.15s ease;
}
.button:hover {
  opacity: 0.85;
  color: var(--bg);
  text-decoration: none;
}
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.button--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.button--ghost:hover { opacity: 1; border-color: var(--text); color: var(--text); }
.button--ghost:disabled { background: transparent; }
.button--danger { background: var(--danger); border-color: var(--danger); color: var(--paper); }
.button--danger:hover { color: var(--paper); }
.danger-title { color: var(--danger); }

/* --- library chrome (tabs + filter, mirrors the deck source panel) ------- */
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1.5rem;
  flex-wrap: wrap;
}
.library-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.library-tab {
  padding: 0.45rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all 0.12s ease;
}
.library-tab:hover { color: var(--text); text-decoration: none; }
.library-tab.active { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); }
.library-tab--deck { border-style: dashed; border-color: var(--line); }
.library-tab--deck:hover { border-color: var(--accent); color: var(--accent); }

.library-filter {
  flex: 0 1 260px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
}
.library-filter::placeholder { color: var(--text-dim); }
.library-filter:focus { border-color: var(--text); }

/* --- grids and cards ---------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.card {
  display: block; color: var(--text);
  padding: 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: background 0.12s ease, border-color 0.12s ease;
}
.card[hidden] { display: none; }
.card:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--soft);
  border-color: var(--line);
}
.card__cover {
  /* height:auto beats the img's height attribute so aspect-ratio can apply */
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius-sm); background: var(--accent-3);
  border: 1px solid var(--line);
  display: block;
}
.card__cover--empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--text-dim);
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--accent-3);
  border: 1px solid var(--line);
}
.card__title {
  display: block; margin-top: 0.6rem; font-weight: 700; font-size: 0.92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card__subtitle {
  display: block; color: var(--text-dim); font-size: 0.82rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- lists --------------------------------------------------------------- */
.index-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.index-list__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 0.5rem; color: var(--text);
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.index-list__row:hover {
  background: var(--soft);
  color: var(--text);
  text-decoration: none;
}

.tracklist { list-style: none; margin: 1rem 0 0; padding: 0; }
.tracklist__row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.tracklist__row:hover { background: var(--soft); }
.tracklist__row--missing { color: var(--text-dim); }
.tracklist__no { width: 1.5rem; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.tracklist__play {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  width: 2rem; height: 2rem; border-radius: 50%;
  transition: all 0.15s ease;
}
.tracklist__play:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); }
.tracklist__play svg { width: 13px; height: 13px; fill: currentColor; vertical-align: -2px; }
.tracklist__title { flex: 1; }
.tracklist__sub { color: var(--text-dim); font-size: 0.85rem; }
.tracklist__time { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.tracklist__reorder { display: flex; gap: 0.15rem; }

.badge { font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: var(--radius-full); border: 1px solid var(--line); color: var(--text-dim); }
.badge--danger { color: var(--danger); border-color: var(--danger); }

/* --- album header -------------------------------------------------------- */
.back-link { display: inline-block; margin: 1rem 0; }
.album-header { display: flex; gap: 1.5rem; align-items: flex-end; flex-wrap: wrap; }
/* the info block shrinks below its content width so it stays beside the
   cover instead of wrapping under it; its own buttons wrap internally */
.album-header__info { flex: 1; min-width: min(260px, 100%); }
.album-header__cover {
  width: 200px; height: 200px; border-radius: var(--radius-md); object-fit: cover;
  background: var(--accent-3);
  border: 1px solid var(--line);
}
.album-header div[data-controller="play"] { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }

/* --- detail pages: content · speaker(s), boombox proportions (ADR-017) ---- */
.page--detail { max-width: 1280px; }
.detail {
  display: grid;
  /* the speaker is half the stage, like one side of a boombox */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.detail-side--left { display: none; }
@media (min-width: 1860px) {
  .page--detail { max-width: none; }
  /* big screen: speakers flank the content — quarter · half · quarter */
  .detail { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
  .detail-side--left { display: block; }
}
/* The speaker fills the visible column height and rides along on scroll.
   The titlebar is subtracted too: detail pages are often shorter than the
   viewport, so the column sits at scroll 0 forever — without it the VU
   panel hides behind the player bar (ADR-020 fix). */
.detail-side {
  position: sticky;
  top: 1rem;
  height: calc(100vh - var(--player-height) - var(--titlebar-height) - 2rem);
  min-height: 480px;
}
@media (max-width: 1023px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail-side { display: none; }
}

/* --- empty states ---------------------------------------------------------- */
.empty { text-align: center; padding: 4rem 1rem; color: var(--text-dim); }
.empty::before {
  content: "静";
  display: block;
  font-size: 2rem;
  color: var(--line);
  margin-bottom: 0.75rem;
}

/* --- search ------------------------------------------------------------ */
.search-input {
  width: 100%; max-width: 480px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-md); padding: 0.6rem 0.9rem; font: inherit;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { outline: none; border-color: var(--text); background: var(--bg-raised); }
.search-input--small { max-width: 220px; padding: 0.35rem 0.7rem; }

/* --- auth pages ----------------------------------------------------------- */
.auth { max-width: 380px; margin: 15vh auto 0; text-align: left; }
.auth__caption {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
}
.auth__title { font-size: 2.2rem; font-weight: 700; margin: 0.35rem 0 0; }
.auth__sub { margin: 0.5rem 0 1.75rem; }
.auth__google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0.8rem 1rem;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.auth__google:hover { border-color: var(--text); }
.auth__google-logo { width: 20px; height: 20px; }
.auth__or {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.25rem 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
}
.auth__or::before, .auth__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth input[type="email"] {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-full); padding: 0.8rem 1.1rem; font: inherit;
  margin-bottom: 0.75rem;
}
.auth input[type="email"]:focus { outline: none; border-color: var(--text); }
.auth input[type="submit"] {
  width: 100%; background: var(--accent); color: var(--paper);
  border: 1px solid var(--accent);
  border-radius: var(--radius-full); padding: 0.8rem; font-weight: 700;
  transition: opacity 0.15s ease;
}
.auth input[type="submit"]:hover { opacity: 0.9; }

/* --- tables (uploads) ---------------------------------------------------- */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); }
th { color: var(--text-dim); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }

/* --- app connections: the one-shot credential reveal (ADR-032) -------------
   Shown once, inside the connections table, so it reads as an answer to the
   row above it rather than as a standalone panel. */
.token-reveal {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}
.token-reveal p { margin: 0 0 0.75rem; }
.token-reveal__fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  align-items: baseline;
}
.token-reveal__fields dt { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.token-reveal__fields dd { margin: 0; }
#connections code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  user-select: all;
  word-break: break-all;
}

/* --- player: see player.css ------------------------------------------------ */

/* --- theme switcher (trigger + settings panel) -----------------------------
   The trigger lives in the titlebar (always visible): a pill matching the
   search field, sized to its content. */
.theme-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.theme-trigger:hover { border-color: var(--text); }
.theme-trigger__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.theme-trigger__hint {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 0 0.35rem;
}

.theme-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--text) 25%, transparent);
}
.theme-overlay[hidden] { display: none; }

.theme-panel {
  width: min(360px, calc(100vw - 2rem));
  max-height: min(560px, calc(100vh - 2rem));
  overflow-y: auto;
  background: var(--bg-raised);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px var(--shadow);
  padding: 1.1rem 1.25rem 0.75rem;
}
.theme-panel__caption {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}
.theme-panel__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0.1rem 0 0.75rem;
}
.theme-group { margin-bottom: 0.5rem; }
.theme-group__label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin: 0.5rem 0 0.35rem;
}
.theme-group__label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.theme-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  text-align: left;
}
.theme-option.is-highlighted {
  background: var(--wash-accent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.theme-option__check { visibility: hidden; color: var(--accent); }
.theme-option.is-current .theme-option__check { visibility: visible; }
.theme-panel__foot {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0 0.35rem;
  border-top: 1px solid var(--line);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}
.theme-panel__close {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.5rem;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}
.theme-panel__close:hover { color: var(--text); border-color: var(--text); }

/* --- inline forms, icon buttons, selects ---------------------------------- */
.inline { display: inline; }
.inline-form { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
.icon-button {
  background: none; border: none; color: var(--text-dim);
  width: 1.9rem; height: 1.9rem; border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.icon-button:hover { background: var(--soft); color: var(--text); }
.icon-button--danger:hover { color: var(--danger); }
.icon-button--active { color: var(--accent); }
.playlist-select {
  background: transparent; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.25rem 0.4rem; font-size: 0.8rem; max-width: 8.5rem;
}
.playlist-header .playlist-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
/* rename form rides the action row: no stray margins, input + button stay paired */
.playlist-actions .inline-form { margin: 0; flex-wrap: nowrap; }

/* --- page header (title + blurb, primary action on the right) -------------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1.75rem;
}
.page-head h1 { margin: 0; }
.page-head__sub { margin: 0.4rem 0 0; max-width: 62ch; }
/* Pins the trailing action right even when it's the header's only child (a
   lone flex item under space-between would otherwise sit left). */
.page-head__end { margin-left: auto; }

/* The page's primary action, sized so it can't be mistaken for a sentence. */
.button--lead {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.35rem;
  font-weight: 700;
}
.button__ico { display: inline-flex; align-items: center; margin-right: 0.4rem; }
.button__ico svg { width: 14px; height: 14px; fill: currentColor; display: block; }

/* --- uploads status page --------------------------------------------------- */
.upload-table { table-layout: fixed; }
.upload-table__size, .upload-table__when { white-space: nowrap; }
.upload-table__size { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.upload-table th:nth-child(3) { width: 11rem; }
.upload-table th:nth-child(4) { width: 8rem; }
.upload-table th:nth-child(5) { width: 10rem; }
.upload-table td { vertical-align: top; }
.upload-file { display: block; overflow-wrap: anywhere; }
.upload-error { display: block; margin-top: 0.15rem; font-size: 0.78rem; color: var(--danger); }
/* the absolute timestamp lives in the title attribute — no underline, which
   would read as a link (hairlines, not chrome) */
.upload-table time { cursor: help; }

/* A dot + a plain-language label. Vermillion marks the two states that are
   about to change or need you: indexing (pulsing) and failed. */
.upload-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
}
.upload-status__dot {
  width: 7px; height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}
.upload-status--ok { color: var(--ok); }
.upload-status--failed { color: var(--danger); }
.upload-status--working { color: var(--accent-strong); }
.upload-status--working .upload-status__dot { animation: upload-pulse 1.4s ease-in-out infinite; }
@keyframes upload-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .upload-status--working .upload-status__dot { animation: none; }
}

/* --- upload dropzone ------------------------------------------------------ */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.dropzone {
  border: 1px dashed var(--text-dim);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  padding: 2.5rem 1rem;
  text-align: center;
  margin: 1rem 0;
  transition: all 0.15s ease;
  cursor: pointer; /* the whole zone opens the file picker */
}
.dropzone:hover { border-color: var(--accent); }
.dropzone--active { border-color: var(--accent); background: var(--wash-accent); }
.dropzone p { margin: 0.4rem 0; }
.dropzone__ico {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  color: var(--text-dim);
}
.dropzone__actions { display: flex; justify-content: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.9rem; }

.upload-summary { margin: 0.75rem 0 0; }
.upload-rights { display: flex; align-items: flex-start; gap: 0.6rem; margin: 1.25rem 0; }
.upload-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.upload-list { list-style: none; margin: 0.5rem 0 1rem; padding: 0; max-height: 40vh; overflow-y: auto; }
.upload-list li {
  display: grid; grid-template-columns: 1fr 120px auto; align-items: center; gap: 0.75rem;
  padding: 0.35rem 0.6rem; border-radius: var(--radius-sm); font-size: 0.9rem;
}
.upload-list li:hover { background: var(--soft); }
.upload-list__meta { display: flex; gap: 0.6rem; align-items: baseline; min-width: 0; }
.upload-list__meta span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-list__status { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }
.upload-list__status--ok { color: var(--ok); }
.upload-list__status--failed { color: var(--danger); }
.upload-list li button {
  background: none; border: none; color: var(--text-dim);
  width: 1.7rem; height: 1.7rem; border-radius: var(--radius-sm);
}
.upload-list li button:hover { color: var(--danger); background: var(--soft); }

.progress {
  height: 4px; border-radius: var(--radius-full); background: var(--soft);
  overflow: hidden;
}
.progress__bar {
  height: 100%; width: 0; border-radius: var(--radius-full);
  background: var(--accent-2);
  transition: width 0.2s ease;
}
.progress__bar--failed { background: var(--danger); }

/* --- mobile ------------------------------------------------------------ */
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.75rem; }
  .library-tab { padding: 0.4rem 0.7rem; font-size: 0.72rem; white-space: nowrap; }
  .library-tabs { flex-wrap: wrap; }
  .album-header__cover { width: 140px; height: 140px; }
  .tracklist__sub { display: none; }
  .titlebar { padding: 0.75rem 1rem; gap: 0.75rem; }
  /* Brand shrinks to seal + katakana: the roman name hides (it stays in the
     DOM as the link's accessible name) and the kana steps up to wordmark. */
  .titlebar__name { display: none; }
  .titlebar__kana {
    font-size: 0.85rem;
    letter-spacing: 0.3em;
    color: var(--text);
    font-weight: 700;
  }
  /* Theme trigger collapses to its accent dot — a round swatch button the
     size of the avatar; the name and "/" keycap are desktop chrome. */
  .theme-trigger {
    width: 36px;
    height: 36px;
    justify-content: center;
    padding: 0;
  }
  .theme-trigger [data-theme-target="triggerLabel"],
  .theme-trigger__hint { display: none; }
  .theme-trigger__dot { width: 14px; height: 14px; }
}
