/* Team builder: the Kanto Pokédex app's design (../pokedex-kanto), see js/dex.js. Everything is scoped to #setup. */
#setup { --pdx-accent: #e3353c; --pdx-ink: #1b1b1f; --pdx-mute: #9a9aa3; --pdx-soft: #f5f5f8; --pdx-line: #e6e6ec;
  font-family: Poppins, "Helvetica Neue", Helvetica, sans-serif; color: var(--pdx-ink); background: #f4f4f6; min-height: 100vh;
  -webkit-font-smoothing: antialiased; }
#setup button { font-family: inherit; cursor: pointer; transition: filter .15s ease, background-color .15s ease; }
#setup button:hover:not(:disabled) { filter: brightness(.94); }
#setup .pdx-mono, #setup .pdx-label { font-family: 'IBM Plex Mono', monospace; }
body > main, #setup main.pdx-main { max-width: none; margin: 0; padding: 0; }   /* undo the page-wide main{} rule in index.html */
.pdx-shell { min-height: 100vh; display: flex; align-items: flex-start; gap: 20px; padding: 20px 20px 150px; }

/* sidebar */
.pdx-aside { width: 176px; flex-shrink: 0; position: sticky; top: 20px; background: #fff; border-radius: 24px; padding: 18px 0 12px;
  box-shadow: 0 12px 30px -24px rgba(20,20,26,.5); max-height: calc(100vh - 170px); display: flex; flex-direction: column; }
.pdx-logo { height: 76px; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.pdx-divider { height: 1px; background: #ececf0; margin: 0 16px 6px; flex-shrink: 0; }
.pdx-type-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 16px; display: flex; flex-direction: column; gap: 8px; }
.pdx-chip { padding: 13px 10px; border-radius: 12px; border: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.pdx-art { position: relative; flex-shrink: 0; }
.pdx-art > .pdx-pmd { position: absolute; }
.pdx-pmd { background-repeat: no-repeat; image-rendering: pixelated; }   /* Mystery Dungeon sprite frame, see art() in dex.js */

/* main + search bar */
.pdx-main { flex: 1 1 420px; min-width: 320px; display: flex; flex-direction: column; gap: 18px; }
.pdx-searchwrap { position: sticky; top: 20px; z-index: 40; }
.pdx-searchbar { background: var(--pdx-accent); border-radius: 22px; padding: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pdx-regions { margin-right: auto; margin-left: 0; display: flex; gap: 8px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.14); }
.pdx-region { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 10px 24px; border-radius: 999px; border: 0;
  background: transparent; color: #fff; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.pdx-region small { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; font-weight: 400; letter-spacing: .08em; opacity: .75; }
.pdx-region:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.pdx-region:disabled { opacity: .38; cursor: not-allowed; }
.pdx-to-regions { width: 48px; height: 48px; border-radius: 999px; border: 0; background: rgba(0,0,0,.14); color: #fff; font-size: 22px; font-weight: 700; flex: none; }
.pdx-to-regions[hidden] { display: none; }
.pdx-foe { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; border-radius: 16px; background: #fff3f3; border: 1px solid #ffd4d4; }
.pdx-foe .pdx-mono { font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--pdx-accent); }
.pdx-foe > div { display: flex; gap: 2px; }
.pdx-region.on { background: #fff; color: var(--pdx-accent); box-shadow: 0 2px 8px -4px rgba(0,0,0,.35); }
.pdx-region.on small { opacity: .8; }
.pdx-search { position: relative; flex: 1 1 260px; max-width: 460px; }
.pdx-search input, #setup #search { width: 100%; flex: none; min-width: 0; padding: 17px 22px 17px 68px; border-radius: 999px; border: 0; background: #fff; color: var(--pdx-ink); font: inherit; font-size: 16px; outline: none; box-shadow: 0 2px 8px -4px rgba(0,0,0,.3); }
.pdx-search input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.5); }
.pdx-search img { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; pointer-events: none; }
.pdx-filter-btn { display: flex; align-items: center; gap: 12px; padding: 15px 28px; border-radius: 999px; border: 0; background: var(--pdx-ink); color: #fff; font-size: 16px; font-weight: 600; box-shadow: 0 2px 8px -4px rgba(0,0,0,.4); }
.pdx-burger { display: grid; gap: 4px; width: 18px; }
.pdx-burger i { height: 2.5px; background: #fff; border-radius: 2px; width: 100%; }
.pdx-burger i:nth-child(2) { width: 62%; margin-left: auto; }
.pdx-filter-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 340px; max-height: 70vh; overflow-y: auto; background: #fff; border-radius: 20px; padding: 22px;
  box-shadow: 0 24px 50px -22px rgba(20,20,26,.5); animation: pdxRise .16s ease both; }
.pdx-label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--pdx-mute); margin: 0 0 10px; }
.pdx-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.pdx-pill { padding: 9px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--pdx-line); background: #fff; color: #4a4a55; }
.pdx-pill.on { border-color: var(--pdx-accent); background: var(--pdx-accent); color: #fff; }
.pdx-seg .pdx-pill { flex: 1; padding: 10px 14px; }
.pdx-seg .pdx-pill.on { border-color: var(--pdx-ink); background: var(--pdx-ink); }
.pdx-reset { width: 100%; padding: 12px; border-radius: 999px; border: 1px solid var(--pdx-line); background: #fff; font-size: 13px; font-weight: 600; }

/* browse: 3 cards per row; clicking a card opens .pdx-panel under its row */
.pdx-browse { display: flex; flex-direction: column; gap: 18px; }
.pdx-browse-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 6px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--pdx-mute); }
.pdx-cards { display: grid; gap: 16px; align-items: start; }
.pdx-card { position: relative; background: #fff; border-radius: 24px; cursor: pointer; padding: 18px 20px 14px; box-shadow: 0 14px 30px -26px rgba(20,20,26,.6);
  display: flex; flex-direction: column; gap: 12px; border: 2px solid transparent; transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease; }
.pdx-card, .pdx-panel { scroll-margin-top: 128px; scroll-margin-bottom: 130px; }
.pdx-card:hover { transform: translateY(-2px); box-shadow: 0 22px 40px -28px rgba(20,20,26,.7); }
.pdx-card.in-team { border-color: color-mix(in srgb, var(--col) 35%, transparent); }
.pdx-card.cursor { box-shadow: 0 0 0 3px rgba(243,195,23,.85), 0 14px 30px -26px rgba(20,20,26,.6); }
.pdx-card.open { border-color: var(--col); box-shadow: 0 26px 50px -30px rgba(20,20,26,.75); }
.pdx-card.open::after { content: ''; position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 12px solid var(--col); }
.pdx-card-head { display: flex; align-items: center; gap: 12px; }
.pdx-card-art { position: relative; display: grid; place-items: center; width: 96px; height: 96px; flex-shrink: 0; }
.pdx-ghost { position: absolute; font-size: 48px; font-weight: 800; color: #f0f0f4; letter-spacing: -.04em; line-height: 1; user-select: none; }
.pdx-card-art .pdx-art { position: relative; }
.pdx-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.pdx-num { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .14em; color: #c2c2cb; }
.pdx-name { font-size: 19px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdx-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pdx-badge { color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; display: inline-block; }
.pdx-add { align-self: flex-start; flex-shrink: 0; padding: 8px 13px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--pdx-line); background: #fff; color: var(--pdx-ink); white-space: nowrap; }
.pdx-stats { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 4px; }
.pdx-srow { display: grid; grid-template-columns: 30px 26px minmax(20px, 1fr); align-items: center; gap: 6px; }
.pdx-slabel { font-size: 11px; font-weight: 600; color: #6f6f79; text-align: right; white-space: nowrap; }
.pdx-sval { font-size: 12px; font-weight: 700; text-align: right; }
.pdx-bar { height: 7px; border-radius: 999px; background: #ededf1; overflow: hidden; }
.pdx-bar > div { height: 100%; border-radius: 999px; background: #f4676c; transition: width .45s cubic-bezier(.2,.8,.2,1); }
.pdx-card-foot { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .12em; color: var(--pdx-mute); padding-top: 8px; border-top: 1px solid #f0f0f4; }
.pdx-card.open .pdx-more { color: var(--col); font-weight: 500; }
.pdx-empty { padding: 70px 20px; text-align: center; color: var(--pdx-mute); background: #fff; border-radius: 24px; font-size: 14px; }
.pdx-empty b { display: block; font-size: 18px; font-weight: 600; color: var(--pdx-ink); margin-bottom: 6px; }

/* quick panel (spans the whole row, under the selected card) */
.pdx-panel { grid-column: 1 / -1; position: relative; margin-top: 4px; background: #fff; border-radius: 24px; padding: 20px 26px 24px;
  box-shadow: 0 24px 50px -30px rgba(20,20,26,.6); animation: pdxRise .18s ease both; }
.pdx-panel-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid #f0f0f4; }
.pdx-panel-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pdx-panel-title b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.pdx-panel-title span { font-size: 13px; color: #8b8b93; }
.pdx-cta { padding: 12px 22px; border-radius: 999px; border: none; font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.pdx-close { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--pdx-line); background: #fff; font-size: 20px; line-height: 1; color: #4a4a55; flex-shrink: 0; }
.pdx-panel-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 28px; align-items: start; }
.pdx-moves { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: 430px; overflow-y: auto; padding-right: 4px; }
.pdx-move { text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid #eeeef2; background: #fff; display: flex; flex-direction: column; gap: 2px; }
.pdx-move:disabled { cursor: default; }
.pdx-move-name { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.pdx-move-name i { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.pdx-move small { font-size: 11px; color: #8b8b93; padding-left: 17px; }
.pdx-move { position: relative; }
.pdx-src { position: absolute; top: 9px; right: 10px; font-style: normal; font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .06em; color: #b4b4bd; }
.pdx-move:not(.on) { opacity: .7; }
.pdx-move.on { opacity: 1; }
.pdx-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin-bottom: 4px; }
.pdx-table th { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--pdx-mute); font-weight: 400; text-align: right; padding: 0 8px 6px; }
.pdx-table td { padding: 6px 8px; text-align: right; border-top: 1px solid #f0f0f4; font-weight: 600; }
.pdx-table td:first-child { text-align: left; color: #4a4a55; }
.pdx-table td.fin { font-weight: 800; color: var(--pdx-accent); }
.pdx-table td.good { color: #2f8a3e; } .pdx-table td.warn { color: #c86400; }
.pdx-rerolls { margin: 10px 0 18px; }
.pdx-abilities { margin-bottom: 8px; }
.pdx-ability { padding: 8px 14px; border-radius: 10px; border: 1px solid; font-size: 12px; font-weight: 600; }
.pdx-ability:disabled { cursor: default; }
.pdx-abdesc { font-size: 12.5px; margin-bottom: 16px; }
.pdx-muted { color: var(--pdx-mute); font-size: 13px; }
.pdx-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pdx-facts > div { background: var(--pdx-soft); border-radius: 14px; padding: 10px 6px; text-align: center; }
.pdx-facts b { display: block; font-size: 17px; font-weight: 800; }
.pdx-facts span { font-size: 10.5px; color: #8b8b93; }
.pdx-terrain { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pdx-terrain span { font-size: 11.5px; font-weight: 600; color: #4a4a55; background: var(--pdx-soft); border-radius: 999px; padding: 5px 10px; }
.pdx-flash { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s;
  background: var(--pdx-ink); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; }
.pdx-flash.on { opacity: 1; }

/* team tray */
.pdx-team-tray { position: fixed; left: 20px; right: 20px; bottom: 20px; z-index: 70; }
.pdx-tray { position: relative; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-radius: 22px; box-shadow: 0 18px 40px -26px rgba(20,20,26,.55);
  padding: 14px 20px; display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.pdx-tray-title { margin-right: auto; display: flex; flex-direction: column; min-width: 0; }
.pdx-tray-title b { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.pdx-tray-title .pdx-mono { font-size: 11px; color: var(--pdx-mute); letter-spacing: .1em; }
.pdx-slots { display: flex; gap: 8px; flex-wrap: wrap; }
.pdx-slot { width: 66px; height: 66px; border-radius: 18px; display: grid; place-items: center; position: relative; border: 2px solid; cursor: pointer; transition: border-color .15s ease; }
.pdx-slot.empty { background: #f7f7fa; border: 2px dashed #dcdce4; cursor: default; font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 700; color: #c4c4ce; }
.pdx-slot-name { position: absolute; bottom: -1px; font-size: 9px; font-weight: 700; color: #4a4a55; max-width: 68px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pdx-slot-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 999px; border: 0; background: var(--pdx-ink); color: #fff; font-size: 13px; line-height: 1; display: none; padding: 0; }
.pdx-slot:hover .pdx-slot-x { display: grid; place-items: center; }
.pdx-tray-btns { display: flex; gap: 8px; }
.pdx-tray-btns .pdx-pill { padding: 10px 15px; }
.pdx-arena-btn { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; border: 1px solid var(--pdx-line); background: #fff; text-align: left; }
.pdx-arena-btn > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.pdx-arena-btn .pdx-mono { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--pdx-mute); }
.pdx-arena-btn b { font-size: 13px; }
.pdx-arena-thumb { width: 54px; height: 40px; border-radius: 999px; background: #0e121b center / contain no-repeat; image-rendering: pixelated; }
.pdx-start { padding: 14px 24px; white-space: nowrap; border-radius: 999px; border: 0; background: var(--pdx-accent); color: #fff; font-size: 15px; font-weight: 700; box-shadow: 0 16px 30px -16px rgba(227,53,60,.7); }
.pdx-start:disabled { background: #eeeef2; color: #b4b4bd; box-shadow: none; cursor: not-allowed; }
.pdx-arena-panel { position: absolute; right: 0; bottom: calc(100% + 10px); width: min(560px, calc(100vw - 40px)); background: #fff; border-radius: 20px; padding: 20px;
  box-shadow: 0 24px 50px -22px rgba(20,20,26,.5); animation: pdxRise .16s ease both; }
.pdx-arena-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pdx-arena { height: 96px; border-radius: 16px; border: 2px solid transparent; background: #0e121b center / contain no-repeat; image-rendering: pixelated; display: flex; align-items: flex-end; padding: 0; overflow: hidden; }
.pdx-arena span { width: 100%; background: linear-gradient(transparent, rgba(0,0,0,.75)); padding: 14px 10px 7px; color: #fff; font-size: 12.5px; font-weight: 600; text-align: left; }
.pdx-arena.on { border-color: var(--pdx-accent); }

@keyframes pdxRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pdxFade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- phones: compact header, 2-up cards, panel as a bottom sheet, two-row team tray ---------------- */
.pdx-backdrop { display: none; }
@media (max-width: 720px) {
  .pdx-shell { padding: 8px 8px 150px; gap: 8px; flex-direction: column; }
  .pdx-main { order: 1; min-width: 0; width: 100%; gap: 10px; }
  .pdx-aside { order: 2; position: static; width: 100%; max-height: none; flex-direction: row; padding: 6px; border-radius: 16px; }
  .pdx-searchwrap { top: 0; margin: -8px -8px 0; }
  .pdx-aside { display: none; }
  .pdx-searchwrap > .pdx-type-nav { display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 8px 8px 6px; gap: 6px;
    scrollbar-width: none; background: #f4f4f6; }
  .pdx-type-nav::-webkit-scrollbar { display: none; }
  .pdx-chip { padding: 7px 12px; font-size: 11px; flex-shrink: 0; border-radius: 10px; }
  /* header: [back][Kanto|Johto|Hoenn][filter] / [search] */
  .pdx-searchbar { border-radius: 0 0 20px 20px; padding: 10px; gap: 8px; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "back regions filter" "search search search"; }
  .pdx-to-regions { grid-area: back; width: 38px; height: 38px; font-size: 18px; }
  .pdx-to-regions[hidden] { display: none; }
  .pdx-regions { grid-area: regions; margin: 0; padding: 3px; gap: 2px; min-width: 0; }
  .pdx-region { flex: 1; padding: 7px 4px; font-size: 13px; }
  .pdx-region small { display: none; }
  .pdx-filter-btn { grid-area: filter; width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .pdx-search { grid-area: search; max-width: none; }
  .pdx-search input, #setup #search { padding: 11px 14px 11px 46px; font-size: 15px; }
  .pdx-search img { width: 34px; height: 34px; left: 4px; }
  .pdx-filter-panel { left: 8px; right: 8px; width: auto; }
  .pdx-browse-head { font-size: 10px; letter-spacing: .1em; padding: 0 4px; }
  .pdx-browse-head .pdx-mono:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  /* cards: compact, two per row */
  .pdx-cards { gap: 8px !important; }
  .pdx-card { padding: 10px; gap: 6px; border-radius: 18px; }
  .pdx-card:hover { transform: none; }
  .pdx-card-head { flex-direction: column; align-items: stretch; gap: 4px; position: relative; }
  .pdx-card-art { width: 100%; height: 72px; }
  .pdx-ghost { font-size: 40px; }
  .pdx-card-info { align-items: flex-start; gap: 3px; }
  .pdx-name { font-size: 15px; }
  .pdx-num { font-size: 9.5px; }
  .pdx-badge { font-size: 9px !important; padding: 4px 7px !important; }
  .pdx-add { position: absolute; top: 0; right: 0; padding: 6px 10px; font-size: 11px; }
  .pdx-stats, .pdx-card-foot { display: none; }
  .pdx-card.open::after { display: none; }
  /* the panel: a bottom sheet over a dim backdrop */
  #setup.pdx-sheet-open .pdx-backdrop { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(20,20,26,.4); }
  body:has(#setup.pdx-sheet-open) { overflow: hidden; }
  .pdx-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-height: 86vh; overflow-y: auto; margin: 0; padding: 14px 14px 28px;
    border-radius: 24px 24px 0 0; animation: pdxSheet .26s cubic-bezier(.2,.8,.2,1) both; overscroll-behavior: contain; }
  .pdx-panel::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: #dcdce2; margin: -4px auto 10px; }
  .pdx-panel-head { flex-wrap: wrap; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; }
  .pdx-panel-title { flex: 1 1 140px; }
  .pdx-panel-head { position: relative; padding-right: 44px; }
  .pdx-close { position: absolute; top: -4px; right: 0; width: 34px; height: 34px; font-size: 18px; }
  .pdx-panel-title b { font-size: 19px; }
  .pdx-panel-title span { font-size: 12px; }
  .pdx-cta { padding: 10px 16px; font-size: 13px; }
  .pdx-panel-body { grid-template-columns: 1fr; gap: 18px; }
  .pdx-moves { grid-template-columns: 1fr 1fr; max-height: none; gap: 6px; }
  .pdx-move { padding: 8px 9px; }
  .pdx-move-name { font-size: 12.5px; }
  .pdx-move small { font-size: 10px; padding-left: 0; }
  .pdx-move-name i { display: none; }
  .pdx-src { position: static; display: block; margin-top: 1px; font-size: 8.5px; }
  .pdx-table { font-size: 12px; }
  .pdx-table td { padding: 5px 6px; }
  .pdx-facts { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .pdx-facts b { font-size: 15px; }
  /* tray: [vs foe ......][Random][Clear] / [6 slots ......][Battle] */
  .pdx-team-tray { left: 6px; right: 6px; bottom: 6px; }
  .pdx-tray { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "foe btns" "slots start"; gap: 8px; padding: 8px 10px; border-radius: 18px; }
  .pdx-tray-title { display: none; }
  .pdx-foe { grid-area: foe; flex-direction: row; align-items: center; gap: 6px; padding: 3px 8px; min-width: 0; overflow: hidden; }
  .pdx-foe .pdx-mono { font-size: 8.5px; white-space: nowrap; flex-shrink: 0; }
  .pdx-foe > div { min-width: 0; overflow: hidden; }
  .pdx-foe .pdx-art { transform: scale(.8); }
  .pdx-tray-btns { grid-area: btns; gap: 6px; }
  .pdx-tray-btns .pdx-pill { padding: 6px 10px; font-size: 11.5px; }
  .pdx-tray > * { min-width: 0; }
  .pdx-slots { grid-area: slots; flex-wrap: nowrap; gap: 5px; min-width: 0; }
  .pdx-slot { flex: 1 1 0; width: auto; height: auto; aspect-ratio: 1; max-width: 52px; min-width: 0; border-radius: 12px; border-width: 1.5px; }
  .pdx-slot .pdx-art { transform: scale(.82); }
  .pdx-slot-name { display: none; }
  .pdx-slot-x { display: grid; place-items: center; width: 18px; height: 18px; top: -6px; right: -6px; font-size: 11px; }
  .pdx-slot.empty span { font-size: 12px; }
  .pdx-start { grid-area: start; padding: 0 14px; font-size: 0; align-self: stretch; }
  .pdx-start::after { content: 'Battle'; font-size: 14px; }
}
@keyframes pdxSheet { from { transform: translateY(100%); } to { transform: none; } }

/* ---- end screen (#result, filled by js/main.js showResult): the same Pokédex look as the team builder, keyboard driven */
#result { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: rgba(244,244,246,.94); backdrop-filter: blur(6px);
  font-family: Poppins, "Helvetica Neue", Helvetica, sans-serif; color: #1b1b1f; -webkit-font-smoothing: antialiased; animation: pdxRise .25s ease both; }
#result[hidden] { display: none; }
.rs-wrap { max-width: 1000px; margin: 0 auto; padding: 24px 20px 24px; display: flex; flex-direction: column; gap: 22px; }
.rs-head { display: block; border-bottom: 0; position: relative; background: #e3353c; color: #fff; border-radius: 24px; padding: 24px 28px; box-shadow: 0 20px 40px -28px rgba(227,53,60,.9); }
.rs-head.lose { background: #1b1b1f; box-shadow: 0 20px 40px -28px rgba(20,20,26,.9); }
.rs-kicker { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; opacity: .8; }
.rs-head h2 { margin: 6px 0 4px; font-family: 'Jersey 15', monospace; font-weight: 400; font-size: 64px; line-height: .9; letter-spacing: .01em; text-transform: uppercase; }
#result-sub { font-size: 14px; opacity: .9; max-width: 70%; }
.rs-score { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); background: #fff; color: #1b1b1f; border-radius: 18px; padding: 12px 18px;
  text-align: center; font-family: 'Jersey 15', monospace; font-size: 44px; line-height: .9; }
.rs-score small { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: #9a9aa3; margin-top: 4px; }
#result .pdx-label { padding: 0 6px; margin-bottom: 10px; }
.rs-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rs-card { background: #fff; border-radius: 22px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; box-shadow: 0 14px 30px -26px rgba(20,20,26,.6);
  border: 2px solid transparent; }
.rs-card.mvp { border-color: #f3c317; }
.rs-card.down { opacity: .55; }
.rs-card.down .pdx-art { filter: grayscale(1); }
.rs-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.rs-card-name { display: flex; align-items: baseline; gap: 6px; font-size: 16px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-card-name small { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 400; color: #9a9aa3; letter-spacing: .08em; }
.rs-hp { display: flex; align-items: center; gap: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: #6f6f79; }
.rs-hp .pdx-bar { flex: 1; }
.rs-hp .pdx-bar > div { background: #41a832; }
.rs-hp.mid .pdx-bar > div { background: #d9ad20; }
.rs-hp.low .pdx-bar > div { background: #e3353c; }
.rs-ev { font-size: 11px; font-weight: 600; color: #2f8f3a; }
.rs-tag { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: #b48a00; }
.rs-foe .rs-card { padding: 10px 12px; }
.rs-bar { position: sticky; bottom: 18px; z-index: 2; display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-radius: 22px; padding: 12px 12px 12px 22px; box-shadow: 0 18px 40px -22px rgba(20,20,26,.55); }
.rs-keys { margin-right: auto; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .08em; color: #9a9aa3; }
.rs-btns { display: flex; gap: 8px; }
.rs-btn { font-family: inherit; font-size: 15px; font-weight: 700; padding: 13px 22px; border-radius: 999px; cursor: pointer; white-space: nowrap; border: 0;
  transition: box-shadow .15s ease, transform .15s ease, filter .15s ease; }
.rs-btn:hover { filter: brightness(.95); }
.rs-go { background: #e3353c; color: #fff; box-shadow: 0 16px 30px -16px rgba(227,53,60,.7); }
.rs-dark { background: #1b1b1f; color: #fff; }
.rs-ghost { background: #fff; color: #1b1b1f; border: 1px solid #e6e6ec; }
.rs-btn.on, .rs-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(243,195,23,.95); transform: translateY(-1px); }
@media (max-width: 900px) { .rs-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .rs-wrap { padding: 14px 12px 14px; gap: 16px; }
  .rs-head { padding: 18px 18px 20px; border-radius: 20px; }
  .rs-head h2 { font-size: 46px; }
  #result-sub { max-width: none; font-size: 13px; }
  .rs-score { position: static; transform: none; display: inline-block; margin-top: 12px; font-size: 34px; padding: 8px 14px; }
  .rs-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rs-card { flex-direction: column; align-items: stretch; text-align: left; padding: 10px; border-radius: 18px; gap: 6px; }
  .rs-card .pdx-art { margin: 0 auto; }
  .rs-keys { display: none; }
  .rs-bar { flex-direction: column; align-items: stretch; padding: 10px; bottom: max(10px, env(safe-area-inset-bottom)); }
  .rs-btns { display: grid; grid-template-columns: 1fr 1fr; }
  .rs-go { grid-column: 1 / -1; grid-row: 1; }
}
