:root {
  --ink: #1d2338;
  --paper: #f8f6ec;
  --paper2: #ebe7d6;
  --frame: #2a3352;
  --frame2: #6c7cb0;
  --red: #e0453a;
  --red-d: #a8261e;
  --blue: #3a6fd8;
  --blue-d: #22479c;
  --green: #3fae5a;
  --green-d: #23753a;
  --gold: #f6c33b;
  --gold-d: #b7861a;
  --bg: #121a30;
  --bg2: #1d2a4c;
  --hud: rgba(20, 27, 50, 0.94);
  --muted: #8a93b4;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --px: 'Press Start 2P', ui-monospace, monospace;
  /* Nunito is loaded with digits only (index.html), so numbers come from it and everything else from
     Pixelify Sans, whose 5 reads as an S ("level S", "1S/1SO"). Pixel digit fonts blurred at these sizes. */
  --tx: 'Nunito', 'Pixelify Sans', 'Trebuchet MS', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--paper); font-family: var(--tx); font-size: 16px; }
body { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
img.px, .px img { image-rendering: pixelated; image-rendering: crisp-edges; }

#app { position: fixed; inset: 0; display: flex; justify-content: center; background: radial-gradient(ellipse at 50% 0%, #2a3b6b 0%, var(--bg) 70%); }
.screen { position: relative; width: 100%; max-width: 520px; height: 100%; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- Generic widgets ---------- */
.panel { background: var(--paper); color: var(--ink); border: 3px solid var(--frame); border-radius: 10px; box-shadow: inset 0 0 0 2px var(--frame2), 0 4px 0 rgba(0,0,0,0.35); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 10px; font-family: var(--px); font-size: 11px; letter-spacing: 0.5px; color: #fff; background: var(--blue); box-shadow: inset 0 -4px 0 var(--blue-d), 0 2px 0 rgba(0,0,0,0.4); text-shadow: 1px 1px 0 rgba(0,0,0,0.35); transition: transform 0.06s; }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--blue-d); }
.btn.red { background: var(--red); box-shadow: inset 0 -4px 0 var(--red-d), 0 2px 0 rgba(0,0,0,0.4); }
.btn.green { background: var(--green); box-shadow: inset 0 -4px 0 var(--green-d), 0 2px 0 rgba(0,0,0,0.4); }
.btn.gold { background: var(--gold); color: #3a2a00; text-shadow: none; box-shadow: inset 0 -4px 0 var(--gold-d), 0 2px 0 rgba(0,0,0,0.4); }
.btn.ghost { background: rgba(255,255,255,0.1); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3); }
.btn[disabled], .btn.off { filter: grayscale(0.8) brightness(0.8); opacity: 0.6; pointer-events: none; }
.btn.big { min-height: 54px; font-size: 13px; padding: 0 22px; }
.btn.sm { min-height: 34px; font-size: 9px; padding: 0 10px; border-radius: 8px; }

.type { display: inline-block; font-family: var(--px); font-size: 7px; line-height: 1; padding: 4px 5px 3px; border-radius: 4px; color: #fff; text-transform: uppercase; text-shadow: 1px 1px 0 rgba(0,0,0,0.4); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2); }
.types { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.pxnum { font-family: var(--px); }
.coin::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0 0 20%, #f6c33b 25% 60%, #b7861a 65%); box-shadow: 0 0 0 1px #6b4c00; }
.star-ic { color: var(--gold); text-shadow: 0 1px 0 #6b4c00; }
.muted { color: var(--muted); }

/* ---------- Title ---------- */
#title { align-items: center; justify-content: center; text-align: center; background: linear-gradient(#2a2552 0%, #b35c76 45%, #ffd39a 60%, #2e3b4c 62%, #151d2b 100%); }
#title .title-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#title > .logo, #title > .tap, #title > .title-btns, #title > .challenge, #title > .moved { position: relative; z-index: 1; }
#title > .credit { z-index: 1; }
/* "kaizoku_collects presents" sits at the top; on the first visit it opens centered, then settles. */
#title .presents { position: absolute; top: calc(18px + var(--safe-t)); left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 10px; pointer-events: none; transform-origin: 50% 0; }
.kc-logo { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,236,200,0.8), 0 4px 14px rgba(0,0,0,0.45); }
.kc-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-shadow: 0 2px 6px rgba(0,0,0,0.55); }
.kc-txt b { font-family: var(--tx); font-size: 18px; color: #fff; }
.kc-txt span { font-family: var(--px); font-size: 8px; letter-spacing: 3px; color: #ffd9a8; text-transform: uppercase; }
#title.intro .presents { animation: presents 1.6s ease-in-out both; }
@keyframes presents { 0% { opacity: 0; transform: translateY(34vh) scale(1.7); } 18%, 55% { opacity: 1; transform: translateY(34vh) scale(1.7); } 100% { opacity: 1; transform: none; } }
#title.intro .logo, #title.intro .title-btns, #title.intro .challenge, #title.intro .moved { animation: titleIn 0.6s ease-out 1.1s both; }
@keyframes titleIn { from { opacity: 0; transform: translateY(14px); } }
.logo { position: relative; margin-top: -10vh; font-family: var(--px); line-height: 1.2; }
.logo .l1 { font-size: clamp(22px, 7.4vw, 36px); color: var(--gold); -webkit-text-stroke: 2px #2a4aa0; text-shadow: 0 4px 0 #2a4aa0, 0 7px 0 rgba(0,0,0,0.25); letter-spacing: 1px; }
.logo .l2 { margin-top: 10px; font-size: clamp(30px, 10.6vw, 54px); color: #fff3d6; -webkit-text-stroke: 2px #7a2f1c; text-shadow: 0 5px 0 #7a2f1c, 0 9px 0 rgba(0,0,0,0.3), 0 0 26px rgba(255,170,90,0.55); letter-spacing: 2px; }
.logo .l3 { margin-top: 14px; font-size: clamp(7px, 2.3vw, 10px); color: #ffe6c4; letter-spacing: 2px; text-shadow: 1px 1px 0 rgba(0,0,0,0.6); }
@keyframes hop { from { transform: translateY(0); } to { transform: translateY(-7px); } }
.tap { margin-top: 30px; font-family: var(--px); font-size: 12px; color: #fff; text-shadow: 2px 2px 0 #224; animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }
.title-btns { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.credit { position: absolute; bottom: calc(10px + var(--safe-b)); left: 0; right: 0; font-size: 11px; color: rgba(255,255,255,0.75); padding: 0 16px; }

/* ---------- Text box (GBA dialogue) ---------- */
.dialog { margin: 12px; padding: 14px 16px; font-size: 17px; line-height: 1.35; }
.dialog b { color: var(--red-d); }

/* ---------- Starter ---------- */
#starter { background: linear-gradient(#e8e0c8, #c8b890); color: var(--ink); justify-content: space-between; }
#starter .table { margin: 0 auto; width: 88%; max-width: 380px; padding: 26px 10px 18px; background: #b07840; border: 4px solid #6a4420; border-radius: 14px; box-shadow: inset 0 -8px 0 #8a5a2c; display: flex; justify-content: space-around; }
.sball { width: 72px; height: 72px; display: grid; place-items: center; transition: transform 0.15s; }
.sball.sel { transform: translateY(-8px) scale(1.12); }
.sball canvas { width: 46px; height: 46px; }
.starter-preview { min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.starter-preview img { width: 150px; height: 150px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
/* The intro stage (js/intro.js): story scenes, then the starters in the lab */
.starter-stage { flex: 1 1 0; min-height: 150px; width: calc(100% - 24px); margin: 0 12px; display: block; border: 3px solid var(--frame); border-radius: 10px; box-shadow: inset 0 0 0 2px var(--frame2), 0 4px 0 rgba(0,0,0,0.35); background: #78c4f2; touch-action: manipulation; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.starter-info { min-height: 46px; display: flex; align-items: center; justify-content: center; }
.sball.pop { animation: ballpop 0.55s ease-out; }
@keyframes ballpop { 25% { transform: translateY(-16px) rotate(-14deg); } 55% { transform: translateY(0) rotate(10deg); } 80% { transform: rotate(-4deg); } }

/* ---------- Hub ---------- */
#hub { background: linear-gradient(180deg, #24345e 0%, #151d36 100%); }
.trainer { margin: calc(8px + var(--safe-t)) 10px 6px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; }
.trainer .tstats { flex: 1; display: flex; flex-direction: column; gap: 6px; font-family: var(--px); font-size: 10px; }
.trainer .row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.badges { display: flex; gap: 4px; }
.badge { width: 14px; height: 14px; border-radius: 50%; background: #c8c4b4; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2); }
.badge.on { box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), 0 0 0 1px #000; }
.daily { position: relative; width: 48px; height: 48px; border-radius: 10px; background: var(--gold); box-shadow: inset 0 -4px 0 var(--gold-d); display: grid; place-items: center; font-size: 24px; animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-8deg); } 85% { transform: rotate(8deg); } }
.hub-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 10px 16px; }
.nav { display: flex; background: var(--hud); border-top: 3px solid #0c1122; padding-bottom: var(--safe-b); }
.nav button { flex: 1; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-family: var(--px); font-size: 7px; color: var(--muted); }
.nav button .ic { font-size: 20px; line-height: 1; filter: grayscale(0.6); }
.nav button.on { color: #fff; background: rgba(255,255,255,0.07); }
.nav button.on .ic { filter: none; }

.region { margin: 10px 0 16px; border-radius: 12px; overflow: hidden; background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.08); }
.region h3 { margin: 0; padding: 10px 12px; font-family: var(--px); font-size: 10px; display: flex; justify-content: space-between; align-items: center; text-shadow: 1px 1px 0 rgba(0,0,0,0.5); }
.region.locked { opacity: 0.55; }
.lvls { position: relative; display: flex; justify-content: space-between; padding: 14px 12px 12px; }
.lvls::before { content: ''; position: absolute; left: 34px; right: 34px; top: 38px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; }
.lvl { position: relative; width: 54px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lvl .node { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-family: var(--px); font-size: 13px; color: #fff; background: var(--blue); box-shadow: inset 0 -4px 0 var(--blue-d), 0 3px 0 rgba(0,0,0,0.35); text-shadow: 1px 1px 0 rgba(0,0,0,0.4); }
.lvl.boss .node { background: var(--red); box-shadow: inset 0 -4px 0 var(--red-d), 0 3px 0 rgba(0,0,0,0.35); }
.lvl.locked .node { background: #555c72; box-shadow: inset 0 -4px 0 #3c4256; color: #9aa; }
.lvl.next .node { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.1); box-shadow: inset 0 -4px 0 var(--blue-d), 0 0 0 5px rgba(255,255,255,0.25); } }
.lvl .stars { font-size: 11px; letter-spacing: -1px; height: 12px; }
.lvl .stars i { font-style: normal; color: #4a5068; }
.lvl .stars i.on { color: var(--gold); }
.lvl .crown { position: absolute; top: -8px; right: -2px; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.card { position: relative; padding: 6px 6px 8px; border-radius: 10px; background: var(--paper); color: var(--ink); border: 2px solid var(--frame); box-shadow: 0 3px 0 rgba(0,0,0,0.35); display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.card img { width: 64px; height: 64px; }
.card .nm { font-size: 13px; font-weight: 700; line-height: 1.05; }
.card .lv { font-family: var(--px); font-size: 8px; color: #556; }
.card.inparty { border-color: var(--red); box-shadow: 0 0 0 2px var(--red), 0 3px 0 rgba(0,0,0,0.35); }
.card .pin { position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); color: #fff; font-family: var(--px); font-size: 7px; display: grid; place-items: center; }
.card .shiny { position: absolute; top: 4px; left: 6px; color: #e8a800; font-size: 12px; }
.card .adv { position: absolute; top: 3px; left: 4px; font-family: var(--px); font-size: 7px; padding: 2px 3px; border-radius: 3px; background: var(--green); color: #fff; }
.card .adv.bad { background: var(--red); }

.sect-title { margin: 14px 2px 8px; font-family: var(--px); font-size: 10px; color: #cfd6f0; display: flex; justify-content: space-between; align-items: center; }
.party-slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pslot { aspect-ratio: 1; border-radius: 10px; background: rgba(255,255,255,0.08); border: 2px dashed rgba(255,255,255,0.18); display: grid; place-items: center; position: relative; }
.pslot img { width: 100%; height: 100%; }
.pslot .lv { position: absolute; bottom: 2px; right: 3px; font-family: var(--px); font-size: 8px; color: #fff; text-shadow: 1px 1px 0 #000; }
.pslot.filled { background: rgba(255,255,255,0.14); border-style: solid; border-color: rgba(255,255,255,0.3); }

.dexgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 5px; }
.dexcell { position: relative; aspect-ratio: 1; border-radius: 8px; background: rgba(255,255,255,0.07); display: grid; place-items: center; }
.dexcell img { width: 100%; height: 100%; }
.dexcell.seen img { filter: brightness(0); opacity: 0.6; }
.dexcell .no { position: absolute; top: 2px; left: 4px; font-family: var(--px); font-size: 6px; color: var(--muted); }
.dexcell.caught { background: rgba(255,255,255,0.16); }
.dexcell .q { font-family: var(--px); color: #4a5578; font-size: 14px; }

.shop-item { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 8px; }
.shop-item img { width: 40px; height: 40px; }
.shop-item .info { flex: 1; min-width: 0; }
.shop-item .info b { display: block; font-size: 16px; }
.shop-item .info small { display: block; color: #5a6078; font-size: 13px; line-height: 1.15; }
.shop-item .own { font-family: var(--px); font-size: 8px; color: #556; margin-top: 4px; }
.shop-item .buy { display: flex; flex-direction: column; gap: 6px; }

.opt-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; margin-bottom: 8px; font-size: 17px; }
.toggle { width: 54px; height: 30px; border-radius: 15px; background: #b6b2a4; position: relative; transition: background 0.15s; box-shadow: inset 0 2px 0 rgba(0,0,0,0.2); }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.25); transition: left 0.15s; }
.toggle.on { background: var(--green); }
.toggle.on::after { left: 27px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(6, 10, 22, 0.66); display: flex; align-items: flex-end; justify-content: center; animation: fadein 0.15s; }
.modal-bg.center { align-items: center; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: 92%; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border: 3px solid var(--frame); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: inset 0 0 0 2px var(--frame2); animation: slideup 0.2s ease-out; padding-bottom: var(--safe-b); }
.modal-bg.center .modal { width: calc(100% - 28px); max-width: 420px; border-radius: 14px; border-bottom: 3px solid var(--frame); animation: pop 0.2s ease-out; padding-bottom: 0; }
@keyframes slideup { from { transform: translateY(40%); opacity: 0; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; gap: 8px; }
.modal-head h2 { margin: 0; font-family: var(--px); font-size: 12px; line-height: 1.4; }
.modal-body { overflow-y: auto; padding: 4px 14px 14px; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; gap: 10px; padding: 10px 14px 14px; border-top: 2px solid var(--paper2); }
.modal-foot .btn { flex: 1; }
.xbtn { width: 38px; height: 38px; border-radius: 10px; background: var(--paper2); color: var(--ink); font-family: var(--px); font-size: 12px; flex-shrink: 0; }

.lv-info { display: flex; gap: 10px; flex-wrap: wrap; font-size: 15px; margin-bottom: 8px; }
.lv-info span { background: var(--paper2); padding: 4px 8px; border-radius: 6px; }
.enemy-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 10px; }
.enemy-chip { width: 54px; display: flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1; padding: 3px 0 4px; border-radius: 8px; background: var(--paper2); }
.enemy-chip img { width: 48px; height: 48px; }
.enemy-chip.boss { background: #ffd6d0; outline: 2px solid var(--red); }
.hint { font-size: 14px; color: #4a5068; margin: 6px 0; }
.label { font-family: var(--px); font-size: 8px; line-height: 1.5; color: #6a7090; margin: 12px 0 6px; text-transform: uppercase; }
.roster-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.rm { position: relative; border-radius: 10px; background: var(--paper2); padding: 4px 2px 5px; display: flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1.05; border: 2px solid transparent; }
.rm img { width: 52px; height: 52px; }
.rm .lv { font-family: var(--px); font-size: 8px; color: #556; margin-top: 2px; }
.rm.in { border-color: var(--red); background: #ffe8e4; }
.rm .adv { position: absolute; top: 3px; left: 3px; font-family: var(--px); font-size: 6px; padding: 2px 3px; border-radius: 3px; background: var(--green); color: #fff; }
.team-slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.team-slots .pslot { background: var(--paper2); border-color: #c8c2ae; }
.team-slots .pslot.filled { background: #ffe8e4; border-color: var(--red); }
.team-slots .pslot .lv { color: var(--ink); text-shadow: none; }

.pk-head { display: flex; gap: 12px; align-items: center; }
.pk-head img { width: 112px; height: 112px; background: radial-gradient(ellipse at 50% 80%, #d8e8c8 0 45%, transparent 46%); }
.pk-head .nm { font-size: 22px; font-weight: 700; }
.bar { height: 8px; border-radius: 4px; background: #d8d4c4; overflow: hidden; }
.bar > i { display: block; height: 100%; background: #3ab0e8; }
.stat { display: grid; grid-template-columns: 52px 34px 1fr; gap: 6px; align-items: center; font-size: 13px; margin: 3px 0; }
.stat .bar > i { background: var(--green); }
.mv-list { display: flex; flex-direction: column; gap: 4px; }
.mv { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: var(--paper2); font-size: 14px; }
.mv .lvreq { margin-left: auto; font-family: var(--px); font-size: 7px; color: #6a7090; }
.mv.locked { opacity: 0.5; }
.evo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.evo img { width: 56px; height: 56px; }
.evo .arrow { font-family: var(--px); font-size: 8px; color: #6a7090; text-align: center; }

/* ---------- Battle ---------- */
#battle { background: #000; }
.hud-top { display: flex; align-items: center; gap: 6px; padding: calc(6px + var(--safe-t)) 8px 6px; background: var(--hud); border-bottom: 3px solid #0c1122; font-family: var(--px); font-size: 11px; z-index: 5; }
.chip { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 9px; border-radius: 8px; background: rgba(255,255,255,0.08); white-space: nowrap; }
.chip.lives .heart { color: #ff5a6a; font-size: 14px; }
.chip.lives.hurt { animation: hurt 0.4s; }
@keyframes hurt { 30% { background: rgba(255,60,60,0.6); transform: scale(1.1); } }
.chip.money.gain { animation: gain 0.3s; }
@keyframes gain { 40% { transform: scale(1.12); color: #ffe060; } }
.hud-top .grow { flex: 1; }
.hud-top .ibtn { width: 38px; height: 34px; border-radius: 8px; background: rgba(255,255,255,0.12); font-family: var(--px); font-size: 10px; display: grid; place-items: center; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.toasts { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 6; }
.toast { max-width: 100%; padding: 8px 12px; font-size: 15px; line-height: 1.2; border-radius: 8px; background: var(--paper); color: var(--ink); border: 2px solid var(--frame); box-shadow: 0 3px 0 rgba(0,0,0,0.35); animation: toastin 0.18s ease-out; display: flex; align-items: center; gap: 8px; }
.toast img { width: 34px; height: 34px; margin: -6px 0; }
.toast.gold { background: #fff3c4; border-color: var(--gold-d); }
.toast.red { background: #ffe0dc; border-color: var(--red-d); }
.toast.out { animation: toastout 0.25s forwards; }
@keyframes toastin { from { transform: translateY(-10px); opacity: 0; } }
@keyframes toastout { to { transform: translateY(-8px); opacity: 0; } }
.banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; z-index: 7; font-family: var(--px); }
.banner .b1 { display: inline-block; padding: 12px 22px; font-size: clamp(14px, 5vw, 22px); color: #fff; background: rgba(20, 27, 50, 0.85); border-top: 3px solid var(--gold); border-bottom: 3px solid var(--gold); text-shadow: 2px 2px 0 #000; animation: banner 1.8s ease-in-out forwards; }
.banner .b1.boss { border-color: var(--red); color: #ffd0c8; }
.banner .b2 { margin-top: 8px; font-size: 10px; color: #fff; text-shadow: 2px 2px 0 #000; animation: banner 1.8s ease-in-out forwards; }
@keyframes banner { 0% { transform: scaleX(0); opacity: 0; } 12% { transform: scaleX(1.05); opacity: 1; } 18% { transform: scaleX(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.confirm { position: absolute; z-index: 8; transform: translate(-50%, -100%); padding: 0 12px; min-height: 36px; border-radius: 18px; font-family: var(--px); font-size: 9px; color: #fff; background: var(--green); box-shadow: inset 0 -3px 0 var(--green-d), 0 3px 6px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.confirm.bad { background: #777; box-shadow: inset 0 -3px 0 #555; }
.enemy-tip { position: absolute; z-index: 8; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(92%, 380px); padding: 8px 10px; display: flex; align-items: center; gap: 8px; animation: toastin 0.15s; }
.enemy-tip img { width: 48px; height: 48px; }
.enemy-tip .t { flex: 1; font-size: 14px; line-height: 1.25; }
.enemy-tip .t b { font-size: 16px; }

.hud-bottom { background: var(--hud); border-top: 3px solid #0c1122; padding: 6px 6px calc(6px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.party-row { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 25px) / 6); gap: 5px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.party-row::-webkit-scrollbar { display: none; }
.party-row > * { scroll-snap-align: start; }
.pcard { position: relative; height: 68px; border-radius: 10px; background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.12); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 3px; overflow: hidden; }
.pcard img { position: absolute; top: -4px; left: 50%; transform: translateX(-50%); width: 54px; height: 54px; }
.pcard .cost { position: relative; font-family: var(--px); font-size: 8px; color: #ffe070; text-shadow: 1px 1px 0 #000; }
.pcard .lv { position: absolute; top: 3px; right: 4px; font-family: var(--px); font-size: 8px; color: #fff; text-shadow: 1px 1px 0 #000; }
.pcard .tbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.pcard.sel { border-color: #7dff8c; background: rgba(125,255,140,0.18); transform: translateY(-3px); }
.pcard.poor .cost { color: #ff7a7a; }
.pcard.poor img { filter: grayscale(0.7) brightness(0.8); }
.pcard.dep { background: rgba(255,255,255,0.03); border-style: dashed; }
.pcard.dep img { opacity: 0.35; }
.pcard.dep .cost { color: #8fd; }
.pcard.empty { border-style: dashed; background: transparent; }
.action-row { display: flex; gap: 6px; align-items: stretch; }
.ballbtn { position: relative; width: 62px; min-height: 48px; border-radius: 10px; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; gap: 2px; font-family: var(--px); font-size: 9px; border: 2px solid transparent; }
.ballbtn img { width: 30px; height: 30px; }
.ballbtn.on { border-color: #ff6a6a; background: rgba(255,90,90,0.25); animation: pulse2 0.8s infinite; }
@keyframes pulse2 { 50% { background: rgba(255,90,90,0.45); } }
.ballbtn .cyc { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 10px; display: grid; place-items: center; box-shadow: 0 2px 0 rgba(0,0,0,0.4); }
.wave-prev { flex: 1; min-width: 0; border-radius: 10px; background: rgba(255,255,255,0.06); display: flex; align-items: center; gap: 2px; padding: 0 6px; overflow: hidden; }
.wave-prev .lbl { font-family: var(--px); font-size: 7px; color: var(--muted); margin-right: 4px; line-height: 1.4; }
.wave-prev img { width: 36px; height: 36px; flex-shrink: 0; }
.wave-prev .cnt { font-family: var(--px); font-size: 8px; color: #cfd6f0; margin-left: 2px; }
.wavebtn { min-width: 108px; border-radius: 10px; font-family: var(--px); font-size: 10px; color: #fff; background: var(--green); box-shadow: inset 0 -4px 0 var(--green-d); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 8px; }
.wavebtn small { font-size: 7px; color: #e8ffd8; }
.wavebtn.start { animation: pulse3 1s ease-in-out infinite; }
@keyframes pulse3 { 50% { transform: scale(1.05); } }
.wavebtn.off { background: #4a5068; box-shadow: inset 0 -4px 0 #343850; color: #aab; }

.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 9; padding: 10px 12px calc(10px + var(--safe-b)); border-radius: 16px 16px 0 0; border-bottom: 0; transform: translateY(105%); transition: transform 0.18s ease-out; }
.sheet.open { transform: none; }
.sheet .top { display: flex; gap: 10px; align-items: center; }
.sheet .top img { width: 64px; height: 64px; margin: -6px 0; }
.sheet .top .nm { font-size: 19px; font-weight: 700; line-height: 1.05; }
.sheet .top .sub { display: flex; gap: 6px; align-items: center; margin-top: 3px; }
.sheet .xp { margin-top: 6px; }
.sheet .moves { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mchip { padding: 7px 9px; border-radius: 8px; font-size: 14px; background: var(--paper2); border: 2px solid transparent; display: flex; align-items: center; gap: 5px; }
.mchip.on { border-color: var(--ink); background: #fff; }
.mchip .dot { width: 9px; height: 9px; border-radius: 50%; }
.sheet .stats-line { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #4a5068; margin-top: 7px; }
.sheet .btns { display: flex; gap: 8px; margin-top: 10px; }
.sheet .btns .btn { flex: 1; font-size: 9px; padding: 0 6px; }

.loading { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: #0d1226; font-family: var(--px); font-size: 11px; }
.loading .spin { width: 40px; height: 40px; margin: 0 auto 14px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-stars { display: flex; justify-content: center; gap: 10px; margin: 6px 0 12px; font-size: 44px; }
.result-stars span { color: #c8c2ae; transform: scale(0); animation: starpop 0.35s ease-out forwards; }
.result-stars span.on { color: var(--gold); text-shadow: 0 3px 0 var(--gold-d); }
@keyframes starpop { 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.reward-line { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; background: var(--paper2); border-radius: 8px; margin-bottom: 6px; font-size: 15px; }
.lvup { display: flex; align-items: center; gap: 6px; font-size: 14px; padding: 4px 6px; border-radius: 8px; background: var(--paper2); margin-bottom: 5px; }
.lvup img { width: 40px; height: 40px; margin: -4px 0; }
.lvup .pxnum { font-size: 8px; margin-left: auto; }
.big-badge { width: 70px; height: 70px; margin: 8px auto; border-radius: 50%; box-shadow: inset 0 -6px 0 rgba(0,0,0,0.25), 0 0 0 4px #fff, 0 0 0 6px var(--ink); animation: starpop 0.5s ease-out; }

@media (max-height: 700px) {
  .pcard { height: 58px; }
  .pcard img { width: 46px; height: 46px; top: -4px; }
  .ballbtn, .wavebtn { min-height: 42px; }
}

/* ---------- Tower panel: AUTO moves, effectiveness, evolution ---------- */
.mchip.auto { font-family: var(--px); font-size: 8px; padding: 7px 8px; background: #e6e0f8; color: #4a3a8a; }
.mchip.auto.on { background: #6a4ad8; color: #fff; border-color: #3a2a90; }
.mchip.used { border-color: #8a7ad8; background: #f2eeff; }
.mchip .eff { margin-left: 2px; font-family: var(--px); font-size: 7px; padding: 2px 3px; border-radius: 3px; color: #fff; }
.mchip .eff.sup { background: #2f9a48; }
.mchip .eff.weak { background: #8a8aa0; }
.mchip .eff.none { background: #c03030; }
.evo-row { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.btn.evolve { justify-content: flex-start; gap: 4px; min-height: 42px; font-size: 9px; padding: 0 10px 0 4px; background: linear-gradient(90deg, #f6c33b, #ff9a3b); color: #3a2000; text-shadow: none; box-shadow: inset 0 -4px 0 #b7701a, 0 2px 0 rgba(0,0,0,0.4); animation: evoglow 1.2s ease-in-out infinite; }
.btn.evolve img { width: 40px; height: 40px; margin: -4px 0; }
.btn.evolve.off { animation: none; }
@keyframes evoglow { 50% { box-shadow: inset 0 -4px 0 #b7701a, 0 0 12px 2px rgba(255,210,80,0.8); } }
.evo-hint { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #5a6078; background: var(--paper2); border-radius: 8px; padding: 2px 8px 2px 2px; }
.evo-hint img { width: 34px; height: 34px; filter: grayscale(0.6); opacity: 0.8; }
.pcard .evob { position: absolute; top: 2px; left: 3px; font-family: var(--px); font-size: 6px; padding: 2px 3px; border-radius: 3px; background: #f6c33b; color: #3a2000; animation: blink 0.9s steps(2) infinite; }
.stats-line .types { vertical-align: middle; }

/* ---------- Bosses, party growth, catching ---------- */
.lvl.mini .node { background: #e8822a; box-shadow: inset 0 -4px 0 #a8541a, 0 3px 0 rgba(0,0,0,0.35); }
.slot-tag { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-family: var(--px); font-size: 6px; padding: 2px 3px; border-radius: 3px; background: var(--green); color: #fff; }
.lvls { padding-bottom: 18px; }
.enemy-chip { position: relative; }
.enemy-chip .tier-tag { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); font-family: var(--px); font-size: 6px; padding: 2px 3px; border-radius: 3px; color: #fff; background: #e8822a; }
.enemy-chip.mega .tier-tag { background: var(--red); }
.enemy-chip.mini { background: #ffe6cc; outline: 2px solid #e8822a; }
.pslot.locked { border-style: dashed; opacity: 0.55; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 16px; }
.pslot.locked .lv { position: static; font-size: 8px; margin-top: 2px; }
.pslot .alpha, .card .alpha { position: absolute; top: 2px; left: 3px; font-weight: 700; font-size: 13px; color: #e8a800; text-shadow: 0 1px 0 #000; }
.reward-line.slot { background: #d8f5d0; font-weight: 700; }
.catchbtn { align-self: center; flex-shrink: 0; gap: 4px; font-size: 8px; }
.enemy-tip { pointer-events: auto; }

.bossbar { position: absolute; z-index: 7; top: 6px; left: 8px; right: 8px; padding: 6px 8px 7px; border-radius: 10px; background: rgba(20, 16, 30, 0.85); border: 2px solid #e8822a; color: #fff; pointer-events: none; animation: toastin 0.25s ease-out; }
.bossbar.mega { border-color: #ff3b3b; box-shadow: 0 0 12px rgba(255, 50, 50, 0.45); }
.bossbar.enraged { animation: enrage 0.6s ease-in-out infinite; }
@keyframes enrage { 50% { box-shadow: 0 0 22px rgba(255, 40, 40, 0.9); } }
.bb-top { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 4px; }
.bb-top .pxnum { font-size: 8px; color: #ffd8a0; }
.bb-tag { margin-left: auto; font-family: var(--px); font-size: 7px; color: #ffb070; }
.bb-track { position: relative; height: 9px; border-radius: 5px; background: #3a2a2a; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.bb-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff9a3b, #ffd23b); transition: width 0.15s linear; }
.bossbar.mega .bb-fill { background: linear-gradient(90deg, #ff2f4f, #ff8a3b); }
.bb-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.7); }
.stage.mega-in::after { content: ''; position: absolute; inset: 0; z-index: 6; pointer-events: none; box-shadow: inset 0 0 80px 30px rgba(255, 20, 20, 0.75); animation: megain 2.2s ease-out forwards; }
@keyframes megain { 0%, 30%, 60% { opacity: 1; } 15%, 45% { opacity: 0.35; } 100% { opacity: 0; } }

/* ---------- Guided tutorial ---------- */
.tut { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.tut.dim { background: rgba(6, 10, 22, 0.45); }
.tut-spot { position: absolute; border: 3px solid #ffd84a; box-shadow: 0 0 0 9999px rgba(6, 10, 22, 0.5), 0 0 18px 4px rgba(255, 216, 74, 0.7); transition: left 0.15s, top 0.15s, width 0.15s, height 0.15s; animation: tutpulse 1.2s ease-in-out infinite; }
@keyframes tutpulse { 50% { border-color: #ffffff; box-shadow: 0 0 0 9999px rgba(6, 10, 22, 0.5), 0 0 28px 8px rgba(255, 216, 74, 0.9); } }
.tut-finger { position: absolute; font-size: 32px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.6)); animation: tutpoke 0.8s ease-in-out infinite; }
@keyframes tutpoke { 50% { transform: translateY(-6px); } }
.tut-box { position: absolute; left: 10px; right: 10px; max-width: 500px; margin: 0 auto; padding: 10px 12px 12px; pointer-events: auto; animation: toastin 0.2s ease-out; }
.tut-head { display: flex; align-items: center; gap: 6px; font-family: var(--px); font-size: 8px; color: var(--red-d); margin-bottom: 6px; }
.tut-ball { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(#e83030 0 45%, #202020 45% 55%, #f8f8f8 55%); box-shadow: 0 0 0 1.5px #202020; }
.tut-skip { margin-left: auto; font-family: var(--tx); font-size: 12px; color: #6a7090; text-decoration: underline; padding: 4px; }
.tut-text { font-size: 16px; line-height: 1.3; color: var(--ink); }
.tut-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---------- Sharing ---------- */
.moment { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; margin: 0 0 12px; border-radius: 12px; background: linear-gradient(135deg, #fff6d0, #ffd96a); box-shadow: inset 0 0 0 2px var(--gold-d), 0 3px 0 rgba(0,0,0,0.2); color: var(--ink); text-align: left; animation: pop 0.35s ease-out 0.6s backwards; }
.mt-thumb { width: 84px; height: 105px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: #1d2a4c; box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.mt-thumb canvas { display: block; width: 100%; height: 100%; }
.mt-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.mt-k { font-family: var(--px); font-size: 7px; color: var(--gold-d); }
.mt-t { font-family: var(--px); font-size: 10px; line-height: 1.45; }
.share-prev { display: grid; place-items: center; min-height: 200px; margin-top: 4px; }
.share-prev.busy { opacity: 0.55; }
.share-card { display: block; width: auto; height: auto; max-width: 100%; max-height: 40vh; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,0.35); image-rendering: auto; }
.share-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 8px; font-family: var(--px); font-size: 9px; }
.share-nav .btn { background: #6a7090; min-width: 44px; }
.share-lbl { display: block; font-family: var(--px); font-size: 7px; color: #6a7090; margin: 12px 0 5px; text-transform: uppercase; }
.share-name { width: 100%; height: 42px; padding: 0 12px; border: 2px solid var(--frame2); border-radius: 10px; background: #fff; color: var(--ink); font-family: var(--tx); font-size: 17px; user-select: text; -webkit-user-select: text; }
.share-name:focus { outline: none; border-color: var(--blue); }
.share-main { width: 100%; margin-top: 12px; }
.share-bonus { text-align: center; font-size: 13px; color: var(--gold-d); margin: 6px 0 2px; }
.share-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.share-row .btn { flex-direction: column; gap: 4px; min-height: 60px; padding: 0 2px; font-size: 6px; letter-spacing: 0; }
.share-row .ic { font-size: 20px; line-height: 1; }
.btn.wa { background: #25d366; box-shadow: inset 0 -4px 0 #128c4a, 0 2px 0 rgba(0,0,0,0.4); }
.btn.ig { background: linear-gradient(45deg, #f09433, #dc2743 55%, #bc1888); box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 2px 0 rgba(0,0,0,0.4); }
.btn.dk { background: #6a7090; }
.tshare { width: 48px; height: 48px; flex-shrink: 0; border-radius: 10px; background: var(--blue); box-shadow: inset 0 -4px 0 var(--blue-d); display: grid; place-items: center; font-size: 22px; }
.challenge { position: relative; display: flex; align-items: center; gap: 10px; width: calc(100% - 40px); max-width: 360px; margin-top: 20px; padding: 8px 12px; text-align: left; font-size: 15px; line-height: 1.3; animation: pop 0.3s ease-out; }
.challenge img { width: 64px; height: 64px; flex-shrink: 0; margin: -6px 0; }
.challenge b { display: block; font-family: var(--px); font-size: 9px; line-height: 1.5; color: var(--red-d); margin-bottom: 3px; }

/* Moving a save off the old address (js/migrate.js) */
.moved { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; text-align: left; font-size: 14px; line-height: 1.3; background: #fff3c4; border-color: var(--gold-d); }
.moved > div { flex: 1; min-width: 0; }
.moved b { display: block; font-family: var(--px); font-size: 9px; line-height: 1.5; color: var(--red-d); margin-bottom: 2px; }
.moved .btn { flex-shrink: 0; }
#title > .moved { width: calc(100% - 40px); max-width: 360px; margin-top: 20px; animation: pop 0.3s ease-out; }
#hub > .moved { margin: 0 10px 6px; }
.move-pick { display: flex; align-items: center; gap: 8px; margin: 8px 0; padding: 6px 10px 6px 4px; }
.move-pick img { width: 56px; height: 56px; flex-shrink: 0; margin: -4px 0; }
.move-pick .mp-txt { flex: 1; min-width: 0; }
.move-pick b { display: block; font-family: var(--px); font-size: 9px; line-height: 1.5; margin-bottom: 4px; }
.move-pick .mp-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--px); font-size: 10px; }

/* ---------- Story ---------- */
.dialog.story { cursor: pointer; min-height: 132px; }
.story-who { font-family: var(--px); font-size: 8px; color: var(--red-d); margin-bottom: 6px; }
.story-more { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--red-d); font-family: var(--px); font-size: 10px; }
.story-more span { animation: blink 0.9s steps(2) infinite; }
.story-skip { font-family: var(--tx); font-size: 13px; color: #6a7090; text-decoration: underline; padding: 4px 0; }
#starter .table.locked { opacity: 0.35; filter: grayscale(0.6); pointer-events: none; }
#starter .table { transition: opacity 0.3s, filter 0.3s; }
.clim { display: inline-flex; align-items: center; gap: 4px; margin: 8px 12px 0; padding: 4px 8px; border-radius: 8px; font-family: var(--px); font-size: 7px; color: #ffe2c0; background: rgba(160,70,30,0.55); }
.clim.ok { color: #e6ffe0; background: rgba(50,140,70,0.65); }
.clim .muted { font-family: var(--tx); font-size: 11px; color: rgba(255,255,255,0.65); }
.region h3 { cursor: pointer; }
.story-card { text-align: center; }
.story-card .clim { margin: 2px 0 8px; }
.story-card h3 { margin: 4px 0 6px; font-family: var(--px); font-size: 12px; line-height: 1.4; color: var(--ink); }
.story-card p { margin: 8px 2px; font-size: 16px; line-height: 1.35; }
.story-cast { display: flex; justify-content: center; gap: 4px; margin: 4px 0; }
.story-cast img { width: 64px; height: 64px; }
.story-cast img.sil { filter: brightness(0) opacity(0.7); }
.story-cast.ending img { width: 72px; height: 72px; animation: bob 1.4s ease-in-out infinite; }
.end-line { opacity: 0; animation: fadeUp 0.9s ease-out forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.story-line.out { opacity: 0; transition: opacity 0.6s; }
.story-line { position: absolute; top: calc(38% + 74px); left: 10px; right: 10px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 4px; font-size: 14px; line-height: 1.3; animation: pop 0.3s ease-out; cursor: pointer; }
.story-line img { width: 52px; height: 52px; flex-shrink: 0; margin: -4px 0; }
.story-line b { display: block; font-family: var(--px); font-size: 8px; color: var(--red-d); margin-bottom: 3px; }
.reward-line.heal { background: #d8f5d0; font-weight: 700; color: #2f6b3a; }

/* ---------- Giovanni's Challenge ---------- */
.gc-card { display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0; padding: 8px 12px; border-radius: 12px; text-align: left; color: #fff; background: linear-gradient(120deg, #3a1020, #7a1d2c 60%, #b8402c); box-shadow: inset 0 0 0 2px rgba(255,200,120,0.5), 0 3px 0 rgba(0,0,0,0.35); }
.gc-card.locked { padding: 4px 12px; filter: grayscale(0.8) brightness(0.8); }
.gc-card.locked .gc-sprites img { width: 36px; height: 36px; }
.gc-card.locked .gc-txt span { font-size: 13px; }
.gc-sprites { display: flex; flex-shrink: 0; }
.gc-sprites img { width: 46px; height: 46px; margin: -4px -8px -4px 0; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.5)); }
.gc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gc-txt b { font-family: var(--px); font-size: 9px; color: #ffd27a; }
.gc-txt span { font-size: 14px; line-height: 1.2; }
.gc-txt small { font-size: 11px; color: rgba(255,255,255,0.7); }
.gc-go { font-size: 22px; }
.gc-sheet .modal { max-height: 94%; }
.gc-intro { margin: 2px 0 8px; font-size: 15px; line-height: 1.35; }
.gc-meta { display: flex; justify-content: space-between; font-size: 13px; color: #4a5068; }
.gc-foes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gc-foe { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 6px; border-radius: 8px; background: var(--paper2); font-size: 12px; }
.gc-foe.ace { background: #f3d6cf; box-shadow: inset 0 0 0 2px #c0504a; }
.gc-foe img { width: 52px; height: 52px; margin: -6px 0 -4px; }
.gc-foe .w { position: absolute; top: 3px; left: 5px; font-family: var(--px); font-size: 7px; color: #a8261e; }
.gc-pool { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.gc-mon { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 1px 5px; border-radius: 8px; background: var(--paper2); font-size: 10px; color: var(--ink); }
.gc-mon.on { background: #d8f5d0; box-shadow: inset 0 0 0 2px var(--green); }
.gc-mon img { width: 48px; height: 48px; margin: -4px 0 -2px; }
.gc-mon .nm { font-size: 11px; line-height: 1.1; text-align: center; }
.gc-mon .types { transform: scale(0.85); }
.gc-mon .cost { font-family: var(--px); font-size: 6px; color: #6a5a00; }
.gc-mon .n { position: absolute; top: 2px; right: 3px; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; font-family: var(--px); font-size: 7px; color: #fff; background: var(--green); }
.gc-mon .adv { position: absolute; top: 3px; left: 3px; font-family: var(--px); font-size: 7px; padding: 2px 3px; border-radius: 3px; color: #fff; background: var(--red); }
.gc-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; margin-bottom: 5px; border-radius: 8px; background: var(--paper2); }
.gc-row img { width: 44px; height: 44px; margin: -4px 0; }
.gc-moves { flex: 1; min-width: 0; font-size: 13px; }
.gc-mv { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.gc-mv .type { font-size: 6px; }
.gc-pick { width: 100%; text-align: left; }
.gc-pick.on { background: #d8f5d0; }
.gc-pick .chk { width: 16px; font-weight: 700; color: var(--green-d); }
.gc-pick .eff { margin-left: auto; font-family: var(--px); font-size: 7px; padding: 2px 4px; border-radius: 3px; color: #fff; background: var(--red); }
.gc-actions { display: flex; gap: 8px; margin-top: 12px; }
.gc-actions .btn { flex: 1; }
.gc-done, .gc-result { text-align: center; }
.gc-score { font-family: var(--px); font-size: 26px; color: #a8261e; margin: 6px 0 4px; }
.gc-sub { margin-bottom: 10px; font-size: 15px; }
.gc-result .reward-line span:nth-child(2) { margin-left: auto; margin-right: 12px; font-size: 13px; }
.gc-status { font-weight: 700; margin-top: 8px; }
.gc-tabs { display: flex; gap: 6px; margin: 4px 0 8px; }
.gc-count { font-size: 13px; color: #4a5068; margin-bottom: 6px; }
.gc-lb { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 5px; border-radius: 8px; background: var(--paper2); }
.gc-lb.you { background: #fff1c4; box-shadow: inset 0 0 0 2px var(--gold-d); }
.gc-lb .rk { width: 34px; text-align: center; font-family: var(--px); font-size: 10px; }
.gc-lb .who { flex: 1; min-width: 0; }
.gc-lb .who b { display: block; font-size: 14px; }
.gc-lb .tm { display: flex; margin-top: 2px; }
.gc-lb .tm img { width: 26px; height: 26px; margin: -3px -2px; }
.gc-lb .sc { text-align: right; }
.gc-lb .sc b { display: block; font-family: var(--px); font-size: 10px; }
.gc-lb .sc small { font-size: 11px; color: #4a5068; }
.gc-name { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 2px; padding: 8px 10px; border-radius: 10px; background: var(--paper2); }
.gc-name small { display: block; font-size: 12px; color: #6a7090; }
.gc-name b { font-size: 17px; }
.gc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gc-chips .btn { font-family: var(--tx); font-size: 14px; letter-spacing: 0; }
.share-hint { min-height: 18px; margin-top: 4px; font-size: 13px; color: var(--red-d); }
.share-hint.ok { color: var(--green-d); }

/* ---------- Big screens: laptops, desktops and landscape tablets ---------- */
/* Hidden on phones; shown below on big screens */
.pcard .nm, .pcard .key, .keys-help { display: none; }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  /* Title: the sunset scene spans the whole window */
  #title { max-width: none; }
  .logo .l1 { font-size: clamp(36px, 5.2vh, 54px); }
  .logo .l2 { font-size: clamp(54px, 9vh, 96px); }
  .logo .l3 { font-size: clamp(10px, 1.4vh, 14px); }
  .tap { font-size: 14px; }
  .credit { font-size: 12px; }
  #starter { max-width: 780px; }

  /* Hub: wider, with the regions in two columns */
  #hub { max-width: 1060px; }
  .hub-content { padding: 4px 16px 20px; }
  .hub-content.tab-map { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: max-content; column-gap: 16px; align-content: start; }
  .hub-content.tab-map > :not(.region) { grid-column: 1 / -1; }
  .hub-content.tab-map .region { margin: 6px 0 10px; }
  .hub-content.tab-mart, .hub-content.tab-opts { width: 100%; max-width: 720px; margin: 0 auto; }

  /* Windows open in the middle instead of sliding up from the bottom */
  .modal-bg { align-items: center; }
  .modal { width: calc(100% - 28px); max-width: 560px; border-radius: 14px; border-bottom: 3px solid var(--frame); padding-bottom: 0; }

  /* Battle: the map gets the full height and the HUD moves into a side panel */
  #battle { max-width: calc(100vh * 8 / 13 + 340px); max-width: calc(100dvh * 8 / 13 + 340px); display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "stage top" "stage side"; box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  #battle > .stage { grid-area: stage; }
  #battle > .hud-top { grid-area: top; padding-top: 10px; padding-bottom: 10px; border-left: 3px solid #0c1122; }
  #battle > .hud-bottom { grid-area: side; min-height: 0; overflow-y: auto; gap: 12px; padding: 12px 10px calc(12px + var(--safe-b)); border-top: 0; border-left: 3px solid #0c1122; }
  #battle .party-row { grid-auto-flow: row; grid-template-columns: 1fr 1fr; grid-auto-columns: auto; gap: 8px; overflow: visible; }
  #battle .pcard { height: 96px; padding-bottom: 6px; }
  #battle .pcard img { top: -2px; width: 68px; height: 68px; }
  #battle .pcard .lv { top: 5px; right: 6px; font-size: 8px; }
  #battle .pcard .nm { display: block; position: relative; font-size: 14px; line-height: 1.1; color: #fff; text-shadow: 1px 1px 0 #000; max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #battle .pcard.sel { transform: none; }
  /* START and the ball stay in sight in a short window (a laptop with toolbars, or the game framed on another
     site, where the frame can be 520px tall): the party and key list scroll under them instead. */
  #battle .action-row { margin-top: auto; position: sticky; bottom: calc(-12px - var(--safe-b)); z-index: 1; padding: 6px 0 calc(12px + var(--safe-b)); margin-bottom: calc(-12px - var(--safe-b)); background: #13192f; /* --hud over the black #battle, solid so nothing shows through */ box-shadow: 0 -8px 8px -6px rgba(0,0,0,0.5); }
  #battle .wavebtn { min-height: 56px; }
  #battle .sheet { left: auto; width: 340px; }
  #battle .enemy-tip { bottom: 16px; }
}
/* Hotkeys and hover feedback, only where there's a mouse */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) and (hover: hover) and (pointer: fine) {
  #battle .pcard .key { display: block; position: absolute; top: 5px; left: 6px; min-width: 15px; padding: 2px 3px 1px; border-radius: 4px; background: rgba(0,0,0,0.45); font-family: var(--px); font-size: 7px; line-height: 1.2; color: #dfe4ff; text-align: center; }
  .keys-help { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,0.05); font-size: 13px; color: #c8cfe8; }
  .keys-help > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .keys-help kbd { min-width: 74px; text-align: center; }
  .keys-help span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  kbd { flex-shrink: 0; padding: 3px 5px 2px; border-radius: 4px; background: #e8e4d4; color: #22283c; font-family: var(--px); font-size: 7px; box-shadow: inset 0 -2px 0 #a8a290; }
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover, .wavebtn:hover, .ballbtn:hover, .daily:hover { filter: brightness(1.1); }
  .pcard:not(.empty):hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.16); }
  .lvl:not(.locked):hover .node { filter: brightness(1.15); transform: translateY(-2px); }
  .nav button:hover { color: #fff; }
  .mchip:hover, .xbtn:hover { filter: brightness(0.95); }
}

/* "A new version is ready" bar (js/update.js) */
.update-bar { position: fixed; z-index: 70; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; margin: 0 auto; width: fit-content; max-width: 460px; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 24px; background: var(--paper); color: var(--ink); border: 2px solid var(--frame); box-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 6px 18px rgba(0,0,0,0.3); font-size: 14px; line-height: 1.2; animation: updin 0.25s ease-out; }
@keyframes updin { from { opacity: 0; margin-top: -12px; } }
.update-go { flex-shrink: 0; padding: 8px 12px 7px; border-radius: 16px; font-family: var(--px); font-size: 9px; color: #fff; background: var(--green); box-shadow: inset 0 -3px 0 var(--green-d); }
.update-x { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--paper2); font-family: var(--px); font-size: 9px; }

/* Nudge toward the party when START is pressed with nobody deployed (ui.js waveTap) */
.party-row.nudge .pcard:not(.empty):not(.dep) { border-color: #ffe070; animation: nudge 0.45s ease-in-out 3; }
@keyframes nudge { 50% { transform: translateY(-7px); box-shadow: 0 0 0 3px rgba(255,224,112,0.45); } }

/* ---------- Reasons to come back (js/goals.js) ---------- */
.goal-chip { margin: 4px 0; padding: 6px 12px; border-radius: 10px; background: #fff3c4; color: var(--ink); box-shadow: inset 0 0 0 2px var(--gold-d); text-align: left; }
.goal-chip .gk { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--px); font-size: 7px; color: var(--gold-d); margin-bottom: 3px; }
.goal-chip .ga { color: #7a5a10; }
.goal-chip .gt { font-size: 13px; line-height: 1.25; }
.modal .goal-chip { margin: 10px 0 2px; }
.sighting { display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0; padding: 6px 12px 6px 6px; text-align: left; background: #fffbe6; border-color: var(--gold-d); }
.sighting img { width: 52px; height: 52px; flex: none; animation: bob 1.4s ease-in-out infinite; }
.sighting .st { display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.25; }
.sighting b { font-family: var(--px); font-size: 8px; color: var(--gold-d); }
.sighting.done { background: var(--paper); }
.sighting.done img { animation: none; }
.sighting.done b { color: var(--green-d); }
.sight-tag { position: absolute; top: -9px; left: -4px; font-size: 14px; animation: twinkle 1.2s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(1.3); opacity: 0.7; } }
.enemy-chip.rare { background: #fff3c4; outline: 2px solid var(--gold-d); }
.enemy-chip.rare .tier-tag { background: var(--gold-d); }
.friend-run { display: flex; align-items: center; gap: 8px; margin: 4px 0; padding: 8px 6px 8px 12px; text-align: left; }
.friend-run .ft { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.25; }
.friend-run b { font-family: var(--px); font-size: 8px; color: var(--red-d); }
.friend-run .fl { font-size: 12px; color: var(--muted); max-width: 90px; text-align: right; }
.friend-run .x, .install-card .x { flex: none; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.reward-line.friend { background: #ffe0dc; font-weight: 700; color: var(--red-d); }
.reward-line.friend.miss { font-weight: 400; }
.kanto-meter.map { grid-column: 1 / -1; font-family: var(--tx); font-size: 13px; color: #2f6b3a; }
.kanto-meter.title { margin-top: 14px; padding: 0 16px; font-size: 13px; color: #fff; text-align: center; text-shadow: 0 1px 2px #000; }
#title.intro .kanto-meter { animation: titleIn 0.6s ease-out 1.1s both; }
.install-card { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; padding: 8px 6px 8px 10px; border-radius: 10px; background: #dff3e2; box-shadow: inset 0 0 0 2px var(--green-d); color: var(--ink); }
.install-card .ic { font-size: 26px; }
.install-card .it { flex: 1; display: flex; flex-direction: column; font-size: 13px; line-height: 1.25; }
.install-card b { font-size: 15px; }
.install-steps { margin: 0; padding-left: 22px; font-size: 16px; line-height: 1.45; }
.install-steps li { margin-bottom: 8px; }
.challenge .ch-note { margin-top: 2px; font-size: 13px; color: var(--muted); }
/* Daily gift calendar: days 1-4, then 5, 6 and a double-width day 7 */
.gift { text-align: center; }
.gift-k { margin-bottom: 10px; font-family: var(--px); font-size: 9px; color: var(--gold-d); }
.gift-cal { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gtile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border-radius: 8px; background: var(--paper2); }
.gtile.big { grid-column: span 2; background: #efe3ff; }
.gtile.cur { background: #fff3c4; box-shadow: inset 0 0 0 3px var(--gold); animation: wiggle 1.6s ease-in-out infinite; }
.gtile.done::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; border-radius: 8px; font-size: 26px; color: var(--green-d); background: rgba(216, 245, 208, 0.8); }
.gtile.pop { animation: pop 0.4s ease-out; }
.gtile img, .gtile .gcoin, .gtile .gq { width: 32px; height: 32px; }
.gtile .gcoin { border-radius: 50%; transform: scale(0.8); background: radial-gradient(circle at 35% 35%, #fff6b0 0 20%, #f6c33b 25% 60%, #b7861a 65%); box-shadow: 0 0 0 2px #6b4c00; }
.gtile .gq { display: grid; place-items: center; font-family: var(--px); font-size: 18px; color: #6a3fb0; }
.gtile .gd { font-family: var(--px); font-size: 6px; color: #6a7090; }
.gtile .gv { font-size: 13px; font-weight: 700; }
.gift-info { margin: 12px 0 2px; font-size: 16px; line-height: 1.35; }

/* ---------- Player feedback, October 2026: move details, slow speeds, live catch panel ---------- */
.hud-top .ibtn.speed { width: auto; min-width: 38px; padding: 0 6px; }
.hud-top .ibtn.slow { background: rgba(120, 190, 255, 0.3); }
.sheet .move-info { margin-top: 6px; font-size: 13px; line-height: 1.35; color: #3a4060; }
.sheet .move-info b { margin: 0 4px; color: var(--ink); }
.sheet .move-info .type, .sheet .move-list .type { vertical-align: 1px; }
.sheet .mi-all { margin-left: 4px; padding: 2px 6px; border-radius: 6px; background: #e6e0f8; color: #4a3a8a; font-family: var(--px); font-size: 7px; vertical-align: 1px; }
.sheet .move-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: var(--paper2); font-size: 12px; line-height: 1.35; color: #3a4060; }
.sheet .move-list b { margin: 0 4px; color: var(--ink); }
.mv { flex-wrap: wrap; }
.mv-d { flex-basis: 100%; font-size: 12px; line-height: 1.3; color: #5a6078; }
.enemy-tip { align-items: flex-start; padding-right: 30px; }
.enemy-tip .tip-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 7px; color: #6a7090; font-size: 13px; }
.enemy-tip .hp { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 2px 0 3px; white-space: nowrap; }
.enemy-tip .hpb { flex: 0 0 52px; height: 7px; border-radius: 4px; background: #505058; overflow: hidden; }
.enemy-tip .hpb i { display: block; height: 100%; background: #48d058; }
.enemy-tip .st { font-size: 12px; margin-top: 3px; color: #5a6078; }
.enemy-tip .note { font-size: 12px; margin-top: 3px; color: #2f6b3a; font-weight: 700; }
.enemy-tip .note.no { color: #a8261e; }
.enemy-tip .tip-catch { display: flex; flex-direction: column; align-items: stretch; gap: 4px; align-self: center; }
.enemy-tip .ballsw { padding: 3px 6px; border-radius: 7px; background: var(--paper2); font-size: 12px; color: #4a5068; }
.enemy-tip.busy .catchbtn { filter: grayscale(0.6); }
.bb-catch { font-family: var(--px); font-size: 6px; padding: 2px 4px; border-radius: 3px; background: #2f8a48; color: #fff; }
.bb-catch.no { background: #6a6a78; }
.enemy-chip .nocatch { margin-top: 2px; font-family: var(--px); font-size: 5px; color: #a8261e; }
.guide { padding: 4px 14px 10px; font-size: 15px; line-height: 1.4; }
.guide h4 { margin: 12px 0 4px; font-family: var(--px); font-size: 9px; line-height: 1.5; color: var(--blue-d); }
.guide p { margin: 0 0 6px; }
.modal .guide { border: 0; box-shadow: none; padding: 0 2px; background: none; }
/* Sorting the PC box (hub) and the pre-battle picker (modal) */
.sortbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 8px; }
.sortbar .sl { margin-right: 2px; font-family: var(--px); font-size: 7px; color: #9aa3c4; }
.sortbar .sb { padding: 6px 8px; border-radius: 7px; background: rgba(255, 255, 255, 0.12); color: #cfd6f0; font-family: var(--px); font-size: 7px; }
.sortbar .sb.on { background: var(--gold); color: #3a2a00; }
.modal .sortbar { margin: 6px 0; }
.modal .sortbar .sl { color: #6a7090; }
.modal .sortbar .sb { background: var(--paper2); color: #4a5068; }
.modal .sortbar .sb.on { background: var(--gold); color: #3a2a00; }
/* Options: support email */
.support { padding: 10px 14px; font-size: 15px; line-height: 1.4; }
.support p { margin: 0 0 10px; }
.support a.btn { display: flex; justify-content: center; width: 100%; text-decoration: none; font-size: 9px; }
.support .ver { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13px; color: #6a7090; }
/* Level labels (.pslot, .rm, .pcard .lv) use Press Start 2P at 8px, its native grid: at 6-7px a 6 read as a G. */
/* Map: next goal, habitats and the Kanto meter in one panel that opens on tap (ui.js journeyPanel) */
.journey { margin: 4px 0; overflow: hidden; }
.journey .jhead { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; text-align: left; font-size: 15px; color: var(--ink); }
.journey .js1 { flex: 1; font-weight: 700; }
.journey .js2 { color: #2f6b3a; font-weight: 700; }
.journey .jchev { color: #6a7090; transition: transform 0.15s; }
.journey.open .jchev { transform: rotate(180deg); }
.journey .jbody { display: none; padding: 0 12px 10px; border-top: 1px dashed #d8d2bc; }
.journey.open .jbody { display: block; }
.journey .jgoal { margin-top: 8px; font-size: 14px; line-height: 1.3; }
.journey .jgoal b, .journey .jhab b { display: block; margin-bottom: 3px; font-family: var(--px); font-size: 7px; color: var(--gold-d); }
.journey .jhab { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; margin-top: 10px; }
.journey .jhab b { margin: 0; color: #2f6b3a; }
.journey .jhab .jn { font-weight: 700; color: #2f6b3a; }
.journey .jhab .bar { grid-column: 1 / -1; height: 7px; border-radius: 4px; background: #d8d2bc; overflow: hidden; }
.journey .jhab .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4fb05a, #8bd86a); }
.journey .kanto-meter.map { margin-top: 8px; }
/* Shorter rare-sighting and friend-challenge rows */
.sighting { padding: 4px 10px 4px 4px; }
.sighting img { width: 40px; height: 40px; }
.sighting .st { gap: 2px; font-size: 13px; }
.friend-run { padding: 6px 6px 6px 12px; }
.friend-run .ft { gap: 2px; font-size: 13px; }
