/* TapTrade — Tap Simulator: Reborn values
   Design system: tokens, type, shared components, header/footer, pet art. */
:root {
  /* Neutrals: navy-black */
  --bg: #0b0f19;
  --bg-2: #0e1320;
  --surface: #121826;
  --surface-2: #182032;
  --surface-3: #1f283d;
  --surface-4: #283350;
  --inset: #0c111c;
  --line: rgba(255, 255, 255, 0.065);
  --line-2: rgba(255, 255, 255, 0.1);
  --line-3: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --text-2: #b8c1d3;
  --muted: #8792a8;
  --faint: #586379;

  /* Brand */
  --accent: #2f8cff;
  --accent-hover: #55a3ff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 140, 255, 0.12);
  --accent-2: #ff7a59;
  --win: #2ee6a0;
  --fair: #ffc94d;
  --lose: #ff5b6e;
  --gold: #ffcf4a;

  /* Shape & depth */
  --radius: 18px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 80px -24px rgba(0, 0, 0, 0.85);
  --ring: 0 0 0 4px rgba(47, 140, 255, 0.14);

  /* Spacing scale (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* Type scale */
  --fs-xs: 11.5px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 26px;
  --fs-2xl: clamp(28px, 4vw, 38px);
  --fs-display: clamp(36px, 6vw, 64px);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.9, 0.45, 1);
  --header-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/1.5 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(900px 360px at 50% -160px, rgba(47, 140, 255, 0.045), transparent 70%);
}
::selection { background: rgba(47, 140, 255, 0.28); color: #fff; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 900px) { .wrap { padding: 0 24px; } }

kbd, .kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  font: 600 11px/1 var(--font); color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 6px;
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 11, 13, 0.82);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 28px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; border-radius: 10px; }
.brand img { width: 32px; height: 32px; display: block; border-radius: 9px; }
.brand-name { display: block; font: 800 19px/1 var(--font-display); letter-spacing: -0.035em; }
.brand-name span { color: var(--accent); }
.brand-sub { display: block; font: 600 10px/1 var(--font); color: var(--muted); letter-spacing: 0.09em; text-transform: uppercase; margin-top: 5px; }

.nav { display: flex; gap: 2px; }
.nav a {
  position: relative;
  text-decoration: none;
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 17px; height: 17px; display: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { color: var(--text); }
.nav a.active::after {
  content: ''; position: absolute; left: 13px; right: 13px; bottom: -14px; height: 2px;
  border-radius: 2px; background: var(--accent);
}

.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Header search button (opens the pet search popup) */
.search-btn {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 8px 0 13px;
  width: 280px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--muted); font-size: 14px; text-align: left;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.search-btn:hover { border-color: var(--line-3); background: var(--surface-2); color: var(--text-2); }
.search-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.search-btn span { flex: 1; }
.search-btn kbd { height: 22px; }
@media (max-width: 1040px) { .search-btn { width: 210px; } .topbar .wrap { gap: 18px; } }
@media (max-width: 880px) { .search-btn kbd { display: none; } .search-btn { width: 150px; } .nav a { padding: 0 10px; } .nav a.active::after { left: 10px; right: 10px; } }

/* Mobile: compact top bar + bottom tab bar */
@media (max-width: 720px) {
  :root { --header-h: 56px; }
  /* backdrop-filter would make the fixed nav position itself inside the header */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10, 11, 13, 0.97); }
  .brand img { width: 30px; height: 30px; }
  .brand-name { font-size: 18px; }
  .search-btn { width: 40px; padding: 0; justify-content: center; border-radius: 12px; color: var(--text-2); }
  .search-btn span, .search-btn kbd { display: none; }
  .nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    margin: 0;
    justify-content: space-around;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(12, 13, 16, 0.94);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-top: 1px solid var(--line);
    z-index: 50;
  }
  .nav a { flex-direction: column; justify-content: center; gap: 4px; height: 52px; font-size: 11px; font-weight: 600; padding: 0 4px; border-radius: 12px; flex: 1; color: var(--muted); letter-spacing: 0; }
  .nav a svg { display: block; width: 22px; height: 22px; }
  .nav a:hover { background: transparent; }
  .nav a.active { background: transparent; color: var(--text); }
  .nav a.active svg { color: var(--accent); }
  .nav a.active::after { left: 50%; right: auto; width: 18px; margin-left: -9px; top: -6px; bottom: auto; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
}

main { flex: 1; padding: 32px 0 64px; }
@media (max-width: 720px) { main { padding: 22px 0 40px; } }
.view { animation: fadeIn 0.25s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Type & layout bits ---------- */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.03em; margin: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.08; letter-spacing: -0.04em; }
.page-head p { margin: 8px 0 0; color: var(--text-2); max-width: 60ch; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.eyebrow::before { content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%; box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.16); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.section { padding: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.section-head h2 { font-size: var(--fs-md); font-weight: 700; letter-spacing: -0.02em; }
.section-head span { font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-weight: 650; font-size: 14px; letter-spacing: -0.01em;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, scale 0.42s var(--spring);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-3); }
/* Squash on press, springy release: shared by buttons, chips, segmented buttons and icon buttons */
.btn:active, .chip:active, .seg button:active, .icon-btn:active { scale: 0.95; transition-duration: 0.1s; }
.chip:active, .seg button:active { scale: 0.93; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 24px -10px rgba(47, 140, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger:hover { border-color: rgba(255, 91, 110, 0.5); color: var(--lose); background: rgba(255, 91, 110, 0.06); }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; padding: 0;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2);
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, scale 0.42s var(--spring);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--line-3); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Inputs ---------- */
.search { flex: 1 1 260px; position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 44px;
  padding: 0 40px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search input:hover { border-color: var(--line-3); }
.search input:focus { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface-2); }
.search input::placeholder { color: var(--muted); }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 720px) { .search kbd { display: none; } }

.input {
  width: 100%; height: 44px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: var(--ring); }

.select {
  height: 44px; padding: 0 38px 0 14px;
  border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%237d828d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  appearance: none; -webkit-appearance: none;
  font-weight: 600; font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.select:hover { border-color: var(--line-3); }
.select:focus-visible { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.select option { background: var(--surface-2); }

/* Segmented control */
.seg { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 3px; height: 44px; }
.seg button {
  border: 0; background: transparent; border-radius: 9px; padding: 0 12px;
  font-weight: 600; font-size: 13px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background 0.15s, color 0.15s, scale 0.42s var(--spring);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed='true'] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.4); }
.seg button svg { width: 18px; height: 18px; }
.seg .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Chips */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  height: 32px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, scale 0.42s var(--spring);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rc, var(--muted)); }
.chip:hover { color: var(--text); border-color: var(--line-3); }
.chip[aria-pressed='true'] {
  color: var(--text);
  background: color-mix(in srgb, var(--rc, var(--accent)) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--rc, var(--accent)) 50%, transparent);
}
.chip .count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip-toggle .box { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--muted); display: grid; place-items: center; }
.chip-toggle[aria-pressed='true'] .box { background: var(--accent); border-color: var(--accent); }
.chip-toggle[aria-pressed='true'] .box::after { content: ''; width: 7px; height: 4px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* Empty state */
.empty:not(.slot) {
  text-align: center; padding: 56px 20px; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  background: radial-gradient(400px 160px at 50% 0%, rgba(255, 255, 255, 0.025), transparent 70%);
}
.empty:not(.slot) h3 { color: var(--text); font-size: 18px; letter-spacing: -0.02em; margin-bottom: 6px; }
.empty:not(.slot) .btn { margin-top: 16px; }

/* ---------- Badges & values ---------- */
.rarity {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--rc) 72%, white);
  height: 22px; padding: 0 9px 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rc) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc) 24%, transparent);
  white-space: nowrap;
}
.rarity::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 6px color-mix(in srgb, var(--rc) 70%, transparent); }

.vtag {
  display: inline-flex; align-items: center;
  height: 20px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0 7px; border-radius: 6px; white-space: nowrap;
}
.vtag-golden { color: #3a2800; background: linear-gradient(135deg, #ffe592, #f2b13a); }
.vtag-rainbow { color: #fff; background: linear-gradient(90deg, #f0566f, #f0a63e, #2fcf9a, #4a9cf0, #a576f0); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35); }
.vtag-diamond { color: #082a3c; background: linear-gradient(135deg, #effcff, #9fe6ff 60%, #cdf4ff); }

.val { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.val-oc {
  display: inline-block;
  font: 800 12px/1 var(--font-display); letter-spacing: 0.06em;
  padding: 5px 8px; border-radius: 7px;
  color: #2b1600; background: linear-gradient(135deg, #ffd66b, #ff9a3c);
  box-shadow: 0 0 16px -6px rgba(255, 170, 60, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.val-none { color: var(--muted); font-size: 0.82em; font-weight: 600; letter-spacing: 0; }

.trend { font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.trend.up { color: var(--win); }
.trend.down { color: var(--lose); }
.trend.flat { color: var(--muted); }
.trend .tdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.demand { display: inline-flex; align-items: center; gap: 6px; }
.demand.none { color: var(--muted); }
.dbars { display: inline-flex; gap: 2px; }
.dbars i { width: 4px; height: 11px; border-radius: 2px; background: var(--surface-4); }
.dbars i.on { background: var(--accent); }
.demand b { font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- Pet art tile ----------
   A dark inset tile with a soft rarity glow. Real renders (transparent PNG) sit centred on the glow;
   without one, a refined initials medallion stands in. Golden / Rainbow / Diamond get their own frame. */
.art {
  --rc: #9aa7b8;
  --frame: linear-gradient(165deg, color-mix(in srgb, var(--rc) 30%, rgba(255, 255, 255, 0.1)), rgba(255, 255, 255, 0.04) 42%, color-mix(in srgb, var(--rc) 16%, rgba(255, 255, 255, 0.03)));
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  padding: 1px;
  background: var(--frame);
  isolation: isolate;
  container-type: inline-size;
}
.art-inner {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 13px;
  overflow: hidden;
  display: grid; place-items: center;
  background:
    radial-gradient(58% 52% at 50% 56%, color-mix(in srgb, var(--rc) 24%, transparent), transparent 72%),
    radial-gradient(130% 70% at 50% -10%, rgba(255, 255, 255, 0.055), transparent 60%),
    linear-gradient(180deg, #16181d, #0d0e11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 -20px 40px -20px rgba(0, 0, 0, 0.5);
}
/* soft floor shadow under the subject */
.art-inner::before {
  content: '';
  position: absolute; left: 24%; right: 24%; bottom: 13%; height: 7%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}
/* Placeholder medallion */
.art-ph {
  position: relative; z-index: 1;
  width: 60%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--rc) 16%, #1a1c22), color-mix(in srgb, var(--rc) 6%, #111216));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--rc) 38%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--rc) 50%, rgba(255, 255, 255, 0.3)),
    0 0 0 4cqw color-mix(in srgb, var(--rc) 5%, transparent),
    0 6cqw 14cqw -4cqw rgba(0, 0, 0, 0.6),
    0 0 18cqw -2cqw color-mix(in srgb, var(--rc) 32%, transparent);
}
.art-initials {
  font: 750 clamp(11px, 20cqw, 60px)/1 var(--font-display);
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--rc) 28%, #fff);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 0 12px color-mix(in srgb, var(--rc) 45%, transparent);
}
.art-inner img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  object-fit: contain; padding: 11%;
  filter: drop-shadow(0 4cqw 5cqw rgba(0, 0, 0, 0.5));
  transition: transform 0.3s var(--ease);
}
.art-inner.has-img .art-ph, .art-inner.has-img .art-initials { visibility: hidden; }
.art-inner.has-img {
  background:
    radial-gradient(50% 46% at 50% 54%, color-mix(in srgb, var(--rc) 40%, transparent), transparent 74%),
    radial-gradient(130% 70% at 50% -10%, rgba(255, 255, 255, 0.055), transparent 60%),
    linear-gradient(180deg, #16181d, #0d0e11);
}
.art.lg .art-inner img { padding: 9%; }

/* Golden: warm gold frame, amber glow, slow light sweep */
.art.v-golden { --rc: #ffc444; background: linear-gradient(150deg, #ffeaa8, #d39a2c 32%, rgba(201, 141, 34, 0.35) 62%, #f5c766); }
.art.v-golden .art-inner {
  background:
    radial-gradient(58% 52% at 50% 56%, rgba(255, 190, 60, 0.26), transparent 72%),
    radial-gradient(130% 70% at 50% -10%, rgba(255, 226, 150, 0.08), transparent 60%),
    linear-gradient(180deg, #1b1710, #0f0d09);
}
.art.v-golden .art-ph {
  background: linear-gradient(180deg, #3a2c10, #1d160a);
  box-shadow:
    inset 0 0 0 1px rgba(255, 205, 100, 0.5),
    inset 0 1px 0 rgba(255, 236, 180, 0.6),
    0 0 0 4cqw rgba(255, 196, 70, 0.05),
    0 6cqw 14cqw -4cqw rgba(0, 0, 0, 0.6),
    0 0 18cqw -2cqw rgba(255, 190, 60, 0.4);
}
.art.v-golden .art-initials {
  background: linear-gradient(180deg, #fff3cc, #f3be4f 70%, #c98a1c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
}
.art.v-golden .art-inner::after {
  content: '';
  position: absolute; inset: 0; z-index: 3; border-radius: inherit;
  /* the sweep moves via background-position so it never leaves the tile */
  background: linear-gradient(115deg, transparent 42%, rgba(255, 240, 200, 0.14) 50%, transparent 58%) 0 0 / 300% 100% no-repeat;
  animation: shimmer 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 55%, 100% { background-position: 0% 0; } }

/* Rainbow: slowly turning spectrum frame */
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.art.v-rainbow {
  --rc: #9a8cff;
  padding: 1.5px;
  background: conic-gradient(from var(--ang), #f0566f, #f0a63e, #ecd25c, #2fcf9a, #4a9cf0, #a576f0, #f0566f);
  animation: spin 8s linear infinite;
}
.art.v-rainbow .art-inner {
  background:
    radial-gradient(40% 36% at 36% 44%, rgba(240, 86, 111, 0.18), transparent 70%),
    radial-gradient(40% 36% at 64% 44%, rgba(74, 156, 240, 0.2), transparent 70%),
    radial-gradient(44% 38% at 50% 68%, rgba(47, 207, 154, 0.16), transparent 70%),
    radial-gradient(130% 70% at 50% -10%, rgba(255, 255, 255, 0.05), transparent 60%),
    linear-gradient(180deg, #17171f, #0e0e13);
}
.art.v-rainbow .art-ph {
  background: linear-gradient(180deg, #1f1e2a, #121218);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 6cqw 14cqw -4cqw rgba(0, 0, 0, 0.6),
    -6cqw 0 16cqw -4cqw rgba(240, 86, 111, 0.28),
    6cqw 0 16cqw -4cqw rgba(74, 156, 240, 0.3);
}
.art.v-rainbow .art-initials {
  background: linear-gradient(100deg, #ff8a9c, #ffd27a, #74f0c6, #82bdff, #c7a6ff);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; text-shadow: none;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.5));
}
@keyframes spin { to { --ang: 360deg; } }

/* Diamond: icy frame, faint facets, a couple of quiet glints */
.art.v-diamond { --rc: #5aa8ff; background: linear-gradient(150deg, #f2fdff, #7fcff0 30%, rgba(90, 160, 210, 0.3) 62%, #c9f2ff); }
.art.v-diamond .art-inner {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.02) 50% 75%, transparent 75%) 0 0 / 22cqw 22cqw,
    radial-gradient(58% 52% at 50% 56%, rgba(143, 227, 255, 0.24), transparent 72%),
    radial-gradient(130% 70% at 50% -10%, rgba(220, 248, 255, 0.08), transparent 60%),
    linear-gradient(180deg, #121a20, #0b0f13);
}
.art.v-diamond .art-ph {
  background: linear-gradient(180deg, #17303d, #0e1a22);
  box-shadow:
    inset 0 0 0 1px rgba(170, 235, 255, 0.45),
    inset 0 1px 0 rgba(235, 252, 255, 0.7),
    0 0 0 4cqw rgba(143, 227, 255, 0.05),
    0 6cqw 14cqw -4cqw rgba(0, 0, 0, 0.6),
    0 0 18cqw -2cqw rgba(143, 227, 255, 0.4);
}
.art.v-diamond .art-initials {
  background: linear-gradient(180deg, #ffffff, #a8e9ff 75%, #6cc6ec);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
}
.spark {
  position: absolute; z-index: 4;
  width: 9%; aspect-ratio: 1;
  background: #fff;
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
  filter: drop-shadow(0 0 3px #bff0ff);
  animation: twinkle 3.2s ease-in-out infinite;
  pointer-events: none;
  opacity: 0;
}
.spark.s1 { top: 10%; right: 12%; }
.spark.s2 { bottom: 16%; left: 12%; width: 7%; animation-delay: 1.1s; }
.spark.s3 { top: 44%; right: 8%; width: 5%; animation-delay: 2.2s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.4) rotate(0); } 50% { opacity: 0.9; transform: scale(1) rotate(45deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .spark { opacity: 0.7; }
}

/* ---------- Modal / pet search popup ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 6, 8, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: min(12vh, 110px) 20px 20px;
  animation: fadeIn 0.15s ease;
}
.modal {
  width: min(620px, 100%); max-height: min(640px, 80vh);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: pop 0.18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.modal-head .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-2); }
.modal-head .icon-btn { width: 32px; height: 32px; border-radius: 9px; }
.modal-head .icon-btn svg { width: 16px; height: 16px; }
.modal .search { flex: none; }
.modal .search input { height: 48px; font-size: 16px; background: var(--bg-2); border-radius: 12px; }
.modal .search input:focus { background: var(--bg-2); }
.picker-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--surface-4) transparent; }
.pick {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 6px 12px 6px 6px; border-radius: 12px; border: 0; background: transparent; text-align: left; width: 100%;
  transition: background 0.1s;
}
.pick:hover { background: var(--surface-2); }
.pick.kb { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.pick .art { width: 44px; border-radius: 11px; }
.pick .art-inner { border-radius: 10px; }
.pick .nm { font-weight: 650; font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.pick .meta { display: flex; gap: 6px; margin-top: 4px; align-items: center; }
.pick .meta .rarity { height: 19px; font-size: 10.5px; padding: 0 7px; }
.pick .meta .vtag { height: 17px; font-size: 9px; padding: 0 5px; }
.pick > .val { font-size: 15px; }
.pick > .val-none { font-size: 12px; }
.picker-list .empty { border: 0; padding: 40px 16px; }
@media (max-width: 600px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 90vh; height: 90vh; border-radius: 22px 22px 0 0; border-bottom: 0; animation: sheet 0.22s var(--ease); }
  .modal-head { padding-top: 22px; position: relative; }
  .modal-head::before { content: ''; position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--surface-4); }
  .picker-list { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  transform: translate(-50%, 16px); opacity: 0;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface-3); color: var(--text); font-weight: 600; font-size: 14px;
  padding: 11px 16px 11px 12px; border-radius: 12px;
  border: 1px solid var(--line-3);
  box-shadow: var(--shadow-lg);
  transition: transform 0.22s var(--ease), opacity 0.22s ease; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast::before {
  content: ''; flex-shrink: 0; width: 8px; height: 8px; margin: 0 2px 0 4px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(47, 140, 255, 0.16);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (max-width: 720px) { .toast { bottom: calc(80px + env(safe-area-inset-bottom)); } }

.loading { display: grid; place-items: center; padding: 80px 0; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin2 0.8s linear infinite; margin-bottom: 12px; }
@keyframes spin2 { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 48px 0 0; color: var(--muted); font-size: 14px; background: linear-gradient(180deg, var(--bg-2), var(--bg)); }
.foot-top { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: 40px; padding-bottom: 40px; }
.foot-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; max-width: 360px; }
.foot-brand .brand img { width: 30px; height: 30px; }
.foot-brand p { margin: 0; color: var(--muted); line-height: 1.6; }
.foot-updated {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.foot-updated::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.16); }
.foot-updated:empty { display: none; }
.foot-col h3, .foot-links h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); margin-bottom: 14px; }
.foot-links { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.foot-links a { color: var(--muted); text-decoration: none; font-weight: 500; transition: color 0.15s; }
.foot-links a:hover { color: var(--text); }
.foot-keys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.foot-keys li { display: flex; align-items: center; gap: 10px; }
.foot-keys .keys { display: inline-flex; gap: 4px; min-width: 64px; }
.foot-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding: 20px 0 26px; font-size: 13px; color: var(--faint);
}
.foot-bottom span:first-child { color: var(--muted); }
@media (max-width: 860px) {
  .foot-top { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
  .foot-brand { grid-column: 1 / -1; max-width: none; }
}
@media (max-width: 720px) {
  .footer { padding-top: 36px; }
  .foot-col.keys-col { display: none; }
  .foot-top { grid-template-columns: 1fr; padding-bottom: 28px; }
  .foot-links { flex-direction: row; flex-wrap: wrap; gap: 10px 20px; }
  .foot-links h3 { width: 100%; margin-bottom: 2px; }
}

/* ---------- Loading skeleton ---------- */
.sk { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%) 0 0 / 200% 100%; border-radius: var(--radius); animation: sk 1.4s linear infinite; border: 1px solid var(--line); }
.sk-hero { height: 240px; margin-bottom: 24px; border-radius: var(--radius-lg); }
.sk-bar { height: 44px; margin-bottom: 20px; border-radius: 12px; width: 60%; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 14px; }
.sk-card { aspect-ratio: 0.74; }
@keyframes sk { to { background-position: -200% 0; } }
@media (max-width: 520px) { .sk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .sk-hero { height: 200px; } .sk-bar { width: 100%; } }
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; cursor: pointer; border-radius: 50%;
  background: var(--surface-4) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3b8c2' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M7 7l10 10M17 7 7 17'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* Variant tints on real pet renders (the image files are the Normal pet) */
.art.v-golden .art-inner img { filter: sepia(0.85) saturate(2.4) hue-rotate(-12deg) brightness(1.08) contrast(1.05) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); }
.art.v-diamond .art-inner img { filter: grayscale(1) brightness(0.65) sepia(1) hue-rotate(190deg) saturate(7) contrast(1.2) brightness(1.1) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); }
.art.v-rainbow .art-inner img { filter: saturate(1.6) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); animation: rainbow-hue 6s linear infinite; }
@keyframes rainbow-hue { from { filter: saturate(1.6) hue-rotate(0deg) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); } to { filter: saturate(1.6) hue-rotate(360deg) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); } }
@media (prefers-reduced-motion: reduce) { .art.v-rainbow .art-inner img { animation: none; filter: saturate(1.6) hue-rotate(40deg); } }
