/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  --bg:         #0d0a1a;
  --surface:    #15121f;
  --surface2:   #1e1a2e;
  --border:     #2a253a;
  --text:       #e4e1ef;
  --muted:      #6b647f;
  --accent:     #d946ef;
  --accent-dim: #a21caf;
  --radius:     12px;
  --font:       "DM Sans", system-ui, sans-serif;
  --font-mono:  "JetBrains Mono", monospace;
  --content-max: 900px;
}

@media (min-width: 1600px) {
  :root {
    --content-max: min(1400px, calc(100vw - 3rem));
  }
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}

body.is-api-loading { cursor: progress; }

/* ── App shell — 900 px default, wider on very large screens ──── */
.app {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

/* ── Header ────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.logo-accent { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.username {
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  font: inherit;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.14s, color 0.14s, opacity 0.14s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dim); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
}
.btn-ghost:hover { color: var(--text); }

/* ── Hero ──────────────────────────────────────────────────────── */
/* Collapse uses grid-row transition — no height calculation needed */
.hero {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.42s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.32s ease;
  opacity: 1;
}

.hero--collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.hero-collapse-wrap {
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 2.5rem 0 2rem;
}

.hero-heading {
  margin: 0 0 0.6rem;
  font-size: clamp(3rem, 9vw, 5.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #fff;
}

.hero-accent {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 36ch;
}

/* Background bars — absolutely positioned, full width, behind content */
.hero-visual {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-bars {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-now-playing {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  max-width: min(380px, 48%);
  z-index: 1;
  pointer-events: auto;
}

.hero-now-playing-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "art label"
    "art meta";
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.2rem;
  padding: 0.9rem 1.1rem;
  background: color-mix(in srgb, var(--surface2) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-now-playing-label {
  grid-area: label;
  align-self: end;
}

.hero-now-playing-art-link {
  grid-area: art;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: 8px;
  transition: opacity 0.15s;
}

.hero-now-playing-art-link:hover {
  opacity: 0.85;
}

.hero-now-playing-art-link[aria-disabled="true"] {
  pointer-events: none;
  cursor: default;
}

.hero-now-playing-art {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface);
}

.hero-now-playing-art--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--accent);
}

.hero-now-playing-art--fallback[hidden] {
  display: none;
}

.hero-now-playing-meta {
  grid-area: meta;
  align-self: start;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hero-now-playing-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-now-playing-label::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  animation: nowPlayingPulse 1.4s ease-in-out infinite;
}

@keyframes nowPlayingPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.hero-now-playing-track {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  transition: color 0.15s;
}

.hero-now-playing-track:hover {
  color: var(--accent);
}

.hero-now-playing-track[aria-disabled="true"] {
  pointer-events: none;
  cursor: default;
}

.hero-now-playing-artist {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  .hero-visual {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "heading nowplaying"
      "sub sub"
      "welcome welcome";
    align-items: start;
    gap: 0 0.65rem;
    padding: 2rem 0 1.5rem;
  }

  .hero-heading {
    grid-area: heading;
    margin-bottom: 0.6rem;
  }

  .hero-sub {
    grid-area: sub;
  }

  .hero-welcome {
    grid-area: welcome;
  }

  .hero-now-playing {
    grid-area: nowplaying;
    position: relative;
    align-self: start;
    margin-top: 0.4rem;
    max-width: none;
    transform: none;
    top: auto;
    right: auto;
    bottom: auto;
    z-index: 3;
  }

  .hero-now-playing-inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "art";
    justify-items: end;
    row-gap: 0.25rem;
    padding: 0;
    background: none;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .hero-now-playing-label {
    align-self: auto;
  }

  .hero-now-playing-meta {
    display: none;
  }

  .hero-now-playing-art {
    width: 52px;
    height: 52px;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
  }

  .hero-now-playing-art--fallback {
    font-size: 1.25rem;
  }

  .hero-now-playing--expanded .hero-now-playing-inner {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "label label"
      "art meta";
    justify-items: stretch;
    align-items: center;
    column-gap: 0.6rem;
    row-gap: 0.35rem;
    padding: 0.55rem 0.65rem;
    background: color-mix(in srgb, var(--surface2) 88%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    width: min(280px, calc(100vw - 2.5rem));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    cursor: default;
  }

  .hero-now-playing--expanded .hero-now-playing-meta {
    display: flex;
  }

  .hero-now-playing--expanded .hero-now-playing-art {
    box-shadow: none;
  }

  .hero-now-playing-label {
    font-size: 0.6rem;
  }

  .hero-now-playing-track {
    font-size: 0.85rem;
  }

  .hero-now-playing-artist {
    font-size: 0.75rem;
  }
}

/* Username form inside hero */
.hero-welcome { margin-top: 0; }

.username-form {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
}

.username-form .input { flex: 1; min-width: 0; }

/* ── Results Panel ─────────────────────────────────────────────── */
.results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
  animation: panelSlideIn 0.28s ease;
}

@keyframes panelSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.results-panel[hidden] { display: none; }

.results-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.results-panel-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.results-close {
  font-size: 0.85rem;
  color: var(--muted);
}

.results-panel-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

/* ── Tool card header (icon + title + description) ─────────────── */
.tool-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.tool-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.tool-icon--tracks  { background: rgba(217, 70, 239, 0.18); color: var(--accent); }
.tool-icon--artists { background: rgba(250, 204, 21,  0.15); color: #facc15; }
.tool-icon--bubble  { background: rgba(56,  189, 248, 0.15); color: #38bdf8; }
.tool-icon--listen  { background: rgba(52,  211, 153, 0.15); color: #34d399; }
.tool-icon--export  { background: rgba(251, 146, 60,  0.15); color: #fb923c; }
.tool-icon--api     { background: rgba(148, 163, 184, 0.12); color: #94a3b8; font-family: var(--font-mono); font-size: 10px; }

.tool-card-header > div { flex: 1; min-width: 0; }

.tool-card h3,
.card h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 600;
}

.tool-card p,
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ── Form elements ─────────────────────────────────────────────── */
.input,
.input-narrow,
.input-select {
  font: inherit;
  font-size: 0.88rem;
  padding: 0.48rem 0.6rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  outline: none;
  transition: border-color 0.14s;
}

.input:focus,
.input-narrow:focus,
.input-select:focus {
  border-color: var(--accent);
}

.input-narrow  { width: 5.5rem; }
.input-select  { min-width: 130px; }

select.input,
select.input-select {
  padding-right: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%236b647f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 12px;
  appearance: none;
  -webkit-appearance: none;
}

/* ── Tool actions row ──────────────────────────────────────────── */
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* ── Artist source (top-tracks card) ───────────────────────────── */
.artist-source {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

/* ── Row 1: two equal columns ──────────────────────────────────── */
.tool-row-2 {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 620px) {
  .tool-row-2 { grid-template-columns: 1fr 1fr; }
  .tool-row-2 .card { margin-bottom: 0; }
}

/* ── Bubble chart card ─────────────────────────────────────────── */
.bubble-card {
  position: relative;
  margin-bottom: 1rem;
  overflow: visible;
  container-type: inline-size;
}

.bubble-layout {
  display: grid;
  grid-template-columns: 35fr 65fr;
  gap: 1.25rem;
  align-items: stretch;
  min-height: 420px;
  transition: grid-template-columns 0.35s ease, min-height 0.35s ease;
}

.bubble-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
}

.bubble-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.bubble-panel-head .tool-card-header {
  flex: 1;
  margin-bottom: 0;
}

.bubble-panel-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.bubble-panel-stack {
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.bubble-expand-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 2;
  flex-shrink: 0;
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
}

.bubble-panel-stack .bubble-hint {
  margin: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--muted);
  width: fit-content;
  max-width: 30cqw;
}

/* After build: controls + tip stack on top, chart fills bottom */
.bubble-card--built .bubble-layout {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  min-height: 520px;
}

.bubble-card--built .bubble-panel {
  gap: 0.75rem;
}

.bubble-card--built .bubble-panel-head {
  padding-right: 9.5rem;
}

.bubble-card--built .bubble-panel-head .tool-card-header p {
  display: none;
}

.bubble-card--built .bubble-panel-stack {
  width: 100%;
}

.bubble-card--built .bubble-hint {
  display: none;
}

.bubble-card--built .bubble-chart-area {
  min-height: 460px;
}

/* Actual bubble chart area */
.bubble-chart-area {
  position: relative;
  width: 100%;
  min-height: 380px;
  height: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: radial-gradient(ellipse 120% 60% at 20% 0%, rgba(217,70,239,0.10), transparent 55%),
              radial-gradient(ellipse 80%  60% at 90% 40%, rgba(34,197,94,0.07),  transparent 50%),
              var(--bg);
  overflow: hidden;
}

.bubble-chart-area svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.bubble-card--built .bubble-chart-area svg,
.bubble-modal-chart svg {
  height: 100%;
}

/* Fullscreen bubble modal */
.bubble-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.bubble-modal[hidden] {
  display: none;
}

.bubble-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 18, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.bubble-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.bubble-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bubble-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.bubble-modal-chart {
  flex: 1;
  min-height: 0;
  height: auto;
  border: none;
  border-radius: 0;
  margin: 0;
}

.bubble { fill-opacity: 1; stroke: rgba(255,255,255,0.12); stroke-width: 1.5; cursor: grab; touch-action: none; }
.bubble:active { cursor: grabbing; }

.bubble-tooltip {
  position: absolute;
  background: rgba(13,10,26,0.92);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
  visibility: hidden;
  white-space: nowrap;
  z-index: 10;
}

@media (max-width: 720px) {
  .bubble-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 0;
  }

  .bubble-panel {
    gap: 0.75rem;
  }

  .bubble-panel-stack {
    width: 100%;
  }

  .bubble-panel-stack .bubble-hint {
    max-width: min(30cqw, 100%);
  }

  .bubble-chart-area {
    min-height: 280px;
  }

  .bubble-card--built .bubble-chart-area {
    min-height: 320px;
    height: auto;
  }
}

/* ── First Listen card ─────────────────────────────────────────── */
.first-listen { margin-bottom: 1rem; }

.first-listen-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.fl-select  { min-width: 160px; }
.fl-artist  { flex: 1; min-width: 140px; }
.fl-track   { flex: 1; min-width: 140px; }

.first-listen-result {
  margin-top: 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  flex-direction: column;
  gap: 0.3rem;
}
.first-listen-result:not([hidden]) {
  display: flex;
}

.first-listen-date  { font-size: 1.5rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.first-listen-track { font-size: 1rem; font-weight: 600; }
.first-listen-meta  { font-size: 0.88rem; color: var(--muted); }
.first-listen-not-found { color: var(--muted); font-size: 0.9rem; margin: 0; }

.first-listen-link {
  margin-top: 0.25rem;
  color: var(--accent);
  font-size: 0.88rem;
  text-decoration: none;
  align-self: flex-start;
}
.first-listen-link:hover { text-decoration: underline; }

/* ── Footer section ────────────────────────────────────────────── */
.footer-section {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}

@media (min-width: 620px) {
  .footer-section { grid-template-columns: 1fr 1fr; }
  .footer-section .card { margin-bottom: 0; }
}

.footer-card .tool-card-header { margin-bottom: 0.75rem; }
.footer-card h3 { font-size: 0.92rem; }
.footer-card p  { font-size: 0.82rem; }

/* ── Tracks / Artists results lists ───────────────────────────── */
.tracks-results { }

.results-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 0.6rem;
}

.tracks-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: track;
}

.tracks-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid var(--border);
  counter-increment: track;
}

.tracks-list li:last-child { border-bottom: none; }

.tracks-list li::before {
  content: counter(track);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.82rem;
  min-width: 1.5rem;
  flex-shrink: 0;
}

.tracks-list .track-name,
.tracks-list .artist-name  { font-weight: 500; flex: 1; min-width: 0; }

.tracks-list .track-playcount {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.88rem;
  flex-shrink: 0;
}

.tracks-list a.track-url {
  color: var(--accent);
  font-size: 0.82rem;
  text-decoration: none;
  flex-shrink: 0;
}
.tracks-list a.track-url:hover { text-decoration: underline; }

/* ── Raw API ───────────────────────────────────────────────────── */
.raw-api {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.raw-api .input { flex: 1; min-width: 140px; }

/* ── Code / preview ────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--surface2);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.preview {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin: 0.5rem 0 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--muted);
}

.preview:empty { display: none; }

/* ── Dashboard ─────────────────────────────────────────────────── */
.dashboard { padding-top: 0; }

/* ── Error banner ──────────────────────────────────────────────── */
.error-banner {
  background: rgba(239,68,68,0.14);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-top: 1rem;
}
.error-banner[hidden] { display: none; }

/* ── Export success message ────────────────────────────────────── */
.export-result-panel { padding: 0.25rem 0; }

.export-success {
  font-size: 1.1rem;
  font-weight: 600;
  color: #34d399;
  margin-bottom: 0.3rem;
}

.export-meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ── API loading overlay ───────────────────────────────────────── */
.api-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,9,12,0.45);
  backdrop-filter: blur(1px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 9999;
}

.api-loading-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.api-loading-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.api-loading-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.api-loading-text { color: var(--text); font-size: 0.9rem; }

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

/* ── Disclaimer ────────────────────────────────────────────────── */
.disclaimer {
  display: inline-block;
  margin-top: 0.2rem;
  color: #f59e0b;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Site footer ───────────────────────────────────────────────── */
.site-footer {
  flex-shrink: 0;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-copy,
.footer-attribution {
  font-size: 0.82rem;
  color: var(--muted);
}

.footer-attribution a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

.footer-github {
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.footer-github:hover { color: var(--text); }

/* ── Misc ──────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
