:root {
  color-scheme: light;
  --ink: #182030;
  --muted: #607084;
  --panel: #fffaf0;
  --panel-2: #f3e7c6;
  --line: #2b3448;
  --soft: #eef5df;
  --accent: #d63c35;
  --accent-2: #2f71b8;
  --good: #18875c;
  --bad: #c93636;
  --gold: #d89b22;
  --screen: #dcebbd;
  --screen-ink: #203018;
  --shadow: 8px 8px 0 rgba(28, 32, 42, .25);
  --pixel-bg: #8dc7df;
}
:root.dark {
  color-scheme: dark;
  --ink: #edf4ff;
  --muted: #aebbd0;
  --panel: #1d2634;
  --panel-2: #121a27;
  --line: #d8e4f5;
  --soft: #263850;
  --accent: #f05c55;
  --accent-2: #78b8ff;
  --good: #62dba4;
  --bad: #ff7777;
  --gold: #ffd35c;
  --screen: #23361d;
  --screen-ink: #dff4bd;
  --shadow: 8px 8px 0 rgba(0, 0, 0, .45);
  --pixel-bg: #192333;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", Verdana, system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255,255,255,.34) 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(225deg, rgba(255,255,255,.22) 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(180deg, var(--pixel-bg), #f3d68b 74%, #72a35d 74%);
}
:root.dark body { background: linear-gradient(180deg, #151d2a, #222b3a 64%, #172817 64%); }
button { font: inherit; color: inherit; }
.app { min-height: 100vh; padding: 22px; display: flex; justify-content: center; }
.shell { width: min(1180px, 100%); display: grid; gap: 14px; }
.pixel-panel, .topbar, .hero, .battle, .leader, .event, .end, .drawer, .pokedex-modal {
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.topbar { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.icon-btn, .btn { border: 3px solid var(--line); background: var(--panel-2); min-height: 38px; padding: 7px 11px; font-weight: 900; cursor: pointer; border-radius: 4px; box-shadow: 3px 3px 0 rgba(0,0,0,.18); }
.icon-btn { width: 42px; padding: 0; font-size: 1.15rem; }
.btn:hover, .icon-btn:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(0,0,0,.22); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.blue { background: var(--accent-2); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; text-align: left; }
.logo { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: url("assets/ui/pokexpanse-icon.png") center / contain no-repeat; border: 0; flex: 0 0 auto; }
.logo::after { content: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.25rem, 2.2vw, 2rem); letter-spacing: 0; }
h2 { font-size: clamp(1.1rem, 2vw, 1.55rem); }
.sub, .hint { color: var(--muted); }
.status { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.pill { min-height: 33px; padding: 6px 9px; border: 2px solid var(--line); background: var(--soft); display: inline-flex; align-items: center; gap: 6px; font-weight: 900; border-radius: 4px; white-space: nowrap; }
.hero { padding: clamp(18px, 4vw, 34px); display: grid; gap: 22px; text-align: center; overflow: hidden; }
.starters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; perspective: 900px; }
.card, .poke-card, .event-option { border: 3px solid var(--line); background: var(--panel); border-radius: 5px; min-width: 0; }
.starter { min-height: 285px; padding: 14px; cursor: pointer; text-align: center; position: relative; overflow: hidden; animation: starterDrop .64s cubic-bezier(.2,.9,.2,1) both; }
.starter:nth-child(2) { animation-delay: .16s; }
.starter:nth-child(3) { animation-delay: .32s; }
.starter:hover { transform: translateY(-4px) rotate(-1deg); background: #fff3ca; }
:root.dark .starter:hover { background: #2a3850; }
.starter .poke-art { opacity: 0; transform: scale(.55); animation: revealMon .55s ease forwards .48s; }
.pokeball { width: 112px; height: 112px; margin: 5px auto 14px; border-radius: 50%; background: linear-gradient(#ef4444 0 47%, #222 47% 55%, #fff 55%); border: 5px solid #222; position: relative; animation: ballBounce 1.5s ease-in-out infinite; }
.pokeball::after { content: ""; position: absolute; inset: 34px; border-radius: 50%; background: #fff; border: 6px solid #222; }
.poke-art { width: 100%; max-height: 132px; object-fit: contain; display: block; image-rendering: auto; }
.type-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: center; margin-top: 8px; }
.type-img { width: 75px; height: 22px; object-fit: contain; image-rendering: auto; vertical-align: middle; }
.battle { display: grid; grid-template-columns: 250px 1fr; overflow: hidden; }
.partner { padding: 16px; border-right: 3px solid var(--line); background: var(--screen); color: var(--screen-ink); display: flex; flex-direction: column; gap: 13px; text-align: center; }
.partner img { height: 170px; }
.item-row, .actions, .stat-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.panel { padding: 17px; display: grid; gap: 13px; min-width: 0; text-align: center; }
.route { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.node { width: 34px; height: 34px; border: 3px solid var(--line); display: grid; place-items: center; background: var(--panel-2); font-weight: 900; }
.node.done { background: #9ee0b8; color: #102819; }
.node.now { background: #ffd35c; color: #392300; animation: pulseNode 1s steps(2) infinite; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.item-btn.active-item { background: #f3c84b; color: #312400; box-shadow: 0 0 0 3px rgba(243, 200, 75, .35), 3px 3px 0 rgba(0,0,0,.22); }
:root.dark .item-btn.active-item { background: #8c6a16; color: #fff5c8; }
.grid.safari-mode .poke-card { cursor: pointer; transform: none; }
.grid.safari-mode .poke-card:hover { transform: none; }
.grid.safari-mode:has(.poke-card:nth-child(-n+3):hover) .poke-card:nth-child(-n+3),
.grid.safari-mode:has(.poke-card:nth-child(n+4):nth-child(-n+6):hover) .poke-card:nth-child(n+4):nth-child(-n+6),
.grid.safari-mode:has(.poke-card:nth-child(n+7):hover) .poke-card:nth-child(n+7) {
  background: #fff0ad;
  box-shadow: inset 0 0 0 3px #e0a91b;
}
:root.dark .grid.safari-mode:has(.poke-card:nth-child(-n+3):hover) .poke-card:nth-child(-n+3),
:root.dark .grid.safari-mode:has(.poke-card:nth-child(n+4):nth-child(-n+6):hover) .poke-card:nth-child(n+4):nth-child(-n+6),
:root.dark .grid.safari-mode:has(.poke-card:nth-child(n+7):hover) .poke-card:nth-child(n+7) {
  background: #5b4614;
  box-shadow: inset 0 0 0 3px #f3c84b;
}
.poke-card.safari-locked { box-shadow: inset 0 0 0 3px #25a86f; cursor: default; }
.poke-card { min-height: 160px; padding: 9px; cursor: pointer; text-align: center; position: relative; transition: transform .12s ease, background .12s ease; }
.poke-card:hover { transform: translateY(-3px); background: #fff3ca; }
:root.dark .poke-card:hover { background: #293750; }
.poke-card.selected { background: #d8ecff; }
.poke-card.correct { background: #d9f7e7; }
.poke-card.wrong { background: #ffe0df; }
:root.dark .poke-card.selected { background: #1d4567; }
:root.dark .poke-card.correct { background: #164532; }
:root.dark .poke-card.wrong { background: #55212a; }
.poke-card.disabled { cursor: default; opacity: .5; }
.poke-card img { width: 100%; height: 82px; object-fit: contain; display: block; }
.name { font-weight: 950; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice { padding: 10px 12px; border: 3px solid var(--line); background: #fff1b8; color: #432d00; text-align: center; }
:root.dark .notice { background: #463915; color: #ffeaa0; }
.event, .leader, .end { padding: clamp(18px, 4vw, 32px); display: grid; gap: 18px; text-align: center; }
.event-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.event-option { padding: 14px; display: grid; gap: 8px; text-align: center; }
.leader-intro { min-height: 420px; display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; align-items: center; }
.leader-stage { min-height: 290px; background: linear-gradient(180deg, #dff4ff 0 58%, #72b35f 58%); border: 3px solid var(--line); display: grid; place-items: end center; padding: 18px; overflow: hidden; }
:root.dark .leader-stage { background: linear-gradient(180deg, #1d2c46 0 58%, #20351f 58%); }
.leader-sprite { width: 150px; height: 150px; object-fit: contain; image-rendering: pixelated; transform: translateX(240px); animation: leaderWalk 1.15s steps(8) forwards; }
.leader-dialog { border: 3px solid var(--line); background: var(--screen); color: var(--screen-ink); padding: 18px; text-align: left; display: grid; gap: 12px; }
.leader-main { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; align-items: stretch; }
.compare { display: grid; gap: 12px; align-content: start; text-align: center; }
.big-stat { font-size: clamp(2rem, 7vw, 4.5rem); font-weight: 950; color: var(--accent-2); }
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.versus .card { padding: 12px; text-align: center; }
.versus img { width: 100%; height: 150px; object-fit: contain; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 30; }
.drawer { position: fixed; z-index: 40; top: 14px; bottom: 14px; left: 14px; width: min(340px, calc(100vw - 28px)); padding: 16px; display: grid; align-content: start; gap: 12px; transform: translateX(-115%); transition: transform .18s ease; }
.drawer.open { transform: translateX(0); }
.drawer-row { display: grid; gap: 8px; }
.menu-list { display: grid; gap: 8px; }
.switch-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.pokedex-modal { position: fixed; z-index: 50; inset: 18px; padding: 16px; display: grid; grid-template-rows: auto auto 1fr; gap: 12px; }
.dex-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.regions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.region { opacity: .55; }
.region.active { opacity: 1; background: var(--accent-2); color: #fff; }
.dex-grid { overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding-right: 4px; }
.dex-card { border: 3px solid var(--line); background: var(--panel-2); border-radius: 5px; padding: 10px; display: grid; grid-template-columns: 70px 1fr; gap: 9px; align-items: center; text-align: left; }
.dex-card img { width: 70px; height: 70px; object-fit: contain; }
.dex-card p { font-size: .85rem; color: var(--muted); }
.footer-note { color: var(--muted); font-size: .84rem; text-align: center; }
@keyframes starterDrop { from { opacity: 0; transform: translateY(-24px) rotateX(45deg); } to { opacity: 1; transform: none; } }
@keyframes revealMon { to { opacity: 1; transform: scale(1); } }
@keyframes ballBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulseNode { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes leaderWalk { to { transform: translateX(0); } }
@media (max-width: 850px) {
  .app { padding: 10px; }
  .topbar, .battle, .leader-main, .leader-intro, .versus { grid-template-columns: 1fr; }
  .status { justify-content: center; }
  .brand { justify-content: center; text-align: center; }
  .partner { border-right: 0; border-bottom: 3px solid var(--line); }
  .partner img { height: 130px; }
  .starters, .event-options { grid-template-columns: 1fr; }
  .grid { gap: 8px; }
  .poke-card { min-height: 138px; padding: 8px; }
  .poke-card img { height: 64px; }
  .pokedex-modal { inset: 8px; }
}


/* Iteration 3: hidden battle types, badges, help and richer route/leader screens */
.status { align-items: center; }
.badge-strip { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 236px; }
.badge-token { width: 26px; height: 26px; border: 2px solid var(--line); border-radius: 50%; display: grid; place-items: center; background: #333946; color: #111721; filter: grayscale(1) brightness(.62); box-shadow: inset 0 2px 0 rgba(255,255,255,.16); }
.badge-token span { font-size: .76rem; line-height: 1; }
.badge-token.earned { background: var(--badge-color); color: #fff; filter: none; text-shadow: 1px 1px 0 rgba(0,0,0,.35); }
.badge-token.flash { animation: badgePop 1.2s ease-in-out infinite; }
.type-row { justify-content: center; margin-top: 0; }
.type-img { width: 58px; height: 17px; }
.starter .type-row, .poke-card .type-row, .partner .type-row, .versus .type-row { display: none; }
.item-row { display: grid; gap: 8px; }
.item-btn { display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; align-items: center; width: 100%; text-align: left; padding: 6px 8px; }
.item-icon { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.item-btn b { min-width: 24px; text-align: center; }
.route-event { background: linear-gradient(180deg, var(--panel), var(--panel-2)); }
.event-option { min-height: 172px; place-items: center; overflow: hidden; position: relative; }
.event-option::before { content: ""; position: absolute; inset: 10px; border: 2px dashed rgba(43,52,72,.32); pointer-events: none; }
.event-anim { width: 72px; height: 72px; display: grid; place-items: center; font-size: 2.4rem; border: 3px solid var(--line); background: var(--screen); border-radius: 50%; animation: floatChoice 1.7s ease-in-out infinite; }
.event-shop .event-anim { animation-delay: .18s; }
.event-dojo .event-anim { animation-delay: .36s; }
.dex-grid { grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); }
.dex-card { grid-template-columns: 88px 1fr; align-items: start; min-height: 166px; }
.dex-media { display: grid; justify-items: center; gap: 5px; }
.dex-media > img { width: 82px; height: 82px; object-fit: contain; }
.dex-types { display: flex; flex-direction: column; gap: 4px; align-items: center; min-height: 38px; }
.dex-type-img { width: 58px; height: 17px; }
.dex-info { display: grid; gap: 8px; min-width: 0; }
.dex-title { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.dex-title h3 { font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dex-title span { font-weight: 950; color: var(--muted); flex: 0 0 auto; }
.dex-card p { font-size: .82rem; line-height: 1.2; }
.help-modal { grid-template-rows: repeat(6, auto); align-content: start; overflow: auto; }
.help-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.help-step, .help-item { border: 3px solid var(--line); background: var(--panel-2); border-radius: 5px; padding: 12px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.help-step span { width: 34px; height: 34px; display: grid; place-items: center; border: 3px solid var(--line); background: var(--accent-2); color: #fff; font-weight: 950; border-radius: 50%; }
.help-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 10px; }
.help-item .item-icon { width: 52px; height: 52px; }
.leader.gym-theme { position: relative; overflow: hidden; background: var(--panel); }
.leader.gym-theme::before { content: ""; position: absolute; inset: 0; opacity: .42; pointer-events: none; background-size: 46px 46px; }
.leader.gym-theme > * { position: relative; z-index: 1; }
.gym-0::before { background-image: linear-gradient(45deg, #87745e 25%, transparent 25%), linear-gradient(-45deg, #a28b6e 25%, transparent 25%); }
.gym-1::before { background-image: radial-gradient(circle at 50% 50%, #7cc9ff 0 18%, transparent 19%), linear-gradient(90deg, #2c7dc4 0 8px, transparent 8px); }
.gym-2::before { background-image: linear-gradient(90deg, #f6d64a 0 8px, transparent 8px), linear-gradient(#fff3a5 0 8px, transparent 8px); }
.gym-3::before { background-image: radial-gradient(circle, #74c365 0 18%, transparent 19%); }
.gym-4::before { background-image: repeating-linear-gradient(45deg, #8d5cab 0 10px, #52376d 10px 20px); }
.gym-5::before { background-image: radial-gradient(circle at 30% 30%, #f1cb74 0 12%, transparent 13%), radial-gradient(circle at 70% 70%, #9a72df 0 12%, transparent 13%); }
.gym-6::before { background-image: repeating-linear-gradient(0deg, #eb6a3d 0 9px, #ffba54 9px 18px); }
.gym-7::before { background-image: repeating-linear-gradient(45deg, #8a6345 0 14px, #5b3b2d 14px 28px); }
.leader-round-head { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; text-align: left; }
.leader-mini { width: 86px; height: 86px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(4px 4px 0 rgba(0,0,0,.22)); animation: trainerIdle 1.2s steps(2) infinite; }
.badge-earned { place-items: center; }
.earned-badge-big { width: 124px; height: 124px; border: 5px solid var(--line); border-radius: 50%; background: var(--badge-color); color: #fff; display: grid; place-items: center; text-shadow: 3px 3px 0 rgba(0,0,0,.32); animation: earnBadge 1.2s cubic-bezier(.2,1.4,.3,1) both; box-shadow: 0 0 0 0 rgba(255,255,255,.7); }
.earned-badge-big span { font-size: 3rem; }
@keyframes badgePop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25) rotate(-8deg); } }
@keyframes scanLine { from { transform: translateY(-12px); } to { transform: translateY(12px); } }
@keyframes floatChoice { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes trainerIdle { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes earnBadge { 0% { opacity: 0; transform: scale(.35) rotate(-24deg); } 70% { opacity: 1; transform: scale(1.12) rotate(5deg); } 100% { transform: scale(1) rotate(0); } }
@media (max-width: 850px) {
  .badge-strip { justify-content: center; max-width: none; }
  .dex-card { grid-template-columns: 78px 1fr; }
  .leader-round-head { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}


/* Compact playfield pass */
body { overflow: hidden; }
.app { height: 100vh; min-height: 0; padding: 8px; align-items: stretch; }
.shell { height: calc(100vh - 16px); grid-template-rows: auto 1fr; gap: 8px; }
.topbar { padding: 6px 9px; gap: 8px; grid-template-columns: auto minmax(170px, 1fr) auto; }
.logo { width: 36px; height: 36px; }
h1 { font-size: clamp(1rem, 1.7vw, 1.35rem); }
h2 { font-size: clamp(.95rem, 1.5vw, 1.2rem); }
.sub { font-size: .84rem; }
.icon-btn { width: 34px; min-height: 32px; font-size: 1rem; }
.pill { min-height: 28px; padding: 4px 7px; border-width: 2px; font-size: .83rem; }
.status { gap: 7px; flex-wrap: nowrap; justify-content: flex-end; min-width: 390px; }
.life-pill { gap: 5px; }
.pixel-hearts { display: inline-flex; gap: 3px; align-items: center; }
.pixel-hearts i { width: 12px; height: 12px; display: inline-block; image-rendering: pixelated; clip-path: polygon(8% 25%, 8% 8%, 33% 8%, 33% 25%, 50% 25%, 50% 8%, 75% 8%, 75% 25%, 92% 25%, 92% 58%, 75% 58%, 75% 75%, 58% 75%, 58% 92%, 42% 92%, 42% 75%, 25% 75%, 25% 58%, 8% 58%); }
.pixel-hearts i.full { background: #e82232; box-shadow: 1px 1px 0 #8a1020; }
.pixel-hearts i.empty { background: #a7adb8; box-shadow: inset 0 0 0 2px #6d7480, 1px 1px 0 rgba(43,52,72,.45); opacity: .72; }
.badge-strip { flex-wrap: nowrap; gap: 3px; max-width: none; min-width: 220px; }
.badge-token { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 4px; background: #222733; padding: 2px; filter: grayscale(1) brightness(.35); }
.badge-token img { width: 18px; height: 18px; max-width: 18px; max-height: 18px; object-fit: contain; display: block; }
.badge-token.earned { background: rgba(255,255,255,.2); filter: none; }
.badge-token.flash { animation: badgePop .85s ease-in-out infinite; }
.battle { grid-template-columns: 190px 1fr; min-height: 0; height: 100%; }
.partner { padding: 9px; gap: 7px; min-height: 0; overflow: hidden; }
.partner img { height: 105px; }
.partner .name { font-size: .9rem; }
.item-row { gap: 4px; }
.item-btn { min-height: 28px; grid-template-columns: 23px 1fr auto; padding: 3px 5px; gap: 4px; font-size: .72rem; border-width: 2px; box-shadow: 2px 2px 0 rgba(0,0,0,.18); }
.item-icon { width: 21px; height: 21px; }
.item-btn b { min-width: 18px; }
.panel { padding: 8px; gap: 7px; min-height: 0; grid-template-rows: auto auto auto 1fr auto; }
.route { gap: 5px; }
.node { width: 26px; height: 26px; border-width: 2px; font-size: .78rem; }
.notice { padding: 5px 8px; border-width: 2px; font-size: .82rem; }
.grid { gap: 6px; min-height: 0; }
.poke-card { min-height: 0; height: 100%; padding: 5px; border-width: 2px; display: grid; grid-template-rows: 1fr auto auto; align-items: center; }
.poke-card img { height: clamp(52px, 10vh, 76px); }
.poke-card .name { font-size: .82rem; }
.poke-card .hint { font-size: .72rem; min-height: 15px; }
.actions { gap: 7px; }
.btn { min-height: 31px; padding: 5px 9px; border-width: 2px; font-size: .82rem; }
.hero { padding: 14px; gap: 12px; min-height: 0; }
.starter { min-height: 215px; padding: 10px; }
.pokeball { width: 78px; height: 78px; border-width: 4px; margin-bottom: 8px; }
.pokeball::after { inset: 23px; border-width: 4px; }
.starter .poke-art { max-height: 95px; }
.event, .leader, .end { padding: 12px; gap: 10px; min-height: 0; overflow: hidden; }
.event-options { gap: 8px; }
.event-option { min-height: 128px; padding: 8px; border-width: 2px; }
.event-anim { width: 50px; height: 50px; font-size: 1.75rem; border-width: 2px; }
.leader-main { gap: 10px; }
.leader-round-head { gap: 8px; }
.leader-mini { width: 62px; height: 62px; }
.versus { gap: 8px; }
.versus .card { padding: 7px; border-width: 2px; }
.versus img { height: 102px; }
.big-stat { font-size: clamp(1.8rem, 5vw, 3.2rem); }
.compare { gap: 8px; }
.leader-intro { min-height: 0; gap: 10px; }
.leader-stage { min-height: 220px; }
.leader-sprite { width: 120px; height: 120px; }
.earned-badge-big { width: 92px; height: 92px; padding: 8px; }
.earned-badge-big img { width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 850px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .shell { height: auto; }
  .status { min-width: 0; flex-wrap: wrap; justify-content: center; }
  .badge-strip { min-width: 0; }
  .battle { grid-template-columns: 1fr; height: auto; }
}


/* Prevent inventory buttons from stretching */
.partner { justify-content: flex-start; }
.item-row { grid-auto-rows: max-content; align-content: start; flex: 0 0 auto; }
.item-btn { height: 30px; min-height: 30px; max-height: 30px; overflow: hidden; }


/* Pokedex official-description layout fix */
.pokedex-modal { overflow: hidden; }
.dex-grid { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); align-content: start; }
.dex-card { grid-template-columns: 82px minmax(0, 1fr); min-height: 142px; padding: 8px; gap: 8px; overflow: hidden; }
.dex-media { align-content: start; justify-items: center; gap: 2px; min-width: 0; }
.dex-media > img { width: 74px; height: 74px; object-fit: contain; }
.dex-types { width: 74px; min-height: 34px; display: flex; flex-direction: column; gap: 1px; align-items: center; justify-content: flex-start; overflow: hidden; }
.dex-type-img { width: 58px; height: 15px; object-fit: fill; flex: 0 0 15px; display: block; }
.dex-info { min-width: 0; gap: 5px; }
.dex-title { align-items: start; line-height: 1.05; }
.dex-title h3 { font-size: .95rem; white-space: normal; line-height: 1.05; }
.dex-title span { font-size: .86rem; }
.dex-card p { font-size: .78rem; line-height: 1.15; max-height: 82px; overflow: hidden; }
@media (max-width: 850px) {
  .dex-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
  .dex-card { grid-template-columns: 76px minmax(0, 1fr); }
  .dex-media > img, .dex-types { width: 70px; }
  .dex-type-img { width: 54px; height: 14px; flex-basis: 14px; }
}


/* Pokedex list/detail modal */
.dex-card { cursor: pointer; text-align: left; appearance: none; color: inherit; font: inherit; }
.dex-card:hover { transform: translateY(-2px); background: var(--soft); }
.dex-card p { display: none; }
.dex-info { align-content: start; }
.dex-title h3 { white-space: normal; }
.dex-detail-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.55); }
.dex-detail-modal { position: fixed; z-index: 80; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(700px, calc(100vw - 28px)); background: var(--panel); border: 3px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: 18px; display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: center; }
.dex-detail-close { position: absolute; top: 8px; right: 8px; }
.dex-detail-art { min-height: 210px; display: grid; place-items: center; background: var(--screen); border: 3px solid var(--line); border-radius: 5px; }
.dex-detail-art img { width: 175px; height: 175px; object-fit: contain; }
.dex-detail-info { display: grid; gap: 12px; padding-right: 28px; }
.dex-detail-info .dex-title { justify-content: flex-start; gap: 12px; padding-right: 36px; }
.dex-detail-info .dex-title h2 { font-size: 1.65rem; }
.dex-detail-info .dex-title span { font-size: 1.05rem; }
.dex-detail-info .dex-types { width: auto; min-height: 0; flex-direction: row; justify-content: flex-start; gap: 5px; overflow: visible; }
.dex-detail-info .dex-type-img { width: 68px; height: 18px; flex: 0 0 68px; }
.dex-detail-info p { font-size: .98rem; line-height: 1.35; color: var(--ink); }
@media (max-width: 650px) {
  .dex-detail-modal { grid-template-columns: 1fr; max-height: calc(100vh - 24px); overflow: auto; }
  .dex-detail-art { min-height: 170px; }
  .dex-detail-art img { width: 145px; height: 145px; }
  .dex-detail-info { padding-right: 0; text-align: center; }
  .dex-detail-info .dex-types { justify-content: center; }
}


/* Move Pokedex list type badges to the right column */
.dex-card { grid-template-columns: 76px minmax(0, 1fr); align-items: center; min-height: 118px; }
.dex-card .dex-media { align-content: center; }
.dex-card .dex-media > img { width: 72px; height: 72px; }
.dex-card .dex-info { align-content: center; gap: 8px; }
.dex-card .dex-info .dex-title { justify-content: flex-start; gap: 9px; }
.dex-card .dex-info .dex-title span { margin-left: 0; }
.dex-card .dex-info .dex-types { width: auto; min-height: 0; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 4px; overflow: visible; }
.dex-card .dex-info .dex-type-img { width: 58px; height: 15px; flex: 0 0 58px; }
.dex-card .dex-media .dex-types { display: none; }
@media (max-width: 850px) {
  .dex-card { grid-template-columns: 72px minmax(0, 1fr); }
  .dex-card .dex-media > img { width: 68px; height: 68px; }
}


/* Pokedex base stat chart */
.stat-chart { margin-top: 2px; padding: 12px 12px 10px; background: #a9a9a9; border-radius: 8px; color: #172033; min-width: 0; }
.stat-chart h3 { margin: 0 0 12px; font-size: .98rem; font-weight: 700; }
.stat-bars { display: grid; grid-template-columns: repeat(6, minmax(42px, 1fr)); gap: 7px; align-items: end; }
.stat-bar-col { min-width: 0; display: grid; grid-template-rows: 16px 112px 30px; gap: 5px; align-items: end; text-align: center; }
.stat-track { position: relative; height: 112px; border-left: 4px solid #f5f5f0; background: repeating-linear-gradient(to top, transparent 0 9px, #f5f5f0 9px 13px); overflow: hidden; }
.stat-fill { position: absolute; left: 4px; right: 0; bottom: 0; background: #28a6d1; box-shadow: inset 0 3px 0 rgba(255,255,255,.24); }
.stat-value { align-self: end; font-size: .72rem; font-weight: 950; color: #172033; line-height: 1; text-shadow: 1px 1px 0 rgba(255,255,255,.55); }
.stat-label { min-height: 30px; display: flex; align-items: flex-start; justify-content: center; font-size: .64rem; line-height: 1.02; font-weight: 900; white-space: normal; }
@media (max-width: 650px) {
  .stat-chart { padding: 10px 8px; }
  .stat-bars { gap: 4px; }
  .stat-bar-col { grid-template-rows: 16px 98px 30px; }
  .stat-track { height: 98px; }
  .stat-label { font-size: .58rem; }
}


/* Starter selector balance */
.starter { display: grid; grid-template-rows: auto 1fr auto; align-items: center; justify-items: center; }
.starter .pokeball { width: 58px; height: 58px; border-width: 3px; margin: 0 auto 4px; }
.starter .pokeball::after { inset: 17px; border-width: 3px; }
.starter .poke-art { max-height: 128px; min-height: 112px; object-fit: contain; }
.starter .name { font-size: 1.08rem; margin-top: 4px; }
@media (max-width: 850px) {
  .starter .poke-art { max-height: 112px; min-height: 96px; }
  .starter .pokeball { width: 52px; height: 52px; }
  .starter .pokeball::after { inset: 15px; }
}


/* Pokedex alignment polish */
.dex-detail-info .dex-title { align-items: center; line-height: 1; }
.dex-detail-info .dex-title h2 { line-height: 1; margin: 0; }
.dex-detail-info .dex-title span { line-height: 1; transform: translateY(4px); }
.dex-card { grid-template-columns: 72px max-content; justify-content: center; }
.dex-card .dex-media { justify-self: end; }
.dex-card .dex-info { width: max-content; max-width: 142px; justify-self: start; align-content: center; justify-items: start; }
.dex-card .dex-info .dex-title { align-items: center; line-height: 1; }
.dex-card .dex-info .dex-title h3 { line-height: 1; }
.dex-card .dex-info .dex-title span { line-height: 1; transform: translateY(2px); }
@media (max-width: 850px) {
  .dex-card { grid-template-columns: 68px max-content; }
  .dex-card .dex-info { max-width: 132px; }
}


/* Tight starter card vertical rhythm */
.starter { grid-template-rows: 54px 150px 28px; align-content: center; row-gap: 0; padding-top: 8px; padding-bottom: 8px; }
.starter .pokeball { align-self: end; width: 50px; height: 50px; margin: 0; }
.starter .pokeball::after { inset: 14px; }
.starter .poke-art { align-self: center; max-height: 145px; min-height: 0; width: 82%; transform: translateY(4px); }
.starter .name { align-self: start; margin-top: -2px; font-size: 1.12rem; line-height: 1.05; }
@media (max-width: 850px) {
  .starter { grid-template-rows: 48px 128px 26px; }
  .starter .pokeball { width: 44px; height: 44px; }
  .starter .pokeball::after { inset: 12px; }
  .starter .poke-art { max-height: 124px; }
}


/* Partner sidebar readability */
.partner { justify-content: center; align-items: stretch; gap: 10px; padding-top: 14px; padding-bottom: 14px; }
.partner .poke-art { height: 126px; max-height: 126px; }
.partner .name { font-size: 1rem; line-height: 1.1; }
.partner .hint { font-size: .9rem; }
.item-row { gap: 6px; width: 100%; }
.item-btn { height: 38px; min-height: 38px; max-height: 38px; grid-template-columns: 28px minmax(0, 1fr) 24px; gap: 6px; padding: 5px 7px; font-size: .78rem; align-items: center; }
.item-btn .item-icon { width: 25px; height: 25px; display: block; }
.item-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-btn b { font-size: .82rem; justify-self: end; }
@media (max-width: 850px) {
  .partner { justify-content: flex-start; }
  .item-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Larger battle grid Pokémon */
.poke-card img { height: clamp(82px, 15vh, 118px); max-width: 88%; margin: 0 auto; }
.poke-card { grid-template-rows: minmax(92px, 1fr) auto auto; }
@media (max-width: 850px) {
  .poke-card img { height: clamp(68px, 13vh, 96px); }
  .poke-card { grid-template-rows: minmax(76px, 1fr) auto auto; }
}


/* Compact help item cards */
.help-items { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: start; }
.help-item { min-height: 0; height: auto; padding: 10px; gap: 6px; align-content: start; }
.help-item .item-icon { width: 42px; height: 42px; }
.help-item h3 { font-size: .98rem; line-height: 1.1; margin: 0; }
.help-item p { font-size: .82rem; line-height: 1.2; margin: 0; }
.help-modal { align-content: start; }


/* Equal-sized help item cards */
.help-items { align-items: stretch; }
.help-item { height: 128px; min-height: 128px; max-height: 128px; grid-template-rows: 42px auto 1fr; align-items: start; justify-content: center; overflow: hidden; }
.help-item p { align-self: start; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Gym leader type backgrounds */
.leader.gym-bg { background-image: linear-gradient(rgba(12, 18, 28, .48), rgba(12, 18, 28, .58)), var(--gym-bg); background-size: cover; background-position: center; }
.leader.gym-bg::before { display: none; }
.leader.gym-bg .leader-dialog, .leader.gym-bg .compare, .leader.gym-bg .card { background: rgba(16, 25, 38, .88); backdrop-filter: blur(1px); }
.leader.gym-bg .leader-stage { background-image: linear-gradient(rgba(255,255,255,.08), rgba(0,0,0,.18)), var(--gym-bg); background-size: cover; background-position: center; }


/* Starter selection scenic background */
.hero {
  background-image:
    linear-gradient(rgba(255, 250, 240, .34), rgba(255, 250, 240, .18)),
    url("assets/backgrounds-webp/dia.webp");
  background-size: cover;
  background-position: center 46%;
}
:root.dark .hero {
  background-image:
    linear-gradient(rgba(18, 26, 39, .44), rgba(18, 26, 39, .34)),
    url("assets/backgrounds-webp/noche.webp");
  background-position: center 46%;
}
.hero > div:first-child,
.hero .footer-note {
  text-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.hero .footer-note {
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
  font-weight: 800;
}
:root.dark .hero .footer-note {
  color: #e8f0ff;
  text-shadow: 0 2px 0 rgba(0,0,0,.55);
}


/* Trainer phase prompt emphasis */
.panel > div:nth-child(2) .sub {
  font-size: 1.02rem;
  line-height: 1.28;
  font-weight: 850;
  color: var(--ink);
}
.phase-key {
  color: #d52232;
  font-weight: 950;
}
:root.dark .phase-key {
  color: #ff6b78;
}


/* Route event readability */
.route-event > .sub {
  font-size: 1.02rem;
  line-height: 1.35;
  font-weight: 800;
  color: var(--ink);
}
.route-event .event-option strong {
  font-size: 1.06rem;
  line-height: 1.15;
}
.route-event .event-option .hint {
  font-size: .96rem;
  line-height: 1.24;
  color: var(--ink);
  font-weight: 700;
}
:root.dark .route-event > .sub,
:root.dark .route-event .event-option .hint {
  color: var(--ink);
}
.hero .starter {
  background: rgba(255, 250, 240, .48);
  backdrop-filter: blur(1px);
}
:root.dark .hero .starter {
  background: rgba(18, 26, 39, .48);
}
.hero > div:first-child {
  width: min(800px, 78vw);
  aspect-ratio: 1285 / 335;
  justify-self: center;
  background-image: url("assets/backgrounds-webp/letrero-dia.webp");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: grid;
  place-items: center;
}
:root[lang="en"] .hero > div:first-child {
  aspect-ratio: 1968 / 442;
  background-image: url("assets/backgrounds-webp/letrero-dia-en-clean.webp");
}
:root.dark .hero > div:first-child {
  background-image: url("assets/backgrounds-webp/letrero-noche.webp");
}
:root.dark[lang="en"] .hero > div:first-child {
  aspect-ratio: 2034 / 444;
  background-image: url("assets/backgrounds-webp/letrero-noche-en-clean.webp");
}
.hero > div:first-child h2,
.hero > div:first-child p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Dynamic Gym-route banner */
.starter-banner {
  position:relative;
  isolation:isolate;
  width:min(1040px,96%);
  min-height:158px;
  justify-self:center;
  display:grid;
  grid-template-columns:86px minmax(0,1fr) 142px;
  align-items:center;
  overflow:hidden;
  border:3px solid #29485f;
  border-radius:18px;
  background:
    linear-gradient(90deg,rgba(56,139,183,.1),transparent 22%,transparent 78%,rgba(225,72,76,.08)),
    linear-gradient(155deg,#fffdf1 0%,#f2f1dc 55%,#dcebdd 100%);
  color:#182b3e;
  box-shadow:0 7px 0 rgba(35,58,70,.34),0 16px 28px rgba(27,55,68,.22),inset 0 0 0 3px rgba(255,255,255,.72);
  text-align:left;
  animation:starterBannerIn .55s cubic-bezier(.18,.82,.25,1) both;
}
.starter-banner::before {
  content:"";
  position:absolute;
  z-index:-1;
  inset:0;
  opacity:.2;
  background-image:linear-gradient(45deg,rgba(34,89,112,.2) 25%,transparent 25%),linear-gradient(-45deg,rgba(34,89,112,.16) 25%,transparent 25%);
  background-size:22px 22px;
  mask-image:linear-gradient(90deg,#000,transparent 35%,transparent 70%,#000);
}
.starter-banner::after { content:""; position:absolute; z-index:2; left:18px; right:18px; bottom:8px; height:4px; border-radius:99px; background:linear-gradient(90deg,#e34a50 0 32%,#f2ca47 32% 38%,#3d94bd 38% 100%); box-shadow:0 1px 0 rgba(255,255,255,.75); }
.starter-banner-accent { position:absolute; z-index:3; inset:10px auto 10px 8px; width:7px; border-radius:99px; background:linear-gradient(#e8474e 0 44%,#f3c63f 44% 54%,#3b91bd 54%); box-shadow:2px 0 0 rgba(24,53,70,.18); }
.starter-banner-ball { width:62px; height:62px; margin-left:17px; display:grid; place-items:center; border:5px solid #23394c; border-radius:50%; background:linear-gradient(#e94b52 0 43%,#21374b 43% 57%,#fffdf2 57%); box-shadow:0 5px 0 #82929a,0 0 0 4px rgba(255,255,255,.7); transform:rotate(-7deg); }
.starter-banner-ball i { width:21px; height:21px; border:5px solid #23394c; border-radius:50%; background:#fffdf2; box-shadow:inset 0 0 0 3px #dbe6de; }
.starter-banner-copy { min-width:0; padding:17px 20px 22px 14px; text-align:left; }
.starter-banner-kicker { margin:0 0 5px; color:#287da8; font-size:.61rem; font-weight:950; letter-spacing:.16em; text-transform:uppercase; }
.starter-banner h2 { margin:0; color:#172b3d; font-size:clamp(1.35rem,2.55vw,2.25rem); line-height:1.02; letter-spacing:-.025em; text-shadow:2px 2px 0 #fff; }
.starter-banner-sub { margin:8px 0 9px; color:#405b6a; font-size:clamp(.76rem,1.25vw,.98rem); font-weight:750; line-height:1.28; }
.starter-banner-rule { display:grid; grid-template-columns:minmax(16px,1fr) auto minmax(16px,1fr); align-items:center; gap:9px; color:#607681; font-size:clamp(.62rem,1vw,.78rem); font-weight:850; text-align:center; }
.starter-banner-rule i { height:2px; border-radius:99px; background:linear-gradient(90deg,transparent,#7192a1); }.starter-banner-rule i:last-child { background:linear-gradient(90deg,#7192a1,transparent); }
.starter-banner-target { align-self:stretch; display:grid; grid-template-rows:auto 1fr auto auto; place-items:center; align-content:center; gap:2px; padding:15px 12px 20px; border-left:2px dashed rgba(54,88,105,.35); background:linear-gradient(180deg,rgba(255,255,255,.35),rgba(63,139,176,.09)); text-align:center; }
.starter-banner-target small { color:#738996; font-size:.52rem; font-weight:950; letter-spacing:.14em; }.starter-banner-target img { width:50px; height:50px; object-fit:contain; image-rendering:pixelated; filter:drop-shadow(0 3px 2px rgba(29,42,52,.28)); }.starter-banner-target strong { color:#213a4e; font-size:.94rem; }.starter-banner-target span { color:#7b5d1b; font-size:.6rem; font-weight:900; }
:root.dark .starter-banner { border-color:#8ba8c0; background:linear-gradient(90deg,rgba(67,160,217,.1),transparent 25%,transparent 75%,rgba(221,65,79,.08)),linear-gradient(150deg,#14283b 0%,#0c1b2b 58%,#102a2d 100%); color:#f2f7ff; box-shadow:0 7px 0 rgba(0,0,0,.48),0 16px 30px rgba(0,0,0,.35),inset 0 0 0 3px rgba(255,255,255,.05); }
:root.dark .starter-banner::before { opacity:.16; background-image:linear-gradient(45deg,rgba(102,186,235,.24) 25%,transparent 25%),linear-gradient(-45deg,rgba(102,186,235,.2) 25%,transparent 25%); }
:root.dark .starter-banner::after { box-shadow:0 1px 0 rgba(255,255,255,.16),0 0 9px rgba(66,159,213,.3); }
:root.dark .starter-banner-ball { border-color:#23394c; background:linear-gradient(#e94b52 0 43%,#21374b 43% 57%,#fffdf2 57%); box-shadow:0 5px 0 #02080d,0 0 0 4px rgba(79,170,226,.2); }
:root.dark .starter-banner-ball i { border-color:#23394c; background:#fffdf2; box-shadow:inset 0 0 0 3px #dbe6de; }
:root.dark .starter-banner-kicker { color:#6fc1fa; }:root.dark .starter-banner h2 { color:#fff6ce; text-shadow:2px 2px 0 #02080e; }:root.dark .starter-banner-sub { color:#bed0df; }:root.dark .starter-banner-rule { color:#91a8b9; }:root.dark .starter-banner-rule i { background:linear-gradient(90deg,transparent,#53768f); }:root.dark .starter-banner-rule i:last-child { background:linear-gradient(90deg,#53768f,transparent); }
:root.dark .starter-banner-target { border-left-color:rgba(145,183,210,.3); background:linear-gradient(180deg,rgba(54,106,143,.13),rgba(0,0,0,.12)); }:root.dark .starter-banner-target small { color:#8faabd; }:root.dark .starter-banner-target strong { color:#fff; }:root.dark .starter-banner-target span { color:#f1d56b; }
@keyframes starterBannerIn { from { opacity:0; transform:translateY(-12px) scale(.985); } }
@media (max-width:700px) { .starter-banner { width:100%; min-height:0; grid-template-columns:64px minmax(0,1fr); }.starter-banner-ball { width:45px; height:45px; margin-left:12px; border-width:4px; }.starter-banner-ball i { width:16px; height:16px; border-width:4px; }.starter-banner-copy { padding:14px 12px 9px 5px; }.starter-banner-target { grid-column:1 / -1; grid-template-columns:auto auto 1fr auto; grid-template-rows:auto; min-height:43px; padding:6px 13px 11px; border-top:2px dashed rgba(54,88,105,.3); border-left:0; gap:7px; justify-items:start; }.starter-banner-target img { width:30px; height:30px; }.starter-banner-target span { justify-self:end; }.starter-banner-rule { grid-template-columns:1fr; text-align:left; }.starter-banner-rule i { display:none; } }


/* Help special groups */
.help-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: stretch;
  gap: 8px;
}
.help-group {
  border: 3px solid var(--line);
  background: var(--panel-2);
  border-radius: 5px;
  height: 94px;
  min-height: 94px;
  padding: 10px 12px;
  display: grid;
  place-items: center;
  font-size: .86rem;
  line-height: 1.2;
  font-weight: 800;
  text-align: center;
  text-wrap: balance;
}

/* Pre-leader center screen */
.center-ready {
  min-height: clamp(260px, 44vh, 390px);
  align-content: center;
  justify-items: center;
  gap: 26px;
  padding: clamp(24px, 5vw, 54px);
}

.center-ready .sub {
  max-width: 780px;
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(1.1rem, 1.75vw, 1.45rem);
  line-height: 1.45;
  font-weight: 850;
  text-align: center;
}

.center-ready .center-challenge {
  width: auto;
  min-width: 170px;
  max-width: 260px;
  justify-self: center;
  padding: 11px 20px;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.15;
  text-align: center;
}

/* Leader stat challenge contrast over gym backgrounds */
.leader.gym-bg .compare,
.leader.gym-bg .card,
.leader.gym-bg .card .name {
  color: #edf4ff;
}

.leader.gym-bg .compare p {
  color: #edf4ff;
  font-weight: 850;
}

.leader.gym-bg .pill {
  background: rgba(238, 245, 223, .94);
  color: #182030;
}

.leader.gym-bg .leader-round-head {
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  gap: 7px;
  min-height: clamp(132px, 22vh, 190px);
  text-align: center;
}

.leader.gym-bg .leader-round-head > div {
  order: 1;
  width: min(520px, 92%);
  padding: 7px 14px;
  border: 2px solid rgba(216, 228, 245, .55);
  border-radius: 5px;
  background: rgba(16, 25, 38, .68);
  color: #edf4ff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .58);
  backdrop-filter: blur(1px);
}

.leader.gym-bg .leader-round-head h2 {
  color: #edf4ff;
  font-size: clamp(1.28rem, 2.15vw, 1.9rem);
  line-height: 1.08;
}

.leader.gym-bg .leader-round-head .sub {
  color: #dce8f8;
  font-size: clamp(.98rem, 1.45vw, 1.18rem);
  line-height: 1.2;
  font-weight: 850;
}

.leader.gym-bg .leader-mini {
  order: 2;
  width: clamp(104px, 12vw, 150px);
  height: clamp(104px, 12vw, 150px);
  justify-self: center;
  transform: translateY(142px);
  filter: drop-shadow(4px 5px 0 rgba(0, 0, 0, .42));
  animation: leaderCenterIdle 1.2s steps(2) infinite;
}

@keyframes leaderCenterIdle {
  0%,100% { transform: translateY(142px); }
  50% { transform: translateY(135px); }
}

.leader.gym-bg .leader-duel {
  grid-template-columns: minmax(160px, 240px) minmax(230px, 360px) minmax(160px, 240px);
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
}

.leader.gym-bg .leader-choice {
  appearance: none;
  width: min(240px, 100%);
  min-height: 0;
  padding: 16px 14px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  cursor: pointer;
  color: #edf4ff;
  font: inherit;
  transition: transform .12s ease, background .12s ease;
}

.leader.gym-bg .leader-choice:hover {
  transform: translateY(-3px);
  background: rgba(31, 48, 72, .94);
}

.leader.gym-bg .leader-choice .poke-art {
  height: clamp(96px, 16vh, 142px);
  max-height: none;
  width: 100%;
}

.leader.gym-bg .leader-choice .name {
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.1;
}

.leader.gym-bg .leader-question {
  width: min(360px, 100%);
  min-height: 0;
  padding: 18px 18px;
  display: grid;
  place-items: center;
  gap: 12px;
  align-content: center;
}

.leader.gym-bg .leader-question p {
  max-width: 320px;
  font-size: clamp(1.18rem, 2vw, 1.62rem);
  line-height: 1.22;
  text-align: center;
  text-wrap: balance;
}

.leader-stat-key {
  color: #ff4d5d;
  font-weight: 950;
}

@media (max-width: 760px) {
  .leader.gym-bg .leader-duel {
    grid-template-columns: 1fr;
  }

  .leader.gym-bg .leader-question {
    order: -1;
  }
}

.badge-earned {
  align-content: center;
  gap: clamp(18px, 4vh, 34px);
  padding: clamp(26px, 6vw, 64px);
}

.badge-earned h2 {
  font-size: clamp(1.35rem, 2.5vw, 2.15rem);
  line-height: 1.1;
  text-align: center;
}

.badge-earned .sub {
  max-width: 760px;
  color: var(--ink);
  font-size: clamp(1.05rem, 1.65vw, 1.35rem);
  line-height: 1.45;
  font-weight: 800;
  text-align: center;
}

.badge-rewards {
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: 840px;
  color: var(--ink);
  font-weight: 850;
  text-align: center;
}

.badge-main,
.badge-shop-reward {
  margin: 0;
  font-size: clamp(1.08rem, 1.75vw, 1.42rem);
  line-height: 1.35;
}

.badge-potion-reward {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.badge-potion-reward .item-icon {
  width: 30px;
  height: 30px;
  vertical-align: middle;
}

.badge-shop-reward {
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.24rem);
}

.badge-earned .btn {
  min-height: 46px;
  padding: 10px 18px;
  font-size: clamp(1rem, 1.45vw, 1.18rem);
}

/* Team Rocket mid-route encounter */
.phase-info-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 12;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 3px solid currentColor;
  border-radius: 50%;
  background: rgba(16, 22, 32, .9);
  color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
  font: 950 1.15rem/1 Georgia, serif;
  cursor: pointer;
}

.phase-info-button:hover { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.35); }
.leader { position: relative; }

.phase-info-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(3, 5, 9, .76);
  backdrop-filter: blur(3px);
}

.phase-info-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1001;
  width: min(560px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: clamp(24px, 5vw, 42px);
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}

.phase-info-modal h2 { margin: 8px 42px 18px 0; font-size: clamp(1.35rem, 3vw, 2rem); }
.phase-info-modal p, .phase-info-modal li { font-weight: 700; line-height: 1.5; }
.phase-info-modal ul { display: grid; gap: 10px; margin: 16px 0 0; padding-left: 22px; }
.phase-info-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 2px solid var(--line); border-radius: 50%; background: var(--panel-2); color: var(--ink); font-size: 1.4rem; font-weight: 900; cursor: pointer; }
.phase-info-symbol { float: left; display: grid; place-items: center; width: 54px; height: 54px; margin-right: 15px; border-radius: 50%; background: var(--villain-accent, #c7192e); color: #fff; font: 2rem/1 Impact, sans-serif; }

.node.rocket-node {
  background: color-mix(in srgb, var(--villain-accent, #c7192e) 72%, #000);
  border-color: color-mix(in srgb, var(--villain-accent, #c7192e) 42%, #000);
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.15rem;
}

.node.rocket-node.done { background: color-mix(in srgb, var(--villain-accent, #c7192e) 50%, #000); color: #fff; }
.node.rocket-node.now { background: var(--villain-accent, #d51d31); color: #fff; box-shadow: 0 0 0 5px color-mix(in srgb, var(--villain-accent, #d51d31) 22%, transparent), 0 0 20px color-mix(in srgb, var(--villain-accent, #d51d31) 65%, transparent); }

.rocket-screen {
  position: relative;
  min-height: calc(100vh - 112px);
  overflow: hidden;
  padding: clamp(18px, 3vw, 42px);
  color: #f8f8fb;
  background: radial-gradient(circle at 72% 28%, color-mix(in srgb, var(--villain-accent, #c7192e) 23%, transparent), transparent 32%), linear-gradient(135deg, #08090d, #17131a 55%, #09090c);
}

.rocket-screen::before {
  content: attr(data-villain-symbol);
  position: absolute;
  right: -2vw;
  bottom: -16vh;
  color: var(--villain-accent, #c7192e);
  opacity: .09;
  font-family: Impact, sans-serif;
  font-size: min(70vw, 780px);
  line-height: .8;
  transform: rotate(-8deg);
}

.rocket-screen > * { position: relative; z-index: 1; }
.rocket-route { max-width: 920px; margin: 0 auto clamp(20px, 4vh, 46px); }

.rocket-intro {
  display: grid;
  grid-template-columns: minmax(280px,.85fr) minmax(360px,1.15fr);
  gap: clamp(24px, 5vw, 74px);
  align-items: center;
  max-width: 1120px;
  margin: 0 auto;
}

.rocket-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(300px, 48vh, 510px);
  overflow: hidden;
  border: 4px solid #45424a;
  border-radius: 22px;
  background: linear-gradient(160deg, #25242a, #08090c 70%);
  box-shadow: inset 0 0 0 4px #0a0a0d, 0 20px 50px rgba(0,0,0,.5);
}

.rocket-emblem { position: absolute; color: var(--villain-accent, #dc192e); opacity: .18; font: min(42vw,430px)/1 Impact,sans-serif; }
.rocket-grunt-sprite {
  width: clamp(190px, 24vw, 290px);
  height: clamp(190px, 24vw, 290px);
  max-width: 82%;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(0 20px 12px rgba(0,0,0,.65));
  animation: rocket-arrival .85s steps(7,end) both;
}
.rocket-grunt-sprite[src*="team-aqua-grunt-body"] { align-self: end; margin-bottom: -1px; }
@keyframes rocket-arrival { from { opacity: 0; transform: translateX(-240px) scale(.85); } to { opacity: 1; transform: translateX(0) scale(1); } }

.rocket-dialog, .rocket-quiz-card, .rocket-outcome {
  border: 3px solid #d2d0d6;
  border-left-color: var(--villain-accent, #d51d31);
  border-radius: 18px;
  background: rgba(16,16,21,.94);
  box-shadow: 0 22px 60px rgba(0,0,0,.48);
}

.rocket-dialog { padding: clamp(24px, 4vw, 48px); }
.rocket-dialog h2, .rocket-outcome h2 { margin: 5px 0 16px; font-size: clamp(1.7rem, 3vw, 3rem); }
.rocket-dialog p:not(.rocket-kicker), .rocket-outcome > p { color: #d7d4dd; font-size: clamp(1rem,1.5vw,1.25rem); line-height: 1.55; }
.rocket-kicker { margin: 0; color: var(--villain-accent, #ff4055); font-weight: 950; letter-spacing: .14em; text-transform: uppercase; }
.rocket-primary { margin-top: 20px; border-color: color-mix(in srgb, var(--villain-accent, #ff5365) 70%, #fff); background: linear-gradient(var(--villain-accent, #d9253a),color-mix(in srgb, var(--villain-accent, #9d1422) 66%, #000)); color: #fff; }

.rocket-quiz-card, .rocket-outcome { max-width: 960px; margin: 0 auto; padding: clamp(22px,4vw,46px); text-align: center; }
.rocket-quiz-head { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; text-align: left; }
.rocket-quiz-head h2 { margin: 5px 0 0; }
.rocket-portrait { width: clamp(82px,10vw,122px); aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; border: 3px solid var(--villain-accent, #b61b2d); border-radius: 12px; background: #050507; }
.rocket-portrait[src*="team-aqua-grunt-portrait"] { object-position: center bottom; }
.rocket-portrait[src*="team-skull-grunts-portrait"] { object-position: center bottom; }
.rocket-partner-mini { display: grid; justify-items: center; color: #ddd; font-weight: 850; }
.rocket-partner-mini img { width: 92px; height: 92px; object-fit: contain; image-rendering: pixelated; }
.rocket-question { max-width: 760px; margin: clamp(24px,4vh,42px) auto; font-size: clamp(1.25rem,2.2vw,2rem); font-weight: 900; line-height: 1.35; }
.rocket-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.rocket-answer { min-height: 76px; padding: 14px; border: 3px solid #85818b; border-radius: 12px; background: #25232a; color: #fff; font: inherit; font-weight: 900; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.rocket-answer:not(:disabled):hover { transform: translateY(-3px); border-color: var(--villain-accent, #ff4055); }
.rocket-answer.correct { border-color: #65e28d; background: #176232; color: #fff; }
.rocket-answer.wrong { border-color: #ff6a79; background: #821d2a; color: #fff; }
.rocket-answer:disabled { opacity: 1; cursor: default; }
.rocket-continue { display: block; margin: 26px auto 0; }

.rocket-outcome { position: relative; overflow: hidden; }
.rocket-outcome-r { display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 12px; border: 4px solid #fff; border-radius: 50%; background: var(--villain-accent, #c7192e); font: 3.7rem/1 Impact,sans-serif; }
.rocket-rewards { display: grid; grid-template-columns: repeat(2,minmax(160px,240px)); justify-content: center; gap: 18px; margin: 28px 0 10px; }
.rocket-reward { display: grid; justify-items: center; gap: 10px; padding: 20px; border: 2px solid #67636c; border-radius: 14px; background: #242229; font-size: 1.08rem; }
.rocket-reward .item-icon { width: 70px; height: 70px; }
.rocket-swap { display: grid; grid-template-columns: minmax(160px,240px) auto minmax(160px,240px); justify-content: center; align-items: center; gap: 20px; margin: 28px auto 8px; }
.rocket-swap article { padding: 15px; border: 2px solid #64616b; border-radius: 14px; background: #242229; }
.rocket-swap article > span { color: #ff8090; font-weight: 900; text-transform: uppercase; }
.rocket-swap .poke-art { width: 145px; height: 145px; margin: 8px auto 0; display: block; object-fit: contain; }
.rocket-swap-arrow { color: var(--villain-accent, #ff4055); font-size: 2.8rem; font-weight: 950; }
.rocket-new-partner { border-color: #65e28d !important; }

@media (max-width: 760px) {
  .rocket-screen { min-height: calc(100vh - 92px); }
  .rocket-intro { grid-template-columns: 1fr; }
  .rocket-stage { min-height: 250px; }
  .rocket-grunt-sprite { width: 190px; height: 190px; }
  .rocket-quiz-head { grid-template-columns: auto 1fr; }
  .rocket-partner-mini { grid-column: 1 / -1; grid-template-columns: auto auto; align-items: center; justify-content: center; }
  .rocket-options { grid-template-columns: 1fr; }
  .rocket-swap { grid-template-columns: 1fr; }
  .rocket-swap-arrow { transform: rotate(90deg); }
}

/* Gym leader cinematic introduction, matching the villain encounter */
.leader-cinematic {
  position: relative;
  min-height: calc(100vh - 112px);
  overflow: hidden;
  padding: clamp(24px, 4vw, 52px);
  color: #f8f8fb;
  background-image: linear-gradient(125deg, rgba(5,9,16,.92), rgba(12,18,29,.58) 55%, rgba(5,9,16,.86)), var(--gym-bg) !important;
  background-size: cover !important;
  background-position: center !important;
}

.leader-cinematic::after {
  content: "★";
  position: absolute;
  right: -4vw;
  bottom: -15vh;
  color: rgba(255,255,255,.075);
  font-size: min(64vw, 680px);
  line-height: .8;
  transform: rotate(-10deg);
  pointer-events: none;
}

.leader-cinematic-intro {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(300px,.9fr) minmax(380px,1.1fr);
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
  width: min(1160px, 100%);
  min-height: calc(100vh - 210px);
  margin: 0 auto;
}

.leader-cinematic-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(330px, 52vh, 540px);
  overflow: hidden;
  border: 4px solid rgba(238,244,255,.88);
  border-radius: 22px;
  background-image: linear-gradient(rgba(9,15,25,.12), rgba(3,7,13,.58)), var(--gym-bg);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 4px rgba(5,8,14,.75), 0 22px 56px rgba(0,0,0,.52);
}

.leader-cinematic-stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 24%;
  background: linear-gradient(transparent, rgba(0,0,0,.45));
}

.leader-stage-badge {
  position: absolute;
  width: min(72%, 340px);
  opacity: .17;
  filter: grayscale(.2) drop-shadow(0 10px 18px rgba(0,0,0,.45));
}

.leader-cinematic-sprite {
  position: relative;
  z-index: 2;
  width: clamp(210px, 27vw, 330px);
  height: clamp(210px, 27vw, 330px);
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 20px 14px rgba(0,0,0,.7));
  animation: leader-cinematic-arrival .9s steps(8,end) both;
}

.leader-cinematic-sprite[src*="trainers-kalos"],
.prep-leader-sprite[src*="trainers-kalos"],
.leader-mini[src*="trainers-kalos"],
.leader-cinematic-sprite[src*="trainers-alola"],
.prep-leader-sprite[src*="trainers-alola"],
.leader-mini[src*="trainers-alola"],
.leader-cinematic-sprite[src*="trainers-galar"],
.prep-leader-sprite[src*="trainers-galar"],
.leader-mini[src*="trainers-galar"],
.leader-cinematic-sprite[src*="trainers-paldea"],
.prep-leader-sprite[src*="trainers-paldea"],
.leader-mini[src*="trainers-paldea"] {
  image-rendering: auto;
  animation: staticTrainerFloat 2.4s ease-in-out infinite;
}

.leader-cinematic-sprite[src*="trainers-kalos"],
.leader-cinematic-sprite[src*="trainers-alola"],
.leader-cinematic-sprite[src*="trainers-galar"],
.leader-cinematic-sprite[src*="trainers-paldea"] {
  animation: leader-cinematic-arrival .9s ease both, staticTrainerFloat 2.4s ease-in-out .9s infinite;
}

.rocket-grunt-sprite[src*="future-villains/alola"],
.rocket-grunt-sprite[src*="future-villains/galar"],
.rocket-grunt-sprite[src*="future-villains/paldea"] {
  image-rendering: auto;
  animation: rocket-arrival .85s ease both, staticTrainerFloat 2.4s ease-in-out .85s infinite;
}

@keyframes staticTrainerFloat {
  0%, 100% { transform: translateY(3px); }
  50% { transform: translateY(-5px); }
}

@media (prefers-reduced-motion: reduce) {
  .leader-cinematic-sprite[src*="trainers-alola"],
  .prep-leader-sprite[src*="trainers-alola"],
  .leader-mini[src*="trainers-alola"],
  .leader-cinematic-sprite[src*="trainers-galar"],
  .prep-leader-sprite[src*="trainers-galar"],
  .leader-mini[src*="trainers-galar"],
  .leader-cinematic-sprite[src*="trainers-paldea"],
  .prep-leader-sprite[src*="trainers-paldea"],
  .leader-mini[src*="trainers-paldea"],
  .rocket-grunt-sprite[src*="future-villains/alola"],
  .rocket-grunt-sprite[src*="future-villains/galar"],
  .rocket-grunt-sprite[src*="future-villains/paldea"] {
    animation: none !important;
  }
}

@keyframes leader-cinematic-arrival {
  from { opacity: 0; transform: translateX(280px) scale(.86); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.leader-cinematic-dialog {
  display: grid;
  gap: 15px;
  padding: clamp(26px, 4vw, 50px);
  border: 3px solid rgba(238,244,255,.92);
  border-left: 7px solid var(--accent-2);
  border-radius: 18px;
  background: rgba(13,19,29,.94);
  color: #f7f8fc;
  text-align: left;
  box-shadow: 0 22px 60px rgba(0,0,0,.5);
  backdrop-filter: blur(3px);
}

.leader-kicker { margin: 0; color: #79b9ff; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.leader-cinematic-dialog h2 { margin: 0; color: #fff; font-size: clamp(1.8rem, 3.4vw, 3.2rem); line-height: 1.05; }
.leader-cinematic-dialog > p:not(.leader-kicker) { margin: 0; color: #dce5f3; font-size: clamp(1rem,1.5vw,1.25rem); line-height: 1.55; }
.leader-rules-preview { display: flex; flex-wrap: wrap; gap: 9px; }
.leader-rules-preview span { padding: 7px 11px; border: 2px solid rgba(211,226,245,.48); border-radius: 999px; background: rgba(255,255,255,.07); color: #eaf2ff; font-weight: 850; }
.leader-cinematic-button { justify-self: start; margin-top: 5px; border-color: #b9dcff; background: linear-gradient(#397fc3,#22558c); color: #fff; }

@media (max-width: 760px) {
  .leader-cinematic { min-height: calc(100vh - 92px); padding: 58px 18px 24px; }
  .leader-cinematic-intro { grid-template-columns: 1fr; gap: 20px; min-height: 0; }
  .leader-cinematic-stage { min-height: 260px; }
  .leader-cinematic-sprite { width: 210px; height: 210px; }
  .leader-cinematic-dialog { padding: 24px; }
}

/* Responsive safety pass for leader battles and villain screens */
.shell { min-width: 0; }

.leader.gym-theme,
.rocket-screen,
.leader-cinematic {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* The gym-theme child rule previously turned this absolute button into a grid item. */
.leader.gym-theme > .phase-info-button,
.leader-cinematic > .phase-info-button,
.rocket-screen > .phase-info-button {
  position: absolute;
  top: clamp(10px, 2vh, 18px);
  right: clamp(10px, 2vw, 18px);
  left: auto;
  z-index: 20;
}

.leader.gym-theme {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  padding: clamp(10px, 2vw, 18px);
}

.leader.gym-bg .leader-round-head {
  position: relative;
  min-height: clamp(150px, 27vh, 225px);
  padding: 4px 52px 8px;
  align-content: start;
}

.leader.gym-bg .leader-round-head > div {
  width: min(520px, 100%);
}

.leader.gym-bg .leader-mini {
  position: static;
  order: 2;
  width: clamp(96px, 15vh, 142px);
  height: clamp(96px, 15vh, 142px);
  margin: 8px auto 0;
  transform: none;
  animation: leaderResponsiveIdle 1.2s steps(2) infinite;
}

@keyframes leaderResponsiveIdle {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.leader.gym-bg .leader-duel {
  width: min(900px, 100%);
  min-width: 0;
  margin: 0 auto;
  align-self: center;
  grid-template-columns: minmax(150px, 240px) minmax(210px, 360px) minmax(150px, 240px);
}

.leader.gym-bg .leader-choice,
.leader.gym-bg .leader-question {
  max-width: 100%;
}

.rocket-screen {
  padding: clamp(54px, 7vh, 72px) clamp(14px, 3vw, 42px) clamp(18px, 3vh, 34px);
  align-content: start;
}

.rocket-route {
  width: min(920px, calc(100% - 52px));
  margin-bottom: clamp(14px, 2.5vh, 30px);
}

.rocket-quiz-card,
.rocket-outcome {
  width: min(960px, 100%);
  max-width: 100%;
  margin-bottom: 8px;
}

.rocket-continue,
.rocket-outcome .rocket-primary {
  position: relative;
  z-index: 2;
  margin-bottom: 4px;
}

@media (max-width: 1050px) {
  .leader.gym-bg .leader-duel {
    grid-template-columns: minmax(140px, 1fr) minmax(210px, 1.25fr) minmax(140px, 1fr);
    gap: 10px;
  }

  .leader.gym-bg .leader-choice { width: 100%; padding: 12px 8px; }
  .leader.gym-bg .leader-choice .poke-art { height: clamp(88px, 14vh, 126px); }
  .leader.gym-bg .leader-question { padding: 14px 10px; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .shell { height: auto; min-height: calc(100vh - 16px); grid-template-rows: auto auto; }

  .leader.gym-theme,
  .rocket-screen,
  .leader-cinematic {
    height: auto;
    min-height: calc(100vh - 92px);
    overflow: visible;
  }

  .leader.gym-bg .leader-round-head { min-height: 0; padding: 4px 42px 8px; }
  .leader.gym-bg .leader-mini { width: 96px; height: 96px; }
  .leader.gym-bg .leader-duel { grid-template-columns: 1fr; width: min(430px, 100%); }
  .leader.gym-bg .leader-question { order: -1; width: 100%; }
  .leader.gym-bg .leader-choice { width: 100%; }

  .rocket-screen { padding: 58px 12px 22px; }
  .rocket-route { width: calc(100% - 44px); }
  .rocket-quiz-card, .rocket-outcome { padding: 18px 14px; }
}

@media (max-height: 800px) and (min-width: 761px) {
  .leader.gym-bg .leader-round-head { min-height: 128px; }
  .leader.gym-bg .leader-mini { width: 86px; height: 86px; margin-top: 3px; }
  .leader.gym-bg .leader-choice .poke-art { height: clamp(76px, 13vh, 104px); }
  .leader.gym-bg .leader-choice { padding: 10px 8px; }
  .leader.gym-bg .leader-question { padding: 12px; }

  .rocket-screen { padding-top: 48px; padding-bottom: 14px; }
  .rocket-route { margin-bottom: 10px; }
  .rocket-quiz-card, .rocket-outcome { padding: clamp(16px, 2.5vh, 24px); }
  .rocket-question { margin: clamp(14px, 2.5vh, 24px) auto; }
  .rocket-answer { min-height: 58px; padding: 10px; }
  .rocket-continue { margin-top: 16px; }
  .rocket-outcome-r { width: 62px; height: 62px; font-size: 2.8rem; margin-bottom: 8px; }
  .rocket-rewards, .rocket-swap { margin-top: 16px; }
  .rocket-swap .poke-art { width: 112px; height: 112px; }
}

/* Closed, container-responsive special screens (no visible scrollbars) */
.leader.gym-theme,
.rocket-screen,
.leader-cinematic {
  container-type: inline-size;
  overflow: hidden;
  scrollbar-gutter: auto;
}

.leader.gym-theme {
  grid-template-rows: minmax(0, 48%) minmax(0, 52%);
  padding: clamp(8px, 1.5vh, 14px) clamp(8px, 1.5vw, 16px);
}

.leader.gym-bg .leader-round-head {
  position: relative;
  min-height: 0;
  height: 100%;
  padding: 0 52px;
  display: block;
}

.leader.gym-bg .leader-round-head > div {
  position: relative;
  z-index: 2;
  width: min(650px, calc(100% - 80px));
  margin: 0 auto;
  padding: clamp(5px, 1vh, 9px) 14px;
}

.leader.gym-bg .leader-mini {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: clamp(-12px, -1.2vh, -4px);
  width: clamp(126px, 22vh, 172px);
  height: clamp(126px, 22vh, 172px);
  margin: 0;
  transform: translateX(-50%);
  animation: leaderLowerIdle 1.2s steps(2) infinite;
}

/* The Striaton trio shares one wide sprite sheet. Give it a wider stage box so
   the three leaders retain the same visual presence as an individual leader. */
.leader-battle-screen .leader-mini[src*="trio-gres"] {
  width: clamp(250px, 40vh, 340px);
  height: clamp(165px, 27vh, 225px);
}

@keyframes leaderLowerIdle {
  0%,100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

.leader.gym-bg .leader-duel {
  align-self: stretch;
  width: min(920px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(3px, .8vh, 8px) 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(8px, 1.5cqw, 18px);
  align-items: center;
}

.leader.gym-bg .leader-choice {
  justify-self: center;
  width: 100%;
  max-width: 240px;
  max-height: 100%;
  min-width: 0;
  padding: clamp(7px, 1.5vh, 14px) clamp(5px, 1cqw, 12px);
}

.leader.gym-bg .leader-choice .poke-art {
  width: 100%;
  height: clamp(88px, 17vh, 142px);
  max-width: 100%;
}

.leader.gym-bg .leader-question {
  justify-self: center;
  width: 100%;
  max-width: 380px;
  max-height: 100%;
  min-width: 0;
  padding: clamp(10px, 2vh, 18px) clamp(8px, 1.5cqw, 18px);
}

.leader.gym-bg .leader-question p {
  font-size: clamp(1rem, 2.3cqw, 1.62rem);
}

.rocket-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: clamp(46px, 7vh, 66px) clamp(12px, 2.5vw, 34px) clamp(10px, 2vh, 22px);
}

.rocket-route {
  width: min(920px, calc(100% - 44px));
  margin: 0 auto clamp(8px, 1.5vh, 18px);
}

.rocket-intro,
.rocket-quiz-card,
.rocket-outcome {
  align-self: center;
  max-height: 100%;
  min-height: 0;
}

.rocket-quiz-card,
.rocket-outcome {
  overflow: hidden;
  padding: clamp(14px, 2.5vh, 30px) clamp(14px, 3cqw, 36px);
}

.rocket-question { margin: clamp(12px, 2.5vh, 28px) auto; }
.rocket-answer { min-height: clamp(50px, 9vh, 76px); padding: clamp(8px, 1.5vh, 14px); }
.rocket-continue { margin-top: clamp(10px, 2vh, 22px); }
.rocket-outcome-r { width: clamp(52px, 9vh, 78px); height: clamp(52px, 9vh, 78px); font-size: clamp(2.3rem, 6vh, 3.5rem); }
.rocket-rewards, .rocket-swap { margin-top: clamp(10px, 2vh, 22px); }
.rocket-swap .poke-art { width: clamp(88px, 16vh, 138px); height: clamp(88px, 16vh, 138px); }

@media (max-width: 760px) {
  .leader.gym-theme,
  .rocket-screen,
  .leader-cinematic {
    overflow: hidden;
  }

  .leader.gym-theme {
    min-height: 680px;
    grid-template-rows: 220px minmax(0, 1fr);
  }

  .leader.gym-bg .leader-round-head { padding: 0 38px; }
  .leader.gym-bg .leader-round-head > div { width: 100%; }
  .leader.gym-bg .leader-mini { width: 138px; height: 138px; bottom: -8px; }
  .leader.gym-bg .leader-duel { grid-template-columns: 1fr; width: min(390px, 100%); gap: 7px; }
  .leader.gym-bg .leader-question { order: -1; padding: 9px; }
  .leader.gym-bg .leader-choice { max-width: 100%; grid-template-columns: 105px 1fr; }
  .leader.gym-bg .leader-choice .poke-art { width: 105px; height: 105px; }

  .rocket-screen { min-height: 680px; grid-template-rows: auto minmax(0, 1fr); }
}

/* Starter Poké Ball reveal */
.starter.starter-cinematic {
  --starter-delay: calc(var(--starter-index) * .3s);
  min-height: clamp(220px, 39vh, 320px);
  padding: clamp(8px, 1.5vw, 14px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 5px;
  overflow: hidden;
  animation: starter-card-arrival .35s ease both;
  animation-delay: var(--starter-delay);
}

.starter-reveal {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  isolation: isolate;
}

.starter-ball {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: clamp(70px, 9vw, 98px);
  aspect-ratio: 1;
  transform: translate(-50%, -240%);
  filter: drop-shadow(0 9px 4px rgba(0,0,0,.35));
  animation: starter-ball-sequence 1.25s cubic-bezier(.2,.75,.28,1) both;
  animation-delay: var(--starter-delay);
}

.starter-ball-top,
.starter-ball-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  border: clamp(4px, .45vw, 6px) solid #20242c;
  animation-duration: .34s;
  animation-timing-function: cubic-bezier(.2,.8,.25,1);
  animation-fill-mode: both;
  animation-delay: calc(var(--starter-delay) + .96s);
}

.starter-ball-top {
  top: 0;
  border-bottom-width: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(145deg, #ff6b65 0 22%, #e62f37 23% 100%);
  animation-name: starter-ball-open-top;
}

.starter-ball-bottom {
  bottom: 0;
  border-top-width: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(145deg, #fff 0 58%, #dfe4ec 59% 100%);
  animation-name: starter-ball-open-bottom;
}

.starter-ball-band {
  position: absolute;
  z-index: 2;
  top: 44%;
  left: 1%;
  width: 98%;
  height: 12%;
  border-radius: 3px;
  background: #20242c;
  animation: starter-band-open .28s ease both calc(var(--starter-delay) + .98s);
}

.starter-ball-button {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 27%;
  aspect-ratio: 1;
  border: clamp(4px, .4vw, 5px) solid #20242c;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 3px #cbd2dc;
  animation: starter-button-flash .28s steps(2) 2 both calc(var(--starter-delay) + .7s), starter-band-open .28s ease both calc(var(--starter-delay) + .98s);
}

.starter-flash {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: clamp(80px, 12vw, 140px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.15);
  background: radial-gradient(circle, #fff 0 18%, #fff7a5 32%, rgba(103,204,255,.72) 48%, transparent 72%);
  mix-blend-mode: screen;
  animation: starter-release-flash .52s ease-out both calc(var(--starter-delay) + .96s);
}

.starter-particles {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
}

.starter-particles i {
  --px: 0px;
  --py: -80px;
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
  background: #fff6a1;
  box-shadow: 0 0 8px #fff, 0 0 14px #69cfff;
  transform: translate(-50%, -50%) scale(.2) rotate(45deg);
  animation: starter-particle-burst .58s ease-out both calc(var(--starter-delay) + 1s);
}

.starter-particles i:nth-child(1) { --px: 0px; --py: -92px; }
.starter-particles i:nth-child(2) { --px: 66px; --py: -66px; }
.starter-particles i:nth-child(3) { --px: 92px; --py: 0px; }
.starter-particles i:nth-child(4) { --px: 66px; --py: 66px; }
.starter-particles i:nth-child(5) { --px: 0px; --py: 92px; }
.starter-particles i:nth-child(6) { --px: -66px; --py: 66px; }
.starter-particles i:nth-child(7) { --px: -92px; --py: 0px; }
.starter-particles i:nth-child(8) { --px: -66px; --py: -66px; }

.starter.starter-cinematic .starter-pokemon {
  position: relative;
  z-index: 2;
  width: min(100%, 220px);
  height: clamp(118px, 23vh, 190px);
  max-height: none;
  object-fit: contain;
  opacity: 0;
  transform: scale(.12) translateY(34px);
  filter: brightness(2.6) saturate(.25) drop-shadow(0 12px 8px rgba(0,0,0,.24));
  animation: starter-pokemon-release .62s cubic-bezier(.18,1.25,.32,1) both calc(var(--starter-delay) + 1.05s);
}

.starter-name {
  opacity: 0;
  transform: translateY(8px);
  animation: starter-name-reveal .3s ease both calc(var(--starter-delay) + 1.48s);
}

@keyframes starter-card-arrival {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes starter-ball-sequence {
  0% { opacity: 0; transform: translate(-50%, -250%) rotate(-25deg); }
  18% { opacity: 1; }
  54% { transform: translate(-50%, -42%) rotate(12deg); }
  67% { transform: translate(-50%, -76%) rotate(-9deg); }
  78% { transform: translate(-50%, -50%) rotate(5deg); }
  88% { transform: translate(-50%, -60%) rotate(-3deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(0); }
}

@keyframes starter-ball-open-top { to { opacity: 0; transform: translateY(-38px) rotate(-13deg); } }
@keyframes starter-ball-open-bottom { to { opacity: 0; transform: translateY(38px) rotate(9deg); } }
@keyframes starter-band-open { to { opacity: 0; transform: scaleX(.35); } }
@keyframes starter-button-flash { 0%,100% { background:#fff; } 50% { background:#80e9ff; box-shadow:0 0 18px #fff; } }

@keyframes starter-release-flash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.12); }
  38% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.85); }
}

@keyframes starter-particle-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(45deg); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--px)), calc(-50% + var(--py))) scale(1) rotate(135deg); }
}

@keyframes starter-pokemon-release {
  0% { opacity: 0; transform: scale(.12) translateY(34px); filter: brightness(3) saturate(0); }
  48% { opacity: 1; filter: brightness(2.2) saturate(.35) drop-shadow(0 0 18px #fff); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: brightness(1) saturate(1) drop-shadow(0 12px 8px rgba(0,0,0,.24)); }
}

@keyframes starter-name-reveal { to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .starter.starter-cinematic { min-height: 205px; }
  .starter.starter-cinematic .starter-pokemon { height: 112px; }
  .starter-ball { width: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  .starter.starter-cinematic,
  .starter-ball,
  .starter-ball-top,
  .starter-ball-bottom,
  .starter-ball-band,
  .starter-ball-button,
  .starter-flash,
  .starter-particles i,
  .starter.starter-cinematic .starter-pokemon,
  .starter-name {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
  }
}

/* Pixel-art heart variants for damage and healing */
.life-loss-heart {
  --heart-pixel-size: clamp(10px, 1.25vw, 16px);
  width: calc(var(--heart-pixel-size) * 9);
  height: calc(var(--heart-pixel-size) * 8);
  display: grid;
  place-items: center;
  font-size: 0;
}

.pixel-heart-large {
  display: grid;
  grid-template-columns: repeat(var(--heart-cols), var(--heart-pixel-size));
  grid-template-rows: repeat(var(--heart-rows), var(--heart-pixel-size));
  width: max-content;
  height: max-content;
  filter: drop-shadow(calc(var(--heart-pixel-size) * .45) calc(var(--heart-pixel-size) * .6) 0 rgba(35,0,8,.42));
}

.pixel-heart-large i { width: var(--heart-pixel-size); height: var(--heart-pixel-size); }
.pixel-heart-large .heart-empty { background: transparent; }
.pixel-heart-large .heart-pixel {
  background: #e92246;
  box-shadow: inset calc(var(--heart-pixel-size) * .18) calc(var(--heart-pixel-size) * .18) 0 rgba(255,132,151,.7), inset calc(var(--heart-pixel-size) * -.16) calc(var(--heart-pixel-size) * -.16) 0 #9d0c27;
}
.pixel-heart-large .heart-outline { background: #15171c; box-shadow: inset 2px 2px 0 #30333b; }
.pixel-heart-large .heart-shine { background: #fff; box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #ffdce3; }
.pixel-heart-large.broken .heart-left-piece { transform: translate(-5px, 2px); }
.pixel-heart-large.broken .heart-right-piece { transform: translate(5px, -2px); }

.life-effect-overlay.loss .pixel-heart-large { animation: pixel-heart-break 1.35s steps(2,end) both; }
.life-effect-overlay.gain .pixel-heart-large { animation: pixel-heart-heal 1.35s cubic-bezier(.2,.9,.25,1) both; }
.life-effect-overlay.gain .pixel-heart-large .heart-pixel {
  background: #ff3659;
  box-shadow: inset calc(var(--heart-pixel-size) * .18) calc(var(--heart-pixel-size) * .18) 0 #ffbdc9, inset calc(var(--heart-pixel-size) * -.16) calc(var(--heart-pixel-size) * -.16) 0 #bd1234, 0 0 calc(var(--heart-pixel-size) * .65) rgba(255,238,137,.85);
}

.life-effect-overlay.gain { animation-name: life-gain-backdrop; }
.life-effect-overlay.gain .life-effect-impact { animation-name: life-gain-impact; }
.life-effect-overlay.gain .life-loss-heart { animation: healed-heart-glow 1.35s ease both; }

.life-effect-overlay .life-loss-heart.emoji-heart {
  width: auto;
  height: auto;
  display: block;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: clamp(6rem, 14vw, 10rem);
  line-height: 1;
  filter: drop-shadow(0 12px 7px rgba(0,0,0,.48));
}

.life-effect-overlay.loss .life-loss-heart.emoji-heart { animation: broken-heart-shake 1.35s ease both; }
.life-effect-overlay.gain .life-loss-heart.emoji-heart { animation: healed-heart-glow 1.35s ease both; }

/* Pokémon Gym emblem in route and phase information */
.node.gym-node { padding: 2px; overflow: hidden; background: #eef4d7; }
.gym-node-icon { display: block; width: 100%; height: 100%; object-fit: contain; }
.node.gym-node.now { background: #fff3a6; }
.node.gym-node.done { background: #b9efc9; }
.phase-info-symbol.gym-info-symbol { padding: 5px; background: #f2f6df; }
.phase-info-symbol.gym-info-symbol img { width: 100%; height: 100%; object-fit: contain; }

/* Final route stop before the Gym Leader */
.event-gym-stop {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: clamp(14px, 2.5vw, 28px);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(10px, 2vh, 18px);
  color: #f5f8ff;
  background-image: linear-gradient(115deg, rgba(7,13,23,.96), rgba(13,24,39,.77) 55%, rgba(7,13,23,.92)), var(--event-gym-bg);
  background-size: cover;
  background-position: center;
  text-align: left;
}

.event-gym-stop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 15% 10%, rgba(118,188,255,.2), transparent 30%), radial-gradient(circle at 86% 88%, rgba(255,210,82,.13), transparent 28%);
  pointer-events: none;
}

.event-gym-stop > * { position: relative; z-index: 1; }

.event-gym-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(16px, 2.5vw, 30px);
  align-items: center;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: clamp(12px, 2vh, 20px) clamp(15px, 2.5vw, 28px);
  border: 2px solid rgba(216,232,252,.55);
  border-radius: 16px;
  background: rgba(10,18,30,.76);
  box-shadow: 0 12px 30px rgba(0,0,0,.34);
  backdrop-filter: blur(3px);
}

.event-gym-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(82px, 10vw, 118px);
  aspect-ratio: 1;
  border: 3px solid rgba(244,249,255,.85);
  border-radius: 50%;
  background: rgba(238,244,221,.95);
  box-shadow: 0 0 0 6px rgba(76,145,211,.18), 0 10px 24px rgba(0,0,0,.38);
  animation: event-seal-arrival .7s cubic-bezier(.2,1.2,.3,1) both;
}

.event-gym-seal > img:first-child { width: 76%; height: 76%; object-fit: contain; }
.event-next-badge { position: absolute; right: -8px; bottom: -8px; width: 42%; height: 42%; object-fit: contain; padding: 4px; border: 2px solid #f4f7ff; border-radius: 50%; background: #202b3b; filter: drop-shadow(0 4px 3px rgba(0,0,0,.4)); animation: event-badge-pulse 1.6s ease-in-out infinite; }
.event-kicker { margin-bottom: 5px; color: #80c7ff; font-size: clamp(.72rem, 1vw, .9rem); font-weight: 950; letter-spacing: .14em; text-transform: uppercase; }
.event-gym-header h2 { color: #fff; font-size: clamp(1.35rem, 2.6vw, 2.25rem); line-height: 1.08; }
.event-gym-header div > p:last-child { max-width: 760px; margin-top: 8px; color: #d7e3f2; font-size: clamp(.88rem, 1.25vw, 1.05rem); line-height: 1.4; font-weight: 700; }

.event-route-status {
  display: grid;
  grid-template-columns: auto minmax(50px, 240px) auto;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: #dce8f7;
  font-size: clamp(.74rem, 1.1vw, .9rem);
  font-weight: 900;
}
.event-route-status span { color: #7ee2aa; }
.event-route-status strong { color: #ffe07a; }
.event-route-status i { height: 3px; border-radius: 999px; background: linear-gradient(90deg,#62dba4,#ffe071); animation: event-path-glow 1.8s ease-in-out infinite; }

.event-choice-grid {
  align-self: stretch;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(1100px, 100%);
  min-height: 0;
  margin: 0 auto;
  gap: clamp(10px, 1.6vw, 18px);
}

.event-choice {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: clamp(12px, 2vh, 20px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  justify-items: center;
  align-content: center;
  gap: clamp(7px, 1.2vh, 12px);
  border: 3px solid rgba(207,223,245,.62);
  border-radius: 16px;
  background: rgba(14,23,36,.9);
  color: #f4f8ff;
  text-align: center;
  box-shadow: 0 12px 25px rgba(0,0,0,.34);
  cursor: pointer;
  isolation: isolate;
  animation: event-choice-arrival .55s ease both calc(var(--event-index) * .13s);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.event-choice::before { display: none; }
.event-choice:hover { transform: translateY(-6px); border-color: #fff; background: rgba(25,39,58,.97); }
.event-choice-glow { position: absolute; z-index: -1; inset: auto -20% -48% -20%; height: 72%; border-radius: 50%; opacity: .26; filter: blur(22px); transition: opacity .16s; }
.event-choice:hover .event-choice-glow { opacity: .48; }
.event-find .event-choice-glow { background: #51aaff; }
.event-shop .event-choice-glow { background: #ffcf54; }
.event-dojo .event-choice-glow { background: #df6cff; }

.event-choice-art {
  display: grid;
  place-items: center;
  width: clamp(58px, 8vh, 82px);
  height: clamp(58px, 8vh, 82px);
  border: 3px solid rgba(233,241,252,.75);
  border-radius: 50%;
  background: rgba(239,246,218,.95);
  box-shadow: 0 7px 16px rgba(0,0,0,.32);
  animation: event-art-float 1.8s ease-in-out infinite calc(var(--event-index) * .18s);
}
.event-choice-art .item-icon { width: 62%; height: 62%; object-fit: contain; }
.event-dojo-art { font-size: clamp(2rem, 4vw, 3rem); }
.event-choice-copy { display: grid; gap: 5px; justify-items: center; }
.event-choice-copy small { color: #8ecaff; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.event-choice-copy strong { color: #fff; font-size: clamp(1rem, 1.6vw, 1.28rem); line-height: 1.1; }
.event-choice-copy > span { color: #cdd9e9; font-size: clamp(.76rem, 1vw, .9rem); line-height: 1.3; font-weight: 700; }
.event-reward { align-self: center; width: 100%; padding: 7px 8px; border: 1px solid rgba(216,229,247,.28); border-radius: 7px; background: rgba(255,255,255,.06); color: #f7df8b; font-size: clamp(.7rem, .9vw, .82rem); line-height: 1.25; font-weight: 850; }
.event-pick { padding: 7px 15px; border-radius: 999px; background: #397fc3; color: #fff; font-size: .82rem; font-weight: 950; transition: transform .16s, background .16s; }
.event-shop .event-pick { background: #a87513; }
.event-dojo .event-pick { background: #7b3ba2; }
.event-choice:hover .event-pick { transform: translateX(4px); filter: brightness(1.15); }

@keyframes event-seal-arrival { from { opacity:0; transform:scale(.35) rotate(-24deg); } to { opacity:1; transform:scale(1) rotate(0); } }
@keyframes event-badge-pulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.12) rotate(5deg); } }
@keyframes event-path-glow { 0%,100% { opacity:.45; } 50% { opacity:1; box-shadow:0 0 10px #ffe071; } }
@keyframes event-choice-arrival { from { opacity:0; transform:translateY(26px); } to { opacity:1; transform:translateY(0); } }
@keyframes event-art-float { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-6px); } }

@media (max-width: 760px) {
  .event-gym-stop { height: auto; min-height: 760px; overflow: visible; }
  .event-gym-header { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .event-route-status { grid-template-columns: auto 40px auto; }
  .event-choice-grid { grid-template-columns: 1fr; }
  .event-choice { min-height: 220px; }
}

@media (max-height: 720px) and (min-width: 761px) {
  .event-gym-stop { padding: 10px 14px; gap: 8px; }
  .event-gym-header { padding: 8px 16px; }
  .event-gym-seal { width: 72px; }
  .event-gym-header div > p:last-child { margin-top: 4px; }
  .event-choice { padding: 9px; gap: 5px; }
  .event-choice-art { width: 54px; height: 54px; }
  .event-reward { padding: 5px; }
}

/* Preparation result and entrance to the Gym */
.prep-ready-screen {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: clamp(16px, 3vw, 34px);
  color: #f4f8ff;
  background-image: linear-gradient(120deg, rgba(6,12,21,.96), rgba(12,23,38,.68) 50%, rgba(6,12,21,.94)), var(--prep-gym-bg);
  background-size: cover;
  background-position: center;
}

.prep-ready-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 23% 50%, rgba(87,181,255,.18), transparent 30%), radial-gradient(circle at 78% 45%, rgba(255,212,91,.16), transparent 31%);
  pointer-events: none;
}

.prep-ready-stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, .9fr) clamp(70px, 9vw, 120px) minmax(300px, 1.1fr);
  align-items: center;
  width: min(1040px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
}

.prep-result,
.prep-leader-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: clamp(20px, 3vw, 36px);
  border: 3px solid rgba(218,232,250,.7);
  border-radius: 20px;
  background: rgba(12,21,34,.91);
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
  backdrop-filter: blur(3px);
}

.prep-result {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(10px, 2vh, 18px);
  text-align: center;
  animation: prep-result-arrival .65s cubic-bezier(.2,1,.3,1) both;
}

.prep-result::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -25%;
  right: -25%;
  bottom: -42%;
  height: 62%;
  border-radius: 50%;
  opacity: .3;
  filter: blur(24px);
  background: #58aaff;
}
.prep-result.prep-shop::after { background:#ffd457; }
.prep-result.prep-dojo::after { background:#d06aff; }

.prep-kicker { color: #83c9ff; font-size: clamp(.72rem, 1vw, .88rem); font-weight: 950; letter-spacing: .13em; text-transform: uppercase; }
.prep-result h2 { color:#fff; font-size:clamp(1.35rem,2.5vw,2.1rem); }
.prep-result > p:not(.prep-kicker) { color:#d5e0ef; font-size:clamp(.86rem,1.15vw,1rem); line-height:1.45; font-weight:700; }

.prep-result-art {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(110px, 16vh, 150px);
  height: clamp(110px, 16vh, 150px);
  border: 4px solid rgba(246,250,255,.9);
  border-radius: 50%;
  background: rgba(239,246,218,.96);
  box-shadow: 0 0 0 8px rgba(105,183,255,.14), 0 14px 24px rgba(0,0,0,.36);
  animation: prep-art-float 1.8s ease-in-out infinite;
}
.prep-result-art .item-icon, .prep-result-art > img { width:64%; height:64%; object-fit:contain; }
.prep-heart-art { position:relative; color:#e92b4d; font-size:clamp(4rem,8vw,6rem); line-height:1; text-shadow:4px 5px 0 #8d1028; }
.prep-heart-art b { position:absolute; right:-15px; top:-7px; display:grid; place-items:center; width:34px; height:34px; border:3px solid #fff; border-radius:50%; background:#36a86e; color:#fff; font-size:1.25rem; text-shadow:none; }
.prep-spark { position:absolute; color:#fff7a7; font-size:1.2rem; text-shadow:0 0 9px #fff; animation:prep-sparkle 1.15s steps(2) infinite; }
.prep-spark.s1 { left:-16px; top:10%; }
.prep-spark.s2 { right:-18px; top:28%; animation-delay:.3s; }
.prep-spark.s3 { right:4px; bottom:-12px; animation-delay:.6s; }
.prep-confirm { padding:8px 13px; border:2px solid rgba(126,229,171,.62); border-radius:999px; background:rgba(25,116,72,.35); color:#8ff0b8; font-size:.82rem; font-weight:950; }

.prep-path { position:relative; display:grid; place-items:center; align-self:stretch; }
.prep-path i { width:100%; height:4px; background:linear-gradient(90deg,#5eb9f3,#ffe273); box-shadow:0 0 12px rgba(255,225,105,.65); animation:prep-path-flow 1.5s ease-in-out infinite; }
.prep-path img { position:absolute; width:clamp(50px,6vw,72px); aspect-ratio:1; object-fit:contain; padding:6px; border:3px solid #f0f5ff; border-radius:50%; background:#eef4d7; filter:drop-shadow(0 8px 8px rgba(0,0,0,.42)); animation:prep-emblem-spin .75s cubic-bezier(.2,1.2,.3,1) both .35s; }

.prep-leader-card {
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto auto;
  gap:clamp(8px,1.5vh,14px);
  align-self:stretch;
  text-align:center;
  animation:prep-leader-arrival .65s ease both .18s;
}
.prep-gym-label { display:flex; align-items:center; justify-content:center; gap:10px; }
.prep-gym-label > img { width:48px; height:48px; object-fit:contain; padding:4px; border:2px solid rgba(235,243,255,.7); border-radius:50%; background:#263346; }
.prep-gym-label span { display:grid; text-align:left; }
.prep-gym-label small { color:#8fcaff; font-weight:900; letter-spacing:.09em; text-transform:uppercase; }
.prep-gym-label strong { color:#fff; font-size:clamp(1.2rem,2vw,1.7rem); }
.prep-leader-stage { position:relative; display:grid; place-items:center; min-height:0; overflow:hidden; border:2px solid rgba(213,228,247,.4); border-radius:14px; background-image:linear-gradient(rgba(7,13,22,.2),rgba(7,13,22,.6)),var(--prep-gym-bg); background-size:cover; background-position:center; }
.prep-gym-emblem { position:absolute; display:grid; place-items:center; width:min(62%,210px); aspect-ratio:1; opacity:.15; }
.prep-gym-emblem img { width:100%; height:100%; object-fit:contain; }
.prep-leader-sprite { position:relative; z-index:2; width:clamp(135px,22vh,205px); height:clamp(135px,22vh,205px); object-fit:contain; image-rendering:pixelated; filter:drop-shadow(0 15px 9px rgba(0,0,0,.58)); animation:prep-leader-idle 1.3s steps(2) infinite; }
.prep-leader-card > p { color:#d5e0ef; font-size:clamp(.78rem,1vw,.9rem); line-height:1.35; font-weight:750; }
.prep-challenge-button { justify-self:center; min-width:min(260px,100%); padding:9px 18px; display:grid; gap:1px; border-color:#ffe278; background:linear-gradient(#e0463e,#a91f27); color:#fff; box-shadow:0 5px 0 #66131b,0 0 20px rgba(255,214,85,.18); }
.prep-challenge-button span { font-size:.7rem; opacity:.82; text-transform:uppercase; letter-spacing:.08em; }
.prep-challenge-button strong { font-size:1rem; }
.prep-challenge-button:hover { transform:translateY(2px); box-shadow:0 3px 0 #66131b,0 0 25px rgba(255,214,85,.35); }

@keyframes prep-result-arrival { from { opacity:0; transform:translateX(-45px) scale(.94); } to { opacity:1; transform:none; } }
@keyframes prep-leader-arrival { from { opacity:0; transform:translateX(45px) scale(.94); } to { opacity:1; transform:none; } }
@keyframes prep-art-float { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-7px); } }
@keyframes prep-sparkle { 0%,100% { opacity:.2; transform:scale(.7) rotate(0); } 50% { opacity:1; transform:scale(1.2) rotate(45deg); } }
@keyframes prep-path-flow { 0%,100% { opacity:.42; transform:scaleX(.78); } 50% { opacity:1; transform:scaleX(1); } }
@keyframes prep-emblem-spin { from { opacity:0; transform:scale(.3) rotate(-90deg); } to { opacity:1; transform:scale(1) rotate(0); } }
@keyframes prep-leader-idle { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-5px); } }

@media (max-width:760px) {
  .prep-ready-screen { height:auto; min-height:820px; overflow:visible; }
  .prep-ready-stage { grid-template-columns:1fr; gap:12px; height:auto; }
  .prep-path { min-height:65px; }
  .prep-path i { width:4px; height:100%; background:linear-gradient(#5eb9f3,#ffe273); }
  .prep-leader-card { min-height:430px; }
}

@media (max-height:720px) and (min-width:761px) {
  .prep-ready-screen { padding:12px 20px; }
  .prep-result,.prep-leader-card { padding:16px; }
  .prep-result-art { width:96px; height:96px; }
  .prep-leader-sprite { width:125px; height:125px; }
}

/* Unified Trainer HUD */
.trainer-hud {
  position: relative;
  overflow: hidden;
  min-height: 58px;
  grid-template-columns:auto minmax(190px,1fr) minmax(190px,330px) auto;
  border-color: #879bad;
  background: linear-gradient(105deg, #fffaf0 0%, #edf4ed 52%, #dcebf2 100%);
  color: #172638;
  box-shadow: 0 5px 0 rgba(38,58,72,.28), inset 0 1px 0 rgba(255,255,255,.85);
}
.trainer-hud::before { content:""; position:absolute; inset:0 auto 0 0; width:6px; background:linear-gradient(#ef4350,#a71928); }
.trainer-hud::after { content:""; position:absolute; top:-55px; left:30%; width:340px; height:110px; transform:rotate(-12deg); background:linear-gradient(90deg,transparent,rgba(96,178,255,.09),transparent); pointer-events:none; }
.trainer-hud > * { position:relative; z-index:1; }
.trainer-hud .hud-menu { border-color:#425b72; background:#f8edc8; color:#172638; box-shadow:2px 3px 0 #9da9aa; }
.trainer-hud .logo { filter:drop-shadow(0 2px 2px rgba(20,47,66,.32)); }
.trainer-hud .brand { gap:10px; }
.trainer-hud .brand-copy { display:grid; gap:1px; }
.hud-wordmark { display:block; width:100%; max-width:330px; height:48px; margin:auto; object-fit:contain; filter:drop-shadow(0 2px 2px rgba(18,49,67,.24)); }
.trainer-hud .hud-region { color:#2879aa; font-size:.56rem; line-height:1; font-weight:950; letter-spacing:.15em; }
.trainer-hud h1 { color:#172638; line-height:1.05; text-shadow:2px 2px 0 #fff; }
.trainer-hud .brand .sub { display:flex; gap:6px; color:#526b7c; font-size:.75rem; }
.trainer-hud .brand .sub strong { color:#9b6810; }
.trainer-hud .life-pill { display:grid; grid-template-columns:auto auto; border-color:#6e8291; background:#fffdf5; color:#172638; box-shadow:inset 0 0 0 2px rgba(35,70,91,.05); }
.trainer-hud .life-pill small { color:#4e6677; font-size:.62rem; letter-spacing:.09em; text-transform:uppercase; }
.trainer-hud .badge-token { border-color:#82929d; background:#e9ece9; }
.trainer-hud .badge-token.earned { border-color:#45657c; background:#f9f3d5; box-shadow:0 0 9px rgba(50,116,155,.22); }
:root.dark .trainer-hud { border-color:#b9cde2; background:linear-gradient(105deg,#101b2a 0%,#17283d 52%,#101927 100%); color:#f5f9ff; box-shadow:0 5px 0 rgba(8,16,27,.42),inset 0 1px 0 rgba(255,255,255,.11); }
:root.dark .trainer-hud .hud-menu { border-color:#dbe8f6; background:#233a54; color:#fff; box-shadow:2px 3px 0 #07101c; }
:root.dark .trainer-hud .logo { filter:drop-shadow(0 2px 3px rgba(0,0,0,.58)); }
:root.dark .trainer-hud .hud-wordmark { filter:drop-shadow(0 2px 4px rgba(0,0,0,.66)); }
:root.dark .trainer-hud .hud-region { color:#72bdff; }
:root.dark .trainer-hud h1 { color:#fff; text-shadow:2px 2px 0 #07101b; }
:root.dark .trainer-hud .brand .sub { color:#b8cbe0; }
:root.dark .trainer-hud .brand .sub strong { color:#f1d876; }
:root.dark .trainer-hud .life-pill { border-color:#748ba3; background:#0c1522; color:#fff; box-shadow:inset 0 0 0 2px rgba(255,255,255,.04); }
:root.dark .trainer-hud .life-pill small { color:#91a9c1; }
:root.dark .trainer-hud .badge-token { border-color:#566a80; background:#080e17; }
:root.dark .trainer-hud .badge-token.earned { border-color:#d9e7f5; background:#263a50; box-shadow:0 0 9px rgba(103,187,255,.32); }

/* Starter selection as illuminated trainer cards */
.hero { position:relative; isolation:isolate; }
.hero::after { content:""; position:absolute; z-index:-1; inset:0; background:linear-gradient(180deg,rgba(255,255,255,.02),rgba(7,25,37,.16)); pointer-events:none; }
.starters { gap:clamp(12px,1.8vw,22px); }
.starter.starter-cinematic {
  position:relative;
  border:3px solid rgba(35,62,83,.92);
  border-radius:16px;
  background:linear-gradient(160deg,rgba(245,251,242,.72),rgba(210,239,219,.48));
  box-shadow:0 14px 28px rgba(14,45,55,.22),inset 0 0 0 2px rgba(255,255,255,.45);
  backdrop-filter:blur(2px);
  transition:transform .2s ease,border-color .2s,box-shadow .2s,background .2s;
}
.starter.starter-cinematic::before { content:""; position:absolute; inset:-40% 20% 38%; border-radius:50%; background:radial-gradient(circle,rgba(255,255,255,.7),transparent 68%); opacity:.25; transition:opacity .2s; pointer-events:none; }
.starter.starter-cinematic:hover { transform:translateY(-7px); border-color:#fff; background:linear-gradient(160deg,rgba(244,255,248,.9),rgba(173,226,204,.72)); box-shadow:0 18px 34px rgba(6,35,47,.3),0 0 0 5px rgba(107,203,255,.22),inset 0 0 0 2px rgba(255,255,255,.7); }
.starter.starter-cinematic:hover::before { opacity:.75; }
.starter-slot { position:absolute; z-index:7; top:12px; left:12px; padding:5px 9px; border:2px solid rgba(33,61,82,.65); border-radius:999px; background:rgba(240,249,229,.82); color:#24445c; font-size:.62rem; font-weight:950; letter-spacing:.1em; }
.starter-choice-footer { position:relative; z-index:6; display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; width:100%; padding:10px 12px; border:2px solid rgba(31,58,79,.55); border-radius:9px; background:rgba(9,28,43,.84); color:#fff; box-shadow:0 5px 12px rgba(0,0,0,.2); }
.starter-choice-footer .starter-name { color:#fff; text-align:left; font-size:clamp(.95rem,1.5vw,1.16rem); }
.starter-choice-footer > span { color:#9ed9ff; font-size:.68rem; font-weight:900; opacity:0; transform:translateX(-7px); transition:.2s; }
.starter.starter-cinematic:hover .starter-choice-footer > span { opacity:1; transform:none; }

/* Route challenge screen */
.gym-route-screen {
  position:relative;
  isolation:isolate;
  border-color:#71899c;
  background-image:linear-gradient(110deg,rgba(249,246,232,.94),rgba(225,239,232,.88)),var(--route-gym-bg);
  background-size:cover;
  background-position:center;
}
.gym-route-screen::before { content:""; position:absolute; z-index:-1; inset:0; background:radial-gradient(circle at 80% 15%,rgba(74,151,190,.13),transparent 30%); }
.route-partner { position:relative; border-right-color:#8a9eaa; background:linear-gradient(180deg,rgba(239,246,226,.97),rgba(214,233,210,.97)); color:#183048; }
.partner-kicker,.partner-bag-label { color:#287ba8; font-size:.6rem; font-weight:950; letter-spacing:.14em; text-align:center; width:100%; }
.partner-pokemon { padding:8px; border:2px solid rgba(65,103,126,.42); border-radius:12px; background:radial-gradient(circle at 50% 40%,rgba(255,255,255,.82),rgba(174,211,194,.42)); }
.partner-pokemon .name { color:#183048; font-size:1.02rem; }
.route-partner .item-row { display:grid; width:100%; gap:5px; }
.route-partner .item-btn { width:100%; border-color:#718999; background:#f8f3dd; color:#183048; box-shadow:none; border-radius:7px; }
.route-partner .item-btn:not(:disabled):hover { border-color:#3c789b; background:#fff9df; transform:translateX(2px); }
.route-partner .item-btn:disabled { opacity:.38; }
.route-challenge-panel { position:relative; color:#172638; background:rgba(255,252,241,.82); backdrop-filter:blur(2px); }
.route-challenge-panel .route { padding:4px 0; }
.route-challenge-panel .node { border-color:#71879a; border-radius:5px; background:#edf3f3; color:#24394b; box-shadow:0 3px 0 rgba(49,65,74,.22); }
.route-challenge-panel .node.done { background:#267a59; color:#eafff2; }
.route-challenge-panel .node.now { background:#e3b83f; color:#241b05; border-color:#fff0a4; }
.route-challenge-head { display:grid; gap:3px; text-align:center; }
.route-challenge-head > span { color:#287ba8; font-size:.62rem; font-weight:950; letter-spacing:.14em; }
.route-challenge-head h2 { color:#172638; font-size:clamp(1.05rem,1.8vw,1.45rem); text-shadow:2px 2px 0 #fff; }
.route-challenge-head .sub { color:#263c4d; font-size:clamp(.76rem,1.05vw,.92rem); font-weight:800; }
.route-challenge-panel .route-challenge-head .sub { color:#263c4d; text-shadow:none; }
.route-challenge-head .phase-key { color:#ff6573; text-shadow:0 0 10px rgba(255,73,92,.25); }
.route-notice { border-color:#c8a945; border-radius:7px; background:rgba(80,62,13,.82); color:#fff2b1; }
.route-pokemon-grid { gap:clamp(6px,.8vw,10px); }
.route-pokemon-grid .poke-card { overflow:hidden; border-color:#7891a1; border-radius:10px; background:linear-gradient(155deg,rgba(255,253,245,.96),rgba(226,239,232,.96)); color:#172638; box-shadow:0 7px 14px rgba(49,68,76,.18); }
.route-pokemon-grid .poke-card::before { content:""; position:absolute; inset:0; background:radial-gradient(circle at 50% 40%,rgba(125,198,255,.12),transparent 58%); pointer-events:none; }
.route-pokemon-grid .poke-card:hover { border-color:#4e91b6; background:linear-gradient(155deg,#fffce9,#d5ece0); box-shadow:0 9px 18px rgba(44,76,88,.22),0 0 0 3px rgba(77,157,198,.15); }
.route-pokemon-grid .poke-card.selected { border-color:#d59d08; background:linear-gradient(155deg,#fff3a8,#f6d457); color:#3a2900; box-shadow:0 0 0 3px rgba(229,171,12,.28),0 7px 14px rgba(91,68,8,.2); }
.route-pokemon-grid .poke-card.selected .name { color:#3a2900; }
.route-pokemon-grid .poke-card.correct { border-color:#74e7a8; background:linear-gradient(155deg,#1e6549,#153b30); }
.route-pokemon-grid .poke-card.wrong { border-color:#ff7b87; background:linear-gradient(155deg,#762a36,#431c25); }
.route-pokemon-grid .poke-card img { margin-bottom:8px; }
.route-pokemon-grid .poke-card .name { color:#172638; }
.route-pokemon-grid .poke-card.correct .name,
.route-pokemon-grid .poke-card.wrong .name { color:#fff; text-shadow:1px 1px 0 rgba(0,0,0,.42); }
.route-pokemon-grid .poke-card .hint { color:#526a79; }
.route-pokemon-grid .poke-card { grid-template-rows:minmax(0,1fr) auto; align-content:center; }
.route-pokemon-grid .poke-card img { align-self:center; }
.route-pokemon-grid .card-result-label { min-height:1.15em; line-height:1.15; white-space:normal; overflow:visible; text-overflow:clip; }
.route-pokemon-grid .result-shown .card-result-label { font-size:clamp(.65rem,.84vw,.78rem); font-weight:750; }
.route-pokemon-grid .result-shown .card-result-label strong { color:inherit; font-weight:950; }
:root.dark .gym-route-screen { border-color:#7f99b4; background-image:linear-gradient(110deg,rgba(9,19,31,.91),rgba(14,29,45,.74)),var(--route-gym-bg); }
:root.dark .gym-route-screen::before { background:radial-gradient(circle at 80% 15%,rgba(84,170,255,.16),transparent 30%); }
:root.dark .route-partner { border-right-color:#7089a2; background:linear-gradient(180deg,rgba(17,37,53,.96),rgba(9,22,34,.96)); color:#eef6ff; }
:root.dark .partner-kicker,:root.dark .partner-bag-label { color:#7cc2ff; }
:root.dark .partner-pokemon { border-color:rgba(176,211,240,.34); background:radial-gradient(circle at 50% 40%,rgba(113,193,255,.18),rgba(2,12,21,.35)); }
:root.dark .partner-pokemon .name { color:#fff; }
:root.dark .route-partner .item-btn { border-color:#536d86; background:#14283b; color:#eaf4ff; }
:root.dark .route-partner .item-btn:not(:disabled):hover { border-color:#b8dcff; background:#1e3b55; }
:root.dark .route-challenge-panel { color:#f2f7ff; background:rgba(7,16,27,.78); }
:root.dark .route-challenge-panel .node { border-color:#8198b0; background:#17283a; color:#d9e7f6; box-shadow:0 3px 0 rgba(0,0,0,.28); }
:root.dark .route-challenge-head > span { color:#79c2ff; }
:root.dark .route-challenge-head h2 { color:#fff; text-shadow:2px 2px 0 #050b13; }
:root.dark .route-challenge-panel .route-challenge-head .sub { color:#f1f6fc; text-shadow:1px 1px 0 #050b13; }
:root.dark .route-pokemon-grid .poke-card { border-color:#607994; background:linear-gradient(155deg,rgba(28,45,63,.95),rgba(13,27,41,.95)); color:#f4f8ff; box-shadow:0 7px 14px rgba(0,0,0,.22); }
:root.dark .route-pokemon-grid .poke-card:hover { border-color:#baddff; background:linear-gradient(155deg,#294967,#172d43); box-shadow:0 9px 18px rgba(0,0,0,.32),0 0 0 3px rgba(96,180,255,.18); }
:root.dark .route-pokemon-grid .poke-card.selected { border-color:#ffe172; background:linear-gradient(155deg,#6d5918,#332d13); color:#fff7c7; box-shadow:0 0 0 3px rgba(255,220,85,.3),0 7px 14px rgba(0,0,0,.25); }
:root.dark .route-pokemon-grid .poke-card.selected .name { color:#fff7c7; }
:root.dark .route-pokemon-grid .poke-card .name { color:#fff; }
:root.dark .route-pokemon-grid .poke-card .hint { color:#b9cde2; }
:root.dark .route-pokemon-grid .poke-card.correct { border-color:#63e6a0; background:linear-gradient(155deg,#176443,#0e3c2c); box-shadow:0 0 0 2px rgba(75,225,145,.18),0 7px 14px rgba(0,0,0,.3); }
:root.dark .route-pokemon-grid .poke-card.wrong { border-color:#ff6f7e; background:linear-gradient(155deg,#7b2938,#451a24); box-shadow:0 0 0 2px rgba(255,91,108,.16),0 7px 14px rgba(0,0,0,.3); }
:root.dark .route-pokemon-grid .poke-card.correct .name,
:root.dark .route-pokemon-grid .poke-card.wrong .name { color:#fff; }
.route-actions .btn { min-width:145px; border-radius:8px; }
.route-actions .primary { background:linear-gradient(#e54c53,#af242d); }
.route-actions .blue { background:linear-gradient(#4a94d5,#28629a); }

/* Badge battle polish */
.leader-battle-screen { isolation:isolate; }
.leader-battle-screen::after { content:""; position:absolute; z-index:0; inset:0; background:radial-gradient(circle at 50% 52%,transparent 25%,rgba(1,5,10,.22) 68%,rgba(1,5,10,.48)); pointer-events:none; }
.leader-battle-screen > * { z-index:2; }
.leader-battle-title { display:grid; justify-items:center; gap:3px; }
.leader-battle-title > span { color:#83c8ff; font-size:.6rem; font-weight:950; letter-spacing:.15em; }
.leader-round-progress { display:flex; align-items:center; justify-content:center; gap:10px; color:#e4edf7; }
.leader-round-progress b { font-size:.8rem; }
.leader-round-progress > span { display:flex; gap:4px; }
.leader-round-progress i { width:24px; height:5px; border-radius:99px; background:#3d4a59; box-shadow:inset 0 0 0 1px rgba(255,255,255,.18); }
.leader-round-progress i.cleared { background:#5fd69a; box-shadow:0 0 7px rgba(84,224,151,.55); }
.leader-round-progress i.active { background:#ffe069; box-shadow:0 0 9px rgba(255,220,85,.75); animation:leader-round-pulse .9s steps(2) infinite; }
.leader-battle-screen .leader-choice { position:relative; overflow:hidden; border-width:3px; border-radius:13px; background:linear-gradient(155deg,rgba(20,36,53,.95),rgba(8,20,32,.95)); box-shadow:0 12px 25px rgba(0,0,0,.36); }
.leader-battle-screen .leader-choice::before { content:""; position:absolute; inset:0; background:radial-gradient(circle at 50% 42%,rgba(108,190,255,.18),transparent 58%); pointer-events:none; }
.leader-battle-screen .leader-choice small { color:#7ec4ff; font-size:.6rem; font-weight:950; letter-spacing:.12em; }
.leader-battle-screen .leader-rival-choice small { color:#ff8791; }
.leader-battle-screen .leader-choice:hover { border-color:#fff; transform:translateY(-6px) scale(1.015); box-shadow:0 16px 30px rgba(0,0,0,.45),0 0 0 4px rgba(111,190,255,.16); }
.leader-battle-screen .leader-question { position:relative; overflow:visible; padding-bottom:clamp(22px,3vh,28px); border:3px solid #8199b0; border-radius:12px; background:rgba(8,19,31,.92); box-shadow:0 10px 24px rgba(0,0,0,.4); }
.stat-check-label { color:#ff6d7a; font-size:.58rem; font-weight:950; letter-spacing:.15em; }
.leader-versus { position:absolute; left:50%; bottom:-18px; display:grid; place-items:center; width:38px; height:38px; transform:translateX(-50%) rotate(-6deg); border:3px solid #fff; border-radius:50%; background:#d63845; color:#fff; font-style:normal; font-size:.78rem; font-weight:950; box-shadow:0 5px 0 #741923; }
.leader-stat-key { text-shadow:0 0 12px rgba(255,69,87,.34); }
@keyframes leader-round-pulse { 50% { opacity:.45; } }

@media (max-width:850px) {
  .trainer-hud { grid-template-columns:auto minmax(170px,1fr) auto; }
  .trainer-hud .hud-wordmark { display:none; }
  .trainer-hud .hud-region { display:none; }
  .starter-choice-footer > span { display:none; }
  .gym-route-screen { grid-template-columns:1fr; }
  .route-partner { border-right:0; border-bottom:3px solid #7089a2; }
}

/* Adventure ending screens */
.adventure-end-screen { position:relative; isolation:isolate; overflow:hidden; min-height:clamp(560px,calc(100vh - 96px),760px); padding:clamp(18px,4vw,48px); place-items:center; background-image:linear-gradient(rgba(245,241,221,.8),rgba(218,231,212,.9)),url("assets/backgrounds-webp/dia.webp"); background-size:cover; background-position:center; }
.adventure-end-screen::before { content:""; position:absolute; z-index:-1; inset:0; background:radial-gradient(circle at 50% 42%,rgba(255,255,255,.75),transparent 42%),linear-gradient(180deg,transparent 55%,rgba(48,88,66,.2)); }
.end-atmosphere { position:absolute; inset:0; pointer-events:none; }
.end-atmosphere i { position:absolute; width:7px; height:7px; border-radius:50%; background:#f0c84c; box-shadow:0 0 13px 4px rgba(240,200,76,.42); animation:end-float 4s ease-in-out infinite; }
.end-atmosphere i:nth-child(1){left:12%;top:23%}.end-atmosphere i:nth-child(2){left:24%;top:72%;animation-delay:-1.4s}.end-atmosphere i:nth-child(3){right:14%;top:28%;animation-delay:-2.2s}.end-atmosphere i:nth-child(4){right:25%;top:78%;animation-delay:-.7s}.end-atmosphere i:nth-child(5){left:52%;top:12%;animation-delay:-3s}
.end-stage { display:grid; grid-template-columns:minmax(150px,230px) minmax(360px,640px); align-items:end; justify-content:center; width:min(900px,100%); }
.end-partner { z-index:2; display:grid; justify-items:center; gap:3px; margin-right:-22px; padding:12px; border:3px solid #536b78; border-radius:16px 0 0 16px; background:linear-gradient(155deg,rgba(232,244,222,.96),rgba(188,219,199,.96)); color:#173148; box-shadow:0 12px 25px rgba(35,65,69,.22); }
.end-partner span { color:#357d9f; font-size:.58rem; font-weight:950; letter-spacing:.13em; }
.end-partner img { width:145px; height:145px; object-fit:contain; filter:drop-shadow(0 8px 4px rgba(28,48,53,.22)); animation:end-partner-breathe 1.8s steps(2) infinite; }
.end-partner strong { font-size:1rem; }
.end-result-card { position:relative; z-index:3; display:grid; justify-items:center; gap:clamp(9px,1.5vh,15px); padding:clamp(22px,4vw,42px); border:4px solid #425b6b; border-radius:18px; background:linear-gradient(155deg,rgba(255,253,242,.98),rgba(230,239,220,.98)); color:#172638; box-shadow:0 18px 0 rgba(46,67,73,.2),0 28px 48px rgba(26,53,62,.23),inset 0 0 0 3px rgba(255,255,255,.65); text-align:center; }
.end-result-card::before { content:""; position:absolute; inset:10px; border:2px dashed rgba(61,93,106,.3); border-radius:10px; pointer-events:none; }
.end-result-kicker { z-index:1; color:#b12e3c; font-size:.65rem; font-weight:950; letter-spacing:.18em; }
.end-result-emblem { z-index:1; display:grid; place-items:center; width:74px; height:74px; border:4px solid #fff; border-radius:50%; background:linear-gradient(#e94851,#a41d2c); color:#fff; box-shadow:0 6px 0 #6c1823,0 0 0 3px #425b6b; }
.end-result-emblem span { font-size:2.3rem; line-height:1; transform:rotate(-8deg); }
.end-result-emblem img { width:58px; height:58px; object-fit:contain; }
.end-result-card h2 { z-index:1; margin:0; font-size:clamp(1.7rem,4vw,2.8rem); line-height:1; text-shadow:2px 2px 0 #fff; }
.end-result-card > p { z-index:1; max-width:520px; margin:0; color:#40596a; font-weight:750; }
.end-badge-case { z-index:1; width:100%; padding:10px 12px; border:2px solid #8b9c9c; border-radius:10px; background:rgba(228,232,213,.75); }
.end-badge-case small { display:block; margin-bottom:7px; color:#506b78; font-size:.57rem; font-weight:950; letter-spacing:.14em; }
.end-badge-case > div { display:flex; justify-content:center; gap:clamp(5px,1vw,10px); }
.end-badge { display:grid; place-items:center; width:clamp(31px,4vw,42px); aspect-ratio:1; border:2px solid #879397; border-radius:8px; background:#b9beb7; filter:grayscale(1); opacity:.36; }
.end-badge.earned { border-color:#526b78; background:#fff9d9; filter:none; opacity:1; box-shadow:0 3px 0 rgba(46,62,66,.2); }
.end-badge img { width:84%; height:84%; object-fit:contain; }
.end-flavour { font-size:.78rem; }
.end-new-run { z-index:1; display:grid; grid-template-columns:auto auto; column-gap:9px; align-items:center; min-width:min(300px,100%); padding:10px 22px; border-color:#72202a; border-radius:10px; background:linear-gradient(#ed4b52,#bd2834); color:#fff; box-shadow:0 6px 0 #771b25,0 10px 18px rgba(83,24,29,.24); }
.end-new-run > span { grid-row:1 / 3; font-size:1.55rem; }.end-new-run strong { text-align:left; font-size:1rem; }.end-new-run small { color:#ffd8db; text-align:left; font-size:.6rem; }
.victory-end .end-result-card { border-color:#80651b; background:linear-gradient(155deg,rgba(255,254,224,.99),rgba(232,244,207,.98)); box-shadow:0 18px 0 rgba(118,91,23,.23),0 28px 48px rgba(45,63,38,.24),inset 0 0 0 3px rgba(255,255,255,.72); }
.victory-end .end-result-kicker { color:#93700d; }.victory-end .end-result-emblem { background:linear-gradient(#ffe66d,#e3a91e); box-shadow:0 6px 0 #8d6511,0 0 0 3px #80651b; animation:victory-emblem 1.5s ease-in-out infinite; }.victory-end .end-new-run { border-color:#315d4b; background:linear-gradient(#55b985,#287757); box-shadow:0 6px 0 #20573f,0 10px 18px rgba(30,79,56,.24); }.victory-end .end-new-run small{color:#d8ffea}
:root.dark .adventure-end-screen { background-image:linear-gradient(rgba(8,17,29,.79),rgba(6,17,27,.94)),url("assets/backgrounds-webp/noche.webp"); }
:root.dark .adventure-end-screen::before { background:radial-gradient(circle at 50% 40%,rgba(63,136,194,.17),transparent 44%),linear-gradient(180deg,transparent 50%,rgba(0,0,0,.3)); }
:root.dark .end-partner { border-color:#748da2; background:linear-gradient(155deg,rgba(24,47,67,.97),rgba(9,25,39,.97)); color:#f1f7ff; box-shadow:0 12px 25px rgba(0,0,0,.36); }
:root.dark .end-partner span { color:#80c8ff; }
:root.dark .end-result-card { border-color:#849bb0; background:linear-gradient(155deg,rgba(20,37,54,.98),rgba(8,20,32,.98)); color:#f4f8ff; box-shadow:0 18px 0 rgba(2,8,15,.52),0 28px 48px rgba(0,0,0,.45),inset 0 0 0 3px rgba(255,255,255,.06); }
:root.dark .end-result-card::before { border-color:rgba(169,203,230,.24); }
:root.dark .end-result-card h2 { text-shadow:2px 2px 0 #050b12; }
:root.dark .end-result-card > p { color:#c5d5e3; }
:root.dark .end-badge-case { border-color:#506b82; background:rgba(5,16,27,.62); }
:root.dark .end-badge-case small { color:#88a8bf; }
:root.dark .end-badge { border-color:#485a68; background:#101a24; }
:root.dark .end-badge.earned { border-color:#9fb5c5; background:#263b4d; box-shadow:0 0 9px rgba(105,187,255,.24); }
:root.dark .victory-end .end-result-card { border-color:#c6a849; background:linear-gradient(155deg,rgba(37,42,47,.98),rgba(17,28,35,.98)); box-shadow:0 18px 0 rgba(5,9,13,.58),0 28px 48px rgba(0,0,0,.5),inset 0 0 0 3px rgba(255,221,91,.07); }
@keyframes end-float { 50% { transform:translateY(-14px) scale(1.35); opacity:.45; } }
@keyframes end-partner-breathe { 50% { transform:translateY(-3px); } }
@keyframes victory-emblem { 50% { transform:translateY(-4px); filter:drop-shadow(0 0 9px rgba(255,218,61,.65)); } }
@media (max-width:700px) { .end-stage { grid-template-columns:1fr; width:min(520px,100%); }.end-partner { margin:0 28px -10px; border-radius:14px 14px 0 0; }.end-partner img { width:100px; height:100px; }.end-result-card { padding:24px 16px; } }

/* Regional adventure selector */
.region-select-screen { position:relative; isolation:isolate; overflow:hidden; width:min(1420px,100%); min-height:calc(100vh - 44px); padding:clamp(18px,2.8vw,38px); border:4px solid #40596c; border-radius:18px; background:linear-gradient(145deg,rgba(255,252,238,.98),rgba(222,239,226,.97)); color:#17283a; box-shadow:0 10px 0 rgba(38,58,68,.3),0 24px 55px rgba(31,66,76,.24),inset 0 0 0 3px rgba(255,255,255,.62); }
.region-select-screen::before { content:""; position:absolute; z-index:-2; inset:0; background:radial-gradient(circle at 13% 8%,rgba(91,187,229,.22),transparent 24%),radial-gradient(circle at 88% 92%,rgba(94,178,107,.2),transparent 27%); }
.region-sky-pixels { position:absolute; z-index:-1; inset:0; opacity:.18; background-image:linear-gradient(45deg,rgba(36,89,111,.15) 25%,transparent 25%),linear-gradient(-45deg,rgba(36,89,111,.15) 25%,transparent 25%); background-size:34px 34px; mask-image:linear-gradient(180deg,#000,transparent 38%); }
.region-select-header { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:18px; align-items:center; max-width:1120px; margin:0 auto 15px; text-align:left; }
.region-world-emblem { display:grid; place-items:center; width:76px; height:76px; border:4px solid #263f55; border-radius:50%; background:linear-gradient(#e94b52 0 44%,#172333 44% 56%,#f8fbf2 56%); box-shadow:0 6px 0 #81929a,0 0 0 4px rgba(255,255,255,.65); }
.region-world-emblem span { width:25px; height:25px; border:5px solid #172333; border-radius:50%; background:#fff; }
.region-select-header p { margin:0 0 3px; color:#287ba8; font-size:.62rem; font-weight:950; letter-spacing:.16em; }
.region-beta-badge { display:inline-block; margin-left:7px; padding:2px 6px; border:1px solid #b17816; border-radius:999px; background:#ffe7a6; color:#744600; font-size:.52rem; line-height:1; letter-spacing:.12em; vertical-align:1px; box-shadow:0 2px 0 rgba(116,70,0,.16); }
.region-select-header h1 { margin:0; font-size:clamp(1.65rem,3.4vw,3rem); line-height:1; text-shadow:2px 2px 0 #fff; }
.region-select-header div > span { display:block; margin-top:6px; color:#516879; font-weight:750; }
.region-screen-actions { display:flex; gap:7px; }
.region-screen-actions button { display:grid; place-items:center; min-width:42px; height:38px; border:2px solid #526b7e; border-radius:8px; background:#fff8dc; color:#1d3448; font-weight:950; box-shadow:0 3px 0 #9aa7a4; cursor:pointer; transition:transform .15s,background .15s,border-color .15s; }
.region-screen-actions button:hover { transform:translateY(-2px); border-color:#df4b55; background:#fff; }
.region-screen-actions button:active { transform:translateY(2px); box-shadow:0 1px 0 #9aa7a4; }
.region-user-icon { display:block; width:21px; height:21px; object-fit:contain; object-position:center; filter:none; }
.region-login-action { position:relative; }
.region-login-action.signed-in::after { content:""; position:absolute; right:4px; bottom:4px; width:8px; height:8px; border:2px solid #fff8dc; border-radius:50%; background:#35b96f; box-shadow:0 0 0 1px #1d6b4a; }
.auth-dialog { position:fixed; z-index:1002; top:50%; left:50%; width:min(520px,calc(100% - 30px)); max-height:calc(100vh - 24px); overflow:auto; padding:25px clamp(18px,4vw,36px) 30px; border:4px solid #49667b; border-radius:20px; background:linear-gradient(145deg,#fffdf2,#e8f2e9); color:#182c3e; box-shadow:0 10px 0 rgba(19,38,49,.42),0 24px 55px rgba(0,0,0,.32),inset 0 0 0 3px rgba(255,255,255,.75); transform:translate(-50%,-50%); animation:region-dialog-in .28s ease both; }
.auth-dialog::before { content:""; position:absolute; inset:10px; border:2px dashed rgba(66,101,120,.25); border-radius:12px; pointer-events:none; }
.auth-dialog > * { position:relative; z-index:1; }
.auth-dialog-head { display:flex; align-items:center; justify-content:center; gap:13px; margin:0 42px 18px; text-align:left; }
.auth-dialog-head p { margin:0 0 3px; color:#287ba8; font-size:.61rem; font-weight:950; letter-spacing:.16em; }
.auth-dialog-head h2 { margin:0; font-size:clamp(1.45rem,4vw,2rem); }
.auth-dialog-ball { position:relative; flex:0 0 auto; width:54px; height:54px; overflow:hidden; border:4px solid #233b4e; border-radius:50%; background:linear-gradient(#ef525c 0 45%,#233b4e 45% 55%,#f8faf2 55%); box-shadow:0 4px 0 #8a9ca1; }
.auth-dialog-ball i { position:absolute; top:50%; left:50%; width:16px; height:16px; border:4px solid #233b4e; border-radius:50%; background:#fff; transform:translate(-50%,-50%); }
.auth-tabs { display:grid; grid-template-columns:1fr 1fr; gap:7px; margin-bottom:15px; padding:5px; border:2px solid #b5c4bd; border-radius:12px; background:#dfe9df; }
.auth-tabs button { min-height:38px; border:0; border-radius:8px; background:transparent; color:#526b72; font-weight:900; cursor:pointer; }
.auth-tabs button.active { background:#fffdf2; color:#1b3446; box-shadow:0 2px 6px rgba(28,55,62,.18); }
.auth-form { display:grid; gap:12px; }
.auth-form label { display:grid; gap:5px; text-align:left; }
.auth-form label span { padding-left:3px; color:#3f5968; font-size:.7rem; font-weight:950; letter-spacing:.06em; }
.auth-form input { width:100%; height:45px; padding:0 13px; border:2px solid #8399a4; border-radius:9px; background:#fffef8; color:#172b3c; font:inherit; outline:none; box-sizing:border-box; }
.auth-form input:focus { border-color:#2e8bbb; box-shadow:0 0 0 3px rgba(46,139,187,.16); }
.auth-privacy-block { display:grid; gap:8px; padding:10px 11px; border:2px solid #9aadb1; border-radius:9px; background:rgba(255,255,255,.48); color:#49616d; font-size:.68rem; line-height:1.4; }
.auth-privacy-block p { margin:0; }
.auth-form .auth-privacy-check { display:grid; grid-template-columns:20px minmax(0,1fr); align-items:start; gap:8px; cursor:pointer; }
.auth-form .auth-privacy-check input { width:18px; height:18px; margin:1px 0 0; padding:0; accent-color:#2e8bbb; box-shadow:none; }
.auth-form .auth-privacy-check span { padding:0; color:#334f5e; font-size:.68rem; font-weight:800; letter-spacing:0; line-height:1.4; }
.auth-privacy-check a,.auth-policy-link,.region-select-footer a { color:#207ca8; font-weight:950; text-underline-offset:2px; }
.auth-privacy-check a:hover,.auth-policy-link:hover,.region-select-footer a:hover { color:#c73649; }
.auth-policy-link { display:inline-block; margin:-5px 0 13px; font-size:.7rem; }
.auth-submit { min-height:45px; padding:10px 18px; border:2px solid #243c50; border-radius:9px; background:linear-gradient(#e9555f,#c93249); color:#fff; font:inherit; font-weight:950; box-shadow:0 4px 0 #7d8c8e; cursor:pointer; }
.auth-submit:hover:not(:disabled) { filter:brightness(1.08); transform:translateY(-1px); }
.auth-submit:disabled { opacity:.6; cursor:wait; }
.auth-form > small,.auth-unconfigured small { color:#607986; font-size:.68rem; line-height:1.45; }
.auth-message { margin:0 0 13px; padding:9px 11px; border:2px solid #6c8793; border-radius:9px; background:#edf5ec; font-size:.76rem; font-weight:800; line-height:1.4; }
.auth-message.success { border-color:#4a9a72; color:#256645; }
.auth-message.error { border-color:#da5b63; background:#fff0ed; color:#9b2735; }
.auth-unconfigured { padding:19px 16px; border:2px solid #8da0a8; border-radius:14px; background:rgba(255,255,255,.5); text-align:center; }
.auth-cloud-mark { display:grid; place-items:center; width:57px; height:57px; margin:0 auto 8px; border:3px solid #47758d; border-radius:50%; background:#dff1f5; color:#2a7297; font-size:1.7rem; }
.auth-unconfigured h3 { margin:4px 0 8px; }
.auth-unconfigured p { margin:0 0 10px; line-height:1.45; }
.auth-profile { text-align:center; }
.auth-profile-avatar { display:grid; place-items:center; width:68px; height:68px; margin:0 auto 8px; border:3px solid #52768b; border-radius:50%; background:#ddecdf; box-shadow:0 4px 0 #a0aeaa; }
.auth-profile-avatar img { width:31px; height:31px; object-fit:contain; }
.auth-profile > small { color:#2d81aa; font-size:.62rem; font-weight:950; letter-spacing:.14em; }
.auth-profile h3 { margin:5px 0 16px; overflow-wrap:anywhere; }
.auth-progress-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:16px; }
.auth-progress-grid article { display:grid; gap:4px; min-width:0; padding:11px 7px; border:2px solid #8aa0aa; border-radius:10px; background:rgba(255,255,255,.5); }
.auth-progress-grid span { color:#607986; font-size:.61rem; font-weight:900; text-transform:uppercase; }
.auth-progress-grid strong { overflow:hidden; text-overflow:ellipsis; font-size:.82rem; }
.auth-signout { width:100%; background:linear-gradient(#667f90,#496273); }
.region-settings-icon { display:grid; place-items:center; width:24px; height:24px; font-family:"Segoe UI Symbol","Arial Unicode MS",sans-serif; font-size:1.55rem; font-weight:400; line-height:1; transform:translateY(-1px); }
.region-dialog-backdrop { position:fixed; z-index:1000; inset:0; background:rgba(12,24,35,.66); backdrop-filter:blur(5px); animation:region-dialog-fade .2s ease both; }
.difficulty-dialog { position:fixed; z-index:1001; top:50%; left:50%; width:min(720px,calc(100% - 34px)); max-height:calc(100vh - 28px); overflow:auto; padding:24px clamp(18px,4vw,42px) 30px; border:4px solid #49667b; border-radius:20px; background:linear-gradient(145deg,#fffdf2,#e8f2e9); color:#182c3e; text-align:center; box-shadow:0 10px 0 rgba(19,38,49,.42),0 24px 55px rgba(0,0,0,.32),inset 0 0 0 3px rgba(255,255,255,.75); transform:translate(-50%,-50%); animation:region-dialog-in .28s ease both; }
.difficulty-dialog::before { content:""; position:absolute; inset:10px; border:2px dashed rgba(66,101,120,.28); border-radius:12px; pointer-events:none; }
.difficulty-dialog-close { position:absolute; z-index:1; top:14px; right:14px; display:grid; place-items:center; width:38px; height:38px; padding:0; border:2px solid #4d6678; border-radius:9px; background:#fff8dc; color:#233a4d; font-size:1.35rem; font-weight:950; cursor:pointer; box-shadow:0 3px 0 #9ba9a7; }
.difficulty-dialog-info { position:absolute; z-index:2; top:14px; left:14px; display:grid; place-items:center; width:38px; height:38px; padding:0 0 1px; border:2px solid #4d6678; border-radius:50%; background:#fff8dc; color:#233a4d; font-family:Georgia,serif; font-size:1.35rem; font-weight:950; line-height:1; cursor:pointer; box-shadow:0 3px 0 #9ba9a7; transition:transform .15s,border-color .15s,background .15s; }
.difficulty-dialog-info:hover { transform:translateY(-2px); border-color:#2e91bd; }
.difficulty-dialog-info.active { border-color:#2e91bd; background:#dff4ff; color:#176486; }
.difficulty-dialog-mark { display:flex; justify-content:center; align-items:end; gap:5px; width:52px; height:41px; margin:0 auto 7px; padding:7px; border:3px solid #263f55; border-radius:50% 50% 12px 12px; background:linear-gradient(145deg,#ed565d,#c52e43); box-shadow:0 4px 0 #8798a0; }
.difficulty-dialog-mark i { width:8px; border:2px solid #17283a; border-radius:3px 3px 0 0; background:#fff4b5; }
.difficulty-dialog-mark i:nth-child(1) { height:13px; }
.difficulty-dialog-mark i:nth-child(2) { height:23px; }
.difficulty-dialog-mark i:nth-child(3) { height:31px; }
.difficulty-dialog > p { margin:0 0 4px; color:#287ba8; font-size:.62rem; font-weight:950; letter-spacing:.16em; }
.difficulty-dialog h2 { margin:0 45px 16px; font-size:clamp(1.4rem,3vw,1.85rem); }
.difficulty-options { position:relative; z-index:1; display:grid; gap:10px; }
.difficulty-option { position:relative; display:grid; grid-template-columns:minmax(155px,1.15fr) minmax(160px,.85fr); height:104px; min-height:0; padding:0; overflow:hidden; border:3px solid #6d8493; border-radius:14px; background:#f7f4e6; color:#1b3042; text-align:left; box-shadow:0 5px 0 rgba(58,78,86,.22); cursor:pointer; transition:transform .16s,border-color .16s,box-shadow .16s; }
.difficulty-option::after { content:""; position:absolute; inset:0; border-left:6px solid var(--mode-color); pointer-events:none; }
.difficulty-option:hover { z-index:2; transform:translateY(-3px); border-color:var(--mode-color); box-shadow:0 8px 0 color-mix(in srgb,var(--mode-color) 28%,transparent); }
.difficulty-option-image { position:relative; display:block; min-width:0; overflow:hidden; background:#cbded8; }
.difficulty-option-image img { display:block; width:100%; height:104px; min-height:0; object-fit:cover; object-position:center; transition:transform .25s,filter .25s; }
.difficulty-option-image i { position:absolute; inset:0; background:linear-gradient(90deg,transparent 52%,#f7f4e6 96%); }
.difficulty-option-copy { position:relative; z-index:1; display:flex; flex-direction:column; justify-content:center; align-items:flex-start; min-width:0; padding:13px 18px 13px 6px; }
.difficulty-option-copy small { color:#6d8493; font-size:.59rem; font-weight:950; letter-spacing:.12em; }
.difficulty-option-copy strong { margin-top:4px; font-size:clamp(1.1rem,2.2vw,1.45rem); line-height:1.05; }
.difficulty-option-0 { --mode-color:#4f9b76; }
.difficulty-option-1 { --mode-color:#d94b54; }
.difficulty-option-1 .difficulty-option-image img { filter:sepia(.55) saturate(3.1) hue-rotate(310deg) contrast(1.08); }
.difficulty-option-2 { --mode-color:#567bc9; }
.difficulty-option-2 .difficulty-option-image img { object-position:center 42%; image-rendering:pixelated; }
.difficulty-option:hover .difficulty-option-image img { transform:scale(1.04); }
.game-mode-guide { position:relative; z-index:1; display:grid; gap:9px; text-align:left; }
.game-mode-guide-card { --guide-mode:#4f9b76; display:grid; grid-template-columns:48px minmax(0,1fr); align-items:center; gap:13px; min-height:91px; padding:12px 17px; border:2px solid color-mix(in srgb,var(--guide-mode) 72%,#6d8493); border-radius:13px; background:color-mix(in srgb,var(--guide-mode) 8%,#f7f4e6); box-shadow:0 4px 0 rgba(58,78,86,.18); }
.game-mode-guide-1 { --guide-mode:#d94b54; }
.game-mode-guide-2 { --guide-mode:#567bc9; }
.game-mode-guide-number { display:grid; place-items:center; width:44px; height:44px; border:3px solid var(--guide-mode); border-radius:50%; background:#fffdf2; color:var(--guide-mode); font-size:.86rem; font-weight:950; box-shadow:0 3px 0 rgba(45,66,75,.2); }
.game-mode-guide-card small { color:var(--guide-mode); font-size:.55rem; font-weight:950; letter-spacing:.13em; }
.game-mode-guide-card h3 { margin:1px 0 3px; font-size:1.08rem; line-height:1.05; }
.game-mode-guide-card ul { display:grid; gap:2px; margin:0; padding-left:16px; color:#405766; font-size:.72rem; font-weight:750; line-height:1.25; }
.game-mode-guide-back { justify-self:center; margin-top:3px; padding:9px 18px; border:2px solid #4d6678; border-radius:8px; background:linear-gradient(#ffffff,#e4efe9); color:#233a4d; font-weight:900; cursor:pointer; box-shadow:0 3px 0 #9ba9a7; }
.game-mode-guide-back:hover { transform:translateY(-1px); border-color:#2e91bd; }
.region-progress { display:grid; grid-template-columns:auto minmax(180px,470px); justify-content:center; align-items:center; gap:13px; margin:0 auto 15px; color:#405a69; font-size:.72rem; font-weight:850; }
.region-progress b { color:#c93644; font-size:1rem; }.region-progress > div { overflow:hidden; height:9px; border:2px solid #6d8290; border-radius:99px; background:#cbd5d2; }.region-progress i { display:block; width:var(--region-progress); height:100%; border-radius:99px; background:linear-gradient(90deg,#e54a52,#f3c84d,#4ab57c); transition:width .5s ease; }
.region-notice { max-width:820px; margin:0 auto 14px; padding:9px 14px; border:2px solid #c19b31; border-radius:8px; background:#fff1b5; color:#493800; text-align:center; font-size:.8rem; font-weight:850; animation:region-notice-in .25s ease both; }
.region-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:clamp(10px,1.3vw,17px); max-width:1120px; margin:0 auto; }
.region-card { position:relative; display:grid; grid-template-columns:minmax(120px,1.2fr) minmax(110px,.8fr); min-height:145px; padding:0; overflow:hidden; border:3px solid #698090; border-radius:13px; background:#f7f4e6; color:#17283a; box-shadow:0 7px 0 rgba(55,75,82,.2),0 11px 20px rgba(40,68,74,.13); cursor:pointer; text-align:left; animation:region-card-in .4s calc(var(--region-index) * .055s) ease both; transition:transform .16s,border-color .16s,box-shadow .16s; }
.region-card::after { content:""; position:absolute; inset:0; border-left:6px solid var(--region-color); pointer-events:none; }
.region-card.unlocked:hover { z-index:2; transform:translateY(-5px); border-color:var(--region-color); box-shadow:0 11px 0 color-mix(in srgb,var(--region-color) 35%,transparent),0 18px 28px rgba(31,61,69,.22); }
.region-image { position:relative; overflow:hidden; min-width:0; background:#cbded8; }
.region-image img { width:100%; height:100%; min-height:145px; object-fit:cover; transition:transform .35s,filter .25s; }
.region-image i { position:absolute; inset:0; background:linear-gradient(90deg,transparent 62%,rgba(247,244,230,.94)); }
.region-card-copy { position:relative; z-index:1; display:grid; align-content:center; gap:5px; margin-left:-15px; padding:12px 13px 12px 0; }
.region-card-copy small { color:#647987; font-size:.53rem; font-weight:950; letter-spacing:.13em; }
.region-card-copy strong { color:#17283a; font-size:clamp(1.15rem,1.9vw,1.55rem); line-height:1; }
.region-status { width:max-content; max-width:100%; padding:4px 8px; border:2px solid color-mix(in srgb,var(--region-color) 65%,#42515b); border-radius:999px; background:color-mix(in srgb,var(--region-color) 13%,#fff); color:#293b46; font-size:.58rem; font-weight:950; }
.region-card.completed .region-status { border-color:#3f976a; background:#dcf4e5; color:#1b603e; }
.region-card.locked { cursor:not-allowed; border-color:#889197; background:#d8d9d3; box-shadow:0 5px 0 rgba(54,62,66,.18); }
.region-card.locked::after { border-color:#737a7d; }.region-card.locked .region-image img { filter:grayscale(1) brightness(.58); transform:scale(1.02); }.region-card.locked .region-image i { background:linear-gradient(90deg,rgba(23,29,34,.08) 45%,rgba(216,217,211,.96)); }.region-card.locked .region-card-copy { opacity:.67; }.region-card.locked .region-status { border-color:#727a7f; background:#bfc2c0; color:#3d464b; }
.region-card.upcoming.unlocked .region-image img { filter:saturate(.75); }
.region-select-footer { margin:16px auto 0; color:#59707e; text-align:center; font-size:.68rem; font-weight:750; }.region-select-footer span { color:#db3b48; }
:root.dark .region-select-screen { border-color:#7892aa; background:linear-gradient(145deg,rgba(13,27,42,.99),rgba(7,19,31,.99)); color:#f1f7ff; box-shadow:0 10px 0 rgba(0,0,0,.45),0 24px 55px rgba(0,0,0,.38),inset 0 0 0 3px rgba(255,255,255,.05); }
:root.dark .region-select-screen::before { background:radial-gradient(circle at 13% 8%,rgba(61,151,211,.16),transparent 26%),radial-gradient(circle at 88% 92%,rgba(59,138,94,.13),transparent 27%); }
:root.dark .region-sky-pixels { opacity:.12; }
:root.dark .region-world-emblem { border-color:#c6d9e8; box-shadow:0 6px 0 #07101a,0 0 0 4px rgba(99,184,255,.12); }
:root.dark .region-select-header p { color:#78c4ff; }:root.dark .region-select-header h1 { text-shadow:2px 2px 0 #03080e; }:root.dark .region-select-header div > span { color:#b1c4d4; }
:root.dark .region-beta-badge { border-color:#f2bf4a; background:#5c420b; color:#ffe79a; box-shadow:0 2px 0 rgba(0,0,0,.35); }
:root.dark .region-screen-actions button { border-color:#7c94a9; background:#1b3349; color:#fff; box-shadow:0 3px 0 #02070c; }
:root.dark .region-screen-actions button:hover { border-color:#ff6270; background:#27465f; }
:root.dark .region-user-icon { filter:invert(1) brightness(2); }
:root.dark .region-login-action.signed-in::after { border-color:#1b3349; background:#45dd88; }
:root.dark .auth-dialog { border-color:#7892aa; background:linear-gradient(145deg,#142b40,#091827); color:#f3f8ff; box-shadow:0 10px 0 rgba(0,0,0,.55),0 24px 60px rgba(0,0,0,.55),inset 0 0 0 3px rgba(255,255,255,.06); }
:root.dark .auth-dialog::before { border-color:rgba(148,192,222,.2); }
:root.dark .auth-dialog-head p,:root.dark .auth-profile > small { color:#78c4ff; }
:root.dark .auth-dialog-ball { border-color:#c9d9e5; box-shadow:0 4px 0 #02070c; }
:root.dark .auth-dialog-ball i { border-color:#c9d9e5; }
:root.dark .auth-tabs { border-color:#4f6c80; background:#0a1a27; }
:root.dark .auth-tabs button { color:#8da7b9; }
:root.dark .auth-tabs button.active { background:#1d3a50; color:#fff; box-shadow:0 2px 6px #000; }
:root.dark .auth-form label span { color:#a9c0cf; }
:root.dark .auth-form input { border-color:#607e93; background:#0c1c2a; color:#f6fbff; }
:root.dark .auth-privacy-block { border-color:#526f83; background:rgba(5,18,29,.46); color:#a7bdcb; }
:root.dark .auth-form .auth-privacy-check span { color:#c1d3df; }
:root.dark .auth-privacy-check a,:root.dark .auth-policy-link,:root.dark .region-select-footer a { color:#75c9f4; }
:root.dark .auth-privacy-check a:hover,:root.dark .auth-policy-link:hover,:root.dark .region-select-footer a:hover { color:#ff8994; }
:root.dark .auth-form > small,:root.dark .auth-unconfigured small { color:#91aabd; }
:root.dark .auth-message { background:#132c3d; color:#eaf5fc; }
:root.dark .auth-message.success { border-color:#45b77a; color:#8ff0b7; }
:root.dark .auth-message.error { border-color:#e35b69; background:#351822; color:#ff9eaa; }
:root.dark .auth-unconfigured,:root.dark .auth-progress-grid article { border-color:#58748a; background:rgba(5,18,29,.45); }
:root.dark .auth-cloud-mark { border-color:#79a9c4; background:#17364a; color:#80d3ff; }
:root.dark .auth-profile-avatar { border-color:#789ab0; background:#173449; box-shadow:0 4px 0 #02070c; }
:root.dark .auth-profile-avatar img { filter:invert(1) brightness(2); }
:root.dark .auth-progress-grid span { color:#8ba8bb; }
:root.dark .difficulty-dialog { border-color:#7892aa; background:linear-gradient(145deg,#142b40,#091827); color:#f3f8ff; box-shadow:0 10px 0 rgba(0,0,0,.55),0 24px 60px rgba(0,0,0,.55),inset 0 0 0 3px rgba(255,255,255,.06); }
:root.dark .difficulty-dialog::before { border-color:rgba(148,192,222,.2); }
:root.dark .difficulty-dialog-close { border-color:#7892aa; background:#1b3349; color:#fff; box-shadow:0 3px 0 #02070c; }
:root.dark .difficulty-dialog-info { border-color:#7892aa; background:#1b3349; color:#fff; box-shadow:0 3px 0 #02070c; }
:root.dark .difficulty-dialog-info:hover,:root.dark .difficulty-dialog-info.active { border-color:#7dccff; background:#21445d; color:#9edaff; }
:root.dark .difficulty-dialog-mark { border-color:#c9d9e5; box-shadow:0 4px 0 #02070c; }
:root.dark .difficulty-dialog > p { color:#78c4ff; }
:root.dark .difficulty-option { border-color:#5f7b91; background:#13283a; color:#f4f8fc; box-shadow:0 5px 0 rgba(0,0,0,.32); }
:root.dark .difficulty-option:hover { border-color:#ff6270; }
:root.dark .difficulty-option-image { background:#172c3d; }
:root.dark .difficulty-option-image i { background:linear-gradient(90deg,transparent 52%,#13283a 96%); }
:root.dark .difficulty-option-copy small { color:#86a1b5; }
:root.dark .game-mode-guide-card { background:color-mix(in srgb,var(--guide-mode) 9%,#13283a); box-shadow:0 4px 0 rgba(0,0,0,.3); }
:root.dark .game-mode-guide-number { background:#091827; box-shadow:0 3px 0 #02070c; }
:root.dark .game-mode-guide-card ul { color:#b7c9d5; }
:root.dark .game-mode-guide-back { border-color:#7892aa; background:linear-gradient(#214057,#152c40); color:#fff; box-shadow:0 3px 0 #02070c; }
:root.dark .region-progress { color:#a9bdcc; }:root.dark .region-progress > div { border-color:#60798f; background:#172737; }
:root.dark .region-notice { border-color:#d2ab39; background:#493a0d; color:#fff0ac; }
:root.dark .region-card { border-color:#5e778e; background:#122538; color:#eff6ff; box-shadow:0 7px 0 rgba(0,0,0,.32),0 11px 20px rgba(0,0,0,.26); }
:root.dark .region-image { background:#172c3d; }:root.dark .region-image i { background:linear-gradient(90deg,transparent 58%,#122538 96%); }
:root.dark .region-card-copy small { color:#86a1b5; }:root.dark .region-card-copy strong { color:#fff; }:root.dark .region-status { background:color-mix(in srgb,var(--region-color) 18%,#102130); color:#eaf4fc; }
:root.dark .region-card.completed .region-status { border-color:#55c68a; background:#153f2e; color:#c8ffe0; }
:root.dark .region-card.locked { border-color:#394957; background:#101923; }:root.dark .region-card.locked .region-image i { background:linear-gradient(90deg,rgba(0,0,0,.18) 45%,#101923 96%); }:root.dark .region-card.locked .region-status { border-color:#4b5964; background:#1c2730; color:#82909a; }
:root.dark .region-select-footer { color:#8fa6b7; }
@keyframes region-card-in { from { opacity:0; transform:translateY(16px) scale(.98); } }
@keyframes region-notice-in { from { opacity:0; transform:translateY(-7px); } }
@keyframes region-dialog-fade { from { opacity:0; } }
@keyframes region-dialog-in { from { opacity:0; transform:translate(-50%,-46%) scale(.96); } }
@media (max-width:950px) { .region-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }.region-select-screen { min-height:calc(100vh - 24px); }.region-select-header { grid-template-columns:auto 1fr; }.region-screen-actions { grid-column:1 / -1; position:absolute; top:16px; right:16px; } }
@media (max-width:610px) { .app { padding:7px; }.region-select-screen { min-height:calc(100vh - 14px); padding:17px 11px; border-radius:11px; }.region-world-emblem { width:55px; height:55px; }.region-world-emblem span { width:19px; height:19px; border-width:4px; }.region-select-header { padding-right:0; gap:10px; }.region-select-header div > span { font-size:.72rem; }.region-screen-actions { position:static; grid-column:1 / -1; justify-content:flex-end; }.region-screen-actions button { min-width:40px; height:36px; }.region-progress { grid-template-columns:1fr; gap:5px; text-align:center; }.region-grid { grid-template-columns:1fr; }.region-card { min-height:125px; grid-template-columns:1.25fr .75fr; }.region-image img { min-height:125px; }.region-select-footer { padding:0 8px; }.difficulty-dialog { padding:22px 12px 24px; }.difficulty-dialog h2 { margin:0 36px 14px; }.difficulty-options { gap:8px; }.difficulty-option { grid-template-columns:1.05fr .95fr; height:78px; min-height:0; }.difficulty-option-image img { height:78px; min-height:0; }.difficulty-option-copy { padding:10px 10px 10px 4px; }.difficulty-option-copy small { font-size:.5rem; }.difficulty-option-copy strong { font-size:1rem; }.difficulty-dialog-mark { width:48px; height:38px; }.difficulty-dialog-info,.difficulty-dialog-close { top:11px; width:34px; height:34px; }.difficulty-dialog-info { left:11px; }.difficulty-dialog-close { right:11px; }.game-mode-guide-card { grid-template-columns:36px minmax(0,1fr); gap:9px; padding:10px; }.game-mode-guide-number { width:34px; height:34px; border-width:2px; font-size:.7rem; }.game-mode-guide-card h3 { font-size:.95rem; }.game-mode-guide-card ul { font-size:.64rem; } }
@media (max-width:610px) {
  .auth-dialog { padding:22px 13px 24px; }
  .auth-dialog-head { margin:0 32px 16px 0; justify-content:flex-start; }
  .auth-dialog-ball { width:46px; height:46px; }
  .auth-progress-grid { grid-template-columns:1fr; }
  .auth-progress-grid article { grid-template-columns:1fr 1fr; align-items:center; text-align:left; }
}

@media (min-width:951px) {
  .region-select-screen { height:calc(100vh - 44px); min-height:0; display:grid; grid-template-rows:auto auto auto minmax(0,1fr) auto; padding:clamp(12px,2.2vh,26px) clamp(20px,2.8vw,38px); }
  .region-select-header { grid-row:1; width:100%; margin-bottom:clamp(7px,1.3vh,13px); gap:clamp(10px,1.3vw,18px); }
  .region-progress { grid-row:2; }
  .region-notice { grid-row:3; }
  .region-grid { grid-row:4; }
  .region-select-footer { grid-row:5; align-self:center; min-height:1.25em; line-height:1.25; }
  .region-world-emblem { width:clamp(54px,8vh,72px); height:clamp(54px,8vh,72px); }
  .region-world-emblem span { width:clamp(18px,2.7vh,24px); height:clamp(18px,2.7vh,24px); }
  .region-select-header h1 { font-size:clamp(1.6rem,4.7vh,2.8rem); }
  .region-select-header div > span { margin-top:clamp(2px,.6vh,6px); font-size:clamp(.7rem,1.7vh,.95rem); }
  .region-progress { margin-bottom:clamp(6px,1.3vh,13px); }
  .region-notice { margin-bottom:clamp(6px,1.2vh,12px); padding:clamp(5px,.9vh,9px) 14px; }
  .region-grid { width:100%; height:100%; min-height:0; grid-template-rows:repeat(3,minmax(0,1fr)); gap:clamp(7px,1.4vh,14px) clamp(9px,1.3vw,17px); }
  .region-card { min-height:0; height:100%; }
  .region-image { min-height:0; }
  .region-image img { height:100%; min-height:0; }
  .region-card-copy { gap:clamp(2px,.6vh,5px); padding-top:clamp(7px,1.2vh,12px); padding-bottom:clamp(7px,1.2vh,12px); }
  .region-card-copy strong { font-size:clamp(1rem,2.7vh,1.45rem); }
  .region-status { padding:clamp(2px,.45vh,4px) 8px; }
  .region-select-footer { margin-top:clamp(7px,1.4vh,14px); }
}

@media (min-width:951px) and (max-height:700px) {
  .region-select-screen { padding-top:9px; padding-bottom:9px; }
  .region-select-header p { font-size:.5rem; }
  .region-select-header div > span { display:none; }
  .region-progress { font-size:.64rem; }
  .region-card-copy small { font-size:.47rem; }
  .region-status { font-size:.52rem; }
  .region-select-footer { min-height:1em; margin-top:4px; font-size:.6rem; line-height:1; }
}
.life-effect-overlay.gain .life-loss-impact strong {
  border-color: #fffbd0;
  background: rgba(22,116,77,.96);
  color: #fffce0;
  box-shadow: 0 6px 0 rgba(4,54,34,.72), 0 0 22px rgba(135,255,194,.55);
  text-shadow: 2px 2px 0 #075734;
}
.life-effect-overlay.gain .life-loss-ring { border-color: rgba(137,255,192,.9); animation-name: life-gain-ring; }
.life-effect-overlay.gain .life-loss-shard {
  width: 13px;
  height: 13px;
  border-radius: 1px;
  background: #fff59a;
  clip-path: polygon(40% 0,60% 0,60% 40%,100% 40%,100% 60%,60% 60%,60% 100%,40% 100%,40% 60%,0 60%,0 40%,40% 40%);
  filter: drop-shadow(0 0 7px #fff) drop-shadow(0 0 12px #63ffc2);
  animation-name: life-gain-spark;
}

@keyframes pixel-heart-break {
  0%,15% { transform: scale(.45); opacity: 0; }
  24% { transform: scale(1.15); opacity: 1; }
  34% { transform: translateX(-5px) scale(1); }
  42% { transform: translateX(5px); }
  50%,78% { transform: translateX(0); opacity: 1; }
  100% { transform: translateY(16px) scale(.76); opacity: 0; }
}

@keyframes pixel-heart-heal {
  0% { opacity: 0; transform: translateY(24px) scale(.35); filter: brightness(3); }
  24% { opacity: 1; transform: translateY(-8px) scale(1.18); filter: brightness(2.2); }
  38%,76% { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
  100% { opacity: 0; transform: translateY(-28px) scale(.86); filter: brightness(1.8); }
}

@keyframes life-gain-backdrop {
  0%,100% { background: rgba(2,24,15,0); }
  18%,72% { background: rgba(2,24,15,.42); }
}

@keyframes life-gain-impact {
  0% { opacity: 0; transform: scale(.35) translateY(25px); }
  18% { opacity: 1; transform: scale(1.12) translateY(-7px); }
  30%,76% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(.82) translateY(-28px); }
}

@keyframes healed-heart-glow {
  0%,100% { filter: drop-shadow(0 0 0 rgba(255,249,143,0)); }
  24%,64% { filter: drop-shadow(0 0 14px #fff) drop-shadow(0 0 30px #7dffc2); }
}

@keyframes life-gain-ring {
  0% { opacity: .95; transform: scale(.2); }
  70% { opacity: .45; }
  100% { opacity: 0; transform: scale(2.8); }
}

@keyframes life-gain-spark {
  0% { opacity: 0; translate: 0 34px; scale: .2; rotate: 0deg; }
  25% { opacity: 1; }
  100% { opacity: 0; translate: var(--shard-x) var(--shard-y); scale: 1.2; rotate: 180deg; }
}

/* Clear, single-hit life loss feedback */
.life-loss-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  background: rgba(24, 2, 8, 0);
  animation: life-loss-backdrop 1.35s ease both;
}

.life-loss-impact {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 210px;
  min-height: 210px;
  transform-origin: center;
  animation: life-loss-impact 1.35s cubic-bezier(.2,.9,.25,1) both;
}

.life-loss-heart {
  position: relative;
  z-index: 3;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: clamp(6rem, 14vw, 10rem);
  line-height: 1;
  filter: drop-shadow(0 12px 7px rgba(0,0,0,.48));
  animation: broken-heart-shake 1.35s ease both;
}

.life-loss-impact strong {
  position: relative;
  z-index: 4;
  margin-top: -12px;
  padding: 8px 17px;
  border: 3px solid #fff;
  border-radius: 8px;
  background: rgba(104, 8, 24, .94);
  color: #fff;
  box-shadow: 0 6px 0 rgba(38,0,7,.7);
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 950;
  letter-spacing: .06em;
  text-shadow: 2px 2px 0 #5d0616;
  animation: life-loss-label 1.35s ease both;
}

.life-loss-ring {
  position: absolute;
  z-index: 1;
  width: 130px;
  height: 130px;
  border: 9px solid rgba(255,81,104,.82);
  border-radius: 50%;
  animation: life-loss-ring 1.05s ease-out both .12s;
}

.life-loss-shard {
  --shard-x: 80px;
  --shard-y: -70px;
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 24px;
  opacity: 0;
  background: #ed2947;
  clip-path: polygon(0 0, 100% 28%, 38% 100%);
  filter: drop-shadow(0 3px 2px rgba(0,0,0,.35));
  animation: life-loss-shard 1s ease-out both .23s;
}

.life-loss-shard.shard-1 { --shard-x: 105px; --shard-y: -78px; }
.life-loss-shard.shard-2 { --shard-x: -108px; --shard-y: -58px; transform: rotate(80deg); }
.life-loss-shard.shard-3 { --shard-x: 94px; --shard-y: 82px; transform: rotate(170deg); }
.life-loss-shard.shard-4 { --shard-x: -86px; --shard-y: 91px; transform: rotate(250deg); }

@keyframes life-loss-backdrop {
  0%,100% { background: rgba(24,2,8,0); }
  18%,72% { background: rgba(24,2,8,.48); }
}

@keyframes life-loss-impact {
  0% { opacity: 0; transform: scale(.3); }
  16% { opacity: 1; transform: scale(1.16); }
  27% { transform: scale(.96); }
  72% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.72) translateY(-25px); }
}

@keyframes broken-heart-shake {
  0%,12% { transform: scale(.45) rotate(0); }
  20% { transform: scale(1.12) rotate(-8deg); }
  27% { transform: scale(1) rotate(8deg); }
  34% { transform: rotate(-6deg); }
  41% { transform: rotate(5deg); }
  48%,100% { transform: rotate(0); }
}

@keyframes life-loss-label {
  0%,18% { opacity: 0; transform: translateY(18px) scale(.75); }
  32%,78% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-8px) scale(.92); }
}

@keyframes life-loss-ring {
  0% { opacity: .9; transform: scale(.25); }
  100% { opacity: 0; transform: scale(2.6); }
}

@keyframes life-loss-shard {
  0% { opacity: 0; translate: 0 0; scale: .25; }
  20% { opacity: 1; }
  100% { opacity: 0; translate: var(--shard-x) var(--shard-y); scale: 1; rotate: 160deg; }
}

@media (prefers-reduced-motion: reduce) {
  .life-loss-overlay,
  .life-loss-impact,
  .life-loss-heart,
  .life-loss-impact strong,
  .life-loss-ring,
  .life-loss-shard {
    animation-duration: .6s !important;
    animation-delay: 0ms !important;
  }
}

.life-effect-overlay .life-loss-heart {
  --heart-pixel-size: clamp(5px, .625vw, 8px);
  width: auto;
  height: auto;
  display: grid;
  place-items: center;
  font-size: 0;
  line-height: 0;
  filter: none;
}

.life-effect-overlay.loss .life-loss-heart { animation: none; }
.life-effect-overlay.gain .life-loss-heart { animation: healed-heart-glow 1.35s ease both; }

.life-loss-shard.shard-5 { --shard-x: 132px; --shard-y: -18px; }
.life-loss-shard.shard-6 { --shard-x: -138px; --shard-y: 8px; }
.life-loss-shard.shard-7 { --shard-x: 122px; --shard-y: 58px; }
.life-loss-shard.shard-8 { --shard-x: -120px; --shard-y: 68px; }
.life-loss-shard.shard-9 { --shard-x: 45px; --shard-y: -122px; }
.life-loss-shard.shard-10 { --shard-x: -48px; --shard-y: -128px; }
.life-loss-shard.shard-11 { --shard-x: 28px; --shard-y: 126px; }
.life-loss-shard.shard-12 { --shard-x: -42px; --shard-y: 132px; }

.life-effect-overlay.loss .life-loss-shard {
  width: 10px;
  height: 10px;
  border-radius: 0;
  background: #ef1738;
  clip-path: none;
  box-shadow: inset 2px 2px 0 #ff6b80, inset -2px -2px 0 #a50922;
  image-rendering: pixelated;
}

.life-effect-overlay.loss .life-loss-shard:nth-of-type(3n) { width: 14px; height: 14px; }
.life-effect-overlay.loss .life-loss-shard:nth-of-type(4n) { width: 7px; height: 7px; background: #17191e; box-shadow: none; }

/* Trainer menu and regional Pokedex refresh */
.trainer-menu {
  width: min(390px, calc(100vw - 24px));
  top: 12px;
  bottom: 12px;
  left: 12px;
  padding: 0;
  overflow: hidden;
  align-content: start;
  gap: 0;
  border: 4px solid #26394d;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(47,121,160,.08) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(315deg, rgba(47,121,160,.08) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(160deg, #fffdf4, #f3efdc);
  color: #17283a;
  box-shadow: 10px 0 0 rgba(19,35,50,.2), 22px 0 45px rgba(8,21,32,.28), inset 0 0 0 2px rgba(255,255,255,.78);
}
.trainer-menu-stripe { height: 8px; background: linear-gradient(90deg, #e6414d 0 42%, #f0c746 42% 58%, #3f99c4 58%); }
.trainer-menu-head { position: relative; display: grid; grid-template-columns: 58px minmax(0,1fr) 40px; gap: 12px; align-items: center; padding: 20px 18px 17px; border-bottom: 3px solid #587083; background: rgba(255,255,255,.5); }
.trainer-menu-head::after { content: ""; position: absolute; right: 0; bottom: -3px; width: 33%; height: 3px; background: #e6414d; }
.trainer-menu-ball { position: relative; width: 54px; height: 54px; overflow: hidden; border: 4px solid #22364a; border-radius: 50%; background: linear-gradient(#ec4954 0 44%, #1c2938 44% 56%, #f8fbf5 56%); box-shadow: 0 4px 0 #8a9ba3, 0 0 0 3px rgba(255,255,255,.7); }
.trainer-menu-ball i { position: absolute; inset: 16px; border: 4px solid #1c2938; border-radius: 50%; background: #fff; }
.trainer-menu-copy { min-width: 0; }
.trainer-menu-copy > span { display: block; color: #2b82ad; font-size: .58rem; font-weight: 950; letter-spacing: .15em; }
.trainer-menu-copy h2 { margin: 2px 0 1px; font-size: 1.65rem; line-height: 1; }
.trainer-menu-copy p { margin: 0; color: #627688; font-size: .72rem; font-weight: 800; }
.trainer-menu-close { align-self: start; width: 38px; height: 38px; border-radius: 9px; background: #fff8dc; box-shadow: 0 3px 0 #9aa7a4; }
.trainer-menu .menu-list { padding: 17px 15px; gap: 11px; }
.menu-action { position: relative; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 12px; align-items: center; min-height: 72px; padding: 10px 13px 10px 10px; border: 3px solid #526b7e; border-radius: 12px; background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(237,243,230,.92)); color: #1a2c3d; text-align: left; box-shadow: 0 5px 0 #9caaa5; cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.menu-action:hover { transform: translateY(-2px); border-color: #2d86b1; background: #fff; box-shadow: 0 7px 0 #88a4ad, 0 10px 18px rgba(38,72,91,.14); }
.menu-action:active { transform: translateY(3px); box-shadow: 0 2px 0 #8b9995; }
.menu-action > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.menu-action strong { font-size: .9rem; line-height: 1.05; }
.menu-action small { color: #647786; font-size: .62rem; font-weight: 700; line-height: 1.15; }
.menu-action > i { color: #377fa3; font-size: 1.5rem; font-style: normal; font-weight: 950; }
.menu-action-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 3px solid #334b5f; border-radius: 50%; background: #dff1d4; color: #23394c; font-size: 1.25rem; font-weight: 950; box-shadow: inset 0 0 0 3px rgba(255,255,255,.52); }
.menu-restart .menu-action-icon { border-color: #9b303b; background: #f8d8d4; color: #b92f3e; }
.menu-dex-icon { background: linear-gradient(#e74751 0 43%, #1c2938 43% 57%, #eef7f2 57%); color: #fff; text-shadow: 0 0 0 #fff; }
.menu-language-icon { border-radius: 11px; background: #dceeff; color: #276b9a; font-size: .75rem; letter-spacing: .04em; }
.menu-theme { grid-template-columns: 48px minmax(0,1fr) auto; cursor: pointer; }
.menu-theme input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.menu-toggle { position: relative; width: 48px; height: 27px; border: 3px solid #4d6679; border-radius: 99px; background: #cad4d4; box-shadow: inset 0 2px 3px rgba(26,48,62,.2); transition: background .18s; }
.menu-toggle i { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border: 2px solid #334b5f; border-radius: 50%; background: #fff; transition: transform .18s; }
.menu-theme input:checked + .menu-toggle { background: #3e91bd; }
.menu-theme input:checked + .menu-toggle i { transform: translateX(20px); }
.menu-theme input:focus-visible + .menu-toggle { outline: 3px solid #f1c83f; outline-offset: 3px; }
.trainer-menu-footer { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-top: auto; padding: 0 20px 20px; color: #758897; font-size: .5rem; font-weight: 950; letter-spacing: .14em; }
.trainer-menu-footer span { height: 2px; background: #93a5ae; }
.drawer-backdrop { background: rgba(8,18,29,.48); backdrop-filter: blur(3px); }

.regional-dex {
  inset: clamp(7px, 1.4vw, 18px);
  padding: 0;
  overflow: hidden;
  grid-template-rows: auto auto minmax(0,1fr);
  gap: 0;
  border: 4px solid #26394d;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(65,140,172,.045) 25%, transparent 25%) 0 0 / 28px 28px,
    linear-gradient(160deg, #fffdf4, #eef3e6);
  box-shadow: 0 10px 0 rgba(31,48,62,.28), 0 24px 60px rgba(7,18,28,.3), inset 0 0 0 2px rgba(255,255,255,.72);
}
.dex-shell-head { position: relative; display: grid; grid-template-columns: 62px minmax(0,1fr) auto 42px; gap: 14px; align-items: center; padding: 15px 18px; border-bottom: 4px solid #26394d; background: linear-gradient(105deg, #f9f7ea 0 62%, #e54752 62% 64%, #20364a 64%); color: #17283a; }
.dex-shell-head::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 38%; height: 4px; background: linear-gradient(90deg,#e54550 0 44%,#f0c944 44% 62%,#3e9cc7 62%); }
.dex-shell-emblem { position: relative; width: 56px; height: 56px; overflow: hidden; border: 4px solid #24384b; border-radius: 50%; background: linear-gradient(#e94752 0 44%,#1c2938 44% 56%,#f4f8f1 56%); box-shadow: 0 4px 0 #81939c, 0 0 0 3px rgba(255,255,255,.68); }
.dex-shell-emblem i { position: absolute; inset: 17px; border: 4px solid #1c2938; border-radius: 50%; background: #fff; }
.dex-shell-head > div:nth-child(2) > span { color: #2c80a8; font-size: .55rem; font-weight: 950; letter-spacing: .16em; }
.dex-shell-head h2 { margin: 2px 0 1px; font-size: clamp(1.35rem,2.5vw,2rem); line-height: 1; }
.dex-shell-head h2 b { color: #d93846; }
.dex-shell-head p { margin: 0; color: #627688; font-size: .68rem; font-weight: 750; }
.dex-count { display: grid; justify-items: center; min-width: 76px; padding: 7px 11px; border: 3px solid #b8d0df; border-radius: 10px; background: rgba(11,28,44,.82); color: #fff; box-shadow: 0 4px 0 rgba(2,9,15,.38); }
.dex-count strong { color: #70d1ff; font-size: 1.25rem; line-height: 1; }
.dex-count small { margin-top: 3px; color: #c4d9e7; font-size: .48rem; letter-spacing: .1em; }
.dex-modal-close { width: 40px; height: 40px; border-color: #d8e5ed; background: #fff7d9; color: #17283a; box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.dex-region-rail { flex-wrap: nowrap; justify-content: flex-start; gap: 7px; overflow-x: auto; padding: 10px 14px 11px; border-bottom: 3px solid #78909f; background: rgba(215,228,220,.82); scrollbar-width: thin; }
.dex-region-rail .region { display: grid; grid-template-columns:auto auto; column-gap: 6px; align-items: center; flex: 0 0 auto; min-width: 104px; padding: 7px 11px; opacity: .58; border: 2px solid #718490; border-radius: 9px; background: #eef0e6; color: #536471; font-size: .7rem; font-weight: 900; box-shadow: none; }
.dex-region-rail .region i { grid-row: 1 / 3; color: #7d8d97; font-size: .52rem; font-style: normal; }
.dex-region-rail .region small { color: #7b8992; font-size: .46rem; font-weight: 850; text-transform: uppercase; }
.dex-region-rail .region.active { opacity: 1; border-color: #296f9b; background: #2e83b4; color: #fff; box-shadow: 0 3px 0 #1b506f; }
.dex-region-rail .region.active i { color: #f4d147; text-shadow: 0 0 7px rgba(255,226,89,.75); }
.dex-region-rail .region.active small { color: #dff4ff; }
.regional-dex .dex-grid { grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); align-content: start; gap: 12px; padding: 14px; background: transparent; scrollbar-color: #668296 #dbe4df; }
.regional-dex .dex-card { position: relative; grid-template-columns: 88px minmax(0,1fr); justify-content: stretch; min-height: 126px; padding: 12px 11px; gap: 11px; overflow: hidden; border: 3px solid #536c7e; border-radius: 13px; background: linear-gradient(145deg,rgba(255,255,255,.96),rgba(239,244,226,.94)); color: #182a3b; box-shadow: 0 5px 0 #a0ada8, 0 8px 15px rgba(42,69,82,.11); transition: transform .16s ease,border-color .16s ease,box-shadow .16s ease;
}
.regional-dex .dex-card::after { content: ""; position: absolute; right: -20px; bottom: -30px; width: 82px; height: 82px; border: 10px solid rgba(61,132,166,.07); border-radius: 50%; }
.regional-dex .dex-card:hover { z-index: 2; transform: translateY(-4px); border-color: #2c8ab7; background: #fffef7; box-shadow: 0 8px 0 #7ca4b2, 0 14px 22px rgba(29,70,91,.2); }
.regional-dex .dex-card-number { position: absolute; z-index: 2; top: 8px; right: 10px; color: #718493; font-size: .67rem; font-weight: 950; letter-spacing: .04em; }
.regional-dex .dex-media { position: relative; z-index: 1; justify-self: stretch; display: grid; place-items: center; }
.dex-card-screen { display: grid; place-items: center; width: 84px; height: 84px; border: 3px solid #587487; border-radius: 18px 18px 18px 7px; background: radial-gradient(circle at 50% 44%,#eaf7d3 0 48%,#c8dfbd 100%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.54), 0 3px 0 #a2b1aa; }
.regional-dex .dex-card .dex-media img { width: 78px; height: 78px; filter: drop-shadow(0 4px 2px rgba(35,54,62,.22)); transition: transform .18s ease; }
.regional-dex .dex-card:hover .dex-media img { transform: scale(1.07) translateY(-2px); }
.regional-dex .dex-info { position: relative; z-index: 1; width: auto; max-width: none; justify-self: stretch; align-content: center; justify-items: start; gap: 7px; padding-top: 8px; }
.regional-dex .dex-title { padding-right: 34px; }
.regional-dex .dex-title h3 { color: #17283a; font-size: .96rem; line-height: 1.05; }
.regional-dex .dex-info .dex-types { gap: 4px; }
.regional-dex .dex-info .dex-type-img { width: 56px; height: 15px; flex-basis: 56px; }
.dex-card-open { margin-top: 2px; color: #347da2; font-size: .5rem; font-weight: 950; letter-spacing: .09em; }
.dex-card-open i { font-size: .9rem; font-style: normal; vertical-align: -1px; }

.dex-detail-backdrop { background: rgba(4,12,21,.72); backdrop-filter: blur(5px); }
.dex-detail-modal { width: min(900px,calc(100vw - 26px)); max-height: calc(100vh - 26px); grid-template-columns: 255px minmax(0,1fr); gap: 20px; overflow: auto; align-items: stretch; padding: 30px 24px 24px; border: 5px solid #7d2630; border-radius: 20px; background:
  linear-gradient(135deg,rgba(47,119,151,.055) 25%,transparent 25%) 0 0 / 24px 24px,
  linear-gradient(150deg,#fffdf3,#eeeede);
  color: #17283a;
  box-shadow: 0 12px 0 #42141b,0 27px 65px rgba(0,0,0,.48),inset 0 0 0 3px rgba(255,255,255,.7);
}
.dex-detail-modal::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 12px; background: linear-gradient(90deg,#e74350 0 34%,#f2ca43 34% 43%,#3b9bc8 43% 100%); }
.dex-detail-shell-light { position: absolute; top: 18px; left: 24px; width: 12px; height: 12px; border: 3px solid #174967; border-radius: 50%; background: #72dcff; box-shadow: 0 0 0 4px #e9faff,0 0 12px #36bdeb; }
.dex-detail-close { top: 18px; right: 18px; z-index: 3; width: 40px; height: 40px; border-radius: 10px; background: #fff4d2; box-shadow: 0 4px 0 #9b8580; }
.dex-detail-art { position: relative; min-height: 100%; overflow: hidden; border: 4px solid #304b5f; border-radius: 16px 16px 16px 6px; background:
  linear-gradient(rgba(48,106,125,.08) 1px,transparent 1px) 0 0 / 16px 16px,
  linear-gradient(90deg,rgba(48,106,125,.08) 1px,transparent 1px) 0 0 / 16px 16px,
  radial-gradient(circle at 50% 45%,#e8f7cf 0 38%,#c3ddb9 72%,#abc8ab 100%);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.48),0 6px 0 #899b96;
}
.dex-detail-art::after { content: ""; position: absolute; inset: 9px; border: 2px solid rgba(49,86,100,.25); border-radius: 10px; pointer-events: none; }
.dex-detail-art img { position: relative; z-index: 1; width: 218px; height: 218px; filter: drop-shadow(0 9px 4px rgba(30,54,62,.25)); animation: dex-pokemon-idle 2.8s ease-in-out infinite; }
.dex-scan-label { position: absolute; z-index: 2; top: 14px; left: 15px; color: #35677a; font-size: .48rem; font-weight: 950; letter-spacing: .12em; }
.dex-art-number { position: absolute; z-index: 2; right: 14px; bottom: 12px; padding: 5px 8px; border: 2px solid #486678; border-radius: 6px; background: rgba(245,250,229,.78); color: #365568; font-size: .65rem; font-weight: 950; }
.dex-detail-info { align-content: center; gap: 11px; min-width: 0; padding: 14px 32px 2px 0; }
.dex-detail-kicker { color: #2c82aa; font-size: .55rem; font-weight: 950; letter-spacing: .15em; }
.dex-detail-info .dex-title { padding: 0; }
.dex-detail-info .dex-title h2 { color: #17283a; font-size: clamp(1.8rem,4vw,2.45rem); line-height: .95; text-shadow: 2px 2px 0 #fff; }
.dex-detail-info .dex-types { margin-top: -2px; gap: 6px; }
.dex-detail-info .dex-type-img { width: 74px; height: 20px; flex-basis: 74px; }
.dex-description { padding: 10px 13px 12px; border-left: 5px solid #3b92ba; border-radius: 0 9px 9px 0; background: rgba(216,232,220,.72); }
.dex-description small { color: #39758e; font-size: .5rem; font-weight: 950; letter-spacing: .13em; }
.dex-detail-info .dex-description p { margin: 4px 0 0; color: #263848; font-size: .92rem; line-height: 1.35; }
.dex-detail-info .stat-chart { margin-top: 1px; padding: 12px 13px 10px; border: 3px solid #4e687a; border-radius: 12px; background:
  linear-gradient(rgba(106,157,178,.1) 1px,transparent 1px) 0 0 / 12px 12px,
  linear-gradient(145deg,#d7e5df,#bccfca);
  color: #17283a;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.36);
}
.dex-detail-info .stat-chart h3 { margin-bottom: 10px; color: #29485a; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.dex-detail-info .stat-bars { gap: 8px; }
.dex-detail-info .stat-bar-col { grid-template-rows: 15px 94px 28px; gap: 4px; }
.dex-detail-info .stat-track { height: 94px; border: 2px solid rgba(53,82,97,.55); border-top: 0; background: repeating-linear-gradient(to top,rgba(255,255,255,.5) 0 2px,transparent 2px 17px); }
.dex-detail-info .stat-fill { left: 3px; right: 3px; bottom: 3px; border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg,#48c8e8,#2388b5); box-shadow: inset 0 3px 0 rgba(255,255,255,.35),0 0 8px rgba(50,180,219,.18); }
.dex-detail-info .stat-value { color: #223b4d; font-size: .67rem; text-shadow: 1px 1px 0 rgba(255,255,255,.7); }
.dex-detail-info .stat-label { color: #2d4352; font-size: .58rem; }

:root.dark .trainer-menu { border-color: #829bb0; background:
  linear-gradient(135deg,rgba(76,149,190,.06) 25%,transparent 25%) 0 0 / 24px 24px,
  linear-gradient(315deg,rgba(76,149,190,.06) 25%,transparent 25%) 0 0 / 24px 24px,
  linear-gradient(160deg,#142437,#0b1826); color:#eff7ff; box-shadow:10px 0 0 rgba(0,0,0,.32),22px 0 45px rgba(0,0,0,.48),inset 0 0 0 2px rgba(255,255,255,.06); }
:root.dark .trainer-menu-head { border-color:#69849a; background:rgba(25,47,67,.58); }
:root.dark .trainer-menu-copy > span { color:#73c7f5; }
:root.dark .trainer-menu-copy p { color:#a7bdcc; }
:root.dark .trainer-menu-close { border-color:#9ab0c0; background:#1c3449; color:#fff; box-shadow:0 3px 0 #03080d; }
:root.dark .menu-action { border-color:#5e7b92; background:linear-gradient(135deg,#1a3147,#11263a); color:#f3f8fc; box-shadow:0 5px 0 #050c13; }
:root.dark .menu-action:hover { border-color:#74c8f1; background:#203d57; box-shadow:0 7px 0 #07111a,0 10px 20px rgba(0,0,0,.28); }
:root.dark .menu-action small { color:#a4bac9; }
:root.dark .menu-action-icon { border-color:#7b94a7; background:#294b5a; color:#fff; box-shadow:inset 0 0 0 3px rgba(255,255,255,.06); }
:root.dark .menu-restart .menu-action-icon { border-color:#d4656e; background:#51232c; color:#ff9ba3; }
:root.dark .menu-dex-icon { background:linear-gradient(#d94350 0 43%,#07111b 43% 57%,#dce9ed 57%); }
:root.dark .menu-language-icon { background:#1b4665; color:#a7ddff; }
:root.dark .menu-toggle { border-color:#8aa1b2; background:#172839; }
:root.dark .trainer-menu-footer { color:#7892a4; }

:root.dark .regional-dex { border-color:#829bb0; background:
  linear-gradient(135deg,rgba(75,151,190,.045) 25%,transparent 25%) 0 0 / 28px 28px,
  linear-gradient(160deg,#0d1d2c,#07131f); box-shadow:0 10px 0 rgba(0,0,0,.48),0 24px 60px rgba(0,0,0,.5),inset 0 0 0 2px rgba(255,255,255,.05); }
:root.dark .dex-shell-head { border-color:#8ba0b2; background:linear-gradient(105deg,#152a3d 0 62%,#df404e 62% 64%,#07131f 64%); color:#f5f9ff; }
:root.dark .dex-shell-head p { color:#a9bdcc; }
:root.dark .dex-shell-head > div:nth-child(2) > span { color:#72c9f6; }
:root.dark .dex-modal-close { border-color:#a5bac8; background:#1a3348; color:#fff; }
:root.dark .dex-region-rail { border-color:#516b80; background:rgba(9,26,40,.88); }
:root.dark .dex-region-rail .region { border-color:#435a6c; background:#132536; color:#8195a4; }
:root.dark .dex-region-rail .region small { color:#6f8392; }
:root.dark .dex-region-rail .region.active { border-color:#75c5ee; background:#226c98; color:#fff; }
:root.dark .regional-dex .dex-card { border-color:#58748b; background:linear-gradient(145deg,#172e43,#102336); color:#eff7ff; box-shadow:0 5px 0 #050c13,0 8px 15px rgba(0,0,0,.25); }
:root.dark .regional-dex .dex-card:hover { border-color:#71c8f3; background:#1c3951; box-shadow:0 8px 0 #06101a,0 14px 23px rgba(0,0,0,.34); }
:root.dark .regional-dex .dex-card-number { color:#829db0; }
:root.dark .dex-card-screen { border-color:#7290a5; background:radial-gradient(circle at 50% 44%,#294d4a 0 48%,#172f39 100%); box-shadow:inset 0 0 0 3px rgba(255,255,255,.06),0 3px 0 #07101a; }
:root.dark .regional-dex .dex-title h3 { color:#fff; }
:root.dark .dex-card-open { color:#73c9f4; }

:root.dark .dex-detail-modal { border-color:#b94b58; background:
  linear-gradient(135deg,rgba(67,144,179,.05) 25%,transparent 25%) 0 0 / 24px 24px,
  linear-gradient(150deg,#142b3e,#091926); color:#f1f7fc; box-shadow:0 12px 0 #3f1118,0 27px 65px rgba(0,0,0,.62),inset 0 0 0 3px rgba(255,255,255,.05); }
:root.dark .dex-detail-close { border-color:#9eb3c2; background:#1d374b; color:#fff; box-shadow:0 4px 0 #02070c; }
:root.dark .dex-detail-art { border-color:#809aab; background:
  linear-gradient(rgba(98,178,196,.08) 1px,transparent 1px) 0 0 / 16px 16px,
  linear-gradient(90deg,rgba(98,178,196,.08) 1px,transparent 1px) 0 0 / 16px 16px,
  radial-gradient(circle at 50% 45%,#214b48 0 38%,#102d36 72%,#0b202d 100%); box-shadow:inset 0 0 0 5px rgba(255,255,255,.04),0 6px 0 #040b12; }
:root.dark .dex-scan-label { color:#8cd8f2; }
:root.dark .dex-art-number { border-color:#7592a4; background:rgba(9,27,40,.78); color:#c3e7f6; }
:root.dark .dex-detail-kicker { color:#75cdf5; }
:root.dark .dex-detail-info .dex-title h2 { color:#fff; text-shadow:2px 2px 0 #02070c; }
:root.dark .dex-description { border-color:#57b4dd; background:rgba(25,55,72,.76); }
:root.dark .dex-description small { color:#80d1f3; }
:root.dark .dex-detail-info .dex-description p { color:#d8e5ee; }
:root.dark .dex-detail-info .stat-chart { border-color:#6e8da2; background:
  linear-gradient(rgba(92,164,190,.08) 1px,transparent 1px) 0 0 / 12px 12px,
  linear-gradient(145deg,#193b50,#102a3d); color:#eef8ff; box-shadow:inset 0 0 0 3px rgba(255,255,255,.04); }
:root.dark .dex-detail-info .stat-chart h3 { color:#a5ddf3; }
:root.dark .dex-detail-info .stat-track { border-color:#7291a5; background:repeating-linear-gradient(to top,rgba(207,239,249,.2) 0 2px,transparent 2px 17px); }
:root.dark .dex-detail-info .stat-value { color:#dff4ff; text-shadow:1px 1px 0 #06111a; }
:root.dark .dex-detail-info .stat-label { color:#c1d6e3; }

@keyframes dex-pokemon-idle { 50% { transform: translateY(-5px); } }
@media (max-width: 760px) {
  .dex-shell-head { grid-template-columns: 48px minmax(0,1fr) 38px; gap: 10px; padding: 12px; }
  .dex-shell-emblem { width: 44px; height: 44px; border-width: 3px; }
  .dex-shell-emblem i { inset: 13px; border-width: 3px; }
  .dex-shell-head p, .dex-count { display: none; }
  .dex-shell-head h2 { font-size: 1.3rem; }
  .dex-modal-close { width: 36px; height: 36px; }
  .regional-dex .dex-grid { grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 9px; padding: 10px; }
  .regional-dex .dex-card { grid-template-columns: 74px minmax(0,1fr); min-height: 108px; padding: 9px; }
  .dex-card-screen { width: 70px; height: 70px; }
  .regional-dex .dex-card .dex-media img { width: 66px; height: 66px; }
  .dex-detail-modal { grid-template-columns: 1fr; gap: 15px; padding: 28px 16px 18px; }
  .dex-detail-art { min-height: 185px; }
  .dex-detail-art img { width: 165px; height: 165px; }
  .dex-detail-info { padding: 0; text-align: left; }
  .dex-detail-info .dex-types { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .trainer-menu { width: calc(100vw - 14px); top: 7px; bottom: 7px; left: 7px; }
  .trainer-menu-head { grid-template-columns: 48px minmax(0,1fr) 36px; padding: 16px 12px 14px; gap: 9px; }
  .trainer-menu-ball { width: 44px; height: 44px; border-width: 3px; }
  .trainer-menu-ball i { inset: 13px; border-width: 3px; }
  .trainer-menu-copy h2 { font-size: 1.35rem; }
  .trainer-menu .menu-list { padding: 13px 10px; gap: 9px; }
  .menu-action { grid-template-columns: 42px minmax(0,1fr) auto; min-height: 65px; padding: 8px; gap: 9px; }
  .menu-action-icon { width: 40px; height: 40px; }
  .regional-dex .dex-grid { grid-template-columns: 1fr; }
  .regional-dex .dex-card { min-height: 104px; }
  .dex-region-rail { padding: 8px; }
  .dex-detail-info .stat-bars { gap: 4px; }
  .dex-detail-info .stat-bar-col { grid-template-rows: 15px 78px 27px; }
  .dex-detail-info .stat-track { height: 78px; }
  .dex-detail-info .stat-label { font-size: .52rem; }
}
@media (prefers-reduced-motion: reduce) {
  .dex-detail-art img { animation: none; }
  .menu-action, .regional-dex .dex-card, .regional-dex .dex-card .dex-media img { transition: none; }
}

/* Trainer handbook */
.trainer-guide {
  inset: clamp(7px,1.4vw,18px);
  padding: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0,1fr);
  gap: 0;
  border: 4px solid #314b5f;
  border-radius: 18px;
  background:
    linear-gradient(135deg,rgba(67,143,169,.045) 25%,transparent 25%) 0 0 / 28px 28px,
    linear-gradient(155deg,#fffdf2,#edf3df);
  color: #17283a;
  box-shadow: 0 10px 0 rgba(31,48,62,.28),0 24px 60px rgba(7,18,28,.3),inset 0 0 0 2px rgba(255,255,255,.72);
}
.guide-shell-head { position: relative; display: grid; grid-template-columns: 62px minmax(0,1fr) auto 42px; gap: 14px; align-items: center; padding: 15px 18px; border-bottom: 4px solid #314b5f; background: linear-gradient(105deg,#f8f7e8 0 62%,#e0ad31 62% 64%,#244b42 64%); }
.guide-shell-head::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 42%; height: 4px; background: linear-gradient(90deg,#459866 0 42%,#e4b631 42% 61%,#3f98bf 61%); }
.guide-emblem { display: grid; place-items: center; width: 56px; height: 56px; border: 4px solid #29465a; border-radius: 50%; background: radial-gradient(circle,#e8f7d7 0 42%,#65ad7e 43% 61%,#244253 62%); box-shadow: 0 4px 0 #83958f,0 0 0 3px rgba(255,255,255,.68); }
.guide-emblem span { display: grid; place-items: center; width: 29px; height: 29px; border: 3px solid #29465a; border-radius: 50%; background: #fff8d9; color: #24587a; font-size: 1rem; font-weight: 950; }
.guide-shell-head > div:nth-child(2) > span { color: #39835e; font-size: .55rem; font-weight: 950; letter-spacing: .16em; }
.guide-shell-head h2 { margin: 2px 0 1px; font-size: clamp(1.35rem,2.5vw,2rem); line-height: 1; }
.guide-shell-head p { margin: 0; color: #637769; font-size: .68rem; font-weight: 750; }
.guide-progress { display: grid; justify-items: center; min-width: 76px; padding: 7px 11px; border: 3px solid #b8d7c5; border-radius: 10px; background: rgba(14,47,43,.84); color: #fff; box-shadow: 0 4px 0 rgba(2,9,15,.38); }
.guide-progress strong { color: #8ce0a8; font-size: 1.25rem; line-height: 1; }
.guide-progress small { margin-top: 3px; color: #d2e9da; font-size: .48rem; letter-spacing: .1em; }
.guide-close { width: 40px; height: 40px; border-color: #dbe7df; background: #fff7d8; color: #17283a; box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.guide-scroll { min-height: 0; overflow: auto; display: grid; align-content: start; gap: 17px; padding: 16px; scrollbar-color: #668798 #dce5dc; }
.guide-section { padding: 14px; border: 3px solid #5d7584; border-radius: 15px; background: rgba(255,255,255,.7); box-shadow: 0 6px 0 #a3b0aa,0 10px 20px rgba(43,70,79,.1); }
.guide-section-head { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 12px; align-items: center; margin-bottom: 13px; padding-bottom: 10px; border-bottom: 2px solid #b7c6c1; }
.guide-section-head > span { display: grid; place-items: center; width: 45px; height: 40px; border: 3px solid #3b667a; border-radius: 9px 9px 9px 3px; background: #2e7898; color: #fff; font-size: .78rem; font-weight: 950; box-shadow: 0 4px 0 #8ca2a7; }
.guide-section-head h3 { margin: 0; color: #1c3345; font-size: 1.05rem; line-height: 1.05; }
.guide-section-head p { margin: 3px 0 0; color: #647785; font-size: .68rem; font-weight: 700; }
.guide-rules .guide-section-head > span { border-color: #2f7451; background: #438e63; }
.guide-trials .guide-section-head > span { border-color: #315d82; background: #3e86b5; }
.guide-items .guide-section-head > span { border-color: #9a7420; background: #d1a02c; }
.guide-groups .guide-section-head > span { border-color: #874150; background: #bd5264; }

.trainer-guide .help-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; }
.trainer-guide .help-step { position: relative; grid-template-columns: 43px minmax(0,1fr); align-items: center; justify-items: stretch; min-height: 112px; padding: 12px; overflow: hidden; border: 3px solid #5c7785; border-radius: 12px; background: linear-gradient(145deg,#f9fff2,#e6f0db); text-align: left; box-shadow: 0 4px 0 #a0aca5; animation: guide-card-in .32s calc(var(--guide-step) * .045s) ease both; }
.trainer-guide .help-step::after { content: ""; position: absolute; right: -22px; bottom: -32px; width: 82px; height: 82px; border: 10px solid rgba(61,139,102,.07); border-radius: 50%; }
.trainer-guide .help-step-number { position: relative; z-index: 1; display: grid; place-items: center; width: 39px; height: 39px; border: 3px solid #396c55; border-radius: 50%; background: #65ae78; color: #fff; font-size: .82rem; font-weight: 950; box-shadow: inset 0 0 0 3px rgba(255,255,255,.25),0 3px 0 #9aa89f; }
.trainer-guide .help-step > div { position: relative; z-index: 1; display: grid; gap: 5px; }
.trainer-guide .help-step small { color: #3c8460; font-size: .48rem; font-weight: 950; letter-spacing: .11em; }
.trainer-guide .help-step p { margin: 0; color: #263b49; font-size: .72rem; font-weight: 750; line-height: 1.25; }
.trainer-guide .help-step > i { position: absolute; top: 0; right: 0; width: 8px; height: 100%; background: linear-gradient(#4a9b6b,#dfb33e); opacity: .75; }

.help-trial-columns { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(280px,.75fr); gap: 12px; }
.help-trial-columns > article { overflow: hidden; border: 3px solid #58788d; border-radius: 13px; background: linear-gradient(145deg,#f3fbff,#e2eff5); box-shadow: 0 4px 0 #9caab0; }
.help-trial-columns > article.special { border-color: #8c5261; background: linear-gradient(145deg,#fff7f4,#f4e3e5); box-shadow: 0 4px 0 #afa1a4; }
.help-trial-columns header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 2px solid #b7cbd5; background: rgba(255,255,255,.48); }
.help-trial-columns header > span { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border: 3px solid #2c5b78; border-radius: 8px; background: #3e86b5; color: #fff; font-size: .9rem; font-weight: 950; box-shadow: 0 3px 0 #9baab1; }
.help-trial-columns .special header > span { border-color: #803746; background: #bd5264; }
.help-trial-columns header small { display: block; color: #47778f; font-size: .47rem; font-weight: 950; letter-spacing: .11em; }
.help-trial-columns .special header small { color: #9b4b5a; }
.help-trial-columns header h3 { margin: 2px 0 0; color: #21384a; font-size: .82rem; }
.help-trial-columns ul { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 13px; margin: 0; padding: 12px 14px 14px 29px; }
.help-trial-columns .special ul { grid-template-columns: 1fr; }
.help-trial-columns li { color: #3e5361; font-size: .64rem; font-weight: 750; line-height: 1.3; }
.help-trial-columns li::marker { color: #3e86b5; }
.help-trial-columns .special li::marker { color: #bd5264; }

.trainer-guide .help-items { display: grid; grid-template-columns: repeat(7,minmax(115px,1fr)); gap: 10px; }
.trainer-guide .help-item { position: relative; display: grid; grid-template-rows: auto minmax(0,1fr); justify-items: center; align-content: start; gap: 9px; min-height: 172px; padding: 12px 9px; overflow: hidden; border: 3px solid #637787; border-radius: 12px; background: linear-gradient(150deg,#fffdf4,#f2ecd2); color: #17283a; text-align: center; box-shadow: 0 4px 0 #aaa998; animation: guide-card-in .32s calc(var(--item-index) * .045s) ease both; }
.trainer-guide .help-item::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: linear-gradient(90deg,#d3a42b,#efd05b); }
.help-item-art { display: grid; place-items: center; width: 68px; height: 68px; margin-top: 2px; border: 3px solid #526b7d; border-radius: 50%; background: radial-gradient(circle,#f4fbdc 0 54%,#d5e1c1 55%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.48),0 4px 0 #aaa99a; }
.trainer-guide .help-item .item-icon { width: 43px; height: 43px; object-fit: contain; image-rendering: pixelated; }
.trainer-guide .help-item > div { display: grid; align-content: start; gap: 5px; }
.trainer-guide .help-item h3 { margin: 0; color: #263b4a; font-size: .77rem; line-height: 1.05; }
.trainer-guide .help-item p { margin: 0; color: #687780; font-size: .61rem; font-weight: 700; line-height: 1.22; }

.trainer-guide .help-groups { display: grid; grid-template-columns: repeat(7,minmax(130px,1fr)); gap: 10px; }
.trainer-guide .help-group { position: relative; display: grid; grid-template-rows: 42px minmax(0,1fr); justify-items: center; align-items: start; gap: 7px; min-height: 128px; padding: 11px 9px; border: 3px solid #6a7182; border-radius: 12px; background: linear-gradient(145deg,#fff9f2,#eee7e7); color: #263746; text-align: center; box-shadow: 0 4px 0 #aaa1a2; }
.trainer-guide .help-group > span { display: grid; place-items: center; width: 42px; height: 42px; border: 3px solid #804554; border-radius: 50%; background: #c95c6e; color: #fff; font-size: 1rem; font-weight: 950; box-shadow: inset 0 0 0 3px rgba(255,255,255,.18),0 3px 0 #a59a9c; }
.trainer-guide .help-group p { margin: 0; color: #3b4751; font-size: .65rem; font-weight: 800; line-height: 1.23; }

:root.dark .trainer-guide { border-color: #829bb0; background:
  linear-gradient(135deg,rgba(74,151,184,.04) 25%,transparent 25%) 0 0 / 28px 28px,
  linear-gradient(155deg,#0d1e2d,#07131f); color: #f1f7fc; box-shadow: 0 10px 0 rgba(0,0,0,.48),0 24px 60px rgba(0,0,0,.5),inset 0 0 0 2px rgba(255,255,255,.05); }
:root.dark .guide-shell-head { border-color: #829bb0; background: linear-gradient(105deg,#152b3d 0 62%,#d5a42a 62% 64%,#071820 64%); }
:root.dark .guide-shell-head > div:nth-child(2) > span { color: #77d29b; }
:root.dark .guide-shell-head p { color: #a8bdc9; }
:root.dark .guide-emblem { border-color: #9bb2c2; background: radial-gradient(circle,#244b45 0 42%,#478b68 43% 61%,#091823 62%); box-shadow: 0 4px 0 #02070c,0 0 0 3px rgba(110,218,158,.1); }
:root.dark .guide-emblem span { border-color: #a4bac8; background: #173344; color: #a7e9c0; }
:root.dark .guide-close { border-color: #a5bac8; background: #1a3448; color: #fff; box-shadow: 0 4px 0 #02070c; }
:root.dark .guide-section { border-color: #58758a; background: rgba(18,40,57,.82); box-shadow: 0 6px 0 #040b12,0 10px 20px rgba(0,0,0,.2); }
:root.dark .guide-section-head { border-color: #476277; }
:root.dark .guide-section-head h3 { color: #fff; }
:root.dark .guide-section-head p { color: #a8bcc9; }
:root.dark .trainer-guide .help-step { border-color: #587a8d; background: linear-gradient(145deg,#183744,#112c3a); box-shadow: 0 4px 0 #040b11; }
:root.dark .trainer-guide .help-step small { color: #83d3a1; }
:root.dark .trainer-guide .help-step p { color: #dbe8ef; }
:root.dark .help-trial-columns > article { border-color: #587a8d; background: linear-gradient(145deg,#193746,#112b39); box-shadow: 0 4px 0 #040b11; }
:root.dark .help-trial-columns > article.special { border-color: #8f5767; background: linear-gradient(145deg,#382735,#251e2a); }
:root.dark .help-trial-columns header { border-color: #46677a; background: rgba(255,255,255,.035); }
:root.dark .help-trial-columns .special header { border-color: #694353; }
:root.dark .help-trial-columns header h3 { color: #f3f8fb; }
:root.dark .help-trial-columns header small { color: #78c2e3; }
:root.dark .help-trial-columns .special header small { color: #ec8da1; }
:root.dark .help-trial-columns li { color: #c6d6df; }
:root.dark .trainer-guide .help-item { border-color: #6c7c8c; background: linear-gradient(150deg,#293340,#1c2935); color: #f2f8fc; box-shadow: 0 4px 0 #050b10; }
:root.dark .help-item-art { border-color: #7a91a2; background: radial-gradient(circle,#294c48 0 54%,#19333b 55%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.05),0 4px 0 #050b10; }
:root.dark .trainer-guide .help-item h3 { color: #fff; }
:root.dark .trainer-guide .help-item p { color: #b6c7d1; }
:root.dark .trainer-guide .help-group { border-color: #70798a; background: linear-gradient(145deg,#302b39,#211f2d); color: #f5f8fb; box-shadow: 0 4px 0 #05080d; }
:root.dark .trainer-guide .help-group p { color: #d1d8df; }
:root.dark .trainer-guide .help-group > span { border-color: #d77c8a; background: #863b4c; box-shadow: inset 0 0 0 3px rgba(255,255,255,.08),0 3px 0 #09070a; }

@keyframes guide-card-in { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 1050px) {
  .help-trial-columns { grid-template-columns: 1fr; }
  .trainer-guide .help-items { grid-template-columns: repeat(3,minmax(135px,1fr)); }
  .trainer-guide .help-groups { grid-template-columns: repeat(3,minmax(150px,1fr)); }
}
@media (max-width: 760px) {
  .guide-shell-head { grid-template-columns: 48px minmax(0,1fr) 38px; gap: 10px; padding: 12px; }
  .guide-emblem { width: 44px; height: 44px; border-width: 3px; }
  .guide-emblem span { width: 23px; height: 23px; border-width: 2px; font-size: .8rem; }
  .guide-shell-head p,.guide-progress { display: none; }
  .guide-shell-head h2 { font-size: 1.3rem; }
  .guide-close { width: 36px; height: 36px; }
  .guide-scroll { padding: 10px; gap: 12px; }
  .guide-section { padding: 10px; }
  .trainer-guide .help-steps { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 540px) {
  .guide-shell-head > div:nth-child(2) > span { font-size: .47rem; }
  .guide-section-head { grid-template-columns: 42px minmax(0,1fr); gap: 9px; }
  .guide-section-head > span { width: 39px; height: 36px; }
  .guide-section-head p { font-size: .61rem; }
  .trainer-guide .help-steps { grid-template-columns: 1fr; }
  .help-trial-columns ul { grid-template-columns: 1fr; }
  .trainer-guide .help-step { min-height: 96px; }
  .trainer-guide .help-items { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .trainer-guide .help-groups { grid-template-columns: 1fr; }
  .trainer-guide .help-group { min-height: 94px; grid-template-columns: 46px minmax(0,1fr); grid-template-rows: 1fr; align-items: center; justify-items: start; text-align: left; }
  .trainer-guide .help-group p { font-size: .68rem; }
}

/* Expanded route, move trials and wild held-item encounter */
.expanded-route { flex-wrap:nowrap; gap:clamp(3px,.55vw,7px); }
.expanded-route .node { width:clamp(23px,2.05vw,30px); height:clamp(23px,2.05vw,30px); flex:0 0 auto; font-size:clamp(.66rem,.85vw,.78rem); }
.expanded-route .wild-node { border-color:#78c874; background:#e5f4c9; color:#24552c; border-radius:50%; }
.expanded-route .rocket-node { font-size:clamp(.95rem,1.35vw,1.18rem); line-height:1; }
.expanded-route .wild-node.now { border-color:#d8ff9c; background:#408d48; color:#fff; box-shadow:0 0 0 4px rgba(89,184,83,.2),0 3px 0 rgba(24,69,34,.35); }
:root.dark .expanded-route .wild-node { border-color:#79b978; background:#193c2a; color:#d8ffd3; }

.route-pokemon-grid .move-card { grid-template-rows:minmax(0,1fr) auto; padding:10px; background:linear-gradient(150deg,#fffdf2,#e4eff0); }
.move-disc { position:relative; align-self:center; justify-self:center; width:clamp(48px,5.2vw,74px); aspect-ratio:1; display:grid; place-items:center; border:4px solid #324b63; border-radius:50%; background:conic-gradient(#5ab6d2 0 12.5%,#dcecf0 0 25%,#5ab6d2 0 37.5%,#dcecf0 0 50%,#5ab6d2 0 62.5%,#dcecf0 0 75%,#5ab6d2 0 87.5%,#dcecf0 0); box-shadow:inset 0 0 0 5px rgba(255,255,255,.55),0 4px 0 rgba(28,48,65,.22); transform:rotate(-8deg); }
.move-disc::before { content:""; width:34%; aspect-ratio:1; border:3px solid #31485d; border-radius:50%; background:#f8d452; box-shadow:inset 0 0 0 3px #fff4a5; }
.move-disc i { position:absolute; right:-7px; bottom:3px; padding:2px 5px; border:2px solid #263c50; border-radius:4px; background:#e85961; color:#fff; font-size:clamp(.5rem,.65vw,.62rem); font-style:normal; font-weight:950; letter-spacing:.05em; transform:rotate(8deg); }
.route-pokemon-grid .move-card.correct .move-disc,.route-pokemon-grid .move-card.wrong .move-disc { filter:saturate(.9) brightness(1.08); }
:root.dark .route-pokemon-grid .move-card { background:linear-gradient(150deg,#20394f,#102537); }
:root.dark .move-disc { border-color:#a9c7dd; background:conic-gradient(#347c9e 0 12.5%,#7894a8 0 25%,#347c9e 0 37.5%,#7894a8 0 50%,#347c9e 0 62.5%,#7894a8 0 75%,#347c9e 0 87.5%,#7894a8 0); box-shadow:inset 0 0 0 7px rgba(255,255,255,.12),0 6px 0 rgba(0,0,0,.35); }

.wild-screen { position:relative; min-height:calc(100vh - 86px); overflow:hidden; color:#183047; background:linear-gradient(180deg,#bce2ef 0 47%,#b5d98d 47% 62%,#759f58 62%); border:3px solid #5a7f91; border-radius:8px; box-shadow:inset 0 0 0 3px rgba(255,255,255,.48),0 8px 0 rgba(34,66,64,.25); }
.wild-screen::before { content:""; position:absolute; inset:0; pointer-events:none; opacity:.38; background:linear-gradient(135deg,rgba(255,255,255,.32) 25%,transparent 25%) 0 0/24px 24px,linear-gradient(315deg,rgba(255,255,255,.2) 25%,transparent 25%) 0 0/24px 24px; }
.wild-route { position:relative; z-index:5; padding:10px 70px 4px; }
.wild-intro-stage { position:relative; z-index:1; min-height:calc(100vh - 155px); display:grid; grid-template-columns:minmax(240px,.9fr) minmax(330px,1.1fr); align-items:center; gap:clamp(20px,5vw,80px); width:min(1100px,92%); margin:auto; }
.wild-grass { position:absolute; left:-7%; bottom:15%; width:48%; height:100px; }
.wild-grass i { position:absolute; bottom:0; width:13px; height:74px; border-radius:100% 0; background:#2d733f; transform-origin:bottom; transform:rotate(var(--grass-angle,-24deg)); box-shadow:18px 7px 0 #438b43,36px -5px 0 #286838,54px 10px 0 #55984c,72px 0 0 #347d41,90px 8px 0 #4c9147,108px -7px 0 #286638,126px 9px 0 #579b4d,144px 2px 0 #2f7540,162px 8px 0 #438b43,180px -4px 0 #286838,198px 9px 0 #55984c,216px 0 0 #347d41; }
.wild-pokemon-entrance { position:relative; display:grid; place-items:center; align-self:end; margin-bottom:18%; animation:wild-appear .8s cubic-bezier(.18,.82,.25,1.18) both; }
.wild-pokemon-entrance img { width:clamp(190px,24vw,330px); height:clamp(190px,24vw,330px); object-fit:contain; filter:drop-shadow(0 18px 7px rgba(24,56,31,.35)); }
.unknown-held-item { position:absolute; z-index:4; top:-5px; right:14%; width:52px; height:52px; display:grid; place-items:center; border:4px solid #283e52; border-radius:50%; background:radial-gradient(circle at 35% 28%,#fff7a3,#e4b72b 60%,#a36d17); color:#24364a; font-size:1.7rem; font-weight:1000; box-shadow:0 0 0 5px rgba(255,255,255,.55),0 7px 0 rgba(37,57,70,.32); animation:held-item-float 1.35s ease-in-out infinite; }
.wild-dialog { align-self:center; padding:clamp(22px,3vw,40px); border:4px solid #314d63; border-radius:14px; background:rgba(255,252,232,.94); box-shadow:inset 0 0 0 4px #d5e9cb,0 9px 0 rgba(32,61,62,.28); }
.wild-dialog p,.wild-kicker { margin:0 0 8px; color:#277c5a; font-size:.72rem; font-weight:950; letter-spacing:.14em; }
.wild-dialog h2 { margin:0 0 12px; font-size:clamp(1.5rem,3vw,2.45rem); line-height:1.05; }
.wild-dialog > span { display:block; color:#41596a; font-weight:700; line-height:1.5; }
.wild-primary { margin-top:22px; border-color:#244a42; background:linear-gradient(#52a95b,#267743); color:#fff; box-shadow:0 5px 0 #17482f; }
.wild-primary:hover { background:linear-gradient(#67bd6b,#318b4e); transform:translateY(-1px); }

.wild-battle-screen { display:grid; grid-template-rows:auto minmax(190px,.9fr) minmax(320px,1.1fr); }
.wild-battlefield { position:relative; z-index:1; display:grid; grid-template-columns:1fr auto 1fr; align-items:end; width:min(950px,88%); margin:auto; }
.wild-combatant { position:relative; display:grid; justify-items:center; align-content:end; }
.wild-combatant > span:first-child:not(.unknown-held-item) { padding:4px 10px; border-radius:4px; background:#173a4d; color:#dff8ff; font-size:.63rem; font-weight:950; letter-spacing:.12em; }
.wild-combatant img { width:clamp(130px,17vw,220px); height:clamp(130px,17vw,220px); object-fit:contain; filter:drop-shadow(0 13px 5px rgba(24,53,34,.35)); }
.wild-combatant strong { min-width:150px; padding:6px 18px; border:3px solid #2d4b5d; border-radius:7px; background:#f8f1d5; text-align:center; box-shadow:0 4px 0 rgba(34,60,61,.28); }
.wild-combatant.player { transform:translateX(-8%); }
.wild-combatant.opponent { transform:translateX(8%); }
.wild-combatant.opponent .unknown-held-item { right:8%; }
.wild-battle-flash { align-self:center; width:58px; height:58px; display:grid; place-items:center; border:4px solid #fff; border-radius:50%; background:#e64d55; color:#fff; font-size:1.05rem; font-weight:1000; box-shadow:0 0 0 5px rgba(230,77,85,.25); animation:wild-vs-pulse 1.4s ease-in-out infinite; }
.wild-question-card { position:relative; z-index:2; align-self:end; width:min(960px,92%); margin:0 auto 18px; padding:clamp(16px,2vw,25px); border:4px solid #304d63; border-radius:14px; background:rgba(255,253,239,.96); text-align:center; box-shadow:inset 0 0 0 4px #dcecd0,0 8px 0 rgba(30,57,62,.3); }
.wild-question-card h2 { width:min(800px,100%); margin:0 auto 6px; font-size:clamp(1rem,1.6vw,1.35rem); line-height:1.35; }
.wild-question-card > p:not(.wild-kicker) { margin:5px 0 12px; color:#506273; font-weight:750; }
.wild-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.wild-answer { min-height:54px; display:flex; align-items:center; justify-content:center; gap:9px; border:3px solid #688398; border-radius:8px; background:#edf4e6; color:#21384a; cursor:pointer; box-shadow:0 4px 0 #b3c5b2; transition:.16s ease; }
.wild-answer:hover:not(:disabled) { border-color:#348b5c; background:#dff4cf; transform:translateY(-2px); }
.wild-option-ball { width:20px; height:20px; flex:0 0 auto; border:3px solid #31465a; border-radius:50%; background:linear-gradient(#e84f57 0 44%,#283c4e 44% 58%,#f8f4df 58%); }
.wild-answer.correct { border-color:#4bd584; background:#176944; color:#fff; box-shadow:0 4px 0 #0e452d; }
.wild-answer.wrong { border-color:#ff7580; background:#7a2733; color:#fff; box-shadow:0 4px 0 #481820; }
.wild-continue { margin:16px auto 0; }

.wild-outcome-screen { display:grid; grid-template-rows:auto 1fr; place-items:center; }
.wild-outcome { position:relative; z-index:2; width:min(650px,90%); padding:clamp(25px,4vw,45px); border:4px solid #344f64; border-radius:18px; background:rgba(255,252,234,.96); text-align:center; box-shadow:inset 0 0 0 5px rgba(167,211,167,.45),0 10px 0 rgba(32,58,61,.3); }
.wild-outcome.success { border-color:#3c9460; }
.wild-outcome.failure { border-color:#bc5260; }
.wild-outcome-pokemon { position:absolute; top:-105px; right:-65px; width:180px; height:180px; object-fit:contain; filter:drop-shadow(0 10px 5px rgba(0,0,0,.25)); transform:rotate(7deg); }
.wild-outcome-icon { width:64px; height:64px; display:grid; place-items:center; margin:0 auto 10px; border:4px solid; border-radius:50%; font-size:2rem; font-weight:1000; }
.wild-outcome-icon.success { border-color:#42a66a; background:#dff6d5; color:#267b4a; }
.wild-outcome-icon.failure { border-color:#c44a59; background:#ffe2df; color:#a22539; }
.wild-outcome h2 { margin:5px 0 10px; font-size:clamp(1.45rem,3vw,2.2rem); }
.wild-outcome p { line-height:1.5; color:#4a6070; }
.wild-drop,.wild-theft { width:max-content; max-width:100%; display:flex; align-items:center; justify-content:center; gap:14px; margin:20px auto 0; padding:12px 20px; border:3px solid #5a9270; border-radius:10px; background:#e5f3d6; box-shadow:0 4px 0 #a4bea1; }
.wild-theft { border-color:#bb6871; background:#f6d9d5; box-shadow:0 4px 0 #c7a19d; }
.wild-drop .item-icon,.wild-theft .item-icon { width:54px; height:54px; }
.wild-drop span { display:grid; justify-items:start; }
.wild-drop small { color:#397457; font-size:.62rem; font-weight:950; letter-spacing:.11em; }

:root.dark .wild-screen { color:#eff8ff; border-color:#6d879d; background:linear-gradient(180deg,#0e2637 0 47%,#183e35 47% 62%,#102d24 62%); box-shadow:inset 0 0 0 3px rgba(143,190,211,.12),0 8px 0 rgba(0,0,0,.38); }
:root.dark .wild-screen::before { opacity:.12; }
:root.dark .wild-dialog,:root.dark .wild-question-card,:root.dark .wild-outcome { border-color:#7892a8; background:rgba(12,28,41,.96); box-shadow:inset 0 0 0 4px rgba(75,130,105,.18),0 8px 0 rgba(0,0,0,.38); }
:root.dark .wild-dialog > span,:root.dark .wild-question-card > p:not(.wild-kicker),:root.dark .wild-outcome p { color:#b8cddd; }
:root.dark .wild-combatant strong { border-color:#7690a6; background:#142d40; color:#f4f9ff; box-shadow:0 4px 0 #050c12; }
:root.dark .wild-answer { border-color:#637d91; background:#193448; color:#eef7ff; box-shadow:0 4px 0 #07121b; }
:root.dark .wild-answer:hover:not(:disabled) { border-color:#7ed39a; background:#214b43; }
:root.dark .wild-answer.correct { border-color:#63e59c; background:#155c3f; }
:root.dark .wild-answer.wrong { border-color:#ff7580; background:#702632; }
:root.dark .wild-drop { border-color:#57a879; background:#173f32; box-shadow:0 4px 0 #071b14; }
:root.dark .wild-theft { border-color:#c2606e; background:#47232c; box-shadow:0 4px 0 #1d0b10; }

@keyframes wild-appear { from { opacity:0; transform:translateX(70px) scale(.65); filter:brightness(3); } 70% { filter:brightness(1.4); } }
@keyframes held-item-float { 50% { transform:translateY(-9px) rotate(5deg); } }
@keyframes wild-vs-pulse { 50% { transform:scale(1.1); box-shadow:0 0 0 10px rgba(230,77,85,.12); } }
@media (max-width:760px) {
  .wild-screen { min-height:720px; }
  .wild-route { padding:8px 54px 3px; }
  .wild-intro-stage { min-height:650px; grid-template-columns:1fr; grid-template-rows:1fr auto; gap:0; align-content:center; }
  .wild-pokemon-entrance { align-self:center; margin:20px 0 -20px; }
  .wild-pokemon-entrance img { width:190px; height:190px; }
  .wild-grass { left:20%; bottom:42%; width:60%; transform:scale(.75); }
  .wild-dialog { align-self:end; padding:20px; }
  .wild-battle-screen { grid-template-rows:auto 230px 1fr; }
  .wild-battlefield { width:96%; }
  .wild-combatant img { width:125px; height:125px; }
  .wild-combatant strong { min-width:110px; padding:5px 8px; font-size:.75rem; }
  .wild-battle-flash { width:43px; height:43px; font-size:.8rem; }
  .wild-options { grid-template-columns:1fr; }
  .wild-question-card { margin-bottom:10px; padding:13px; }
  .wild-answer { min-height:45px; }
  .wild-outcome-pokemon { top:-80px; right:-25px; width:125px; height:125px; }
}
@media (max-width:460px) {
  .expanded-route { gap:2px; }
  .expanded-route .node { width:22px; height:22px; border-width:2px; font-size:.6rem; }
  .wild-route { padding-inline:45px; }
  .wild-combatant.player,.wild-combatant.opponent { transform:none; }
  .wild-combatant img { width:102px; height:102px; }
  .wild-combatant > span:first-child:not(.unknown-held-item) { display:none; }
  .wild-combatant .unknown-held-item { width:35px; height:35px; border-width:3px; font-size:1.1rem; }
}

/* Regional progression announcement */
.region-unlock-backdrop { position:fixed; z-index:110; inset:0; background:rgba(12,25,36,.72); backdrop-filter:blur(6px); animation:unlock-fade .25s ease both; }
.region-unlock-modal { position:fixed; z-index:111; top:50%; left:50%; width:min(820px,calc(100vw - 28px)); max-height:calc(100vh - 28px); padding:clamp(18px,3vw,30px); overflow:auto; border:5px solid #456479; border-radius:22px; background:linear-gradient(145deg,#fffdf0,#e5f1df); color:#183047; box-shadow:0 12px 0 #243e4c,0 30px 80px rgba(0,0,0,.42),inset 0 0 0 3px rgba(255,255,255,.72); transform:translate(-50%,-50%); animation:unlock-modal-in .42s cubic-bezier(.2,.86,.25,1.15) both; }
.region-unlock-modal::before { content:""; position:absolute; top:0; left:0; right:0; height:11px; background:linear-gradient(90deg,var(--unlock-color),#f1ca45,#4d9ac2); }
.region-unlock-rays { position:absolute; top:-180px; right:-160px; width:430px; height:430px; border-radius:50%; opacity:.12; background:repeating-conic-gradient(from 0deg,var(--unlock-color) 0 9deg,transparent 9deg 18deg); animation:unlock-rays 18s linear infinite; pointer-events:none; }
.region-unlock-modal > header { position:relative; display:grid; grid-template-columns:150px minmax(0,1fr); align-items:center; gap:22px; padding-bottom:20px; border-bottom:3px solid #9ab0ad; }
.region-unlock-emblem { width:150px; height:112px; overflow:hidden; border:4px solid var(--unlock-color); border-radius:17px; background:#dbe7d6; box-shadow:0 6px 0 #91a09a; }
.region-unlock-emblem img { width:100%; height:100%; object-fit:cover; }
.region-unlock-modal header small { display:block; margin-bottom:5px; color:var(--unlock-color); font-size:.68rem; font-weight:1000; letter-spacing:.16em; }
.region-unlock-modal header h2 { margin:0; font-size:clamp(2rem,5vw,3.4rem); line-height:1; text-shadow:2px 2px 0 #fff; }
.region-unlock-modal header p { margin:8px 0 0; color:#5e7380; font-weight:800; }
.region-unlock-body { position:relative; display:grid; grid-template-columns:1fr 1fr; gap:13px; margin-top:18px; }
.region-unlock-body article { padding:15px 17px; border:3px solid #66869a; border-radius:13px; background:rgba(244,251,239,.82); box-shadow:0 4px 0 #a7b2ae; }
.region-unlock-body article.unlock-changed { border-color:#a17a2d; background:rgba(255,247,215,.84); }
.region-unlock-body h3 { display:flex; align-items:center; gap:8px; margin:0 0 10px; font-size:.92rem; }
.region-unlock-body h3 span { display:grid; place-items:center; width:28px; height:28px; border-radius:50%; background:#3c8a61; color:#fff; }
.region-unlock-body .unlock-changed h3 span { background:#be8d27; }
.region-unlock-body ul { display:grid; gap:8px; margin:0; padding-left:19px; }
.region-unlock-body li { color:#425b69; font-size:.72rem; font-weight:750; line-height:1.35; }
.region-unlock-body li::marker { color:#3d9365; }
.region-unlock-body aside { grid-column:1 / -1; display:grid; grid-template-columns:42px minmax(0,1fr); align-items:center; gap:12px; padding:12px 15px; border:3px solid #596f91; border-radius:12px; background:linear-gradient(100deg,#e4eef8,#edf4e8); }
.region-unlock-body aside > span { display:grid; place-items:center; width:39px; height:39px; border:3px solid #46607e; border-radius:9px; background:#5b7fa5; color:#fff; }
.region-unlock-body aside p { margin:0; color:#465d6c; font-size:.73rem; font-weight:750; line-height:1.38; }
.region-unlock-body aside strong { display:block; margin-bottom:2px; color:#243c50; }
.region-unlock-continue { display:grid; grid-template-columns:auto auto; align-items:center; column-gap:9px; min-width:min(340px,100%); margin:20px auto 3px; padding:11px 24px; border-color:#285f46; border-radius:10px; background:linear-gradient(#59bd85,#287b57); color:#fff; box-shadow:0 6px 0 #1d5a3e; }
.region-unlock-continue > span { grid-row:1 / 3; }.region-unlock-continue strong,.region-unlock-continue small { text-align:left; }.region-unlock-continue small { color:#d4ffe6; }
:root.dark .region-unlock-backdrop { background:rgba(0,5,10,.82); }
:root.dark .region-unlock-modal { border-color:#8ca7b9; background:linear-gradient(145deg,#142b3c,#081722); color:#f2f8fc; box-shadow:0 12px 0 #02080d,0 30px 80px rgba(0,0,0,.65),inset 0 0 0 3px rgba(255,255,255,.06); }
:root.dark .region-unlock-modal > header { border-color:#496579; }
:root.dark .region-unlock-emblem { box-shadow:0 6px 0 #02090e; }
:root.dark .region-unlock-modal header h2 { text-shadow:2px 2px 0 #02070b; }
:root.dark .region-unlock-modal header p { color:#aec1cd; }
:root.dark .region-unlock-body article { border-color:#55788d; background:rgba(21,49,65,.86); box-shadow:0 4px 0 #030a0f; }
:root.dark .region-unlock-body article.unlock-changed { border-color:#9c7934; background:rgba(56,45,25,.84); }
:root.dark .region-unlock-body li { color:#cad8df; }
:root.dark .region-unlock-body aside { border-color:#58758c; background:linear-gradient(100deg,#172d43,#172f32); }
:root.dark .region-unlock-body aside p { color:#c0d1dc; }
:root.dark .region-unlock-body aside strong { color:#fff; }
@keyframes unlock-fade { from { opacity:0; } }
@keyframes unlock-modal-in { from { opacity:0; transform:translate(-50%,-45%) scale(.88); } }
@keyframes unlock-rays { to { transform:rotate(360deg); } }
@media (max-width:650px) {
  .region-unlock-modal > header { grid-template-columns:92px minmax(0,1fr); gap:13px; }
  .region-unlock-emblem { width:92px; height:78px; }
  .region-unlock-modal header small { font-size:.52rem; }
  .region-unlock-body { grid-template-columns:1fr; }
  .region-unlock-body aside { grid-column:1; }
}

/* Gym victory celebration */
.badge-celebration {
  position: relative;
  isolation: isolate;
  height: 100%;
  padding: clamp(10px, 2.2vh, 22px);
  overflow: hidden;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(248, 251, 238, .93), rgba(224, 239, 231, .88)),
    var(--badge-gym-bg) center / cover;
}
.badge-celebration::before {
  content: "";
  position: absolute;
  z-index: -2;
  top: 50%;
  left: 50%;
  width: 160vmax;
  height: 160vmax;
  opacity: .18;
  background: repeating-conic-gradient(from 0deg, var(--badge-color) 0 8deg, transparent 8deg 18deg);
  transform: translate(-50%, -50%) rotate(0);
  transform-origin: center;
  animation: badgeVictoryRays 28s linear infinite;
}
.badge-celebration::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .84), transparent 34%),
    linear-gradient(180deg, transparent 62%, rgba(51, 82, 67, .16));
  pointer-events: none;
}
.badge-celebration-atmosphere {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.badge-celebration-atmosphere i {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, .9);
  background: var(--badge-color);
  box-shadow: 0 0 12px rgba(255, 255, 255, .7);
  transform: rotate(45deg);
  animation: badgeVictoryParticle 4.8s ease-in-out infinite;
}
.badge-celebration-atmosphere i:nth-child(1) { top: 14%; left: 12%; animation-delay: -.5s; }
.badge-celebration-atmosphere i:nth-child(2) { top: 23%; right: 14%; animation-delay: -1.7s; }
.badge-celebration-atmosphere i:nth-child(3) { bottom: 16%; left: 19%; animation-delay: -2.8s; }
.badge-celebration-atmosphere i:nth-child(4) { bottom: 12%; right: 18%; animation-delay: -3.6s; }
.badge-celebration-atmosphere i:nth-child(5) { top: 48%; right: 7%; animation-delay: -2.2s; }
.badge-victory-card {
  width: min(910px, 96%);
  max-height: 100%;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  gap: clamp(7px, 1.45vh, 13px);
  padding: clamp(13px, 2.5vh, 24px);
  border: 4px solid #496b7b;
  border-radius: 20px;
  background: linear-gradient(150deg, rgba(255, 253, 239, .98), rgba(238, 246, 225, .96));
  color: #172c40;
  box-shadow:
    0 9px 0 #304e5a,
    0 22px 48px rgba(28, 48, 57, .27),
    inset 0 0 0 3px rgba(255, 255, 255, .8);
}
.badge-victory-head {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding-bottom: clamp(6px, 1.2vh, 11px);
  border-bottom: 2px solid rgba(63, 93, 106, .35);
  text-align: center;
}
.badge-victory-kicker {
  color: #ad7420;
  font-size: clamp(.64rem, 1.1vw, .82rem);
  font-weight: 1000;
  letter-spacing: .18em;
}
.badge-victory-head p {
  color: #617986;
  font-size: clamp(.57rem, .9vw, .7rem);
  font-weight: 950;
  letter-spacing: .12em;
}
.badge-victory-main {
  display: grid;
  grid-template-columns: clamp(150px, 22vw, 210px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(14px, 3vw, 34px);
  width: min(720px, 100%);
  margin: 0 auto;
}
.badge-stage {
  position: relative;
  min-height: clamp(135px, 22vh, 190px);
  display: grid;
  place-items: center;
}
.badge-stage-ring {
  position: absolute;
  width: clamp(126px, 18vh, 166px);
  aspect-ratio: 1;
  border: 3px dashed color-mix(in srgb, var(--badge-color) 72%, #5f7480);
  border-radius: 50%;
  opacity: .6;
  animation: badgeStageRing 16s linear infinite;
}
.badge-stage .earned-badge-big {
  position: relative;
  width: clamp(104px, 16vh, 144px);
  height: clamp(104px, 16vh, 144px);
  padding: 0;
  overflow: hidden;
  border: 5px solid #f7fbff;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .78), transparent 22%),
    color-mix(in srgb, var(--badge-color) 74%, #d6a64d);
  box-shadow:
    0 0 0 5px #496475,
    0 9px 0 #344d59,
    0 14px 24px rgba(22, 46, 58, .32),
    inset 0 0 18px rgba(255, 255, 255, .42);
}
.badge-stage .earned-badge-big img {
  position: absolute;
  inset: 12%;
  width: 76% !important;
  height: 76% !important;
  max-width: 76% !important;
  max-height: 76% !important;
  object-fit: contain !important;
  display: block;
  filter: drop-shadow(0 4px 2px rgba(25, 39, 47, .35));
}
.badge-stage > small {
  position: absolute;
  bottom: 0;
  padding: 4px 10px;
  border: 2px solid #526d79;
  border-radius: 999px;
  background: #f9f5dd;
  color: #6c7c82;
  font-size: .55rem;
  font-weight: 1000;
  letter-spacing: .12em;
}
.badge-spark {
  position: absolute;
  z-index: 3;
  color: #e9a727;
  font-size: clamp(1rem, 2.2vw, 1.65rem);
  text-shadow: 0 2px 0 #fff;
  animation: badgeSpark 1.7s ease-in-out infinite;
}
.badge-spark-one { top: 14%; left: 8%; }
.badge-spark-two { top: 26%; right: 5%; animation-delay: -.6s; }
.badge-spark-three { bottom: 15%; right: 13%; animation-delay: -1.1s; }
.badge-victory-copy {
  display: grid;
  gap: clamp(4px, .8vh, 8px);
  text-align: left;
}
.badge-victory-copy > span {
  color: #b47b21;
  font-size: clamp(.62rem, 1vw, .76rem);
  font-weight: 1000;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.badge-victory-copy h2 {
  color: #172c40;
  font-size: clamp(2rem, 5vw, 3.55rem);
  line-height: .95;
  text-align: left;
  text-shadow: 2px 2px 0 #fff;
}
.badge-victory-copy p {
  max-width: 540px;
  color: #536c78;
  font-size: clamp(.83rem, 1.35vw, 1.05rem);
  font-weight: 750;
  line-height: 1.35;
}
.badge-victory-copy p strong { color: #263f4b; }
.badge-reward-panel {
  overflow: hidden;
  border: 3px solid #9b7b34;
  border-radius: 12px;
  background: linear-gradient(110deg, #fff5cf, #f3ead1);
  box-shadow: 0 4px 0 rgba(105, 83, 37, .25);
}
.badge-reward-panel > header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-bottom: 2px solid rgba(148, 111, 38, .35);
  background: rgba(226, 183, 71, .18);
}
.badge-reward-panel > header > span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #c88d26;
  color: #fff;
}
.badge-reward-panel header div { display: grid; }
.badge-reward-panel header small,
.badge-reward-item small {
  color: #997027;
  font-size: .53rem;
  font-weight: 1000;
  letter-spacing: .11em;
}
.badge-reward-panel header strong { font-size: .76rem; }
.badge-reward-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 7px;
  padding: 8px;
}
.badge-reward-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 2px solid rgba(132, 98, 36, .38);
  border-radius: 9px;
  background: rgba(255, 253, 238, .82);
  text-align: left;
}
.badge-reward-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: #e8dfb9;
  font-size: 1.45rem;
}
.badge-reward-icon .item-icon { width: 32px; height: 32px; }
.badge-reward-item > div { min-width: 0; display: grid; gap: 2px; }
.badge-reward-item strong {
  min-width: 0;
  color: #2f414a;
  font-size: clamp(.68rem, 1vw, .82rem);
  line-height: 1.2;
}
.badge-reward-item p { color: #6b7779; font-size: .6rem; font-weight: 800; }
.badge-victory-progress {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.badge-victory-progress > div:first-child { display: grid; }
.badge-victory-progress small {
  color: #657985;
  font-size: .52rem;
  font-weight: 1000;
  letter-spacing: .1em;
}
.badge-victory-progress strong { color: #314957; font-size: .84rem; }
.badge-victory-case {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(8, clamp(34px, 4.5vw, 44px));
  justify-content: center;
  gap: clamp(3px, .7vw, 7px);
}
.badge-victory-slot {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 4px;
  border: 2px solid #738590;
  border-radius: 7px;
  background: #c8d1ce;
  filter: grayscale(1) brightness(.68);
  opacity: .72;
}
.badge-victory-slot img {
  width: 84% !important;
  height: 84% !important;
  max-width: 84% !important;
  max-height: 84% !important;
  object-fit: contain !important;
  display: block;
}
.badge-victory-slot.earned {
  border-color: #b67b22;
  background: #fff1b8;
  filter: none;
  opacity: 1;
}
.badge-victory-slot.current {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--badge-color), 0 0 14px color-mix(in srgb, var(--badge-color) 60%, transparent);
  animation: badgeCurrentSlot 1.25s ease-in-out infinite;
}
.badge-next-button {
  width: min(430px, 100%);
  min-height: 50px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 8px 16px;
  border-color: #714348;
  border-radius: 10px;
  background: linear-gradient(#ef625e, #c8343b);
  color: #fff;
  box-shadow: 0 5px 0 #7d2930, 0 10px 20px rgba(76, 33, 37, .2);
}
.badge-next-button div { min-width: 0; display: grid; text-align: center; }
.badge-next-button strong { font-size: clamp(.82rem, 1.3vw, 1rem); }
.badge-next-button small {
  overflow: hidden;
  color: #ffe4df;
  font-size: clamp(.53rem, .85vw, .66rem);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root.dark .badge-celebration {
  background:
    linear-gradient(135deg, rgba(7, 16, 29, .93), rgba(15, 31, 44, .9)),
    var(--badge-gym-bg) center / cover;
}
:root.dark .badge-celebration::after {
  background:
    radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--badge-color) 24%, transparent), transparent 35%),
    linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .35));
}
:root.dark .badge-victory-card {
  border-color: #8099ad;
  background: linear-gradient(150deg, rgba(22, 38, 55, .98), rgba(10, 24, 37, .97));
  color: #edf6ff;
  box-shadow: 0 9px 0 #030a10, 0 24px 52px rgba(0, 0, 0, .52), inset 0 0 0 3px rgba(255, 255, 255, .05);
}
:root.dark .badge-victory-head { border-color: rgba(154, 181, 201, .25); }
:root.dark .badge-victory-head p,
:root.dark .badge-victory-copy p,
:root.dark .badge-victory-progress small { color: #aebfcd; }
:root.dark .badge-victory-copy h2 { color: #f5f9ff; text-shadow: 2px 2px 0 #02070b; }
:root.dark .badge-victory-copy p strong,
:root.dark .badge-victory-progress strong { color: #fff; }
:root.dark .badge-stage > small { border-color: #708ba0; background: #172b3c; color: #d3e0e9; }
:root.dark .badge-reward-panel {
  border-color: #96743a;
  background: linear-gradient(110deg, #352c1e, #24251f);
  box-shadow: 0 4px 0 #050708;
}
:root.dark .badge-reward-panel > header { border-color: rgba(219, 173, 75, .24); background: rgba(179, 128, 35, .12); }
:root.dark .badge-reward-panel header strong,
:root.dark .badge-reward-item strong { color: #f4f7f8; }
:root.dark .badge-reward-item { border-color: rgba(202, 161, 74, .27); background: rgba(13, 25, 34, .7); }
:root.dark .badge-reward-icon { background: #263746; }
:root.dark .badge-reward-item p { color: #aebbc2; }
:root.dark .badge-victory-slot { border-color: #536775; background: #101922; }
:root.dark .badge-victory-slot.earned { border-color: #c79438; background: #3e351f; }

@keyframes badgeVictoryRays {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes badgeVictoryParticle {
  0%, 100% { opacity: .25; transform: translateY(7px) rotate(45deg) scale(.7); }
  50% { opacity: 1; transform: translateY(-9px) rotate(135deg) scale(1); }
}
@keyframes badgeStageRing { to { transform: rotate(360deg); } }
@keyframes badgeSpark { 0%, 100% { opacity: .42; transform: scale(.7) rotate(-8deg); } 50% { opacity: 1; transform: scale(1.15) rotate(8deg); } }
@keyframes badgeCurrentSlot { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

@media (max-height: 720px) and (min-width: 701px) {
  .badge-victory-card { gap: 6px; padding: 10px 18px; }
  .badge-victory-main { grid-template-columns: 145px minmax(0, 1fr); }
  .badge-stage { min-height: 128px; }
  .badge-stage .earned-badge-big { width: 104px; height: 104px; }
  .badge-stage-ring { width: 124px; }
  .badge-reward-panel > header { padding-block: 5px; }
  .badge-reward-list { padding: 6px; }
  .badge-reward-item { padding-block: 5px; }
  .badge-victory-case { grid-template-columns: repeat(8, 34px); }
  .badge-next-button { min-height: 45px; padding-block: 5px; }
}
@media (max-width: 700px) {
  .badge-celebration { height: auto; min-height: 680px; overflow: hidden; }
  .badge-victory-card { width: 100%; max-height: none; }
  .badge-victory-main { grid-template-columns: 1fr; gap: 6px; text-align: center; }
  .badge-stage { min-height: 145px; }
  .badge-victory-copy { justify-items: center; text-align: center; }
  .badge-victory-copy h2 { text-align: center; }
  .badge-victory-progress { grid-template-columns: 1fr; gap: 6px; }
  .badge-victory-progress > div:first-child { grid-template-columns: 1fr auto; align-items: center; }
  .badge-victory-case { gap: 3px; }
  .badge-victory-case { grid-template-columns: repeat(8, minmax(27px, 36px)); }
}

/* Game modes and Battle Tower */
.difficulty-option.selected {
  border-color: #60d7a0;
  box-shadow: 0 0 0 2px rgba(96,215,160,.25), 0 8px 0 rgba(5,20,31,.42);
}
.tower-hud { border-bottom-color: #e3b84c; }
.tower-hud .hud-region { color: #f5ca61; }
.tower-score-pill { display:flex; align-items:center; gap:9px; border-color:#d7aa3e; }
.tower-score-pill strong { color:#ffd96f; font-size:1.35rem; line-height:1; }
.tower-start-screen,
.tower-trial-screen,
.tower-partner-reward,
.tower-end-screen {
  position:relative;
  min-height:calc(100vh - 78px);
  overflow:hidden;
  background:
    linear-gradient(135deg,rgba(6,18,32,.97),rgba(19,34,53,.94)),
    url("assets/ui/battle-tower.png?v=20260718-panorama") center/cover;
}
.tower-start-screen { padding:18px clamp(12px,2.4vw,38px); }
.tower-start-banner {
  grid-template-columns:minmax(0,1fr) 132px;
  gap:18px;
  padding:0 18px 0 22px;
  border-color:#d7aa3e;
  background:linear-gradient(110deg,rgba(10,30,47,.97),rgba(28,48,68,.94));
}
.tower-start-banner .starter-banner-copy { padding-left:0; }
.tower-record-card {
  width:132px; min-width:0; padding:12px 14px; display:grid; place-items:center;
  border:2px solid #e1b84e; border-radius:14px; background:rgba(7,22,34,.8);
  color:#fff;
}
.tower-record-card small { color:#f5ca61; letter-spacing:.14em; }
.tower-record-card strong { font-size:2.6rem; line-height:1; }
.tower-record-card span { color:#b8c9d7; }
.tower-trial-screen {
  display:grid;
  grid-template-columns:minmax(190px,235px) minmax(0,1fr);
  gap:12px;
  padding:12px;
}
.tower-grid-glow {
  position:absolute; inset:-20%;
  background:repeating-linear-gradient(90deg,transparent 0 80px,rgba(240,199,90,.025) 81px 82px),
             repeating-linear-gradient(0deg,transparent 0 80px,rgba(240,199,90,.025) 81px 82px);
  transform:perspective(700px) rotateX(52deg);
  pointer-events:none;
}
.tower-partner-card,
.tower-challenge-panel { position:relative; z-index:1; }
.tower-partner-card {
  align-self:stretch; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:16px 12px; color:#eef8ff; text-align:center;
  border:2px solid #7895aa; border-radius:16px;
  background:linear-gradient(155deg,rgba(16,43,61,.96),rgba(8,22,34,.96));
}
.tower-partner-card small { color:#69c9ff; letter-spacing:.12em; font-weight:800; }
.tower-partner-card img { width:min(180px,80%); aspect-ratio:1; object-fit:contain; margin:14px 0 2px; }
.tower-partner-card strong { font-size:1.45rem; }
.tower-partner-card span { margin-top:12px; color:#9fb5c4; font-size:.82rem; line-height:1.4; }
.tower-challenge-panel {
  min-width:0; padding:10px; border:2px solid #7895aa; border-radius:16px;
  background:rgba(8,23,35,.94);
}
.tower-challenge-panel > header { text-align:center; color:#eef8ff; padding:2px 8px 8px; }
.tower-challenge-panel > header > span { color:#f5ca61; font-size:.72rem; font-weight:900; letter-spacing:.18em; }
.tower-challenge-panel > header h2 { margin:2px 0; font-size:clamp(1.25rem,2vw,1.85rem); }
.tower-challenge-panel > header p { margin:0; color:#dce7ee; }
.tower-challenge-panel > header .phase-key {
  color:#ff6573;
  font:inherit;
  font-weight:950;
  letter-spacing:normal;
}
.tower-challenge-panel .route-notice { margin:6px 0 10px; }
.tower-pokemon-grid { height:calc(100vh - 285px); min-height:360px; }
.tower-challenge-panel .route-actions { margin-top:10px; padding-bottom:2px; }
.tower-partner-reward,
.tower-end-screen { display:grid; place-items:center; padding:18px; }
.tower-reward-rays {
  position:absolute; width:90vmin; aspect-ratio:1; border-radius:50%;
  background:repeating-conic-gradient(from 0deg,rgba(250,209,99,.12) 0 8deg,transparent 8deg 18deg);
  animation:badgeVictoryRays 24s linear infinite;
}
.tower-partner-reward article,
.tower-end-screen article {
  position:relative; z-index:1; width:min(760px,96vw); padding:clamp(22px,4vw,46px);
  text-align:center; color:#eef8ff; border:3px solid #d9b34e; border-radius:22px;
  background:linear-gradient(145deg,rgba(11,31,47,.98),rgba(20,42,59,.98));
  box-shadow:0 22px 50px rgba(0,0,0,.45),inset 0 0 40px rgba(250,208,92,.08);
}
.tower-partner-reward article > small,
.tower-end-screen article > small { color:#f5ca61; font-weight:900; letter-spacing:.16em; }
.tower-partner-reward h2,
.tower-end-screen h2 { margin:8px 0 18px; font-size:clamp(1.7rem,3.5vw,2.7rem); }
.tower-partner-swap { display:grid; grid-template-columns:1fr auto 1fr; gap:16px; align-items:center; }
.tower-partner-swap > div {
  display:grid; justify-items:center; padding:14px; border:2px solid #66849a;
  border-radius:16px; background:rgba(5,18,29,.65);
}
.tower-partner-swap > div.new { border-color:#5bdca1; box-shadow:0 0 24px rgba(91,220,161,.17); }
.tower-partner-swap img { width:150px; height:150px; object-fit:contain; }
.tower-partner-swap span { color:#9fb5c4; font-size:.75rem; font-weight:900; letter-spacing:.1em; }
.tower-partner-swap strong { font-size:1.2rem; }
.tower-partner-swap > b { color:#f5ca61; font-size:2.1rem; }
.tower-final-score {
  width:190px; height:190px; margin:10px auto 18px; display:grid; place-content:center;
  border:5px solid #f0d173; border-radius:50%; background:#10283b;
  box-shadow:0 0 0 9px rgba(240,209,115,.12),0 0 40px rgba(240,209,115,.2);
}
.tower-final-score span { color:#91adc1; font-size:.72rem; font-weight:900; letter-spacing:.15em; }
.tower-final-score strong { color:#fff; font-size:4.2rem; line-height:1; }
.tower-back-modes { margin-top:15px; border:0; background:none; color:#b8ccda; text-decoration:underline; cursor:pointer; }
:root:not(.dark) .tower-start-screen,
:root:not(.dark) .tower-trial-screen,
:root:not(.dark) .tower-partner-reward,
:root:not(.dark) .tower-end-screen { color-scheme:dark; }

@media (max-width: 900px) {
  .tower-trial-screen { grid-template-columns:150px minmax(0,1fr); }
  .tower-partner-card span { display:none; }
  .tower-pokemon-grid { min-height:400px; }
}
@media (max-width: 700px) {
  .tower-hud .tower-score-pill { display:none; }
  .tower-start-banner { grid-template-columns:1fr; padding:12px 16px 18px 22px; text-align:center; }
  .tower-record-card { margin:auto; }
  .tower-trial-screen { display:block; overflow:auto; }
  .tower-partner-card { min-height:170px; margin-bottom:10px; }
  .tower-partner-card img { width:110px; height:110px; margin:2px; }
  .tower-pokemon-grid { height:auto; min-height:720px; }
  .tower-partner-swap { grid-template-columns:1fr; }
  .tower-partner-swap > b { transform:rotate(90deg); }
}
