/* The stage keeps the field's 4:3 bounds. Each page extends one DS panel to
   full height; portraits are decoded from the installed ROM, never captured. */
#pokemon-view{--pokemon-ink:#233e44;--pokemon-paper:#f5faf6;position:absolute;top:0;left:50%;transform:translateX(-50%);width:var(--dex-width);height:var(--dex-height);display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;background:#173238;color:var(--pokemon-ink);font:400 24px/1.08 PokemonDS,monospace;z-index:3}
#pokemon-view[hidden]{display:none}
body[data-pokemon-open="true"] #mp-names,body[data-pokemon-open="true"] #mp-chat,body[data-pokemon-open="true"] #scene-chat{visibility:hidden}
#pokemon-view *{box-sizing:border-box}
#pokemon-view button{font:inherit;cursor:pointer;color:inherit;touch-action:manipulation}
#pokemon-view button:focus-visible{outline:3px solid #ffd160;outline-offset:-4px}
#pokemon-view button:hover:not(:disabled){filter:brightness(1.07)}
#pokemon-view button:disabled{cursor:default}
.pokemon-half{position:relative;container-type:inline-size;min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;background:#89d8d7;background-image:linear-gradient(90deg,transparent 6%,#4bbbc0 6% 8%,#a9eeeb 8% 10%,transparent 10% 90%,#a9eeeb 90% 92%,#4bbbc0 92% 94%,transparent 94%)}
#pokemon-view h3{flex:none;height:7%;min-height:24px;margin:0;padding:0 4%;display:flex;align-items:center;background:#239aa1;border-bottom:3px solid #65c8cb;color:#fff;font:400 6.5cqw/1 PokemonDS,monospace;text-shadow:1px 2px #256d79}
.pokemon-overview-body{padding:2.5%;display:flex;flex:1;flex-direction:column;gap:2%;min-height:0}
.pokemon-hero{flex:1;min-height:0;display:grid;place-items:center;overflow:hidden}
.pokemon-portrait{image-rendering:pixelated;object-fit:contain;display:block}
.pokemon-portrait[hidden]{display:none}
.pokemon-hero-image{width:100%;height:100%;min-height:0;object-fit:contain;filter:drop-shadow(0 5px 0 #34898b35)}
.pokemon-identity{flex:none;border:3px solid #4c9398;background:var(--pokemon-paper);padding:3%;box-shadow:3px 3px #60babc;font-size:5.5cqw}
.pokemon-identity>div{display:flex;justify-content:space-between;align-items:center;gap:4px;margin:1.5% 0}
.pokemon-identity strong{font-size:7.5cqw;font-weight:400;overflow-wrap:anywhere}
.pokemon-gender{color:#387caa}
.pokemon-types{display:flex;gap:4px;flex-wrap:wrap}
.pokemon-types>span{background:#aab2a0;color:#182b30;box-shadow:inset 0 0 0 2px #ffffff55;padding:3px 5px;font-size:4.5cqw;text-shadow:none}
.pokemon-types [data-type="13"]{background:#e1cd47}.pokemon-types [data-type="11"]{background:#83bfee}.pokemon-types [data-type="10"]{background:#f1a16e}.pokemon-types [data-type="12"]{background:#a8d477}.pokemon-types [data-type="5"]{background:#ccb881}.pokemon-types [data-type="4"]{background:#d5af87}.pokemon-types [data-type="14"]{background:#eea5b8}
.pokemon-hp{display:block!important;height:9px;min-height:5px;background:#214e39;overflow:hidden}
.pokemon-hp i{display:block;height:100%;background:#59eb43}
.pokemon-hp [data-health="mid"]{background:#f2c441}.pokemon-hp [data-health="low"]{background:#f45e4e}
.pokemon-message{flex:none;margin:0 2.5% 2.5%;min-height:10%;max-height:23%;display:flex;align-items:center;padding:3%;border:4px ridge #737c8b;background:#fafafa;color:#384755;font-size:5.8cqw;white-space:pre-line;overflow:auto}
.pokemon-party-body{padding:2%;min-height:0;flex:1;display:flex;flex-direction:column}
.pokemon-grid{height:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:2%}
#pokemon-view .pokemon-slot{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding:4%;gap:3%;border:3px solid #176438;box-shadow:inset 0 0 0 2px #74d185,2px 2px #398d91;background:linear-gradient(#087a34 48%,#049a42 48%);color:#fff;text-shadow:1px 2px #1c3e2d;text-align:left}
#pokemon-view .pokemon-slot.selected{border-color:#ec4a3e;box-shadow:inset 0 0 0 2px #ffefd0,2px 2px #477f84;background:linear-gradient(#0bae45 48%,#23cd51 48%)}
#pokemon-view .pokemon-slot.switch-source{border-color:#ffcd53}
.pokemon-slot-art{flex:1;min-height:0;display:grid;place-items:center}
.pokemon-slot-art .pokemon-portrait{width:100%;height:100%;min-height:0;object-fit:contain}
.pokemon-slot strong{font-size:6.4cqw;font-weight:400;white-space:nowrap;letter-spacing:-.015em}
.pokemon-slot .pokemon-hp{flex:none;margin:1% 0;height:7px}
.pokemon-slot-meta{display:flex;justify-content:space-between;gap:3px;font-size:5.3cqw;white-space:nowrap}
.pokemon-held{position:absolute;right:7%;top:7%;color:#ffe5a2;font:14px Arial,sans-serif}
#pokemon-view .pokemon-empty{align-items:center;justify-content:center;background:#40acb8;border-color:#309ba5;box-shadow:inset 0 0 0 2px #6dc6cb;color:#287b87;text-shadow:none}
.pokemon-empty span{opacity:.7;font-size:9cqw}
.pokemon-actions{display:flex;flex-direction:column;justify-content:center;flex:1;gap:3%;padding:3%}
#pokemon-view .pokemon-actions button{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4% 5%;min-height:0;flex:1;max-height:19%;border:3px solid #b88732;box-shadow:inset 0 0 0 2px #ffe8a2,3px 3px #6ba4a1;background:linear-gradient(#fff2a6 45%,#f4c950 46%);color:#374749;font-size:8cqw;text-align:left}
#pokemon-view .pokemon-actions .selected{border-color:#e94c3e;background:#fff2a2}
.pokemon-controls{flex:none;min-height:9%;display:flex;justify-content:space-evenly;gap:4px;padding:6px 4px;background:linear-gradient(#298ed0 48%,#154d9e 48%)}
#pokemon-view .pokemon-controls button{display:flex;align-items:center;justify-content:center;gap:5px;flex:1;min-width:0;border:1px solid #688393;border-radius:4px;background:linear-gradient(#f8fcfc 47%,#bdd0dc 48%);font-size:5.4cqw;padding:3px;color:#263e4a}
#pokemon-view kbd{display:inline-flex;align-items:center;justify-content:center;flex:none;padding:4px;min-width:20px;min-height:24px;white-space:nowrap;border:1px solid #99aeb9;border-bottom:3px solid #98aab6;border-radius:4px;box-shadow:0 2px #597585;background:linear-gradient(#fff,#dce7ee);font:500 10px Arial,sans-serif;color:#2a424c}
.pokemon-summary-overview .pokemon-overview-body{flex:1;min-height:0}
.pokemon-summary-overview .pokemon-identity{font-size:4.5cqw;padding:2%}
.pokemon-summary-overview .pokemon-identity strong{font-size:6cqw}
.pokemon-summary-note{flex:none;height:38%;margin:0 3% 3%;display:flex;justify-content:center;overflow:hidden;background:#e4eded;border:3px ridge #648ea7}
.pokemon-native{image-rendering:pixelated;display:block;object-fit:contain;max-width:100%;min-height:0}
.pokemon-summary-note .pokemon-native{height:100%;width:auto}
.pokemon-memo{width:100%;padding:4%;background:#f7faf3;font-size:5.8cqw;line-height:1.13;overflow:auto;white-space:pre-line}
.pokemon-memo p{margin:0 0 .5em}.pokemon-memo p:last-child{margin-bottom:0}.pokemon-memo p:first-child{color:#ab4739}
.pokemon-facts{width:100%;margin:0;display:flex;flex-direction:column;justify-content:space-around;gap:4px;font-size:6.2cqw}
.pokemon-facts>div{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:3% 0;border-bottom:2px dotted #bfd1c7}
.pokemon-facts>div:last-child{border-bottom:0}.pokemon-facts dt{color:#4c6869}.pokemon-facts dd{margin:0;text-align:right;overflow-wrap:anywhere}
.pokemon-summary-content:has(.pokemon-facts){padding:4%;background:#f7faf3}.pokemon-summary-content>.pokemon-facts{height:100%}
.pokemon-skills{display:flex;flex-direction:column;width:100%;padding:2% 4%;background:#f7faf3;min-height:0}
.pokemon-skills .pokemon-facts{flex:1;gap:1px;min-height:0;font-size:5.2cqw}.pokemon-skills .pokemon-facts>div{padding:0}
.pokemon-ability{font-size:5.3cqw;color:#385973;padding-top:3px}
.pokemon-ability-effect{font-size:5cqw;margin:2px 0;line-height:1.08}
.pokemon-summary-content:has(.pokemon-moves){padding:3%;background:#71c4c9}
.pokemon-moves{display:flex;flex-direction:column;gap:3%;width:100%;height:100%;min-height:0}
.pokemon-moves>p{font-size:5.5cqw;margin:0;flex:none}
#pokemon-view .pokemon-move{display:flex;flex-direction:column;justify-content:center;gap:8%;flex:1;min-height:0;min-width:0;text-align:left;background:#f7faf3;border:3px solid #56959c;box-shadow:2px 2px #479499;padding:3% 5%}
#pokemon-view .pokemon-move[aria-pressed="true"]{border-color:#e45446;box-shadow:inset 0 0 0 2px #ffe2ac,2px 2px #479499}
.pokemon-move strong{font-size:8cqw;font-weight:400}.pokemon-move-meta{display:flex;justify-content:space-between;align-items:center;gap:4px;font-size:5.5cqw}
.pokemon-move-detail{padding:4%;background:#f7faf3;display:flex;flex-direction:column;width:100%;gap:7px;overflow:auto}
.pokemon-move-detail>strong{font-size:7cqw;font-weight:400;color:#b1483b}.pokemon-move-detail p{font-size:5.8cqw;line-height:1.1;margin:0}
.pokemon-move-numbers{display:flex;justify-content:space-between;flex-wrap:wrap;gap:4px;font-size:5cqw;border-bottom:2px dotted #bdd0c9;padding-bottom:6px}
#pokemon-view .pokemon-summary-party button:disabled{opacity:.65}
.pokemon-empty-ribbons{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:18px;width:100%;height:100%;padding:8%;background:#f7faf3;font-size:6cqw}
.pokemon-empty-ribbons svg{width:64px;height:64px;color:#bc903a}.pokemon-empty-ribbons strong{font-size:8cqw;font-weight:400}
.pokemon-tabs{display:flex;gap:4px;flex:none;padding:2%}
#pokemon-view .pokemon-tabs button{flex:1;min-width:0;border:2px solid #6b8d9a;background:#f4faf5;color:#345360;padding:4px 2px;font-size:5.7cqw}
#pokemon-view .pokemon-tabs [aria-pressed="true"]{background:#d3484a;border-color:#84383e;color:#fff}
.pokemon-summary-content{flex:1;display:flex;align-items:center;justify-content:center;min-height:0;margin:0 3%;overflow:hidden;background:#e4eded;border:3px ridge #628f9c}
.pokemon-summary-content .pokemon-native{height:100%;width:auto;max-width:100%;object-fit:contain}
.pokemon-native[data-pokemon-touch]{cursor:pointer;touch-action:manipulation}
.pokemon-summary-party{display:flex;gap:2%;height:12%;min-height:32px;padding:2% 3%;flex:none}
#pokemon-view .pokemon-summary-party button{flex:1;max-width:25%;min-width:0;padding:0;border:2px solid #508d90;background:#e4f2ed;display:grid;place-items:center}
#pokemon-view .pokemon-summary-party [aria-pressed="true"]{border-color:#e44f43;background:#fff3d7}
.pokemon-summary-party .pokemon-portrait{width:100%;height:100%;min-height:0}
.pokemon-summary .pokemon-controls button{flex-direction:column;font-size:4.3cqw;gap:2px}
.pokemon-native-footer{width:100%;height:auto;max-height:13%;flex:none}
.pokemon-native-full{width:100%;height:auto;max-height:100%;margin:auto;object-fit:contain}
.pokemon-native-half .pokemon-native-full{flex:1;min-height:0}
.pokemon-native-half{background-image:none}
.pokemon-loading{grid-column:1/-1;display:flex;align-items:center;justify-content:center;gap:16px;background:#89d8d7;color:#263e4a}
@media(prefers-reduced-motion:no-preference){.pokemon-slot.selected .pokemon-slot-art{animation:pokemon-select .16s ease-out}@keyframes pokemon-select{from{transform:translateY(3px)}to{transform:translateY(0)}}}
@media(max-width:600px){#pokemon-view{gap:4px}.pokemon-controls{padding:3px;gap:2px}#pokemon-view kbd{font-size:9px;padding:2px;min-width:16px;min-height:18px}#pokemon-view .pokemon-controls button{flex-direction:column;font-size:5.6cqw;gap:1px}.pokemon-identity{border-width:2px}.pokemon-message{border-width:2px}.pokemon-slot strong{font-size:6cqw}.pokemon-slot-meta{font-size:5.5cqw}.pokemon-slot-art .pokemon-portrait{max-height:100%}}
@container(max-width:260px){
  .pokemon-summary-note:has(.pokemon-skills){height:46%}
  .pokemon-skills{overflow:auto}.pokemon-skills .pokemon-facts{flex:none}
  .pokemon-facts{gap:2px;font-size:6cqw}.pokemon-facts>div{padding:1% 0;gap:4px}
  .pokemon-skills .pokemon-facts,.pokemon-ability,.pokemon-ability-effect{font-size:11px}
  .pokemon-slot strong{font-size:12px}.pokemon-slot-meta{font-size:11px}
  #pokemon-view .pokemon-move{padding:1px 4px;gap:0;border-width:2px}
  .pokemon-move strong{font-size:max(12px,6.5cqw);line-height:1}
  .pokemon-move-meta{font-size:11px;line-height:1}
  .pokemon-move .pokemon-types>span{font-size:11px;padding:0 2px;box-shadow:none;line-height:1}
}
