/* ==========================================================================
   Eddies site - shared styles (every page loads this first).
   Layout principle: pages are fluid. Content fills the window up to
   --page-max, side gutters scale with the screen, and nothing has a fixed
   width wider than a phone, so there is never horizontal scrolling.
   ========================================================================== */
:root {
  --bg: #07070b;
  --bg-panel: #101018;
  --bg-card: #15151e;
  --bg-hi: #1c1c27;
  --border: #262633;
  --border-hi: #3a3a4d;
  --yellow: #f5e400;
  --cyan: #1de1e1;
  --text: #ececf1;
  --text-dim: #9494a3;
  --red: #ff4d4d;
  --green: #4dff88;
  --purple: #b866ff;
  --pink: #ff5fa8;

  --color-red: #e8465a;
  --color-blue: #3d8bfd;
  --color-green: #3ecf6e;
  --color-yellow: #e8c93a;

  --type-legend: #ffb833;
  --type-unit: #4da6ff;
  --type-gear: #ff9f43;
  --type-program: #b866ff;

  --page-max: 1560px;
  --gutter: clamp(14px, 3.2vw, 44px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

/* Any element toggled via the `hidden` attribute must actually hide,
   even if it (or a class on it, e.g. .bucket-action-row's `display: flex`)
   also sets its own `display` elsewhere - an author rule normally beats
   the UA stylesheet's `[hidden] { display: none }`, which silently no-ops
   `el.hidden = true` on anything with its own display rule. */
[hidden] { display: none !important; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
  overflow-x: hidden; /* last-resort guard; no page should need it */
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(245, 228, 0, .075), transparent 62%),
    radial-gradient(760px 520px at -8% 6%, rgba(29, 225, 225, .065), transparent 62%);
}

/* Faint circuit-board grid behind everything, fading out down the page. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 75%);
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}

a { color: var(--cyan); text-decoration: none; }
img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

::selection { background: var(--yellow); color: #0a0a0f; }

/* Anchored sections shouldn't hide under the sticky header. */
section[id], [id^="grp-"] { scroll-margin-top: 110px; }

/* ---- Update banner ----------------------------------------------------- */
.update-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--yellow);
  color: #0a0a0f;
  font-size: 13px;
  font-weight: 700;
}

.update-banner button {
  border: 1px solid #0a0a0f;
  background: #0a0a0f;
  color: var(--yellow);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* ---- Header / navigation ------------------------------------------------ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 9, 14, .84);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}

/* Neon underline: yellow -> cyan -> transparent. */
.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--yellow), var(--cyan) 55%, transparent 100%);
}

.app-header .bar {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .2em;
  white-space: nowrap;
}

.brand img { width: 30px; height: 30px; object-fit: contain; transition: transform .4s var(--ease); }
.brand:hover img { transform: rotate(-12deg) scale(1.08); }
.brand .accent { color: var(--yellow); }
.brand small { color: var(--text-dim); font-size: 12px; font-weight: 600; letter-spacing: .12em; }

.nav-tabs {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.nav-tabs a {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color .15s, background .15s;
}

.nav-tabs a:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.nav-tabs a.active { background: var(--yellow); color: #0a0a0f; }

/* Phones: logo on the first row, the tabs on their own full-width row, so the
   header never grows wider than the screen. */
@media (max-width: 720px) {
  .app-header .bar { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px 8px; }
  .brand { font-size: 15px; }
  .brand img { width: 26px; height: 26px; }
  .nav-tabs { order: 3; flex: 1 1 100%; margin: 0; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs a { flex: 1 0 auto; text-align: center; padding: 8px 6px; font-size: 11px; letter-spacing: .06em; }
}

/* ---- Page container ------------------------------------------------------ */
main {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(16px, 2.6vw, 34px) var(--gutter) 64px;
  flex: 1 0 auto;
}

main.narrow { max-width: 860px; }

.page-head { margin: 2px 0 clamp(16px, 2.4vw, 26px); }
.page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1.1;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.page-head h1 .accent { color: var(--yellow); }
.page-head p { margin: 0; max-width: 72ch; color: var(--text-dim); font-size: clamp(13px, 1.3vw, 15px); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: clamp(26px, 4vw, 44px) 0 14px;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(17px, 2vw, 22px);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.section-head h2::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: .95em;
  margin-right: 10px;
  background: var(--yellow);
  transform: skewX(-14deg);
  vertical-align: -.1em;
}
.section-head .more { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.section-head .more:hover { color: var(--yellow); }

/* ---- Footer -------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(9, 9, 14, .6);
  padding: 16px var(--gutter) 22px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}
.site-footer .build-info { background: none; border: 0; padding: 0 0 6px; font-size: 11px; }
.site-footer .legal { opacity: .7; max-width: 80ch; margin: 0 auto; }

.build-info {
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
  padding: 4px 12px;
}

/* ---- Motion --------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* stagger() in shared.js tags the first few children of a freshly rendered
   grid with --i, so cards cascade in instead of popping. */
.rise { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.page-head, .page-enter { animation: rise .55s var(--ease) both; }

.skeleton-block {
  border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--bg-card) 30%, #222230 50%, var(--bg-card) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.bucket-toggle {
  display: flex;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.bucket-toggle button {
  flex: 1;
  border: none;
  background: var(--bg-card);
  color: var(--text-dim);
  padding: 10px 0;
  font-size: 13px;
  font-weight: 700;
}

.bucket-toggle button.active { background: var(--yellow); color: #0a0a0f; }
.bucket-toggle button:not(:first-child) { border-left: 1px solid var(--border); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}

.chip:hover { border-color: var(--text-dim); color: var(--text); }
.chip:active { transform: scale(.95); }
@media (pointer: coarse) { .chip { padding: 8px 14px; } }

.chip.active { border-color: var(--cyan); color: var(--cyan); background: rgba(29, 225, 225, 0.1); }

/* Color chips are tinted at rest, not just when active, so Red/Blue/Green/
   Yellow are identifiable at a glance instead of all reading as flat gray. */
.chip.color-Red { border-color: rgba(232, 70, 90, 0.4); color: var(--color-red); }
.chip.color-Blue { border-color: rgba(61, 139, 253, 0.4); color: var(--color-blue); }
.chip.color-Green { border-color: rgba(62, 207, 110, 0.4); color: var(--color-green); }
.chip.color-Yellow { border-color: rgba(232, 201, 58, 0.4); color: var(--color-yellow); }

.chip.color-Red.active { border-color: var(--color-red); background: rgba(232, 70, 90, 0.18); }
.chip.color-Blue.active { border-color: var(--color-blue); background: rgba(61, 139, 253, 0.18); }
.chip.color-Green.active { border-color: var(--color-green); background: rgba(62, 207, 110, 0.18); }
.chip.color-Yellow.active { border-color: var(--color-yellow); background: rgba(232, 201, 58, 0.18); }

/* Type chips get their own fixed accent (unrelated to faction color) so the
   Color row and Type row don't read as one visually-identical gray block. */
.chip.type-Legend { border-color: rgba(255, 184, 51, 0.4); color: var(--type-legend); }
.chip.type-Unit { border-color: rgba(77, 166, 255, 0.4); color: var(--type-unit); }
.chip.type-Gear { border-color: rgba(255, 159, 67, 0.4); color: var(--type-gear); }
.chip.type-Program { border-color: rgba(184, 102, 255, 0.4); color: var(--type-program); }

.chip.type-Legend.active { border-color: var(--type-legend); background: rgba(255, 184, 51, 0.18); }
.chip.type-Unit.active { border-color: var(--type-unit); background: rgba(77, 166, 255, 0.18); }
.chip.type-Gear.active { border-color: var(--type-gear); background: rgba(255, 159, 67, 0.18); }
.chip.type-Program.active { border-color: var(--type-program); background: rgba(184, 102, 255, 0.18); }

/* Rarity filters: icon buttons (mask-image technique, matching the desktop
   app's Collection window rarity sidebar) instead of text chips. The 9 raw
   rarity values collapse to 7 icons - all three "Iconic ..." rarities share
   the one Iconic icon, same as collection.js's rarityMatchesFilter(). */
.rarity-filter-btn {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.rarity-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.rarity-icon-common { -webkit-mask-image: url('assets/rarity/common.png?v=official'); mask-image: url('assets/rarity/common.png?v=official'); background-color: #9a9aa5; }
.rarity-icon-uncommon { -webkit-mask-image: url('assets/rarity/uncommon.png?v=official'); mask-image: url('assets/rarity/uncommon.png?v=official'); background-color: #5fdc84; }
.rarity-icon-rare { -webkit-mask-image: url('assets/rarity/rare.png?v=official'); mask-image: url('assets/rarity/rare.png?v=official'); background-color: #4da6ff; }
.rarity-icon-epic { -webkit-mask-image: url('assets/rarity/epic.png?v=official'); mask-image: url('assets/rarity/epic.png?v=official'); background-color: #b866ff; }
.rarity-icon-secret-rare { -webkit-mask-image: url('assets/rarity/secret-rare.png?v=official'); mask-image: url('assets/rarity/secret-rare.png?v=official'); background-color: #ff4d4d; }
.rarity-icon-iconic-rare { -webkit-mask-image: url('assets/rarity/iconic-rare.png?v=official'); mask-image: url('assets/rarity/iconic-rare.png?v=official'); background-color: #ffb833; }
.rarity-icon-nova-rare {
  -webkit-mask-image: url('assets/rarity/nova-rare.png?v=official');
  mask-image: url('assets/rarity/nova-rare.png?v=official');
  background-color: #ff5fa8;
}

.rarity-filter-btn:hover { border-color: var(--text); }
.rarity-filter-btn:hover .rarity-icon { filter: brightness(1.3); }
.rarity-filter-btn.active {
  background: rgba(245, 228, 0, 0.12);
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(245, 228, 0, 0.35);
}

select {
  width: 100%;
  padding: 10px 34px 10px 12px;
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239494a3' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color .15s;
}

select:hover { border-color: var(--border-hi); }

.result-count {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(136px, 14vw, 190px)), 1fr));
  gap: clamp(10px, 1.4vw, 18px);
}

.need-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
  /* Off-screen tiles skip layout/paint; the grid can hold hundreds. */
  content-visibility: auto;
  contain-intrinsic-size: auto 340px;
}

.need-card:hover {
  transform: translateY(-4px);
  border-color: var(--yellow);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .55), 0 0 0 1px rgba(245, 228, 0, .25);
}

.need-card:active { transform: translateY(-1px) scale(.99); }

.need-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  background: #000;
}

.need-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

.need-card-img-wrap.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

.need-badge {
  display: inline-block;
  background: var(--yellow);
  color: #0a0a0f;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  margin-bottom: 5px;
}

.need-card-info { padding: 8px; text-align: center; }
.need-card-name, .need-card-subname, .need-card-meta { text-align: left; }
.need-card-name { font-size: 12px; font-weight: 700; line-height: 1.25; }
.need-card-subname { font-size: 10px; color: var(--text-dim); font-style: italic; }
.need-card-meta { font-size: 10px; color: var(--text-dim); margin-top: 3px; }
.need-card-price { font-size: 11px; font-weight: 700; color: var(--green); margin-top: 3px; text-align: left; }
.selected-price { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.selected-price .price-value { font-weight: 700; color: var(--green); }
.selected-price a { color: var(--cyan); }
.need-card-price.price-guess, .selected-price .price-value.price-guess { color: var(--text-dim); }

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Record page */
.search-input {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  margin-bottom: 10px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.search-result-item:active { border-color: var(--cyan); }

.search-result-meta { font-size: 11px; color: var(--text-dim); }

.selected-card {
  margin-top: 14px;
  padding: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.selected-card-name { font-size: 17px; font-weight: 800; }
.selected-card-subname { font-size: 13px; color: var(--text-dim); font-style: italic; margin-bottom: 8px; }

.selected-rules {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin-top: 8px;
  white-space: pre-line;
}

/* Inline keyword badge icons (Call/Spend/Blocker/etc.) swapped in for the
   raw "{Keyword}" tokens rulesText/FAQ text comes with from the API - see
   renderRulesText() in record.js. Sized to sit on the text baseline like
   the real cards. */
.keyword-icon {
  height: 1.1em;
  vertical-align: middle;
  margin: 0 1px;
}

.popped-faq {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.popped-faq h4 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.faq-item {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.faq-q { font-weight: 700; color: var(--text); }
.faq-a { color: var(--text-dim); margin-top: 2px; }

.bucket-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.bucket-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.bucket-action-row .bucket-name { flex: 1; font-size: 13px; font-weight: 700; }

.bucket-action-row button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.bucket-action-row button:active { border-color: var(--cyan); color: var(--cyan); }

.search-different-link {
  display: block;
  font-size: 12px;
  color: var(--cyan);
  margin-bottom: 10px;
}

.toggle-other-buckets {
  display: block;
  font-size: 12px;
  color: var(--cyan);
  margin-top: 8px;
}

.give-away-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.give-away-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.optional-tag {
  font-weight: 400;
  color: var(--text-dim);
  text-transform: none;
}

.give-away-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--purple);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
}

.give-away-chip button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.give-away-chip button:hover { color: var(--red); }

.give-away-bucket-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.give-away-bucket-label {
  font-size: 12px;
  color: var(--text-dim);
}

.give-away-bucket-btn {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.give-away-bucket-btn.active {
  color: var(--purple);
  border-color: var(--purple);
  background: rgba(184, 102, 255, 0.12);
}

.give-away-owned {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 4px;
}

.pending-panel {
  margin-top: 20px;
}

.pending-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-panel h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.pending-action-buttons {
  display: flex;
  gap: 8px;
}

.pending-action-btn {
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  border-radius: 6px;
  padding: 5px 10px;
  text-decoration: none;
}

.pending-action-btn:active {
  background: rgba(29, 225, 225, 0.15);
}

.pending-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.pending-unsynced {
  color: var(--yellow);
  font-style: italic;
}

.pending-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 6px;
}

.pending-item .pending-delta.positive { color: var(--green); }
.pending-item .pending-delta.negative { color: var(--red); }

.token-gate {
  padding: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
}

.token-gate p { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.token-gate input {
  width: 100%;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  margin: 8px 0;
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.btn-primary { background: var(--yellow); color: #0a0a0f; border-color: var(--yellow); }

.status-line {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.status-line.ok { color: var(--green); }
.status-line.error { color: var(--red); }

.forget-token {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-top: -8px;
  margin-bottom: 12px;
}

/* ==========================================================================
   Shared components added in the redesign
   ========================================================================== */

/* Buttons used for calls to action (Home hero, empty states). */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid var(--border-hi);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: transform .15s var(--ease), background .15s, color .15s, border-color .15s;
}
.cta:hover { transform: translateY(-2px); border-color: var(--yellow); color: var(--yellow); }
.cta.primary { background: var(--yellow); border-color: var(--yellow); color: #0a0a0f; }
.cta.primary:hover { background: #fff35c; color: #0a0a0f; }

/* Angled-corner panel, the site's signature shape. */
.clip { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px)); }
.panel-box { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; }

/* Row of headline numbers. */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
  margin-bottom: clamp(14px, 2vw, 22px);
}
.stat {
  padding: 12px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--yellow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat:nth-child(2) { border-left-color: var(--cyan); }
.stat:nth-child(3) { border-left-color: var(--purple); }
.stat:nth-child(4) { border-left-color: var(--green); }
.stat b { font-size: clamp(22px, 3vw, 30px); line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .stat-tiles .stat:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.stat span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }

/* ---- Needed page: filter sidebar + results ---------------------------------- */
.needed-layout { display: flex; flex-direction: column; gap: 14px; }

.filters summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  user-select: none;
}
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: "\25BE"; margin-left: auto; color: var(--text-dim); transition: transform .2s; }
.filters:not([open]) summary::after { transform: rotate(-90deg); }
.filters .badge {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--yellow);
  color: #0a0a0f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
}
.filters-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 16px; }
.filter-label {
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.filter-hint { margin: 6px 0 0; font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.filters .bucket-toggle { margin-bottom: 0; }
.filter-clear {
  align-self: flex-start;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.filter-clear:hover { color: var(--red); border-color: var(--red); }

.results-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.results-bar .grow { flex: 1 1 220px; min-width: 0; }
.results-bar .search-input { margin: 0; }
.results-bar select { width: auto; min-width: 190px; flex: 0 1 auto; }
@media (max-width: 520px) { .results-bar select { width: 100%; } }

.search-input {
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(29, 225, 225, .15); }

@media (min-width: 960px) {
  .needed-layout { display: grid; grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .filters { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; }
  .filters summary { pointer-events: none; cursor: default; }
  .filters summary::after { display: none; }
}

.result-count { margin-bottom: 12px; }

/* Empty states */
.empty-state {
  margin: 20px 0;
  padding: 44px 16px;
  border: 1px dashed var(--border-hi);
  border-radius: 12px;
  text-align: center;
  color: var(--text-dim);
}

/* Card art: soft fade-in once an image decodes. */
.need-card-img-wrap img { transition: transform .35s var(--ease); }
.need-card:hover .need-card-img-wrap img { transform: scale(1.04); }
.need-card-img-wrap { overflow: hidden; }
.need-badge { box-shadow: 0 2px 10px rgba(245, 228, 0, .25); }
