:root {
  --ink: #1f2933;
  --paper: #fff8df;
  --sky: #7bdff2;
  --sea: #35a7ff;
  --grass: #6ecb63;
  --leaf: #2f9e44;
  --sun: #ffd166;
  --pink: #ff7a90;
  --mint: #8ff3c5;
  --blue: #118ab2;
  --purple: #8e7dff;
  --danger: #ef476f;
  --success: #06d6a0;
  --shadow: 0 6px 0 rgba(31, 41, 51, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, #45bdf4 0%, #7bdff2 56%, #7ed957 56%, #7ed957 78%, #6b3f2e 78%, #4b2a22 100%);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

body.home-art-active {
  background: #45bdf4;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.app-shell:has(.mission-screen) {
  min-height: 100vh;
  margin: 0 auto;
}

.app-shell:has(.mini-game-screen) {
  min-height: 100vh;
  margin: 0 auto;
}

.app-shell:has(.game-modes-screen) {
  min-height: 100vh;
  margin: 0 auto;
}

body.home-art-active .app-shell {
  width: min(100vw, calc(100vh * 1.7667));
  min-height: 100vh;
  margin: 0 auto;
}

.screen {
  min-height: calc(100vh - 32px);
  border: 4px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.home-screen {
  min-height: calc(100vh - 32px);
  padding: 42px 52px 28px;
  overflow: visible;
  background:
    radial-gradient(circle at 36% 34%, rgba(255,255,255,.54), transparent 34%),
    linear-gradient(180deg, #fff8df 0%, #fff2ca 100%);
}

.home-title-stack {
  display: grid;
  gap: 14px;
}

.home-title-stack h1 {
  margin: 0;
  line-height: 1;
}

.home-subtitle-line,
.home-subtitle-dashes {
  height: 8px;
  margin: 0;
  background: rgba(31, 41, 51, .36);
}

.home-subtitle-line {
  width: min(360px, 42vw);
}

.home-subtitle-dashes {
  width: min(260px, 34vw);
  background: repeating-linear-gradient(90deg, rgba(31,41,51,.46) 0 42px, transparent 42px 54px);
}

.sprite-home-screen {
  min-height: 100vh;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.sprite-home-screen::after {
  display: none;
}

.pixel-home-stage {
  position: relative;
  width: min(100vw, calc(100vh * 1.7667));
  aspect-ratio: 848 / 480;
  overflow: hidden;
  background:
    linear-gradient(180deg, #42bdf3 0%, #7bdff2 58%, #75d957 58%, #75d957 78%, #6d3d2d 78%, #4e2c24 100%);
  image-rendering: pixelated;
}

.home-panel-shell {
  position: absolute;
  inset: 5.8% 6.8% 7.2%;
  z-index: 2;
  border: 5px solid #0b1b2d;
  clip-path: polygon(
    14px 0,
    calc(100% - 14px) 0,
    calc(100% - 14px) 6px,
    calc(100% - 6px) 6px,
    calc(100% - 6px) 14px,
    100% 14px,
    100% calc(100% - 14px),
    calc(100% - 6px) calc(100% - 14px),
    calc(100% - 6px) calc(100% - 6px),
    calc(100% - 14px) calc(100% - 6px),
    calc(100% - 14px) 100%,
    14px 100%,
    14px calc(100% - 6px),
    6px calc(100% - 6px),
    6px calc(100% - 14px),
    0 calc(100% - 14px),
    0 14px,
    6px 14px,
    6px 6px,
    14px 6px
  );
  background:
    radial-gradient(circle at 58% 28%, rgba(255,255,255,.42), transparent 34%),
    linear-gradient(180deg, #fff8dc 0%, #fff1bf 100%);
  box-shadow: 0 7px 0 rgba(31,41,51,.32);
}

.panel-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  z-index: 3;
}

.panel-corner::before,
.panel-corner::after {
  content: "";
  position: absolute;
  image-rendering: pixelated;
}

.panel-corner::before {
  left: 5px;
  top: 5px;
  width: 6px;
  height: 6px;
  background: #0b1b2d;
  box-shadow:
    6px 0 0 #0b1b2d,
    0 6px 0 #0b1b2d;
}

.panel-corner::after {
  left: 0;
  top: 0;
  width: 7px;
  height: 7px;
  background: #ffd565;
  box-shadow:
    7px 0 0 #ffd565,
    0 7px 0 #ffd565;
}

.panel-corner.top-left {
  left: -3px;
  top: -3px;
}

.panel-corner.top-right {
  right: -3px;
  top: -3px;
  transform: scaleX(-1);
}

.panel-corner.bottom-left {
  left: -3px;
  bottom: -3px;
  transform: scaleY(-1);
}

.panel-corner.bottom-right {
  right: -3px;
  bottom: -3px;
  transform: scale(-1);
}

.bg-sprite {
  position: absolute;
  z-index: 1;
  image-rendering: pixelated;
  pointer-events: none;
}

.bg-cloud-left-top {
  left: 0.9%;
  top: 10.5%;
}

.bg-cloud-left-mid {
  left: 1.8%;
  top: 32%;
}

.bg-cloud-right-top {
  right: 1.1%;
  top: 15.8%;
}

.bg-cloud-right-mid {
  right: 2.3%;
  top: 46.5%;
}

.bg-tree-left {
  left: 0;
  bottom: 6.8%;
}

.bg-tree-right {
  right: 0;
  bottom: 13.2%;
}

.bg-bush-left {
  left: 1.8%;
  bottom: 10.8%;
}

.bg-bush-right {
  right: .6%;
  bottom: 10.5%;
}

.bg-grass-left {
  left: 4.6%;
  bottom: 20.5%;
}

.bg-grass-right {
  right: 4.4%;
  bottom: 21%;
}

.sprite-home-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(52px, 3.75vw, 76px) clamp(58px, 4.2vw, 86px) 0;
}

.sprite-home-brand {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.home-sprite.home-brand-icon {
  flex: 0 0 auto;
  width: clamp(76px, 5.6vw, 116px);
  height: auto;
}

.pixel-word.home {
  gap: clamp(2px, .3vw, 4px);
  filter: drop-shadow(2px 2px 0 rgba(31,41,51,.16));
}

.pixel-word.home .pixel-glyph-slot {
  --glyph-height: clamp(70px, 5.3vw, 108px);
  height: clamp(70px, 5.3vw, 108px);
}

.pixel-word.home .pixel-glyph {
  height: 100%;
}

.sprite-home-controls {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-top: 2px;
}

.sprite-icon-btn,
.sprite-card {
  position: relative;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
  min-height: 0;
}

.sprite-card:hover,
.sprite-card:focus-visible {
  outline: 0;
  transform: translateY(-2px);
}

.sprite-icon-btn {
  width: clamp(54px, 4.6vw, 94px);
  height: clamp(54px, 4.6vw, 94px);
  display: grid;
  place-items: stretch;
}

.sprite-icon-btn:hover,
.sprite-icon-btn:focus-visible {
  outline: 0;
  transform: translateY(-2px);
}

.sprite-icon-btn .home-sprite {
  pointer-events: none;
  transition: filter 120ms ease, transform 120ms ease;
}

.sprite-icon-btn:hover .home-sprite,
.sprite-icon-btn:focus-visible .home-sprite {
  filter: brightness(1.06) saturate(1.04) drop-shadow(0 3px 0 rgba(31,41,51,.22));
  transform: translateY(-1px);
}

.sprite-icon-btn:active .home-sprite {
  filter: brightness(.96) saturate(.98);
  transform: translateY(2px);
}

.sprite-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  min-width: max-content;
  max-width: 220px;
  border: 3px solid #0b1b2d;
  background: #fffdf2;
  color: #0b1b2d;
  padding: 6px 10px;
  font-size: clamp(13px, .95vw, 16px);
  font-weight: 900;
  line-height: 1.2;
  box-shadow: 0 4px 0 rgba(31,41,51,.24);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 100ms ease, transform 100ms ease, visibility 100ms ease;
  white-space: nowrap;
}

.sprite-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 10px;
  height: 10px;
  border-right: 3px solid #0b1b2d;
  border-bottom: 3px solid #0b1b2d;
  background: #fffdf2;
  transform: translateX(-50%) rotate(45deg);
}

.sprite-home-controls .sprite-tooltip,
.toolbar.icon-toolbar .sprite-tooltip {
  top: calc(100% + 10px);
  bottom: auto;
}

.sprite-home-controls .sprite-tooltip::after,
.toolbar.icon-toolbar .sprite-tooltip::after {
  top: -9px;
  bottom: auto;
  border: 0;
  border-left: 3px solid #0b1b2d;
  border-top: 3px solid #0b1b2d;
}

.sprite-card:hover .sprite-tooltip,
.sprite-card:focus-visible .sprite-tooltip,
.sprite-icon-btn:hover .sprite-tooltip,
.sprite-icon-btn:focus-visible .sprite-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toolbar.icon-toolbar .sprite-icon-btn:last-child .sprite-tooltip {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.toolbar.icon-toolbar .sprite-icon-btn:last-child:hover .sprite-tooltip,
.toolbar.icon-toolbar .sprite-icon-btn:last-child:focus-visible .sprite-tooltip {
  transform: translateY(0);
}

.toolbar.icon-toolbar .sprite-icon-btn:last-child .sprite-tooltip::after {
  left: auto;
  right: 22px;
  transform: rotate(45deg);
}

.home-sprite {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.home-sprite.bg-cloud-left-top,
.home-sprite.bg-cloud-right-mid {
  width: 5.8%;
}

.home-sprite.bg-cloud-left-mid,
.home-sprite.bg-cloud-right-top {
  width: 7.2%;
}

.home-sprite.bg-tree-left {
  width: 8.2%;
}

.home-sprite.bg-tree-right {
  width: 7.4%;
}

.home-sprite.bg-bush-left {
  width: 5.8%;
}

.home-sprite.bg-bush-right {
  width: 5.5%;
}

.home-sprite.bg-grass-left,
.home-sprite.bg-grass-right {
  width: 2.8%;
}

.sprite-home-menu {
  display: flex;
  gap: clamp(16px, 1.15vw, 24px);
  padding-left: clamp(58px, 4.1vw, 84px);
  margin-top: clamp(30px, 2.15vw, 44px);
}

.sprite-card {
  width: clamp(150px, 10.75vw, 218px);
  height: clamp(109px, 7.7vw, 158px);
  aspect-ratio: 218 / 158;
  display: grid;
  place-items: stretch;
}

.button-sprite {
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  transition: filter 120ms ease, transform 120ms ease;
}

.sprite-card:hover .button-sprite,
.sprite-card:focus-visible .button-sprite {
  filter: brightness(1.06) saturate(1.04) drop-shadow(0 4px 0 rgba(31,41,51,.22));
  transform: translateY(-2px);
}

.sprite-card:active .button-sprite {
  filter: brightness(.96) saturate(.98);
  transform: translateY(2px);
}

.sprite-map {
  position: absolute;
  left: 4.8%;
  right: 28.8%;
  bottom: 7.1%;
  pointer-events: none;
}

.sprite-map-art {
  width: 100%;
}

.sprite-guide {
  position: absolute;
  right: 5.4%;
  bottom: 5.5%;
  width: clamp(260px, 18.2vw, 370px);
  pointer-events: none;
}

.sprite-speech {
  width: clamp(190px, 13.2vw, 270px);
  margin: 0 0 clamp(-10px, -.5vw, -8px) 0;
}

.sprite-robot {
  width: 100%;
}

.top-bar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 4px solid var(--ink);
  background: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand > div:not(.logo-pixel) {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo-pixel {
  width: 44px;
  height: 44px;
  background: var(--sun);
  border: 4px solid var(--ink);
  box-shadow:
    8px 0 0 #f4a261,
    0 8px 0 #f4a261,
    8px 8px 0 #ef476f;
}

.brand-title {
  margin: 0;
  line-height: 1;
}

.brand-subtitle {
  margin: 0;
  font-size: 15px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar.icon-toolbar {
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
}

.toolbar.icon-toolbar .sprite-icon-btn {
  width: clamp(52px, 4vw, 68px);
  height: clamp(52px, 4vw, 68px);
}

.pixel-btn {
  min-height: 42px;
  border: 3px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  font-weight: 800;
  box-shadow:
    inset 4px 4px 0 rgba(255,255,255,.45),
    inset -4px -4px 0 rgba(31,41,51,.08),
    0 4px 0 rgba(31, 41, 51, 0.22);
}

.pixel-btn:hover,
.pixel-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(31, 41, 51, 0.22);
}

.pixel-btn.primary {
  background: var(--sun);
}

.pixel-btn.secondary {
  background: var(--mint);
}

.pixel-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.pixel-logo-wrap {
  display: inline-block;
}

.pixel-word {
  --pixel-size: 5px;
  --pixel-gap: 1px;
  display: inline-flex;
  align-items: flex-end;
  gap: calc(var(--pixel-size) * 1.2);
  max-width: 100%;
  font-size: 0;
  line-height: 1;
}

.pixel-glyph {
  display: block;
  width: auto;
  height: clamp(28px, 4vw, 42px);
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.pixel-glyph-slot {
  --glyph-height: clamp(28px, 4vw, 42px);
  position: relative;
  display: inline-block;
  width: calc(var(--glyph-advance) * var(--glyph-height) / 16);
  height: var(--glyph-height);
  flex: 0 0 auto;
}

.pixel-glyph-slot .pixel-glyph {
  position: absolute;
  left: 0;
  bottom: 0;
  max-width: none;
}

.pixel-word.small .pixel-glyph-slot {
  --glyph-height: clamp(18px, 2.8vw, 26px);
  height: clamp(18px, 2.8vw, 26px);
}

.pixel-word.small .pixel-glyph {
  height: 100%;
}

.pixel-word.small {
  --pixel-size: clamp(3px, .44vw, 5px);
  --pixel-gap: 1px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.speech {
  border: 4px solid var(--ink);
  background: #fff;
  padding: 14px;
  line-height: 1.6;
  font-size: 17px;
  box-shadow: var(--shadow);
}

.map-screen {
  padding: 20px;
}

.mission-screen {
  padding: 14px 20px;
}

.map-screen h2 {
  margin: 12px 0 0;
}

.unlock-hint {
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 800;
  color: rgba(31, 41, 51, 0.78);
}

.map-board {
  margin-top: 18px;
  border: 4px solid var(--ink);
  background:
    linear-gradient(180deg, #fff9df 0%, #fff3bf 100%);
  box-shadow: var(--shadow);
  padding: 28px 20px;
  position: relative;
  overflow: hidden;
}

.map-board::before,
.map-board::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  height: 10px;
  background: repeating-linear-gradient(90deg, rgba(31,41,51,.34) 0 18px, transparent 18px 30px);
}

.map-board::before {
  top: 34%;
  transform: rotate(-4deg);
}

.map-board::after {
  top: 70%;
  transform: rotate(4deg);
}

.map-board::before,
.map-board::after {
  height: 12px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 18px;
  row-gap: 34px;
  align-items: stretch;
}

.adventure-path {
  position: relative;
  z-index: 1;
}

.free-practice-screen {
  padding: 22px;
}

.free-practice-screen > .toolbar {
  margin-bottom: 14px;
}

.free-practice-board {
  border: 4px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.96), rgba(255, 240, 190, 0.9)),
    var(--paper);
  box-shadow: var(--shadow);
  padding: 24px;
}

.free-practice-heading h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 44px);
}

.free-practice-heading p {
  margin: 0 0 22px;
  font-size: 18px;
  line-height: 1.5;
}

.free-practice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.free-practice-mode {
  min-height: 132px;
  border: 4px solid var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  transition: transform 120ms ease, filter 120ms ease;
}

.free-practice-mode:hover,
.free-practice-mode:focus-visible {
  transform: translateY(-4px);
  filter: brightness(1.03);
  outline: none;
}

.free-practice-mode:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(31, 41, 51, 0.28);
}

.free-mode-badge {
  width: 76px;
  height: 76px;
  border: 4px solid var(--ink);
  background: var(--sun);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 900;
  box-shadow: inset -8px -8px 0 rgba(239, 71, 111, 0.16);
}

.free-mode-copy {
  display: grid;
  gap: 8px;
}

.free-mode-copy strong {
  font-size: clamp(22px, 3vw, 32px);
}

.free-mode-copy span {
  font-size: 18px;
  line-height: 1.45;
}

.game-modes-screen,
.mini-game-screen {
  padding: 22px;
}

.game-modes-screen > .toolbar,
.mini-game-screen > .toolbar {
  margin-bottom: 14px;
}

.game-modes-board {
  border: 4px solid var(--ink);
  background: linear-gradient(180deg, #fff8df, #fff0be);
  box-shadow: var(--shadow);
  padding: 24px;
}

.game-modes-heading h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 44px);
}

.game-modes-heading p {
  margin: 0 0 22px;
  font-size: 18px;
}

.game-modes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.game-mode-card {
  min-height: 190px;
  border: 4px solid var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.game-mode-badge {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  border: 4px solid var(--ink);
  background: var(--sun);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  box-shadow: inset -8px -8px 0 rgba(239, 71, 111, .18);
}

.bomb-mode-card .game-mode-badge {
  background: var(--pink);
}

.game-mode-copy {
  min-width: 0;
}

.game-mode-copy h3 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 34px);
}

.game-mode-copy p {
  margin: 0 0 18px;
  line-height: 1.5;
}

.game-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-game-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mini-game-stats strong {
  display: block;
  font-size: 20px;
}

.rain-arena {
  position: relative;
  height: clamp(360px, calc(100vh - 330px), 610px);
  min-height: 340px;
  overflow: hidden;
  border: 4px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .12), transparent 54%),
    linear-gradient(180deg, #258fd5 0%, #35a7ff 78%, #6ecb63 78%, #2f9e44 100%);
  box-shadow: var(--shadow);
}

.rain-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.rain-drop {
  position: absolute;
  left: var(--drop-x);
  top: 0;
  width: 72px;
  height: 84px;
  transform: translate(-50%, var(--drop-y));
  filter: drop-shadow(4px 5px 0 rgba(31, 41, 51, .24));
}

.rain-drop-sprite {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.rain-drop span {
  position: absolute;
  left: 50%;
  top: 57%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border: 3px solid var(--ink);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
}

.animal-floor {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 8px;
  width: min(360px, 42vw);
  aspect-ratio: 320 / 112;
  transform: translateX(-50%);
}

.animal-floor img {
  position: absolute;
  display: block;
  image-rendering: pixelated;
}

.animal-floor-ground {
  inset: 0;
  width: 100%;
  height: 100%;
}

.animal-floor-character {
  width: 25%;
  height: auto;
  transform-origin: center bottom;
}

.animal-floor-cat {
  left: 13.125%;
  top: 17.857%;
  animation: animal-cat-idle 0.9s steps(1, end) infinite;
}

.animal-floor-frog {
  left: 37.5%;
  top: 21.429%;
  animation: animal-frog-idle 0.8s steps(1, end) infinite;
}

.animal-floor-dog {
  left: 63.75%;
  top: 17.857%;
  animation: animal-dog-idle 1s steps(1, end) infinite;
}

.rain-splash-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

.rain-splash {
  position: absolute;
  left: 50%;
  top: calc(78% - 10px);
  width: 20px;
  height: 20px;
  opacity: 0;
  background: #c9f4ff;
  box-shadow: -30px 8px 0 #c9f4ff, 30px 8px 0 #c9f4ff, -50px 22px 0 #7bdff2, 50px 22px 0 #7bdff2;
}

.rain-splash.visible {
  animation: rain-splash 360ms steps(3) both;
}

.mini-game-result {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 41, 51, .5);
}

.mini-game-result-card {
  width: min(440px, 100%);
  border: 5px solid var(--ink);
  background: #fffdf2;
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

.mini-game-result-card h2 {
  margin: 0 0 16px;
}

.mini-game-result-card .hero-actions {
  justify-content: center;
  margin-top: 20px;
}

.bomb-arena {
  position: relative;
  height: clamp(360px, calc(100vh - 330px), 610px);
  min-height: 340px;
  overflow: hidden;
  border: 4px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(38, 53, 71, .10) 0 18px, transparent 18px 36px),
    linear-gradient(180deg, #86a9c4 0%, #7699b6 100%);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(150px, .48fr) minmax(320px, 1.52fr);
  align-items: center;
  gap: clamp(20px, 3vw, 48px);
  padding: clamp(24px, 4vw, 56px);
}

.bomb-timer {
  position: relative;
  display: grid;
  place-items: center;
  width: min(190px, 100%);
  justify-self: center;
}

.bomb-timer img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(8px 10px 0 rgba(0, 0, 0, .3));
}

.bomb-timer span {
  position: absolute;
  left: 28.8889%;
  top: 53.3333%;
  width: 42.2222%;
  height: 22.2222%;
  transform: none;
  min-width: 0;
  border: 3px solid var(--ink);
  background: #fff;
  padding: 0;
  color: var(--danger);
  text-align: center;
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  display: grid;
  place-items: center;
}

.bomb-sentence-progress {
  border: 5px solid var(--ink);
  background: #fffdf2;
  box-shadow: 0 10px 0 rgba(0, 0, 0, .28);
  padding: clamp(24px, 4vw, 48px);
  font-size: clamp(34px, 5.5vw, 64px);
  font-weight: 900;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.bomb-typed {
  color: #159a68;
}

.bomb-next {
  background: var(--sun);
  color: var(--ink);
}

.bomb-pending {
  color: var(--ink);
}

.bomb-explosion {
  --bomb-origin-x: 18%;
  position: absolute;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
}

.bomb-explosion > span {
  position: absolute;
  left: var(--bomb-origin-x);
  top: 50%;
  display: block;
  image-rendering: pixelated;
}

.bomb-explosion-core {
  width: 112px;
  height: 96px;
  z-index: 3;
  background: #ff4b2b;
  clip-path: polygon(50% 0, 61% 23%, 82% 9%, 78% 34%, 100% 38%, 82% 54%, 96% 75%, 70% 72%, 64% 100%, 48% 79%, 27% 96%, 29% 70%, 4% 73%, 20% 50%, 0 34%, 27% 31%, 22% 8%, 43% 24%);
  filter: drop-shadow(0 0 10px rgba(255, 75, 43, .72));
  animation: bomb-explosion-flame 650ms cubic-bezier(.16, .8, .25, 1) both;
}

.bomb-explosion-core::before,
.bomb-explosion-core::after {
  content: "";
  position: absolute;
  display: block;
}

.bomb-explosion-core::before {
  inset: 17px 20px;
  background: #ffd23f;
  clip-path: polygon(50% 0, 65% 25%, 93% 17%, 80% 48%, 100% 68%, 66% 69%, 50% 100%, 34% 70%, 0 78%, 20% 47%, 4% 25%, 37% 28%);
}

.bomb-explosion-core::after {
  left: 50%;
  top: 50%;
  width: 34px;
  height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 48% 52% 43% 57%;
  background: #fff8df;
  box-shadow: 0 0 12px rgba(255, 248, 223, .85);
}

.bomb-explosion-ring {
  width: 92px;
  height: 72px;
  z-index: 2;
  background:
    radial-gradient(ellipse at 18% 72%, #4f4a47 0 17%, transparent 18%),
    radial-gradient(ellipse at 42% 44%, #706965 0 23%, transparent 24%),
    radial-gradient(ellipse at 68% 55%, #514c49 0 21%, transparent 22%),
    radial-gradient(ellipse at 84% 28%, #817976 0 15%, transparent 16%),
    radial-gradient(ellipse at 55% 82%, #302d2b 0 20%, transparent 21%);
  filter: drop-shadow(0 6px 4px rgba(11, 27, 45, .26));
  animation: bomb-explosion-smoke 850ms ease-out both;
}

.bomb-explosion-debris {
  width: 8px;
  height: 8px;
  z-index: 4;
  background: #302d2b;
  box-shadow: -62px -34px 0 #302d2b, 52px -45px 0 #9b6b4b, 74px 24px 0 #302d2b, -48px 54px 0 #9b6b4b;
  animation: bomb-explosion-debris 700ms ease-out both;
}

.bomb-explosion-debris::before,
.bomb-explosion-debris::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}

.bomb-explosion-debris::before {
  width: 6px;
  height: 6px;
  background: #ff6b2b;
  box-shadow: -76px 10px 0 #ff4b2b, -24px -64px 0 #ffd23f, 32px -58px 0 #ff6b2b, 68px 48px 0 #ff4b2b;
}

.bomb-explosion-debris::after {
  width: 4px;
  height: 4px;
  background: #fff8df;
  box-shadow: -88px -18px 0 #ffd23f, -34px 70px 0 #fff8df, 18px -78px 0 #ffd23f, 84px -12px 0 #fff8df, 42px 72px 0 #ffd23f;
}

.bomb-arena.is-ended .bomb-timer {
  opacity: 0;
}

.bomb-arena.is-exploding {
  animation: bomb-arena-shake 650ms steps(2, end) both;
}

.bomb-arena.is-exploding .bomb-timer {
  animation: bomb-vanish 380ms steps(4, end) both;
}

.bomb-arena.has-error .bomb-sentence-progress {
  animation: bomb-error 160ms linear 2;
  border-color: var(--danger);
  background: #ffd1dc;
}

@keyframes bomb-error {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes bomb-explosion-flame {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.12) rotate(-8deg); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(.82) rotate(0); }
  34% { opacity: 1; transform: translate(-50%, -50%) scale(1.18) rotate(3deg); }
  62% { opacity: .88; transform: translate(-50%, -50%) scale(.98) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.68) rotate(2deg); }
}

@keyframes bomb-explosion-smoke {
  0%, 26% { opacity: 0; transform: translate(-50%, -35%) scale(.25); }
  45% { opacity: .82; transform: translate(-50%, -55%) scale(.75); }
  100% { opacity: 0; transform: translate(-50%, -112%) scale(1.25); }
}

@keyframes bomb-explosion-debris {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.35) rotate(0); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(.85) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25) rotate(70deg); }
}

@keyframes bomb-arena-shake {
  0%, 100% { transform: translate(0); }
  16% { transform: translate(-8px, 5px); }
  32% { transform: translate(7px, -5px); }
  48% { transform: translate(-5px, -3px); }
  64% { transform: translate(5px, 3px); }
  80% { transform: translate(-2px, 1px); }
}

@keyframes bomb-vanish {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  45% { opacity: 1; transform: translateY(-12px) scale(1.08); }
  100% { opacity: 0; transform: translateY(18px) scale(.2); }
}

@keyframes bomb-explosion-fade {
  0% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, -50%); }
}

@keyframes animal-cat-idle {
  0%, 100% { transform: translateY(0); }
  25%, 75% { transform: translateY(-2px); }
  50% { transform: translateY(-4px); }
}

@keyframes animal-frog-idle {
  0%, 100% { transform: translateY(0); }
  25%, 75% { transform: translateY(-3px); }
  50% { transform: translateY(-6px); }
}

@keyframes animal-dog-idle {
  0%, 100% { transform: translateY(0); }
  25%, 75% { transform: translateY(-2px); }
  50% { transform: translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .animal-floor-character {
    animation: none;
  }

  .bomb-arena.is-exploding,
  .bomb-arena.is-exploding .bomb-timer {
    animation: none;
  }

  .bomb-arena.is-ended .bomb-timer {
    opacity: 0;
  }

  .bomb-explosion-ring,
  .bomb-explosion-debris {
    display: none;
  }

  .bomb-explosion-core {
    box-shadow: none;
    animation: bomb-explosion-fade 300ms linear both;
  }
}

@keyframes rain-splash {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(.7); }
  50% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -8px) scale(1.2); }
}

.level-node {
  min-height: 170px;
  height: 100%;
  border: 4px solid var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.level-node::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  width: 16px;
  height: 16px;
  background: var(--sun);
  box-shadow:
    16px 0 0 #f4a261,
    0 16px 0 #f4a261;
}

.level-node.unlocked {
  background: #fef3c7;
}

.level-node.locked {
  background: #e5e7eb;
}

.level-number {
  width: 42px;
  height: 42px;
  border: 3px solid var(--ink);
  background: var(--grass);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.level-node h3 {
  margin: 0;
  font-size: 22px;
}

.level-node p {
  margin: 0;
  line-height: 1.45;
}

.star-row {
  margin-top: auto;
  font-size: 22px;
  color: #f59e0b;
  text-shadow: 1px 1px 0 var(--ink);
}

.focus-keys {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.keycap {
  min-width: 34px;
  height: 34px;
  border: 3px solid var(--ink);
  background: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(31, 41, 51, 0.22);
}

.keycap.active {
  background: var(--sun);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.stat-box {
  border: 3px solid var(--ink);
  background: #fff;
  padding: 8px 10px;
  font-weight: 900;
}

.stat-box span {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.mission-stage {
  height: clamp(450px, calc(100vh - 288px), 600px);
  min-height: 0;
  border: 4px solid var(--ink);
  background:
    linear-gradient(180deg, #1f8bd1 0%, #35a7ff 60%, #4caf50 60%, #4caf50 100%);
  position: relative;
  display: grid;
  grid-template-rows: minmax(190px, 1fr) auto;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
}

.mission-target-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  padding: 0 0 8px;
}

.target-card {
  position: relative;
  min-width: 180px;
  max-width: min(680px, 94%);
  text-align: center;
  border: 5px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 18px 30px;
  font-size: clamp(40px, 6.2vw, 68px);
  font-weight: 900;
  line-height: 1.14;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 0 rgba(31, 41, 51, 0.34);
}

.target-card.error {
  background: #ffd1dc;
  border-color: #e4485f;
}

.target-card.shake {
  animation: shake 150ms linear 2;
}

.input-dock {
  position: relative;
  z-index: 1;
  border: 4px solid var(--ink);
  background: #fff;
  padding: 12px 14px 14px;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 41, 51, 0.48);
}

.intro-card {
  width: min(520px, 100%);
  border: 5px solid var(--ink);
  background: #fffdf2;
  box-shadow: var(--shadow);
  padding: 22px;
  text-align: center;
}

.intro-card h3 {
  margin: 8px 0 10px;
  font-size: 24px;
}

.intro-card p {
  margin: 0 0 18px;
  line-height: 1.7;
  font-size: 18px;
}

.intro-guide-icon {
  display: block;
  width: 118px;
  height: auto;
  margin: 0 auto 10px;
  image-rendering: pixelated;
}

.keyboard {
  display: grid;
  gap: 5px;
  justify-content: center;
  justify-items: center;
  margin-top: 0;
}

.keyboard-row {
  width: max-content;
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(24, 16px);
  gap: 5px;
  justify-content: center;
}

.keyboard-row .keycap {
  grid-column: var(--key-column) / span var(--key-span, 2);
  width: 100%;
  min-width: 0;
}

.keyboard-row.space-row {
  padding-left: 0;
}

.space-key {
  width: 100%;
}

.case-key {
  min-width: 56px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}

.case-key:hover,
.case-key:focus-visible {
  background: var(--mint);
  outline: none;
}

.case-key.active:hover,
.case-key.active:focus-visible {
  background: var(--sun);
}

.symbol-key {
  min-width: 34px;
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(31, 41, 51, 0.5);
  display: grid;
  place-items: center;
  padding: 24px;
}

.result-card {
  width: min(440px, 100%);
  border: 5px solid var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
  text-align: center;
}

.result-stars {
  font-size: 52px;
  color: #f59e0b;
  text-shadow: 2px 2px 0 var(--ink);
}

.result-unlock-note {
  margin: 10px auto 18px;
  font-weight: 800;
  color: rgba(31, 41, 51, 0.78);
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

@media (max-width: 860px) {
  .map-grid,
  .free-practice-grid,
  .game-modes-grid,
  .mini-game-stats,
  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bomb-arena {
    grid-template-columns: 1fr;
    grid-template-rows: 160px 1fr;
    gap: 18px;
  }

  .bomb-timer {
    width: min(145px, 100%);
  }

  .bomb-explosion {
    --bomb-origin-x: 50%;
  }

}

@media (max-width: 560px) {
  .app-shell {
    width: calc(100vw - 16px);
    margin: 8px auto;
  }

  .screen {
    min-height: calc(100vh - 16px);
  }

  .home-title-stack {
    gap: 8px;
    min-width: 0;
  }

  .home-title-stack h1,
  .home-title-stack .pixel-logo-wrap {
    max-width: 100%;
  }

  .home-subtitle-line {
    width: 100%;
  }

  .home-subtitle-dashes {
    width: 74%;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-screen,
  .mission-screen,
  .free-practice-screen,
  .game-modes-screen,
  .mini-game-screen {
    padding: 14px;
  }

  .free-practice-board {
    padding: 16px;
  }

  .free-practice-grid {
    grid-template-columns: 1fr;
  }

  .game-modes-grid,
  .mini-game-stats {
    grid-template-columns: 1fr;
  }

  .pixel-word.small {
    --pixel-size: 3px;
    --pixel-gap: 1px;
  }

  .map-grid,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .mission-stage {
    min-height: 560px;
  }

}
