/* ---------- Finder: fair swaps, upgrades and downgrades ---------- */
.fd { display: flex; flex-direction: column; }
.fd a { text-decoration: none; }
.fd-body-wrap { display: flex; flex-direction: column; gap: 22px; }
.fd-k { font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

/* Mode tabs */
.fd-tabs {
  display: inline-flex; gap: 2px; padding: 4px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line-2);
}
.fd-tab {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--muted); white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.fd-tab svg { width: 17px; height: 17px; }
.fd-tab:hover { color: var(--text); }
.fd-tab.on { color: var(--text); background: var(--surface-3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.4); }
.fd-tab.on svg { color: var(--accent); }
.fd-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Picked pet hero ---------- */
.fd-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; align-items: center; gap: 24px;
  padding: 22px 26px 22px 22px; border-radius: 24px;
  background:
    radial-gradient(420px 240px at 8% 50%, color-mix(in srgb, var(--rc) 18%, transparent), transparent 70%),
    radial-gradient(520px 300px at 100% 0%, rgba(47, 140, 255, 0.12), transparent 65%),
    linear-gradient(180deg, #131a2b, #0e1322);
  border-color: rgba(120, 160, 255, 0.14);
  box-shadow: 0 30px 70px -44px rgba(47, 140, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.fd-hero.tier-legend, .fd-hero.tier-secret { border-color: color-mix(in srgb, var(--rc) 30%, var(--line)); }
.fd-hero-art { display: block; }
.fd-hero-art .art { width: 100%; transition: transform 0.25s var(--ease); }
.fd-hero-art:hover .art { transform: translateY(-3px) scale(1.02); }
.fd-hero-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.fd-hero-name {
  font: 800 clamp(24px, 3vw, 34px)/1.08 var(--font-display); letter-spacing: -0.04em; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fd-hero-name:hover { color: var(--accent-hover); }
.fd-hero-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.fd-hero-val { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
.fd-big {
  font: 900 clamp(34px, 4.4vw, 52px)/1 var(--font-display); letter-spacing: -0.05em; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; white-space: nowrap;
}
.fd-big .tok { width: 0.7em; height: 0.7em; margin-right: 0.16em; vertical-align: 0; }
.fd-big .val-oc { font-size: 18px; padding: 8px 12px; }
.fd-big-none { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--muted); }
.fd-range { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.fd-range .tok { width: 13px; height: 13px; }
.fd-change { margin-top: 4px; }

/* Start state */
.fd-start { padding: 26px; display: flex; flex-direction: column; gap: 20px; border-radius: 24px; }
.fd-start-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 36px 20px; border-radius: 20px; cursor: pointer; color: var(--text);
  border: 1.5px dashed var(--line-3);
  background: radial-gradient(60% 80% at 50% 0%, rgba(47, 140, 255, 0.12), transparent 70%), var(--bg-2);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.fd-start-btn:hover { border-color: var(--accent); }
.fd-start-btn:active { transform: scale(0.99); }
.fd-start-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fd-start-ring {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px;
  color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 8px rgba(47, 140, 255, 0.06);
}
.fd-start-ring svg { width: 24px; height: 24px; }
.fd-start-t { font-size: 19px; font-weight: 800; letter-spacing: -0.03em; }
.fd-start-s { font-size: 14px; color: var(--text-2); }
.fd-start-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.fd-start-or::before, .fd-start-or::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.fd-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fd-qp {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 12px 8px 8px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.fd-qp:hover { border-color: color-mix(in srgb, var(--rc) 45%, var(--line-2)); background: var(--surface-3); }
.fd-qp .art { width: 48px; flex-shrink: 0; border-radius: 11px; }
.fd-qp .art-inner { border-radius: 10px; }
.fd-qp-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fd-qp-t b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-qp-t .val { font-size: 13px; color: var(--text-2); }

/* Stat strip */
.fd-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px;
  padding: 14px 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
}
.fd-strip > div { display: flex; align-items: baseline; gap: 7px; }
.fd-strip b { font: 800 22px/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.fd-strip span { font-size: 13px; color: var(--text-2); font-weight: 600; }
.fd-strip .fd-strip-note { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 500; display: block; }
.fd-strip-note .tok { width: 12px; height: 12px; }

/* ---------- Groups ---------- */
.fd-group { display: flex; flex-direction: column; gap: 14px; }
.fd-ghead { display: flex; align-items: center; gap: 12px; }
.fd-gico {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(47, 140, 255, 0.18);
}
.fd-gico svg { width: 18px; height: 18px; }
.fd-gtxt { min-width: 0; flex: 1; }
.fd-gtxt h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.fd-gtxt p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.fd-count {
  min-width: 30px; height: 26px; padding: 0 9px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}
.fd-none {
  padding: 16px 18px; border-radius: 14px; font-size: 13.5px; color: var(--muted);
  border: 1px dashed var(--line-2); background: rgba(255, 255, 255, 0.012);
}
.fd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }

/* ---------- Suggestion card ---------- */
.fd-card {
  position: relative; min-width: 0; display: flex; flex-direction: column;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.18s var(--ease), box-shadow 0.18s;
}
.fd-card:hover {
  border-color: color-mix(in srgb, var(--rc) 35%, var(--line-2));
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--rc) 55%, rgba(0, 0, 0, 0.8));
}
.fd-stage {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 14px 4px; min-height: 0;
}
.fd-art { position: relative; display: block; width: 104px; flex-shrink: 0; }
.fd-art .art { width: 100%; }
.fd-stage.multi .fd-art { width: 86px; }
.fd-card.is-three .fd-art { width: 64px; }
.fd-card.is-three .fd-stage { gap: 3px; }
.fd-plus { font: 800 16px/1 var(--font-display); color: var(--faint); }
.fd-qty {
  position: absolute; right: -6px; bottom: -4px; z-index: 3;
  padding: 4px 8px; border-radius: 9px;
  font: 900 14px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  color: #fff; background: var(--accent); box-shadow: 0 6px 16px -6px rgba(47, 140, 255, 0.8), 0 0 0 3px var(--surface);
}
.fd-card.is-three .fd-qty { font-size: 11.5px; padding: 3px 6px; }
.fd-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 16px; flex: 1; }
.fd-names {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-width: 0;
  font-size: 15px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3;
}
.fd-nm { color: var(--text); min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-nm:hover { color: var(--accent-hover); }
.fd-n { color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.fd-and, .fd-approx { color: var(--faint); font-weight: 700; }
.fd-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 22px; }
.fd-each { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fd-each .val { color: var(--text-2); }
.fd-foot {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line);
}
.fd-total { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fd-total .fd-k { font-size: 10.5px; }
.fd-total .val { font-size: 21px; font-weight: 800; letter-spacing: -0.035em; }
.fd-diff {
  flex-shrink: 0; height: 26px; padding: 0 9px; border-radius: 8px; display: inline-flex; align-items: center;
  font-size: 12.5px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line-2);
}
.fd-diff.tone-even { color: var(--win); background: rgba(46, 230, 160, 0.1); border-color: rgba(46, 230, 160, 0.25); }
.fd-diff.tone-pos { color: var(--win); background: rgba(46, 230, 160, 0.08); border-color: rgba(46, 230, 160, 0.2); }
.fd-diff.tone-neg { color: var(--fair); background: rgba(255, 201, 77, 0.08); border-color: rgba(255, 201, 77, 0.22); }
.fd-diff.tone-up { color: var(--accent-2); background: rgba(255, 122, 89, 0.09); border-color: rgba(255, 122, 89, 0.24); }
.fd-go { width: 100%; justify-content: center; height: 36px; margin-top: 2px; }
.fd-go:hover { background: var(--accent); border-color: transparent; color: #fff; }
.fd-split {
  display: flex; align-items: center; justify-content: center; gap: 7px; height: 36px; margin-top: 2px;
  border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--bg-2); border: 1px dashed var(--line-2);
}
.fd-split svg { width: 14px; height: 14px; }

/* ---------- Honest messages ---------- */
.fd-msg { padding: 34px 26px; text-align: center; display: flex; flex-direction: column; align-items: center; border-radius: 22px; }
.fd-msg-ico {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px;
  color: var(--fair); background: rgba(255, 201, 77, 0.1); border: 1px solid rgba(255, 201, 77, 0.22);
}
.fd-msg-ico svg { width: 24px; height: 24px; }
.fd-msg h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.fd-msg p { margin: 8px 0 0; max-width: 56ch; color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.fd-msg-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }

/* ---------- Budget panel ---------- */
.fd-budget {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0;
  border-radius: 24px; overflow: hidden;
  background: radial-gradient(520px 300px at 0% 0%, rgba(47, 140, 255, 0.13), transparent 65%), linear-gradient(180deg, #131a2b, #0e1322);
  border-color: rgba(120, 160, 255, 0.14);
}
.fd-budget-main, .fd-budget-pets { padding: 22px 24px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.fd-budget-pets { border-left: 1px solid var(--line); background: rgba(0, 0, 0, 0.12); }
.fd-budget-field {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 0 12px 0 16px; height: 68px; border-radius: 16px;
  background: var(--inset); border: 1px solid var(--line-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fd-budget-field:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.fd-budget-field .tok { width: 32px; height: 32px; margin: 0; flex-shrink: 0; }
.fd-budget-in {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text);
  font: 900 34px/1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
}
.fd-budget-in::placeholder { color: var(--faint); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.fd-budget-in[readonly] { cursor: default; }
.fd-budget-hint { margin: 0; font-size: 13px; color: var(--muted); }
.fd-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.fd-presets .chip { cursor: pointer; font-variant-numeric: tabular-nums; }
.fd-presets .tok { width: 13px; height: 13px; margin-right: 0; }
.fd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fd-chip {
  display: inline-flex; align-items: center; gap: 9px; max-width: 100%; min-width: 0;
  padding: 5px 5px 5px 5px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2);
}
.fd-chip .art { width: 40px; flex-shrink: 0; border-radius: 10px; }
.fd-chip .art-inner { border-radius: 9px; }
.fd-chip-t { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fd-chip-t b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.fd-chip-t .val { font-size: 12px; color: var(--text-2); }
.fd-chip-x {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--muted); background: transparent; border: 0; cursor: pointer;
}
.fd-chip-x svg { width: 14px; height: 14px; }
.fd-chip-x:hover { color: var(--lose); background: rgba(255, 91, 110, 0.1); }
.fd-add {
  display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 16px 0 12px;
  border-radius: 14px; border: 1.5px dashed var(--line-3); background: transparent; color: var(--text-2);
  font: 650 13.5px var(--font); cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.fd-add svg { width: 16px; height: 16px; }
.fd-add:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.fd-results { display: flex; flex-direction: column; gap: 22px; }

.fd :is(.fd-chip-x, .fd-add, .fd-presets .chip):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .fd-head .fd-tabs { width: 100%; }
  .fd-tab { flex: 1; justify-content: center; }
}
@media (max-width: 760px) {
  .fd-hero { grid-template-columns: 92px minmax(0, 1fr); gap: 16px; padding: 18px; }
  .fd-hero-val { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; text-align: left; gap: 6px 12px; padding-top: 14px; border-top: 1px solid var(--line); }
  .fd-hero-val .fd-big { order: 1; }
  .fd-hero-val .fd-change { order: 2; margin: 0; }
  .fd-hero-val .fd-range { order: 3; width: 100%; }
  .fd-budget { grid-template-columns: minmax(0, 1fr); }
  .fd-budget-pets { border-left: 0; border-top: 1px solid var(--line); }
  .fd-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fd-strip { gap: 8px 18px; padding: 12px 16px; }
  .fd-strip .fd-strip-note { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .fd-tab { padding: 0 10px; font-size: 13px; gap: 6px; }
  .fd-tab svg { width: 15px; height: 15px; }
  .fd-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  /* Phone: compact horizontal cards so more fit on screen */
  .fd-card { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .fd-stage { padding: 12px 0 12px 12px; align-items: center; }
  .fd-art { width: 76px; }
  .fd-stage.multi { flex-direction: column; gap: 2px; }
  .fd-stage.multi .fd-art { width: 54px; }
  .fd-card.is-three .fd-art { width: 44px; }
  .fd-plus { font-size: 12px; line-height: 0.8; }
  .fd-qty { font-size: 12px; padding: 3px 6px; right: -4px; }
  .fd-body { padding: 12px 12px 12px 12px; gap: 6px; }
  .fd-names { font-size: 14px; }
  .fd-foot { padding-top: 8px; }
  .fd-total .val { font-size: 18px; }
  .fd-go, .fd-split { height: 34px; }
  .fd-budget-main, .fd-budget-pets { padding: 18px; }
  .fd-budget-field { height: 60px; }
  .fd-budget-in { font-size: 28px; }
  .fd-start { padding: 16px; }
  .fd-start-btn { padding: 28px 16px; }
  .fd-quick { gap: 8px; }
  .fd-qp { padding: 6px 8px 6px 6px; gap: 9px; }
  .fd-qp .art { width: 40px; }
  .fd-qp-t b { font-size: 13px; }
  .fd-msg { padding: 28px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .fd-card, .fd-hero-art .art { transition: none; }
  .fd-card:hover, .fd-hero-art:hover .art { transform: none; }
}
@media (max-width: 720px) { .nav a[data-nav="finder"] { display: none; } }

/* Header fit: with seven nav links, medium screens shrink the search to an icon and tighten the nav */
@media (min-width: 721px) and (max-width: 1279px) {
  .search-btn { width: 40px; padding: 0; justify-content: center; flex: 0 0 auto; }
  .search-btn span, .search-btn kbd { display: none; }
  .brand-tag { display: none; }
}
@media (min-width: 721px) and (max-width: 1023px) {
  .nav a { padding: 8px 9px; font-size: 13.5px; }
  .nav a svg { display: none; }
  .topbar .wrap { gap: 10px; }
}
@media (min-width: 721px) and (max-width: 800px) {
  .nav a { padding: 8px 6px; font-size: 13px; }
  .brand-pet .brand-name { font-size: 18px; }
}
