:root {
  color-scheme: dark;
  --bg: #100e1c;
  --bg-2: #171429;
  --panel: #1d1934;
  --panel-2: #262043;
  --line: #3a3163;
  --text: #ece8ff;
  --muted: #a69fcb;
  --accent: #ff7ac6;
  --accent-2: #5ee7ff;
  --gold: #ffd447;

  --tier-cyan: #4ef0ff;
  --tier-yellow: #ffd447;
  --tier-white: #f4f2ff;
  --tier-red: #ff5d6c;

  --el-neutral: #c9c2ae;
  --el-fire: #ff6b3d;
  --el-water: #3da5ff;
  --el-grass: #6fd64e;
  --el-electric: #ffd23d;
  --el-ice: #8ae8ff;
  --el-ground: #c9894a;
  --el-dark: #a66bff;
  --el-dragon: #ff5fd2;

  --radius: 16px;
  --font-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 10% -10%, #3b1d5e55, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #0d4d6355, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--accent-2);
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  line-height: 1.15;
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
}

/* ---- Hero ---- */

.hero {
  padding: 56px 16px 40px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent-2), #b388ff 45%, var(--accent) 75%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 24px #ff7ac633);
}

.hero-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 600;
}

.updated {
  display: inline-block;
  margin: 18px 0 0;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 0.9rem;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 48px;
  display: grid;
  gap: 28px;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 10px 40px #0006;
}

.panel > h2,
.index-head h2 {
  font-size: 2rem;
}

.section-sub {
  margin: 4px 0 20px;
  color: var(--muted);
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.notice {
  margin: 22px 0 0;
  padding: 14px 18px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #ffd4470f;
  color: var(--text);
  white-space: pre-line;
}

.notice:empty {
  display: none;
}

.notice.requests {
  border-left-color: var(--accent);
  background: #ff7ac610;
  font-weight: 700;
}

/* ---- Index cards ---- */

.index-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.jump {
  display: flex;
  gap: 10px;
}

.jump a {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.jump a:hover {
  border-color: var(--accent-2);
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition:
    transform 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-2);
  box-shadow: 0 6px 24px #5ee7ff22;
}

.card-icon {
  position: relative;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: var(--panel-2);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-icon {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  color: var(--muted);
}

.card-body {
  min-width: 0;
}

.card-name {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-price {
  color: var(--gold);
  font-weight: 800;
}

.card-tagline {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.card.sold .card-icon img,
.card.sold .card-name,
.card.sold .card-tagline {
  opacity: 0.45;
}

.card.sold .card-price {
  color: var(--tier-red);
}

.stamp {
  position: absolute;
  inset: auto 0 8px;
  margin: 0 auto;
  width: max-content;
  padding: 0 6px;
  border: 2px solid var(--tier-red);
  border-radius: 4px;
  color: var(--tier-red);
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transform: rotate(-12deg);
  background: #100e1ccc;
}

/* ---- Pal sections ---- */

#pal-sections {
  display: grid;
  gap: 28px;
}

#pal-sections:empty {
  display: none;
}

.pal-head {
  display: flex;
  gap: 22px;
  align-items: center;
}

.pal-icon {
  flex: none;
  width: 128px;
  height: 128px;
  border-radius: 20px;
  background: radial-gradient(circle at 30% 25%, #ffffff18, transparent 60%), var(--panel-2);
  border: 2px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.pal-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pal-icon .no-icon {
  font-size: 3.5rem;
}

.pal-title {
  flex: 1;
  min-width: 0;
}

.pal-title h2 {
  font-size: 2.2rem;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 2px 0 10px;
  color: var(--muted);
  font-weight: 700;
}

.dot {
  opacity: 0.6;
}

.gender {
  font-size: 1.2rem;
}

.gender.male {
  color: #5eb1ff;
}

.gender.female {
  color: #ff7ac6;
}

.stars {
  color: var(--gold);
  letter-spacing: 2px;
}

.price-tag {
  flex: none;
  align-self: flex-start;
  padding: 10px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffd44726, #ff7ac61c);
  border: 2px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
}

.price-tag small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.price-tag.is-sold {
  border-color: var(--tier-red);
  color: var(--tier-red);
  background: #ff5d6c14;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

.pal.sold {
  border-color: #ff5d6c55;
}

.pal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 28px;
  margin-top: 24px;
}

.block + .block {
  margin-top: 22px;
}

.block h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.description {
  margin: 0 0 22px;
  font-size: 1.05rem;
  white-space: pre-line;
}

/* ---- Alpha & partner skill ---- */

.alpha-mark {
  margin-right: 6px;
  color: var(--gold);
}

.alpha-badge {
  display: inline-block;
  margin-left: 14px;
  padding: 2px 12px;
  border-radius: 999px;
  vertical-align: middle;
  background: linear-gradient(135deg, var(--gold), #ff8a3d);
  color: #1a1206;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 0 18px #ffd44744;
}

.pal-icon:has(+ .pal-title .alpha-badge) {
  border-color: var(--gold);
  box-shadow: 0 0 22px #ffd44755;
}

.partner {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #ff7ac655;
  background: linear-gradient(135deg, #ff7ac614, #5ee7ff0d);
}

.partner-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.partner-tech {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
}

.partner-desc {
  margin: 4px 0 0;
  white-space: pre-line;
}

/* ---- Badges ---- */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-weight: 800;
  font-size: 0.9rem;
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.badge-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.badge.work {
  color: var(--accent-2);
}

.el-neutral { color: var(--el-neutral); }
.el-fire { color: var(--el-fire); }
.el-water { color: var(--el-water); }
.el-grass { color: var(--el-grass); }
.el-electric { color: var(--el-electric); }
.el-ice { color: var(--el-ice); }
.el-ground { color: var(--el-ground); }
.el-dark { color: var(--el-dark); }
.el-dragon { color: var(--el-dragon); }

/* ---- Traits ---- */

.traits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.trait {
  --tier: var(--tier-white);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--tier) 55%, transparent);
  background: color-mix(in srgb, var(--tier) 10%, var(--panel));
  color: var(--tier);
  font-weight: 800;
  cursor: help;
}

.trait:focus-visible,
.skill:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.tier-cyan {
  --tier: var(--tier-cyan);
  box-shadow: 0 0 14px #4ef0ff33;
}
.tier-yellow { --tier: var(--tier-yellow); }
.tier-white { --tier: var(--tier-white); }
.tier-red { --tier: var(--tier-red); }

.q {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0.8;
}

/* ---- Active skills ---- */

.skills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.skill {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 6px;
  border-radius: 10px;
  background: var(--panel-2);
}

.skill[data-tip] {
  cursor: help;
}

.skill .badge {
  justify-content: center;
}

.skill-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.skill-name .q {
  color: var(--muted);
}

.skill-power {
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---- Stats & IVs ---- */

.stats {
  display: grid;
  grid-template-columns: 1fr auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.stats dt,
.stats dd {
  margin: 0;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
}

.stats dt:first-of-type,
.stats dd:first-of-type {
  border-top: none;
}

.stats dt {
  color: var(--muted);
  font-weight: 700;
}

.stats dd {
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.iv-row {
  display: grid;
  grid-template-columns: 64px 1fr 96px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.iv-label {
  color: var(--muted);
  font-weight: 700;
}

.iv-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.iv-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #b388ff, var(--accent-2));
}

.iv-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #5ee7ff40;
  border-radius: 999px;
}

.iv-value {
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

/* ---- Photos ---- */

.photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}

button.zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  cursor: zoom-in;
}

button.zoom img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.25s;
}

button.zoom:hover img {
  transform: scale(1.04);
}

.back {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.back:hover {
  color: var(--accent-2);
}

/* ---- Bounties ---- */

.bounty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

.bounty {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px 14px;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.bounty .trait {
  grid-row: span 2;
}

.bounty-price {
  color: var(--gold);
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 800;
  text-align: right;
}

.bounty-status {
  justify-self: end;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.is-wanted {
  background: #6fd64e22;
  color: #8ff06c;
}

.is-claimed {
  background: #a69fcb22;
  color: var(--muted);
}

.bounty.claimed .trait,
.bounty.claimed .bounty-price {
  opacity: 0.45;
}

.bounty.claimed .bounty-price {
  text-decoration: line-through;
}

/* ---- Find me ---- */

.find-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.find-grid figure {
  margin: 0;
}

.find-grid figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.find-grid button.zoom img {
  aspect-ratio: auto;
}

footer {
  padding: 0 16px 40px;
  text-align: center;
}

.to-top {
  color: var(--muted);
  text-decoration: none;
}

/* ---- Tooltip & lightbox ---- */

.tooltip {
  position: absolute;
  z-index: 10;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b0a14f2;
  box-shadow: 0 8px 30px #000a;
  color: var(--text);
  font-size: 0.9rem;
  white-space: pre-line;
  pointer-events: none;
}

.tooltip strong {
  display: block;
  font-family: var(--font-head);
  font-size: 1.05rem;
}

.lightbox {
  max-width: 94vw;
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

.lightbox::backdrop {
  background: #05040acc;
}

.lightbox img {
  max-width: 94vw;
  max-height: 94vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #000a;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

/* ---- Narrow screens ---- */

@media (max-width: 820px) {
  .panel {
    padding: 20px 16px;
  }
  .pal-head {
    flex-wrap: wrap;
  }
  .pal-icon {
    width: 96px;
    height: 96px;
  }
  .pal-body {
    grid-template-columns: 1fr;
  }
  .traits {
    grid-template-columns: 1fr;
  }
  .photos {
    grid-template-columns: 1fr;
  }
  .skill {
    grid-template-columns: 96px 1fr auto;
  }
}
