@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("./vendor/fonts/baloo-2/baloo-2-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("./vendor/fonts/baloo-2/baloo-2-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("./vendor/fonts/nunito/nunito-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("./vendor/fonts/nunito/nunito-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #403b4d;
  --ink-soft: #756d82;
  --cream: #fffaf2;
  --paper: #fffdf8;
  --peach: #f6bbb6;
  --peach-deep: #df8889;
  --berry: #a95d76;
  --mint: #a9d6bf;
  --mint-deep: #5f9c83;
  --gold: #f5c95f;
  --lavender: #b9acd1;
  --shadow: 0 18px 50px rgba(76, 58, 79, 0.16);
  --soft-shadow: 0 8px 24px rgba(76, 58, 79, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: clip;
  overscroll-behavior: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

body {
  color: var(--ink);
  background: #e7d7d7;
  font-family: "Nunito", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button svg,
.chip-icon svg,
.unlock-notice svg {
  width: 1.15em;
  height: 1.15em;
  stroke-width: 2.35;
  pointer-events: none;
}

button:focus-visible {
  outline: 4px solid rgba(95, 156, 131, 0.38);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 440px;
  overflow: clip;
  background:
    radial-gradient(circle at 8% 15%, rgba(255, 255, 255, 0.58) 0 5%, transparent 5.2%),
    radial-gradient(circle at 88% 9%, rgba(255, 255, 255, 0.44) 0 7%, transparent 7.2%),
    linear-gradient(145deg, #f5d7d2 0%, #e8d9df 45%, #d3e4dc 100%);
  isolation: isolate;
}

.app::before,
.app::after {
  position: absolute;
  z-index: -1;
  width: 34vw;
  height: 34vw;
  min-width: 220px;
  min-height: 220px;
  content: "";
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-radius: 45% 55% 60% 40%;
}

.app::before {
  top: -19vw;
  left: -8vw;
  transform: rotate(18deg);
}

.app::after {
  right: -12vw;
  bottom: -22vw;
  transform: rotate(-25deg);
}

.loading-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  text-align: center;
  background: linear-gradient(155deg, #f7cbc6, #e9dbe1 52%, #cfe4d9);
  transition: opacity 400ms ease, visibility 400ms ease;
}

.app:not(.is-loading) .loading-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  position: relative;
  display: grid;
  width: 116px;
  height: 104px;
  place-items: center;
  margin-bottom: 20px;
  color: #fff9f3;
  background: #716878;
  border: 7px solid rgba(255, 255, 255, 0.7);
  border-radius: 48% 48% 45% 45%;
  box-shadow: 0 17px 30px rgba(84, 67, 86, 0.22);
  animation: loading-bob 1.8s ease-in-out infinite;
}

.loading-ear,
.result-ear {
  position: absolute;
  z-index: -1;
  top: -23px;
  width: 54px;
  height: 54px;
  background: #8b8292;
  border: 6px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

.loading-ear::after,
.result-ear::after {
  position: absolute;
  inset: 10px;
  content: "";
  background: #d8a9b2;
  border-radius: 50%;
}

.loading-ear.left,
.result-ear.left { left: -16px; }
.loading-ear.right,
.result-ear.right { right: -16px; }

.loading-face {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
}

.loading-screen h1 {
  margin: 0;
  color: var(--ink);
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1;
}

.loading-screen p {
  margin: 8px 0 20px;
  color: var(--ink-soft);
  font-weight: 800;
}

.loading-track {
  width: min(280px, 72vw);
  height: 11px;
  overflow: hidden;
  padding: 2px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 99px;
}

.loading-track span {
  display: block;
  width: 12%;
  height: 100%;
  background: linear-gradient(90deg, var(--peach-deep), var(--gold));
  border-radius: inherit;
  transition: width 300ms ease;
}

.game-screen {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1180px, 100%);
  height: 100%;
  min-height: 0;
  margin: auto;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
}

.level-heading {
  min-width: 0;
  text-align: center;
}

.heading-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.skin-name {
  padding: 2px 7px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.48);
  border-radius: 99px;
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.power-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 7px;
  margin-top: 2px;
}

.power-meter span {
  width: 15px;
  height: 4px;
  background: rgba(64,59,77,0.15);
  border-radius: 99px;
}

.power-meter span.active {
  background: var(--skin-color, var(--gold));
  box-shadow: 0 0 8px color-mix(in srgb, var(--skin-color, var(--gold)) 60%, transparent);
}

.eyebrow {
  display: block;
  color: var(--berry);
  font-family: "Baloo 2", cursive;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.1;
  text-transform: uppercase;
}

.level-heading h1,
.overlay-header h2,
.result-card h2 {
  margin: 0;
  overflow: hidden;
  font-family: "Baloo 2", cursive;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  box-shadow: 0 7px 18px rgba(76, 58, 79, 0.09);
  cursor: pointer;
  font-family: "Baloo 2", cursive;
  font-size: 1.45rem;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease;
}

.icon-button:hover { transform: translateY(-2px); background: var(--paper); }
.icon-button:active { transform: translateY(1px) scale(0.96); }
.icon-button svg { width: 20px; height: 20px; }

.top-actions {
  display: flex;
  gap: 8px;
}

.dev-only {
  color: #7b5b18;
  background: #fff1b8;
  border-color: rgba(255, 214, 83, 0.6);
}

.mission-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding-bottom: 8px;
}

.mission-chip {
  display: flex;
  min-width: 128px;
  align-items: center;
  gap: 9px;
  padding: 7px 13px 7px 8px;
  background: rgba(255, 253, 248, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 18px;
  box-shadow: 0 5px 16px rgba(76, 58, 79, 0.07);
}

.chip-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--mint-deep);
  border-radius: 12px;
  font-size: 1.1rem;
}

.step-chip .chip-icon { background: var(--peach-deep); }
.mission-chip .chip-copy { display: grid; line-height: 1; }
.mission-chip strong { font-family: "Baloo 2", cursive; font-size: 1.05rem; line-height: 1; white-space: nowrap; }
.mission-chip small { margin-top: 2px; color: var(--ink-soft); font-size: 0.65rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.step-chip { min-width: 158px; }

.board-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 24%, rgba(255,255,255,0.38) 0 3px, transparent 4px),
    radial-gradient(circle at 75% 66%, rgba(255,255,255,0.3) 0 4px, transparent 5px),
    linear-gradient(150deg, rgba(255, 250, 242, 0.52), rgba(255,255,255,0.22));
  border: 2px solid rgba(255, 255, 255, 0.56);
  border-radius: 34px;
  box-shadow: inset 0 0 50px rgba(255,255,255,0.18), var(--shadow);
  touch-action: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.tutorial-card {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: min(450px, calc(100% - 36px));
  align-items: center;
  gap: 12px;
  padding: 14px 42px 14px 14px;
  background: rgba(255, 253, 248, 0.96);
  border: 2px solid #fff;
  border-radius: 22px;
  box-shadow: var(--soft-shadow);
  animation: card-in 380ms cubic-bezier(.2,.8,.2,1);
  pointer-events: auto;
}

.tutorial-card #tutorial-close {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.35rem;
}

.tutorial-demo {
  position: relative;
  display: block;
  width: 66px;
  height: 62px;
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(145deg, #fff0d2, #f6dfc2);
  border-radius: 18px;
}
.tutorial-demo svg { position: absolute; width: 22px; height: 22px; }
.demo-pipe { position: absolute; top: 17px; left: 19px; width: 30px; height: 30px; background: #fffaf0; border: 2px solid rgba(92,77,91,0.16); border-radius: 8px; animation: demo-pipe-turn 2.4s ease-in-out infinite; }
.demo-pipe i { position: absolute; display: block; background: var(--mint-deep); border-radius: 99px; }
.demo-pipe i:first-child { top: 12px; left: 12px; width: 22px; height: 6px; }
.demo-pipe i:last-child { top: -5px; left: 12px; width: 6px; height: 22px; }
.demo-tap { position: absolute; right: 7px; bottom: 7px; width: 13px; height: 17px; background: #fff; border: 2px solid #c97882; border-radius: 8px 8px 10px 10px; animation: demo-tap 2.4s ease-in-out infinite; }
.demo-route-line { position: absolute; top: 30px; right: 13px; left: 13px; height: 6px; overflow: hidden; background: rgba(92,77,91,0.14); border-radius: 99px; }
.demo-route-line::after { display: block; width: 100%; height: 100%; content: ""; background: var(--mint-deep); border-radius: inherit; transform-origin: left; animation: demo-route-grow 2.2s ease-in-out infinite; }
.demo-chin { position: absolute; z-index: 2; top: 24px; left: 8px; width: 16px; height: 16px; color: #fff; background: #716878; border: 2px solid #fff; border-radius: 50%; font-size: 0.6rem; line-height: 12px; text-align: center; animation: demo-chin-bob 1s ease-in-out infinite; }
.demo-home { z-index: 2; top: 20px; right: 7px; color: #b66d79; fill: #fff5df; }
.demo-food { z-index: 2; top: 19px; left: 22px; color: #a4732e; fill: #e3b85d; animation: demo-food-bounce 1.15s ease-in-out infinite; }
.demo-spark { position: absolute; z-index: 3; top: 11px; right: 12px; color: #d59a27; animation: demo-spark 1.15s ease-in-out infinite; }
.demo-turn { top: 12px; left: 8px; color: #c86f80; animation: demo-turn-spin 1.8s cubic-bezier(.3,.8,.3,1) infinite; }
.demo-count { position: absolute; top: 20px; right: 8px; font-family: "Baloo 2", cursive; font-size: 0.95rem; }
.demo-count span { display: inline-block; color: #c86f80; animation: demo-count-pop 1.8s ease-in-out infinite; }
.demo-runner { position: absolute; z-index: 3; top: 23px; left: 7px; padding: 2px 4px; color: #fff; background: #716878; border: 2px solid #fff; border-radius: 9px; font-size: 0.42rem; white-space: nowrap; animation: demo-run-home 2.4s ease-in-out infinite; }

.tutorial-copy { min-width: 0; }
.tutorial-copy > small { display: block; margin-bottom: 2px; color: var(--mint-deep); font-size: 0.6rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.tutorial-card strong { display: block; font-family: "Baloo 2", cursive; font-size: 1rem; }
.tutorial-card p { min-height: 42px; margin: 1px 0 8px; color: var(--ink-soft); font-size: 0.75rem; font-weight: 700; line-height: 1.35; }
.tutorial-dots { display: flex; gap: 4px; margin-bottom: 8px; }
.tutorial-dots i { width: 17px; height: 4px; background: rgba(64,59,77,0.14); border-radius: 99px; transition: width 160ms ease, background 160ms ease; }
.tutorial-dots i.active { width: 29px; background: var(--mint-deep); }
.tutorial-actions { display: flex; min-height: 31px; justify-content: flex-end; gap: 7px; }
.tutorial-actions button {
  position: static;
  display: inline-flex;
  width: auto;
  height: 31px;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  color: var(--ink-soft);
  background: #f5efeb;
  border: 1px solid rgba(91,80,103,0.08);
  border-radius: 10px;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  font-size: 0.67rem;
  font-weight: 900;
}
.tutorial-actions button:last-child { color: #fff; background: var(--mint-deep); }
.tutorial-actions button svg { width: 14px; height: 14px; }

.toast {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: 3;
  max-width: calc(100% - 32px);
  padding: 9px 15px;
  color: #fff;
  background: rgba(64, 59, 77, 0.88);
  border-radius: 99px;
  box-shadow: var(--soft-shadow);
  font-size: 0.76rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.game-footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding-top: 10px;
}

.game-footer p {
  width: min(360px, 44vw);
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 24px;
  border-radius: 17px;
  cursor: pointer;
  font-family: "Baloo 2", cursive;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.primary-button svg,
.secondary-button svg { width: 18px; height: 18px; }

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #c86f80, #9f617e);
  border: 0;
  box-shadow: 0 9px 19px rgba(138, 72, 96, 0.24), inset 0 1px rgba(255,255,255,0.25);
}

.primary-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(138, 72, 96, 0.28); }
.primary-button:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.primary-button:disabled { opacity: 0.38; cursor: not-allowed; box-shadow: none; }

.secondary-button {
  color: var(--ink);
  background: #f6f0ec;
  border: 2px solid rgba(117, 109, 130, 0.1);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(58, 48, 64, 0.32);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: overlay-in 220ms ease;
}

.overlay-panel {
  width: min(970px, 100%);
  max-height: 100%;
  padding: clamp(18px, 3.5vw, 34px);
  overflow: auto;
  background: linear-gradient(145deg, #fffaf4, #f8f3f2);
  border: 2px solid rgba(255,255,255,0.78);
  border-radius: 34px;
  box-shadow: 0 28px 70px rgba(49, 38, 54, 0.25);
  scrollbar-width: thin;
  scrollbar-color: #cfbfc3 transparent;
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.overlay-header h2 { font-size: clamp(1.7rem, 4vw, 2.35rem); }

.map-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.platform-profile {
  display: flex;
  align-items: center;
  max-width: 190px;
  gap: 8px;
  padding: 6px 11px 6px 6px;
  border: 1px solid rgba(117, 109, 130, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
}

.platform-profile[hidden] { display: none; }
.platform-profile img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.platform-profile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reset-journey-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  color: #975366;
  background: #fff4f1;
  border: 2px solid rgba(177, 92, 112, 0.16);
  border-radius: 14px;
  cursor: pointer;
  font: 900 0.7rem "Nunito", sans-serif;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.reset-journey-button:hover {
  background: #ffeae6;
  border-color: rgba(177, 92, 112, 0.3);
  transform: translateY(-1px);
}

.reset-journey-button svg { width: 17px; height: 17px; }

.journey-summary {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: 22px 0 26px;
  padding: 14px 18px 20px;
  background: #efe6ea;
  border-radius: 22px;
}

.summary-mascot {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #fff9f3;
  background: var(--skin-color, #756d7e);
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 7px 14px rgba(77,65,82,0.15);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 2px;
}

.summary-copy strong { font-family: "Baloo 2", cursive; font-size: 1.05rem; }
.summary-copy p { margin: -2px 0 0; color: var(--ink-soft); font-size: 0.76rem; font-weight: 800; }

.summary-progress {
  position: absolute;
  right: 18px;
  bottom: 10px;
  left: 86px;
  height: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.75);
  border-radius: 99px;
}

.summary-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--peach-deep), var(--gold));
  border-radius: inherit;
  transition: width 500ms ease;
}

.dev-jump-bar {
  display: grid;
  grid-template-columns: auto auto 76px auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 8px 10px;
  color: #66541e;
  background: #fff0b9;
  border: 2px solid rgba(231,188,67,0.35);
  border-radius: 15px;
  font-size: 0.69rem;
  font-weight: 900;
}
.dev-jump-bar > svg { width: 18px; height: 18px; }
.dev-jump-bar input { width: 76px; min-height: 34px; padding: 4px 8px; color: var(--ink); background: #fffdf6; border: 1px solid rgba(102,84,30,0.18); border-radius: 9px; font: 800 0.78rem "Nunito", sans-serif; }
.dev-jump-bar button { display: inline-flex; min-height: 34px; align-items: center; gap: 5px; padding: 5px 11px; color: #fff; background: #866f2d; border: 0; border-radius: 9px; cursor: pointer; font: 900 0.7rem "Nunito", sans-serif; }
.dev-jump-bar button svg { width: 14px; height: 14px; }
.dev-jump-bar small { color: rgba(80,66,25,0.72); }

.world-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.world-card:nth-child(4),
.world-card:nth-child(5) {
  transform: translateX(50%);
}

.world-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
  background: var(--world-soft, #e7f0e9);
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 26px;
  box-shadow: 0 10px 22px rgba(76, 58, 79, 0.08);
}

.world-card::after {
  position: absolute;
  top: -38px;
  right: -35px;
  width: 110px;
  height: 110px;
  content: "";
  background: rgba(255,255,255,0.28);
  border-radius: 48% 52% 45% 55%;
}

.world-card.locked { filter: saturate(0.3); }
.world-card.locked > *:not(.world-lock) { opacity: 0.55; }

.world-icon {
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  color: #fff;
  background: var(--world-color, var(--mint-deep));
  border-radius: 14px;
  box-shadow: inset 0 1px rgba(255,255,255,0.3);
  font-size: 1.25rem;
}

.world-card h3 { margin: 10px 0 0; font-family: "Baloo 2", cursive; font-size: 1.2rem; line-height: 1; }
.world-card > p { min-height: 33px; margin: 5px 0 13px; color: var(--ink-soft); font-size: 0.72rem; font-weight: 700; line-height: 1.35; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.level-button {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  padding: 0 0 7px;
  color: var(--ink);
  background: rgba(255,255,255,0.77);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 13px;
  cursor: pointer;
  font-family: "Baloo 2", cursive;
  font-size: 0.82rem;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease;
}

.level-button:hover:not(:disabled) { transform: translateY(-2px); background: #fff; }
.level-button.current { border-color: var(--world-color); box-shadow: 0 0 0 3px rgba(255,255,255,0.6); }
.level-button:disabled { color: rgba(64,59,77,0.35); cursor: not-allowed; }
.level-button .mini-stars { position: absolute; right: 0; bottom: 2px; left: 0; color: var(--gold); font-size: 0.48rem; letter-spacing: -1px; text-align: center; }
.level-button .lock-dot { font-size: 0.75rem; opacity: 0.42; }

.world-lock {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.62);
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.25;
}

.reset-journey-overlay { z-index: 35; }

.ad-transition { z-index: 50; background: rgba(70, 64, 80, 0.42); backdrop-filter: blur(5px); }
.ad-transition-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 26px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  background: rgba(255, 250, 247, 0.96);
  box-shadow: 0 18px 45px rgba(70, 64, 80, 0.2);
  color: var(--ink);
}
.ad-transition-card svg { width: 23px; height: 23px; color: var(--rose); animation: spin 850ms linear infinite; }
.ad-transition-card strong { font-family: "Baloo 2", cursive; font-size: 1rem; }

@keyframes spin { to { transform: rotate(360deg); } }

.reset-journey-card {
  width: min(480px, 100%);
  padding: clamp(28px, 5vw, 42px);
  text-align: center;
  background: linear-gradient(150deg, #fffdf8, #fbf1ee);
  border: 3px solid rgba(255,255,255,0.88);
  border-radius: 32px;
  box-shadow: 0 28px 70px rgba(49, 38, 54, 0.28);
}

.reset-journey-icon {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 13px;
  place-items: center;
  color: #a65b6c;
  background: #ffe3df;
  border-radius: 22px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.7);
}

.reset-journey-icon svg { width: 30px; height: 30px; }
.reset-journey-card h2 { margin-top: 3px; font-size: clamp(1.65rem, 5vw, 2.2rem); }
.reset-journey-card > p { max-width: 390px; margin: 8px auto 24px; color: var(--ink-soft); font-size: 0.85rem; font-weight: 700; line-height: 1.5; }

.reset-journey-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.danger-button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  color: #fff;
  background: linear-gradient(135deg, #c86f80, #9f556d);
  border: 0;
  border-radius: 17px;
  box-shadow: 0 9px 19px rgba(138, 72, 96, 0.24);
  cursor: pointer;
  font: 900 0.78rem "Nunito", sans-serif;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.danger-button:hover { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(138, 72, 96, 0.3); }
.danger-button svg { width: 18px; height: 18px; }

.result-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 100%;
  padding: clamp(26px, 5vh, 42px) clamp(20px, 5vw, 42px) clamp(20px, 4vh, 34px);
  overflow: auto;
  text-align: center;
  background: linear-gradient(150deg, #fffdf8, #fbf3ef);
  border: 3px solid rgba(255,255,255,0.86);
  border-radius: 36px;
  box-shadow: 0 28px 70px rgba(49, 38, 54, 0.27);
  animation: result-in 420ms cubic-bezier(.16,1.1,.3,1);
}

.result-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -15px;
  width: 8px;
  height: 14px;
  background: var(--confetti-color);
  border-radius: 5px;
  animation: confetti-fall 1.9s var(--delay) ease-out forwards;
}

.result-mascot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 82px;
  height: 74px;
  place-items: center;
  margin: 0 auto 14px;
  color: #fff9f3;
  background: var(--skin-color, #716878);
  border: 6px solid #fff;
  border-radius: 48% 48% 45% 45%;
  box-shadow: 0 13px 25px rgba(84, 67, 86, 0.18);
}

.result-ear { top: -17px; width: 40px; height: 40px; border-width: 5px; }
.result-ear.left { left: -13px; }
.result-ear.right { right: -13px; }
.result-ear::after { inset: 7px; }
.result-ear { background: var(--skin-color, #8b8292); }
.result-ear::after { background: var(--skin-accent, #d8a9b2); }
.result-face { margin-top: 7px; font-size: 17px; font-weight: 900; letter-spacing: 3px; }

.result-card h2 { margin-top: 3px; font-size: clamp(1.7rem, 5vw, 2.35rem); white-space: normal; }
.result-card > p { margin: 3px 0 4px; color: var(--ink-soft); font-size: 0.82rem; font-weight: 700; }

.result-stars {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #dfd7d0;
  font-size: clamp(2.7rem, 9vw, 4rem);
}

.result-stars span { display: inline-block; transform: scale(0.82) rotate(-6deg); }
.result-stars span:nth-child(2) { transform: translateY(-9px) scale(0.9); }
.result-stars span:nth-child(3) { transform: scale(0.82) rotate(6deg); }
.result-stars span.earned { color: var(--gold); filter: drop-shadow(0 5px 0 rgba(174,122,38,0.16)); animation: star-pop 520ms cubic-bezier(.2,1.4,.3,1) backwards; }
.result-stars span:nth-child(2).earned { animation-delay: 150ms; }
.result-stars span:nth-child(3).earned { animation-delay: 300ms; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 5px 0 18px;
  padding: 12px 0;
  background: #f4ece9;
  border-radius: 19px;
}

.result-stats div { display: grid; gap: 1px; padding: 0 8px; border-right: 1px solid rgba(117,109,130,0.12); }
.result-stats div:last-child { border: 0; }
.result-stats strong { font-family: "Baloo 2", cursive; font-size: 1rem; }
.result-stats small { color: var(--ink-soft); font-size: 0.62rem; font-weight: 800; }

.unlock-notice {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: -4px 0 18px;
  padding: 10px 13px;
  color: #4b7767;
  text-align: left;
  background: #e2f1e7;
  border-radius: 16px;
}

.unlock-notice > span { font-size: 1.5rem; }
.unlock-notice > svg { flex: 0 0 auto; width: 24px; height: 24px; }
.unlock-notice strong { font-family: "Baloo 2", cursive; font-size: 0.85rem; }
.unlock-notice p { margin: -2px 0 0; font-size: 0.68rem; font-weight: 800; }

.result-actions { display: grid; grid-template-columns: 0.85fr 1.25fr; gap: 10px; }

.language-card {
  width: min(500px, 100%);
  padding: clamp(20px, 4vw, 32px);
  background: linear-gradient(145deg, #fffaf4, #f8f3f2);
  border: 2px solid rgba(255,255,255,0.82);
  border-radius: 30px;
  box-shadow: 0 28px 70px rgba(49,38,54,0.25);
  animation: result-in 350ms cubic-bezier(.16,1.1,.3,1);
}

.language-card h2 { margin: 1px 0 0; font-family: "Baloo 2", cursive; font-size: 1.75rem; }

.language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 20px;
}

.language-grid button {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  color: var(--ink);
  background: #f4ece9;
  border: 2px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 900;
  text-align: start;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.language-grid button:hover { background: #fff; transform: translateY(-2px); }
.language-grid button.active { background: #e4f0e9; border-color: var(--mint-deep); }
.language-grid button span { display: grid; width: 34px; height: 30px; place-items: center; color: #fff; background: var(--berry); border-radius: 9px; font-size: 0.68rem; }

.final-card {
  position: relative;
  width: min(680px, 100%);
  max-height: 100%;
  padding: clamp(28px, 5vh, 48px) clamp(22px, 6vw, 55px) clamp(22px, 4vh, 38px);
  overflow: auto;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0, rgba(245,201,95,0.18), transparent 37%),
    linear-gradient(150deg, #fffdf8, #f4edf8);
  border: 3px solid rgba(255,255,255,0.9);
  border-radius: 38px;
  box-shadow: 0 32px 80px rgba(49,38,54,0.3);
  animation: result-in 500ms cubic-bezier(.16,1.1,.3,1);
}

.final-card h2 { margin: 4px 0 0; font-family: "Baloo 2", cursive; font-size: clamp(2.1rem, 7vw, 3.4rem); line-height: 1; }
.final-card > p { max-width: 530px; margin: 8px auto 22px; color: var(--ink-soft); font-size: 0.9rem; font-weight: 800; line-height: 1.45; }

.final-halo {
  position: relative;
  z-index: 1;
  display: grid;
  width: 118px;
  height: 108px;
  place-items: center;
  margin: 2px auto 20px;
  color: #fff;
  background: linear-gradient(145deg, #5d587e, #7770a5);
  border: 8px solid #fff;
  border-radius: 48%;
  box-shadow: 0 0 0 10px rgba(245,201,95,0.22), 0 16px 35px rgba(83,65,103,0.24);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 4px;
  animation: loading-bob 2.2s ease-in-out infinite;
}

.final-ear {
  position: absolute;
  z-index: -1;
  top: -25px;
  width: 54px;
  height: 54px;
  background: #79729d;
  border: 7px solid #fff;
  border-radius: 50%;
}
.final-ear.left { left: -18px; }
.final-ear.right { right: -18px; }
.final-ear::after { position: absolute; inset: 10px; content: ""; background: #bd9bee; border-radius: 50%; }

.final-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 20px;
  padding: 15px 0;
  background: rgba(230,221,237,0.6);
  border-radius: 20px;
}

.final-stats div { display: grid; gap: 1px; padding: 0 10px; border-inline-end: 1px solid rgba(117,109,130,0.12); }
.final-stats div:last-child { border: 0; }
.final-stats strong { color: #665f82; font-family: "Baloo 2", cursive; font-size: 1.05rem; }
.final-stats small { color: var(--ink-soft); font-size: 0.63rem; font-weight: 900; }

.final-fireworks { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.firework-star { position: absolute; color: var(--spark-color); font-size: var(--spark-size); animation: firework-pop 1.8s var(--spark-delay) ease-out infinite; }

html[dir="rtl"] body { font-family: Tahoma, Arial, sans-serif; }
html[dir="rtl"] .primary-button svg[data-lucide="arrow-right"] { transform: scaleX(-1); }
html[dir="rtl"] .summary-progress { right: 86px; left: 18px; }
html[dir="rtl"] .world-card:nth-child(4),
html[dir="rtl"] .world-card:nth-child(5) { transform: translateX(-50%); }
html[dir="rtl"] .tutorial-card { padding: 14px 14px 14px 42px; }
html[dir="rtl"] .tutorial-card #tutorial-close { right: auto; left: 9px; }

.recording-hand-mode #solution-button { display: none !important; }

#recording-hand {
  --recording-hand-x: -100px;
  --recording-hand-y: -100px;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 64px;
  height: 72px;
  opacity: 0;
  pointer-events: none;
  transform: translate(calc(var(--recording-hand-x) - 20px), calc(var(--recording-hand-y) - 8px));
  transition: transform 260ms cubic-bezier(.22, .85, .35, 1), opacity 160ms ease;
}

#recording-hand.visible { opacity: 1; }
#recording-hand.dismissed { opacity: 0; }

.recording-hand-disc {
  position: absolute;
  inset: 0 auto auto 0;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #50485c;
  background: rgba(255, 253, 248, 0.96);
  border: 3px solid rgba(99, 183, 176, 0.92);
  border-radius: 50% 50% 48% 52%;
  box-shadow: 0 9px 22px rgba(70, 57, 75, 0.22), inset 0 0 0 3px rgba(255, 255, 255, 0.66);
  transform-origin: 20px 8px;
}

.recording-hand-disc svg {
  width: 34px;
  height: 34px;
  overflow: visible;
  fill: #ffd6bd;
  stroke: #50485c;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2;
  transform: translate(-7px, 3px) rotate(-8deg);
}

.recording-hand-disc svg path + path { fill: none; }

.recording-hand-ripple {
  position: absolute;
  left: 12px;
  top: 0;
  width: 16px;
  height: 16px;
  border: 3px solid rgba(230, 126, 126, 0.92);
  border-radius: 50%;
  opacity: 0;
  transform: scale(.2);
}

#recording-hand.tapping .recording-hand-disc { animation: recording-hand-tap 340ms ease-out; }
#recording-hand.tapping .recording-hand-ripple { animation: recording-hand-ripple 430ms ease-out; }

@media (orientation: portrait) {
  .recording-hand-mode .result-overlay:not([hidden]) { display: none !important; }
}

@keyframes loading-bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes overlay-in { from { opacity: 0; } }
@keyframes result-in { from { opacity: 0; transform: translateY(24px) scale(0.92); } }
@keyframes star-pop { from { color: #dfd7d0; transform: scale(0) rotate(-30deg); } }
@keyframes confetti-fall { to { transform: translate(var(--drift), 560px) rotate(520deg); opacity: 0; } }
@keyframes firework-pop { 0% { opacity: 0; transform: scale(0) rotate(0); } 25% { opacity: 1; transform: scale(1.2) rotate(60deg); } 100% { opacity: 0; transform: scale(0.4) translateY(60px) rotate(180deg); } }
@keyframes demo-pipe-turn { 0%, 22% { transform: rotate(0); } 42%, 72% { transform: rotate(90deg); } 92%, 100% { transform: rotate(180deg); } }
@keyframes demo-tap { 0%, 18%, 100% { transform: translateY(7px); opacity: 0; } 28%, 48% { transform: translateY(0); opacity: 1; } 58% { transform: translateY(4px) scale(.9); opacity: 1; } 72% { opacity: 0; } }
@keyframes demo-route-grow { 0%, 15% { transform: scaleX(.08); } 65%, 85% { transform: scaleX(1); } 100% { transform: scaleX(.08); } }
@keyframes demo-chin-bob { 50% { transform: translateY(-2px); } }
@keyframes demo-food-bounce { 0%, 100% { transform: translateY(3px) rotate(-7deg); } 50% { transform: translateY(-4px) rotate(7deg) scale(1.08); } }
@keyframes demo-spark { 0%, 100% { transform: scale(.45) rotate(0); opacity: .25; } 50% { transform: scale(1.25) rotate(90deg); opacity: 1; } }
@keyframes demo-turn-spin { 0%, 20% { transform: rotate(0); } 65%, 100% { transform: rotate(360deg); } }
@keyframes demo-count-pop { 0%, 45%, 100% { transform: scale(1); } 60%, 78% { transform: scale(1.28); } }
@keyframes demo-run-home { 0%, 12% { transform: translateX(0) translateY(0); } 45% { transform: translateX(19px) translateY(-3px); } 78%, 88% { transform: translateX(36px) translateY(0) scale(.78); opacity: 1; } 100% { transform: translateX(39px) scale(.45); opacity: 0; } }
@keyframes recording-hand-tap { 0%, 100% { transform: translateY(0) scale(1); } 42% { transform: translateY(7px) scale(.86); } }
@keyframes recording-hand-ripple { 0% { opacity: .95; transform: scale(.25); } 100% { opacity: 0; transform: scale(2.7); } }

@media (max-width: 760px) {
  .game-screen { padding-right: max(8px, env(safe-area-inset-right)); padding-left: max(8px, env(safe-area-inset-left)); }
  .topbar { min-height: 62px; gap: 7px; }
  .icon-button { width: 42px; height: 42px; border-radius: 14px; }
  .top-actions { gap: 5px; }
  .mission-bar { gap: 6px; min-height: 50px; }
  .mission-chip { min-width: 0; padding: 6px 9px 6px 6px; border-radius: 15px; }
  .chip-icon { width: 30px; height: 30px; border-radius: 10px; }
  .mission-chip strong { font-size: 0.93rem; }
  .mission-chip small { font-size: 0.56rem; }
  .board-shell { border-radius: 25px; }
  .game-footer { min-height: 68px; gap: 10px; padding-top: 7px; }
  .game-footer p { width: 42%; font-size: 0.66rem; }
  .primary-button, .secondary-button { min-height: 46px; padding: 10px 17px; border-radius: 15px; }
  .world-list { grid-template-columns: 1fr; }
  .dev-jump-bar { grid-template-columns: auto auto 68px auto; }
  .dev-jump-bar small { display: none; }
  .world-card:nth-child(4), .world-card:nth-child(5) { transform: none; }
  html[dir="rtl"] .world-card:nth-child(4), html[dir="rtl"] .world-card:nth-child(5) { transform: none; }
  .world-card > p { min-height: 0; }
  .level-button { aspect-ratio: 1.45; }
}

@media (max-width: 420px) {
  .level-heading h1 { font-size: 1.1rem; }
  .eyebrow { font-size: 0.62rem; }
  .mission-chip { gap: 5px; }
  .tutorial-card { right: 10px; bottom: 10px; width: calc(100% - 20px); }
  .tutorial-demo { width: 58px; }
  .game-footer p { display: none; }
  .game-footer .primary-button { width: min(280px, 88vw); }
  .result-card { border-radius: 28px; }
  .top-actions { gap: 3px; }
  .top-actions .icon-button { width: 39px; }
  .skin-name { display: none; }
  .language-grid { grid-template-columns: 1fr; }
  .language-card { max-height: 100%; overflow: auto; }
  .overlay-header { align-items: flex-start; }
  .map-header-actions { gap: 5px; }
  .platform-profile { width: 42px; height: 42px; justify-content: center; padding: 5px; }
  .platform-profile span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .reset-journey-button { width: 42px; height: 42px; justify-content: center; padding: 0; }
  .reset-journey-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .reset-journey-actions { grid-template-columns: 1fr; }
  .final-stats { grid-template-columns: 1fr; gap: 7px; padding: 12px; }
  .final-stats div { grid-template-columns: 1fr 1fr; align-items: center; border: 0; text-align: start; }
  .final-halo { width: 92px; height: 84px; margin-bottom: 15px; }
}

@media (max-height: 570px) and (orientation: landscape) {
  .game-screen {
    grid-template-rows: 58px 48px minmax(0, 1fr) 54px;
    padding: max(5px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .topbar { position: static; z-index: auto; min-height: 58px; gap: 7px; pointer-events: auto; }
  .level-heading { padding: 0; background: transparent; border-radius: 0; box-shadow: none; }
  .level-heading h1 { font-size: 1.15rem; }
  .heading-meta { gap: 5px; }
  .eyebrow { font-size: 0.58rem; }
  .icon-button { width: 40px; height: 40px; border-radius: 13px; }
  .mission-bar { position: static; z-index: auto; min-height: 48px; padding-bottom: 4px; flex-direction: row; align-items: center; pointer-events: auto; }
  .mission-chip { min-width: 122px; padding: 5px 9px 5px 5px; background: rgba(255,253,248,0.78); }
  .step-chip { min-width: 150px; }
  .chip-icon { width: 29px; height: 29px; }
  .board-shell { grid-row: auto; }
  .game-footer { position: static; z-index: auto; min-height: 54px; justify-content: center; padding-top: 5px; }
  .game-footer p { display: none; }
  .primary-button { min-height: 43px; padding: 8px 17px; }
  .result-card { width: min(610px, 92%); padding-top: 16px; padding-bottom: 16px; }
  .result-mascot { display: none; }
  .result-stars { min-height: 55px; font-size: 2.7rem; }
  .result-card h2 { font-size: 1.65rem; }
  .result-stats { margin: 0 0 10px; padding: 7px 0; }
  .result-actions { width: 76%; margin: auto; }
  .final-card { width: min(720px, 94%); padding-top: 16px; padding-bottom: 16px; }
  .final-halo { display: none; }
  .final-card h2 { font-size: 1.9rem; }
  .final-card > p { margin: 4px auto 10px; font-size: 0.72rem; }
  .final-stats { margin-bottom: 10px; padding: 8px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-demo *, .summary-mascot, .result-mascot { animation: none !important; }
}

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