/* Values list (home) */
.home { display: flex; flex-direction: column; gap: 44px; }
.home h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }

/* ---------- Market hero ---------- */
.market {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 34px 36px 28px;
  border-radius: 26px;
  background:
    radial-gradient(700px 380px at 82% 30%, rgba(47, 140, 255, 0.22), transparent 65%),
    radial-gradient(500px 300px at 0% 0%, rgba(120, 90, 255, 0.10), transparent 60%),
    linear-gradient(180deg, #131a2b, #0d1220);
  border: 1px solid rgba(120, 160, 255, 0.16);
  box-shadow: 0 30px 80px -40px rgba(47, 140, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
/* faint grid fading out to the left, like a trading terminal */
.mk-deco {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(600px 360px at 80% 35%, #000, transparent 75%);
  mask-image: radial-gradient(600px 360px at 80% 35%, #000, transparent 75%);
}
.market-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); gap: 24px; align-items: center; }
.market-main { min-width: 0; }
.mk-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-2);
}
.mk-live { width: 8px; height: 8px; border-radius: 50%; background: #2ee6a0; box-shadow: 0 0 0 0 rgba(46, 230, 160, 0.6); animation: mk-pulse 2s infinite; }
@keyframes mk-pulse { 70% { box-shadow: 0 0 0 8px rgba(46, 230, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 230, 160, 0); } }
.mk-numrow { display: flex; align-items: center; gap: 14px; margin: 18px 0 10px; }
.mk-numrow .coin { width: clamp(38px, 4.6vw, 60px); height: auto; flex-shrink: 0; filter: drop-shadow(0 6px 16px rgba(170, 120, 255, 0.5)); }
.market-num {
  font: 900 clamp(46px, 6.4vw, 84px)/0.95 var(--font-display);
  letter-spacing: -0.05em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff 30%, #a9c6ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 24px rgba(47, 140, 255, 0.35));
}
.market-sub { margin: 0; color: var(--text-2); font-size: 14.5px; max-width: 52ch; line-height: 1.55; }
.market-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 22px 0 0; max-width: 520px; }
.market-stats div {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line);
}
.market-stats dt { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.market-stats dt svg { width: 14px; height: 14px; color: var(--accent); }
.market-stats dd { margin: 0; font: 800 24px/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.market-stats dd.sm { font-size: 20px; line-height: 24px; }
.mk-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.mk-actions .btn { height: 44px; padding: 0 18px; }
.market-link svg, .see-all svg { width: 15px; height: 15px; transition: transform 0.15s; }
.see-all:hover svg { transform: translateX(3px); }

/* Showcase of the top three pets, floating over a glowing stage */
.mk-show { position: relative; height: 330px; }
.mk-stage {
  position: absolute; left: 6%; right: 6%; bottom: 14px; height: 70px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(47, 140, 255, 0.45), rgba(47, 140, 255, 0.08) 60%, transparent);
  filter: blur(6px);
}
.mk-stage::after { content: ''; position: absolute; inset: 22% 18%; border-radius: 50%; border: 1px solid rgba(140, 190, 255, 0.35); }
.mk-pet { position: absolute; bottom: 34px; display: grid; justify-items: center; text-decoration: none; animation: mk-float 5s ease-in-out infinite; }
.mk-pet img { position: relative; z-index: 1; width: 100%; height: auto; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.6)); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1.2); }
.mk-pet:hover img { transform: scale(1.06) translateY(-6px); }
.mk-glow { position: absolute; z-index: 0; inset: 18% 12% 30%; border-radius: 50%; background: var(--rc); opacity: 0.4; filter: blur(34px); }
.mk-p0 { left: 0; width: 34%; animation-delay: -1.6s; }
.mk-p1 { left: 28%; width: 44%; bottom: 50px; z-index: 2; animation-delay: -0.4s; }
.mk-p2 { right: 0; width: 34%; animation-delay: -3s; }
.mk-tag {
  position: relative; z-index: 2; margin-top: -6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; border-radius: 12px;
  background: rgba(13, 18, 32, 0.82); border: 1px solid color-mix(in srgb, var(--rc) 40%, var(--line-2));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.8);
}
.mk-tag-name { font-size: 11.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.mk-tag-val { display: flex; align-items: center; gap: 5px; font: 800 16px/1 var(--font-display); letter-spacing: -0.02em; color: #fff; }
.mk-tag-val .coin { width: 15px; height: 15px; }
.mk-p1 .mk-tag-val { font-size: 19px; }
@keyframes mk-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
/* same variant tints as the pet cards */
.mk-pet img.v-golden { filter: sepia(0.85) saturate(2.4) hue-rotate(-12deg) brightness(1.08) contrast(1.05) drop-shadow(0 18px 22px rgba(0, 0, 0, 0.6)); }
.mk-pet img.v-diamond { filter: grayscale(1) brightness(0.65) sepia(1) hue-rotate(190deg) saturate(7) contrast(1.2) brightness(1.1) drop-shadow(0 18px 22px rgba(0, 0, 0, 0.6)); }
.mk-pet img.v-rainbow { animation: rainbow-hue 6s linear infinite; }

/* Market by rarity */
.mbar-wrap { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.mbar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.mbar-head h2 { font-size: 17px !important; }
.mbar-head .muted { font-size: 13px; font-variant-numeric: tabular-nums; }
.mbar { position: relative; display: flex; gap: 3px; height: 16px; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.mbar-seg {
  min-width: 4px; border-radius: 4px; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 65%, #fff), var(--rc) 55%, color-mix(in srgb, var(--rc) 75%, #000));
  box-shadow: 0 0 12px -2px color-mix(in srgb, var(--rc) 70%, transparent);
  transition: opacity 0.15s, filter 0.15s;
}
.mbar-seg:hover { filter: brightness(1.15); }
.mbar-seg:first-child { border-radius: 999px 4px 4px 999px; }
.mbar-seg:nth-last-child(2) { border-radius: 4px 999px 999px 4px; }
.mbar-seg.dim { opacity: 0.25; }
.mbar-tip {
  position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 5;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 7px 11px; border-radius: 10px;
  background: #1d222b; border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.7);
  font-size: 13px; font-variant-numeric: tabular-nums; pointer-events: none;
}
.mbar-tip[hidden] { display: none; }
.mbar-tip .dot { width: 8px; height: 8px; border-radius: 50%; }
.mlegend { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 8px; margin-top: 16px; }
.mleg {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px 12px 12px; border-radius: 12px; text-align: left;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.mleg:hover { border-color: color-mix(in srgb, var(--rc) 50%, transparent); background: color-mix(in srgb, var(--rc) 9%, transparent); transform: translateY(-1px); }
.mleg-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--rc) 16%, transparent); color: var(--rc); }
.mleg-ico .r-ico { width: 15px; height: 15px; }
.mleg-txt { display: flex; flex-direction: column; min-width: 0; }
.mleg-txt b { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mleg-txt span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mleg-pct { font: 800 15px var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.mleg-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--w); background: var(--rc); border-radius: 0 3px 3px 0; box-shadow: 0 0 8px var(--rc); }

@media (max-width: 960px) {
  .market-top { grid-template-columns: 1fr; }
  .mk-show { order: -1; height: 230px; max-width: 460px; width: 100%; justify-self: center; }
}
@media (max-width: 520px) {
  .home { gap: 34px; }
  .market { padding: 20px 16px; border-radius: 20px; }
  .mk-show { height: 250px; margin-top: 4px; }
  .mk-p1 { bottom: 46px; }
  .mk-tag { padding: 4px 8px; }
  .mk-tag-name { font-size: 10px; max-width: 90px; }
  .mk-tag-val { font-size: 13px; }
  .mk-p1 .mk-tag-val { font-size: 15px; }
  .mk-numrow { margin: 14px 0 8px; gap: 10px; }
  .market-num { font-size: clamp(36px, 11vw, 50px); }
  .market-sub { font-size: 13px; }
  .market-stats { gap: 6px; }
  .market-stats div { padding: 10px; }
  .market-stats dt { font-size: 11px; }
  .market-stats dd { font-size: 19px; }
  .market-stats dd.sm { font-size: 15px; line-height: 19px; }
  .mk-actions .btn { flex: 1; }
  .mbar-wrap { margin-top: 22px; padding-top: 18px; }
  .mlegend { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .mleg { padding: 8px 9px 10px; gap: 7px; }
  .mleg-ico { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) { .mk-pet, .mk-live { animation: none; } }

/* ---------- Rails ---------- */
.rail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.rail-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.rail-title span { color: var(--muted); font-size: 14px; }
.rail-ctrl { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.see-all {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: none; padding: 6px 4px; margin-right: 4px;
  color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.see-all:hover { color: #7af7cd; }
.rail-btn {
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--surface);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.rail-btn svg { width: 16px; height: 16px; }
.rail-btn:hover:not(:disabled) { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.2); }
.rail-btn:disabled { opacity: 0.35; cursor: default; }
.rail-sec.no-scroll .rail-btn { display: none; }
.rail {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - 5 * 14px) / 6);
  gap: 14px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding: 0 16px;
  scrollbar-width: none;
  padding: 4px 0 6px; margin: -4px 0 -6px;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item { position: relative; scroll-snap-align: start; min-width: 0; display: flex; }
.rail-item .pet-card { flex: 1; }
.rail-badge {
  position: absolute; z-index: 4; top: 18px; left: 18px;
  font: 800 12px/1 var(--font-display); letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  padding: 6px 8px; border-radius: 8px;
  background: rgba(10, 12, 16, 0.78); border: 1px solid var(--line-2); color: var(--text);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.rail-item:nth-child(1) .rank { color: #1c1400; background: linear-gradient(135deg, #ffe58a, #ffbf3a); border-color: transparent; }
.rail-item:nth-child(2) .rank { color: #12161d; background: linear-gradient(135deg, #f1f4f8, #b9c2cf); border-color: transparent; }
.rail-item:nth-child(3) .rank { color: #1e0f05; background: linear-gradient(135deg, #f3b98a, #c97c45); border-color: transparent; }
.rail-badge.chg.up { color: var(--win); }
.rail-badge.chg.down { color: var(--lose); }
.rail-badge.chg.new { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
@media (max-width: 1100px) { .rail { grid-auto-columns: calc((100% - 4 * 14px) / 5); } }
@media (max-width: 900px) { .rail { grid-auto-columns: calc((100% - 3 * 14px) / 4); } }
@media (max-width: 720px) {
  .rail-btn { display: none; }
  .rail { grid-auto-columns: 42%; gap: 10px; margin: -4px -16px -6px; padding: 4px 16px 6px; }
  .rail::after { content: ''; width: 6px; }
  .rail-title { flex-direction: column; align-items: flex-start; gap: 2px; }
  .rail-title span { font-size: 13px; }
  .home h2 { font-size: 20px; }
}
@media (hover: none) { .rail-btn { display: none; } }

/* ---------- All pets ---------- */
.all-head { margin-bottom: 2px; }
.all-head .updated { color: var(--muted); font-size: 13px; white-space: nowrap; }
@media (max-width: 520px) { .all-head { flex-direction: column; align-items: flex-start; gap: 6px; } }

/* ---------- Toolbar / filters ---------- */
.toolbar {
  position: sticky; top: 64px; z-index: 30;
  padding: 12px 0;
  margin-bottom: 8px;
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
@media (max-width: 720px) { .toolbar { position: static; padding-top: 4px; } }
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (max-width: 720px) {
  .toolbar-row > .seg:first-of-type { order: 1; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar-row > .seg:first-of-type::-webkit-scrollbar { display: none; }
  .toolbar-row > .seg:first-of-type button { flex: 1 0 auto; }
  .toolbar-row .select { flex: 1; }
}

.chip-sep { flex: 0 0 1px; height: 20px; align-self: center; background: var(--line-2); margin: 0 4px; }

.results-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 6px 0 14px; flex-wrap: wrap; }
.results-meta b { color: var(--text); }
.updated { display: inline-flex; align-items: center; gap: 6px; }
.updated::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.18); }

/* ---------- Pet cards (shared: home grid, rails, pet page "Similar pets") ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.pet-card {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; gap: 12px;
  padding: 10px 10px 14px;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.pet-card:hover { background: var(--surface-2); border-color: rgba(255, 255, 255, 0.14); }
.pet-card:active { transform: scale(0.985); }
.pet-card:focus-visible { outline-offset: 3px; border-radius: var(--radius); }
/* The shared .art (style.css) is itself the dark inset tile; the card just frames it. */
.pc-tile { position: relative; }
.pc-tile .art { width: 100%; border-radius: 12px; }
.pc-tile .art-inner { border-radius: 11px; }
.pc-tile .art-ph { transition: transform 0.25s ease; }
.pet-card:hover .pc-tile .art-ph, .pet-card:hover .pc-tile .art-inner img { transform: scale(1.05); }
.pc-tile .vtag { position: absolute; top: 8px; right: 8px; z-index: 3; }
.pc-body { display: flex; flex-direction: column; gap: 5px; padding: 0 4px; min-width: 0; }
.pc-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pc-value { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.pc-value .val { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.pc-value .val-none { font-size: 14px; font-weight: 600; }
.pc-meta {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.pc-meta > span { overflow: hidden; text-overflow: ellipsis; }
.pc-meta > span:first-child { flex-shrink: 0; }
.pc-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; flex-shrink: 0; }
.pc-rarity { color: color-mix(in srgb, var(--rc) 75%, var(--text-2)); font-weight: 600; }
@media (max-width: 520px) {
  .pet-card { padding: 8px 8px 12px; gap: 10px; border-radius: 16px; }
  .pc-body { padding: 0 3px; gap: 4px; }
  .pc-value .val { font-size: 19px; }
  .pc-name { font-size: 13.5px; }
  .pc-meta { font-size: 11.5px; }
}

/* List mode */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.list-head, .pet-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 2.4fr) 1fr 1fr 1fr 90px;
  gap: 16px; align-items: center;
}
.list-head { padding: 12px 16px 12px 10px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.list-head span:nth-child(n + 3) { text-align: right; }
.pet-row {
  padding: 8px 16px 8px 10px;
  text-decoration: none;
  border-top: 1px solid var(--line);
  transition: background 0.15s;
}
.list-head + .pet-row { border-top: 0; }
.pet-row:hover { background: var(--surface-2); }
.pet-row:focus-visible { outline-offset: -2px; border-radius: 0; }
.pr-tile { width: 52px; }
.pr-tile .art { width: 100%; border-radius: 12px; }
.pr-tile .art-inner { border-radius: 11px; }
.pr-tile .art-inner img { padding: 8%; }
.pr-tile .spark { display: none; }
.pr-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pr-name b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-name .tags { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.pr-rarity { color: color-mix(in srgb, var(--rc) 75%, var(--text-2)); font-weight: 600; }
.pr-name .vtag { font-size: 9.5px; padding: 2px 6px; }
.pr-exists-sm { display: none; }
.pr-value { text-align: right; }
.pet-row .val { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.pr-cell { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; display: flex; justify-content: flex-end; }
@media (max-width: 720px) {
  .list-head { display: none; }
  .pet-row { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; padding: 8px 14px 8px 8px; }
  .pr-tile { width: 48px; }
  .pet-row .pr-hide { display: none; }
  .pr-exists-sm { display: inline; }
  .pr-exists-sm::before { content: ''; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; vertical-align: middle; margin-right: 8px; }
}


/* Card entrance */
.grid .pet-card { animation: rise 0.35s ease both; }
.grid .pet-card:nth-child(n + 13) { animation: none; }
.grid .pet-card:nth-child(2) { animation-delay: 0.02s; } .grid .pet-card:nth-child(3) { animation-delay: 0.04s; }
.grid .pet-card:nth-child(4) { animation-delay: 0.06s; } .grid .pet-card:nth-child(5) { animation-delay: 0.08s; }
.grid .pet-card:nth-child(6) { animation-delay: 0.1s; }  .grid .pet-card:nth-child(n + 7) { animation-delay: 0.12s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Market by rarity, v2 ---------- */
.mbar { height: 30px; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); }
.mbar-seg { position: relative; display: flex; align-items: center; min-width: 6px; border-radius: 7px; overflow: hidden; }
.mbar-seg:first-child { border-radius: 8px 4px 4px 8px; }
.mbar-seg:nth-last-child(2) { border-radius: 4px 8px 8px 4px; }
.mbar-seg::after { content: ''; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent); pointer-events: none; }
.mbar-lab {
  position: relative; z-index: 1; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 11.5px; font-weight: 600; color: rgba(5, 10, 20, 0.85);
}
.mbar-lab b { font-weight: 800; }
.mlegend { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.mleg {
  grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; row-gap: 12px;
  padding: 14px 14px 14px;
  border-radius: 14px;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--rc) 13%, transparent), transparent 60%),
    rgba(255, 255, 255, 0.025);
  border-color: color-mix(in srgb, var(--rc) 16%, var(--line));
}
.mleg:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--rc) 80%, transparent); }
.mleg-ico { width: 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb, var(--rc) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 35%, transparent), 0 0 18px -6px var(--rc); }
.mleg-ico .r-ico { width: 18px; height: 18px; }
.mleg-txt b { font-size: 14px; }
.mleg-txt span { font-size: 12px; }
.mleg-num { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.mleg-num b { font: 800 18px/1 var(--font-display); letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.mleg-num span { display: flex; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mleg-num .tok { width: 12px; height: 12px; margin-right: 3px; vertical-align: 0; }
.mleg-track { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.mleg-track i { display: block; height: 100%; width: var(--w); border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--rc) 60%, transparent), var(--rc)); box-shadow: 0 0 10px var(--rc); }
@media (max-width: 960px) { .mlegend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .mbar { height: 22px; padding: 3px; }
  .mbar-lab { display: none; }
  .mleg { padding: 10px; row-gap: 9px; gap: 8px; }
  .mleg-ico { width: 28px; height: 28px; }
  .mleg-ico .r-ico { width: 14px; height: 14px; }
  .mleg-txt b { font-size: 12.5px; }
  .mleg-num b { font-size: 15px; }
  .mleg-num span { font-size: 11px; }
}

/* ---------- All pets toolbar, v2 ---------- */
.all-head { margin-bottom: 6px; }
.toolbar {
  top: 72px; padding: 12px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 10px;
  border-radius: 18px;
  background: rgba(16, 22, 36, 0.86);
  border: 1px solid var(--line-2);
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.tb-main .search input { height: 46px; border-radius: 13px; background: rgba(0, 0, 0, 0.25); font-size: 15px; }
.tb-main .select, .tb-main .seg { height: 46px; }
.tb-chips { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-chips > .chip-toggle { flex-shrink: 0; }
.tb-chips .chip-sep { flex: 0 0 1px; height: 22px; background: var(--line-2); }
.chips-wrap { position: relative; flex: 1; min-width: 0; }
.chips-wrap .chips { padding: 2px 0; margin: 0; -webkit-mask-image: none; mask-image: none; scroll-behavior: smooth; }
.chips-wrap::before, .chips-wrap::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 56px; z-index: 1; pointer-events: none;
  opacity: 0; transition: opacity 0.2s;
}
.chips-wrap::before { left: 0; background: linear-gradient(90deg, rgb(16, 22, 36), transparent); }
.chips-wrap::after { right: 0; background: linear-gradient(270deg, rgb(16, 22, 36), transparent); }
.chips-wrap.can-prev::before, .chips-wrap.can-next::after { opacity: 1; }
.chips-btn {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: var(--surface-3); border: 1px solid var(--line-3); color: var(--text);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.chips-btn svg { width: 15px; height: 15px; }
.chips-btn.prev { left: 0; } .chips-btn.next { right: 0; }
.chips-wrap.can-prev .chips-btn.prev, .chips-wrap.can-next .chips-btn.next { opacity: 1; pointer-events: auto; }
.chip-r .r-ico { width: 13px; height: 13px; color: var(--rc); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--rc) 60%, transparent)); }
.chip-r[aria-pressed='true'] { box-shadow: 0 0 16px -6px var(--rc); }
.results-meta { margin: 4px 2px 18px; }
.clear-filters { background: none; border: 0; padding: 0; font-size: 13px; font-weight: 700; color: var(--accent); cursor: pointer; }
.clear-filters:hover { text-decoration: underline; }
.clear-filters[hidden] { display: none; }
@media (hover: none) { .chips-btn { display: none; } }
@media (max-width: 720px) {
  .toolbar { position: static; padding: 10px; border-radius: 16px; }
  .tb-chips { flex-wrap: nowrap; }
}
@media (max-width: 520px) {
  .mleg { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; row-gap: 8px; }
  .mleg-num { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; }
  .mleg-txt b { white-space: normal; overflow: visible; }
}

/* Rarity tiles: the rarity's best pet as its icon, rarity symbol as a corner badge */
.mleg-ico { position: relative; overflow: visible; }
.mleg-ico.has-pet { width: 52px; height: 52px; border-radius: 14px; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rc) 40%, transparent), color-mix(in srgb, var(--rc) 8%, #0c111c) 70%); }
.mleg-ico.has-pet img { width: 118%; height: 118%; object-fit: contain; margin-top: -8%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55)); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1.3); }
.mleg:hover .mleg-ico.has-pet img { transform: scale(1.1) rotate(-4deg); }
.mleg-badge { display: grid; place-items: center; }
.mleg-ico.has-pet .mleg-badge {
  position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: #0c111c; border: 1.5px solid color-mix(in srgb, var(--rc) 60%, transparent);
  box-shadow: 0 0 10px -2px var(--rc);
}
.mleg-ico.has-pet .mleg-badge .r-ico { width: 12px; height: 12px; }
@media (max-width: 520px) {
  .mleg-ico.has-pet { width: 40px; height: 40px; border-radius: 11px; }
  .mleg-ico.has-pet .mleg-badge { width: 18px; height: 18px; right: -5px; bottom: -5px; }
  .mleg-ico.has-pet .mleg-badge .r-ico { width: 10px; height: 10px; }
}

/* ---------- Watchlist: star buttons, rail, hint, filter chip ---------- */
.fav-btn {
  position: relative; flex-shrink: 0;
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10, 14, 24, 0.74);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}
/* bigger hit area for thumbs */
.fav-btn::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; }
.fav-btn svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round;
  transition: fill 0.18s, stroke 0.18s, filter 0.18s;
}
.fav-btn:hover { color: #fff; border-color: var(--line-3); background: rgba(24, 32, 50, 0.92); transform: scale(1.08); }
.fav-btn:active { transform: scale(0.92); }
.fav-btn[aria-pressed='true'] {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  background: color-mix(in srgb, var(--gold) 14%, rgba(10, 14, 24, 0.82));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 10%, transparent), 0 4px 16px -4px color-mix(in srgb, var(--gold) 55%, transparent);
}
.fav-btn[aria-pressed='true'] svg { fill: currentColor; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gold) 70%, transparent)); }
.fav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the pop when starring: a bounce plus a ring that bursts out */
.fav-btn.fav-pop { animation: fav-pop 0.42s cubic-bezier(0.3, 1.6, 0.5, 1); }
.fav-btn.fav-pop::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--gold);
  animation: fav-ring 0.5s ease-out forwards;
}
@keyframes fav-pop { 0% { transform: scale(1); } 35% { transform: scale(1.32); } 65% { transform: scale(0.92); } 100% { transform: scale(1); } }
@keyframes fav-ring { from { opacity: 0.9; transform: scale(0.8); } to { opacity: 0; transform: scale(1.9); } }

.pc-fav { position: absolute; top: 8px; left: 8px; z-index: 5; }
.pr-fav { justify-self: end; background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--faint); }
.pr-fav:hover { background: var(--surface-3); border-color: var(--line-2); }
.pet-row:hover .pr-fav:not([aria-pressed='true']) { color: var(--text-2); }
.list-head, .pet-row { grid-template-columns: 52px minmax(0, 2.4fr) 1fr 1fr 1fr 90px 30px; }
@media (max-width: 720px) {
  .pet-row { grid-template-columns: 48px minmax(0, 1fr) auto 30px; gap: 10px; padding-right: 8px; }
}
@media (max-width: 520px) {
  .pc-fav { top: 6px; left: 6px; width: 28px; height: 28px; }
  .pc-fav svg { width: 14px; height: 14px; }
}

/* rail badges sit top-right so the star keeps the top-left corner */
.rail-badge { left: auto; right: 18px; }
@media (max-width: 520px) { .rail-badge { top: 16px; right: 16px; } }
.watch-chg { display: inline-flex; align-items: center; gap: 3px; }
.watch-chg i { font-style: normal; font-size: 8px; }
.rail-badge.watch-chg.up { background: color-mix(in srgb, var(--win) 16%, rgba(10, 14, 24, 0.85)); border-color: color-mix(in srgb, var(--win) 35%, transparent); }
.rail-badge.watch-chg.down { background: color-mix(in srgb, var(--lose) 16%, rgba(10, 14, 24, 0.85)); border-color: color-mix(in srgb, var(--lose) 35%, transparent); }

.watch-slot { display: flex; min-width: 0; }
.watch-slot > .rail-sec { flex: 1; min-width: 0; }
.watch-slot:empty { display: none; }
.rail-sec[data-rail-sec='watch'] .rail-title h2 { display: inline-flex; align-items: center; gap: 8px; }
.rail-sec[data-rail-sec='watch'] .rail-title h2::before {
  content: ''; width: 18px; height: 18px; flex-shrink: 0;
  background: var(--gold);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.84 5.76 6.36.92-4.6 4.48 1.08 6.33L12 17.3l-5.68 2.99 1.08-6.33-4.6-4.48 6.36-.92z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.84 5.76 6.36.92-4.6 4.48 1.08 6.33L12 17.3l-5.68 2.99 1.08-6.33-4.6-4.48 6.36-.92z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 6px rgba(255, 207, 74, 0.5));
}

.watch-hint {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-md);
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 7%, var(--surface)), var(--surface) 55%);
  color: var(--text-2); font-size: 14px; line-height: 1.4;
  transition: opacity 0.2s, transform 0.2s;
}
.watch-hint { align-self: flex-start; max-width: 100%; }
.watch-hint.out { opacity: 0; transform: translateY(-4px); }
.watch-hint > span:nth-child(2) { flex: 1; min-width: 0; }
.watch-hint b { color: var(--gold); font-weight: 800; }
.watch-hint-ico {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent);
}
.watch-hint-ico svg { width: 15px; height: 15px; fill: currentColor; }
.watch-hint-x {
  width: 32px; height: 32px; padding: 0; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.watch-hint-x:hover { background: var(--surface-3); color: var(--text); }
.watch-hint-x svg { width: 15px; height: 15px; }
@media (max-width: 520px) { .watch-hint { font-size: 13.5px; gap: 10px; } }

.chip-watch .box.star { border: 0; border-radius: 0; width: 15px; height: 15px; }
.chip-watch .box.star svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; }
.chip-watch[aria-pressed='true'] .box.star { background: none; }
.chip-watch[aria-pressed='true'] .box.star::after { content: none; }
.chip-watch[aria-pressed='true'] .box.star svg { fill: var(--gold); stroke: var(--gold); }
.chip-watch[aria-pressed='true'] { border-color: color-mix(in srgb, var(--gold) 40%, transparent); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); }

.watch-empty-ico { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; margin-bottom: 10px; color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.watch-empty-ico svg { width: 24px; height: 24px; fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  .fav-btn, .fav-btn.fav-pop, .fav-btn.fav-pop::after, .watch-hint { animation: none; transition: none; }
}

/* ---------- Market by rarity bar, v3 ---------- */
.mbar { height: 44px; padding: 5px; gap: 4px; border-radius: 16px; overflow: visible; }
.mbar-seg {
  min-width: 10px; border-radius: 10px; overflow: visible; gap: 6px; padding: 0 10px;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1.3), opacity 0.2s, filter 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 16px -4px color-mix(in srgb, var(--rc) 70%, transparent), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.mbar-seg:first-child { border-radius: 12px 6px 6px 12px; }
.mbar-seg:nth-last-child(2) { border-radius: 6px 12px 12px 6px; }
.mbar-seg.tiny { min-width: 12px; padding: 0; }
.mbar-seg.mid { min-width: 30px; justify-content: center; padding: 0; }
.mbar-seg::after { border-radius: inherit; }
/* slow shine sweeping across the whole bar */
.mbar-seg::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%) 0 0 / 250% 100% no-repeat;
  animation: mbar-shine 6s ease-in-out infinite;
}
@keyframes mbar-shine { 0% { background-position: 150% 0; } 45%, 100% { background-position: -150% 0; } }
.mbar:hover .mbar-seg { opacity: 0.45; }
.mbar .mbar-seg:hover { opacity: 1; transform: translateY(-3px) scaleY(1.08); filter: brightness(1.12); z-index: 2; box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--rc) 90%, transparent); }
.mbar-pet {
  position: relative; z-index: 1; width: 40px; height: 40px; margin: -8px 0 -6px -6px; flex-shrink: 0;
  object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}
.mbar-ico { position: relative; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(5, 10, 20, 0.28); color: #fff; flex-shrink: 0; }
.mbar-ico .r-ico { width: 12px; height: 12px; color: #fff; filter: none; }
.mbar-lab { padding: 0; font-size: 12.5px; font-weight: 700; color: rgba(5, 10, 20, 0.88); }
@media (max-width: 720px) {
  .mbar { height: 30px; padding: 4px; gap: 3px; }
  .mbar-pet, .mbar-lab { display: none; }
  .mbar-seg.big { justify-content: center; padding: 0; }
  .mbar-ico { width: 16px; height: 16px; }
  .mbar-ico .r-ico { width: 10px; height: 10px; }
}
@media (prefers-reduced-motion: reduce) { .mbar-seg::before { animation: none; opacity: 0; } }
