:root {
  --bg: #FFF7EA;
  --bg2: #FFEBCC;
  --paper: #FFFDF6;
  --ink: #1E1B3A;
  --muted: #6A6585;
  --line: #EBDDC6;
  --brand: #FF5A5F;
  --brand-dark: #E2434A;
  --accent: #3D5AFE;
  --ok: #2E9E5B;
  --warn: #E89B00;
  --font-head: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font-body); overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; margin: 0 0 .4em; }
h1 { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 600; }
p { margin: 0 0 1em; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- site chrome */
.site-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 2px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; line-height: 1; }
.logo small { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 3px; }
.site-nav { margin-left: auto; display: flex; gap: 4px; }
.site-nav a { text-decoration: none; font-weight: 800; padding: 8px 12px; border-radius: 999px; }
.site-nav a:hover { background: var(--bg2); }
@media (max-width: 640px) { .site-nav a.opt { display: none; } .logo span:not(.mark) { font-size: 1rem; } }

.site-foot { margin-top: 80px; padding: 40px 0 60px; border-top: 2px solid var(--line); color: var(--muted); font-size: .92rem; }
.site-foot .wrap { display: grid; gap: 8px; }

/* ---------------------------------------------------------------- buttons, chips, forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 999px;
  border: 2.5px solid var(--ink); background: var(--brand); color: #fff; font: 800 1rem var(--font-body); text-decoration: none;
  box-shadow: 0 4px 0 var(--ink); cursor: pointer; transition: transform .08s, box-shadow .08s; }
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.ghost:hover { background: var(--bg2); }
.btn.small { padding: 7px 14px; font-size: .9rem; box-shadow: 0 3px 0 var(--ink); }
.btn[disabled] { opacity: .55; cursor: progress; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; background: #fff; font: 800 .9rem var(--font-body); cursor: pointer; color: var(--ink); display: inline-flex; gap: 6px; align-items: center; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
a.chip { text-decoration: none; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 800; font-size: .92rem; }
.field > em { font-style: normal; color: var(--muted); font-size: .85rem; margin-top: -4px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { min-height: 96px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ts-box { min-height: 65px; margin-bottom: 14px; }
.form-msg { padding: 12px 14px; border-radius: 12px; font-weight: 700; margin-bottom: 14px; }
.form-msg.err { background: #FFE3E3; color: #9B1C1C; }
.form-msg.ok { background: #DDF6E6; color: #145A32; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; white-space: nowrap; }
.pill.available { background: #DDF6E6; }
.pill.pending { background: #FFF0C2; }
.pill.adopted { background: var(--brand); color: #fff; }
.pill.fun { background: #DCE4FF; }
.pill.demo { background: #EEE; border-style: dashed; }

/* ---------------------------------------------------------------- home */
.hero { padding: 48px 0 24px; overflow-x: clip; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: center; }
.hero p.lede { font-size: 1.2rem; max-width: 34em; }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.fan { position: relative; height: 440px; }
.fan > .card { position: absolute; left: 50%; top: 10px; --cw: 270px; transition: transform .3s; }
.fan > :nth-child(1) { transform: translateX(-95%) rotate(-12deg) translateY(30px); }
.fan > :nth-child(2) { transform: translateX(-50%) rotate(0deg); z-index: 2; }
.fan > :nth-child(3) { transform: translateX(-5%) rotate(12deg) translateY(30px); }
.fan:hover > :nth-child(1) { transform: translateX(-108%) rotate(-16deg) translateY(36px); }
.fan:hover > :nth-child(3) { transform: translateX(8%) rotate(16deg) translateY(36px); }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .fan { height: 360px; }
  .fan > .card { --cw: 220px; }
}
@media (max-width: 420px) { .fan > .card { --cw: 170px; } .fan { height: 290px; } }

.section { padding: 40px 0 8px; }
.section-head { display: flex; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.section-head .chips { margin-left: auto; }
.filters { display: grid; gap: 10px; margin-bottom: 20px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px; }
@media (max-width: 440px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
.empty { padding: 40px; text-align: center; border: 2px dashed var(--line); border-radius: 20px; color: var(--muted); }

.litter-band { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 26px; padding: 22px; box-shadow: 0 6px 0 var(--ink); display: grid; gap: 16px; margin-bottom: 26px; }
.litter-band header { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.litter-band h3 { font-size: 1.6rem; margin: 0; }
.litter-band .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
.step { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 22px; padding: 22px; position: relative; }
.step::before { counter-increment: step; content: counter(step); position: absolute; top: -16px; left: 18px; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; border: 2.5px solid var(--ink); display: grid; place-items: center; font: 700 1.1rem var(--font-head); }
.step h3 { font-size: 1.25rem; margin-top: 6px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 26px; } }
.callout { margin-top: 26px; background: var(--ink); color: #fff; border-radius: 26px; padding: 26px; display: grid; gap: 6px; }
.callout h3 { font-size: 1.4rem; }

/* ---------------------------------------------------------------- the creature card */
.card { --t1: #c9c2b0; --t2: var(--t1); width: var(--cw, 340px); max-width: 100%; aspect-ratio: 63 / 88; container-type: inline-size;
  position: relative; border-radius: 5cqi; padding: 3cqi; color: #17152b;
  background: linear-gradient(140deg, var(--t1), color-mix(in srgb, var(--t2) 85%, #000) );
  box-shadow: 0 1.5cqi 5cqi rgba(30, 27, 58, .28), inset 0 0 0 .9cqi rgba(255, 255, 255, .35); overflow: hidden; }
.card-inner { height: 100%; border-radius: 3cqi; display: flex; flex-direction: column; gap: 1.4cqi; padding: 2.4cqi 3cqi 2cqi;
  background: linear-gradient(180deg, color-mix(in srgb, var(--t1) 22%, #fffdf6), color-mix(in srgb, var(--t2) 14%, #fffdf6));
  font-size: 3.4cqi; line-height: 1.3; }
.card-top { display: flex; align-items: center; gap: 1.8cqi; }
.card-stage { font-size: 2.4cqi; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: #fff; border: .4cqi solid #17152b; border-radius: 99px; padding: .3cqi 1.8cqi; }
.card-name { font-family: var(--font-head); font-weight: 700; font-size: 6.6cqi; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-hp { font-family: var(--font-head); font-weight: 700; font-size: 6cqi; color: #C8102E; white-space: nowrap; }
.card-hp small { font-size: 2.7cqi; margin-right: .5cqi; color: #17152b; }
.orb { width: 6.4cqi; height: 6.4cqi; border-radius: 50%; display: inline-grid; place-items: center; background: var(--c); font-size: 3.6cqi; line-height: 1;
  box-shadow: inset 0 -.6cqi 0 rgba(0, 0, 0, .22), 0 0 0 .5cqi #fff, 0 0 0 .9cqi #17152b; flex: none; }
.card-art { position: relative; aspect-ratio: 3 / 2; border-radius: 1.5cqi; overflow: hidden; flex: none;
  border: 1.1cqi solid #EAD8A4; box-shadow: 0 0 0 .5cqi #17152b, inset 0 0 2cqi rgba(0, 0, 0, .25); background: #fff; }
.card-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }
.card-art .noart { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12cqi; background: repeating-linear-gradient(45deg, #fff, #fff 3cqi, #f4efe2 3cqi, #f4efe2 6cqi); }
.card-strip { font-size: 2.6cqi; font-weight: 800; text-align: center; background: linear-gradient(90deg, #EAD8A4, #fff6d8, #EAD8A4); border-radius: 99px; padding: .4cqi 2cqi; margin: -.4cqi 4cqi 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-body { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 1.2cqi; }
.card-ability { padding-bottom: 1cqi; border-bottom: .3cqi solid rgba(23, 21, 43, .2); }
.ab-tag { display: inline-block; font-size: 2.4cqi; font-weight: 800; color: #fff; background: #C8102E; border-radius: .8cqi; padding: .2cqi 1.2cqi; margin-right: 1cqi; text-transform: uppercase; letter-spacing: .05em; vertical-align: .2cqi; }
.card-ability b, .card-move b { font-family: var(--font-head); font-weight: 600; font-size: 4.2cqi; }
.card-ability p, .card-move p { margin: .4cqi 0 0; font-size: 2.9cqi; }
.card-move { display: grid; grid-template-columns: auto 1fr auto; column-gap: 2cqi; align-items: center; }
.card-move .cost { display: flex; gap: .9cqi; }
.card-move .cost .orb { width: 5cqi; height: 5cqi; font-size: 2.8cqi; }
.card-move .power { font-family: var(--font-head); font-weight: 700; font-size: 5.4cqi; }
.card-move p { grid-column: 1 / -1; }
.card-stats { display: grid; grid-template-columns: 1fr 1fr auto; gap: 2cqi; font-size: 2.3cqi; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; border-top: .3cqi solid rgba(23, 21, 43, .2); padding-top: 1cqi; }
.card-stats b { display: block; text-transform: none; letter-spacing: 0; font-size: 2.8cqi; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-flavor { font-size: 2.65cqi; font-style: italic; border: .3cqi solid rgba(23, 21, 43, .35); border-radius: 1cqi; padding: .8cqi 1.6cqi; background: rgba(255, 255, 255, .55); margin: 0; }
.card-foot { display: flex; justify-content: space-between; font-size: 2.2cqi; font-weight: 800; opacity: .8; }
.card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, .55), transparent 45%); mix-blend-mode: soft-light; }
.card:hover::after { opacity: 1; }
.card.rarity-rare::before, .card.rarity-legendary::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: linear-gradient(115deg, transparent 25%, rgba(255, 0, 170, .16) 38%, rgba(0, 210, 255, .16) 50%, rgba(255, 230, 0, .16) 62%, transparent 75%);
  background-size: 250% 250%; background-position: var(--mx, 50%) var(--my, 50%); mix-blend-mode: color-dodge; }
.card-ribbon { position: absolute; z-index: 3; top: 5cqi; right: -12cqi; transform: rotate(35deg); width: 44cqi; text-align: center;
  font: 700 3.4cqi var(--font-head); padding: 1cqi 0; color: #fff; background: var(--brand); border-block: .5cqi solid #17152b; }
.card-ribbon.pending { background: var(--warn); }
.card-ribbon.demo { background: #6B6B6B; }

/* photo back of the card */
.photo-card .card-inner { padding: 2.4cqi; }
.photo-card .photo { flex: 1; min-height: 0; border-radius: 2cqi; overflow: hidden; border: .6cqi solid #17152b; background: #000; }
.photo-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-card .caption { text-align: center; font: 600 5cqi var(--font-head); }
.photo-card .caption small { display: block; font: 700 2.6cqi var(--font-body); opacity: .75; }

.flip { perspective: 1600px; width: var(--cw, 360px); max-width: 100%; }
.flip-inner { position: relative; transition: transform .75s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip .face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip .back { position: absolute; inset: 0; transform: rotateY(180deg); }
.flip .card { --cw: 100%; width: 100%; }

/* ---------------------------------------------------------------- mini cards (gallery) */
.mini { position: relative; display: block; border-radius: 20px; padding: 6px; text-decoration: none; color: var(--ink);
  background: linear-gradient(140deg, var(--t1, #ccc), color-mix(in srgb, var(--t2, #ccc) 85%, #000));
  box-shadow: 0 4px 0 var(--ink), 0 0 0 2.5px var(--ink); transition: transform .15s; }
.mini:hover { transform: translateY(-4px) rotate(-1.2deg); }
.mini-inner { border-radius: 15px; overflow: hidden; background: var(--paper); }
.mini-art { aspect-ratio: 1; background: #f3eee2; overflow: hidden; }
.mini-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.mini:hover .mini-art img { transform: scale(1.05); }
.mini-body { display: flex; align-items: center; gap: 6px; padding: 8px 10px 9px; }
.mini-body b { font: 600 1.1rem var(--font-head); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-body .hp { font: 700 .8rem var(--font-head); color: #C8102E; white-space: nowrap; }
/* Outside a card, orbs get a fixed size (cqi units would resolve against the viewport). */
.mini-types .orb, .chip .orb, .pill .orb { width: 22px; height: 22px; font-size: 12px; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2), 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }
.chip .orb { width: 18px; height: 18px; font-size: 10px; margin-left: 2px; }
.mini-types { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; }
.mini-tag { position: absolute; top: 14px; left: 14px; }
.mini-sub { padding: 0 10px 10px; margin-top: -4px; font-size: .82rem; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- pet + litter pages */
.pet-page { padding: 36px 0; }
.pet-page .wrap { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 44px; align-items: start; }
.pet-page .card-col { position: sticky; top: 84px; display: grid; gap: 14px; justify-items: center; }
.pet-page .flip { --cw: 400px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 18px 0; }
.fact { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.fact span { display: block; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact b { font-weight: 800; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.bio { font-size: 1.08rem; white-space: pre-line; }
.demo-note { background: #F1F1F1; border: 2px dashed #9a9a9a; border-radius: 14px; padding: 12px 14px; font-weight: 700; margin: 14px 0; }
.apply-box { margin-top: 28px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 24px; padding: 24px; box-shadow: 0 6px 0 var(--ink); }
.apply-box h2 { font-size: 1.7rem; }
.sibs { margin-top: 28px; }
.sibs .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (max-width: 820px) {
  .pet-page .wrap { grid-template-columns: 1fr; }
  .pet-page .card-col { position: static; }
  .pet-page .flip { --cw: min(400px, 100%); }
}
.litter-hero { padding: 40px 0 10px; }
.litter-hero .badges { margin-top: 10px; }
.litter-page .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px; justify-items: center; }
.litter-page .grid a { text-decoration: none; display: block; width: 100%; }
.litter-page .grid .card { --cw: 100%; }

/* ---------------------------------------------------------------- admin */
.admin { padding: 24px 0 80px; }
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 20px; }
.admin-list { display: grid; gap: 10px; }
.admin-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; background: var(--paper); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; cursor: pointer; }
.admin-row:hover { border-color: var(--ink); }
.admin-row img, .admin-row .ph { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: #eee; }
.admin-row .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.editor .preview { position: sticky; top: 84px; display: grid; gap: 14px; }
.editor .preview .card { --cw: 360px; }
@media (max-width: 960px) { .editor { grid-template-columns: 1fr; } .editor .preview { position: static; } }
fieldset { border: 2px solid var(--line); border-radius: 18px; padding: 16px 16px 4px; margin: 0 0 18px; background: var(--paper); }
legend { font: 600 1.1rem var(--font-head); padding: 0 6px; }
.art-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.art-thumb { position: relative; width: 74px; height: 74px; border-radius: 12px; overflow: hidden; border: 3px solid transparent; cursor: pointer; padding: 0; background: #eee; }
.art-thumb img { width: 100%; height: 100%; object-fit: cover; }
.art-thumb.chosen { border-color: var(--brand); }
.art-thumb .x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; line-height: 20px; cursor: pointer; }
.photo-drop { display: grid; gap: 10px; align-content: start; }
.photo-drop .btn { justify-self: start; }
.photo-drop img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 14px; }
.spinner { width: 18px; height: 18px; border: 3px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.app-card { background: var(--paper); border: 2px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 8px; }
.app-card header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app-card dl { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 0; font-size: .95rem; }
.app-card dt { font-weight: 800; color: var(--muted); }
.app-card dd { margin: 0; white-space: pre-line; }
@media (max-width: 520px) { .app-card dl { grid-template-columns: 1fr; } }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 800; margin-bottom: 12px; }
.check input { width: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 800; z-index: 50; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
