/* Bestiary app styles — chrome/tokens come from css/site.css */
:root {
  --panel: #2a1848;
  --panel-2: #341e58;
  --fire: #e85d3a;
  --water: #3aa0e8;
  --grass: #4cbf6a;
  --rock: #c4a06a;
  --lightning: #f0c53a;
}

.bestiary-shell {
  width: min(1100px, calc(100% - 28px));
  max-width: 100%;
  box-sizing: border-box;
}

body.bestiary-page {
  overflow-x: clip;
}

.bestiary-shell.admin-wide,
.bestiary-shell.tier-wide {
  width: min(1280px, calc(100% - 28px));
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 18px;
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(18, 8, 32, 0.45);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.app-nav a:hover,
.app-nav a.active {
  border-color: var(--gold);
  color: var(--gold);
}

.filters {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.search {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 6, 24, 0.7);
  color: var(--ink);
  font-size: 16px;
}

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

.filter-row select,
.filter-row button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
}

.filter-row button.active {
  background: #5a2d9a;
  border-color: var(--gold);
  color: var(--gold);
}

.meta,
.page-lede.evo-crumbs,
.evo-crumbs {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.5;
}

.evo-crumb {
  color: var(--focus, #d4b3ff);
  text-decoration: none;
  font-weight: 600;
}

.evo-crumb:hover {
  color: var(--gold, #f0d36a);
  text-decoration: underline;
}

.evo-crumb.is-active {
  color: var(--ink, #f4eefc);
  font-weight: 700;
  text-decoration: none;
  pointer-events: none;
}

.evo-crumb-sep {
  color: var(--muted);
  font-weight: 400;
}

.catalog-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--danger);
  background: #3a1520;
  color: #ffd0d6;
  font-size: 15px;
  line-height: 1.45;
}

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

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, var(--panel) 0%, #23143d 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  min-height: 148px;
}

.card-portrait {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #1a0d30;
  background: #1c102e;
  align-self: center;
  display: grid;
  place-items: center;
  padding: 4px;
  box-sizing: border-box;
}

.card-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.card:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.card-name {
  font-weight: 700;
  font-size: 1.02rem;
}

.card-sub {
  color: var(--muted);
  font-size: 12px;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: 999px;
  background: #1a0d30;
  border: 1px solid var(--line);
  white-space: nowrap;
  box-sizing: border-box;
}

.badge.Fire { color: #ffb199; border-color: var(--fire); }
.badge.Water { color: #b7e0ff; border-color: var(--water); }
.badge.Grass { color: #b7f0c4; border-color: var(--grass); }
.badge.Rock { color: #f0ddb7; border-color: var(--rock); }
.badge.Lightning { color: #ffe999; border-color: var(--lightning); }
.badge.aura { color: var(--gold); border-color: var(--gold); }
.badge.stats { color: var(--lime); border-color: #7aa32a; }
.badge.verified { color: #6fdc9a; border-color: #3f9a68; }
.badge.unverified { color: #a8a0b4; border-color: rgba(160, 155, 170, 0.45); }
.badge.not-live { color: #ffd08a; border-color: rgba(255, 176, 80, 0.55); }
.badge.appearance-unknown { color: #9ec9ff; border-color: rgba(120, 180, 255, 0.5); }

.tiers {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #6d4d9a;
  background: #1a0d30;
  color: var(--muted);
  font-size: 10px;
  display: grid;
  place-items: center;
}

.dot.filled { border-color: var(--lime); color: var(--lime); }
.dot.current {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
  color: #fff;
}

.sheet {
  background: linear-gradient(180deg, #4a2a78 0%, #2b1650 100%);
  border: 3px solid #1a0d30;
  border-radius: 22px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 16px 14px 18px;
  position: relative;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
}

.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6d6a72;
  box-shadow: inset 0 1px 2px #111;
}
.sheet::before { top: 10px; left: 10px; }
.sheet::after { top: 10px; right: 10px; }

.sheet-name {
  text-align: center;
  font-size: 1.8rem;
  margin: 4px 0 14px;
  text-shadow: 0 2px 0 #12081c;
}

.sheet-name h1 {
  margin: 0;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  color: inherit;
  text-shadow: inherit;
}

.page-hero--sheet {
  padding-bottom: 4px;
}

.page-hero--sheet .evo-crumbs {
  margin-bottom: 4px;
}

.sheet-portrait {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 0 auto 16px;
  max-width: 280px;
}

.sheet-portrait__stage {
  width: min(100%, 260px);
  aspect-ratio: 1;
  border-radius: 22px;
  border: 3px solid #1a0d30;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.08), transparent 55%),
    linear-gradient(180deg, #3a215f 0%, #1c102e 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  padding: 14px;
  box-sizing: border-box;
  overflow: hidden;
}

.sheet-portrait__img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

.art-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 2px solid #1a0d30;
  background: #1c102e;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.art-toggle__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #c9b8e4;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 16px;
  cursor: pointer;
  min-width: 5.5rem;
}

.art-toggle__btn.is-active {
  background: linear-gradient(180deg, #6d4d9a 0%, #4a2a78 100%);
  color: #fff;
}

.skill {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.skill-icon {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 2px solid #1a0d30;
  background: #1c102e;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  font-weight: 800;
  font-size: 1.4rem;
}

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

.tier-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  background: #1a0d30;
  color: var(--gold);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 4px;
}

.skill h2 {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 1.15rem;
}

.skill p {
  margin: 0;
  color: #efe8ff;
  line-height: 1.4;
}

.stats {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(10, 6, 22, 0.45);
  border-radius: 8px;
  padding: 8px 10px;
}

.stat span { color: #c9b8e4; }
.stat strong { color: var(--lime); font-size: 1.05rem; }
.stat strong.empty { color: var(--muted); font-weight: 500; font-size: 0.95rem; }

.block {
  background: rgba(10, 6, 22, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 10px;
}

.block h3 {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 1rem;
}

.block p {
  margin: 0 0 8px;
  color: #ddd3f2;
  font-size: 14px;
  line-height: 1.4;
}

.block-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.skill-extra {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(155, 109, 255, 0.28);
}

.skill-extra h4 {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.95rem;
}

.skill-extra p {
  margin: 0 0 8px;
}

.skill-extra .stats {
  margin-top: 8px;
}

.base-stats {
  max-width: 26rem;
}

.sheet-stats-pair {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  align-items: start;
}

.sheet-stats-pair > .block {
  margin-top: 0;
  min-width: 0;
}

.sheet-stats-pair .base-stats {
  max-width: none;
}

.sheet-popup-stats {
  margin-top: 10px;
}

.sheet-review-foot {
  margin: 18px 0 0;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.4;
}

.sheet-review-foot.is-verified {
  color: #6fdc9a;
}

.sheet-review-foot.is-unverified {
  color: #a8a0b4;
}

.sheet-main {
  display: grid;
  gap: 12px 18px;
  align-items: start;
  margin-bottom: 14px;
  grid-template-columns: 1fr;
  grid-template-areas:
    "title"
    "art"
    "tags"
    "info";
  overflow: visible;
}

@media (min-width: 860px) {
  .sheet-main {
    grid-template-columns: minmax(16rem, 0.95fr) minmax(0, 1.05fr);
    grid-template-areas:
      "title tags"
      "art info";
  }
}

.sheet-main__tags { grid-area: tags; }
.sheet-main__title { grid-area: title; }
.sheet-main__info { grid-area: info; }
.sheet-main__art { grid-area: art; }

.sheet-main__tags,
.sheet-main__title,
.sheet-main__info,
.sheet-main__art {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.sheet-main__tags .badges {
  margin: 0;
}

.sheet-main__title .sheet-name--art {
  text-align: center;
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  line-height: 1.1;
}

.sheet-main__info .skill,
.sheet-main__info .block {
  margin-top: 0;
}

.sheet-main__art .sheet-portrait {
  margin: 0 auto;
  width: 100%;
  max-width: 280px;
}

.sheet-main__art .sheet-portrait__stage {
  margin: 0;
}

.sheet-main__art .evolution--compact {
  margin-top: 0;
}

.sheet-main__art .evolution--compact .evo-gates {
  margin-top: 8px;
}

.sheet-main__art .evolution--compact .evo-gate:not(.is-current) {
  display: none;
}

/* —— Feeding foods (in-game card tray) —— */
.sheet-main__art {
  overflow: visible;
  z-index: 2;
}

.feeding-foods {
  margin-top: 10px;
  overflow: visible;
}

.feeding-foods__title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--gold, #f0d36a);
}

.feed-food-tray {
  list-style: none;
  margin: 0;
  padding: 2px 0 4px;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 3px;
  width: 100%;
  overflow: visible;
}

.feed-food-card {
  --tone-a: #f6e08a;
  --tone-b: #e8c24a;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 48px;
  overflow: visible;
  z-index: 1;
}

.feed-food-card:hover,
.feed-food-card:focus-within,
.feed-food-card.is-tip-open {
  z-index: 6;
}

.feed-food-card[data-tone="gold"] { --tone-a: #ffe56a; --tone-b: #f0c832; }
.feed-food-card[data-tone="amber"] { --tone-a: #f6dfb0; --tone-b: #e8c078; }
.feed-food-card[data-tone="violet"] { --tone-a: #d7c2f4; --tone-b: #b89adf; }
.feed-food-card[data-tone="sky"] { --tone-a: #b7e4fb; --tone-b: #7ec8ef; }
.feed-food-card[data-tone="mint"] { --tone-a: #c8f0d4; --tone-b: #8ed9a8; }

.feed-food-card__face {
  position: relative;
  border-radius: 14px;
  border: 3px solid #120a1c;
  overflow: visible;
  isolation: isolate;
  background:
    linear-gradient(45deg, var(--tone-a) 25%, transparent 25%) -6px 0 / 12px 12px,
    linear-gradient(-45deg, var(--tone-a) 25%, transparent 25%) -6px 0 / 12px 12px,
    linear-gradient(45deg, transparent 75%, var(--tone-a) 75%) -6px 0 / 12px 12px,
    linear-gradient(-45deg, transparent 75%, var(--tone-a) 75%) -6px 0 / 12px 12px,
    var(--tone-b);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.feed-food-card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  object-position: center 62%;
  padding: 2px 2px 14px;
  box-sizing: border-box;
}

.feed-food-card__fallback {
  display: grid;
  place-items: center;
  min-height: 86px;
  padding: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #1a1028;
  text-align: center;
}

.feed-food-card__pts {
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  min-width: 72%;
  padding: 0 4px;
  border-radius: 3px;
  background: #fff;
  border: 2px solid #120a1c;
  color: #120a1c;
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.25;
  pointer-events: none;
}

.feed-food-card__help {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #120a1c;
  background: rgba(24, 14, 40, 0.92);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  display: grid;
  place-items: center;
  padding: 0;
}

.feed-food-card__help:hover,
.feed-food-card__help:focus-visible,
.feed-food-card__help[aria-expanded="true"] {
  background: #f0d36a;
  color: #120a1c;
  outline: none;
}

.feed-food-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: min(220px, 70vw);
  z-index: 20;
  border-radius: 12px;
  border: 3px solid #120a1c;
  background: #fff;
  color: #1a1028;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: none;
  pointer-events: none;
}

.feed-food-card:hover .feed-food-tip,
.feed-food-card:focus-within .feed-food-tip,
.feed-food-card.is-tip-open .feed-food-tip {
  display: block !important;
  pointer-events: auto;
}

.feed-food-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 3px solid #120a1c;
  border-bottom: 3px solid #120a1c;
  transform: translateX(-50%) rotate(45deg);
}

.feed-food-card:first-child .feed-food-tip,
.feed-food-card[data-tip="end"] .feed-food-tip {
  left: calc(100% + 6px);
  right: auto;
  bottom: auto;
  top: 0;
  transform: none;
}

.feed-food-card:first-child .feed-food-tip::after,
.feed-food-card[data-tip="end"] .feed-food-tip::after {
  left: 0;
  bottom: auto;
  top: 22px;
  transform: translate(-50%) rotate(45deg);
}


.feed-food-tip__head[data-tone="gold"] { --tone-a: #ffe56a; --tone-b: #f0c832; }
.feed-food-tip__head[data-tone="amber"] { --tone-a: #f6dfb0; --tone-b: #e8c078; }
.feed-food-tip__head[data-tone="violet"] { --tone-a: #d7c2f4; --tone-b: #b89adf; }
.feed-food-tip__head[data-tone="sky"] { --tone-a: #b7e4fb; --tone-b: #7ec8ef; }
.feed-food-tip__head[data-tone="mint"] { --tone-a: #c8f0d4; --tone-b: #8ed9a8; }

.feed-food-tip__head {
  padding: 8px 10px;
  background:
    linear-gradient(45deg, var(--tone-a) 25%, transparent 25%) 0 0 / 10px 10px,
    linear-gradient(-45deg, var(--tone-a) 25%, transparent 25%) 0 0 / 10px 10px,
    linear-gradient(45deg, transparent 75%, var(--tone-a) 75%) 0 0 / 10px 10px,
    linear-gradient(-45deg, transparent 75%, var(--tone-a) 75%) 0 0 / 10px 10px,
    var(--tone-b);
  border-bottom: 2px solid #120a1c;
}

.feed-food-tip__name {
  font-weight: 900;
  font-size: 0.88rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.feed-food-tip__blurb {
  margin: 0;
  padding: 8px 10px 6px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #1a1028;
}

.feed-food-tip__sources {
  padding: 0 10px 10px;
}

.feed-food-tip__sources-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #5a3d8a;
  margin-bottom: 4px;
}

.feed-food-tip__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.feed-food-tip__chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #ebe3f7;
  color: #5a3d8a;
  font-size: 0.7rem;
  font-weight: 700;
}

/* —— Feeding upgrades (chat-bubble plates) —— */
.sheet-main__art .feeding-upgrades {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  margin-top: 10px;
}

.feeding-upgrades > summary {
  cursor: pointer;
  list-style: none;
  color: var(--gold, #f0d36a);
  font-weight: 700;
  font-size: 0.95rem;
}

.feeding-upgrades > summary::-webkit-details-marker {
  display: none;
}

.feeding-upgrades > summary::before {
  content: "▸ ";
  color: var(--muted, #b7a4d4);
}

.feeding-upgrades[open] > summary::before {
  content: "▾ ";
}

.feeding-upgrades__body {
  margin-top: 8px;
}

.feed-upgrades {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  overflow: visible;
}

.feed-upgrade {
  min-width: 0;
}

.feed-upgrade__bubble {
  --feed-well-left: 28.36%;
  --feed-boosts-left: 42.31%;
  container-type: inline-size;
  position: relative;
  min-height: 96px;
  overflow: visible;
  background: url("../../assets/Icons/feeding/bubble.png") center / 100% 100% no-repeat;
}

.feed-upgrade__gem {
  position: absolute;
  /* Bottom vertex sits just left of the slant (~16.3% at the plate floor),
     so the slant falls on the right of that point. */
  left: 15.24%;
  top: 50%;
  z-index: 2;
  width: clamp(52px, 20cqi, 80px);
  height: clamp(52px, 20cqi, 80px);
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.feed-upgrade__copy {
  position: absolute;
  left: var(--feed-boosts-left);
  right: 1.47%;
  top: 5%;
  bottom: 38.6%;
  z-index: 1;
  display: flex;
  align-items: center;
  overflow: visible;
  min-width: 0;
}

.feed-upgrade__grade {
  position: absolute;
  right: 100%;
  top: 50%;
  flex: 0 0 auto;
  height: clamp(22px, 7.4cqi, 36px);
  width: auto;
  /* Tiny shared CSS gap. 79×53 plate padding does the rest: SSS fills
     the canvas, SS keeps a little air, S/A/B/C/D keep more. */
  margin: 0 clamp(2px, 0.85cqi, 4px) 0 0;
  object-fit: contain;
  object-position: right center;
  transform: translateY(-50%);
  filter:
    drop-shadow(1px 0 0 #000)
    drop-shadow(-1px 0 0 #000)
    drop-shadow(0 1px 0 #000)
    drop-shadow(0 -1px 0 #000);
}

.feed-upgrade__grade-fallback {
  flex: 0 0 auto;
  color: var(--gold, #f0d36a);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  -webkit-text-stroke: 1px #000;
  paint-order: stroke fill;
}

.feed-upgrade__text {
  min-width: 0;
  color: #fff;
  font-family: var(--font-display, inherit);
  font-size: clamp(0.92rem, 5.75cqi, 1.75rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-text-stroke: 1px #000;
  paint-order: stroke fill;
}

.feed-upgrade__well {
  position: absolute;
  left: calc(var(--feed-well-left) + 4.2cqi);
  right: 3.36%;
  top: 61.4%;
  height: 24.7%;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: clamp(5px, 1.6cqi, 8px);
  min-width: 0;
  overflow: visible;
  padding: 0 10px;
  background: #000;
  border-radius: 999px;
}

.feed-upgrade__well-label {
  flex: 0 0 auto;
  color: #fff;
  font-family: var(--font-display, inherit);
  font-size: clamp(0.72rem, 4.2cqi, 1.125rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 0 #000;
  /* Optical center: glyph sits high in the em box */
  transform: translateY(0.05em);
}

.feed-upgrade__stars {
  flex: 0 0 auto;
  height: clamp(13px, 4.8cqi, 21px);
  width: auto;
  max-width: none;
  object-fit: contain;
  object-position: left center;
}

.feed-upgrade__stars--badge {
  height: clamp(22px, 5.6cqi, 28px);
}

.feed-upgrade--plain .feed-upgrade__bubble {
  min-height: 88px;
}

.feed-upgrade--plain .feed-upgrade__copy {
  top: 0;
  bottom: 0;
  height: auto;
}

@media (max-width: 520px) {
  .feed-upgrade__bubble {
    min-height: 80px;
  }

  .feed-upgrade--plain .feed-upgrade__bubble {
    min-height: 74px;
  }

  .feed-food-card {
    max-width: none;
  }

  .feed-upgrade__well {
    left: calc(var(--feed-well-left) + 3.4cqi);
  }

  .feed-upgrade__well-label {
    transform: translateY(0.04em);
  }
}

@media (max-width: 360px) {
  .feed-upgrade__bubble {
    --feed-boosts-left: 39.16%;
    min-height: 74px;
  }

  .feed-upgrade--plain .feed-upgrade__bubble {
    min-height: 68px;
  }

  .feed-upgrade__copy {
    right: 1%;
  }

  .feed-upgrade__well {
    left: calc(var(--feed-well-left) + 2.4cqi);
    gap: 4px;
  }

  .feed-upgrade__well-label {
    font-size: 0.68rem;
    letter-spacing: 0;
  }

  .feed-upgrade__stars {
    height: clamp(12px, 4.8cqi, 16px);
  }

  .feed-upgrade__stars--badge {
    height: clamp(16px, 6.2cqi, 22px);
  }
}

.sheet-lower-pair {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  align-items: start;
}

@media (min-width: 860px) {
  .sheet-lower-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sheet-lower-pair > .block {
  margin-top: 0;
  height: 100%;
}

.horde-skills__list {
  display: grid;
  gap: 10px;
}

.horde-skill {
  border-radius: 10px;
  background: rgba(10, 6, 22, 0.45);
  padding: 8px 10px;
}

.horde-skill__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.horde-skill__level {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.horde-skill__name {
  color: #efe8ff;
  font-size: 0.95rem;
}

.horde-skill__label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.horde-skill__desc {
  margin: 0;
  color: #ddd3f2;
  font-size: 0.88rem;
  line-height: 1.4;
}

.admin-horde-skills {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-horde-skills h3 {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 1rem;
}

.admin-horde-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(10, 6, 22, 0.35);
}

.admin-horde-row .horde-row-title {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.arena-factor .stat strong {
  font-size: 1.2rem;
}

@media (min-width: 720px) {
  .sheet-stats-pair {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.base-stats__grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.base-stat {
  min-width: 0;
}

.base-stat__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.85rem;
  margin-bottom: 4px;
  min-width: 0;
}

.base-stat__meta span { color: #c9b8e4; }
.base-stat__meta strong { color: var(--lime); font-variant-numeric: tabular-nums; }

.base-stat__bar {
  height: 8px;
  width: 100%;
  max-width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-sizing: border-box;
}

.base-stat__bar > span {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: #d4924a;
}

.evo-gates {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.evo-gate {
  border-radius: 10px;
  background: rgba(10, 6, 22, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 10px;
}

.evo-gate.is-current {
  border-color: rgba(255, 255, 255, 0.22);
}

.evo-gate__path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: #efe8ff;
  font-size: 0.92rem;
}

.evo-gate__stars {
  margin: 4px 0 0;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.evo-gate__trial {
  margin: 4px 0 0;
  color: #ddd3f2;
  font-size: 0.84rem;
  line-height: 1.4;
}

.tier-board__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.tier-rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 10px;
  background: rgba(10, 6, 22, 0.45);
  padding: 8px 10px;
}

.tier-rating__label {
  color: #c9b8e4;
  font-size: 0.85rem;
}

.tier-letter {
  min-width: 2rem;
  text-align: center;
  font-weight: 800;
  font-size: 0.8rem;
  border-radius: 8px;
  padding: 3px 8px;
  color: var(--tier-letter, #3dc8ff);
  background: color-mix(in srgb, var(--tier-letter, #3dc8ff) 14%, transparent);
}

.evo {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.evolution .evo {
  margin-top: 8px;
}

.evo a,
.evo button {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3px solid #5a3d82;
  background: #1c102e;
  color: var(--ink);
  display: grid;
  place-items: center;
  text-decoration: none;
  overflow: hidden;
  padding: 5px;
  box-sizing: border-box;
  cursor: pointer;
  font-weight: 700;
}

.evo a.current,
.evo button.current {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.evo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.evo .empty-slot {
  opacity: 0.35;
  cursor: default;
}

.flavor {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ad-slot {
  /* Shared styles live in /css/ads.css — kept minimal here for pages that omit it. */
  margin: 18px auto 0;
  max-width: 760px;
}

.ad-placeholder {
  border: 1px dashed #6d4d9a;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  background: rgba(12, 6, 24, 0.4);
}

.form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(12, 6, 24, 0.7);
  color: var(--ink);
  font-size: 16px;
}

textarea { min-height: 80px; resize: vertical; }
#list-desc { min-height: 56px; }

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

button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #3d2270;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

button.primary, .btn.primary {
  background: #6a33c2;
  border-color: var(--gold);
}

button:disabled,
button[aria-busy="true"] {
  opacity: 0.7;
  cursor: wait;
}

button.danger { background: #6a2230; border-color: var(--danger); }

.storage-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--gold);
  background: #3a2a10;
  color: #ffe9b0;
  font-size: 14px;
  line-height: 1.45;
}

.toast {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(240, 211, 106, 0.45);
  background: #2a1840;
  color: var(--gold);
  font-weight: 600;
}

.toast.error {
  color: #ffd0d6;
  background: #4a1824;
  border-color: rgba(255, 122, 138, 0.45);
}

.inbox-progress.inbox-progress-ok {
  color: var(--lime, #c6f25a);
  font-weight: 600;
}

.family-list {
  display: grid;
  gap: 8px;
}

.family-list button {
  text-align: left;
}

.tier-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tier-editor {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.upload-row {
  display: grid;
  gap: 10px;
}

@media (min-width: 720px) {
  .upload-row {
    grid-template-columns: 1fr 1fr;
  }
}

.upload-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 6, 24, 0.45);
}

.upload-card > span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.upload-preview {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid #1a0d30;
  background: #1c102e;
}

.upload-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.upload-pick input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  cursor: pointer;
  font-size: 0;
}

.inbox-list-error {
  color: #ffd0d6;
}

.upload-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.upload-hint code {
  color: var(--ink);
}

.params-block {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.params-block h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--gold);
}

.inbox-panel {
  margin-bottom: 16px;
}

.inbox-progress {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--gold);
  background: #3a2a10;
  color: #ffe9b0;
  font-size: 14px;
  line-height: 1.45;
}

.inbox-progress-busy::before {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-right: 8px;
  border: 2px solid #ffe9b0;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -1px;
  animation: inbox-spin 0.7s linear infinite;
}

.inbox-progress-error {
  border-color: var(--danger);
  background: #4a1824;
  color: #ffd0d6;
}

@keyframes inbox-spin {
  to { transform: rotate(360deg); }
}

.inbox-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inbox-toggle input {
  width: auto;
}

.inbox-file-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.inbox-file-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inbox-file-label input {
  width: auto;
}

.inbox-status {
  margin: 0;
  font-size: 14px;
}

.inbox-match-row {
  display: grid;
  gap: 6px;
}

.inbox-match-search,
.inbox-match {
  width: 100%;
}

.inbox-review {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.inbox-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 6, 24, 0.4);
}

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

.inbox-thumb {
  width: 120px;
  max-height: 160px;
  object-fit: contain;
  border-radius: 10px;
  background: #1c102e;
}

.inbox-changes {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.inbox-fill { color: var(--lime); }
.inbox-skip { color: var(--muted); }

.inbox-field-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

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

.inbox-field-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.inbox-field-label input {
  width: auto;
}

.missing-title {
  margin: 16px 0 8px;
  font-size: 1rem;
  color: var(--gold);
}

.missing-family {
  margin: 6px 0;
}

.missing-family ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.missing-jump {
  padding: 2px 8px;
  font-size: 13px;
}

.param-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 600px) {
  .param-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .sheet { padding: 22px 24px 24px; }
  .skill { grid-template-columns: 88px 1fr; }
  .skill-icon { width: 88px; height: 88px; }
}

@media (max-width: 520px) {
  .skill { grid-template-columns: 64px 1fr; }
  .sheet-name { font-size: 1.45rem; }
}

.admin-workspace,
.builder-workspace {
  display: grid;
  gap: 16px;
}

.admin-picker {
  display: grid;
  gap: 10px;
  align-content: start;
}

.picker-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gold);
}

.picker-search-label,
.picker-select-label {
  display: grid;
  gap: 4px;
}

.family-select {
  width: 100%;
  min-height: 200px;
  padding: 6px;
  overflow: auto;
}

.family-select option {
  padding: 6px 8px;
}

.editor-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.editor-sticky {
  display: grid;
  gap: 10px;
}

.family-meta {
  display: grid;
  gap: 10px;
}

.verify-toggle .verify-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10, 6, 22, 0.45);
}

.verify-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.verify-toggle #family-verified-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.tier-board {
  display: grid;
  gap: 10px;
}

.tier-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  min-height: 88px;
  background: rgba(10, 6, 22, 0.4);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 8px;
}

.tier-row.active-row {
  border-style: solid;
  border-color: var(--gold);
}

.tier-row-label {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  border-radius: 10px;
  background: #1a0d30;
  color: var(--gold);
}

.tier-row-units {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  min-height: 68px;
}

.unit-chip {
  width: 64px;
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1c102e;
  color: inherit;
  cursor: pointer;
  text-align: center;
}

.unit-chip img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}

.unit-chip span {
  font-size: 10px;
  line-height: 1.2;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-chip.dragging { opacity: 0.45; }

.pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 4px 0;
}

.list-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.list-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
}

.list-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.list-preview {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.list-preview img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #1a0d30;
}

.share-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.share-box input {
  flex: 1 1 220px;
}

@media (min-width: 1100px) {
  .admin-workspace,
  .builder-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: stretch;
    height: calc(100vh - 150px);
    min-height: 560px;
  }

  .admin-picker,
  .builder-pool,
  .admin-editor,
  .builder-board {
    min-height: 0;
    max-height: 100%;
  }

  .admin-picker,
  .builder-pool {
    position: sticky;
    top: 10px;
    overflow: auto;
  }

  .family-select {
    min-height: 0;
    height: calc(100vh - 340px);
  }

  .admin-editor .sheet,
  .builder-board .sheet {
    height: 100%;
    max-height: 100%;
    overflow: auto;
  }

  .editor-sticky {
    position: sticky;
    top: -4px;
    z-index: 4;
    background: linear-gradient(180deg, #4a2a78 0%, #3a2064 92%);
    padding: 8px 4px 10px;
    margin: -4px -4px 8px;
    border-bottom: 1px solid var(--line);
  }

  .family-meta {
    grid-template-columns: 1fr 1fr;
  }

  .builder-pool .pool-grid {
    max-height: calc(100vh - 320px);
  }
}
