:root {
  color-scheme: dark;
  --bg: #090c12;
  --panel: #141925;
  --panel-2: #10151f;
  --panel-border: #293244;
  --panel-border-soft: rgba(149, 165, 194, 0.16);
  --text: #f4f6fb;
  --text-soft: #cbd2df;
  --muted: #8f99aa;
  --accent: #92a9ff;
  --accent-2: #7bd9c1;
  --accent-soft: rgba(146, 169, 255, 0.11);
  --ok: #55d99a;
  --warn: #efbd5d;
  --err: #ff7f84;
  --section-cap: 20rem;
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.23);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #0d121b 0%, #0a0e15 42%, #080b10 100%);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Quiet tonal canvas: no coloured hotspots, just a uniform low-contrast grain. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.72'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: soft-light;
}

button, input, select { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid rgba(146, 169, 255, 0.46);
  outline-offset: 3px;
}

header {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) clamp(1rem, 4vw, 2rem) 1.2rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
}

#health-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  min-height: 28px;
  border: 1px solid var(--panel-border-soft);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

#health-pill .health-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(239, 189, 93, 0.09);
}

#health-pill[data-state="ready"] {
  border-color: rgba(85, 217, 154, 0.18);
  color: var(--text-soft);
}

#health-pill[data-state="ready"] .health-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(85, 217, 154, 0.09);
}

#health-pill[data-state="error"] {
  border-color: rgba(255, 127, 132, 0.2);
  color: var(--err);
}

#health-pill[data-state="error"] .health-dot {
  background: var(--err);
  box-shadow: 0 0 0 3px rgba(255, 127, 132, 0.08);
}

#health-pill[data-state="degraded"] {
  border-color: rgba(239, 189, 93, 0.2);
  color: var(--warn);
}

#health-pill[data-state="degraded"] .health-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(239, 189, 93, 0.08);
}

header h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2rem, 5.5vw, 3.9rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

header h1 span {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

header p {
  max-width: 720px;
  margin: 1rem 0 0;
  color: var(--text-soft);
  font-size: clamp(0.94rem, 2vw, 1.05rem);
  line-height: 1.7;
}

main {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 4rem;
}

form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  margin: 0 0 0.8rem;
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  background: linear-gradient(145deg, rgba(24, 30, 43, 0.96), rgba(15, 20, 30, 0.96));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

form::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(146, 169, 255, 0.65), transparent);
}

input[type="text"] {
  min-height: 46px;
  border: 1px solid var(--panel-border);
  border-radius: 11px;
  padding: 0.68rem 0.78rem;
  background: rgba(7, 10, 15, 0.78);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input[type="text"] {
  flex: 1 1 210px;
  min-width: 170px;
}

input[type="text"]:hover { border-color: #3a4660; }

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(8, 11, 17, 0.94);
  box-shadow: 0 0 0 4px rgba(146, 169, 255, 0.11);
}

input::placeholder { color: #707b8d; }

button {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  padding: 0.66rem 1.05rem;
  background: linear-gradient(130deg, var(--accent), #8fcfc5);
  color: #0b0e14;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(124, 156, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 11px 28px rgba(124, 156, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.56; cursor: wait; }

#status {
  min-height: 1.4em;
  margin: 0.15rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.84rem;
}

#status.err {
  width: fit-content;
  border: 1px solid rgba(255, 127, 132, 0.22);
  border-radius: 10px;
  padding: 0.48rem 0.68rem;
  background: rgba(255, 127, 132, 0.07);
  color: var(--err);
}

#examples {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

#examples button {
  min-height: 30px;
  margin: 0;
  border: 1px solid var(--panel-border-soft);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 650;
  box-shadow: none;
}

#examples button:hover {
  border-color: rgba(146, 169, 255, 0.4);
  background: var(--accent-soft);
  color: var(--accent);
}

#result { min-height: 8rem; }

.card {
  position: relative;
  margin-bottom: 0.9rem;
  border: 1px solid var(--panel-border-soft);
  border-radius: var(--radius-md);
  padding: 1rem 1.05rem;
  background: linear-gradient(145deg, rgba(22, 27, 38, 0.93), rgba(15, 19, 27, 0.94));
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

/* Result toolbar — above the summary card. Freshness chip left, action buttons right; the
   spacer pushes the buttons flush right regardless of how many render. */
.result-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
}
.result-toolbar .freshness {
  border: 1px solid var(--panel-border-soft);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  color: var(--muted);
  font-size: 0.72rem;
}
.result-toolbar .freshness b { color: var(--text-soft); font-weight: 650; }
.result-toolbar .spacer { flex: 1; }

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.85rem;
  background: var(--panel);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: none; /* reset the global button's gradient/shadow */
}
.toolbar-btn:hover:not(:disabled) {
  transform: none;
  filter: none;
  box-shadow: none;
  border-color: rgba(146, 169, 255, 0.38);
  color: var(--text);
}
.toolbar-btn.quiet { border-style: dashed; color: var(--muted); }

.summary {
  display: flex;
  align-items: flex-start;
  gap: clamp(1rem, 3vw, 1.4rem);
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1rem, 3vw, 1.35rem);
  border-color: rgba(146, 169, 255, 0.22);
}

.summary .backdrop {
  position: absolute;
  inset: -8%;
  z-index: -2;
  background-position: center;
  background-size: cover;
  opacity: 0.24;
  filter: blur(16px) saturate(1.1);
  transform: scale(1.08);
}

.summary .backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, rgba(14, 18, 26, 0.97) 10%, rgba(14, 18, 26, 0.80) 58%, rgba(14, 18, 26, 0.94));
}

.summary::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(110deg, rgba(146, 169, 255, 0.055), transparent 48%);
}

.summary img {
  width: clamp(104px, 16vw, 148px);
  height: clamp(104px, 16vw, 148px);
  object-fit: cover;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: #0b0e14;
  box-shadow: 0 15px 36px rgba(0, 0, 0, 0.36);
}

.summary .body {
  min-width: 0;
  flex: 1;
  padding-top: 0.08rem;
}

.summary .titlerow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.summary h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-warn {
  border: 1px solid rgba(239, 189, 93, 0.35);
  background: rgba(239, 189, 93, 0.1);
  color: var(--warn);
}

.identity-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(239, 189, 93, 0.35);
  border-radius: 12px;
  background: rgba(239, 189, 93, 0.08);
  color: var(--warn);
  font-size: 0.86rem;
}

.identity-banner-text {
  flex: 1;
}

.identity-banner button {
  flex: none;
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  background: var(--warn);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

.sections.unverified .card.section {
  opacity: 0.6;
}

/* The artwork is as unverified as the sections are — it is the fuzzy match's face, and left at full
   strength it reads as confirmation directly above a banner saying nothing here is confirmed. The
   backdrop carries its own 0.24 opacity, so it is dimmed by filter instead of overriding that. */
.summary.unverified img,
.gallery.unverified img {
  opacity: 0.6;
}

.summary.unverified .backdrop {
  filter: blur(16px) saturate(1.1) brightness(0.6);
}

.section-chip {
  font-size: 0.6rem;
  padding: 0.12rem 0.45rem;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: normal;
}

.summary .subtitle {
  width: fit-content;
  margin: 0.28rem 0 0.65rem;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 650;
}

.summary .subtitle.enrich-row {
  cursor: pointer;
  border-bottom: 1px dotted rgba(146, 169, 255, 0.65);
}

.summary .subtitle.enrich-row:hover {
  color: var(--text);
  border-color: var(--text);
}

.summary .text {
  max-width: 760px;
  max-height: 5.4em;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.62;
  white-space: pre-line;
}

.summary .text.expanded { max-height: none; }

.summary .source {
  margin-top: 0.48rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 0.68rem;
  padding: 0.9rem;
}

.gallery figure { min-width: 0; margin: 0; text-align: center; }

.gallery img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  display: block;
  border: 1px solid var(--panel-border-soft);
  border-radius: 10px;
  background: #0b0e14;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.gallery img:hover {
  transform: translateY(-2px);
  border-color: rgba(146, 169, 255, 0.38);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.gallery figcaption {
  overflow: hidden;
  margin-top: 0.34rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 0.9rem;
  align-items: stretch;
}

.section {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}


.section:hover {
  border-color: rgba(146, 169, 255, 0.25);
  box-shadow: 0 15px 42px rgba(0, 0, 0, 0.22);
}

.section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.58rem;
  color: #aab3c2;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.section h3 .count {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  min-height: 1.28rem;
  border: 1px solid var(--panel-border-soft);
  border-radius: 999px;
  padding: 0.03rem 0.38rem;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

.section ul {
  list-style: none;
  margin: 0;
  /* The clamp trims each card's list to whole items, so lists in one row cap at different
     heights; the auto margin absorbs that remainder above the footer, and every card's
     "Show all" and credit line sit on one baseline whatever its list came to. */
  margin-bottom: auto;
  padding: 0;
  flex: 1;
  overflow: hidden;
  max-height: var(--section-cap);
}

.section ul.expanded { max-height: none; }

.section li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 42px;
  padding: 0.43rem 0.1rem;
  border-top: 1px solid var(--panel-border-soft);
  font-size: 0.83rem;
  border-radius: 7px;
  transition: background 140ms ease;
}

.section li:first-child { border-top: none; }

.section li img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  background: #0b0e14;
}

.section li .primary {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.section li .primary a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}

.section li .primary a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.section li .primary .enrich-link { border-bottom: 1px dotted var(--muted); }
.section li.enrich-row { cursor: pointer; }
.section li.enrich-row:hover { background: var(--accent-soft); }
.section li.enrich-row:hover .enrich-link { color: var(--accent); border-color: var(--accent); }

.section li .secondary {
  color: var(--muted);
  font-size: 0.77rem;
}

.section li .meta {
  max-width: 42%;
  overflow: hidden;
  border: 1px solid var(--panel-border-soft);
  border-radius: 6px;
  padding: 0.13rem 0.42rem;
  background: rgba(6, 9, 14, 0.65);
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: none;
}

.show-more {
  width: 100%;
  min-height: 32px;
  margin: 0.2rem 0 0;
  padding: 0.42rem 0 0;
  background: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
  text-align: left;
  box-shadow: none;
}

.show-more:hover:not(:disabled) {
  transform: none;
  filter: none;
  color: var(--text);
  box-shadow: none;
}

.preview-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-height: 0;
  flex: none;
  border: 1px solid var(--panel-border-soft);
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 0.65rem;
  line-height: 1;
  box-shadow: none;
}

.preview-btn:hover:not(:disabled) {
  transform: none;
  border-color: transparent;
  background: var(--accent);
  color: #0b0e14;
  box-shadow: none;
}

.preview-btn.playing { border-color: transparent; background: var(--ok); color: #0b0e14; }
.preview-btn.loading { opacity: 0.65; }
.preview-btn.error { color: var(--err); }

.preview-btn .spinner {
  width: 11px;
  height: 11px;
  margin: 0;
  border-width: 1.5px;
  border-color: rgba(230, 232, 236, 0.35);
  border-top-color: var(--text);
}

.summary .preview-btn { width: 32px; height: 32px; font-size: 0.8rem; }
.summary .preview-btn .spinner { width: 14px; height: 14px; }

details.meta-panel { margin-top: 0.05rem; }

details.meta-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  outline: none;
  user-select: none;
}

details.meta-panel summary:hover { color: var(--text-soft); }

details.meta-panel[open] summary {
  margin-bottom: 0.65rem;
  color: var(--text-soft);
}

dl.identifiers {
  margin: 0 0 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  font-size: 0.77rem;
}

dl.identifiers > div { display: flex; align-items: baseline; gap: 0.4rem; }

dl.identifiers dt {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
}

dl.identifiers dd { margin: 0; }

dl.identifiers code {
  color: var(--text-soft);
  user-select: all;
  word-break: break-all;
}

table.providers {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.2rem;
  font-size: 0.77rem;
}

table.providers th,
table.providers td {
  padding: 0.48rem 0.5rem;
  border-top: 1px solid var(--panel-border-soft);
  text-align: left;
  vertical-align: top;
}

table.providers th {
  color: var(--muted);
  font-weight: 700;
}

table.providers td { color: var(--text-soft); }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.42rem;
  border-radius: 50%;
}

.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(85, 217, 154, 0.08); }
.dot.ok_stale { background: var(--warn); box-shadow: 0 0 0 3px rgba(239, 189, 93, 0.08); }
.dot.not_found { background: var(--muted); }
.dot.rate_limited { background: var(--warn); }
.dot.error { background: var(--err); box-shadow: 0 0 0 3px rgba(255, 127, 132, 0.07); }

.stale-badge {
  display: inline-block;
  border: 1px solid rgba(239, 189, 93, 0.35);
  border-radius: 6px;
  padding: 0.1rem 0.42rem;
  margin-left: 0.3rem;
  background: rgba(239, 189, 93, 0.1);
  color: var(--warn);
  font-size: 0.68rem;
}

.stale-count { color: var(--warn); }

.cache-fieldset { display: flex; flex-direction: column; gap: 0.6rem; border: none; margin: 0; padding: 0; }
.cache-fieldset legend {
  margin: 0.9rem 0 0;
  padding: 0;
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cache-fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-soft);
  font-size: 0.85rem;
  cursor: pointer;
}
/* Only <button> and text inputs pick up the global chrome above, so this override is needed. */
.cache-fieldset input[type="radio"] { appearance: auto; }
.cache-fieldset code { color: var(--muted); font-size: 0.7rem; }

.summary img,
.gallery img { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  cursor: zoom-out;
  background: rgba(3, 5, 8, 0.9);
  backdrop-filter: blur(10px);
}

.lightbox[hidden] { display: none; }

.lightbox img {
  width: auto;
  height: auto;
  max-width: min(92vw, 1200px);
  max-height: 90vh;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
}

#empty {
  margin-top: 0.9rem;
  border: 1px dashed var(--panel-border);
  border-radius: var(--radius-md);
  padding: clamp(2.25rem, 7vw, 4rem) 1rem;
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.loading-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.72rem;
  margin-top: 0.9rem;
  border: 1px solid var(--panel-border-soft);
  border-radius: var(--radius-md);
  padding: 3rem 1rem;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.02), rgba(146, 169, 255, 0.045), rgba(255, 255, 255, 0.02));
  color: var(--muted);
  font-size: 0.9rem;
}

.spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid var(--panel-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

button .spinner {
  margin-right: 0.42rem;
  border-color: rgba(11, 14, 20, 0.32);
  border-top-color: #0b0e14;
}

#submit { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }

/* The kind tabs sit on the form card's shoulder: no bottom border, so the active one reads as the
   same surface as the card below it. */
.kind-tabs { display: flex; gap: 0.1rem; margin: 1.25rem 0 0; padding: 0 0.4rem; }

.kind-tabs button {
  min-height: 38px;
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: 11px 11px 0 0;
  padding: 0.4rem 1rem;
  background: rgba(15, 20, 30, 0.6);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  box-shadow: none;
}

.kind-tabs button:hover:not(:disabled) { transform: none; filter: none; box-shadow: none; color: var(--text-soft); }

.kind-tabs button.active {
  background: linear-gradient(145deg, rgba(24, 30, 43, 0.96), rgba(15, 20, 30, 0.96));
  color: var(--accent);
  border-color: var(--panel-border);
}

/* The primary field carries its own search action, so no kind ever needs a second action row. */
.smartbox { position: relative; flex: 1 1 230px; display: flex; align-items: center; min-width: 0; }
.smartbox input[type="text"] { width: 100%; padding-right: 6.4rem; }

.smartbox .inline-find {
  position: absolute;
  right: 0.45rem;
  min-height: 32px;
  border: 1px solid var(--panel-border-soft);
  border-radius: 8px;
  padding: 0.2rem 0.7rem;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  box-shadow: none;
}

.smartbox .inline-find:hover:not(:disabled) { transform: none; filter: none; box-shadow: none; color: var(--accent); border-color: rgba(146, 169, 255, 0.4); }

.smartbox .inline-find:focus-visible {
  outline: none;
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(146, 169, 255, 0.22);
}

.smartbox .inline-find[hidden] { display: none; }
.smartbox.no-find input[type="text"] { padding-right: 0.78rem; }

/* A sibling of the form, not a child: the form clips its overflow. */
.search-results {
  margin: 0 0 0.8rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-results ul { list-style: none; margin: 0; padding: 0.3rem; }
.search-results h4 { margin: 0.5rem 0.9rem 0.1rem; color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }

/* Rows are real buttons, so they are reachable and announced like the actions they are. */
.search-results li button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.search-results li button:hover { transform: none; filter: none; box-shadow: none; background: var(--accent-soft); }
.search-results li button:focus-visible { outline: none; background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(146, 169, 255, 0.35) inset; }
.search-results img { width: 34px; height: 34px; border-radius: 8px; background: #0b0e14; flex: none; object-fit: cover; }
.search-results .primary { flex: 1; min-width: 0; }
.search-results .secondary { color: var(--muted); font-size: 0.77rem; }

.search-results .score {
  flex: none;
  border: 1px solid var(--panel-border-soft);
  border-radius: 6px;
  padding: 0.13rem 0.42rem;
  color: var(--muted);
  font-size: 0.7rem;
}

footer {
  padding: 1.9rem 0 0;
  color: var(--muted);
  font-size: 0.73rem;
  text-align: center;
}

footer code {
  border: 1px solid var(--panel-border-soft);
  border-radius: 5px;
  padding: 0.08rem 0.32rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
}

footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(146, 169, 255, 0.55);
}

footer a:hover { color: var(--text); border-color: var(--text); }

/* Per-card credits: owed beside the data, so quiet enough to sit under any card without competing
   with it — muted, one line, wrapping rather than clipping. */
.credit-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.36rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.5;
}

/* The card's own credits sit under the bio and its credit, so each names what it covers. */
.credit-label {
  color: var(--text-soft);
  opacity: 0.7;
}

.credit-line a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted rgba(146, 169, 255, 0.4);
}

.credit-line a:hover { color: var(--text-soft); border-color: var(--text-soft); }

/* The caption itself clips to one line; a credit is owed in full, so it wraps instead. */
.gallery figcaption .credit-line {
  justify-content: center;
  margin-top: 0.1rem;
  font-size: 0.62rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.summary .source .credit-line { margin: 0; font-size: 0.7rem; }

/* Attribution credits: owed content, so no card chrome — a hairline separates it from the footer. */
.credits-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-border-soft);
  color: var(--muted);
  text-align: left;
  line-height: 1.7;
}

.credits-footer[hidden] { display: none; }

.credits-title {
  color: var(--text-soft);
  cursor: help;
}

/* Every notice carries its own separator, so the trailing one leads into the panel link. */
.credits-footer .credit::after {
  content: " · ";
  color: var(--muted);
}

.credits-link {
  min-height: 0;
  border: 0;
  border-bottom: 1px dotted rgba(146, 169, 255, 0.55);
  border-radius: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-size: inherit;
  font-weight: inherit;
}

.credits-link:hover:not(:disabled) {
  transform: none;
  filter: none;
  box-shadow: none;
  color: var(--text);
  border-color: var(--text);
}

/* The gear and the dialog's close button opt out of the global gradient button entirely. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}

.gear-btn,
.dialog-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 0;
  flex: none;
  border: 1px solid var(--panel-border-soft);
  border-radius: 999px;
  padding: 0;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.gear-btn:hover:not(:disabled),
.dialog-close:hover:not(:disabled) {
  transform: none;
  filter: none;
  box-shadow: none;
  color: var(--text);
  border-color: rgba(146, 169, 255, 0.4);
}

#settings-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-height: 85vh;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem 1.3rem;
  background: var(--panel);
  color: var(--text-soft);
  font-size: 0.82rem;
  overflow: auto;
}

#settings-dialog::backdrop { background: rgba(6, 9, 15, 0.66); }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.dialog-section + .dialog-section { margin-top: 1.2rem; }

.dialog-section h3 {
  margin: 0.9rem 0 0;
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#provider-panel { overflow-x: auto; }

.provider-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.78rem;
}

.provider-table caption {
  padding-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: left;
}

.provider-table th {
  padding: 0.34rem 0.5rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.provider-table td {
  padding: 0.34rem 0.5rem;
  border-top: 1px solid var(--panel-border-soft);
  color: var(--text-soft);
  vertical-align: top;
}

.provider-table .pdot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  background: var(--ok);
}

.provider-table .pdot.off { background: var(--err); }
.provider-table .secondary { color: var(--muted); font-size: 0.68rem; }
.provider-table .keyreq { color: var(--warn); }

@keyframes spin { to { transform: rotate(360deg); } }

/* Genre chips under the summary title; teal outline + star marks a curated-vocabulary genre. */
.genre-chips { display: flex; flex-wrap: wrap; gap: 0.38rem; margin: 0.35rem 0 0.55rem; }
.genre-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border: 1px solid var(--panel-border-soft);
  border-radius: 999px;
  padding: 0.16rem 0.62rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.74rem;
  cursor: default;
}
.genre-chip.curated {
  border-color: rgba(123, 217, 193, 0.45);
  background: rgba(123, 217, 193, 0.09);
  color: var(--accent-2);
}
.genre-chip.curated::before { content: '\2726'; font-size: 0.66rem; }
.genre-legend { margin: 0.1rem 0 0.4rem; color: var(--muted); font-size: 0.68rem; }
.genre-legend span[aria-hidden] { color: var(--accent-2); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  header { padding-top: 2.2rem; }
  form { align-items: stretch; }
  input[type="text"], #submit, .smartbox { width: 100%; }
  input[type="text"] { flex-basis: 100%; }
  .kind-tabs { flex-wrap: wrap; }
  .kind-tabs button { flex: 1 1 auto; }
  #submit { margin-top: 0.05rem; }
  .summary { flex-direction: column; }
  .summary img,
  .summary .skeleton-img { width: 112px; height: 112px; }
  table.providers { min-width: 660px; }
  details.meta-panel { overflow-x: auto; }
}

@media (max-width: 480px) {
  header, main { padding-left: 0.85rem; padding-right: 0.85rem; }
  .header-top { align-items: flex-start; }
  .eyebrow { max-width: 12rem; font-size: 0.64rem; }
  #health-pill { min-height: 26px; padding: 0.24rem 0.55rem; font-size: 0.68rem; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section li .meta { max-width: 34%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Progressive streaming: placeholders for data that has not settled yet ---
   Every rule here is reachable only while a stream is open. A finished page — streamed or not —
   carries no pending card, no pending slot and no waiting row, so none of this can be left on
   screen claiming something is still coming. */

.skeleton {
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(100deg, var(--panel-border-soft) 30%, rgba(149, 165, 194, 0.3) 50%, var(--panel-border-soft) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer { to { background-position: -220% 0; } }

/* The exact box `.summary img` occupies, so the artwork landing does not resize the card. */
.summary .skeleton-img {
  width: clamp(104px, 16vw, 148px);
  height: clamp(104px, 16vw, 148px);
  flex: none;
  border-radius: 13px;
}
.skeleton-lines { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.55rem; }
.skeleton-lines .skeleton { height: 0.72rem; }
.skeleton-lines .skeleton:last-child { width: 62%; }
.skeleton-chip { display: inline-block; width: 5.5rem; height: 1.35rem; border-radius: 999px; }

.card.section.pending h3 { color: var(--muted); }
.card.section.pending ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.card.section.pending li { padding: 0; border: none; }
.card.section.pending .skeleton { height: 1.1rem; }
.card.section.pending li:nth-child(2) .skeleton { width: 84%; }
.card.section.pending li:nth-child(3) .skeleton { width: 66%; }

.badge-pending { background: var(--accent-soft); color: var(--accent); }
.badge-pending .spinner { width: 11px; height: 11px; margin-right: 0.35rem; }
.freshness .spinner { width: 11px; height: 11px; margin-right: 0.4rem; vertical-align: -1px; }

.dot.waiting { background: transparent; border: 1px solid var(--muted); }
table.providers tr.waiting td { color: var(--muted); font-style: italic; }

.fieldset-note { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.5; }
.cache-fieldset input[type="checkbox"] { appearance: auto; }
