/* Hero: sunny route, battle screen, tall grass strip, marquee. */

.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(to bottom,
    #7cc8ff 0 18%, #88cdff 0 34%, #96d3ff 0 48%, #a6daff 0 60%, #b8e3ff 0 72%, #c8eaff 0 84%, #d6f1ff 0);
  padding-top: 28px;
}
@media (min-width: 720px) { .hero { padding-top: 48px; } }
.hero__sky { position: absolute; inset: 0; pointer-events: none; }
.hero__sun { position: absolute; right: 6%; top: 28px; width: calc(15 * var(--px)); height: calc(15 * var(--px)); }
.cloud { position: absolute; left: 0; width: calc(32 * var(--px)); height: calc(13 * var(--px)); animation: drift 140s steps(700) infinite; will-change: transform; }
.cloud--1 { top: 9%; animation-delay: -30s; }
.cloud--2 { top: 30%; width: calc(22 * var(--px)); height: calc(10 * var(--px)); animation-duration: 110s; animation-delay: -80s; }
.cloud--3 { top: 56%; animation-duration: 170s; animation-delay: -120s; opacity: .9; }
@keyframes drift { from { transform: translateX(-40vw); } to { transform: translateX(110vw); } }
@media (max-width: 719px) { .hero__sun { top: 12px; right: 12px; } .cloud--3 { display: none; } }

/* phones: title, battle, then the pitch; desktop: copy left, battle right */
.hero__grid { position: relative; display: grid; gap: 24px; grid-template-areas: 'intro' 'battle' 'more'; }
.hero__intro { grid-area: intro; position: relative; z-index: 2; }
.hero__more { grid-area: more; position: relative; z-index: 2; }
.battle { grid-area: battle; }
@media (min-width: 1024px) {
  .hero__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 48px; row-gap: 0;
    grid-template-rows: 1fr auto auto 1fr; grid-template-areas: '. battle' 'intro battle' 'more battle' '. battle';
  }
  .hero__intro { align-self: end; }
}

.hero__intro .eyebrow { background: var(--paper); padding: 7px 10px 6px; box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink); margin: 3px; }
.hero__title {
  font: var(--fs-h1)/1.25 var(--font-px); text-transform: uppercase; margin: 18px 0 0;
  color: var(--ink); text-shadow: 0 var(--px) 0 var(--paper), var(--px) var(--px) 0 var(--paper);
  text-wrap: balance;
}
.hero__title em { color: var(--pink-dark); text-shadow: 0 var(--px) 0 var(--paper), var(--px) var(--px) 0 var(--paper), 0 calc(var(--px) * 2) 0 var(--ink); }
.hero__lead { font-size: calc(var(--fs-body) + 1px); max-width: 34em; }
@media (min-width: 1024px) { .hero__title { margin-bottom: 18px; } }
.hero__lead strong { font-weight: 700; }
@media (min-width: 1180px) { .hero__lead { font-size: 22px; } }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 22px 0 16px; }
@media (max-width: 479px) { .hero__cta .px-btn { flex: 1 1 100%; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; background: rgb(255 248 231 / .92); padding: 7px 9px 6px;
  font: var(--fs-xs)/1 var(--font-px); text-transform: uppercase;
  box-shadow: 0 -2px 0 0 var(--ink), 0 2px 0 0 var(--ink), -2px 0 0 0 var(--ink), 2px 0 0 0 var(--ink), 2px 4px 0 0 rgb(29 23 51 / .2);
  margin: 2px;
}
.chip b { font-weight: 400; color: var(--pink-dark); font-size: var(--fs-s); }
.chip img { width: 14px; height: 14px; }

/* ============ battle screen ============ */
.battle {
  --s: 3; --sp: calc(var(--s) * 1px);
  container: battle / inline-size;
  position: relative; z-index: 2; background: var(--ink); padding: 6px;
  box-shadow: 0 0 0 3px var(--ink-2), 8px 10px 0 3px rgb(29 23 51 / .22);
  margin: 3px;
}
@media (min-width: 380px) { .battle { --s: 4; } }
@media (min-width: 720px) { .battle { --s: 5; padding: 8px; width: calc(100% - 6px); max-width: 760px; justify-self: center; } }
@media (min-width: 1024px) { .battle { max-width: none; justify-self: stretch; } }
@media (min-width: 1600px) and (min-height: 1000px) { .battle { --s: 6; } }

.scene { position: relative; height: calc(88 * var(--sp)); overflow: hidden; background: var(--sky-bottom); isolation: isolate; }
.scene > * { position: absolute; }
.scene__sky {
  inset: 0 0 auto 0; height: calc(48 * var(--sp));
  background: linear-gradient(to bottom, #7cc8ff 0 calc(10 * var(--sp)), #8dd0ff 0 calc(19 * var(--sp)), #a0d8ff 0 calc(27 * var(--sp)),
    #b3e1ff 0 calc(34 * var(--sp)), #c6e9ff 0 calc(40 * var(--sp)), #d6f1ff 0);
}
.scene__cloud { left: 0; top: calc(5 * var(--sp)); width: calc(32 * var(--sp)); height: calc(13 * var(--sp)); animation: scene-drift 90s steps(360) infinite; }
.scene__cloud--2 { top: calc(22 * var(--sp)); width: calc(22 * var(--sp)); height: calc(10 * var(--sp)); animation-duration: 70s; animation-delay: -40s; }
@keyframes scene-drift { from { transform: translateX(-120%); } to { transform: translateX(calc(100cqw + 20%)); } }
.scene__hills { left: 0; right: 0; top: calc(40 * var(--sp)); height: calc(16 * var(--sp)); background: url(../assets/ui/hill.svg) 0 0 / calc(64 * var(--sp)) 100% repeat-x; image-rendering: pixelated; }
.scene__ground { left: 0; right: 0; top: calc(56 * var(--sp)); bottom: 0; background: url(../assets/ui/ground.svg) 0 0 / calc(16 * var(--sp)) calc(8 * var(--sp)) repeat-x, var(--grass); image-rendering: pixelated; }
.scene__plat { width: calc(64 * var(--sp)); height: calc(16 * var(--sp)); }
.scene__plat--foe { right: calc(4 * var(--sp)); top: calc(46 * var(--sp)); }
.scene__plat--ally { left: calc(-8 * var(--sp)); top: calc(74 * var(--sp)); }
.scene__glow {
  right: calc(-12 * var(--sp)); top: calc(-12 * var(--sp)); width: calc(96 * var(--sp)); height: calc(84 * var(--sp)); opacity: 0;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgb(255 224 122 / .55) 0 10deg, transparent 0 20deg);
  -webkit-mask: radial-gradient(closest-side, #000 30%, transparent 100%); mask: radial-gradient(closest-side, #000 30%, transparent 100%);
  transition: opacity .3s steps(3);
}
.scene.is-legend .scene__glow { opacity: 1; animation: spin 16s steps(64) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ally { left: calc(8 * var(--sp)); top: calc(48 * var(--sp)); width: calc(32 * var(--sp)); height: calc(32 * var(--sp)); }
.ally.is-hop { animation: hop .42s steps(4); }
@keyframes hop { 40% { transform: translateY(calc(var(--hop, 6) * -1 * var(--sp, 4px))); } }

.foe {
  right: calc(20 * var(--sp)); top: calc(20 * var(--sp)); width: calc(32 * var(--sp)); height: calc(32 * var(--sp));
  appearance: none; border: 0; padding: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 90%;
}
.foe img { width: 100%; height: 100%; }
.foe:focus-visible { outline: var(--px) dashed var(--ink); outline-offset: 2px; }
.foe.is-squish { animation: squish .36s steps(3); }
@keyframes squish { 30% { transform: scale(1.14, .84); } 65% { transform: scale(.92, 1.1); } }
.foe.is-hidden { visibility: hidden; }
.foe.is-entering img { animation: foe-in .5s steps(5) both; }
@keyframes foe-in { from { filter: brightness(0); transform: translateX(calc(24 * var(--sp))); } 60% { filter: brightness(0); transform: none; } to { filter: none; } }
.foe__sparkles { position: absolute; inset: 0; pointer-events: none; display: none; }
.foe.is-shiny .foe__sparkles { display: block; }
.foe__sparkles i {
  position: absolute; width: calc(7 * var(--sp)); height: calc(7 * var(--sp));
  background: url(../assets/ui/sparkle-sheet.svg) 0 0 / auto 100% no-repeat; image-rendering: pixelated;
  animation: sparkle-sheet .5s steps(4) infinite;
}
.foe__sparkles i:nth-child(1) { left: calc(-3 * var(--sp)); top: calc(4 * var(--sp)); }
.foe__sparkles i:nth-child(2) { right: calc(-4 * var(--sp)); top: calc(12 * var(--sp)); animation-delay: -.2s; animation-duration: .7s; }
.foe__sparkles i:nth-child(3) { left: calc(12 * var(--sp)); top: calc(-5 * var(--sp)); animation-delay: -.35s; animation-duration: .6s; }
@keyframes sparkle-sheet { to { background-position: calc(-28 * var(--sp)) 0; } }

/* HUDs */
.hud {
  --b: 3px; background: var(--paper); color: var(--ink); padding: 7px 9px 8px;
  font: var(--fs-xs)/1.3 var(--font-px); text-transform: uppercase;
  box-shadow:
    0 calc(var(--b) * -1) 0 0 var(--ink), 0 var(--b) 0 0 var(--ink),
    calc(var(--b) * -1) 0 0 0 var(--ink), var(--b) 0 0 0 var(--ink),
    var(--b) calc(var(--b) * 2) 0 0 rgb(29 23 51 / .35);
  z-index: 3;
}
.hud--foe { left: calc(3 * var(--sp) + 3px); top: calc(3 * var(--sp) + 3px); width: min(47%, 300px); }
.hud--ally { right: calc(3 * var(--sp) + 3px); bottom: calc(3 * var(--sp) + 3px); }
.hud__name { font-size: var(--fs-xs); line-height: 1.45; overflow-wrap: anywhere; }
.hud__row { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; margin: 6px 0 7px; }
.hud__row .type-badge { padding: 3px 5px 2px 3px; margin: 2px; }
.hud__row .type-badge img { height: 14px; }
.hud__lv { margin-left: auto; }
.hud__party { display: flex; gap: 3px; margin-top: 6px; }
.hud__party img { width: 18px; height: 20px; }
.hud__party img.is-empty { filter: grayscale(1) brightness(1.2); opacity: .35; }
.hud__crown { color: var(--gold-dark); }
@container battle (min-width: 440px) {
  .hud__name { font-size: var(--fs-s); }
  .hud { padding: 9px 11px 10px; }
}
@container battle (min-width: 600px) {
  .hud__name { font-size: 16px; }
  .hud { font-size: var(--fs-xs); }
  .hud--foe { width: min(46%, 320px); }
  .hud__party img { width: 27px; height: 30px; }
}

/* HP bar */
.hp { --b: 2px; display: flex; align-items: center; gap: 5px; }
.hp__tag { font: var(--fs-xs)/1 var(--font-px); color: var(--gold); background: var(--ink); padding: 3px 4px 2px; }
.hp__track { flex: 1; height: 8px; background: var(--ink-2); margin: var(--b); box-shadow: 0 calc(var(--b) * -1) 0 0 var(--ink), 0 var(--b) 0 0 var(--ink), calc(var(--b) * -1) 0 0 0 var(--ink), var(--b) 0 0 0 var(--ink); }
.hp__fill { display: block; height: 100%; width: calc(var(--hp) * 1%); background: var(--hp-green); box-shadow: inset 0 2px 0 0 rgb(255 255 255 / .45); transition: width .8s steps(16); }
.hp[data-level="mid"] .hp__fill { background: var(--hp-yellow); }
.hp[data-level="low"] .hp__fill { background: var(--hp-red); }
@container battle (min-width: 600px) { .hp__track { height: 12px; } .hp { --b: 3px; } }

/* FX layer: capsule, particles, emotes */
.scene__fx { inset: 0; pointer-events: none; z-index: 4; }
.scene__fx > * { position: absolute; left: 0; top: 0; image-rendering: pixelated; }
.cap { width: calc(13 * var(--sp)); height: calc(16 * var(--sp)); transform-origin: 50% 100%; }
.cap img { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-emote { width: calc(10 * var(--sp)); height: calc(11 * var(--sp)); animation: emote-pop .9s steps(3) both; }
@keyframes emote-pop { 0% { transform: scale(0); } 20% { transform: scale(1.15); } 30%, 80% { transform: scale(1); opacity: 1; } 100% { opacity: 0; transform: translateY(calc(-4 * var(--sp))); } }
.fx-heart { width: calc(9 * var(--sp)); height: calc(8 * var(--sp)); animation: heart-up .9s steps(6) both; }
@keyframes heart-up { from { transform: translateY(0) scale(.6); } 30% { transform: translateY(calc(-6 * var(--sp))) scale(1); opacity: 1; } to { transform: translateY(calc(-18 * var(--sp))); opacity: 0; } }
.fx-burst { width: calc(23 * var(--sp)); height: calc(10 * var(--sp)); animation: burst 1.2s steps(3) both; transform-origin: 50% 100%; }
@keyframes burst { 0% { transform: scale(0); } 25% { transform: scale(1.1); } 35%, 75% { transform: scale(1); opacity: 1; } 100% { opacity: 0; } }
.fx-star { width: calc(7 * var(--sp)); height: calc(7 * var(--sp)); }
.fx-dust { width: calc(10 * var(--sp)); height: calc(8 * var(--sp)); background: url(../assets/ui/dust-sheet.svg) 0 0 / auto 100% no-repeat; animation: dust .3s steps(3) forwards; }
@keyframes dust { to { background-position: calc(-30 * var(--sp)) 0; } }

/* intro wipe + flash */
.scene__wipe { inset: 0; z-index: 6; pointer-events: none; display: grid; grid-template-rows: repeat(8, 1fr); }
.scene__wipe i { background: var(--ink); transform: translateX(-101%); }
.scene__wipe i:nth-child(even) { transform: translateX(101%); }
.scene::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0; background: #fff; }
.scene.is-flash::after { animation: flash .42s steps(1) 1; }
.scene.is-flash-gold::after { background: var(--gold); animation: flash .6s steps(1) 1; }
@keyframes flash { 0%, 34%, 68% { opacity: 1; } 17%, 51%, 85%, 100% { opacity: 0; } }

/* dialog + menu under the screen */
.battle__panel { display: grid; gap: 0; background: var(--paper-2); padding: 6px 4px 8px; }
.battle__panel .px-box { --b: 3px; margin: 9px; }
.dialog { min-height: calc(3 * 1.9em + 26px); padding: 12px 14px 14px; font: var(--fs-s)/1.9 var(--font-px); }
.dialog__text { min-height: calc(3 * 1.9em); overflow-wrap: break-word; }
.dialog__text b { font-weight: 400; color: var(--pink-dark); }
.dialog__text .gold { color: var(--gold-dark); }
.dialog__next { position: absolute; right: 12px; bottom: 10px; width: 14px; height: 8px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.dialog.is-clickable { cursor: pointer; }
.dialog__btns { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }

.menu { display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 0 4px; padding: 6px 6px; min-height: calc(2 * 48px + 12px); }
.menu .choice { font-size: var(--fs-s); padding: 8px 6px 8px 26px; min-height: 48px; line-height: 1.35; }
.menu .choice::before { left: 6px; width: 12px; height: 21px; margin-top: -11px; background-size: 12px 21px; }
.menu .choice.is-soon-item { color: #7d7690; }
.menu .choice .soon-tag { font-size: 8px; }
.menu.is-locked .choice { opacity: .45; pointer-events: none; }
.menu.is-locked .choice::before { opacity: 0 !important; }
@container battle (min-width: 600px) {
  .battle__panel { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: stretch; }
  .dialog { font-size: 16px; line-height: 1.8; min-height: calc(3 * 1.8em + 30px); }
  .dialog__text { min-height: calc(3 * 1.8em); }
  .menu .choice { font-size: 16px; padding-left: 30px; }
  .menu { min-height: 0; }
}
@container battle (min-width: 1000px) { .dialog { font-size: 16px; } }

/* ============ land + tall grass ============ */
.hero__land {
  position: relative; height: calc(22 * var(--px)); margin-top: 36px;
  background:
    url(../assets/ui/ground.svg) 0 calc(16 * var(--px)) / calc(16 * var(--px)) calc(8 * var(--px)) repeat-x,
    url(../assets/ui/hill.svg) 0 0 / calc(64 * var(--px)) calc(16 * var(--px)) repeat-x;
  image-rendering: pixelated;
}
.hero__land::after { content: ""; position: absolute; left: 0; right: 0; top: calc(22 * var(--px) - 1px); height: 2px; background: var(--grass); }
@media (min-width: 1024px) { .hero__land { margin-top: -40px; z-index: 1; } }
.grass { position: relative; background: var(--grass); padding-top: calc(4 * var(--px)); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.grass__tiles { display: flex; height: calc(16 * var(--px)); overflow: hidden; position: relative; }
.grass__tiles span {
  flex: none; width: calc(16 * var(--px)); height: 100%;
  background: url(../assets/ui/tall-grass.svg) 0 0 / 100% 100% no-repeat; image-rendering: pixelated;
}
.grass__tiles span.is-rustle { background-image: url(../assets/ui/tall-grass-rustle.svg); animation: rustle-shake .3s steps(2); }
@keyframes rustle-shake { 50% { transform: translateX(var(--px)); } }
.grass__tiles .leaf {
  position: absolute; width: calc(2 * var(--px)); height: calc(2 * var(--px)); background: var(--grass-light); pointer-events: none;
  box-shadow: var(--px) var(--px) 0 0 var(--grass-dark);
  animation: leaf .7s steps(7) forwards;
}
@keyframes leaf { to { transform: translate(var(--dx, 12px), calc(-12 * var(--px))) rotate(90deg); opacity: 0; } }
.grass__tiles .grass-emote { position: absolute; width: calc(10 * var(--px)); height: calc(11 * var(--px)); animation: emote-pop .8s steps(3) both; }
.grass__hint {
  position: absolute; left: 50%; top: calc(-9 * var(--px)); transform: translateX(-50%); z-index: 3;
  appearance: none; border: 0; background: var(--ink); color: var(--paper);
  font: var(--fs-xs)/1 var(--font-px); padding: 9px 12px 8px; white-space: nowrap; cursor: pointer; min-height: 32px;
  box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), 3px 0 0 0 var(--ink), -3px 0 0 0 var(--ink);
}
.grass__hint::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -4px; border: 4px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
.grass__hint:hover { background: var(--ink-2); }
@media (min-width: 720px) { .grass__hint { font-size: var(--fs-s); } }

/* ============ marquee ============ */
.marquee { position: relative; background: var(--ink); color: var(--butter); overflow: hidden; padding: 14px 0 13px; border-top: var(--px) solid var(--grass-dark); }
.marquee__track { display: flex; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__group { display: flex; align-items: center; flex: none; }
.marquee__item { display: inline-flex; align-items: center; gap: 18px; padding-right: 18px; font: var(--fs-s)/1 var(--font-px); text-transform: uppercase; white-space: nowrap; }
.marquee__item img { width: 14px; height: 14px; }
.marquee__item:nth-child(3n+2) { color: var(--pink-light); }
.marquee__item:nth-child(3n) { color: var(--mint); }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (min-width: 720px) { .marquee__item { font-size: 16px; gap: 22px; padding-right: 22px; } .marquee { padding: 18px 0 17px; } }
@media (prefers-reduced-motion: reduce) {
  .marquee__track { animation: none; width: auto; flex-wrap: wrap; justify-content: center; padding: 0 16px; row-gap: 10px; }
  .marquee__group[aria-hidden] { display: none; }
  .marquee__group { flex-wrap: wrap; justify-content: center; row-gap: 10px; }
  .cloud, .scene__cloud { animation: none; }
  .cloud--1 { transform: translateX(8vw); } .cloud--2 { transform: translateX(62vw); } .cloud--3 { transform: translateX(30vw); }
  .scene__cloud { transform: translateX(20%); } .scene__cloud--2 { transform: translateX(260%); }
}
.foe canvas { width: 100%; height: 100%; }

/* narrow battle screens: slimmer HUD (type emblem only), creature a bit further right */
@container battle (max-width: 439px) {
  .hud--foe { width: auto; max-width: 46%; }
  .hud__row .type-badge { font-size: 0; gap: 0; padding: 3px 4px; }
  .hud__row { gap: 3px 6px; }
  .hud__lv { margin-left: 0; }
  .foe { right: calc(14 * var(--sp)); }
  .scene__plat--foe { right: calc(-2 * var(--sp)); }
}

/* menu layouts by item count; SOON is a corner badge so it never pushes a label out */
.menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.menu--n2 { grid-template-columns: minmax(0, 1fr); }
.menu .choice .soon-tag { position: absolute; right: 0; top: -3px; margin: 0; padding: 3px 4px 2px; font-size: 8px; }
@container battle (min-width: 600px) {
  .menu { min-height: calc(3 * 44px + 12px); }
  .menu--n3 { grid-template-columns: minmax(0, 1fr); }
  .menu--n3 .choice, .menu--n2 .choice { min-height: 44px; }
}
@container battle (min-width: 500px) and (max-width: 599px) {
  .battle__panel { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: stretch; }
  .menu { min-height: calc(3 * 44px + 12px); }
  .menu--n3 { grid-template-columns: minmax(0, 1fr); }
  .menu .choice { min-height: 44px; }
}
