:root {
  --bg: #ffffff;
  --bg-elev: #f6f7f9;
  --bg-elev-2: #ffffff;
  --fg: #0f1115;
  --fg-muted: #5b6270;
  --border: #e5e7eb;
  --accent: #6366f1;
  --accent-fg: #ffffff;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(15, 17, 21, 0.06);
  --shadow-md: 0 6px 24px rgba(15, 17, 21, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 17, 21, 0.18);

  --q1: rgba(99, 102, 241, 0.06);
  --q2: rgba(244, 114, 182, 0.06);
  --q3: rgba(20, 184, 166, 0.06);
  --q4: rgba(245, 158, 11, 0.06);
}

[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-elev: #11141b;
  --bg-elev-2: #161a23;
  --fg: #e8eaf0;
  --fg-muted: #8b93a7;
  --border: #232938;
  --accent: #818cf8;
  --accent-fg: #0b0d12;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);

  --q1: rgba(129, 140, 248, 0.10);
  --q2: rgba(244, 114, 182, 0.10);
  --q3: rgba(45, 212, 191, 0.10);
  --q4: rgba(251, 191, 36, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  min-height: 100vh;
}

/* ─── Top bar ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 22px; color: var(--accent); }
.brand h1 {
  font-size: 16px; margin: 0;
  letter-spacing: -0.01em; font-weight: 600;
}

.topbar-actions { display: flex; gap: 8px; }

.ghost-btn,
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.ghost-btn:hover,
.icon-btn:hover { background: var(--bg-elev); }

.icon-btn {
  width: 38px; height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ─── Input bar ───────────────────────────────────────────────── */
.input-bar { padding: 18px 20px 6px; background: var(--bg); }

#userForm {
  display: flex; gap: 10px;
  max-width: 720px; margin: 0 auto;
}

.input-wrap {
  flex: 1;
  display: flex; align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.input-wrap .at { color: var(--fg-muted); margin-right: 6px; font-size: 15px; }

#usernameInput {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--fg); font-size: 15px; padding: 14px 0; font-family: inherit;
}

.primary-btn {
  background: var(--accent); color: var(--accent-fg);
  border: none; border-radius: 12px;
  padding: 0 18px; font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  transition: transform 120ms ease, opacity 120ms ease;
  min-height: 48px;
}

.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
}

.primary-btn.loading .spinner { display: inline-block; }
.primary-btn.loading .btn-label { opacity: 0.85; }

@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  margin: 8px auto 0; max-width: 720px;
  color: var(--danger); font-size: 13px; min-height: 18px;
}

/* ─── Layout ──────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  padding: 14px 20px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}

/* ─── Chart ───────────────────────────────────────────────────── */
.chart-wrap { display: flex; align-items: center; justify-content: center; }

.chart {
  position: relative;
  width: min(100%, 720px);
  aspect-ratio: 1 / 1;
  min-width: 320px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.quadrant { position: absolute; width: 50%; height: 50%; }
.quadrant.q1 { top: 0;    right: 0; background: var(--q1); }
.quadrant.q2 { top: 0;    left: 0;  background: var(--q2); }
.quadrant.q3 { bottom: 0; left: 0;  background: var(--q3); }
.quadrant.q4 { bottom: 0; right: 0; background: var(--q4); }

.grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 10% 10%;
  opacity: 0.35;
  pointer-events: none;
}

.axis { position: absolute; background: var(--fg-muted); opacity: 0.55; }
.axis-x { top: 50%; left: 0; right: 0; height: 1.5px; transform: translateY(-50%); }
.axis-y { left: 50%; top: 0; bottom: 0; width: 1.5px; transform: translateX(-50%); }

.axis-label {
  position: absolute;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
  background: var(--bg-elev-2);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: text;
  outline: none;
  user-select: text;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.axis-label:hover {
  border-color: var(--accent);
  color: var(--fg);
  background: var(--bg-elev);
}

.axis-label:focus {
  border-color: var(--accent);
  color: var(--fg);
  background: var(--bg-elev);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.20);
}

.label-pos-y { top: 8px;    left: 50%; transform: translateX(-50%); }
.label-neg-y { bottom: 8px; left: 50%; transform: translateX(-50%); }
.label-pos-x { top: 50%;    right: 8px; transform: translateY(-50%); }
.label-neg-x { top: 50%;    left: 8px;  transform: translateY(-50%); }

.avatars { position: absolute; inset: 0; pointer-events: none; }

.avatar {
  position: absolute;
  width: 48px; height: 48px;
  margin-left: -24px; margin-top: -24px;
  border-radius: 50%;
  border: 2px solid var(--bg-elev-2);
  box-shadow: var(--shadow-md);
  background: var(--bg-elev);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 180ms cubic-bezier(.2,.9,.2,1.4), box-shadow 160ms ease;
  animation: pop 380ms cubic-bezier(.2,.9,.2,1.4);
}

.avatar img {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover; display: block;
}

.avatar:hover {
  transform: scale(1.18);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}

.avatar .tip {
  position: absolute;
  top: -34px; left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  font-size: 11px; font-weight: 600;
  padding: 4px 8px; border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.avatar:hover .tip { opacity: 1; }

@keyframes pop {
  0%   { transform: scale(0.2); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-md);
  max-height: calc(100vh - 180px);
  display: flex; flex-direction: column;
  gap: 14px;
}

@media (max-width: 960px) {
  .sidebar { max-height: none; }
}

.sidebar-header h2 {
  margin: 0 0 2px 0;
  font-size: 15px; letter-spacing: -0.01em;
}

.subtle { color: var(--fg-muted); font-size: 12px; }

.cards {
  display: flex; flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.cards::-webkit-scrollbar { width: 8px; }
.cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.empty-state {
  color: var(--fg-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  padding: 16px;
  border-radius: 12px;
  text-align: center;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  animation: cardIn 360ms cubic-bezier(.2,.9,.2,1.4);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-img {
  width: 72px; height: 72px;
  border-radius: 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  object-fit: cover;
}

.card-body {
  display: flex; flex-direction: column;
  gap: 2px; min-width: 0;
}

.card-handle {
  font-size: 11px; font-weight: 600;
  color: var(--fg-muted);
  text-transform: lowercase;
}

.card-name {
  font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em;
}

.card-source {
  font-style: italic;
  font-size: 12px;
  color: var(--fg-muted);
}

.card-caption {
  font-size: 12px; color: var(--fg);
  margin-top: 4px; line-height: 1.35;
}

.card-traits {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 6px;
}

.trait {
  font-size: 10.5px; font-weight: 600;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.trait.trait-on {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.card.loading .card-name::after {
  content: "…";
}


/* ─── View-card button on each sidebar card ──────────────────── */
.card-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.view-card-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.view-card-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

/* ─── Modal ───────────────────────────────────────────────────── */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.modal-panel {
  position: relative;
  z-index: 1;
  max-width: 920px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-elev-2);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: cardIn 240ms cubic-bezier(.2,.9,.2,1.4);
}

.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
}

.stats-card-wrap {
  display: flex;
  justify-content: center;
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 12px;
  overflow: hidden;
}

.stats-card-wrap > .stats-card {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .modal { padding: 8px; }
  .modal-panel {
    padding: 10px;
    border-radius: 14px;
    max-height: calc(100vh - 16px);
  }
  .stats-card-wrap {
    padding: 6px;
    border-radius: 10px;
  }
  .modal-actions { flex-wrap: wrap; }
}

/* ─── Stats card (the downloadable bit) ──────────────────────── */
/* Independent of the main theme so the exported JPEG always looks
   the same. Uses its own light palette. */
.stats-card {
  width: 880px;
  background: #ffffff;
  color: #0d1119;
  border-radius: 18px;
  border: 2px solid #0d1119;
  padding: 22px 22px 26px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 18px 48px rgba(15, 17, 21, 0.18);
}

.sc-header {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.sc-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid #0d1119;
  object-fit: cover;
  background: #f0f0f0;
}

.sc-titles { min-width: 0; }

.sc-handle-row {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}

.sc-handle {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.sc-badge {
  display: inline-block;
  background: #c4b5fd;
  color: #2e1065;
  border: 1.5px solid #0d1119;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sc-tagline {
  font-style: italic;
  color: #ef4444;
  font-size: 14px;
  margin-top: 4px;
}

.sc-rank {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #fcd34d;
  border: 2px solid #0d1119;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 30px;
  color: #0d1119;
  box-shadow: 3px 3px 0 #0d1119;
}

.sc-rank-pill {
  position: absolute;
  bottom: -10px; left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1.5px solid #0d1119;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* mini chart inside card */
.sc-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin: 8px 0 0;
}

.sc-chart {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border: 2px solid #0d1119;
  border-radius: 14px;
  overflow: hidden;
}

.sc-stats { /* right column top: legendary stats */ }
.sc-side-lookalike { margin-top: 14px; }

.sc-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, #e5e7eb 1.5px, transparent 1.5px),
    linear-gradient(to bottom, #e5e7eb 1.5px, transparent 1.5px);
  background-size: 12.5% 12.5%;
}

.sc-axis {
  position: absolute;
}
.sc-axis-x {
  top: 50%; left: 0; right: 0; height: 3px; transform: translateY(-50%);
  background: #ef4444;
}
.sc-axis-y {
  left: 50%; top: 0; bottom: 0; width: 3px; transform: translateX(-50%);
  background: #f59e0b;
}

.sc-label {
  position: absolute;
  background: #ffffff;
  border: 1.5px solid #0d1119;
  border-radius: 999px;
  padding: 4px 12px;
  font-style: italic;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 2px 2px 0 #0d1119;
}

.sc-label-pos-y { top: 8px;    left: 50%; transform: translateX(-50%); }
.sc-label-neg-y { bottom: 8px; left: 50%; transform: translateX(-50%); }
.sc-label-pos-x {
  top: 50%; right: 8px;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: center;
}
.sc-label-neg-x {
  top: 50%; left: 8px;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
}

.sc-pin {
  position: absolute;
  width: 36px; height: 36px;
  margin-left: -18px; margin-top: -18px;
}

.sc-pin img {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2.5px solid #ef4444;
  background: #fff;
  display: block;
}

.sc-pin-tag {
  position: absolute;
  top: 38px; left: 50%; transform: translateX(-50%);
  background: #0d1119;
  color: #fff;
  font-weight: 800;
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.1em;
}

/* legendary stats */
.sc-stats-title {
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.04em;
  margin: 4px 0 10px;
}

.sc-stat {
  margin-bottom: 12px;
}

.sc-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.sc-stat-name {
  font-weight: 800;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4b5563;
}

.sc-stat-pct {
  font-weight: 900;
  color: #ef4444;
  font-size: 13px;
}

.sc-bar {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  height: 10px;
}

.sc-bar-cell {
  background: #e5e7eb;
  border-radius: 3px;
}
.sc-bar-cell.on {
  background: #ef4444;
}

/* ─── Look-alike block (right column, under stats) ───────────── */
.sc-lookalike-title {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  color: #0d1119;
}

.sc-lookalike-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: start;
  background: #fafafa;
  border: 1.5px solid #0d1119;
  border-radius: 12px;
  padding: 10px;
}

.sc-lookalike-img {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  border: 1.5px solid #0d1119;
  background: #f0f0f0;
  display: block;
}

.sc-lookalike-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sc-lookalike-name {
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sc-lookalike-source {
  font-size: 11.5px;
  color: #4b5563;
  font-style: normal;
}
.sc-lookalike-source em {
  font-style: italic;
  color: #ef4444;
}

.sc-lookalike-caption {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #0d1119;
}

.sc-stat {
  margin-bottom: 10px;
}

.sc-stat-name {
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4b5563;
}


/* ─── Quiz modal ──────────────────────────────────────────────── */
.quiz-panel {
  max-width: 580px;
  padding: 22px;
}

.quiz-progress {
  height: 6px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.quiz-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 280ms cubic-bezier(.2,.9,.2,1);
}

.quiz-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.quiz-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--bg-elev-2);
  box-shadow: var(--shadow-sm);
  object-fit: cover;
  background: var(--bg-elev);
}

.quiz-meta-text {
  display: flex; flex-direction: column;
  min-width: 0;
}

.quiz-handle {
  font-weight: 700;
  font-size: 14px;
}

.quiz-step-num {
  font-size: 11.5px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quiz-meta .ghost-btn {
  margin-left: auto;
}

.quiz-title {
  margin: 0 0 8px;
  font-size: 19px;
  letter-spacing: -0.01em;
  line-height: 1.35;
  font-weight: 700;
}

.quiz-sub {
  margin: 0 0 18px;
  color: var(--fg-muted);
  font-size: 13px;
}

.quiz-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.quiz-labels label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quiz-labels input {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--fg);
  font-family: inherit;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.quiz-labels input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.quiz-choice {
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  color: var(--fg);
  cursor: pointer;
  line-height: 1.4;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.quiz-choice:hover {
  border-color: var(--accent);
  background: var(--bg-elev-2);
  transform: translateX(2px);
}

.quiz-choice.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  font-weight: 600;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-actions .primary-btn {
  margin-left: auto;
}

@media (max-width: 520px) {
  .quiz-panel { padding: 16px; }
  .quiz-labels { grid-template-columns: 1fr; }
}


/* ─── Quiz: look-alike pool picker ──────────────────────────── */
.quiz-pref {
  margin-bottom: 18px;
}

.quiz-pref > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quiz-pref select {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--fg);
  font-family: inherit;
  outline: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.quiz-pref select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.quiz-pref-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}


/* ─── Rate-limit banner (LLM quota fallback) ─────────────────── */
.rate-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #f59e0b;
  font-size: 13px;
  text-align: center;
  flex-wrap: wrap;
}

.rate-banner[hidden] { display: none; }

.rate-banner-text { font-weight: 700; }
.rate-banner-sub  { color: #78350f; opacity: 0.9; }

[data-theme="dark"] .rate-banner {
  background: #422006;
  color: #fbbf24;
  border-bottom-color: #92400e;
}
[data-theme="dark"] .rate-banner-sub { color: #fde68a; }
