:root {
  --sky-top: #5bc9f1;
  --sky-bottom: #dff8ff;
  --ink: #28445e;
  --deep-blue: #307ab6;
  --pink: #ff729c;
  --yellow: #ffd85e;
  --mint: #70dcc0;
  --white: #fff;
  --panel: rgba(255, 255, 255, 0.88);
  --shadow: 0 12px 30px rgba(39, 102, 143, 0.18);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--sky-top);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  overflow-x: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.38) 0 2px, transparent 3px),
    radial-gradient(circle at 87% 27%, rgba(255, 255, 255, 0.34) 0 2px, transparent 3px),
    linear-gradient(180deg, var(--sky-top) 0%, #9ce4fa 44%, var(--sky-bottom) 100%);
  background-size: 80px 80px, 110px 110px, auto;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
}

button:focus-visible {
  outline: 4px solid rgba(255, 216, 94, 0.88);
  outline-offset: 3px;
}

.is-hidden {
  display: none !important;
}

.sky-decor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cloud {
  position: absolute;
  width: 150px;
  height: 46px;
  border-radius: 60px;
  background: rgba(255, 255, 255, 0.45);
  filter: blur(0.3px);
  animation: drift 20s linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 74px;
  height: 74px;
  left: 27px;
  bottom: 4px;
}

.cloud::after {
  width: 56px;
  height: 56px;
  right: 22px;
  bottom: 5px;
}

.cloud-a { top: 12%; left: -40px; transform: scale(0.8); }
.cloud-b { top: 54%; right: -55px; transform: scale(1.25); animation-delay: -7s; }
.cloud-c { top: 83%; left: 7%; transform: scale(0.56); animation-delay: -13s; }

.sparkle {
  position: absolute;
  color: rgba(255, 255, 255, 0.72);
  animation: twinkle 2.4s ease-in-out infinite;
}

.sparkle-a { top: 15%; right: 12%; font-size: 24px; }
.sparkle-b { top: 48%; left: 8%; font-size: 18px; animation-delay: -0.8s; }
.sparkle-c { top: 75%; right: 9%; font-size: 28px; animation-delay: -1.5s; }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 680px);
  min-height: 100svh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px env(safe-area-inset-bottom);
}

.topbar {
  height: 58px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.mini-brand {
  justify-self: center;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(34, 101, 143, 0.25);
}

.mini-brand span { color: #fff; }

.icon-button {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  color: #fff;
  background: rgba(40, 103, 151, 0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.topbar .icon-button.is-hidden {
  display: block !important;
  visibility: hidden;
}

.screen {
  display: none;
  padding: 8px 4px 28px;
  animation: screenIn 0.35s ease both;
}

.screen.is-active { display: block; }

.eyebrow {
  margin: 0 0 5px;
  color: var(--deep-blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.start-screen {
  text-align: center;
  padding-top: 3px;
}

.hero-scene {
  position: relative;
  width: min(88vw, 380px);
  height: min(57vw, 250px);
  max-height: 250px;
  margin: 0 auto 8px;
}

.hero-rainbow {
  position: absolute;
  width: 66%;
  aspect-ratio: 2 / 1;
  top: 15%;
  left: 17%;
  border: clamp(10px, 3vw, 17px) solid #ff7e9f;
  border-bottom: 0;
  border-radius: 180px 180px 0 0;
  box-shadow:
    inset 0 clamp(8px, 2.2vw, 13px) 0 #ffd86a,
    inset 0 clamp(16px, 4.4vw, 26px) 0 #75dcc1;
  opacity: 0.92;
}

.hero-cloud {
  position: absolute;
  left: 50%;
  height: 35%;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(59, 124, 163, 0.15);
}

.hero-cloud::before,
.hero-cloud::after {
  content: "";
  position: absolute;
  bottom: 15%;
  border-radius: 50%;
  background: inherit;
}

.hero-cloud::before { left: 12%; width: 36%; aspect-ratio: 1; }
.hero-cloud::after { right: 10%; width: 45%; aspect-ratio: 1; }
.back-cloud { width: 82%; bottom: 7%; transform: translateX(-50%); opacity: 0.72; }
.front-cloud { width: 68%; bottom: 1%; transform: translateX(-50%); z-index: 5; }

.hero-cat {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 20%;
  width: 37%;
  aspect-ratio: 1.08;
  transform: translateX(-50%);
  border-radius: 45% 45% 43% 43%;
  background: linear-gradient(145deg, #fff9ef, #f5bd82);
  box-shadow: inset -10px -12px 0 rgba(225, 139, 90, 0.13), 0 12px 22px rgba(38, 97, 133, 0.18);
  animation: floatCat 2.7s ease-in-out infinite;
}

.cat-ear {
  position: absolute;
  top: -13%;
  width: 35%;
  height: 38%;
  border-radius: 12px 70% 8px 70%;
  background: #f7ce9b;
  z-index: -1;
}

.cat-ear::after {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: inherit;
  background: #f39e9e;
  opacity: 0.6;
}

.ear-left { left: 4%; transform: rotate(-24deg); }
.ear-right { right: 4%; transform: scaleX(-1) rotate(-24deg); }

.cat-face {
  position: absolute;
  inset: 0;
}

.cat-face i,
.cat-face b {
  position: absolute;
  top: 45%;
  width: 9%;
  aspect-ratio: 0.72;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset 2px 3px 0 #fff;
}

.cat-face i { left: 28%; }
.cat-face b { right: 28%; }
.cat-face em { position: absolute; top: 54%; left: 46%; font-style: normal; font-size: clamp(16px, 5vw, 27px); color: #d75e73; }

.cat-paw {
  position: absolute;
  bottom: -6%;
  width: 34%;
  height: 27%;
  border-radius: 50%;
  background: #f6cb99;
}

.paw-left { left: 7%; transform: rotate(8deg); }
.paw-right { right: 7%; transform: rotate(-8deg); }

.hero-star {
  position: absolute;
  z-index: 7;
  color: var(--yellow);
  text-shadow: 0 3px 0 #f0ad3d, 0 6px 14px rgba(49, 104, 142, 0.25);
  animation: starBob 1.8s ease-in-out infinite;
}

.star-one { left: 7%; top: 30%; font-size: clamp(25px, 8vw, 42px); }
.star-two { right: 8%; top: 24%; font-size: clamp(20px, 6vw, 35px); animation-delay: -0.5s; }
.star-three { right: 15%; bottom: 3%; font-size: clamp(15px, 5vw, 27px); animation-delay: -1s; }

.start-screen > .eyebrow { color: #1d6b9f; }

.start-screen h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(35px, 10.5vw, 61px);
  line-height: 0.96;
  letter-spacing: 0.01em;
  text-shadow: 0 5px 0 #388fc0, 0 10px 24px rgba(35, 104, 146, 0.24);
}

.start-screen h1 span {
  color: var(--yellow);
  font-size: 0.64em;
  text-shadow: 0 4px 0 #e29e3c;
}

.lead {
  margin: 19px 0 14px;
  color: #24658d;
  font-size: clamp(15px, 4.5vw, 20px);
  font-weight: 800;
  line-height: 1.65;
}

.start-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-bottom: 20px;
}

.start-badges span {
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 999px;
  color: #2d739d;
  background: rgba(255,255,255,0.58);
  font-size: 11px;
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  min-height: 57px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #ff83a8, #f05282);
  box-shadow: 0 7px 0 #c53d68, 0 14px 26px rgba(174, 53, 99, 0.24), inset 0 2px 0 rgba(255,255,255,0.38);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.primary-button:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #c53d68, 0 8px 18px rgba(174, 53, 99, 0.2);
}

.primary-button b { font-size: 27px; line-height: 1; }
.big-button { min-width: min(88vw, 330px); font-size: 18px; }

.text-button {
  display: block;
  margin: 18px auto 0;
  padding: 8px 14px;
  border: 0;
  color: #37799f;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.map-heading,
.game-heading,
.collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.map-heading h2,
.game-heading h2,
.collection-heading h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(22px, 6vw, 31px);
  text-shadow: 0 3px 0 rgba(45, 121, 165, 0.45);
}

.total-stars {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: 999px;
  color: #356e8d;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 5px 14px rgba(31, 101, 143, 0.12);
}

.total-stars span { color: #f1b631; }
.total-stars b { margin-left: 4px; font-size: 20px; }
.total-stars small { font-size: 10px; font-weight: 800; }

.island-map {
  display: grid;
  gap: 13px;
  margin-top: 17px;
}

.island-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 2px solid rgba(255,255,255,0.72);
  border-radius: 24px;
  background: var(--island-bg, rgba(255,255,255,0.75));
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255,255,255,0.42);
}

.island-card::after {
  content: attr(data-icon);
  position: absolute;
  right: 5px;
  top: -11px;
  color: rgba(255,255,255,0.38);
  font-size: 80px;
  transform: rotate(9deg);
  pointer-events: none;
}

.island-card.is-locked { filter: saturate(0.5); opacity: 0.68; }

.island-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.island-title h3 { margin: 0; font-size: 17px; }
.island-title small { font-size: 10px; font-weight: 900; opacity: 0.72; }

.stage-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stage-button {
  min-height: 67px;
  padding: 5px 2px;
  border: 0;
  border-radius: 17px;
  color: #315770;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 5px 0 rgba(48, 105, 139, 0.15);
  cursor: pointer;
}

.stage-button strong { display: block; font-size: 17px; }
.stage-button span { display: block; color: #e5a921; font-size: 11px; letter-spacing: -1px; min-height: 14px; }
.stage-button.is-current { color: #fff; background: linear-gradient(180deg, #ff8cae, #f05b87); box-shadow: 0 5px 0 #c74670; animation: currentPulse 1.7s ease-in-out infinite; }
.stage-button.is-current span { color: #fff1ad; }
.stage-button:disabled { cursor: default; color: #90a5b0; background: rgba(237, 245, 248, 0.8); box-shadow: none; }
.stage-button:disabled strong { font-size: 0; }
.stage-button:disabled strong::after { content: "🔒"; font-size: 16px; }

.collection-card {
  margin-top: 17px;
  padding: 17px;
  border: 2px solid rgba(255,255,255,0.75);
  border-radius: 25px;
  background: rgba(255,255,255,0.76);
  box-shadow: var(--shadow);
}

.collection-heading h3 { color: var(--ink); font-size: 20px; text-shadow: none; }
.cat-count { padding: 6px 10px; border-radius: 999px; color: #fff; background: var(--pink); font-size: 12px; font-weight: 900; }

.cat-collection {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 13px;
}

.cat-card {
  position: relative;
  padding: 8px 2px 6px;
  border-radius: 16px;
  text-align: center;
  background: #fff;
}

.cat-card .cat-emoji { display: block; font-size: 31px; filter: drop-shadow(0 3px 2px rgba(60,95,117,0.18)); }
.cat-card b { display: block; margin-top: 1px; font-size: 10px; }
.cat-card.is-locked { background: rgba(213, 229, 236, 0.64); }
.cat-card.is-locked .cat-emoji { filter: grayscale(1); opacity: 0.25; }
.cat-card.is-locked b { color: #8ba0aa; }
.cat-card small { position: absolute; right: 5px; top: 4px; color: #da9e1f; font-size: 9px; font-weight: 900; }

.game-screen { padding-top: 3px; }
.game-heading { margin-bottom: 10px; }
.game-heading h2 { font-size: clamp(19px, 5vw, 25px); white-space: nowrap; }
.game-heading > div:first-child { min-width: 0; }
.stage-score { flex: 0 0 auto; color: var(--yellow); font-size: 12px; font-weight: 900; letter-spacing: 1px; text-shadow: 0 2px 0 #cb9130; }

.mission-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 2px solid rgba(255,255,255,0.75);
  border-radius: 17px;
  background: rgba(255,255,255,0.72);
}

.mission-copy span,
.move-counter span { display: block; color: #5e8ba5; font-size: 9px; font-weight: 900; letter-spacing: 0.05em; }
.mission-copy b { font-size: 12px; }
.move-counter { text-align: right; }
.move-counter b { color: var(--pink); font-size: 18px; }
.move-counter small { font-size: 9px; font-weight: 800; }

.board-wrap {
  position: relative;
  width: min(calc(100vw - 36px), 570px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 9px;
  border: 4px solid rgba(255,255,255,0.87);
  border-radius: 27px;
  background: linear-gradient(145deg, rgba(31, 135, 193, 0.33), rgba(255,255,255,0.25));
  box-shadow: 0 16px 35px rgba(37, 102, 143, 0.24), inset 0 2px 12px rgba(25,91,133,0.13);
  touch-action: none;
}

.board {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  width: 100%;
  height: 100%;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 23%;
  color: #fff;
  background:
    radial-gradient(circle at 32% 29%, rgba(255,255,255,0.7) 0 4%, transparent 5%),
    linear-gradient(145deg, rgba(255,255,255,0.54), rgba(255,255,255,0.19));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.47);
  cursor: pointer;
  touch-action: none;
}

.cell::after {
  content: "";
  position: absolute;
  inset: 34%;
  z-index: 0;
  border-radius: 50%;
  background: transparent;
  transition: transform 0.16s ease, background 0.16s ease;
}

.cell.path-cell::after {
  background: #ffe683;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.48), 0 0 15px rgba(255,222,92,0.85);
  transform: scale(1.06);
}

.cell.reachable {
  animation: reachable 1.35s ease-in-out infinite;
}

.cell.hinted {
  z-index: 4;
  background: linear-gradient(145deg, #fff7ae, #ffd85d);
  box-shadow: 0 0 0 5px rgba(255,255,255,0.82), 0 0 24px #fff3a2;
  animation: hintPulse 0.65s ease-in-out infinite alternate;
}

.cell.blocked {
  cursor: default;
  background: linear-gradient(145deg, rgba(92, 103, 142, 0.7), rgba(46, 59, 99, 0.75));
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.12), inset 0 -4px 0 rgba(24,32,67,0.18);
}

.storm {
  position: relative;
  z-index: 3;
  font-size: clamp(20px, 7.5vw, 42px);
  filter: drop-shadow(0 3px 1px rgba(28,45,76,0.25));
}

.star-token {
  position: relative;
  z-index: 3;
  color: var(--yellow);
  font-size: clamp(23px, 8vw, 45px);
  line-height: 1;
  text-shadow: 0 3px 0 #da9c28, 0 0 10px rgba(255,233,122,0.8);
  animation: tokenSpin 2.2s ease-in-out infinite;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.star-token.is-collected {
  opacity: 0;
  transform: scale(1.9) rotate(60deg);
}

.goal-rainbow {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76%;
  height: 55%;
  border: clamp(4px, 1.4vw, 8px) solid #ff7f9f;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  box-shadow: inset 0 clamp(4px, 1.4vw, 8px) 0 #ffe271, inset 0 clamp(8px, 2.8vw, 16px) 0 #65d7bb;
  animation: rainbowGlow 1.8s ease-in-out infinite;
}

.start-cloud {
  position: relative;
  z-index: 1;
  width: 72%;
  height: 43%;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 3px 0 rgba(72,147,187,0.16);
}

.trail-svg {
  position: absolute;
  z-index: 1;
  inset: 9px;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  overflow: visible;
  pointer-events: none;
}

.trail-shadow,
.trail-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.trail-shadow { stroke: rgba(47, 127, 164, 0.26); stroke-width: 18; }
.trail-line { stroke: #ffe170; stroke-width: 11; filter: drop-shadow(0 0 5px rgba(255,246,170,0.9)); }

.moving-cat {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc((100% - 43px) / 6);
  height: calc((100% - 43px) / 6);
  left: 9px;
  top: 9px;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(.2,.9,.33,1.25);
}

.moving-cat span {
  position: relative;
  z-index: 2;
  font-size: clamp(26px, 9.5vw, 54px);
  filter: drop-shadow(0 4px 1px rgba(45,90,119,0.22));
  animation: catWiggle 0.7s ease-in-out infinite alternate;
}

.moving-cat i {
  position: absolute;
  z-index: 1;
  bottom: 14%;
  width: 71%;
  height: 32%;
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 3px 0 rgba(70,140,178,0.13);
}

.game-message {
  min-height: 23px;
  margin: 11px 0 8px;
  text-align: center;
  color: #276a91;
  font-size: 13px;
  font-weight: 900;
}

.game-message.is-warning { color: #c54568; animation: shake 0.25s ease; }

.game-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.secondary-button {
  min-height: 43px;
  padding: 6px 4px;
  border: 2px solid rgba(255,255,255,0.73);
  border-radius: 15px;
  color: #347395;
  background: rgba(255,255,255,0.69);
  box-shadow: 0 4px 0 rgba(47,110,146,0.12);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.secondary-button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(47,110,146,0.12); }
.secondary-button:disabled { opacity: 0.4; cursor: default; }
.hint-button { color: #b06d12; background: rgba(255,242,174,0.84); }
.keyboard-tip { margin-top: 7px; text-align: center; color: rgba(40,91,122,0.64); font-size: 9px; font-weight: 700; }

.overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 65, 94, 0.48);
  backdrop-filter: blur(8px);
}

.overlay.is-open { display: flex; animation: fadeIn 0.25s ease; }

.result-card {
  position: relative;
  width: min(100%, 410px);
  padding: 25px 22px 21px;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(180deg, #f8feff, #ddf8ff);
  box-shadow: 0 24px 70px rgba(20,55,82,0.34), inset 0 2px 0 #fff;
  animation: resultPop 0.42s cubic-bezier(.2,.9,.32,1.25);
}

.result-card > * { position: relative; z-index: 2; }
.result-card .eyebrow { color: #5e92ad; }
.result-card h2 { margin: 4px 0; color: #2f749c; font-size: 32px; }
.result-card > p:not(.eyebrow):not(.result-moves) { margin: 4px 0 7px; font-size: 14px; font-weight: 800; }
.result-cat { margin: 2px 0 -2px; font-size: 70px; filter: drop-shadow(0 6px 2px rgba(47,101,133,0.18)); animation: resultCat 1s ease-in-out infinite alternate; }
.result-stars { color: #f1b42a; font-size: 42px; letter-spacing: 3px; text-shadow: 0 3px 0 #d48c20; }
.result-moves { margin: 3px 0 12px; color: #5c8296; font-size: 12px; font-weight: 800; }

.new-cat-notice {
  margin: 5px 0 13px;
  padding: 10px;
  border: 2px dashed #ffc052;
  border-radius: 14px;
  color: #8c641a;
  background: #fff7c9;
  font-size: 12px;
  font-weight: 800;
}

.new-cat-notice span { margin-right: 5px; padding: 3px 6px; border-radius: 999px; color: #fff; background: #ff7c9f; font-size: 9px; }
.result-card .primary-button { width: min(100%, 310px); }
.result-card .text-button { margin-top: 11px; }

.result-burst {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.confetti {
  position: absolute;
  width: 9px;
  height: 16px;
  border-radius: 3px;
  animation: confettiFall 1.8s ease-out both;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(38,70,91,0.92);
  box-shadow: 0 8px 24px rgba(21,48,67,0.25);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  transform: translate(-50%, 18px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-showing { opacity: 1; transform: translate(-50%, 0); }

@keyframes drift { 0%,100% { translate: -10px 0; } 50% { translate: 25px 5px; } }
@keyframes twinkle { 0%,100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes floatCat { 0%,100% { transform: translateX(-50%) translateY(0) rotate(-1deg); } 50% { transform: translateX(-50%) translateY(-8px) rotate(1deg); } }
@keyframes starBob { 0%,100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-8px) rotate(8deg); } }
@keyframes currentPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes reachable { 0%,100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.47); } 50% { box-shadow: inset 0 1px 0 rgba(255,255,255,.47), 0 0 0 3px rgba(255,239,154,.65); } }
@keyframes hintPulse { from { transform: scale(.96); } to { transform: scale(1.04); } }
@keyframes tokenSpin { 0%,100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(7deg) scale(1.12); } }
@keyframes rainbowGlow { 0%,100% { filter: drop-shadow(0 0 2px rgba(255,255,255,.6)); } 50% { filter: drop-shadow(0 0 10px rgba(255,245,158,1)); } }
@keyframes catWiggle { from { transform: rotate(-3deg) translateY(1px); } to { transform: rotate(3deg) translateY(-2px); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes resultPop { from { opacity: 0; transform: scale(.72) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes resultCat { from { transform: translateY(2px) rotate(-4deg); } to { transform: translateY(-5px) rotate(4deg); } }
@keyframes confettiFall { 0% { opacity: 1; transform: translateY(-35px) rotate(0); } 100% { opacity: 0; transform: translateY(390px) rotate(560deg); } }

@media (min-width: 700px) {
  .app-shell { padding-inline: 18px; }
  .map-screen { padding-inline: 22px; }
  .island-map { grid-template-columns: 1fr 1fr; }
  .cat-collection { grid-template-columns: repeat(8, 1fr); }
  .board-wrap { max-width: 520px; }
}

@media (max-height: 720px) and (orientation: landscape) {
  .app-shell { width: min(100%, 980px); }
  .start-screen.is-active { display: grid; grid-template-columns: 1fr 1fr; align-items: center; column-gap: 20px; }
  .start-screen.is-active > *:not(.hero-scene) { grid-column: 2; }
  .start-screen h1 { font-size: 52px; }
  .hero-scene { grid-row: 1 / 7; grid-column: 1; width: 390px; height: 240px; }
  .game-screen.is-active { display: grid; grid-template-columns: minmax(300px, 520px) minmax(250px, 1fr); grid-template-rows: auto auto 1fr auto; gap: 8px 22px; align-items: start; }
  .game-heading { grid-column: 2; }
  .mission-bar { grid-column: 2; }
  .board-wrap { grid-column: 1; grid-row: 1 / 5; width: min(82vh, 520px); }
  .game-message { grid-column: 2; margin-top: 18px; }
  .game-controls { grid-column: 2; }
  .keyboard-tip { display: none; }
}

@media (max-width: 370px) {
  .app-shell { padding-inline: 9px; }
  .board-wrap { width: calc(100vw - 20px); border-radius: 22px; }
  .mission-bar { padding-inline: 8px; }
  .mission-copy b { font-size: 11px; }
  .move-counter small { display: block; }
  .game-controls { gap: 5px; }
  .secondary-button { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
