*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:#0f1a12;color:#f4f1de;font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;overscroll-behavior:none}
body{display:flex;justify-content:center;touch-action:manipulation;-webkit-user-select:none;user-select:none}
#app{position:relative;width:100%;max-width:480px;height:100dvh;display:flex;flex-direction:column;background:#1d2b1f;overflow:hidden;padding-bottom:env(safe-area-inset-bottom)}
.hidden{display:none!important}
#hud{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;padding-top:max(8px,env(safe-area-inset-top));background:#14201a;border-bottom:3px solid #0b120d}
.hudl{display:flex;align-items:center;gap:6px;font-size:16px}
.jar-ico{display:inline-block;width:16px;height:18px;background:linear-gradient(#8fd3c4 0 30%,#3f8f7a 30%);border:2px solid #0b120d;border-radius:3px 3px 6px 6px;position:relative}
.jar-ico:before{content:"";position:absolute;left:-3px;right:-3px;top:-6px;height:5px;background:#a0633a;border:2px solid #0b120d;border-radius:2px}
.hudm{flex:1;display:flex;align-items:center;gap:6px;font-size:12px;min-width:0}
.hudm img{width:26px;height:26px;border:2px solid #0b120d;border-radius:4px}
.hudm .hpbar{flex:1;max-width:110px}
.pbtn{font:inherit;font-weight:700;color:#14201a;background:#e9d8a6;border:3px solid #0b120d;border-radius:6px;padding:8px 10px;box-shadow:0 3px 0 #0b120d;cursor:pointer;letter-spacing:.5px}
.pbtn:active{transform:translateY(2px);box-shadow:0 1px 0 #0b120d}
.pbtn.small{font-size:12px;padding:6px 8px}
.pbtn.big{font-size:22px;padding:12px 34px}
.pbtn:disabled{opacity:.45}
#stage{position:relative;flex:none;width:100%;aspect-ratio:1/1;max-height:62dvh;margin:0 auto;background:#0b120d}
#world{width:100%;height:100%;display:block;image-rendering:pixelated;image-rendering:crisp-edges}
#toast{position:absolute;left:8px;right:8px;bottom:8px;background:#f4f1de;color:#14201a;border:3px solid #0b120d;border-radius:6px;padding:8px 10px;font-size:14px;font-weight:700}
#flash{position:absolute;inset:0;background:#fff;animation:fl .18s steps(1) 4}
@keyframes fl{50%{background:#0b120d}}
#pad{flex:1;display:flex;align-items:center;justify-content:space-around;gap:10px;padding:10px 12px;min-height:150px}
.dpad{display:grid;grid-template-columns:repeat(3,58px);grid-template-rows:repeat(3,58px);gap:2px}
.d{font-size:20px;color:#e9d8a6;background:#2e4434;border:3px solid #0b120d;border-radius:8px;box-shadow:0 3px 0 #0b120d;touch-action:none}
.d:active,.d.on{background:#47664f;transform:translateY(2px);box-shadow:0 1px 0 #0b120d}
.up{grid-column:2;grid-row:1}.left{grid-column:1;grid-row:2}.mid{grid-column:2;grid-row:2;background:#2e4434;border:3px solid #0b120d;border-radius:8px}.right{grid-column:3;grid-row:2}.down{grid-column:2;grid-row:3}
.side{display:flex;flex-direction:column;align-items:center;gap:8px;max-width:150px}
.hint{font-size:11px;line-height:1.35;color:#c9c3a3;margin:0;text-align:center}
.reed{color:#9be36b}
.screen{position:absolute;inset:0;z-index:5;background:#1d2b1f;display:flex;flex-direction:column;align-items:center;padding:16px;padding-top:max(16px,env(safe-area-inset-top));overflow-y:auto}
#title{justify-content:center;gap:10px;background:radial-gradient(circle at 50% 35%,#3a5a3f,#14201a 70%)}
.logo{font-size:52px;font-weight:900;color:#e9d8a6;letter-spacing:4px;text-shadow:4px 4px 0 #0b120d,-2px -2px 0 #6b8f4e}
.sub{margin:0;font-size:16px;color:#9be36b}
.hero{width:min(60vw,240px);border:4px solid #0b120d;border-radius:10px;box-shadow:0 6px 0 #0b120d;animation:bob 1.6s ease-in-out infinite}
@keyframes bob{50%{transform:translateY(-6px)}}
.small-print{font-size:12px;color:#c9c3a3;text-align:center;max-width:320px;line-height:1.4}
h2{margin:6px 0 12px;font-size:20px;color:#e9d8a6}
#starter-list{display:flex;flex-direction:column;gap:10px;width:100%;max-width:360px}
.st{display:flex;align-items:center;gap:12px;background:#2e4434;border:3px solid #0b120d;border-radius:8px;padding:8px;color:#f4f1de;font:inherit;text-align:left;box-shadow:0 3px 0 #0b120d}
.st img{width:72px;height:72px;border:2px solid #0b120d;border-radius:6px}
.st small{display:block;color:#c9c3a3;font-size:11px;margin-top:4px}
/* battle */
#battle{padding:10px;gap:10px;justify-content:center;background:linear-gradient(#5f8a63 0 52%,#3e6345 52%)}
.foe{width:100%;display:flex;flex-direction:column;align-items:center;gap:6px}
.card{background:#f4f1de;color:#14201a;border:3px solid #0b120d;border-radius:8px;padding:6px 8px;width:100%;max-width:320px;box-shadow:0 3px 0 #0b120d}
.row{display:flex;justify-content:space-between;align-items:center;gap:6px;font-size:14px;margin-bottom:5px}
.hpbar{height:10px;background:#30302e;border:2px solid #0b120d;border-radius:4px;overflow:hidden}
.hpbar i{display:block;height:100%;width:100%;background:#59c135;transition:width .35s}
.hpbar i.mid{background:#e7c33b}.hpbar i.low{background:#e04a3c}
.foe-art{position:relative;width:min(64vw,280px,36dvh);aspect-ratio:1}
#foe-img{width:100%;height:100%;border:4px solid #0b120d;border-radius:10px;box-shadow:0 5px 0 #0b120d;transition:transform .3s,opacity .3s,filter .3s}
#foe-img.hit{animation:hit .3s}
@keyframes hit{25%{transform:translateX(-8px);filter:brightness(2)}75%{transform:translateX(8px)}}
#foe-img.gone{transform:scale(.1);opacity:0}
#jar-anim{position:absolute;left:50%;top:50%;width:44px;height:52px;margin:-26px 0 0 -22px;background:linear-gradient(#8fd3c4 0 30%,#3f8f7a 30%);border:4px solid #0b120d;border-radius:6px 6px 14px 14px}
#jar-anim:before{content:"";position:absolute;left:-7px;right:-7px;top:-13px;height:10px;background:#a0633a;border:4px solid #0b120d;border-radius:4px}
#jar-anim.throw{animation:throw .5s ease-out}
#jar-anim.shake{animation:shake .5s}
@keyframes throw{0%{transform:translate(-120px,220px) rotate(-200deg) scale(.6)}100%{transform:none}}
@keyframes shake{25%{transform:rotate(-20deg)}75%{transform:rotate(20deg)}}
.me{width:100%;display:flex;align-items:center;gap:8px;max-width:340px}
#me-img{width:64px;height:64px;border:3px solid #0b120d;border-radius:8px;transform:scaleX(-1)}
.me .card{flex:1}
#me-hptxt{font-size:12px}
.msg{width:100%;max-width:340px;min-height:58px;background:#14201a;border:3px solid #0b120d;border-radius:8px;padding:8px 10px;font-size:14px;line-height:1.35}
.acts{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%;max-width:340px}
.acts .pbtn{font-size:15px;padding:12px 6px}
.acts:disabled,.acts.busy .pbtn{opacity:.5;pointer-events:none}
.tier{font-size:11px;font-weight:700;padding:2px 6px;border-radius:4px;border:2px solid #0b120d;color:#14201a;white-space:nowrap}
.t-Common{background:#c9c3a3}.t-Uncommon{background:#9be36b}.t-Rare{background:#5cc8f0}.t-Epic{background:#c38bf2}.t-Legendary{background:#ffcb3b}
/* dex */
#dex{padding:12px}
.dex-head{display:flex;justify-content:space-between;align-items:center;width:100%;max-width:440px}
#dex-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;width:100%;max-width:440px}
.cell{position:relative;aspect-ratio:1;border:3px solid #0b120d;border-radius:8px;background:#2e4434;overflow:hidden;padding:0;font:inherit;color:#c9c3a3}
.cell img{width:100%;height:100%;display:block}
.cell.seen img{filter:brightness(0) opacity(.55)}
.cell .no{position:absolute;left:3px;bottom:2px;font-size:10px;font-weight:700;color:#fff;text-shadow:1px 1px 0 #000}
.cell.unk{display:flex;align-items:center;justify-content:center;font-size:22px}
.cell.caught{border-color:var(--tc,#0b120d)}
.cell.partner:after{content:"★";position:absolute;right:3px;top:1px;color:#ffcb3b;text-shadow:1px 1px 0 #000}
#detail{gap:8px;background:#14201a}
#det-img{width:min(70vw,260px);border:4px solid #0b120d;border-radius:10px}
#det-traits{list-style:none;padding:0;margin:4px 0;width:100%;max-width:300px;font-size:13px}
#det-traits li{display:flex;justify-content:space-between;border-bottom:1px dashed #47664f;padding:4px 0}
#det-traits li span{color:#c9c3a3}
.det-btns{display:flex;gap:10px}
@media (min-height:760px){.dpad{grid-template-columns:repeat(3,66px);grid-template-rows:repeat(3,66px)}}

/* leaderboard */
.pbtn.gold{background:#ffcb3b}
#title-lb{margin-top:4px}
#board{padding:12px;gap:6px;background:#14201a}
.lb-meline{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;max-width:440px;font-size:12px;color:#c9c3a3}
.lb-h{width:100%;max-width:440px;margin:10px 0 2px;font-size:13px;letter-spacing:1px;color:#9be36b;text-transform:uppercase}
#lb-hall{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;width:100%;max-width:440px}
.hall-card{display:flex;flex-direction:column;align-items:center;gap:4px;background:#2e4434;border:3px solid #0b120d;border-radius:8px;padding:6px;text-align:center;min-width:0}
.hall-card img{width:100%;max-width:90px;aspect-ratio:1;border:2px solid #0b120d;border-radius:6px;filter:grayscale(1) brightness(.45)}
.hall-card.got{border-color:#ffcb3b;background:#3d3a1e;box-shadow:0 0 10px rgba(255,203,59,.35)}
.hall-card.got img{filter:none}
.hall-txt{display:flex;flex-direction:column;gap:1px;font-size:12px;min-width:0;width:100%}
.hall-txt b{color:#ffcb3b}
.hall-who{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hall-who i{font-style:normal;font-size:9px;color:#14201a;background:#ffcb3b;border-radius:3px;padding:0 3px;margin-right:2px}
.hall-txt small{font-size:10px;color:#c9c3a3}
#lb-list,#lb-feed{display:flex;flex-direction:column;gap:6px;width:100%;max-width:440px}
.lb-row{display:flex;align-items:center;gap:8px;background:#2e4434;border:3px solid #0b120d;border-radius:8px;padding:6px 8px}
.lb-row.you{border-color:#9be36b;background:#33503a}
.lb-row.top1{background:#4a4322}
.rk{width:28px;text-align:center;font-weight:900;font-size:16px;flex:none}
.lb-mid{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.lb-name{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lb-name em{font-style:normal;font-size:11px;color:#9be36b}
.lb-bar{height:6px;background:#14201a;border:1px solid #0b120d;border-radius:3px;overflow:hidden}
.lb-bar i{display:block;height:100%;background:#59c135}
.lb-legs{display:flex;flex-wrap:wrap;gap:4px}
.leg-badge{font-size:10px;font-weight:700;color:#14201a;background:#ffcb3b;border:2px solid #0b120d;border-radius:4px;padding:0 4px}
.lb-score{flex:none;text-align:right}
.lb-score b{font-size:20px;color:#e9d8a6}.lb-score small{font-size:11px;color:#c9c3a3}
.lb-empty{font-size:12px;color:#c9c3a3;margin:4px 0}
.feed-row{display:flex;align-items:center;gap:8px;font-size:13px;background:#2e4434;border:2px solid #0b120d;border-radius:8px;padding:5px 8px}
.feed-row img{width:34px;height:34px;border:2px solid #0b120d;border-radius:5px;flex:none}
.feed-row small{color:#c9c3a3;font-size:11px}
.feed-row.first{border-color:#ffcb3b;background:#3d3a1e}
#lb-status{margin:10px 0 4px}
#namebox{justify-content:center;gap:10px;background:radial-gradient(circle at 50% 35%,#3a5a3f,#14201a 70%);z-index:7}
#name-in{font:inherit;font-size:20px;font-weight:700;width:100%;max-width:300px;padding:10px 12px;border:3px solid #0b120d;border-radius:8px;background:#f4f1de;color:#14201a;text-align:center;-webkit-user-select:text;user-select:text}
.name-err{min-height:16px;margin:0;font-size:12px;color:#ff9b8a}
#banner{position:absolute;z-index:20;left:8px;right:8px;top:max(8px,env(safe-area-inset-top));display:flex;align-items:center;gap:8px;background:#ffcb3b;color:#14201a;border:3px solid #0b120d;border-radius:8px;padding:6px 10px;font-weight:800;font-size:14px;box-shadow:0 4px 0 #0b120d}
#banner img{width:38px;height:38px;border:2px solid #0b120d;border-radius:5px;flex:none}
#banner.pop{animation:pop .45s ease-out}
@keyframes pop{0%{transform:translateY(-120%)}70%{transform:translateY(6px)}100%{transform:none}}

/* arcade picker */
#title{justify-content:flex-start;gap:12px;padding-top:max(22px,env(safe-area-inset-top))}
.arc-top{font-size:34px;font-weight:900;color:#e9d8a6;letter-spacing:3px;text-shadow:3px 3px 0 #0b120d,-2px -2px 0 #6b8f4e;text-align:center;margin-top:6px}
#title .sub{margin-top:-6px}
.gcard{display:flex;align-items:center;gap:12px;width:100%;max-width:400px;background:#2e4434;border:3px solid #0b120d;border-radius:10px;padding:10px;box-shadow:0 4px 0 #0b120d;color:#f4f1de;text-decoration:none}
.gcard.kong{background:linear-gradient(135deg,#3b2f1c,#2e4434)}
.gcard:active{transform:translateY(2px)}
.ghero{width:104px;height:104px;flex:none;border:3px solid #0b120d;border-radius:8px;image-rendering:pixelated;background:#0b120d}
.ginfo{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
.gname{font-size:22px;font-weight:900;color:#e9d8a6;letter-spacing:1px;text-shadow:2px 2px 0 #0b120d}
.gdesc{margin:0;font-size:11px;line-height:1.35;color:#c9c3a3}
.gbtns{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.gbtns .pbtn{font-size:14px;padding:7px 10px}.gbtns .pbtn.small{font-size:11px;padding:6px 7px}
.newb{font-style:normal;font-size:10px;vertical-align:middle;background:#e04a3c;color:#fff;border:2px solid #0b120d;border-radius:4px;padding:1px 4px;text-shadow:none;animation:bob 1.2s ease-in-out infinite;display:inline-block}

.gcard.pin{background:linear-gradient(135deg,#1f3d4a,#2e4434)}
.ghero.pinhero{image-rendering:auto}
.gcard.kart{background:linear-gradient(135deg,#4a2a1f,#2e4434)}

.gcard.roul{background:linear-gradient(135deg,#5a1f1a,#1d5a33)}

.gcard.walk{background:linear-gradient(135deg,#3a4a1a,#1d3a2e)}

.gcard.smash{background:linear-gradient(135deg,#4a3a12,#2e4434)}
