:root {
  --forest: #112f2d;
  --dark: #0b241f;
  --ink: #182b24;
  --paper: #fff6db;
  --gold: #ffd25e;
  --mint: #b5df9a;
  --line: #cdbd92;
  --display: "Barlow Condensed", Impact, "Arial Black", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1.2rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 "DM Sans", "Trebuchet MS", Arial, sans-serif; }
a { color: inherit; text-underline-offset: .24em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid #08786b; outline-offset: 4px; }
.bound { width: min(1170px, calc(100% - 3rem)); margin-inline: auto; }
.skip { position: fixed; z-index: 2; top: 1rem; left: 1rem; background: var(--gold); padding: .75rem 1rem; }
.skip:not(:focus) { clip-path: inset(50%); }

.masthead { background: var(--dark); color: var(--paper); border-bottom: 1px solid #fff2; }
.masthead-inner, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font: 1.15rem/1 var(--display); white-space: nowrap; }
.brand img { border-radius: 9px; }
.brand small { display: block; margin-top: .34rem; color: var(--mint); font: 700 .56rem/1 "Trebuchet MS", Arial, sans-serif; letter-spacing: .13em; }
nav { display: flex; flex-wrap: wrap; gap: .55rem 1.4rem; justify-content: flex-end; }
nav a { font-size: .93rem; font-weight: 700; text-decoration: none; }
nav a:hover, nav a[aria-current] { color: var(--mint); text-decoration: underline; }
.masthead :focus-visible, .book-intro :focus-visible, .secrets :focus-visible, footer :focus-visible { outline-color: var(--gold); }

.book-intro {
  overflow: hidden;
  color: var(--paper);
  background: radial-gradient(ellipse at 82% 70%, #3c6949, transparent 51%), var(--forest);
  border-bottom: 6px solid var(--gold);
}
.intro-inner { position: relative; display: grid; grid-template-columns: 1.14fr .86fr; align-items: center; gap: 1rem; padding-block: clamp(2.9rem, 6vw, 5.1rem); }
.intro-inner > div:first-child { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 .65rem; color: var(--gold); font-weight: 900; font-size: .77rem; letter-spacing: .16em; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; line-height: 1.05; }
h1 { margin: 0; font-size: clamp(3rem, 6.9vw, 6.3rem); letter-spacing: -.04em; line-height: .94; }
h1 span { color: var(--mint); }
.intro-inner p:not(.eyebrow) { max-width: 34ch; font-size: clamp(1.1rem, 2vw, 1.27rem); margin: 1.2rem 0 1.4rem; }
.jump { display: inline-flex; align-items: center; min-height: 44px; gap: .75rem; font-weight: 900; text-decoration: none; background: var(--gold); color: var(--ink); padding: .6rem .95rem; border: 2px solid var(--dark); box-shadow: 3px 3px 0 var(--dark); }
.jump:hover { background: #ffe393; }
.intro-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.food-jump { background: var(--mint); }
.food-jump:hover { background: #d0eda9; }
.intro-art { position: relative; min-height: clamp(12rem, 23vw, 20rem); }
.intro-frame { position: absolute; inset: 5% 10% 5% auto; display: grid; place-items: center; width: min(66%, 260px); padding: 10px; background: linear-gradient(152deg, #d9ecd2 52%, #bdd6b6 52%); border: 7px solid #fff4d4; transform: rotate(9deg); box-shadow: 7px 9px 0 #081c16a0; }
.intro-frame-back { inset: 8% auto 6% 9%; transform: rotate(-14deg); background: #ffe0a4; }
.intro-frame img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }

.catalog { padding-block: clamp(2.6rem, 6vw, 5rem); }
.catalog h2, .secrets h2 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); margin: 0; text-transform: uppercase; }
.catalog > p { margin: .5rem 0 1rem; }
.controls { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, minmax(135px, .4fr)); gap: .8rem; margin: 1.55rem 0 .65rem; }
.controls label { display: grid; gap: .3rem; font-weight: 900; }
.controls input, .controls select { width: 100%; min-height: 48px; border: 2px solid #7f7b5e; border-radius: 6px; background: #fffdf5; padding: .6rem .75rem; }
.result-count { min-height: 1.5em; font-size: .93rem; }
.animal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.65rem, 2vw, 1.3rem); }
.animal-card {
  --stage: #dcebd2;
  --swatch: #afc6a5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 0;
  background: #fffdf4;
  box-shadow: 3px 4px 0 #b7a67d;
  text-decoration: none;
  transition: transform .18s, box-shadow .18s;
}
.animal-card:hover { transform: translateY(-3px); box-shadow: 3px 7px 0 #9d875e; }
.card-stage, .profile-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.32;
  overflow: hidden;
  background: radial-gradient(circle, #fff9 1px, transparent 1.4px) 0 0 / 12px 12px, linear-gradient(142deg, var(--stage, #dcebd2) 56%, var(--swatch, #afc6a5) 56%);
}
.card-stage img { height: 90%; width: min(80%, 190px); object-fit: contain; filter: drop-shadow(2px 3px 1px #31554935); }
.card-number { position: absolute; z-index: 1; top: .55rem; left: .55rem; padding: .16rem .36rem; background: var(--dark); color: var(--paper); font-size: .72rem; font-weight: 900; border-radius: 3px; }
.card-text { display: flex; flex-direction: column; gap: .35rem; align-items: stretch; padding: .7rem .75rem; width: 100%; }
.card-name { font: 900 clamp(1.03rem, 1.7vw, 1.27rem)/1.15 var(--display); }
.card-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .2rem .5rem; }
.card-species { font-size: .89rem; }
.card-art { margin-top: auto; padding-top: .35rem; color: #315549; font-size: .88rem; font-weight: 800; text-decoration: underline; }
.tag { padding: .17rem .38rem; background: var(--stage); font-size: .76rem; font-weight: 900; border-radius: 4px; }
.more, .secondary { display: flex; align-items: center; gap: .55rem; min-height: 48px; margin: 1.7rem auto 0; padding: .67rem 1.1rem; border: 2px solid var(--dark); border-radius: 5px; background: var(--forest); color: var(--paper); font-weight: 900; }
.more:hover, .secondary:hover { background: #23534d; }
.empty { padding: 1rem; background: #eee1bd; text-align: center; border-radius: 8px; }
.empty .secondary { margin-top: .55rem; }

.food-guide { padding-block: clamp(2.6rem, 6vw, 4.5rem); background: #f6edda; border-top: 1px solid var(--line); }
.food-guide h2 { margin: 0; font-size: clamp(2.1rem, 4.6vw, 3.6rem); text-transform: uppercase; }
.food-guide h2 + p { margin: .5rem 0 1.25rem; }
.food-search { max-width: 38rem; font-weight: 900; }
.food-search-fields { display: flex; align-items: stretch; gap: .55rem; margin-top: .28rem; }
.food-search input { flex: 1 1 auto; min-width: 0; min-height: 48px; padding: .61rem .75rem; border: 2px solid #7f7b5e; border-radius: 6px; background: #fffdf5; font-weight: 400; }
.food-search .clear-filters { white-space: nowrap; }
.food-result { margin: .5rem 0 .9rem; font-size: .93rem; }
.food-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.75rem, 2vw, 1.35rem); }
.food-card { display: flex; flex-direction: column; overflow: hidden; border: 2px solid var(--ink); border-radius: 10px; background: #fffbef; box-shadow: 3px 4px 0 #c5b17a; }
.food-sauce { --food-tint: #ffe6da; --food-accent: #c24335; }
.food-soda { --food-tint: #dcf3fa; --food-accent: #297bba; }
.food-eyes { --food-tint: #f6e0f6; --food-accent: #9f499e; }
.food-pizza { --food-tint: #ffebc9; --food-accent: #c4562e; }
.food-porridge { --food-tint: #f3e9ce; --food-accent: #926935; }
.food-brew { --food-tint: #f4e0d0; --food-accent: #894f32; }
.food-card-heading { display: flex; align-items: center; justify-content: space-between; gap: .4rem; min-height: 104px; padding: .5rem 1rem; border-bottom: 4px solid var(--food-accent); background: var(--food-tint); }
.food-card-heading h3 { margin: 0; font-size: clamp(1.85rem, 3.3vw, 2.5rem); }
.food-card-heading > img { flex: 0 0 54px; width: 54px; height: 82px; object-fit: contain; }
.food-card-heading > .food-original { flex-basis: 74px; width: 74px; border-radius: 6px; }
.food-pizza-lid { position: relative; flex: 0 0 95px; aspect-ratio: 550 / 355; overflow: hidden; border-radius: 6px; }
.food-pizza-lid img { position: absolute; top: -36.62%; left: -76.36%; width: 232.73%; height: auto; max-width: none; }
.food-effect { margin: .9rem .9rem .65rem; padding: .55rem .7rem; border-radius: 5px; background: var(--food-tint); font-weight: 800; line-height: 1.4; }
.food-story { margin: 0 .95rem 1rem; }
.food-place { display: flex; flex-wrap: wrap; gap: .18rem .5rem; align-items: baseline; margin: auto .95rem 1rem; padding-top: .55rem; border-top: 1px solid var(--line); font-size: .9rem; }
.food-place dt { font-weight: 900; }
.food-place dd { margin: 0; }
.food-empty { margin: 0; }
@media (max-width: 850px) { .food-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .food-grid { grid-template-columns: minmax(0, 1fr); } }

.secrets { background: var(--forest); color: var(--paper); border-top: 6px solid var(--gold); }
.secret-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 4vw, 2.5rem); align-items: center; padding-block: 3rem; }
.secrets p:not(.eyebrow) { max-width: 48ch; }
.shadows { display: flex; justify-content: center; flex-wrap: wrap; gap: .65rem; }
.shadow-card { display: grid; place-items: center; width: clamp(80px, 10vw, 142px); aspect-ratio: .83; background: #d8c8ec; border: 4px solid var(--paper); transform: rotate(-7deg); box-shadow: 3px 4px #061812; overflow: hidden; }
.shadow-card:nth-child(2) { transform: translateY(-.5rem); background: #eed9a5; }
.shadow-card:nth-child(3) { transform: rotate(7deg); background: #badbbb; }
.shadow-card::before { content: ""; display: block; width: 100%; aspect-ratio: 1; background: var(--dark); mask-image: var(--silhouette); mask-size: contain; mask-position: center; mask-repeat: no-repeat; -webkit-mask-image: var(--silhouette); -webkit-mask-size: contain; -webkit-mask-position: center; -webkit-mask-repeat: no-repeat; }
.shadow-one { --silhouette: url("./media/thumbnails/m-monroe.webp"); }
.shadow-two { --silhouette: url("./media/thumbnails/queen-elizabeth.webp"); }
.shadow-three { --silhouette: url("./media/thumbnails/nessie.webp"); }
footer { background: var(--dark); color: var(--paper); }
footer a { font-weight: 900; padding-block: .55rem; }

.profile { position: fixed; width: min(520px, calc(100% - 2rem)); max-height: calc(100% - 2rem); padding: 0; border: 3px solid var(--dark); border-radius: 12px; background: var(--paper); color: var(--ink); box-shadow: 8px 10px 0 #06181280; }
.profile::backdrop { background: #031714bd; }
.profile-art { aspect-ratio: 2.5; }
.profile[data-model="true"] .profile-art { aspect-ratio: 1.45; }
.profile-art img { width: min(52%, 195px); height: 98%; object-fit: contain; }
.profile-model { position: absolute; inset: 0; z-index: 1; }
.profile-model canvas { display: block; width: 100%; height: 100%; }
.profile form { position: absolute; top: .6rem; right: .6rem; z-index: 3; }
.close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 6px; background: var(--dark); color: var(--paper); font-size: 1.7rem; }
.close:hover { background: #265649; }
.profile-content { padding: 1rem clamp(.9rem, 4vw, 1.6rem) 1.4rem; }
.profile-num { margin: 0; font-weight: 900; }
.profile h2 { margin: .25rem 0; font-size: clamp(1.7rem, 5vw, 2.5rem); }
.profile-art-kind { margin: .7rem 0 1rem; color: #52634e; font-size: .9rem; }
.profile-bio { margin: 0 0 1rem; }
.profile-filter, .related-animals a { display: inline-flex; align-items: center; min-height: 28px; color: #254e40; text-decoration: underline; text-underline-offset: .18em; }
.profile-filter:hover, .related-animals a:hover { color: #122f2d; }
.stats { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; }
.stats div { background: var(--stage, #dcebd2); padding: .35rem .55rem; border-radius: 4px; }
.stats dt { font-size: .75rem; }
.stats dd { font-weight: 900; margin: 0; }
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .8rem 0 0; }
.moves div { padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 5px; }
.moves dt { font-size: .78rem; }
.moves dd { margin: 0; font-weight: 900; }
.locations h3 { font-size: 1.08rem; margin: 1rem 0 .4rem; }
.locations ul { margin: 0; padding-inline-start: 1.15em; }
.locations p { margin: 0; font-size: .95rem; }
.locations .location-note { font-size: .8rem; margin-top: .7rem; color: #64705c; }
.profile-locations li { font-size: .92rem; margin-top: .25rem; }
.profile-locations details { margin-top: .5rem; font-size: .9rem; }
.profile-locations summary { cursor: pointer; font-weight: 700; }

@media (max-width: 820px) {
  .animal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .bound { width: calc(100% - 2rem); }
  .intro-inner { grid-template-columns: 1fr; gap: .8rem; }
  .intro-art { min-height: clamp(10rem, 46vw, 14rem); width: min(94%, 345px); margin: 0 auto; }
  .intro-frame { width: 52%; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search, .controls label:last-child { grid-column: 1 / -1; }
  .animal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .secret-inner { grid-template-columns: 1fr; }
  .shadows { margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .animal-card { transition: none; }
}

.card-rarity { display: block; margin-top: .4rem; font-weight: 800; font-size: .85rem; color: #254e40; }

.animal-open { display: block; color: inherit; text-decoration: none; }
.animal-card > .card-meta { margin-top: auto; padding: 0 .75rem .8rem; justify-content: flex-start; gap: .5rem; }
.species-button, .card-class { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .4rem .65rem; border: 1px solid #527756; border-radius: 6px; background: #e1f1cf; color: #173d2d; font-size: .875rem; font-weight: 800; text-decoration: none; }
.species-button:hover, .card-class:hover { background: var(--gold); }
.species-shortcuts { justify-content: flex-start; gap: .5rem; margin-top: 1.5rem; }
.species-shortcuts > span { flex-basis: 100%; font-weight: 800; }
.species-shortcuts a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem 1rem; border: 2px solid var(--forest); border-radius: 7px; background: #fffdf4; color: var(--forest); text-decoration: none; }
.species-shortcuts a:hover, .species-shortcuts a[aria-current] { background: var(--forest); color: white; text-decoration: none; }
.filter-summary { display: flex; gap: .75rem; align-items: center; justify-content: space-between; margin-block: .8rem; }
.filter-summary p { margin: 0; font-weight: 800; }
.clear-filters { flex-shrink: 0; min-height: 44px; padding: .45rem .7rem; border: 1px solid var(--forest); border-radius: 5px; background: transparent; font-weight: 800; }
.evolutions { border-top: 2px solid var(--line); margin-top: 1.5rem; padding-top: 1.15rem; }
.evolutions h3 { margin: 0 0 .5rem; font-size: 1.6rem; }
.evolution-intro { font-size: .94rem; margin: 0 0 1rem; }
.evolution-chain { display: flex; align-items: stretch; gap: .65rem; margin: 0 0 1rem; padding: 0 0 .5rem; list-style: none; overflow-x: auto; }
.evolution-chain > li { flex: 1 0 120px; max-width: 180px; display: flex; flex-direction: column; }
.evolution-requirements { min-height: 3.3em; margin: 0 0 .4rem; font-size: .875rem; line-height: 1.35; color: #39583b; }
.evolution-form { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .5rem; border: 2px solid #94af82; border-radius: 8px; background: #edf4dc; text-align: center; text-decoration: none; }
.evolution-form[aria-current] { border: 3px solid var(--forest); background: #ffe9a7; }
.evolution-form:hover { background: #fff0bd; }
.evolution-form img { width: 100px; height: 90px; object-fit: contain; }
.evolution-form strong { font-size: .94rem; line-height: 1.2; }
.evolution-form > span { font-size: .875rem; }
@media(max-width:600px) { .evolution-chain { flex-direction: column; overflow: visible; } .evolution-chain > li { flex: auto; max-width: none; } .evolution-form { display: grid; grid-template-columns: 82px 1fr; text-align: left; justify-items: start; column-gap: .75rem; } .evolution-form img { grid-row: span 2; width: 82px; height: 82px; } .evolution-requirements { min-height: 0; } }

.food-howto { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; list-style: none; padding: 0; margin: 1.4rem 0 1.8rem; counter-reset: food-step; }
.food-howto li { counter-increment: food-step; padding: 1rem; border: 2px solid var(--forest); border-radius: 10px; background: #edf4dc; }
.food-howto strong { display: block; font-size: 1.1rem; margin-bottom: .45rem; color: var(--forest); }
.food-howto strong::before { content: counter(food-step) ". "; }
.food-howto span { display: block; }
@media(max-width:600px) { .food-howto { grid-template-columns: 1fr; } }

/* Native 3D food packaging gets a full illustration panel. */
.food-card-heading { min-height: 86px; padding: 1rem; }
.food-3d-art { display: grid; place-items: center; margin: 0; height: 230px; overflow: hidden; background: radial-gradient(ellipse at 50% 70%,#fffef6 10%,var(--food-tint) 95%); border-bottom: 1px solid var(--line); }
.food-3d-art img { display: block; width: 100%; height: 100%; object-fit: contain; padding: .6rem; }
@media(max-width:600px) { .food-3d-art { height: 255px; } }

/* Match the neutral backdrop used by the original in-game package captures. */
.food-3d-art { background: #fdfdfd; }

.food-usage { margin: 1rem 0 1.4rem; border: 2px solid var(--forest); border-radius: 8px; background: #edf4dc; padding: 0 1rem; }
.food-usage summary { min-height: 48px; padding-block: .7rem; font-weight: 800; cursor: pointer; }
.food-usage .food-howto { margin-top: .25rem; }

.food-3d-art { position: relative; display: block; flex: none; }
.food-3d-art img { position: absolute; inset: 0; min-width: 0; min-height: 0; width: 100%; height: 100%; }
