/* Demagify stylesheet
   Register: analytical. Ruled hairline panels, tinted fills, 3px radius, no shadows.
   Display: Jost. Body and figures: IBM Plex Sans. Data labels: IBM Plex Mono.
   Motion: transform and opacity only, ease-out, 180-240ms on state change. */

:root {
  --gray1: #111111; --gray2: #191919; --gray3: #222222; --gray4: #2a2a2a; --gray5: #313131;
  --gray6: #3a3a3a; --gray7: #484848; --gray8: #606060; --gray9: #6e6e6e; --gray10: #7b7b7b;
  --gray11: #b4b4b4; --gray12: #eeeeee;

  --iris3: #202248; --iris6: #3d3e82; --iris9: #5b5bd6; --iris10: #6e6ade; --iris11: #b1a9ff; --iris12: #e0dffe;
  --red2: #201314; --red3: #3b1219; --red4: #500f1c; --red6: #72232d; --red8: #b54548; --red9: #e5484d; --red10: #ec5d5e; --red11: #ff9592; --red12: #ffd1d9;
  --green2: #121b17; --green3: #132d21; --green6: #20573e; --green9: #30a46c; --green10: #33b074; --green11: #3dd68c; --green12: #b1f1cb;
  --amber9: #ffc53d; --amber11: #ffca16;
  --spotify: #1db954; --spotify-hover: #1ed760;

  --bg: var(--gray1);
  --panel: var(--gray2);
  --panel-2: var(--gray3);
  --line: var(--gray6);
  --line-soft: var(--gray5);
  --ink: var(--gray12);
  --ink-2: var(--gray11);
  --ink-3: var(--gray10);
  --accent: var(--iris9);
  --accent-text: var(--iris11);

  --font-display: 'Jost', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;

  --t-1: 0.8rem;
  --t0: 1rem;
  --t1: 1.25rem;
  --t2: 1.5625rem;
  --t3: 1.953rem;
  --t4: clamp(2.2rem, 1.6rem + 2.4vw, 3.05rem);

  --radius: 3px;
  --topbar-h: 60px;
  --measure: 66ch;
  --gap: 12px;

  --ease-out-3: cubic-bezier(.33, 1, .68, 1);
  --ease-out-4: cubic-bezier(.25, 1, .5, 1);
  --ease-in-3: cubic-bezier(.32, 0, .67, 0);
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-enter: 320ms;
}

/* ------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t0);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body.has-actionbar { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.12; letter-spacing: -0.015em; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent-text); text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon, .btn-icon, .field-icon, .select-chevron, .icon-btn svg, .avatar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
strong { font-weight: 600; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--iris6); color: var(--ink); }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; background: var(--iris9); color: #fff; padding: 10px 14px; border-radius: var(--radius); }
.skip-link:focus { top: 12px; }

.main { width: min(1120px, 100% - 40px); margin: 0 auto; }
.section-title { font-size: var(--t1); }
.section-sub { color: var(--ink-2); font-size: 0.95rem; max-width: var(--measure); }
.page-title { font-size: var(--t3); letter-spacing: -0.02em; }
.page-title:focus, .hero-title:focus { outline: none; }

/* ------------------------------------------------------------- topbar */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1120px, 100% - 40px); margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); flex: none; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; object-fit: contain; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.015em; line-height: 1; }
.topbar-nav { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
.topbar-nav-link {
  background: transparent; border: 1px solid transparent; color: var(--ink-2);
  font-family: inherit; font-size: 0.88rem; font-weight: 500; padding: 6px 12px;
  border-radius: var(--radius); cursor: pointer; line-height: 1;
  transition: all var(--dur) var(--ease-out-3);
}
.topbar-nav-link:hover { color: var(--ink); background: var(--gray3); }
.topbar-nav-link.is-active { color: var(--ink); background: var(--gray4); border-color: var(--line); }

.library-back-home {
  display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2);
  font-size: 0.88rem; font-weight: 500; margin-bottom: 12px; text-decoration: none;
  background: transparent; border: none; cursor: pointer; padding: 0;
  transition: color var(--dur) var(--ease-out-3);
}
.library-back-home:hover { color: var(--iris9); }
.library-back-home .btn-icon { width: 16px; height: 16px; }

.topbar-search { flex: 1; max-width: 360px; margin-left: auto; }
.topbar-session { display: flex; align-items: center; gap: 12px; }
body[data-auth="out"] .topbar-session { margin-left: auto; }
.session { display: flex; align-items: center; gap: 12px; }
.session-text { display: flex; flex-direction: column; line-height: 1.25; }
.session-name { font-weight: 500; font-size: 0.92rem; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-status { font-size: 0.78rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--green9); }
.dot-stale { background: var(--amber9); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gray4); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; font-weight: 600; font-size: 0.85rem; color: var(--ink-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

body[data-auth="out"] .auth-only { display: none !important; }
body[data-auth="in"] .auth-out-only { display: none !important; }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius);
  border: 1px solid transparent; font-weight: 500; font-size: 0.95rem; line-height: 1;
  color: var(--ink); background: var(--gray4); text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur) var(--ease-out-3), border-color var(--dur) var(--ease-out-3), color var(--dur) var(--ease-out-3), transform var(--dur-fast) var(--ease-out-3), opacity var(--dur) var(--ease-out-3);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--iris9); color: #fff; }
.btn-spotify { background: var(--spotify); color: #08130b; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--red9); color: #fff; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 0.88rem; }
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 1rem; }
@media (hover: hover) {
  .btn-primary:hover { background: var(--iris10); }
  .btn-spotify:hover { background: var(--spotify-hover); }
  .btn-ghost:hover { background: var(--gray3); border-color: var(--gray7); }
  .btn-danger:hover { background: var(--red10); }
  .btn:not(.btn-primary):not(.btn-spotify):not(.btn-ghost):not(.btn-danger):hover { background: var(--gray5); }
}
@media (pointer: coarse) { .btn-sm { min-height: 44px; } }

.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--ink-2); transition: background-color var(--dur) var(--ease-out-3), color var(--dur) var(--ease-out-3), transform var(--dur-fast) var(--ease-out-3); }
.icon-btn:active { transform: scale(0.97); }
@media (hover: hover) { .icon-btn:hover { background: var(--gray4); color: var(--ink); } }

.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); font-size: 0.88rem; font-weight: 500; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color var(--dur-fast) var(--ease-out-3); min-height: 32px; }
@media (hover: hover) { .link-btn:hover { text-decoration-color: currentColor; } }

/* ------------------------------------------------------------- fields */
.field { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; background: var(--gray2); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color var(--dur) var(--ease-out-3), background-color var(--dur) var(--ease-out-3); }
.field:focus-within { border-color: var(--iris9); background: var(--gray1); }
.field input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; padding: 10px 0; color: var(--ink); font-size: 0.98rem; }
.field input::placeholder { color: var(--ink-3); }
.field input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.field-icon { color: var(--ink-3); }
.field:focus-within .field-icon { color: var(--ink-2); }
.field-compact { min-height: 40px; }
.field-compact input { font-size: 0.9rem; padding: 8px 0; }
.field-clear { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-right: -6px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink-2); }
.field-clear svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (hover: hover) { .field-clear:hover { background: var(--gray4); color: var(--ink); } }
.field-help { color: var(--ink-3); font-size: 0.85rem; margin-top: 10px; }
.grow { flex: 1; min-width: 0; }

.select { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; background: var(--gray2); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color var(--dur) var(--ease-out-3); }
.select:focus-within { border-color: var(--iris9); }
.select-label { color: var(--ink-3); font-size: 0.88rem; }
.select select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; outline: none; padding: 10px 24px 10px 0; color: var(--ink); font-size: 0.92rem; font-weight: 500; cursor: pointer; }
.select-chevron { position: absolute; right: 10px; color: var(--ink-3); pointer-events: none; width: 16px; height: 16px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--gray2); border: 1px solid var(--line); border-radius: var(--radius); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 2px; background: transparent; color: var(--ink-2); font-size: 0.86rem; font-weight: 500; white-space: nowrap; transition: background-color var(--dur) var(--ease-out-3), color var(--dur) var(--ease-out-3), transform var(--dur-fast) var(--ease-out-3); }
.seg-btn:active { transform: scale(0.97); }
.seg-btn.is-active { background: var(--gray5); color: var(--ink); }
@media (hover: hover) { .seg-btn:not(.is-active):hover { color: var(--ink); background: var(--gray3); } }
.count { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); padding: 1px 6px; border-radius: 2px; background: var(--gray3); }
.seg-btn.is-active .count { color: var(--ink); background: var(--gray7); }

.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; color: var(--ink-2); font-size: 0.88rem; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--gray6); border: 1px solid var(--gray7); transition: background-color var(--dur) var(--ease-out-3), border-color var(--dur) var(--ease-out-3); flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--gray12); transition: transform var(--dur) var(--ease-out-3); }
.switch input:checked + .switch-track { background: var(--iris9); border-color: var(--iris9); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .switch:hover { color: var(--ink); } }

.pill { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 0.86rem; transition: background-color var(--dur) var(--ease-out-3), color var(--dur) var(--ease-out-3), border-color var(--dur) var(--ease-out-3), transform var(--dur-fast) var(--ease-out-3); }
.pill:active { transform: scale(0.97); }
@media (hover: hover) { .pill:hover { color: var(--ink); background: var(--gray3); border-color: var(--gray7); } }
@media (pointer: coarse) { .pill { min-height: 44px; } }

/* ------------------------------------------------------------- views */
.view { padding: 40px 0 64px; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view.is-entering { animation: view-in var(--dur-enter) var(--ease-out-4) both; }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- landing: hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 48px; align-items: start; padding-bottom: 48px; }
.hero-title { font-size: var(--t4); font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; max-width: 14ch; }
.hero-lede { margin-top: 20px; font-size: 1.08rem; line-height: 1.6; color: var(--ink-2); max-width: var(--measure); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-proof { margin-top: 32px; display: grid; gap: 12px; max-width: var(--measure); }
.hero-proof li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); font-size: 0.95rem; line-height: 1.5; }
.hero-proof .marker { margin-top: 7px; }
.marker { display: inline-block; width: 9px; height: 9px; flex: none; background: var(--gray8); }
.marker-maga { background: var(--red9); }
.marker-opposed { background: var(--green9); }
.marker-clean { background: var(--gray8); }
.hero-sample { padding-top: 6px; min-width: 0; max-width: 100%; }
.hero-sample-label { font-size: 0.85rem; color: var(--ink-3); margin-bottom: 10px; }

/* ------------------------------------------------------------- ticker */
.ticker { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 28px 0 32px; margin: 0 calc(50% - 50vw); }
.ticker-head, .ticker-viewport { width: min(1120px, 100% - 40px); margin: 0 auto; }
.ticker-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.ticker-head-col { display: flex; flex-direction: column; gap: 8px; }
.ticker-headline-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ticker-geo-row { display: flex; align-items: center; }
.ticker-geo-pill { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-sans); font-size: 0.82rem; font-weight: 500; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); padding: 5px 12px; border-radius: 9999px; cursor: pointer; transition: all var(--dur-fast) var(--ease-out-3); text-decoration: none; vertical-align: middle; }
@media (hover: hover) { .ticker-geo-pill:hover { background: var(--gray4); border-color: var(--gray8); color: var(--ink); } }
.ticker-geo-flag { font-size: 0.95rem; line-height: 1; }
.ticker-geo-label { letter-spacing: -0.01em; }
.ticker-geo-arrow { color: var(--ink-3); transition: transform var(--dur-fast) var(--ease-out-3); }
.ticker-geo-pill:hover .ticker-geo-arrow { transform: translateY(1px); color: var(--ink); }
.ticker-badge-local { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500; color: var(--amber11); background: var(--panel-2); border: 1px solid var(--line); border-radius: 2px; padding: 2px 6px; width: fit-content; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-local-icon { font-size: 0.7rem; flex: none; }
.ticker-viewport { overflow: hidden; -webkit-mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent); }
.ticker-viewport.is-empty { -webkit-mask-image: none; mask-image: none; }
.ticker-track { display: flex; gap: var(--gap); width: max-content; animation: ticker-scroll 70s linear infinite; will-change: transform; }
.ticker-viewport.is-empty .ticker-track { animation: none !important; width: 100%; justify-content: center; transform: none !important; }
.ticker-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 32px 24px; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); max-width: 580px; width: 100%; box-sizing: border-box; }
.ticker-empty-text { font-size: 0.94rem; color: var(--ink-2); line-height: 1.5; }
.ticker-empty-text strong { color: var(--ink); }
@keyframes ticker-scroll { to { transform: translateX(calc(-50% - var(--gap) / 2)); } }
.ticker-viewport.is-paused .ticker-track, .ticker-viewport:focus-within .ticker-track { animation-play-state: paused; }
@media (hover: hover) { .ticker-viewport:hover .ticker-track { animation-play-state: paused; } }
.ticker-card { position: relative; width: 310px; flex: none; display: grid; gap: 12px; padding: 16px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color var(--dur) var(--ease-out-3), background-color var(--dur) var(--ease-out-3); }
@media (hover: hover) { .ticker-card:hover { border-color: var(--gray8); background: var(--panel-2); } }
.ticker-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ticker-top .dossier-avatar, .ticker-top .dossier-avatar-fallback { width: 44px; height: 44px; font-size: 1rem; flex: none; }
.ticker-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ticker-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.spotify-badge-ticker { position: relative; z-index: 2; width: 18px; height: 18px; }
.spotify-badge-ticker .spotify-inline-icon { width: 11px; height: 11px; }
.ticker-listeners { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-2); font-weight: 500; }
.ticker-tag { font-size: 0.84rem; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.ticker-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.ticker-source { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; min-height: 28px; max-width: 65%; border-radius: 2px; color: var(--ink-2); font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-source .source-favicon { width: 15px; height: 15px; border-radius: 3px; flex: none; background: #ffffff; padding: 1px; box-sizing: border-box; }
@media (hover: hover) { .ticker-source:hover { color: var(--ink); text-decoration: underline; } }
.ticker-action { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); flex: none; }
.ticker-open { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; background: transparent; color: transparent; }
.ticker-open:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; color: transparent; }

/* ------------------------------------------------------------- panels */
.panel { padding: 32px 0 8px; }
.panel-head { margin-bottom: 20px; display: grid; gap: 6px; }
.lookup-form { display: flex; gap: 10px; }
.lookup-form .field { flex: 1; }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.pills-label { color: var(--ink-3); font-size: 0.86rem; margin-right: 2px; }
.lookup-result { margin-top: 20px; }
.lookup-result:empty { display: none; }
.lookup-loading { display: flex; align-items: center; gap: 12px; padding: 20px; color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gray6); border-top-color: var(--iris9); animation: spin 800ms linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.suggestions { position: absolute; left: -1px; right: -1px; top: calc(100% + 6px); z-index: 40; background: var(--gray2); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; display: grid; gap: 2px; }
.topbar-suggestions { left: auto; right: 0; width: 360px; max-width: calc(100vw - 32px); max-height: 400px; overflow-y: auto; border-color: var(--gray6); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55); }
.suggestions li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 2px; cursor: pointer; color: var(--ink); font-size: 0.92rem; }
.suggestions li .icon { width: 14px; height: 14px; color: var(--ink-3); }
.suggestions li[aria-selected="true"] { background: var(--gray4); }
@media (hover: hover) { .suggestions li:hover { background: var(--gray3); } }

.suggest-item { display: flex; align-items: center; gap: 10px; width: 100%; }
.suggest-thumb { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: var(--gray4); border: 1px solid var(--line-soft); }
.suggest-thumb-fallback { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 600; color: var(--ink-2); background: var(--gray4); border: 1px solid var(--line-soft); flex: none; }
.suggest-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.suggest-top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.suggest-name { font-weight: 500; font-size: 0.9rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-badge { font-size: 0.72rem; padding: 2px 6px; border-radius: 2px; font-weight: 600; flex: none; }
.suggest-badge-maga { background: var(--red9); color: #fff; }
.suggest-badge-opposed { background: var(--green9); color: #06170f; }
.suggest-badge-clean { background: var(--gray5); color: var(--ink-2); }
.suggest-summary { font-size: 0.78rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ------------------------------------------------------------- connect */
.connect { padding: 40px 0 0; border-top: 1px solid var(--line); margin-top: 40px; }
.connect-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.connect-card { background: var(--panel); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.connect-card h3 { font-size: 1.1rem; }
.connect-card p { color: var(--ink-2); font-size: 0.92rem; flex: 1; }
.connect-card .btn { align-self: flex-start; margin-top: 8px; }

/* ------------------------------------------------------------- library */
.library-head { display: grid; gap: 8px; margin-bottom: 24px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 0.95rem; white-space: nowrap; transition: color var(--dur) var(--ease-out-3); }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); transform: scaleX(0); transition: transform var(--dur) var(--ease-out-3); }
.tab.is-active { color: var(--ink); }
.tab.is-active::after { transform: scaleX(1); }
@media (hover: hover) { .tab:not(.is-active):hover { color: var(--ink); } }

.toolbar { position: sticky; top: var(--topbar-h); z-index: 10; background: var(--bg); padding: 12px 0 14px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar-row-filters { gap: 10px 14px; }
.toolbar-summary { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 0.86rem; white-space: nowrap; }

.playlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.pl-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; animation: rise-in var(--dur-enter) var(--ease-out-4) both; animation-delay: calc(var(--i, 0) * 30ms); transition: border-color var(--dur) var(--ease-out-3), background-color var(--dur) var(--ease-out-3), transform var(--dur) var(--ease-out-3); }
.pl-card:active { transform: scale(0.98); }
@media (hover: hover) { .pl-card:hover { border-color: var(--gray8); background: var(--panel-2); } .pl-card:hover .pl-audit { background: var(--gray4); border-color: var(--gray7); } }
.pl-card.pl-card-unavailable { cursor: default; opacity: 0.72; }
.pl-card.pl-card-unavailable:active { transform: none; }
@media (hover: hover) {
  .pl-card.pl-card-unavailable:hover { border-color: var(--line); background: var(--panel); }
  .pl-card.pl-card-unavailable:hover .pl-audit { background: transparent; border-color: var(--line); }
}
.pl-art { position: relative; aspect-ratio: 1; border-radius: 2px; overflow: hidden; background: var(--gray3); }
.pl-img { width: 100%; height: 100%; object-fit: cover; }
.pl-badge-unavailable { position: absolute; top: 6px; left: 6px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; background: var(--panel); color: var(--ink-2); border: 1px solid var(--gray7); border-radius: 2px; }
.pl-badge-unavailable .icon { width: 12px; height: 12px; }
.pl-art-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--gray8); }
.pl-art-empty .icon { width: 30px; height: 30px; stroke-width: 1.5; }
.pl-title { font-family: var(--font-body); font-weight: 600; font-size: 0.95rem; letter-spacing: 0; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.pl-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.8rem; color: var(--ink-3); min-width: 0; }
.pl-count { flex: none; }
.pl-owner { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 6px; border-radius: 2px; background: var(--gray3); color: var(--ink-2); }
.pl-owner.is-mine { background: var(--iris3); color: var(--iris11); }
.pl-audit { width: 100%; margin-top: 4px; }
.pl-audit.is-disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.pl-skeleton { pointer-events: none; }
.skel { background: var(--gray4); border-radius: 2px; animation: skel-pulse 1.3s var(--ease-out-3) infinite alternate; }
.skel-line { height: 12px; margin-top: 4px; }
.skel-short { width: 60%; }
@keyframes skel-pulse { from { opacity: 0.5; } to { opacity: 1; } }

.state-box { display: flex; align-items: flex-start; gap: 14px; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.state-box > .icon { width: 22px; height: 22px; color: var(--ink-3); margin-top: 2px; }
.state-box > div { flex: 1; min-width: 0; }
.state-error > .icon { color: var(--red11); }
.state-title { font-weight: 600; }
.state-text { color: var(--ink-2); font-size: 0.92rem; margin-top: 2px; }
.state-actions { display: flex; gap: 8px; flex: none; }
.state-wide { grid-column: 1 / -1; }
.source-card { padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 14px; max-width: 720px; }
.source-card .btn { justify-self: start; }
.url-form { display: flex; gap: 10px; }

/* ------------------------------------------------------------- scan */
.view-scan { display: grid; place-items: center; min-height: calc(100vh - var(--topbar-h)); padding: 24px 0; }
.scan-panel { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: center; width: min(820px, 100%); padding: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.scan-ring { position: relative; width: 220px; height: 220px; }
.scan-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.scan-ring-track { fill: none; stroke: var(--gray5); stroke-width: 6; }
.scan-ring-fill { fill: none; stroke: var(--iris9); stroke-width: 6; stroke-linecap: butt; transition: stroke-dashoffset 380ms var(--ease-out-3); }
.scan-pct { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; align-items: baseline; justify-content: center; font-family: var(--font-body); font-weight: 600; font-size: 3rem; letter-spacing: -0.03em; line-height: 1; }
.scan-pct-unit { font-size: 1.1rem; font-weight: 500; color: var(--ink-3); margin-left: 2px; letter-spacing: 0; }
.scan-body { display: grid; gap: 16px; min-width: 0; }
.scan-target { color: var(--ink-2); font-weight: 500; }
.scan-step { color: var(--ink-2); font-size: 0.95rem; min-height: 1.5em; }
.scan-steps { display: grid; gap: 10px; }
.scan-steps li { display: flex; align-items: flex-start; gap: 12px; color: var(--ink-3); font-size: 0.92rem; transition: color var(--dur) var(--ease-out-3); }
.scan-steps li.is-active { color: var(--ink); }
.scan-steps li.is-done { color: var(--ink-2); }
.step-dot { position: relative; width: 10px; height: 10px; margin-top: 6px; flex: none; border: 1px solid var(--gray7); background: transparent; transition: background-color var(--dur) var(--ease-out-3), border-color var(--dur) var(--ease-out-3); }
.scan-steps li.is-active .step-dot { border-color: var(--iris9); background: var(--iris9); }
.scan-steps li.is-done .step-dot { border-color: var(--green9); background: var(--green9); }
.scan-counter { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-3); margin-left: 4px; }
.scan-actions { margin-top: 4px; display: flex; align-items: center; }
.scan-body .btn { justify-self: start; }

/* ------------------------------------------------------------- results */
.results-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.results-head > div { display: grid; gap: 8px; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.stat { background: var(--panel); padding: 18px 20px; display: grid; gap: 6px; min-width: 0; }
.stat-label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-weight: 600; font-size: 1.9rem; letter-spacing: -0.02em; line-height: 1; }
.results-notice:empty { display: none; }
.notice { display: flex; gap: 14px; align-items: flex-start; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 28px; }
.notice > .icon { width: 22px; height: 22px; margin-top: 2px; color: var(--ink-2); }
.notice-clean { background: var(--green3); border-color: var(--green6); }
.notice-clean > .icon { color: var(--green11); }
.notice-title { font-weight: 600; font-size: 1.05rem; }
.notice-text { color: var(--ink-2); font-size: 0.95rem; margin-top: 4px; max-width: var(--measure); }

.group { margin-bottom: 36px; }
.group-head { display: grid; gap: 6px; margin-bottom: 16px; }
.group-count { display: inline-block; margin-left: 8px; padding: 2px 8px; vertical-align: middle; font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--ink-2); background: var(--gray3); border-radius: 2px; }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.card-slot { animation: rise-in var(--dur-enter) var(--ease-out-4) both; animation-delay: calc(var(--i, 0) * 40ms); }

/* ------------------------------------------------------------- dossier */
.dossier { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; max-width: 100%; box-sizing: border-box; }
.dossier-maga { background: var(--panel); border-color: var(--line); }
.dossier-opposed { background: var(--panel); border-color: var(--line); }
.dossier-unverified { border-style: dashed; }
.dossier-compact { padding: 16px 18px; gap: 10px; }

.dossier-top { display: flex; align-items: center; gap: 14px; }
.dossier-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; background: var(--gray4); border: 1px solid var(--line-soft); }
.dossier-avatar-fallback { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 600; color: var(--ink-2); background: var(--gray4); border: 1px solid var(--line-soft); flex: none; }
.dossier-title-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.dossier-headline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dossier-name-wrap { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dossier-name { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; margin: 0; color: var(--ink); line-height: 1.3; }
.spotify-badge-link { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(29, 185, 84, 0.12); border: 1px solid rgba(29, 185, 84, 0.3); color: var(--spotify); text-decoration: none; transition: all var(--dur-fast) var(--ease-out-3); flex-shrink: 0; }
.spotify-badge-link:hover { background: var(--spotify); border-color: var(--spotify); color: #000000; box-shadow: 0 0 10px rgba(29, 185, 84, 0.45); transform: translateY(-1px); }
.spotify-badge-link:hover .spotify-inline-icon { fill: #000000; }
.spotify-inline-icon { width: 13px; height: 13px; fill: var(--spotify); flex-shrink: 0; display: inline-block; vertical-align: middle; transition: transform var(--dur-fast) var(--ease-out-3); }
.dossier-tag { color: var(--ink-2); font-size: 0.85rem; }
.dossier-listeners { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-2); font-weight: 500; }
.dossier-summary { color: var(--ink); font-size: 0.94rem; line-height: 1.55; max-width: var(--measure); margin: 0; }
.dossier-compact .dossier-summary { font-size: 0.9rem; }

.dossier-note { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); font-size: 0.9rem; padding: 10px 12px; background: var(--gray3); border-radius: 2px; }
.dossier-note .icon { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.dossier-note-opposed { background: rgba(48, 164, 108, 0.1); border: 1px solid rgba(48, 164, 108, 0.25); color: var(--green12); }
.dossier-note-opposed .icon { color: var(--green11); }
.dossier-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dossier-foot { display: flex; justify-content: flex-end; margin-top: 2px; }

.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 8px; border-radius: 2px; font-size: 0.78rem; font-weight: 600; line-height: 1; }
.badge .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.badge-maga { background: var(--red9); color: #fff; }
.badge-opposed { background: var(--green9); color: #06170f; }
.badge-clean { background: var(--gray5); color: var(--ink); }
.badge-unverified { background: var(--gray4); color: var(--ink-2); outline: 1px dashed var(--gray8); outline-offset: -1px; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 8px; border-radius: 2px; font-size: 0.78rem; color: var(--ink-2); background: var(--gray3); border: 1px solid var(--line-soft); white-space: nowrap; }
.chip .icon { width: 12px; height: 12px; }
.chip-muted { color: var(--ink-3); background: transparent; }
.dossier-maga .chip { border-color: var(--line-soft); background: var(--gray3); color: var(--ink-2); }
.dossier-maga .chip-muted { background: transparent; color: var(--ink-3); }
.dossier-opposed .chip { border-color: var(--line-soft); background: var(--gray3); color: var(--ink-2); }
.dossier-opposed .chip-muted { background: transparent; color: var(--ink-3); }
.tag { display: inline-block; padding: 2px 7px; border-radius: 2px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-2); background: var(--gray4); white-space: nowrap; }

.quote { position: relative; margin: 0; padding: 10px 14px 10px 18px; font-size: 0.94rem; line-height: 1.5; color: var(--ink); background: rgba(255, 255, 255, 0.03); }
.quote::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gray8); }
.quote p::before { content: "\201C"; color: var(--ink-3); }
.quote p::after { content: "\201D"; color: var(--ink-3); }
.quote-maga::before { background: var(--red9); }
.quote-opposed::before { background: var(--green9); }
.quote-maga { color: var(--ink); }
.quote-opposed { color: var(--ink); }

.block-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.sources-block { min-width: 0; width: 100%; }
.sources { display: grid; gap: 8px; min-width: 0; width: 100%; }
.sources li { min-width: 0; width: 100%; list-style: none; }
.source { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.025); color: var(--ink); min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; transition: border-color var(--dur) var(--ease-out-3), background-color var(--dur) var(--ease-out-3), transform var(--dur-fast) var(--ease-out-3); }
.source:active { transform: scale(0.99); }
@media (hover: hover) { .source:hover { border-color: var(--gray8); background: rgba(255, 255, 255, 0.05); } .source:hover .source-title { text-decoration: underline; text-underline-offset: 3px; } }
.dossier-maga .source { border-color: var(--line-soft); }
.dossier-opposed .source { border-color: var(--line-soft); }
.source-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.source-title { font-weight: 500; font-size: 0.9rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.source-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--ink-2); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.source-favicon { width: 16px; height: 16px; border-radius: 3px; flex: none; vertical-align: middle; background: #ffffff; padding: 1px; box-sizing: border-box; }
.source-snippet { font-size: 0.82rem; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.source-side { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--ink-2); }
.source-more { color: var(--ink-3); font-size: 0.82rem; padding: 2px 2px; min-width: 0; width: 100%; }
.source-row { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.source-archive-pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-family: var(--font-mono); color: var(--ink-2); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-soft); border-radius: 9999px; padding: 3px 8px; text-decoration: none; transition: all var(--dur-fast) var(--ease-out-3); }
.source-archive-pill:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); border-color: var(--gray8); }
.source-archive-pill .icon { width: 11px; height: 11px; }
.tracks { display: flex; flex-wrap: wrap; gap: 8px; }
.track-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.track { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 9999px; background: var(--gray3); border: 1px solid var(--line-soft); font-size: 0.82rem; color: var(--ink); text-decoration: none; transition: all var(--dur-fast) var(--ease-out-3); font-weight: 500; }
.track-link:hover { background: var(--gray4); border-color: rgba(29, 185, 84, 0.5); color: #ffffff; text-decoration: none; transform: translateY(-1px); }
.track-link:hover .spotify-inline-icon { transform: scale(1.15); }
.album-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 9999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-soft); font-size: 0.76rem; color: var(--ink-2); text-decoration: none; transition: all var(--dur-fast) var(--ease-out-3); }
.album-chip:hover { background: var(--gray4); border-color: rgba(29, 185, 84, 0.4); color: #ffffff; text-decoration: none; transform: translateY(-1px); }
.album-chip:hover .spotify-inline-icon { transform: scale(1.15); }
.album-label { color: var(--ink-3); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.album-name { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dossier-maga .track { background: var(--gray3); border-color: var(--line-soft); color: var(--ink); }
.dossier-opposed .track { background: var(--gray3); border-color: var(--line-soft); color: var(--ink); }


/* ------------------------------------------------------------- v2 + actionbar */
.v2 { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-top: 8px; }
.v2-copy { display: grid; gap: 8px; min-width: 0; }
.v2 .section-title .tag { vertical-align: middle; margin-left: 10px; position: relative; top: -2px; }
.v2 .btn { flex: none; }

.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--bg); border-top: 1px solid var(--line); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); animation: bar-in var(--dur-enter) var(--ease-out-4) both; }
@keyframes bar-in { from { transform: translateY(100%); } to { transform: none; } }
.actionbar-inner { width: min(1120px, 100% - 40px); margin: 0 auto; display: flex; gap: 10px; justify-content: flex-end; }

/* ------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0 36px; background: var(--bg); }
.footer-inner { width: min(1120px, 100% - 40px); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.footer-disclaimer { margin: 0; color: var(--ink-3); font-size: 0.85rem; line-height: 1.5; max-width: 620px; }
.footer-links { display: inline-flex; align-items: center; gap: 10px; font-size: 0.85rem; flex-shrink: 0; }
.footer-link { color: var(--ink-2); text-decoration: none; transition: color var(--dur-fast) var(--ease-out-3); }
.footer-link:hover { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.footer-dot { color: var(--line-strong); user-select: none; font-size: 0.75rem; }

/* ------------------------------------------------------------- legal pages */
.legal-page { min-height: 100vh; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; align-items: center; padding: 24px 16px 48px; }
.legal-header { width: 100%; max-width: 760px; display: flex; align-items: center; justify-content: space-between; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); margin-bottom: 36px; }
.legal-header a.legal-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.2rem; }
.legal-container { width: 100%; max-width: 760px; display: flex; flex-direction: column; gap: 32px; }
.legal-hero { display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line-soft); padding-bottom: 24px; }
.legal-title { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; color: var(--ink); margin: 0; }
.legal-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); margin: 0; }
.legal-body { display: flex; flex-direction: column; gap: 28px; line-height: 1.65; color: var(--ink-2); font-size: 0.95rem; }
.legal-section { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 24px; }
.legal-section h2 { font-size: 1.22rem; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); margin: 0; }
.legal-section p { margin: 0; }
.legal-section ul { margin: 4px 0 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.legal-section li { color: var(--ink-2); }
.legal-section a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.legal-section a:hover { color: #ffffff; }
.legal-callout { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 18px; margin: 4px 0; font-size: 0.9rem; }
.legal-callout strong { color: var(--ink); }
.legal-footer { width: 100%; max-width: 760px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink-3); font-size: 0.8rem; }
.legal-footer-links { display: flex; align-items: center; gap: 10px; }
.legal-footer-link { color: var(--ink-2); text-decoration: none; }
.legal-footer-link:hover { color: #ffffff; text-decoration: underline; }

/* ------------------------------------------------------------- dialogs */
.dialog { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); width: min(720px, calc(100vw - 32px)); max-height: min(88vh, 920px); margin: auto; }
.dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.dialog[open] { animation: dialog-in 240ms var(--ease-out-4) both; }
.dialog-inner { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; max-height: min(88vh, 920px); }
.dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.dialog-title { font-weight: 600; font-size: 0.95rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-body { padding: 20px; overflow-y: auto; }
.dialog-body .dossier { border: 0; padding: 0; background: transparent; }
.dialog-body .dossier-maga .chip, .dialog-body .dossier-maga .track { background: var(--gray3); }
.dialog-body .section-sub { margin-bottom: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.purge-list { display: grid; gap: 8px; }
.purge-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--gray3); }
.purge-item .marker { margin-top: 7px; }
.purge-main { display: grid; gap: 2px; min-width: 0; }
.purge-name-row { display: inline-flex; align-items: center; gap: 6px; }
.purge-track-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; font-weight: 500; transition: color var(--dur-fast) var(--ease-out-3); }
.purge-track-link:hover { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.purge-track-link:hover .spotify-inline-icon { transform: scale(1.15); }
.purge-name { font-weight: 500; }
.purge-meta { font-size: 0.85rem; color: var(--ink-2); }
.purge-artist-link { color: var(--ink-2); text-decoration: none; transition: color var(--dur-fast) var(--ease-out-3); }
.purge-artist-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.purge-album-link { color: var(--ink-3); text-decoration: none; transition: color var(--dur-fast) var(--ease-out-3); }
.purge-album-link:hover { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.loc-presets-section { margin-bottom: 18px; }
.loc-group-title { display: block; font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); margin-bottom: 8px; }
.loc-presets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.loc-preset-pill { font-family: var(--font-sans); font-size: 0.82rem; font-weight: 500; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 11px; text-align: left; cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out-3), background-color var(--dur-fast) var(--ease-out-3); display: flex; align-items: center; gap: 6px; }
@media (hover: hover) { .loc-preset-pill:hover { border-color: var(--gray8); background: var(--gray4); color: var(--ink); } }
.loc-preset-primary { border-color: var(--gray7); background: var(--gray3); font-weight: 600; }
.loc-custom-section { padding-top: 14px; border-top: 1px solid var(--line-soft); }
.loc-custom-row { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------- toasts */
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
body.has-actionbar .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; background: var(--gray3); border: 1px solid var(--gray7); border-radius: var(--radius); color: var(--ink); font-size: 0.92rem; animation: toast-in 240ms var(--ease-out-4) both; }
.toast-error { border-color: var(--red8); }
.toast-warn { border-color: var(--amber9); }
.toast-text { flex: 1; }
.toast-action { flex: none; }
.toast.is-leaving { animation: toast-out 180ms var(--ease-in-3) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero-title { max-width: 18ch; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats .stat:nth-child(-n+2) { grid-column: span 1; }
  .connect-grid { grid-template-columns: 1fr; }
  .scan-panel { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 28px; padding: 32px 24px; }
  .scan-body { justify-items: center; }
  .scan-steps li { text-align: left; }
  .scan-body .btn { justify-self: center; }
}

@media (max-width: 720px) {
  .main, .topbar-inner, .ticker-head, .ticker-viewport, .actionbar-inner, .footer-inner { width: min(1120px, 100% - 32px); }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .view { padding: 28px 0 56px; }
  .topbar-search { display: none !important; }
  .session-text { display: none; }
  .brand-name { font-size: 1.05rem; }
  .hero-lede { font-size: 1rem; }
  .hero-actions .btn { flex: 1 1 100%; }
  .ticker-head { flex-direction: column; align-items: flex-start; }
  .ticker-card { width: 262px; }
  .lookup-form { flex-direction: column; }
  .lookup-form .btn { width: 100%; min-height: 48px; }
  .toolbar { position: static; }
  .toolbar-summary { margin-left: 0; width: 100%; justify-content: space-between; }
  .seg { flex-wrap: wrap; }
  .playlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .results-head { flex-direction: column; }
  .results-head .btn { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .stat-label { white-space: normal; }
  .dossier { padding: 18px 16px; }
  .dossier-name { font-size: var(--t1); }
  .source { flex-direction: column; gap: 8px; }
  .source-side { margin-top: 0; }
  .v2 { flex-direction: column; align-items: stretch; }
  .url-form { flex-direction: column; }
  .actionbar-inner { justify-content: stretch; }
  .actionbar-inner .btn { flex: 1; min-height: 48px; }
  .scan-ring { width: 180px; height: 180px; }
  .scan-pct { font-size: 2.5rem; }
  .scan-actions { justify-content: center; width: 100%; }
  .dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: 90vh; max-height: 90dvh; }
  .dialog-inner { max-height: 90vh; max-height: 90dvh; }
  .dialog-body { padding: 16px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .field-clear { min-width: 44px; min-height: 44px; }
  .loc-preset-pill { min-height: 44px; }
}

@media (pointer: coarse), (max-width: 960px) {
  /* Enforce 16px to prevent iOS Safari & mobile browsers auto-zoom on input focus */
  input[type="text"], input[type="search"], input[type="url"], select {
    font-size: 16px !important;
  }
}

@media (max-width: 420px) {
  .playlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-card { padding: 8px; }
  .pl-audit { font-size: 0.82rem; padding: 0 8px; }
  .pills .pill { flex: 1 1 auto; justify-content: center; }
  .hero-proof li { font-size: 0.88rem; }
}

/* ------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 120ms !important; }
  .view.is-entering, .pl-card, .card-slot, .actionbar, .dialog[open], .toast { animation: none !important; }
  .view.is-entering { opacity: 1; }
  .ticker-track { animation: none !important; width: auto; }
  .ticker-viewport { overflow-x: auto; -webkit-mask-image: none; mask-image: none; padding-bottom: 6px; }
  .ticker-track > .ticker-card:nth-child(n+13) { display: none; }
  .spinner { animation: spin 1.2s linear infinite !important; }
  .skel { animation: none !important; opacity: 0.7; }
  .scan-ring-fill { transition-duration: 120ms !important; }
}
