:root {
  color-scheme: light;
  --ink: #18302b;
  --muted: #5b6d68;
  --paper: #fffdf7;
  --canvas: #f3eddf;
  --brand: #173f35;
  --brand-2: #286650;
  --sun: #f5d778;
  --red: #a93232;
  --line: #c9d2ca;
  --white: #fff;
  --shadow-sm: 0 2px 6px rgb(23 63 53 / 12%);
  --shadow-md: 0 12px 30px rgb(23 48 43 / 16%);
  --radius-sm: .55rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --space-1: .35rem;
  --space-2: .6rem;
  --space-3: .9rem;
  --space-4: 1.25rem;
  --space-5: 1.75rem;
  --space-6: 2.5rem;
  --motion-fast: 160ms;
  --motion-card: 360ms;
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 20rem; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 90% 5%, #fff8d8 0, transparent 24rem), var(--canvas); line-height: 1.5; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4, p { margin-block-start: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { line-height: 1.15; }
:focus-visible { outline: .2rem solid #0c6eb7; outline-offset: .18rem; }
[hidden] { display: none !important; }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; z-index: 100; top: .5rem; left: .5rem; padding: .75rem 1rem; background: var(--white); border: 3px solid var(--brand); border-radius: var(--radius-sm); transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.site-header { position: sticky; z-index: 20; top: 0; padding: var(--space-3) clamp(var(--space-3), 3vw, var(--space-6)); color: var(--white); background: color-mix(in srgb, var(--brand) 97%, transparent); box-shadow: var(--shadow-md); backdrop-filter: blur(12px); }
.site-header__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); max-width: 100rem; margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-size: clamp(1.15rem, 2vw, 1.55rem); font-weight: 900; text-decoration: none; white-space: nowrap; }
.brand__mark { display: grid; place-items: center; width: 2.6rem; aspect-ratio: 1; color: var(--brand); background: var(--sun); border: 3px solid var(--white); border-radius: 50%; font-size: .75rem; }
.primary-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }
.nav-control { min-height: 2.75rem; display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .65rem; border: 1px solid rgb(255 255 255 / 35%); border-radius: 999px; text-decoration: none; font-weight: 750; transition: background var(--motion-fast), transform var(--motion-fast); }
.nav-control:hover, .nav-control[aria-current="page"] { background: rgb(255 255 255 / 14%); }
.nav-control.is-ready, .nav-control--battle.is-ready { color: var(--brand); background: var(--sun); border-color: var(--sun); animation: ready-pulse 1.4s ease-in-out infinite; }
.count-badge { min-width: 1.65rem; padding: .08rem .35rem; color: var(--brand); background: var(--white); border-radius: 999px; text-align: center; font-size: .78rem; font-weight: 900; }
.search-form { display: grid; grid-template-columns: auto minmax(15rem, 42rem); align-items: center; justify-content: end; gap: var(--space-2); max-width: 100rem; margin: var(--space-3) auto 0; }
.search-form label { font-size: .85rem; font-weight: 800; }
.search-form__controls { display: grid; grid-template-columns: minmax(8rem, 1fr) auto auto; gap: .4rem; }
.search-form input { width: 100%; min-height: 2.75rem; padding: .55rem .8rem; color: var(--ink); background: var(--white); border: 2px solid transparent; border-radius: var(--radius-sm); }

#app { min-height: 70vh; max-width: 100rem; margin-inline: auto; padding: clamp(var(--space-4), 3vw, var(--space-6)); }
.noscript { margin: var(--space-4); padding: var(--space-4); background: var(--white); border-left: .35rem solid var(--red); }
.button { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem .85rem; color: var(--ink); background: var(--white); border: 2px solid var(--brand); border-radius: var(--radius-sm); font-weight: 800; line-height: 1.15; text-align: center; text-decoration: none; cursor: pointer; transition: transform var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast); }
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button--primary, .button--battle { color: var(--white); background: var(--brand); }
.button--quiet { color: var(--white); background: transparent; border-color: rgb(255 255 255 / 65%); }
.button--danger { color: #812727; border-color: #b64b4b; background: #fffafa; }
.button--card { width: 100%; color: var(--white); background: var(--brand); }
.button-row, .detail-actions, .battle-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.text-link, .back-link { font-weight: 800; text-underline-offset: .2em; }
.back-link { display: inline-block; margin-bottom: var(--space-4); }
.eyebrow { margin-bottom: var(--space-1); color: var(--brand-2); font-size: .76rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.muted { color: var(--muted); }

.catalog-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: clamp(var(--space-4), 3vw, var(--space-6)); align-items: start; }
.filter-panel { position: sticky; top: 10.2rem; }
.filter-panel h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.type-rail { display: grid; gap: .35rem; }
.type-filter { --type-accent: var(--brand-2); min-height: 2.9rem; display: grid; grid-template-columns: 1.65rem 1fr auto; align-items: center; gap: .45rem; padding: .55rem .65rem; background: rgb(255 255 255 / 62%); border: 2px solid transparent; border-radius: var(--radius-sm); font-weight: 800; text-decoration: none; }
.type-filter:hover { background: var(--white); }
.type-filter.is-active { background: var(--white); border-color: var(--type-accent); box-shadow: inset .3rem 0 var(--type-accent); }
.type-filter__icon { font-size: 1.2rem; text-align: center; }
.type-filter__count { color: var(--muted); font-size: .78rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-5); }
.page-heading h1 { margin-bottom: .5rem; }
.page-heading p:last-child { max-width: 48rem; margin-bottom: 0; color: var(--muted); }
.page-heading--center { justify-content: center; text-align: center; }
.result-count { flex: none; padding: .42rem .8rem; background: var(--white); border: 1px solid var(--line); border-radius: 999px; font-weight: 850; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: clamp(.85rem, 2vw, 1.4rem); align-items: start; }

.pokemon-card { position: relative; width: 100%; max-width: 21rem; min-height: 32rem; justify-self: center; perspective: 1000px; }
.card-face { min-height: 32rem; display: flex; flex-direction: column; gap: var(--space-2); padding: .85rem; background: var(--paper); border: .28rem solid var(--brand); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); transition: opacity var(--motion-card), transform var(--motion-card); }
.card-face--front { visibility: visible; opacity: 1; pointer-events: auto; transform: rotateY(0); }
.card-face--back { position: absolute; inset: 0; visibility: hidden; opacity: 0; pointer-events: none; transform: rotateY(180deg); overflow: auto; }
.pokemon-card.is-flipped .card-face--front { visibility: hidden; opacity: 0; pointer-events: none; transform: rotateY(-180deg); }
.pokemon-card.is-flipped .card-face--back { visibility: visible; opacity: 1; pointer-events: auto; transform: rotateY(0); }
.card-front__top, .card-back__heading, .detail-title, .attack__heading { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.card-front__top h3, .card-back__heading h3 { margin: 0; font-size: 1.25rem; }
.hp { flex: none; font-size: 1.2rem; font-weight: 950; }
.hp span { color: var(--muted); font-size: .65em; }
.card-art { position: relative; flex: 1; min-height: 19rem; display: grid; place-items: center; overflow: hidden; background: #dce7e0; border-radius: var(--radius-md); }
.card-art img { width: 100%; height: 100%; object-fit: contain; }
.card-front__footer { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.type-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.type-pill, .energy { display: inline-flex; align-items: center; padding: .18rem .5rem; color: var(--ink); background: #e7eee9; border: 1px solid rgb(24 48 43 / 18%); border-radius: 999px; font-size: .72rem; font-weight: 850; }
.type-pill--fire, .energy--fire { background: #ffd9cc; }
.type-pill--water, .energy--water { background: #d9ecff; }
.type-pill--grass, .energy--grass { background: #dcefd5; }
.type-pill--lightning, .energy--lightning { background: #fff0a8; }
.type-pill--psychic, .energy--psychic { background: #ecd9f5; }
.type-pill--fighting, .energy--fighting { background: #ead7c7; }
.type-pill--darkness, .energy--darkness { color: var(--white); background: #4b4c5d; }
.type-pill--metal, .energy--metal { background: #dfe4e7; }
.type-pill--fairy, .energy--fairy { background: #ffdff1; }
.type-pill--dragon, .energy--dragon { background: #e8dfb0; }
.type-pill--colorless, .energy--colorless { background: #eee; }
.descriptor { color: var(--muted); font-size: .8rem; }
.fact-list, .attack-list { list-style: none; padding: 0; margin: 0; }
.fact-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.fact-list li { padding: .35rem; background: #f0f3ef; border-radius: .35rem; text-align: center; font-size: .68rem; }
.fact-list span, .fact-list strong { display: block; }
.fact-list span { color: var(--muted); }
.card-attacks { flex: 1; min-height: 0; overflow: auto; }
.card-attacks h4 { margin: .2rem 0 .35rem; }
.attack-list { display: grid; gap: var(--space-2); }
.attack { padding: .7rem; background: #f3f0e4; border-radius: var(--radius-sm); }
.attack__cost { display: flex; flex-wrap: wrap; gap: .2rem; }
.attack__damage { font-size: 1.1rem; }
.attack p { margin: .45rem 0 0; font-size: .86rem; }
.attack-list--compact .attack { padding: .45rem; }
.attack-list--compact .attack p { font-size: .74rem; }
.card-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.card-action { min-height: 3.1rem; padding: .35rem; flex-direction: column; font-size: .68rem; }
.card-action.is-selected { background: #d5ebdf; box-shadow: inset 0 0 0 2px var(--brand); }
.card-face--back > .text-link { text-align: center; font-size: .8rem; }

.collection-notice { display: flex; flex-wrap: wrap; gap: .25rem var(--space-3); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); color: #284b40; background: #dfeee7; border-left: .35rem solid var(--brand-2); border-radius: var(--radius-sm); }
.collection-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.collection-toolbar .collection-notice { flex: 1; margin: 0; }
.trade-comparison { margin-bottom: var(--space-6); padding: var(--space-4); background: #f6f1df; border: 2px solid #d9c77d; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.trade-comparison h2 { margin-bottom: .35rem; }
.trade-comparison > div > p:last-child { margin-bottom: var(--space-3); color: var(--muted); }
.trade-comparison__scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); }
.trade-comparison table { width: 100%; min-width: max-content; border-collapse: collapse; text-align: left; }
.trade-comparison th, .trade-comparison td { min-width: 10rem; padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.trade-comparison thead th { position: sticky; top: 0; z-index: 1; color: var(--white); background: var(--brand); font-weight: 900; }
.trade-comparison tbody th { min-width: 11rem; color: var(--brand); background: #f6f8f2; font-size: .84rem; }
.trade-comparison tbody tr:last-child > * { border-bottom: 0; }
.trade-comparison tbody tr:last-child { background: #fff7ca; }
.empty-state, .state-panel { min-height: 22rem; display: grid; place-content: center; justify-items: center; padding: var(--space-6); background: rgb(255 255 255 / 70%); border: 2px dashed var(--line); border-radius: var(--radius-lg); text-align: center; }
.empty-state__icon, .state-panel > span { font-size: 3rem; }
.state-panel { max-width: 48rem; margin-inline: auto; }
.state-panel--error { border-color: #d39595; }
.spinner { width: 3rem; aspect-ratio: 1; border: .35rem solid #c9d8d1; border-top-color: var(--brand); border-radius: 50%; animation: spin .75s linear infinite; }

.detail-page, .help-page { max-width: 78rem; margin-inline: auto; }
.detail-layout { display: grid; grid-template-columns: minmax(18rem, 28rem) minmax(0, 1fr); gap: clamp(var(--space-5), 5vw, 4rem); align-items: start; }
.detail-art { overflow: hidden; background: #dce7e0; border: .4rem solid var(--brand); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.detail-art img { width: 100%; aspect-ratio: 5 / 7; object-fit: contain; }
.detail-copy > section { margin-top: var(--space-5); }
.detail-copy .fact-list { max-width: 34rem; margin-block: var(--space-4); }
.lead { font-size: 1.08rem; }
.detail-actions { justify-content: flex-start; margin-block: var(--space-5); }
.detail-actions .card-action { min-width: 8.5rem; flex-direction: row; font-size: .82rem; }
.metadata { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
.metadata div { padding: .65rem; background: rgb(255 255 255 / 55%); border-radius: var(--radius-sm); }
.metadata dt { color: var(--muted); font-size: .78rem; }
.metadata dd { margin: 0; font-weight: 800; }
.ability { padding: var(--space-3); background: #eee4f2; border-radius: var(--radius-sm); }
.help-page { max-width: 52rem; padding: clamp(var(--space-4), 5vw, var(--space-6)); background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.help-page section { margin-block: var(--space-5); }

.battle-page { max-width: 82rem; margin-inline: auto; }
.battle-arena { display: grid; grid-template-columns: minmax(0, 1fr) 7rem minmax(0, 1fr); gap: var(--space-3); align-items: center; }
.battle-slot { position: relative; min-height: 34rem; display: flex; flex-direction: column; align-items: center; padding: var(--space-4); background: var(--paper); border: .3rem solid var(--brand); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); text-align: center; transition: transform 500ms, box-shadow 500ms; }
.battle-slot.is-winner { border-color: #a47700; box-shadow: 0 0 0 .35rem var(--sun), var(--shadow-md); }
.battle-slot.is-draw { border-color: #45739b; }
.battle-slot--empty { justify-content: center; border-style: dashed; box-shadow: none; }
.battle-slot--empty > span { font-size: 3rem; }
.battle-card-art { width: min(100%, 18rem); margin-bottom: var(--space-3); overflow: hidden; background: #dce7e0; border-radius: var(--radius-md); }
.battle-card-art img { width: 100%; aspect-ratio: 5 / 7; object-fit: contain; }
.crown-zone { z-index: 2; display: grid; justify-items: center; color: #775c04; transition: transform 700ms cubic-bezier(.2, .8, .2, 1); }
.crown { font-size: 4rem; filter: drop-shadow(0 .18rem 0 #fff); }
.crown-zone strong { font-size: .75rem; text-transform: uppercase; }
.crown-zone.crown-left { transform: translateX(calc(-50% - 3.5rem)); }
.crown-zone.crown-right { transform: translateX(calc(50% + 3.5rem)); }
.battle-page.has-result .crown-zone.crown-left { animation: crown-left 700ms cubic-bezier(.2, .8, .2, 1); }
.battle-page.has-result .crown-zone.crown-right { animation: crown-right 700ms cubic-bezier(.2, .8, .2, 1); }
.crown-zone.is-draw strong { font-size: 0; }
.crown-zone.is-draw strong::after { content: "Draw"; font-size: .75rem; }
.battle-page.has-result:not(.is-animating) .crown-zone:not(.is-draw) { visibility: hidden; opacity: 0; }
.winner-crown { position: absolute; z-index: 4; top: -.95rem; right: -.75rem; display: grid; place-items: center; width: 3.25rem; aspect-ratio: 1; background: #fff5bf; border: .2rem solid #9b7600; border-radius: 50%; font-size: 1.65rem; filter: drop-shadow(0 .35rem .2rem rgb(0 0 0 / 18%)); animation: crown-land 620ms cubic-bezier(.2, .9, .25, 1.25) both; }
.confetti { position: absolute; inset: -1.5rem -1rem auto; z-index: 3; height: 7rem; pointer-events: none; overflow: visible; }
.confetti i { position: absolute; width: .55rem; height: .9rem; background: var(--sun); border-radius: .1rem; animation: confetti-pop 1100ms ease-out both; }
.confetti i:nth-child(2n) { background: #e85d54; }
.confetti i:nth-child(3n) { background: #4a8dd8; }
.confetti i:nth-child(4n) { background: #72a85f; }
.confetti i:nth-child(1) { --drift: -3.5rem; left: 12%; animation-delay: 20ms; }
.confetti i:nth-child(2) { --drift: -2rem; left: 23%; animation-delay: 120ms; }
.confetti i:nth-child(3) { --drift: -1rem; left: 35%; animation-delay: 60ms; }
.confetti i:nth-child(4) { --drift: .5rem; left: 48%; animation-delay: 160ms; }
.confetti i:nth-child(5) { --drift: 2rem; left: 60%; animation-delay: 10ms; }
.confetti i:nth-child(6) { --drift: 3.5rem; left: 72%; animation-delay: 140ms; }
.confetti i:nth-child(7) { --drift: 2.5rem; left: 84%; animation-delay: 80ms; }
.confetti i:nth-child(8) { --drift: 4rem; left: 92%; animation-delay: 190ms; }
.confetti i:nth-child(9) { --drift: -4rem; left: 5%; animation-delay: 170ms; }
.score-breakdown { width: 100%; margin: var(--space-3) 0; }
.score-breakdown div { display: flex; justify-content: space-between; gap: var(--space-2); padding: .35rem .2rem; border-bottom: 1px solid var(--line); text-align: left; }
.score-breakdown dd { margin: 0; font-weight: 800; text-align: right; }
.score-total { font-size: 1.12rem; }
.battle-summary { display: flex; justify-content: space-between; width: 100%; margin-block: var(--space-3); }
.battle-outcome { margin: var(--space-5) auto var(--space-3); font-size: 1.25rem; font-weight: 900; text-align: center; }
.button--battle { min-width: 10rem; color: var(--ink); background: var(--sun); border-color: #806506; font-size: 1.12rem; }
.battle-page.is-animating .strongest-attack { animation: attack-highlight 650ms ease-in-out 2; border-radius: .35rem; }
.battle-page.is-animating .battle-slot.is-attacking[data-battle-side="left"] { animation: attack-from-left 1050ms cubic-bezier(.2, .7, .2, 1) both; }
.battle-page.is-animating .battle-slot.is-attacking[data-battle-side="right"] { animation: attack-from-right 1050ms cubic-bezier(.2, .7, .2, 1) both; }
.battle-page.is-animating .battle-slot.is-defending[data-battle-side="left"] { animation: knocked-left 1050ms cubic-bezier(.2, .7, .2, 1) both; }
.battle-page.is-animating .battle-slot.is-defending[data-battle-side="right"] { animation: knocked-right 1050ms cubic-bezier(.2, .7, .2, 1) both; }
.battle-page.is-animating .battle-slot.is-clashing[data-battle-side="left"] { animation: clash-left 820ms ease-in-out both; }
.battle-page.is-animating .battle-slot.is-clashing[data-battle-side="right"] { animation: clash-right 820ms ease-in-out both; }

@keyframes spin { to { transform: rotate(1turn); } }
@keyframes ready-pulse { 50% { box-shadow: 0 0 0 .25rem rgb(245 215 120 / 30%); } }
@keyframes attack-highlight { 50% { color: #5b4300; background: var(--sun); box-shadow: 0 0 0 .2rem rgb(245 215 120 / 35%); } }
@keyframes attack-from-left { 0%, 100% { transform: translateX(0) rotate(0); } 38% { transform: translateX(5.25rem) rotate(3deg) scale(1.03); } 58% { transform: translateX(4.4rem) rotate(-1deg); } }
@keyframes attack-from-right { 0%, 100% { transform: translateX(0) rotate(0); } 38% { transform: translateX(-5.25rem) rotate(-3deg) scale(1.03); } 58% { transform: translateX(-4.4rem) rotate(1deg); } }
@keyframes knocked-left { 0%, 32% { transform: translateX(0) rotate(0); } 47% { transform: translateX(-.8rem) rotate(-4deg); } 72% { transform: translateX(-3rem) rotate(-330deg) scale(.92); } 100% { transform: translateX(0) rotate(-360deg); } }
@keyframes knocked-right { 0%, 32% { transform: translateX(0) rotate(0); } 47% { transform: translateX(.8rem) rotate(4deg); } 72% { transform: translateX(3rem) rotate(330deg) scale(.92); } 100% { transform: translateX(0) rotate(360deg); } }
@keyframes clash-left { 0%, 100% { transform: translateX(0); } 45% { transform: translateX(1.25rem) rotate(2deg); } 65% { transform: translateX(-.5rem); } }
@keyframes clash-right { 0%, 100% { transform: translateX(0); } 45% { transform: translateX(-1.25rem) rotate(-2deg); } 65% { transform: translateX(.5rem); } }
@keyframes crown-land { 0% { opacity: 0; transform: translateY(-7rem) rotate(-35deg) scale(.55); } 72% { opacity: 1; transform: translateY(.35rem) rotate(10deg) scale(1.08); } 100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); } }
@keyframes confetti-pop { 0% { opacity: 0; transform: translate(0, 1.5rem) rotate(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift), 5.5rem) rotate(510deg); } }
@keyframes attack-from-top { 0%, 100% { transform: translateY(0) rotate(0); } 38% { transform: translateY(2.75rem) rotate(2deg) scale(1.02); } 58% { transform: translateY(2rem) rotate(-1deg); } }
@keyframes attack-from-bottom { 0%, 100% { transform: translateY(0) rotate(0); } 38% { transform: translateY(-2.75rem) rotate(-2deg) scale(1.02); } 58% { transform: translateY(-2rem) rotate(1deg); } }
@keyframes knocked-top { 0%, 32% { transform: translateY(0) rotate(0); } 47% { transform: translateY(-.7rem) rotate(-4deg); } 72% { transform: translateY(-2rem) rotate(-330deg) scale(.94); } 100% { transform: translateY(0) rotate(-360deg); } }
@keyframes knocked-bottom { 0%, 32% { transform: translateY(0) rotate(0); } 47% { transform: translateY(.7rem) rotate(4deg); } 72% { transform: translateY(2rem) rotate(330deg) scale(.94); } 100% { transform: translateY(0) rotate(360deg); } }
@keyframes crown-left { from { transform: translateX(0); } to { transform: translateX(calc(-50% - 3.5rem)); } }
@keyframes crown-right { from { transform: translateX(0); } to { transform: translateX(calc(50% + 3.5rem)); } }

@media (max-width: 70rem) {
  .site-header { position: relative; }
  .filter-panel { top: 1rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
  .pokemon-card, .card-face { min-height: 30rem; }
}

@media (max-width: 50rem) {
  .site-header__top { align-items: flex-start; flex-direction: column; }
  .primary-nav { width: 100%; justify-content: flex-start; }
  .search-form { grid-template-columns: 1fr; justify-content: stretch; }
  .catalog-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-panel { position: static; min-width: 0; }
  .filter-panel h2 { margin-bottom: .45rem; }
  .type-rail { display: flex; gap: .45rem; overflow-x: auto; padding: .15rem .15rem .7rem; scroll-snap-type: x proximity; }
  .type-filter { flex: 0 0 auto; min-width: 7.5rem; scroll-snap-align: start; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-art { width: min(100%, 27rem); margin-inline: auto; }
  .battle-arena { grid-template-columns: 1fr; }
  .crown-zone { min-height: 5rem; }
  .crown-zone.crown-left, .crown-zone.crown-right { transform: none; }
  .battle-page.has-result .crown-zone.crown-left, .battle-page.has-result .crown-zone.crown-right { animation: none; }
  .battle-slot { min-height: 0; }
  .battle-card-art { width: min(80%, 17rem); }
  .battle-page.is-animating .battle-slot.is-attacking[data-battle-side="left"] { animation-name: attack-from-top; }
  .battle-page.is-animating .battle-slot.is-attacking[data-battle-side="right"] { animation-name: attack-from-bottom; }
  .battle-page.is-animating .battle-slot.is-defending[data-battle-side="left"] { animation-name: knocked-top; }
  .battle-page.is-animating .battle-slot.is-defending[data-battle-side="right"] { animation-name: knocked-bottom; }
  .trade-comparison { padding: var(--space-3); }
  .trade-comparison th, .trade-comparison td { min-width: 8.5rem; }
}

@media (max-width: 34rem) {
  .site-header { padding: .75rem; }
  .primary-nav { display: grid; grid-template-columns: repeat(2, 1fr); }
  .nav-control { justify-content: center; }
  .search-form__controls { grid-template-columns: 1fr auto; }
  .search-form input { grid-column: 1 / -1; }
  #app { padding: var(--space-3); }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .card-grid { grid-template-columns: 1fr; }
  .pokemon-card { max-width: 22rem; }
  .collection-toolbar { flex-direction: column; }
  .collection-toolbar .button { width: 100%; }
  .metadata { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .card-face--front, .card-face--back, .pokemon-card.is-flipped .card-face--front, .pokemon-card.is-flipped .card-face--back { transform: none; }
  .crown-zone.crown-left, .crown-zone.crown-right { transform: none; }
}

@media (forced-colors: active) {
  .type-filter.is-active, .card-action.is-selected, .battle-slot.is-winner { outline: 3px solid Highlight; }
}
