/*
 * Sets.LIVE design system + public layout.
 * Apple dark-mode "materials" in the colours of the site logo: neutral graphite surfaces, frosted bars,
 * menus and sheets, hairline separators and one restrained accent (the logo's mint).
 * Tokens and base components are shared with player.css, admin.css, features.css, identify.css, sc.html
 * and the register/token pages: extend them there, never redefine them. Style guide: STYLE.md (DS).
 * Breakpoint: desktop >= 900px, mobile < 900px.
 */

/* ------------------------------------------------------------------ tokens */
:root {
  /* Surfaces: page < elevated (cards, lists, dialogs) < controls on cards */
  --bg: #0b0b0c; --bg-elev: #1c1c1e; --bg-elev-2: #2c2c2e; --bg-hover: #3a3a3c;
  /* Materials: always paired with backdrop-filter: var(--blur) */
  --material: rgba(28, 28, 30, .72); --material-thick: rgba(28, 28, 30, .86); --material-thin: rgba(44, 44, 46, .55);
  --bg-glass: var(--material);
  --menu-bg: rgba(37, 37, 39, .88); --menu-solid: #232325;
  --blur: saturate(180%) blur(24px);
  /* Fills: hover/press on any surface, text fields, thin controls */
  --hover: rgba(255, 255, 255, .05); --press: rgba(255, 255, 255, .09);
  --field: rgba(118, 118, 128, .12); --fill: rgba(118, 118, 128, .24); --fill-strong: rgba(118, 118, 128, .36);
  --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .14); --separator: rgba(84, 84, 88, .45);
  /* Text: faint only on --bg, --bg-elev, materials, --field and --hover (>= 4.5:1 there) */
  --text: #f5f5f7; --text-dim: #aeaeb2; --text-faint: #8e8e93;
  /* The one accent: the logo's mint cloud */
  --accent: #6dd7ca; --accent-2: #8eccb6; --accent-grad: linear-gradient(135deg, #6dd7ca 0%, #8eccb6 100%);
  --accent-ink: #06231f; --accent-soft: rgba(109, 215, 202, .14); --accent-line: rgba(109, 215, 202, .38); --accent-strong: #4fc9ba;
  /* The logo's speaker */
  --graphite: #2f2f2f; --graphite-deep: #121212; --graphite-cap: #868686;
  --danger: #ff453a; --danger-text: #ff6961; --danger-soft: rgba(255, 69, 58, .14);
  --success: #32d74b; --success-soft: rgba(50, 215, 75, .14);
  --warning: #ffd60a; --warning-soft: rgba(255, 214, 10, .12);
  --radius-lg: 20px; --radius: 16px; --radius-sm: 12px; --radius-xs: 8px; --radius-pill: 999px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 28px rgba(0, 0, 0, .45);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .55), 0 0 0 .5px rgba(255, 255, 255, .08);
  --shadow-lg: var(--shadow-pop);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --col: 760px; --topbar-h: 60px; --mini-h: 68px; --ease: cubic-bezier(.2, .8, .2, 1);
  --z-topbar: 50; --z-player: 60; --z-sheet: 80; --z-dialog: 90; --z-toast: 100;
  /* Derived (public layout) */
  --z-popover: 85;
  --wide: 1180px;
  --row-h: 58px;
  --player-empty-h: 76px;  /* desktop space reserved before the player mounts: idle card (player.css) */
  --player-h: 236px;       /* ... and when a track is about to be restored: loaded card */
  --ph-glyph: rgba(255, 255, 255, .55);
  color-scheme: dark;
}

/* ------------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
  background: var(--bg);
  /* Keyboard focus and in-page jumps stop below the sticky top bar (WCAG 2.4.11) */
  scroll-padding-top: calc(var(--topbar-h) + 8px);
}
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  position: relative;
  background: var(--bg); color: var(--text);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul[role], ol[role], .plain-list { list-style: none; padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { border: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
[hidden] { display: none !important; }
::selection { background: rgba(109, 215, 202, .32); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font: 700 28px/34px var(--font-display); letter-spacing: -.02em; }
h2 { font: 600 20px/25px var(--font-display); letter-spacing: -.01em; }
h3 { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.005em; }
hr { border: 0; border-top: 1px solid var(--separator); margin: 16px 0; }
code, kbd, pre, samp { font-family: var(--mono); font-size: .9em; }
mark {
  background: rgba(109, 215, 202, .2); color: #fff; border-radius: 3px; padding: 0 1px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ------------------------------------------------------------- type scale */
.t-large { font: 700 28px/34px var(--font-display); letter-spacing: -.02em; }
.t-title { font: 600 20px/25px var(--font-display); letter-spacing: -.01em; }
.t-headline { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.005em; }
.t-body { font-size: 15px; line-height: 20px; }
.t-callout { font-size: 14px; line-height: 19px; }
.t-footnote { font-size: 13px; line-height: 18px; }
.t-caption { font-size: 12px; line-height: 16px; font-weight: 500; }

/* --------------------------------------------------------------- utilities */
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: 10px; z-index: var(--z-toast); padding: 10px 16px;
  border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-ink); font-weight: 650;
  transform: translateY(-160%); transition: transform .2s var(--ease);
}
.skip-link:focus { transform: none; text-decoration: none; }

/* Materials: translucent, blurred, hairline edge. Opaque fallback where backdrop-filter is missing. */
.material, .material--thick, .material--thin {
  background: var(--material); border: .5px solid var(--border);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.material--thick { background: var(--material-thick); }
.material--thin { background: var(--material-thin); }
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .material, .material--thick, .material--thin { background: rgba(28, 28, 30, .97); }
}

.icon {
  width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }
.icon--spin { animation: spin .9s linear infinite; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px;
  padding: 0 6px; border-radius: 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  background: var(--bg-elev-2); color: var(--text-dim); font: 600 11.5px/1 var(--font); white-space: nowrap;
}

/* ----------------------------------------------------------------- buttons */
/* .btn is the gray button; --filled/--primary, --tinted, --plain/--ghost and --danger are the variants. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--bg-elev-2); color: var(--text);
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease),
    transform .15s var(--ease), filter .15s var(--ease);
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }
.btn--gray { background: var(--bg-elev-2); color: var(--text); }
.btn--primary, .btn--filled { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover, .btn--filled:hover { background: #86e0d5; }
.btn--primary:active:not(:disabled), .btn--filled:active:not(:disabled) { background: var(--accent-strong); }
.btn--tinted { background: var(--accent-soft); color: var(--accent); }
.btn--tinted:hover { background: rgba(109, 215, 202, .22); }
.btn--ghost, .btn--plain { background: transparent; color: var(--text-dim); }
.btn--ghost:hover, .btn--plain:hover { background: var(--hover); color: var(--text); }
.btn--ghost:active:not(:disabled), .btn--plain:active:not(:disabled) { background: var(--press); }
.btn--danger { background: var(--danger-soft); color: var(--danger-text); }
.btn--danger:hover { background: rgba(255, 69, 58, .22); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--radius-xs); gap: 6px; }
.btn--sm .icon { width: 16px; height: 16px; }
.btn--lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 14px; }
/* Pill wins over the size modifiers' radius, whatever their order in the class list (UX21-05) */
.btn.btn--pill { border-radius: var(--radius-pill); }
.btn--icon { width: 40px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn--icon.btn--lg { width: 48px; }
.btn--icon[aria-pressed="true"], .btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------- forms */
.input, .select, .textarea {
  display: block; width: 100%; height: 40px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--field); color: var(--text); font-size: 15px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(255, 255, 255, .22); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 215, 202, .24);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aeaeb2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.select option { background: var(--bg-elev-2); color: var(--text); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
input[type="range"] { accent-color: var(--accent); }
.input--sm, .select--sm { height: 32px; font-size: 13px; border-radius: var(--radius-xs); }
.input-icon { position: relative; display: block; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; width: 18px; height: 18px; }
.input-icon > .input { padding-left: 38px; }
/* A field with a trailing button (show/hide password, clear) */
.input-affix { position: relative; display: block; }
.input-affix > .input { padding-right: 48px; }
.input-affix__btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-affix__btn:active:not(:disabled) { transform: translateY(-50%) scale(.95); }
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field > label, .field__label { font-size: 13px; font-weight: 600; color: var(--text); }
.field__hint { font-size: 13px; color: var(--text-faint); }
.field__error { font-size: 13px; color: var(--danger-text); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }

/* Segmented control (iOS): <div class="segmented" role="tablist"><button class="segmented__item" aria-selected="true"> */
.segmented {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
  padding: 2px; border-radius: 10px; background: var(--fill);
}
.segmented--block { display: grid; width: 100%; }
.segmented__item {
  min-width: 0; height: 30px; padding: 0 14px; border-radius: 8px; color: var(--text);
  font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color .18s var(--ease), box-shadow .18s var(--ease);
}
.segmented__item:hover { background: var(--hover); }
.segmented__item[aria-selected="true"], .segmented__item[aria-pressed="true"], .segmented__item[aria-checked="true"] {
  background: #636366; box-shadow: 0 3px 8px rgba(0, 0, 0, .18), 0 1px 1px rgba(0, 0, 0, .12);
}
.segmented__item:focus-visible { outline-offset: -2px; }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 .5px var(--accent-line);
  font: 700 13px/1 var(--font-display); text-transform: uppercase; user-select: none;
}
.avatar--lg { width: 44px; height: 44px; font-size: 18px; }

/* ------------------------------------------------------ cards, chips, badges */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--separator);
}
.card__head > h2, .card__head > h3 { font: 600 15px/20px var(--font); letter-spacing: 0; }
.card__body { padding: 18px; }

/* Inset grouped list (Apple Settings style) */
.group { display: grid; gap: 6px; }
.group + .group { margin-top: 22px; }
.group__header { padding: 0 16px; color: var(--text-faint); font: 500 12px/16px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.group__body { overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-elev); border: 1px solid var(--border); }
.group__row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 16px;
  color: var(--text); font-size: 15px; line-height: 20px; text-align: left; text-decoration: none;
}
.group__row + .group__row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--separator); }
.group__row > .icon { width: 20px; height: 20px; color: var(--text-dim); }
a.group__row:hover, button.group__row:hover { background: var(--hover); text-decoration: none; }
a.group__row:active, button.group__row:active { background: var(--press); }
.group__label { flex: 1; min-width: 0; }
.group__value { margin-left: auto; min-width: 0; color: var(--text-dim); text-align: right; overflow-wrap: anywhere; }
.group__chev { width: 16px; height: 16px; color: var(--text-faint); }
.group__footer { padding: 0 16px; color: var(--text-faint); font-size: 13px; line-height: 18px; }
.dialog .group__body { background: rgba(255, 255, 255, .04); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; flex: none;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-dim); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { background: var(--bg-elev-2); color: var(--text); text-decoration: none; }
.chip .icon { width: 15px; height: 15px; }
.chip.is-active, .chip[aria-pressed="true"], .chip[aria-current="true"] {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--text);
}
.chip__count { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.chip.is-active .chip__count, .chip[aria-pressed="true"] .chip__count { color: var(--text-dim); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; flex: none;
  border-radius: 6px; border: 1px solid var(--border-strong); background: rgba(255, 255, 255, .05);
  color: var(--text-dim); font-size: 11px; font-weight: 650; line-height: 1; letter-spacing: .02em; white-space: nowrap;
  vertical-align: middle;
}
.badge--ok { color: var(--success); background: var(--success-soft); border-color: rgba(50, 215, 75, .3); }
.badge--warn { color: var(--warning); background: var(--warning-soft); border-color: rgba(255, 214, 10, .3); }
.badge--danger { color: var(--danger-text); background: var(--danger-soft); border-color: rgba(255, 69, 58, .34); }
.badge--muted { color: var(--text-faint); background: transparent; border-color: var(--border); }
.badge--accent { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* -------------------------------------------------------- spinner, skeleton */
.spinner {
  display: inline-block; width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .16); border-top-color: var(--accent);
  animation: spin .8s linear infinite; vertical-align: middle;
}
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }
.skeleton {
  display: block; border-radius: var(--radius-xs); min-height: 12px;
  background: linear-gradient(90deg, var(--bg-elev-2) 0%, #353538 40%, var(--bg-elev-2) 80%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.progress { height: 4px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--p, 0%); background: var(--accent-grad); border-radius: inherit; transition: width .4s var(--ease); }

/* ------------------------------------------------------------------- table */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint); padding: 10px 12px; border-bottom: 1px solid var(--separator); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--separator); vertical-align: middle; }
.table tbody tr { transition: background-color .12s var(--ease); }
.table tbody tr:hover { background: var(--hover); }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------- logo */
/* Wordmark "Sets" + ".LIVE" next to the logo mark (mint cloud + graphite speaker), drawn from an inline SVG
   so every page that prints the standard logo markup gets it (the old live dot element becomes the mark). */
.logo {
  display: inline-flex; align-items: center; gap: .4em; flex: none;
  color: var(--text); font: 700 19px/1 var(--font-display); letter-spacing: -.02em;
  white-space: nowrap; text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo__mark, .logo__dot {
  display: block; flex: none; width: 1.6em; height: 1.02em; margin-top: -.08em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 46 256 162'%3E%3Cdefs%3E%3ClinearGradient id='g' gradientUnits='userSpaceOnUse' x1='236' y1='60' x2='20' y2='200'%3E%3Cstop offset='0' stop-color='%236dd7ca'/%3E%3Cstop offset='1' stop-color='%238eccb6'/%3E%3C/linearGradient%3E%3Cmask id='m'%3E%3Crect y='40' width='256' height='180' fill='%23fff'/%3E%3Ccircle cx='193' cy='127' r='66' fill='%23000'/%3E%3C/mask%3E%3C/defs%3E%3Cg fill='url(%23g)' mask='url(%23m)'%3E%3Ccircle cx='97' cy='105' r='55'/%3E%3Ccircle cx='44' cy='158' r='44'/%3E%3Ccircle cx='211' cy='158' r='44'/%3E%3Crect x='44' y='112' width='167' height='90'/%3E%3C/g%3E%3Ccircle cx='193' cy='127' r='61' fill='%232f2f2f' stroke='%23e5e5ea' stroke-opacity='.4' stroke-width='3'/%3E%3Ccircle cx='193' cy='127' r='31.5' fill='%23121212'/%3E%3Ccircle cx='193' cy='127' r='10.5' fill='%23868686'/%3E%3C/svg%3E") center / contain no-repeat;
}
.logo__live { color: var(--accent); }

/* ---------------------------------------------------------- toasts & popups */
.toasts {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: var(--z-toast);
  width: min(460px, calc(100% - 24px)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%;
  min-height: 46px; padding: 7px 8px 7px 14px; border-radius: 14px;
  background: var(--menu-bg); border: .5px solid var(--border-strong); box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  color: var(--text); font-size: 14px; animation: toast-in .24s var(--ease) both;
}
.toast.is-leaving { animation: toast-out .18s ease-in both; }
.toast__icon { color: var(--accent); }
.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger-text); }
.toast__msg { flex: 1; min-width: 0; padding-right: 4px; }
.toast__action { color: var(--accent); font-weight: 650; }
.toast__close { color: var(--text-dim); }

.backdrop {
  position: fixed; inset: 0; z-index: var(--z-dialog); background: rgba(0, 0, 0, .52);
  display: grid; place-items: center; padding: 16px; animation: fade-in .18s var(--ease) both;
}
.backdrop.is-leaving { animation: fade-out .15s ease-in both; }
.dialog {
  position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--bg-elev); border: .5px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); padding: 22px 24px 24px; animation: dialog-in .22s var(--ease) both;
}
.dialog.is-leaving { animation: fade-out .15s ease-in both; }
.dialog--wide { width: min(620px, 100%); }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dialog__head .btn--icon { margin: -4px -8px 0 0; border-radius: 50%; }
.dialog__title { font: 600 20px/25px var(--font-display); letter-spacing: -.01em; }
.dialog__lead { margin: -2px 0 16px; color: var(--text-dim); font-size: 14px; line-height: 19px; }
.dialog__body { color: var(--text-dim); font-size: 15px; line-height: 21px; }
.dialog__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.dialog__body a:not(.btn), .notice__text a, .empty__text a, .head__desc a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent-line); }

.menu {
  position: fixed; z-index: var(--z-popover); min-width: 220px; max-width: min(320px, calc(100vw - 16px));
  /* Long menus (the Add to playlist flyout) scroll inside the viewport instead of running off it (UX21-01) */
  max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 5px; border-radius: var(--radius-sm); background: var(--menu-bg); border: .5px solid var(--border-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--shadow-pop); animation: pop-in .14s var(--ease) both; transform-origin: top right;
}
.menu__item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-height: 36px; padding: 0 11px;
  border-radius: var(--radius-xs); color: var(--text); font-size: 14px; text-align: left; text-decoration: none; white-space: nowrap;
}
/* :where keeps this at class specificity so extensions (e.g. a centred Cancel row) can override it */
.menu__item > :where(span:not(.menu__hint)), .menu__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.menu__item .icon { width: 18px; height: 18px; color: var(--text-dim); }
/* Pointer: a quiet fill. Keyboard: a clearly visible tinted fill + accent ring (UXUI-02).
   Touch: no sticky :hover on the item that slides in under the finger, only press feedback (UX21-10). */
@media (hover: hover) { .menu__item:hover { background: var(--press); } }
.menu__item:hover { text-decoration: none; }  /* link items (Download) never take the global a:hover underline */
.menu__item:active { background: var(--press); }
.menu__item:focus-visible, .menu__item.is-active {
  background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; text-decoration: none;
}
.menu__item[aria-expanded="true"] { background: var(--press); }
.menu__item[aria-disabled="true"], .menu__item:disabled { opacity: .4; pointer-events: none; }
.menu__item--danger, .menu__item--danger .icon { color: var(--danger-text); }
.menu__item[aria-haspopup="menu"]::after, .menu__item[aria-haspopup="true"]::after,
.menu__item[aria-checked="true"]::after {
  content: ""; flex: none; width: 14px; height: 14px; margin-left: auto; background: currentColor; opacity: .6;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.menu__item[aria-checked="true"]::after {
  color: var(--accent); opacity: 1;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6.5 9.5 17 4 11.5'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6.5 9.5 17 4 11.5'/%3E%3C/svg%3E");
}
.menu__hint { flex: none; margin-left: auto; padding-left: 12px; color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.menu__label { padding: 7px 11px 5px; font-size: 12px; font-weight: 600; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.menu__head { display: grid; gap: 1px; min-width: 0; padding: 8px 11px 9px; margin-bottom: 4px; border-bottom: 1px solid var(--separator); }
.menu__head-title { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.menu__head-sub { overflow: hidden; color: var(--text-dim); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.menu__sep { height: 1px; margin: 5px 10px; background: var(--separator); }
.menu-backdrop { position: fixed; inset: 0; z-index: calc(var(--z-popover) - 1); background: rgba(0, 0, 0, .42); animation: fade-in .18s both; }

.popover {
  position: fixed; z-index: var(--z-popover); width: min(360px, calc(100vw - 24px));
  padding: 16px; border-radius: 14px; background: var(--menu-bg); border: .5px solid var(--border-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--shadow-pop); font-size: 14px; color: var(--text-dim); animation: pop-in .14s var(--ease) both;
}
.popover h2 { font: 600 15px/20px var(--font); color: var(--text); margin-bottom: 6px; }
.popover dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin-top: 12px; align-items: baseline; }
.popover dt { margin: 0; }
.popover dd { font-size: 13px; }

/* -------------------------------------------------- artwork placeholders */
/* Apple Music-style placeholder: graphite with a subtle tint from the logo's family (hue 150-205, mint to
   steel; saturation <= 35%, lightness 22-34%) and a centred glyph. Set --ph-h/--ph-s/--ph-l inline (see
   STYLE.md phStyle()); markup that only sets the older --h (0..359) is mapped into the same family here. */
.art-ph, .thumb, .head__art, .mosaic {
  --ph-h: calc(150 + var(--h, 18) * 55 / 359);
  --ph-s: calc(16% + var(--h, 18) * 19% / 359);
  --ph-l: calc(34% - var(--h, 18) * 12% / 359);
}
/* .mosaic.art-ph: an empty playlist keeps its tint over the plain .mosaic background below (UX21-06) */
.art-ph, .thumb, .head__art, .mosaic__ph, .mosaic.art-ph {
  position: relative; overflow: hidden; display: grid; place-items: center; color: var(--ph-glyph);
  background:
    radial-gradient(120% 90% at 25% 8%, hsl(var(--ph-h) var(--ph-s) calc(var(--ph-l) + 10%) / .42), transparent 62%),
    linear-gradient(160deg, hsl(var(--ph-h) var(--ph-s) var(--ph-l) / .55) 0%, hsl(var(--ph-h) var(--ph-s) var(--ph-l) / .12) 100%),
    linear-gradient(180deg, #2c2c2e, #1c1c1e);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1);
}
.art-ph > .icon, .mosaic__ph > .icon { width: 42%; height: 42%; stroke-width: 1.6; }
.art-ph > img, .mosaic__ph > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* 2x2 cover mosaic (playlists): <span class="mosaic" data-n="4"><img>x4</span> */
.mosaic {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border-radius: var(--radius-sm); flex: none;
  background: linear-gradient(180deg, #2c2c2e, #1c1c1e); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1);
}
.mosaic > img, .mosaic > .mosaic__ph { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; }
.mosaic[data-n="1"] > img:first-child { grid-area: 1 / 1 / 3 / 3; }
.mosaic.art-ph { display: grid; place-items: center; }
.mosaic.art-ph > .icon { grid-area: 1 / 1 / 3 / 3; }

/* ============================================================ PUBLIC LAYOUT */

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar); height: var(--topbar-h);
  background: var(--material); border-bottom: .5px solid var(--separator);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.topbar.is-raised { z-index: var(--z-popover); }
.topbar__inner {
  width: min(var(--wide), calc(100% - 32px)); height: 100%; margin-inline: auto;
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 520px) minmax(max-content, 1fr); align-items: center; gap: 20px;
}
.topbar__start { display: flex; align-items: center; min-width: 0; }
.topbar__end { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav__link {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border-radius: var(--radius-pill); color: var(--text-dim); font-size: 14px; font-weight: 600; text-decoration: none;
  white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav__link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav__link[aria-current="page"] { color: var(--text); background: rgba(255, 255, 255, .08); }
.nav__link[aria-current="page"] .icon { color: var(--accent); }
.nav__link .icon { width: 18px; height: 18px; }
.topbar__search-btn { display: none; }

/* ------------------------------------------------------ type-ahead search */
.search { position: relative; width: 100%; }
.search__bar { position: relative; display: flex; align-items: center; }
.search__icon { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; width: 17px; height: 17px; }
.search__input {
  width: 100%; height: 38px; padding: 0 76px 0 38px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--field); color: var(--text); font-size: 15px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.search__input::placeholder { color: var(--text-faint); opacity: 1; }
.search__input:hover { border-color: var(--border-strong); }
.search__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 215, 202, .24); }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search__tail { position: absolute; right: 7px; display: flex; align-items: center; gap: 4px; }
.search__hint { pointer-events: none; }
.search__input:focus ~ .search__tail .search__hint, .search.has-value .search__hint { display: none; }
.search__clear { width: 28px; height: 28px; border-radius: 50%; display: none; place-items: center; color: var(--text-dim); }
.search__clear:hover { background: var(--hover); color: var(--text); }
.search.has-value .search__clear { display: grid; }
.search__back { display: none; }
.search__panel {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max(100%, 580px); max-width: calc(100vw - 32px);
  max-height: min(72vh, 660px); overflow: auto; overscroll-behavior: contain;
  /* Solid: inside the blurred top bar a nested backdrop-filter cannot see the page (backdrop root) */
  padding: 6px; border-radius: var(--radius); background: var(--menu-solid); border: .5px solid var(--border-strong);
  box-shadow: var(--shadow-pop); animation: pop-in .14s var(--ease) both; transform-origin: top center;
}
.search__panel[hidden] { display: none; }
.sugg-list { list-style: none; margin: 0; padding: 0; }
.sugg-group {
  padding: 10px 12px 5px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim);
}
.sugg {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 56px; padding: 7px 10px; border-radius: 10px; cursor: pointer; scroll-margin: 6px;
  /* keyboard-selected options stay clear of the sticky "See all results" row (SRCH-07) */
  scroll-margin-bottom: 60px;
}
.sugg:hover { background: var(--hover); }
.sugg[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent-line); }
.sugg__main { min-width: 0; display: block; }
.sugg__title, .sugg__sub, .sugg__path { display: block; }
.sugg__title { font-size: 15px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg__sub, .sugg__path { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg__sub { color: var(--text-dim); }
.sugg__path { color: var(--text-faint); }
.sugg__end { color: var(--text-faint); font-size: 13px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.sugg[aria-selected="true"] .sugg__path, .sugg[aria-selected="true"] .sugg__end { color: var(--text-dim); }
.sugg__go { opacity: 0; color: var(--text-dim); transition: opacity .12s; }
.sugg[aria-selected="true"] .sugg__go { opacity: 1; }
/* The total and the way into the full results stay visible while the panel scrolls (SRCH-07). */
.sugg--all {
  position: sticky; bottom: -6px; z-index: 1;
  grid-template-columns: 40px minmax(0, 1fr) auto; min-height: 48px; margin-top: 4px;
  border-top: 1px solid var(--separator); border-radius: 0 0 10px 10px; background: var(--menu-solid);
}
.sugg--all[aria-selected="true"] { background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--menu-solid); }
.sugg--all .sugg__title { color: var(--accent); font-weight: 600; }
.sugg--recent { min-height: 44px; }
.sugg-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--fill); color: var(--text-dim); }
.sugg-status { display: flex; align-items: center; gap: 10px; padding: 14px 12px; color: var(--text-dim); font-size: 14px; }
.sugg-empty { padding: 20px 14px; color: var(--text-dim); font-size: 14px; text-align: center; }
.sugg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 8px 10px 4px; font-size: 12px; color: var(--text-dim); border-top: 1px solid var(--separator); margin-top: 4px; }
.sugg-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* ------------------------------------------------------------------ notice */
.notice {
  width: min(var(--col), calc(100% - 32px)); margin: 14px auto 0; display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 10px 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid rgba(109, 215, 202, .26); background: var(--accent-soft); color: var(--text); font-size: 14px;
  animation: fade-in .2s both;
}
.notice > .icon { margin-top: 1px; color: var(--accent); }
.notice__text { flex: 1; min-width: 0; padding-top: 1px; white-space: pre-line; }
.notice__close { margin: -5px 0; }
.notice--warning { border-color: rgba(255, 214, 10, .3); background: var(--warning-soft); }
.notice--warning > .icon { color: var(--warning); }
.notice--danger, .notice--error { border-color: rgba(255, 69, 58, .34); background: var(--danger-soft); }
.notice--danger > .icon, .notice--error > .icon { color: var(--danger-text); }
.notice--success { border-color: rgba(50, 215, 75, .3); background: var(--success-soft); }
.notice--success > .icon { color: var(--success); }

/* ----------------------------------------------------------- shell, footer */
.shell { width: min(var(--col), calc(100% - 32px)); margin-inline: auto; padding: 16px 0 40px; }
.view { outline: none; min-height: 50vh; }
.view.is-entering > * { animation: view-in .22s var(--ease) both; }
.view__heading:focus { outline: none; }
.view__heading:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

.footer {
  width: min(var(--col), calc(100% - 32px)); margin: 0 auto; padding: 22px 0 30px;
  border-top: 1px solid var(--separator); color: var(--text-faint); font-size: 13px; text-align: center;
}
.footer__links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 4px; list-style: none; margin: 0; padding: 0; }
.footer__links li { display: inline-flex; align-items: center; }
.footer__links li + li::before { content: "\00B7"; margin-right: 4px; color: var(--text-faint); }
.footer a { color: var(--text-dim); padding: 4px 6px; border-radius: 6px; }
.footer a:hover { color: var(--text); background: var(--hover); text-decoration: none; }
/* Footer "Links" button: the chain swings and the chevron lifts on hover, hinting at the menu above it. */
.footer__more::before { align-self: center; }
.footer__linksbtn {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 6px; border: 0; border-radius: 6px;
  background: none; color: var(--text-dim); font: inherit; cursor: pointer;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.footer__linksbtn .icon { width: 15px; height: 15px; transition: transform .25s var(--ease), color .15s var(--ease); }
.footer__linksbtn .footer__chev { width: 13px; height: 13px; opacity: .7; }
.footer__linksbtn:hover, .footer__linksbtn[aria-expanded="true"] { color: var(--text); background: var(--hover); }
.footer__linksbtn:hover .footer__linkicon, .footer__linksbtn[aria-expanded="true"] .footer__linkicon { color: var(--accent); transform: rotate(-35deg) scale(1.08); }
.footer__linksbtn:hover .footer__chev { transform: translateY(-2px); }
.footer__linksbtn[aria-expanded="true"] .footer__chev { transform: rotate(180deg); }
.footer__links--plain { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .footer__linksbtn .icon { transition: none; } }
.footer__meta { margin-top: 10px; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.footer__keys { display: inline-flex; align-items: center; gap: 6px; color: var(--text-faint); }
.footer__keys:hover { color: var(--text-dim); }
@media (hover: none) { .footer__keys { display: none; } }

/* ------------------------------------------------------------- breadcrumbs */
.crumbs { margin: 6px 0 0; }
.crumbs ol {
  display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 2px 0;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
/* Scrolled to the current crumb (FEND-11): fade the start too, so the hidden root crumbs are hinted */
.crumbs ol.is-scrolled {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.crumbs ol::-webkit-scrollbar { display: none; }
.crumbs li { display: flex; align-items: center; flex: none; }
.crumbs li:last-child { padding-right: 24px; }
.crumbs li + li::before {
  content: ""; width: 14px; height: 14px; margin: 0 1px; opacity: .55; flex: none;
  background: currentColor; color: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.crumb {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--radius-pill);
  color: var(--text-dim); font-size: 13.5px; font-weight: 550; white-space: nowrap; max-width: 300px;
}
.crumb > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumb:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.crumb[aria-current="page"] { color: var(--text); font-weight: 650; }
.crumb[aria-current="page"]:hover { background: none; }
.crumb .icon { width: 16px; height: 16px; }

/* ------------------------------------------------------------ view headers */
.head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 18px; margin: 14px 0 16px; }
.head--plain { grid-template-columns: minmax(0, 1fr); }
.head__art {
  width: 84px; height: 84px; border-radius: var(--radius); flex: none;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .1), 0 10px 24px -12px rgba(0, 0, 0, .75);
}
.head__art .icon { width: 34px; height: 34px; stroke-width: 1.6; }
.head__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.head__art--accent { background: var(--accent-grad); color: var(--accent-ink); }
.head__art--accent .icon { stroke-width: 2; }
.head__kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.head__title { font: 700 clamp(22px, 2.6vw, 28px)/1.2 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.head__stats { margin-top: 5px; color: var(--text-dim); font-size: 14px; display: flex; flex-wrap: wrap; gap: 2px 0; font-variant-numeric: tabular-nums; }
.head__stats > span + span::before { content: "\00B7"; margin: 0 7px; color: var(--text-faint); }
.head__desc { margin-top: 8px; max-width: 520px; color: var(--text-dim); font-size: 14px; }
.empty .mono { display: block; margin-top: 6px; color: var(--text-faint); font-size: 12.5px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.toolbar__filter { flex: 1 1 200px; min-width: 0; position: relative; }
.toolbar__filter .input { height: 38px; padding-right: 64px; }
.toolbar__count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-faint); pointer-events: none; font-variant-numeric: tabular-nums; }
.toolbar__sort { width: auto; min-width: 118px; height: 38px; }
.toolbar__group { display: flex; gap: 8px; flex-wrap: nowrap; }
.toolbar .btn { height: 38px; }
.toolbar .btn--icon { width: 38px; }
.toolbar .btn--play { border-radius: var(--radius-pill); padding: 0 18px 0 15px; }
.section-label {
  display: flex; align-items: center; gap: 8px; margin: 22px 4px 8px; font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint);
}
.section-label:first-child { margin-top: 4px; }
.section-label__count { font-weight: 500; letter-spacing: 0; text-transform: none; }

/* -------------------------------------------------------------- list, rows */
.list {
  list-style: none; margin: 0; padding: 4px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
}
.list + .list, .list + .section-label { margin-top: 12px; }
.row {
  --cols: 28px 40px minmax(0, 1fr) auto auto;
  --sep: 102px;  /* hairline separator starts under the text column */
  position: relative; display: grid; grid-template-columns: var(--cols); align-items: center; gap: 12px;
  min-height: var(--row-h); padding: 8px 8px 8px 10px; border-radius: 11px;
  content-visibility: auto; contain-intrinsic-size: auto var(--row-h);
  transition: background-color .12s var(--ease);
}
.list > .row + .row::before {
  content: ""; position: absolute; top: 0; left: var(--sep); right: 10px; height: 1px; background: var(--separator);
  pointer-events: none; transition: opacity .12s var(--ease);
}
@media (hover: hover) {
  .row:hover { background: var(--hover); }
  .list > .row:hover::before, .list > .row:hover + .row::before { opacity: 0; }
}
.row.is-current { background: rgba(109, 215, 202, .06); }
.list > .row.is-current::before, .list > .row.is-current + .row::before { opacity: 0; }
.row.is-flash { animation: row-flash 1.6s var(--ease); }
.row.is-anim { animation: rise-in .26s var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
.row.is-unavailable, .row.is-missing { opacity: .45; }
.row__main { min-width: 0; }
.row__link { color: inherit; text-decoration: none; min-width: 0; display: block; }
.row__link:hover { text-decoration: none; }
.row__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.row__link:focus-visible { outline: none; }
.row__link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.row__title {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: 15px; font-weight: 550; color: var(--text); line-height: 1.3;
}
.row__title > .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row__sub { display: block; margin-top: 2px; font-size: 13px; color: var(--text-dim); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__sub .q { color: var(--text-faint); }
.row__sub .m + .q::before, .row__sub .q + .q::before { content: "\00B7"; margin: 0 6px; }
.row__path {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 5px; max-width: 100%; margin-top: 3px;
  font-size: 12.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top;
}
.row__path .icon { width: 13px; height: 13px; }
.row__path:hover { color: var(--text); text-decoration: underline; }
/* A big enough tap target next to the row's own play target (WCAG 2.5.8, UXUI-13) */
@media (pointer: coarse) { .row__path { min-height: 24px; } }
.row__end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
.row__dur { font-size: 13px; color: var(--text-dim); white-space: nowrap; min-width: 3.4em; text-align: right; }
.row__size { font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.row__actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; }
.row__actions .btn { color: var(--text-dim); border-radius: 50%; }
.row__actions .btn:hover { color: var(--text); background: var(--press); }
@media (hover: hover) and (pointer: fine) {
  .row__actions .btn { opacity: 0; transition: opacity .12s var(--ease), background-color .12s, color .12s; }
  .row:hover .row__actions .btn, .row:focus-within .row__actions .btn, .row__actions .btn[aria-expanded="true"] { opacity: 1; }
}

/* index / play / equaliser cell */
.row__idx { position: relative; width: 28px; height: 28px; display: grid; place-items: center; color: var(--text-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.row__idx > * { grid-area: 1 / 1; transition: opacity .12s; }
.row__idx .icon { width: 16px; height: 16px; opacity: 0; color: var(--text); }
.row.is-current .row__idx { color: var(--accent); }
.row.is-current .row__idx .n { opacity: 0; }
.row.is-current .row__idx .eq { opacity: 1; }
@media (hover: hover) {
  .row:hover .row__idx .n, .row.is-current:hover .row__idx .eq { opacity: 0; }
  .row:hover .row__idx .icon { opacity: 1; }
}
.eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 16px; height: 14px; opacity: 0; transition: opacity .12s; }
.eq i { flex: 1; height: 100%; border-radius: 1px; background: var(--accent); transform-origin: bottom; transform: scaleY(.3); }
.eq i:nth-child(2) { transform: scaleY(.55); }
.eq i:nth-child(3) { transform: scaleY(.4); }
.is-playing .eq i { animation: eq .9s ease-in-out infinite alternate; }
.is-playing .eq i:nth-child(2) { animation-duration: .72s; animation-delay: -.3s; }
.is-playing .eq i:nth-child(3) { animation-duration: 1.05s; animation-delay: -.6s; }
.is-playing .eq i:nth-child(4) { animation-duration: .8s; animation-delay: -.15s; }

/* thumbnails (artwork or the placeholder above) */
.thumb { --s: 40px; width: var(--s); height: var(--s); flex: none; border-radius: var(--radius-xs); }
.thumb > .icon { width: 44%; height: 44%; stroke-width: 1.7; }
.thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s var(--ease);
}
.thumb img.is-loaded { opacity: 1; }
.thumb--lg { --s: 56px; border-radius: 10px; }
.thumb .eq { display: none; position: absolute; z-index: 1; width: 18px; height: 16px; }
.row.is-current .thumb::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.row.is-current .thumb .eq { display: inline-flex; opacity: 1; }
@media (min-width: 900px) {
  .row--file.is-current .thumb::after, .row--file.is-current .thumb .eq { display: none; }
}
@media (hover: hover) {
  .row--result .thumb::before, .row--pl .thumb::before {
    content: ""; position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity .15s var(--ease);
    background: rgba(0, 0, 0, .45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5.6v12.8a1 1 0 0 0 1.53.85l10.2-6.4a1 1 0 0 0 0-1.7L9.53 4.75A1 1 0 0 0 8 5.6z'/%3E%3C/svg%3E") center / 42% no-repeat;
  }
  .row--result:hover .thumb::before, .row--pl:hover .thumb::before { opacity: 1; }
}
/* folders: a quiet tinted tile with the folder glyph in the family colour */
.thumb--dir {
  color: hsl(var(--ph-h) 38% 72%);
  background: linear-gradient(180deg, hsl(var(--ph-h) var(--ph-s) var(--ph-l) / .3), hsl(var(--ph-h) var(--ph-s) var(--ph-l) / .16)), var(--bg-elev-2);
}
.thumb--dir > .icon { width: 50%; height: 50%; stroke-width: 1.8; }
.thumb--m3u > .icon { width: 46%; height: 46%; }
.row.is-current .thumb { box-shadow: 0 0 0 2px var(--accent-line); }

/* folder rows */
.row--dir { --cols: 40px minmax(0, 1fr) auto; --sep: 62px; }
.row--dir .row__title { font-weight: 600; }
.row__chev { color: var(--text-faint); display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
@media (hover: hover) { .row--dir:hover .row__chev .icon { color: var(--text); transform: translateX(2px); } }
.row__chev .icon { transition: transform .15s var(--ease), color .15s; width: 18px; height: 18px; }

/* results (search / recent) */
.row--result { --cols: 56px minmax(0, 1fr) auto auto; --row-h: 76px; --sep: 78px; }
.row--result .row__title { font-size: 15.5px; }
/* playlist rows */
.row--pl { --cols: 24px 40px minmax(0, 1fr) auto auto; --sep: 98px; touch-action: pan-y; }
.row--pl.is-dragging {
  z-index: 5; background: var(--bg-elev-2); box-shadow: 0 16px 36px -10px rgba(0, 0, 0, .7), 0 0 0 .5px var(--border-strong);
  transition: none; content-visibility: visible; cursor: grabbing;
}
.row--pl.is-dragging::before, .row--pl.is-dragging + .row::before { opacity: 0; }
.list.is-sorting .row--pl:not(.is-dragging) { transition: transform .18s var(--ease); }
.list.is-sorting { user-select: none; -webkit-user-select: none; }
.grip {
  position: relative; z-index: 1; width: 24px; height: 40px; display: grid; place-items: center; margin-left: -4px;
  color: var(--text-faint); cursor: grab; touch-action: none; border-radius: 6px;
}
.grip:hover { color: var(--text); background: var(--hover); }
.grip .icon { width: 18px; height: 18px; }

/* skeleton rows and states */
.row--skel { pointer-events: none; }
.row--skel .thumb { background: var(--bg-elev-2); box-shadow: none; }
.skel-lines { display: grid; gap: 8px; }
.skel-lines .skeleton:first-child { width: 62%; height: 13px; }
.skel-lines .skeleton:last-child { width: 38%; height: 11px; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 20px; text-align: center; color: var(--text-dim); }
.empty__icon {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 4px; color: var(--accent);
  background: var(--accent-soft);
}
.empty__icon .icon { width: 28px; height: 28px; stroke-width: 1.8; }
.empty__title { font: 600 20px/25px var(--font-display); letter-spacing: -.01em; color: var(--text); }
.empty__text { max-width: 440px; font-size: 15px; line-height: 21px; }
.empty .btn-row { justify-content: center; margin-top: 8px; }
.list .empty { padding: 36px 16px; }
.status-line { display: flex; align-items: center; gap: 10px; padding: 10px 4px; color: var(--text-dim); font-size: 14px; }
.more-rows { display: flex; justify-content: center; padding: 12px 0 4px; }

/* search results view */
.search-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.search-tools .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-right: auto; }
.search-tools .select { width: auto; height: 34px; font-size: 13px; }
.search-edit { display: none; }
.meta-note { display: grid; gap: 7px; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-elev); border: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }
.meta-note__row { display: flex; align-items: center; gap: 8px; }
.meta-note .icon { color: var(--accent); width: 16px; height: 16px; }
.tips { display: grid; gap: 8px; margin: 18px auto 0; max-width: 460px; text-align: left; font-size: 14px; }
/* The search landing lists the tips like the popover: example left, explanation right (UXUI-12) */
.tips dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: baseline; }
.tips dt, .tips dd { margin: 0; }
.tips dd { color: var(--text-dim); }
.tips code, .popover code, .example {
  font-family: var(--mono); font-size: 12.5px; padding: 2px 7px; border-radius: 6px; background: var(--fill);
  border: 1px solid transparent; color: var(--text); white-space: nowrap;
}
button.example { cursor: pointer; }
button.example:hover { border-color: var(--accent-line); color: var(--accent); }

/* day groups (recent) */
.day .section-label { margin-top: 20px; }
.toolbar + .day .section-label { margin-top: 6px; }

/* shortcuts dialog */
.keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; margin-top: 10px; }
.keys__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--separator); font-size: 14px; color: var(--text-dim); }
.keys__row span:last-child { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------------------------------ player placement */
@media (min-width: 900px) {
  .player { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: var(--z-player); margin-bottom: 18px; }
  .player:empty { min-height: var(--player-empty-h); }
  .has-now .player:empty { min-height: var(--player-h); }
  /* Paint the 8px between the top bar and the sticky player so scrolled rows never show through (UXUI-06) */
  .player::before { content: ""; position: absolute; left: -12px; right: -12px; top: -8px; height: 8px; background: var(--bg); pointer-events: none; }
  /* Focus scrolled into view stops below the sticky player too (FEND-07; browsers without :has keep the top bar value) */
  html:has(> body.has-player) { scroll-padding-top: calc(var(--topbar-h) + 8px + var(--player-h) + 12px); }
}
/* Short laptop screens: the compact player card (player.css) is shorter; keep the reservations exact (UXUI-07) */
@media (min-width: 900px) and (max-height: 820px) {
  :root { --player-h: 186px; --player-empty-h: 64px; }
}

/* ---------------------------------------------------- account pages (/register, /token) */
/* main.acct: the public top bar uses a div.acct for its account button, which must not get this layout */
main.acct { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  padding: clamp(28px, 9vh, 88px) 16px calc(24px + env(safe-area-inset-bottom)); }
.acct__brand { margin-bottom: 26px; font-size: 24px; }
.acct__card { width: min(440px, 100%); border-radius: var(--radius-lg); box-shadow: var(--shadow); animation: acct-in .25s var(--ease) both; }
.acct__card > .card__body { padding: clamp(22px, 5vw, 32px); }
.acct__kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.acct__kicker .icon { width: 16px; height: 16px; }
.acct__kicker--ok { color: var(--success); }
.acct__kicker--warn { color: var(--warning); }
.acct__card h1 { font: 700 26px/32px var(--font-display); letter-spacing: -.02em; margin-bottom: 8px; }
.acct__lead { color: var(--text-dim); margin-bottom: 22px; line-height: 21px; }
.acct__form .btn--primary { margin-top: 22px; height: 48px; font-size: 16px; border-radius: 14px; }
.acct__pw { position: relative; }
.acct__pw .input { padding-right: 48px; }
.acct__pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.acct__pw-toggle:active:not(:disabled) { transform: translateY(-50%) scale(.95); }
.acct__hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.acct__alert { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 11px 13px;
  border-radius: var(--radius-sm); font-size: 14px; border: 1px solid rgba(255, 69, 58, .34); background: var(--danger-soft); }
.acct__alert .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--danger-text); }
.acct__alert--info { border-color: rgba(255, 214, 10, .3); background: var(--warning-soft); }
.acct__alert--info .icon { color: var(--warning); }
.acct__alert--success { border-color: rgba(50, 215, 75, .3); background: var(--success-soft); }
.acct__alert--success .icon { color: var(--success); }
.acct__token { display: flex; gap: 8px; align-items: stretch; }
/* The whole token stays visible (wraps) so it can be checked by eye. */
.acct__token-input { min-height: 0; min-width: 0; resize: none; overflow: hidden; word-break: break-all;
  font-family: var(--mono); font-size: 13px; line-height: 1.45; }
.acct__token .btn { flex: none; height: auto; }
.acct__steps { margin: 20px 0 0; padding-left: 20px; color: var(--text-dim); display: grid; gap: 6px; }
.acct__steps b { color: var(--text); font-weight: 600; }
.acct__alt { margin-top: 18px; text-align: center; color: var(--text-dim); font-size: 14px; }
/* Links in running text are underlined, not told apart by colour alone (UXUI-09) */
.acct__alt a, .acct__steps a, .acct__lead a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent-line); }
.acct__foot { margin-top: auto; padding-top: 32px; font-size: 13px; }
.acct__foot ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; list-style: none; margin: 0; padding: 0; }
.acct__foot li + li::before { content: "\00B7"; margin-right: 6px; color: var(--text-faint); }
.acct__foot a { color: var(--text-dim); display: inline-block; padding: 6px 2px; }
@keyframes acct-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- keyframes */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes eq { 0% { transform: scaleY(.2); } 100% { transform: scaleY(1); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes row-flash { 0%, 40% { background-color: rgba(109, 215, 202, .2); } }
@keyframes sheet-in { from { transform: translateY(100%); } }

/* ============================================================== MOBILE < 900 */
@media (max-width: 899.98px) {
  :root { --topbar-h: 56px; --row-h: 62px; }
  body { font-size: 15px; }
  .topbar__inner { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; width: calc(100% - 20px); }
  .topbar__search { display: none; }
  .topbar__search-btn { display: inline-flex; border-radius: 50%; }
  .logo { font-size: 18px; }
  .nav__link { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .nav__link .nav__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

  /* full-screen search overlay */
  body.search-open { overflow: hidden; }
  body.search-open .topbar { z-index: var(--z-popover); -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  body.search-open .topbar__search {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: var(--z-popover);
    background: var(--bg); padding-top: env(safe-area-inset-top); animation: fade-in .16s both;
  }
  /* The overlay is modal: what it covers leaves the tab order and the accessibility tree (UXUI-04) */
  body.search-open .skip-link, body.search-open .topbar__start, body.search-open .topbar__end,
  body.search-open .notice, body.search-open .shell, body.search-open .footer { visibility: hidden; }
  body.search-open .search { display: flex; flex-direction: column; height: 100%; }
  body.search-open .search__bar { padding: 8px 10px; gap: 4px; border-bottom: .5px solid var(--separator); }
  .search__back { display: inline-flex; flex: none; border-radius: 50%; }
  .search__icon { display: none; }
  .search__input { height: 40px; padding-left: 14px; font-size: 16px; border-radius: 11px; }
  .search__tail { right: 16px; }
  .search__hint { display: none; }
  .search__panel {
    position: static; transform: none; width: auto; max-width: none; max-height: none; flex: 1; border: 0; border-radius: 0;
    box-shadow: none; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
    padding: 6px 6px calc(16px + env(safe-area-inset-bottom)); animation: none;
  }
  .search__panel[hidden] { display: block !important; }
  .sugg { min-height: 60px; }
  .sugg--all { position: static; background: transparent; }
  .sugg--all[aria-selected="true"] { background: var(--accent-soft); }
  .sugg__go, .sugg-foot { display: none; }

  .shell { width: calc(100% - 20px); padding-top: 10px; }
  .notice { width: calc(100% - 20px); margin-top: 10px; }
  .footer { width: calc(100% - 20px); }
  body.has-player .shell { padding-bottom: calc(var(--mini-h) + env(safe-area-inset-bottom) + 24px); }
  /* pull the footer into the space the mini player reserves, then keep it clear of the player */
  body.has-player .footer { margin-top: calc(-1 * (var(--mini-h) + env(safe-area-inset-bottom))); padding-bottom: calc(var(--mini-h) + env(safe-area-inset-bottom) + 20px); }
  html:has(> body.has-player) { scroll-padding-bottom: calc(var(--mini-h) + env(safe-area-inset-bottom) + 16px); }
  body.sheet-open { overflow: hidden; }
  body.has-player .toasts { bottom: calc(var(--mini-h) + env(safe-area-inset-bottom) + 14px); }

  .head { gap: 14px; margin: 10px 0 14px; }
  .head__art { width: 64px; height: 64px; border-radius: 14px; }
  .head__art .icon { width: 28px; height: 28px; }
  .head__stats { font-size: 13px; }
  .toolbar__filter { flex-basis: 100%; }
  .toolbar__sort { flex: 1; }
  /* Icon-only on phones, but the words stay the accessible name (UXUI-01) */
  .toolbar .btn:not(.btn--play) .btn-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }

  .list { padding: 3px; border-radius: 14px; }
  .row { --cols: 44px minmax(0, 1fr) auto auto; --sep: 63px; gap: 11px; padding: 8px 4px 8px 8px; }
  .row .row__idx { display: none; }
  .row .thumb { --s: 44px; }
  .row--dir { --cols: 44px minmax(0, 1fr) auto; --sep: 63px; }
  .row--result { --cols: 52px minmax(0, 1fr) auto auto; --sep: 71px; }
  .row--result .thumb { --s: 52px; }
  .row--pl { --cols: 24px 44px minmax(0, 1fr) auto; --sep: 98px; }
  .row--pl .row__end { display: none; }
  .row__actions .btn.d-only, .row__end .row__size { display: none; }
  .row__actions [data-act="pl"] { display: none; }
  .row__title { align-items: flex-start; }
  .row__title > .t { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
  .row__title .badge { margin-top: 1px; }
  .row__dur { font-size: 12.5px; min-width: 0; }
  .row__actions .btn { width: 40px; height: 44px; border-radius: var(--radius-sm); }
  .row__chev .d-only { display: none; }
  .search-edit {
    display: flex; order: -1; width: 100%; justify-content: flex-start; height: 44px; margin-bottom: 4px;
    background: var(--field); border-color: var(--border); color: var(--text-dim); font-weight: 500;
  }
  .search-tools .chips { gap: 4px; }
  .search-tools .chip { padding: 0 11px; }
  .footer__links li + li::before { display: none; }
  .footer__links { gap: 2px 8px; }
  .keys { grid-template-columns: minmax(0, 1fr); }

  /* Action sheet: the row/context menu slides up from the bottom */
  .menu.is-sheet {
    left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: none; min-width: 0;
    max-height: 86vh; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-width: .5px 0 0;
    padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
    /* nearly opaque: colourful artwork under a big sheet must not bleed through as a glow */
    background: rgba(30, 30, 32, .95); -webkit-backdrop-filter: saturate(140%) blur(30px); backdrop-filter: saturate(140%) blur(30px);
    animation: sheet-in .24s var(--ease) both; z-index: var(--z-popover);
  }
  .menu.is-sheet .menu__item { min-height: 52px; padding: 0 14px; font-size: 16px; border-radius: var(--radius-sm); gap: 14px; }
  .menu.is-sheet .menu__item .icon { width: 21px; height: 21px; }
  .menu.is-sheet .menu__label { padding: 6px 14px 8px; font-size: 13px; max-width: none; }
  .menu.is-sheet .menu__head { padding: 6px 14px 12px; margin: 0 -8px 6px; }
  .menu.is-sheet .menu__head-title { font-size: 16px; }
  .menu.is-sheet .menu__head-sub { font-size: 13px; }
  .menu.is-sheet::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: 2px auto 10px; }
  .popover { left: 12px !important; right: 12px; width: auto; }

  .dialog { padding: 20px; }
  /* Sheets: dialogs marked --sheet become bottom sheets on phones */
  .backdrop--sheet { place-items: end stretch; padding: 0; }
  .backdrop--sheet > .dialog--sheet, .dialog--sheet {
    width: 100%; max-width: none; max-height: 92vh; max-height: 92dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-width: .5px 0 0;
    padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); animation: sheet-in .24s var(--ease) both;
  }
  .dialog--sheet::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: 0 auto 14px; }
  .dialog--sheet .dialog__actions { flex-direction: column-reverse; align-items: stretch; }
  .dialog--sheet .dialog__actions .btn { height: 50px; font-size: 16px; border-radius: 14px; }

  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 8px 4px; border-bottom: 1px solid var(--separator); }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 8px; border: 0; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--text-faint); font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  .table td[data-label=""]::before { content: none; }

  .acct__form .input { height: 46px; }
  .acct__token { flex-direction: column; }
  .acct__token-input { font-size: 15px; }
  .acct__token .btn { height: 46px; }
}

/* Landscape phones and high zoom: the top bar scrolls away so content keeps the height (UXUI-16).
   relative (not static) keeps the z-index of .is-raised and the search overlay. */
@media (max-width: 899.98px) and (max-height: 500px) {
  .topbar { position: relative; }
}

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn--icon { min-width: 44px; }
  .btn--sm { min-height: 40px; }
  .btn--icon.btn--sm { min-width: 40px; }
  .chip { height: 36px; }
  .crumb { height: 36px; }
  .menu__item { min-height: 46px; }
  .segmented__item { height: 36px; }
}

/* Phones and touch screens: fields at 16px, so iOS Safari does not zoom into the auth sheet, prompts,
   Change password, filters or the search sort when they get focus (UX21-04). The readonly token box on
   /register and /token opens no keyboard and keeps its size: its two rows hold the 64-character token. */
@media (pointer: coarse), (max-width: 899.98px) {
  .input, .select, .textarea:not(.acct__token-input), .search-tools .select, .search__input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .spinner, .icon--spin { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}
