:root {
  color-scheme: light;
  --dex-ink: #09243a;
  --dex-muted: #607b8d;
  --dex-navy: #071d2e;
  --dex-blue: #0b7ee7;
  --dex-green: #1fa875;
  --dex-lime: #b8e762;
  --dex-gold: #ffc83d;
  --dex-paper: #f3f7f6;
  --dex-line: rgba(9,36,58,.12);
  --dex-shadow: 0 18px 50px rgba(5,38,61,.11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--dex-ink); background: var(--dex-paper); font-family: Inter, Manrope, "Segoe UI", Arial, sans-serif; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.dex-wrap { width: min(1240px, calc(100% - 48px)); margin-inline: auto; }
.dex-skip { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 15px; border-radius: 10px; color: #fff; background: var(--dex-navy); transform: translateY(-150%); }
.dex-skip:focus { transform: none; }

.dex-nav { position: absolute; z-index: 20; top: 14px; left: 50%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: min(1240px, calc(100% - 48px)); min-height: 68px; padding: 8px 10px 8px 16px; border: 1px solid rgba(255,255,255,.22); border-radius: 21px; color: #fff; background: rgba(3,24,39,.38); backdrop-filter: blur(17px); transform: translateX(-50%); }
.dex-brand { display: inline-flex; align-items: center; gap: 9px; width: max-content; }
.dex-brand img { width: 47px; height: 47px; object-fit: contain; filter: drop-shadow(0 5px 10px rgba(0,0,0,.22)); }
.dex-brand > span { display: grid; line-height: 1; }
.dex-brand b { color: #fff; font-size: 17px; font-weight: 950; letter-spacing: -.6px; }
.dex-brand b span { color: var(--dex-gold); }
.dex-brand small { margin-top: 5px; color: rgba(255,255,255,.58); font-size: 7px; font-weight: 850; letter-spacing: 1.2px; }
.dex-nav nav { display: flex; gap: 5px; padding: 4px; border-radius: 13px; background: rgba(0,15,25,.2); }
.dex-nav nav a { padding: 10px 13px; border-radius: 10px; color: rgba(255,255,255,.64); font-size: 11px; font-weight: 800; }
.dex-nav nav a.is-active { color: #fff; background: rgba(255,255,255,.15); }
.dex-play { justify-self: end; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 17px; border-radius: 13px; color: var(--dex-ink); background: #fff; font-size: 11px; font-weight: 880; }
.dex-play b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; background: var(--dex-blue); }

.dex-hero { position: relative; min-height: 540px; overflow: hidden; color: #fff; background: radial-gradient(circle at 79% 43%, rgba(38,171,236,.38), transparent 24%), radial-gradient(circle at 16% 16%, rgba(27,143,201,.18), transparent 27%), linear-gradient(145deg, #0a3c5b, #061b2a 72%); }
body[data-pokedex-mode="game"] .dex-hero { background: radial-gradient(circle at 79% 43%, rgba(116,218,119,.33), transparent 25%), radial-gradient(circle at 17% 14%, rgba(84,193,130,.16), transparent 27%), linear-gradient(145deg, #0b493b, #061e27 72%); }
.dex-hero::before { content: ""; position: absolute; inset: 0; opacity: .2; background-image: radial-gradient(circle at center, rgba(255,255,255,.34) 1px, transparent 1px); background-size: 24px 24px; mask-image: linear-gradient(90deg, #000, transparent 60%); }
.dex-hero-orb { position: absolute; top: 110px; right: calc(50% - 560px); width: 500px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 48px rgba(255,255,255,.035), 0 0 0 96px rgba(255,255,255,.02), inset 0 0 100px rgba(43,175,239,.13); }
.dex-hero-grid { position: relative; display: grid; grid-template-columns: 1fr .9fr; align-items: center; min-height: 540px; padding: 62px 0 58px; }
.dex-hero-copy { position: relative; z-index: 3; max-width: 710px; }
.dex-hero-copy > span { color: #7ed5ff; font-size: 9px; font-weight: 920; letter-spacing: 1.7px; }
body[data-pokedex-mode="game"] .dex-hero-copy > span { color: #8ef0b4; }
.dex-hero h1 { margin: 16px 0 19px; font-size: clamp(54px, 5.3vw, 79px); font-weight: 950; line-height: .93; letter-spacing: -4.5px; }
.dex-hero h1 em { color: var(--dex-gold); font-style: normal; }
body[data-pokedex-mode="game"] .dex-hero h1 em { color: var(--dex-lime); }
.dex-hero-copy p { max-width: 590px; margin: 0; color: rgba(255,255,255,.67); font-size: 15px; line-height: 1.65; }
.dex-hero-art { position: relative; align-self: stretch; }
.dex-hero-art img { position: absolute; object-fit: contain; filter: drop-shadow(0 24px 20px rgba(0,0,0,.36)); }
.dex-hero-art img:nth-child(1) { z-index: 2; right: 4%; bottom: -30px; width: 360px; }
.dex-hero-art img:nth-child(2) { z-index: 3; right: 43%; bottom: 12px; width: 260px; }
.dex-hero-art img:nth-child(3) { z-index: 1; right: -11%; bottom: 22px; width: 245px; opacity: .88; }

.dex-browser { position: relative; z-index: 4; padding: 0 0 100px; }
.dex-mode-switch { display: grid; grid-template-columns: repeat(2,1fr); width: min(850px,100%); margin: -42px auto 82px; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: #fff; box-shadow: 0 22px 70px rgba(2,30,50,.2); }
.dex-mode-switch a { position: relative; display: grid; gap: 4px; min-height: 112px; padding: 25px 30px; transition: background .2s ease; }
.dex-mode-switch a + a { border-left: 1px solid var(--dex-line); }
.dex-mode-switch a:hover { background: #f7fbfc; }
.dex-mode-switch a.is-active { color: #fff; background: linear-gradient(135deg, #0c7fe8, #075db8); }
body[data-pokedex-mode="game"] .dex-mode-switch a.is-active { background: linear-gradient(135deg, #25ae74, #10734d); }
.dex-mode-switch small { color: var(--dex-blue); font-size: 8px; font-weight: 900; letter-spacing: 1.4px; }
body[data-pokedex-mode="game"] .dex-mode-switch small { color: var(--dex-green); }
.dex-mode-switch a.is-active small { color: rgba(255,255,255,.65); }
.dex-mode-switch b { font-size: 18px; letter-spacing: -.5px; }
.dex-mode-switch span { color: var(--dex-muted); font-size: 9px; }
.dex-mode-switch a.is-active span { color: rgba(255,255,255,.65); }
.dex-browser-head { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.dex-browser-head > div > span { color: var(--dex-blue); font-size: 9px; font-weight: 920; letter-spacing: 1.5px; }
body[data-pokedex-mode="game"] .dex-browser-head > div > span { color: var(--dex-green); }
.dex-browser-head h2 { margin: 8px 0 0; font-size: clamp(39px, 4vw, 58px); line-height: 1; letter-spacing: -2.8px; }
.dex-browser-head > p { margin: 0 0 6px; color: var(--dex-muted); font-size: 11px; font-weight: 680; }

.dex-filters { display: grid; grid-template-columns: 1.8fr repeat(3,1fr) auto; align-items: end; gap: 9px; padding: 13px; border: 1px solid var(--dex-line); border-radius: 22px; background: #fff; box-shadow: var(--dex-shadow); }
.dex-filters-game { grid-template-columns: 1.65fr repeat(4,1fr) auto; }
.dex-filters label { display: grid; gap: 6px; min-width: 0; }
.dex-filters label > span { padding-left: 3px; color: #688192; font-size: 8px; font-weight: 820; }
.dex-filters input, .dex-filters select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid #dce6e9; border-radius: 12px; outline: none; color: var(--dex-ink); background: #f7faf9; font-size: 10px; font-weight: 700; }
.dex-filters input:focus, .dex-filters select:focus { border-color: var(--dex-blue); box-shadow: 0 0 0 4px rgba(11,126,231,.1); background: #fff; }
body[data-pokedex-mode="game"] .dex-filters input:focus, body[data-pokedex-mode="game"] .dex-filters select:focus { border-color: var(--dex-green); box-shadow: 0 0 0 4px rgba(31,168,117,.1); }
.dex-search > div { position: relative; }
.dex-search > div b { position: absolute; z-index: 2; top: 50%; left: 13px; color: #7b929f; font-size: 17px; transform: translateY(-50%); }
.dex-search input { padding-left: 38px; }
.dex-filters > button { height: 46px; padding: 0 14px; border: 1px solid #dbe5e8; border-radius: 12px; color: var(--dex-muted); background: #fff; font-size: 9px; font-weight: 850; cursor: pointer; }
.dex-status { display: flex; align-items: center; gap: 9px; min-height: 34px; margin: 16px 4px; color: var(--dex-muted); font-size: 9px; font-weight: 700; }
.dex-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--dex-green); box-shadow: 0 0 0 5px rgba(31,168,117,.1); }
.dex-status.is-loading i { background: var(--dex-blue); animation: dexPulse 1s infinite; }
.dex-status.is-error { color: #be3541; }
.dex-status.is-error i { background: #e54552; }
@keyframes dexPulse { 50% { opacity:.25; transform:scale(.75); } }

.dex-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; min-height: 300px; }
.dex-card { position: relative; display: grid; min-width: 0; min-height: 355px; overflow: hidden; padding: 16px; border: 1px solid var(--dex-line); border-radius: 24px; color: var(--dex-ink); background: #fff; box-shadow: 0 9px 30px rgba(3,35,57,.055); font: inherit; text-align: left; cursor: pointer; transition: transform .23s ease, box-shadow .23s ease, border-color .23s ease; }
.dex-card:hover { z-index: 2; border-color: rgba(11,126,231,.32); box-shadow: 0 20px 48px rgba(3,35,57,.14); transform: translateY(-5px); }
body[data-pokedex-mode="game"] .dex-card:hover { border-color: rgba(31,168,117,.38); }
.dex-card:focus-visible { outline: 3px solid var(--dex-blue); outline-offset: 3px; }
.dex-card-top { display: flex; align-items: center; justify-content: space-between; }
.dex-card-number { color: #718895; font-size: 9px; font-weight: 900; letter-spacing: .7px; }
.dex-card-generation { padding: 6px 8px; border-radius: 8px; color: #517080; background: #edf4f5; font-size: 7px; font-weight: 880; }
.dex-card-visual { position: relative; display: grid; place-items: center; min-height: 187px; margin: 8px -4px 4px; overflow: hidden; border-radius: 19px; background: radial-gradient(circle at 50% 47%, var(--type-soft, #dceef7) 0 37%, #f6faf9 38%); }
.dex-card-visual::before { content: ""; position: absolute; width: 110px; height: 110px; border: 1px solid rgba(255,255,255,.75); border-radius: 50%; box-shadow: 0 0 0 18px rgba(255,255,255,.2); }
.dex-card-visual img { position: relative; z-index: 2; width: 175px; height: 175px; object-fit: contain; filter: drop-shadow(0 15px 12px rgba(1,30,49,.2)); transition: transform .25s ease; }
.dex-card:hover .dex-card-visual img { transform: translateY(-4px) scale(1.035); }
.dex-card-title { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-top: 8px; }
.dex-card-title > div { min-width: 0; }
.dex-card-title h3 { max-width: 205px; margin: 0; overflow: hidden; font-size: 19px; line-height: 1.15; letter-spacing: -.7px; text-overflow: ellipsis; white-space: nowrap; }
.dex-card-title small { display: block; margin-top: 4px; overflow: hidden; color: #78909d; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.dex-type-list { display: flex; flex-wrap: wrap; gap: 5px; }
.dex-type { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 999px; color: var(--type-ink, #234); background: var(--type-soft, #e7eff2); font-size: 7px; font-weight: 900; text-transform: uppercase; }
.dex-card-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 12px; padding-top: 11px; border-top: 1px solid #e9eff1; }
.dex-card-meta span { display: grid; gap: 3px; min-width: 0; }
.dex-card-meta small { color: #8498a3; font-size: 6px; font-weight: 850; letter-spacing: .6px; }
.dex-card-meta b { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.dex-readiness { display: inline-flex; align-items: center; gap: 6px; width: max-content; max-width: 100%; min-height: 24px; margin-top: 9px; padding: 0 8px; border-radius: 999px; color: #147146; background: #e1f6e9; font-size: 7px; font-weight: 880; }
.dex-readiness::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #22b66f; }
.dex-readiness.is-prototype { color: #816316; background: #fff2c9; }
.dex-readiness.is-prototype::before { background: #e4a91e; }
.dex-skill-slots { display: flex; align-items: center; gap: 5px; margin-top: 10px; }
.dex-skill-slots i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; background: var(--dex-navy); font-size: 7px; font-style: normal; font-weight: 900; }
.dex-skill-slots span { margin-left: auto; color: #7b919d; font-size: 7px; font-weight: 800; }
.dex-skill-summary { margin-top: 10px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-radius: 10px; color: #4f6d78; background: #edf5f2; }
.dex-skill-summary b { color: #147146; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.dex-skill-summary span { overflow: hidden; font-size: 7px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.dex-card-skeleton { min-height: 355px; border-radius: 24px; background: linear-gradient(100deg,#edf3f3 25%,#f8fbfb 42%,#edf3f3 58%); background-size: 260% 100%; animation: dexSkeleton 1.2s linear infinite; }
@keyframes dexSkeleton { to { background-position-x:-150%; } }
.dex-load-more { display: flex; align-items: center; justify-content: center; gap: 9px; min-width: 190px; min-height: 50px; margin: 28px auto 0; border: 1px solid var(--dex-line); border-radius: 14px; color: var(--dex-ink); background: #fff; box-shadow: 0 9px 24px rgba(3,35,57,.07); font-size: 10px; font-weight: 880; cursor: pointer; }
.dex-load-more span { color: var(--dex-blue); }
body[data-pokedex-mode="game"] .dex-load-more span { color: var(--dex-green); }
.dex-empty { padding: 70px 20px; border: 1px dashed #cfdadd; border-radius: 24px; text-align: center; }
.dex-empty b { font-size: 23px; }
.dex-empty p { color: var(--dex-muted); font-size: 11px; }
.dex-empty button { padding: 11px 16px; border: 0; border-radius: 10px; color: #fff; background: var(--dex-blue); font-size: 9px; font-weight: 850; cursor: pointer; }

.dex-dialog { width: min(950px, calc(100vw - 34px)); max-width: none; max-height: min(860px, calc(100svh - 34px)); padding: 0; overflow: auto; border: 1px solid rgba(255,255,255,.8); border-radius: 28px; color: var(--dex-ink); background: #fff; box-shadow: 0 42px 130px rgba(0,20,35,.48); }
.dex-dialog::backdrop { background: rgba(2,18,29,.73); backdrop-filter: blur(12px); }
.dex-dialog-close { position: sticky; z-index: 8; top: 15px; float: right; display: grid; place-items: center; width: 40px; height: 40px; margin: 15px 15px -55px 0; border: 1px solid rgba(9,36,58,.09); border-radius: 13px; color: #6c8390; background: rgba(255,255,255,.88); box-shadow: 0 7px 20px rgba(3,32,51,.12); font-size: 25px; line-height: 1; cursor: pointer; backdrop-filter: blur(10px); }
.dex-dialog-hero { display: grid; grid-template-columns: 360px 1fr; min-height: 350px; overflow: hidden; background: linear-gradient(135deg, var(--type-soft, #ddecf4), #fff 65%); }
.dex-dialog-visual { position: relative; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle, rgba(255,255,255,.82) 0 30%, transparent 31%); }
.dex-dialog-visual::before { content: ""; position: absolute; width: 230px; height: 230px; border: 1px solid rgba(255,255,255,.82); border-radius: 50%; box-shadow: 0 0 0 35px rgba(255,255,255,.16); }
.dex-dialog-visual img { position: relative; z-index: 2; width: 300px; height: 300px; object-fit: contain; filter: drop-shadow(0 22px 19px rgba(1,30,48,.23)); }
.dex-dialog-copy { align-self: center; padding: 54px 48px; }
.dex-dialog-copy > small { color: #628091; font-size: 8px; font-weight: 900; letter-spacing: 1.2px; }
.dex-dialog-copy h2 { margin: 8px 0 4px; font-size: 46px; line-height: 1; letter-spacing: -2.2px; }
.dex-dialog-copy > em { display: block; margin-bottom: 15px; color: #6d8796; font-size: 11px; font-style: normal; }
.dex-dialog-copy .dex-type-list { margin-bottom: 20px; }
.dex-dialog-facts { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.dex-dialog-facts span { display: grid; gap: 5px; padding: 12px; border: 1px solid rgba(9,36,58,.09); border-radius: 12px; background: rgba(255,255,255,.6); }
.dex-dialog-facts small { color: #728a97; font-size: 6px; font-weight: 850; }
.dex-dialog-facts b { font-size: 10px; }
.dex-dialog-body { display: grid; grid-template-columns: .9fr 1.1fr; gap: 30px; padding: 34px; }
.dex-dialog-panel { padding: 23px; border: 1px solid var(--dex-line); border-radius: 20px; }
.dex-dialog-panel > small { color: var(--dex-blue); font-size: 8px; font-weight: 900; letter-spacing: 1.2px; }
body[data-pokedex-mode="game"] .dex-dialog-panel > small { color: var(--dex-green); }
.dex-dialog-panel h3 { margin: 7px 0 15px; font-size: 22px; letter-spacing: -.7px; }
.dex-stat-list { display: grid; gap: 11px; margin: 0; }
.dex-stat-list div { display: grid; grid-template-columns: 88px 1fr 28px; align-items: center; gap: 8px; }
.dex-stat-list dt { color: var(--dex-muted); font-size: 8px; font-weight: 730; }
.dex-stat-list dd { height: 7px; margin: 0; overflow: hidden; border-radius: 99px; background: #e9eff0; }
.dex-stat-list dd i { display: block; width: var(--stat); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--dex-blue), #35c392); }
body[data-pokedex-mode="game"] .dex-stat-list dd i { background: linear-gradient(90deg, var(--dex-green), var(--dex-lime)); }
.dex-stat-list b { font-size: 9px; }
.dex-game-trait { display: grid; gap: 8px; }
.dex-game-trait article { padding: 13px; border-radius: 13px; background: #f2f7f6; }
.dex-game-trait article small { color: #738b98; font-size: 6px; font-weight: 850; letter-spacing: .7px; }
.dex-game-trait article b { display: block; margin: 5px 0; font-size: 11px; }
.dex-game-trait article p { margin: 0; color: var(--dex-muted); font-size: 8px; line-height: 1.5; }
.dex-skills { grid-column: 1 / 3; }
.dex-skill-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.dex-skill { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 11px; min-height: 82px; padding: 11px; border: 1px solid var(--dex-line); border-radius: 15px; }
.dex-skill-icon { display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden; border-radius: 13px; color: #fff; background: var(--dex-navy); font-size: 11px; font-weight: 900; }
.dex-skill-icon img { width: 100%; height: 100%; object-fit: cover; }
.dex-skill > div { min-width: 0; }
.dex-skill b { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dex-skill p { margin: 5px 0 0; color: var(--dex-muted); font-size: 7px; line-height: 1.45; }
.dex-skill > span { display: grid; gap: 4px; text-align: right; }
.dex-skill > span small { color: #8498a3; font-size: 6px; }
.dex-skill > span b { font-size: 8px; }
.dex-combat-plan { grid-column:1/-1; padding:10px; border:1px solid #cfe2df; border-radius:13px; background:#f1f8f5; }
.dex-combat-plan small { color:#3a8970; font-size:6px; font-weight:900; letter-spacing:.08em; }
.dex-combat-plan b { display:block; margin-top:5px; color:#146b50; font-size:9px; }
.dex-combat-plan p { margin:5px 0 0; color:var(--dex-muted); font-size:7px; line-height:1.45; }
.dex-evolution { grid-column: 1 / 3; }
.dex-evolution-line { display: flex; flex-wrap: wrap; gap: 8px; }
.dex-evolution-line span { padding: 9px 11px; border-radius: 11px; color: var(--dex-muted); background: #eff5f5; font-size: 8px; font-weight: 800; }
.dex-source-note { grid-column: 1 / 3; margin: 0; color: #7d929e; font-size: 7px; line-height: 1.55; }

.dex-footer { padding: 28px 0; color: rgba(255,255,255,.6); background: var(--dex-navy); }
.dex-footer .dex-wrap { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 30px; }
.dex-footer .dex-brand img { width: 38px; height: 38px; }
.dex-footer .dex-brand b { font-size: 14px; }
.dex-footer p { max-width: 620px; margin: 0; color: rgba(255,255,255,.4); font-size: 8px; line-height: 1.5; }
.dex-footer > div > a:last-child { color: #fff; font-size: 9px; font-weight: 850; }
.dex-noscript { position: fixed; z-index: 1000; right: 12px; bottom: 12px; left: 12px; padding: 15px; color: #fff; background: #c83742; text-align: center; }

@media (max-width: 1120px) {
  .dex-grid { grid-template-columns: repeat(3,1fr); }
  .dex-filters, .dex-filters-game { grid-template-columns: repeat(4,1fr); }
  .dex-search { grid-column: span 2; }
  .dex-filters > button { align-self: end; }
  .dex-hero-art img:nth-child(1) { right: -6%; }
  .dex-hero-art img:nth-child(2) { right: 38%; }
}

@media (max-width: 800px) {
  .dex-wrap { width: min(100% - 30px, 680px); }
  .dex-nav { width: calc(100% - 22px); grid-template-columns: 1fr auto; }
  .dex-nav nav { display: none; }
  .dex-play { min-height: 43px; }
  .dex-hero { min-height: 700px; }
  .dex-hero-grid { grid-template-columns: 1fr; align-content: start; min-height: 700px; padding-top: 125px; }
  .dex-hero h1 { font-size: clamp(48px, 10vw, 68px); }
  .dex-hero-art { min-height: 295px; }
  .dex-hero-art img:nth-child(1) { right: 14%; bottom: -80px; width: 300px; }
  .dex-hero-art img:nth-child(2) { right: 54%; bottom: -55px; width: 210px; }
  .dex-hero-art img:nth-child(3) { right: -6%; bottom: -40px; width: 190px; }
  .dex-mode-switch { margin-bottom: 62px; }
  .dex-browser-head { display: grid; gap: 9px; }
  .dex-grid { grid-template-columns: repeat(2,1fr); }
  .dex-filters, .dex-filters-game { grid-template-columns: repeat(2,1fr); }
  .dex-dialog-hero { grid-template-columns: 290px 1fr; }
  .dex-dialog-copy { padding: 40px 30px; }
  .dex-dialog-body { grid-template-columns: 1fr; }
  .dex-skills, .dex-evolution, .dex-source-note { grid-column: auto; }
  .dex-skill-grid { grid-template-columns: 1fr; }
  .dex-footer .dex-wrap { grid-template-columns: 1fr auto; }
  .dex-footer p { grid-column: 1 / 3; grid-row: 2; }
}

@media (max-width: 540px) {
  .dex-wrap { width: calc(100% - 20px); }
  .dex-nav { top: 8px; width: calc(100% - 14px); min-height: 60px; padding-left: 9px; border-radius: 17px; }
  .dex-brand img { width: 39px; height: 39px; }
  .dex-brand b { font-size: 14px; }
  .dex-brand small { font-size: 6px; }
  .dex-play { min-height: 40px; padding: 0 8px 0 12px; font-size: 9px; }
  .dex-play b { width: 24px; height: 24px; }
  .dex-hero { min-height: 680px; }
  .dex-hero-grid { padding-top: 105px; min-height: 680px; }
  .dex-hero h1 { font-size: clamp(43px, 13vw, 58px); letter-spacing: -3px; }
  .dex-hero-copy p { font-size: 13px; }
  .dex-hero-art img:nth-child(1) { right: 8%; width: 270px; }
  .dex-hero-art img:nth-child(2) { right: 58%; width: 180px; }
  .dex-hero-art img:nth-child(3) { right: -15%; width: 170px; }
  .dex-mode-switch { grid-template-columns: 1fr; margin-top: -46px; border-radius: 20px; }
  .dex-mode-switch a { min-height: 90px; padding: 19px 21px; }
  .dex-mode-switch a + a { border-top: 1px solid var(--dex-line); border-left: 0; }
  .dex-browser-head h2 { font-size: 38px; }
  .dex-filters, .dex-filters-game { grid-template-columns: 1fr 1fr; padding: 10px; }
  .dex-search { grid-column: 1 / 3; }
  .dex-filters label:nth-of-type(n+4), .dex-filters > button { grid-column: span 1; }
  .dex-grid { grid-template-columns: 1fr; }
  .dex-card { min-height: 348px; }
  .dex-card-visual { min-height: 196px; }
  .dex-dialog { width: calc(100vw - 12px); max-height: calc(100svh - 12px); border-radius: 22px; }
  .dex-dialog-hero { grid-template-columns: 1fr; }
  .dex-dialog-visual { min-height: 290px; }
  .dex-dialog-copy { padding: 26px 20px 30px; }
  .dex-dialog-copy h2 { font-size: 39px; }
  .dex-dialog-body { gap: 12px; padding: 12px; }
  .dex-dialog-panel { padding: 18px; }
  .dex-dialog-facts { grid-template-columns: repeat(2,1fr); }
  .dex-footer .dex-wrap { grid-template-columns: 1fr; text-align: center; }
  .dex-footer .dex-brand { margin-inline: auto; }
  .dex-footer p { grid-column: auto; grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* PokePark Pokédex 2.18: clear modes, contained details and reliable mobile flow. */
html.dex-dialog-open,
html.dex-dialog-open body { overflow: hidden; }

.dex-mode-switch { width: min(980px,100%); overflow: visible; gap: 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.dex-mode-switch a { grid-template-columns: 86px minmax(0,1fr) auto; align-items: center; gap: 17px; min-height: 128px; padding: 19px 22px; overflow: hidden; border: 1px solid rgba(8,43,65,.11); border-radius: 22px; background: rgba(255,255,255,.96); box-shadow: 0 18px 55px rgba(3,32,52,.13); }
.dex-mode-switch a + a { border-left: 1px solid rgba(8,43,65,.11); }
.dex-mode-switch a:hover { border-color: rgba(11,126,231,.28); transform: translateY(-3px); box-shadow: 0 24px 65px rgba(3,32,52,.17); }
.dex-mode-switch a.is-active { border-color: transparent; }
.dex-mode-switch a > em { align-self: start; color: rgba(9,36,58,.22); font-size: 10px; font-style: normal; font-weight: 900; letter-spacing: .15em; }
.dex-mode-switch a.is-active > em { color: rgba(255,255,255,.35); }
.dex-mode-copy { display: grid; min-width: 0; gap: 5px; }
.dex-mode-switch .dex-mode-copy > b { overflow: hidden; font-size: 18px; letter-spacing: -.55px; text-overflow: ellipsis; white-space: nowrap; }
.dex-mode-switch .dex-mode-copy > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dex-mode-device { position: relative; display: block; width: 76px; height: 82px; border: 1px solid rgba(255,255,255,.55); border-radius: 19px 19px 24px 14px; background: linear-gradient(145deg,#f15a5e 0 47%,#c72d3a 48% 100%); box-shadow: inset 0 0 0 4px rgba(255,255,255,.13), 0 13px 22px rgba(79,21,31,.22); transform: rotate(-4deg); }
.dex-mode-device::before { content:""; position:absolute; top:10px; left:11px; width:22px; height:22px; border:4px solid #e5f9ff; border-radius:50%; background:radial-gradient(circle at 35% 30%,#fff 0 10%,#6de4ff 12% 38%,#0877aa 40% 100%); box-shadow:0 0 0 3px #7a202d,0 0 12px rgba(99,222,255,.75); }
.dex-mode-device::after { content:""; position:absolute; right:9px; bottom:10px; width:25px; height:18px; border:2px solid rgba(8,34,48,.5); border-radius:5px; background:linear-gradient(135deg,#dff6df,#75b693); box-shadow:inset 0 0 0 3px rgba(255,255,255,.28); }
.dex-mode-device > span { position:absolute; left:13px; bottom:13px; width:21px; height:21px; opacity:.72; background:linear-gradient(#fff,#fff) center/5px 100% no-repeat,linear-gradient(#fff,#fff) center/100% 5px no-repeat; }
.dex-mode-device.is-game { border-radius:16px 25px 16px 25px; background:linear-gradient(145deg,#35c58c 0 43%,#08785e 44% 100%); box-shadow:inset 0 0 0 4px rgba(255,255,255,.12),0 13px 22px rgba(8,70,55,.24); transform:rotate(4deg); }
.dex-mode-device.is-game::before { top:12px; left:13px; width:27px; height:27px; border-color:#dffff5; background:radial-gradient(circle,#dffff5 0 9%,#4af0c2 10% 31%,#086a75 33% 100%); box-shadow:0 0 0 3px #075a4d,0 0 13px rgba(66,236,194,.65); }
.dex-mode-device.is-game::after { width:27px; height:21px; background:linear-gradient(135deg,#dafaff,#6fc5da); }

.dex-filters input,
.dex-filters select { min-width: 0; text-overflow: ellipsis; }
.dex-filter select { overflow: hidden; }

.dex-dialog { position: fixed; inset: 0; margin: auto; overflow: hidden; overscroll-behavior: contain; }
.dex-dialog-close { position: absolute; top: 14px; right: 14px; float: none; margin: 0; }
#dexDialogContent { max-height: min(860px,calc(100svh - 34px)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #9fb5be transparent; }
#dexDialogContent::-webkit-scrollbar { width: 9px; }
#dexDialogContent::-webkit-scrollbar-track { background: transparent; }
#dexDialogContent::-webkit-scrollbar-thumb { border: 3px solid #fff; border-radius: 99px; background: #9fb5be; }
.dex-dialog-body,
.dex-dialog-panel,
.dex-dialog-copy,
.dex-skill,
.dex-skill > div { min-width: 0; }

@media (max-width: 700px) {
  .dex-mode-switch { gap: 8px; }
  .dex-mode-switch a { grid-template-columns: 65px minmax(0,1fr) auto; min-height: 103px; padding: 14px 15px; }
  .dex-mode-switch a + a { border-top: 1px solid rgba(8,43,65,.11); }
  .dex-mode-device { width: 58px; height: 66px; border-radius: 15px 15px 18px 11px; }
  .dex-mode-device::before { top: 8px; left: 9px; width: 17px; height: 17px; border-width: 3px; }
  .dex-mode-device::after { right: 7px; bottom: 8px; width: 20px; height: 14px; }
  .dex-mode-device > span { left: 10px; bottom: 10px; width: 16px; height: 16px; }
  .dex-mode-device.is-game::before { top: 9px; left: 10px; width: 21px; height: 21px; }
  .dex-mode-switch .dex-mode-copy > b { font-size: 15px; }
  .dex-mode-switch .dex-mode-copy > span { font-size: 8px; }
  .dex-dialog { width: calc(100vw - 12px); max-height: calc(100svh - 12px); }
  #dexDialogContent { max-height: calc(100svh - 12px); }
}

@media (max-width: 430px) {
  .dex-filters,
  .dex-filters-game { grid-template-columns: 1fr; }
  .dex-filters label,
  .dex-filters label:nth-of-type(n+4),
  .dex-filters > button { grid-column: 1; }
  .dex-mode-switch a { grid-template-columns: 58px minmax(0,1fr); }
  .dex-mode-switch a > em { display: none; }
  .dex-mode-device { width: 52px; height: 60px; }
  .dex-dialog-copy h2 { overflow-wrap: anywhere; }
}
