/* Pokémon X & Y Kalos Pokédex (dex.js). The look follows the game's Pokédex: the red Pokédex frame with the area
   rows, a blue upper screen with the entry and the coral Pokédex-text band, and a Touch Screen with the language
   tabs and a grid of blue icon tiles. Game textures come from dex/ui (decoded from the cartridge). Both screens are
   sized with container units so they keep the 3DS proportions (400 x 240 and 320 x 240) at any width. */

.xy-zk { --zk-blue: #2f86d8; --zk-blue-2: #5fb6ef; --zk-navy: #173a6b; --zk-coral: #e2574f; --zk-coral-2: #c93c3a;
  --zk-olive: #5c5a24; --zk-green: #7ad13a; --zk-tile: #2a78cf; --zk-tile-2: #59a9ec; }
.xy-zk .xy-map-top { justify-content: space-between; }
.xy-zk-maplink { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: #ffffff; color: var(--xy-ink); font-weight: 800; text-decoration: none; }
.xy-zk-maplink::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fff 0 22%, transparent 23%), linear-gradient(#e0393e 0 46%, #2a2f36 46% 54%, #fff 54%); }
.xy-zk-maplink:hover, .xy-zk-maplink:focus-visible { outline: 3px solid var(--xy-holo); outline-offset: 2px; }
.xy-zk-status { margin: 0; padding: 16px; border-radius: 16px; background: #3a414b; }
.xy-zk.is-live .xy-zk-status { display: none; }

.xy-zk-app { display: grid; gap: 16px; }
.zk-main { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1fr); }

/* ----- area menu: the red Pokédex frame ----- */
.zk-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 10px; border-radius: 18px;
  background: linear-gradient(180deg, #8d0f16, #5e0a10 60%, #3b070b); box-shadow: inset 0 2px rgba(255, 255, 255, .18), inset 0 -3px rgba(0, 0, 0, .35); }
.zk-menu::before { content: ""; grid-column: 1 / -1; height: clamp(64px, 9vw, 110px); margin: -4px -4px 2px; border-radius: 14px 14px 6px 6px;
  background: url("dex/ui/top.webp") center top / auto 200% no-repeat, #b30f18; }
.zk-area { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px 6px 8px;
  border: 0; border-radius: 10px; background: linear-gradient(90deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .2)); color: #ffffff; cursor: pointer; text-align: left;
  font-family: var(--xy-display); font-size: .86rem; font-weight: 900; letter-spacing: .02em; text-shadow: 0 2px rgba(0, 0, 0, .55); }
.zk-area img { width: 32px; height: 32px; image-rendering: pixelated; }
.zk-area-count { font-variant-numeric: tabular-nums; font-size: .95rem; }
.zk-area:hover { background: linear-gradient(90deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .3)); }
.zk-area[aria-current="true"] { background: linear-gradient(180deg, #ffffff, #e9edf0); color: #b30f18; text-shadow: none; box-shadow: 0 0 0 3px #ffd34a; }
.zk-area:focus-visible { outline: 3px solid #ffd34a; outline-offset: 2px; }
.zk-area.is-complete .zk-area-name::after { content: ""; display: inline-block; width: 16px; height: 16px; margin-left: 6px; vertical-align: -2px;
  background: url("dex/ui/crown.png") 0 0 / contain no-repeat; image-rendering: pixelated; }

/* ----- the console: upper screen, hinge, Touch Screen ----- */
.zk-console { display: grid; justify-items: center; gap: 0; padding: 14px; border-radius: 26px; background: linear-gradient(180deg, #454c57, #2b3038);
  box-shadow: inset 0 2px rgba(255, 255, 255, .12), 0 18px 40px -26px rgba(0, 0, 0, .8); }
.zk-hinge { width: 100%; height: 16px; margin: 6px 0; border-radius: 8px; background: linear-gradient(180deg, #1d2127, #3a414b 60%, #1d2127); }
.zk-top, .zk-bottom { position: relative; container-type: inline-size; overflow: hidden; border: 3px solid #101317; border-radius: 6px; }
.zk-top { width: min(100%, 720px); aspect-ratio: 400 / 240; color: var(--zk-navy);
  background: radial-gradient(circle at 18% 46%, rgba(255, 255, 255, .28) 0 14%, transparent 14.5%),
    repeating-radial-gradient(circle at 18% 46%, rgba(255, 255, 255, .0) 0 3.4cqw, rgba(255, 255, 255, .16) 3.4cqw 3.7cqw),
    linear-gradient(180deg, var(--zk-blue-2), var(--zk-blue) 70%); }
.zk-bottom { width: min(80%, 576px); aspect-ratio: 320 / 240; background: #d8dde2; }
/* the screens are their own size containers, so their layout lives on an inner box (cqw = that screen's width) */
.zk-in { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 7.5cqw minmax(0, 1fr) 11cqw; }

/* upper screen (1 game pixel = 0.25cqw) */
.zk-top-head { position: absolute; inset: 0 0 auto; height: 6.5cqw; display: flex; justify-content: space-between; align-items: center; }
.zk-title { margin: 0 0 0 1.5cqw; padding: .3cqw 2.4cqw .3cqw 1.6cqw; border-radius: 1.2cqw; background: linear-gradient(180deg, #24334d, #0e1726);
  color: #ffffff; font: italic 900 2.6cqw/1.1 var(--xy-display); letter-spacing: .06em;
  text-shadow: -.25cqw 0 #2e7cc9, .25cqw 0 #2e7cc9, 0 -.25cqw #2e7cc9, 0 .25cqw #2e7cc9; }
.zk-count { display: flex; align-items: baseline; gap: 1.2cqw; margin: 0; padding: .6cqw 2cqw .6cqw 4cqw; height: 100%; box-sizing: border-box;
  background: linear-gradient(180deg, #23467e, var(--zk-navy)); clip-path: polygon(3cqw 0, 100% 0, 100% 100%, 0 100%); color: #ffffff; font: 800 2.2cqw/1 var(--xy-display); }
.zk-count span { font-size: 1.8cqw; letter-spacing: .05em; color: #bcd8f6; }
.zk-count b { min-width: 5cqw; text-align: right; font-size: 3.2cqw; font-variant-numeric: tabular-nums; }
.zk-stage { position: absolute; left: 2cqw; top: 7.5cqw; width: 34cqw; height: 30cqw; display: grid; place-items: center; }
.zk-ring { position: absolute; left: 3cqw; right: 3cqw; bottom: 3cqw; height: 6cqw; border-radius: 50%; background: radial-gradient(closest-side, rgba(12, 40, 80, .45), transparent); }
.zk-mon { position: relative; display: block; width: 30cqw; height: 22.5cqw; background-image: var(--icons); background-repeat: no-repeat;
  background-size: 3200% 2300%; background-position: calc(var(--ix) * 100% / 31) calc(var(--iy) * 100% / 22); image-rendering: pixelated;
  filter: drop-shadow(0 .6cqw 0 rgba(10, 30, 60, .25)); }
.zk-mon.is-in { animation: zk-pop .35s ease-out; }
@keyframes zk-pop { from { transform: translateY(2cqw) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.zk-mark { position: absolute; left: 3cqw; top: 1cqw; width: 5cqw; height: 5cqw; }
.zk-mark[data-state="caught"], .zk-tile[data-state="caught"] .zk-ball { background: radial-gradient(circle at 50% 50%, #ffffff 0 16%, #20242a 17% 26%, transparent 27%),
  linear-gradient(180deg, #e8383d 0 44%, #20242a 44% 56%, #ffffff 56%); border-radius: 50%; box-shadow: 0 0 0 .35cqw #20242a; }
.zk-mark[data-state="seen"], .zk-tile[data-state="seen"] .zk-ball { border-radius: 50%; background: radial-gradient(circle, #20242a 0 30%, #ffffff 31% 60%, transparent 61%); box-shadow: 0 0 0 .35cqw rgba(32, 36, 42, .6); }
.zk-info { position: absolute; left: 38cqw; right: 1.5cqw; top: 7.6cqw; padding: .6cqw 2cqw .8cqw; border-radius: 2.5cqw 2.5cqw 2.5cqw 5cqw;
  border: .5cqw solid rgba(255, 255, 255, .85); background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(222, 238, 252, .9)); }
.zk-name { display: flex; align-items: center; gap: 1.6cqw; margin: 0; padding-bottom: .6cqw; border-bottom: .4cqw solid #ffffff; font: 900 3.3cqw/1.15 var(--xy-display); }
.zk-areaicon { width: 5cqw; height: 5cqw; image-rendering: pixelated; }
.zk-no { min-width: 12cqw; font-variant-numeric: tabular-nums; }
.zk-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zk-cat { margin: .3cqw 0 0 6.6cqw; padding-bottom: .3cqw; border-bottom: .3cqw solid #ffffff; font: 800 2.8cqw/1.2 var(--xy-display); }
.zk-info dl { margin: .2cqw 0 0; }
.zk-info dl > div { display: flex; justify-content: space-between; align-items: center; min-height: 5.4cqw; padding: 0 0 0 6.6cqw; border-bottom: .3cqw solid #ffffff; }
.zk-info dl > div:last-child { border-bottom: 0; }
.zk-info dt { font: 900 2.5cqw/1.1 var(--xy-display); letter-spacing: .04em; }
.zk-info dd { margin: 0; display: flex; gap: 1cqw; font: 800 2.8cqw/1.1 var(--xy-display); font-variant-numeric: tabular-nums; }
.zk-type { display: inline-block; width: 12.5cqw; height: 5cqw; overflow: hidden; color: transparent; font-size: 0;
  background: var(--types) 0 calc(var(--t) * 100% / 17) / 100% 1800% no-repeat; image-rendering: pixelated; }
.zk-text { position: absolute; left: 0; right: 0; bottom: 0; height: 19.5cqw; margin: 0; padding: 3.6cqw 4cqw 1cqw 5cqw; box-sizing: border-box; overflow: hidden;
  background: radial-gradient(120% 70% at 50% -42%, transparent 60%, rgba(255, 255, 255, .5) 60.5% 61.5%, transparent 62%), linear-gradient(180deg, var(--zk-coral), var(--zk-coral-2));
  clip-path: ellipse(85% 100% at 50% 100%); color: #ffffff; font: 700 2.95cqw/1.38 var(--xy-display); text-shadow: 0 .3cqw rgba(110, 20, 20, .5); }
.zk-top[data-version="y"] .zk-text { --zk-coral: #e15a62; }

/* Touch Screen (1 game pixel = 0.3125cqw) */
.zk-langs { display: flex; align-items: center; gap: .6cqw; padding: 0 2cqw; background: linear-gradient(180deg, #6b6a2b, var(--zk-olive)); }
.zk-lang { width: 12.5cqw; height: 6.25cqw; padding: 0; border: 0; border-radius: 1.4cqw; cursor: pointer;
  background: url("dex/ui/langs.png") 0 calc(var(--row) * 100% / 6) / 100% 700% no-repeat; image-rendering: pixelated; opacity: .85; }
.zk-lang[aria-selected="true"] { opacity: 1; box-shadow: 0 0 0 .6cqw var(--zk-green), 0 0 2.4cqw .6cqw rgba(122, 209, 58, .8); }
.zk-lang:hover, .zk-lang:focus-visible { opacity: 1; outline: none; box-shadow: 0 0 0 .6cqw #ffffff; }
.zk-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: 15cqw; gap: 1.6cqw; align-content: start; overflow-y: auto; padding: 2cqw 2.6cqw 2cqw 2cqw;
  background: repeating-linear-gradient(0deg, #e2e6ea 0 .6cqw, #d5dbe0 .6cqw 1.2cqw); scrollbar-width: thin; scrollbar-color: var(--zk-green) #9aa3ab; overscroll-behavior: contain; }
.zk-tile { position: relative; display: grid; place-items: center; padding: 0; border: .6cqw solid #e8f2fc; border-radius: 2.4cqw; cursor: pointer;
  background: linear-gradient(180deg, var(--zk-tile-2), var(--zk-tile)); box-shadow: inset 0 -1cqw rgba(0, 20, 60, .2), 0 .6cqw 0 rgba(20, 40, 70, .25); }
.zk-tile .zk-icon { width: 12.5cqw; height: 9.4cqw; margin-top: -2.4cqw; }
.zk-icon { display: inline-block; flex: none; background-image: var(--icons); background-repeat: no-repeat; background-size: 3200% 2300%;
  background-position: calc(var(--ix) * 100% / 31) calc(var(--iy) * 100% / 22); image-rendering: pixelated; }
.zk-num { position: absolute; right: 1.4cqw; bottom: .5cqw; color: #ffffff; font: 900 3.5cqw/1 var(--xy-display); font-variant-numeric: tabular-nums;
  text-shadow: -.3cqw -.3cqw #123b6c, .3cqw -.3cqw #123b6c, -.3cqw .3cqw #123b6c, .3cqw .3cqw #123b6c; }
.zk-ball { position: absolute; left: 1.4cqw; bottom: 1cqw; width: 3.6cqw; height: 3.6cqw; }
.zk-tile[data-state="none"] .zk-ball { border-radius: 50%; box-shadow: inset 0 0 0 .35cqw rgba(255, 255, 255, .45); }
.zk-tile:hover { box-shadow: inset 0 -1cqw rgba(0, 20, 60, .2), 0 0 0 .6cqw #ffffff; }
.zk-tile[aria-selected="true"] { border-color: #ffd34a; box-shadow: 0 0 0 .8cqw #f39c12, 0 0 3cqw 1cqw rgba(255, 211, 74, .8); z-index: 1; }
.zk-tile:focus-visible { outline: .8cqw solid #ffffff; outline-offset: .6cqw; }
.zk-empty { grid-column: 1 / -1; margin: 4cqw 0; text-align: center; color: #4a525c; font: 800 4cqw/1.3 var(--xy-display); }
.zk-bar { display: flex; align-items: center; gap: 1.6cqw; padding: 0 2cqw; background: linear-gradient(180deg, #f6f8f9, #c9d0d6); border-top: .6cqw solid #a9b2ba; }
.zk-bar input, .zk-bar select { height: 7.6cqw; min-width: 0; border: .5cqw solid #8b959e; border-radius: 4cqw; background: #ffffff; color: #2a2f36; font: 800 3.4cqw/1 var(--xy-display); }
.zk-search { flex: 1 1 auto; padding: 0 2.4cqw 0 7.6cqw; background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10' cy='10' r='6' fill='none' stroke='%232a2f36' stroke-width='3'/%3E%3Cpath d='M15 15l6 6' stroke='%232a2f36' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") 2.2cqw 50% / 4cqw no-repeat; }
.zk-sort, .zk-show { flex: 0 1 auto; padding: 0 1.6cqw; }

/* ----- side panel ----- */
.zk-side { padding: 16px; border-radius: 20px; background: #ffffff; color: var(--xy-ink); box-shadow: inset 0 -3px rgba(42, 47, 54, .06); }
.zk-side-head { display: grid; grid-template-columns: 80px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
.zk-side-head .zk-icon { grid-row: 1 / 3; width: 80px; height: 60px; }
.zk-side-head h3 { margin: 0; font: 900 1.3rem/1.15 var(--xy-display); }
.zk-side-no { color: var(--xy-muted-ink); font-size: .84rem; font-weight: 700; }
.zk-marks { display: flex; gap: 6px; margin: 14px 0 4px; }
.zk-markbtn { flex: 1; padding: 8px 6px; border: 2px solid var(--xy-border); border-radius: 12px; background: var(--xy-secondary); color: var(--xy-ink); font: 800 .88rem/1 var(--xy-display); cursor: pointer; }
.zk-markbtn[aria-pressed="true"] { border-color: var(--xy-primary); background: var(--xy-primary); color: #ffffff; }
.zk-markbtn.m-caught[aria-pressed="true"] { border-color: #c62a30; background: #e0393e; }
.zk-markbtn:focus-visible { outline: 3px solid var(--xy-holo); outline-offset: 2px; }
.zk-sec { margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--xy-muted); }
.zk-sec h4 { margin: 0 0 8px; font: 900 .95rem/1.2 var(--xy-display); letter-spacing: .02em; text-transform: uppercase; color: var(--xy-primary-deep); }
.zk-places { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.zk-places li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--xy-secondary); }
.zk-place { font-weight: 900; color: var(--xy-primary-deep); }
a.zk-place { text-decoration: none; }
a.zk-place:hover, a.zk-place:focus-visible { text-decoration: underline; }
.zk-how { color: var(--xy-muted-ink); font-size: .86rem; line-height: 1.35; }
.zk-how.is-special { color: var(--xy-ink); }
.zk-note { margin: 8px 0 0; color: var(--xy-muted-ink); font-size: .86rem; line-height: 1.45; }
.zk-maplink { display: inline-block; margin-top: 10px; font-weight: 800; color: var(--xy-primary-deep); }
.zk-evo { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.zk-evo li { display: grid; gap: 2px; }
.zk-evomon { display: flex; align-items: center; gap: 8px; padding: 2px 8px 2px 2px; border: 2px solid transparent; border-radius: 12px; background: none; color: var(--xy-ink); font: 800 .95rem/1 var(--xy-display); cursor: pointer; text-align: left; }
.zk-evomon .zk-icon { width: 40px; height: 30px; }
.zk-evomon[aria-current="true"] { border-color: var(--xy-primary); background: var(--xy-muted); }
.zk-evomon:hover, .zk-evomon:focus-visible { border-color: var(--xy-border); outline: none; }
.zk-evo small { padding-left: 50px; color: var(--xy-muted-ink); font-size: .8rem; }

@media (min-width: 900px) {
  .zk-main { grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); }
  .zk-menu { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .zk-menu::before { height: 90px; }
}
@media (min-width: 1360px) {
  .xy-zk-app { grid-template-columns: 290px minmax(0, 1fr); align-items: start; }
  .zk-menu { grid-template-columns: minmax(0, 1fr); position: sticky; top: 12px; }
  .zk-menu::before { height: 150px; background-size: auto 210%; }
}
@media (max-width: 560px) {
  .zk-console { padding: 8px; border-radius: 18px; }
  .zk-bottom { width: 100%; }
  .zk-area { font-size: .72rem; gap: 6px; padding: 6px 8px 6px 6px; grid-template-columns: 26px minmax(0, 1fr); }
  .zk-area img { width: 26px; height: 26px; }
  .zk-area-count { grid-column: 2; font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) { .zk-mon.is-in { animation: none; } }
/* 3D model (dex-model.js): replaces the icon once loaded */
.zk-model { position: absolute; inset: 0; width: 100%; height: 100%; display: none; cursor: grab; touch-action: pan-y; }
.zk-model:active { cursor: grabbing; }
.zk-model:focus-visible { outline: 2px solid var(--xy-holo); outline-offset: -2px; border-radius: 2cqw; }
.zk-stage.has-model .zk-model { display: block; }
.zk-stage.has-model .zk-mon { visibility: hidden; }
