﻿    :root {
      --sky: #9ad8ff;
      --grass: #83d274;
      --path: #efd2a4;
      --ui: rgba(255, 255, 255, 0.86);
      --ink: #23425a;
      --accent: #ffba49;
      --good: #62d46b;
      --bad: #ff6b6b;
      --glow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 0 24px rgba(255, 255, 255, 0.6);
      --world-width: 1280px;
      --world-height: 720px;
      --game-scale: 1;
      --game-offset-x: 0px;
      --game-offset-y: 0px;
      --game-cover-x: 0px;
      --game-cover-y: 0px;
      --game-cover-width: var(--world-width);
      --game-cover-height: var(--world-height);
      --hud-background: 7, 12, 18;
      --hud-opacity: 0.72;
      --hud-color: 255, 255, 255;
      --joystick-size: 1;
      --joystick-background: 7, 12, 18;
      --joystick-opacity: 0.84;
      --joystick-color: 7, 12, 18;
    }

    * { box-sizing: border-box; }

    *,
    *::before,
    *::after {
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      -webkit-touch-callout: none;
    }

    html, body {
      margin: 0;
      min-height: 100%;
      font-family: "Trebuchet MS", "Gill Sans", sans-serif;
      background: linear-gradient(180deg, #6dc3ff, #eefafc);
      color: var(--ink);
      overflow: hidden;
      touch-action: none;
    }

    body.shake {
      animation: shake 0.35s linear;
    }

    button {
      border: 0;
      border-radius: 999px;
      font: inherit;
      cursor: pointer;
      color: var(--ink);
    }

    #app {
      position: relative;
      width: 100vw;
      height: 100vh;
      overflow: hidden;
      background:
        radial-gradient(circle at top right, rgba(255,255,255,0.65), transparent 30%),
        linear-gradient(180deg, #90d6ff 0%, #d7f6ff 62%, #fff7e3 100%);
    }

    body.manual-landscape #app {
      position: fixed;
      left: 0;
      top: 0;
      width: 100vh;
      height: 100vw;
      transform: rotate(90deg) translateY(-100%);
      transform-origin: top left;
    }

    .screen, .overlay {
      position: absolute;
      inset: 0;
      display: none;
    }

    .screen.active,
    .overlay.active {
      display: flex;
    }

    .screen {
      align-items: center;
      justify-content: center;
      padding: 18px;
    }

    .orientation-overlay {
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 16px;
      padding: max(18px, env(safe-area-inset-top)) 24px max(18px, env(safe-area-inset-bottom));
      background: linear-gradient(180deg, rgba(20, 42, 59, 0.94), rgba(27, 61, 82, 0.97));
      z-index: 200;
      text-align: center;
      user-select: none;
      -webkit-user-select: none;
    }

    .orientation-card {
      width: min(420px, calc(100vw - 32px));
      padding: 28px 24px;
      border-radius: 28px;
      background: rgba(255,255,255,0.92);
      box-shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
      color: var(--ink);
      user-select: none;
      -webkit-user-select: none;
      max-height: calc(100vh - 112px);
      overflow: auto;
    }

    .orientation-card h2 {
      margin: 0 0 10px;
      font-size: clamp(1.6rem, 4vw, 2.2rem);
    }

    .orientation-card p {
      margin: 0;
      font-size: 1.05rem;
      line-height: 1.45;
    }

    .orientation-action {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      margin-top: 18px;
      padding: 13px 22px;
      border: 0;
      border-radius: 999px;
      background: linear-gradient(180deg, #ffcf72, #ffad38);
      color: #17334a;
      font: inherit;
      font-weight: 800;
      box-shadow: 0 10px 22px rgba(255, 173, 56, 0.32);
      cursor: pointer;
      touch-action: manipulation;
      user-select: none;
      -webkit-user-select: none;
    }

    .orientation-action:active {
      transform: translateY(1px);
    }

    .install-home-action {
      position: relative;
      left: auto;
      bottom: auto;
      transform: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 9px;
      padding: 14px 22px;
      border: 0;
      border-radius: 999px;
      background: linear-gradient(180deg, #43d46f, #159447);
      color: #f7fff9;
      font: inherit;
      font-weight: 900;
      box-shadow: 0 14px 28px rgba(21, 148, 71, 0.34);
      cursor: pointer;
      pointer-events: auto;
      touch-action: manipulation;
      white-space: nowrap;
    }

    .install-home-action:active {
      transform: translateY(1px);
    }

    .install-home-action .install-icon {
      font-size: 1.15em;
      line-height: 1;
    }

    .orientation-phone {
      position: relative;
      width: 86px;
      height: 132px;
      margin: 0 auto 18px;
      border-radius: 22px;
      border: 6px solid #2c6d8b;
      background: linear-gradient(180deg, #d8f2ff, #fef7dd);
      box-shadow: inset 0 0 0 4px rgba(255,255,255,0.78);
      animation: orientationTilt 1.6s ease-in-out infinite;
    }

    .orientation-phone::before {
      content: "";
      position: absolute;
      left: 50%;
      top: 8px;
      width: 24px;
      height: 4px;
      border-radius: 999px;
      transform: translateX(-50%);
      background: rgba(44, 109, 139, 0.42);
    }

    .orientation-phone::after {
      content: "";
      position: absolute;
      right: -30px;
      top: 50%;
      width: 26px;
      height: 26px;
      border-top: 5px solid #ffba49;
      border-right: 5px solid #ffba49;
      transform: translateY(-50%) rotate(45deg);
      border-radius: 2px;
    }

    #menuScreen {
      width: var(--world-width);
      height: var(--world-height);
      overflow: visible;
      left: var(--game-offset-x);
      top: var(--game-offset-y);
      transform: scale(var(--game-scale));
      transform-origin: top left;
    }

    .menu-backdrop {
      position: absolute;
      inset: 0;
      overflow: visible;
      pointer-events: none;
      z-index: 0;
      opacity: 0;
      transition: opacity 0.18s ease;
    }

    .menu-backdrop.ready {
      opacity: 1;
    }

    .scene-sky {
      position: absolute;
      inset: 0;
      overflow: hidden;
      pointer-events: none;
    }

    .sun, .cloud, .tree, .building, .swing, .slide, .bench-bg {
      position: absolute;
    }

    .sun {
      width: 110px;
      height: 110px;
      border-radius: 50%;
      background: radial-gradient(circle, #fff7a7 0%, #ffd85d 55%, #ffbc41 100%);
      top: 28px;
      right: 55px;
      box-shadow: 0 0 40px rgba(255, 207, 74, 0.65);
      animation: pulseSun 3s ease-in-out infinite;
    }

    .cloud {
      width: 140px;
      height: 54px;
      background: rgba(255, 255, 255, 0.85);
      border-radius: 50px;
      top: 70px;
      animation: cloudDrift 20s linear infinite;
      box-shadow: 45px 10px 0 10px rgba(255,255,255,0.8), 82px -8px 0 6px rgba(255,255,255,0.72);
    }

    .cloud.c1 { left: -80px; animation-duration: 24s; }
    .cloud.c2 { left: 240px; top: 118px; animation-duration: 32s; transform: scale(0.82); }
    .cloud.c3 { left: 70%; top: 82px; animation-duration: 28s; transform: scale(0.95); }

    .hill {
      position: absolute;
      bottom: 90px;
      width: 420px;
      height: 180px;
      background: #97d578;
      border-radius: 50%;
      filter: brightness(1.02);
    }

    .hill.h1 { left: -90px; }
    .hill.h2 { right: -60px; width: 470px; }

    .building {
      left: 44px;
      bottom: 125px;
      width: 190px;
      height: 190px;
      background: #ffc8a1;
      border-radius: 16px;
      box-shadow: inset 0 -14px 0 rgba(0,0,0,0.06);
    }

    .building::before {
      content: "";
      position: absolute;
      inset: 20px 22px;
      background:
        linear-gradient(90deg, transparent 0 14%, #b1ebff 14% 26%, transparent 26% 38%, #b1ebff 38% 50%, transparent 50% 62%, #b1ebff 62% 74%, transparent 74% 86%, #b1ebff 86% 100%),
        linear-gradient(180deg, transparent 0 20%, #b1ebff 20% 32%, transparent 32% 46%, #b1ebff 46% 58%, transparent 58% 72%, #b1ebff 72% 84%, transparent 84% 100%);
      opacity: 0.9;
      border-radius: 8px;
    }

    .tree {
      bottom: 118px;
      width: 46px;
      height: 120px;
    }

    .tree::before {
      content: "";
      position: absolute;
      bottom: 0;
      left: 18px;
      width: 10px;
      height: 48px;
      background: #946034;
      border-radius: 8px;
    }

    .tree::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 46px;
      height: 72px;
      border-radius: 50%;
      background: radial-gradient(circle at 40% 30%, #bdf785, #59bc4f);
      box-shadow: -18px 20px 0 6px #62c257, 17px 22px 0 4px #74cf67;
    }

    .tree.t1 { left: 280px; }
    .tree.t2 { right: 180px; transform: scale(1.15); }
    .tree.t3 { right: 55px; transform: scale(0.95); }

    .swing {
      bottom: 146px;
      left: 335px;
      width: 110px;
      height: 120px;
      border-left: 7px solid #846247;
      border-right: 7px solid #846247;
      border-top: 7px solid #846247;
      border-radius: 14px 14px 0 0;
    }

    .swing::before, .swing::after {
      content: "";
      position: absolute;
      top: 24px;
      width: 4px;
      height: 52px;
      background: #fff;
    }

    .swing::before { left: 34px; }
    .swing::after { right: 34px; }

    .swing-seat {
      position: absolute;
      bottom: 26px;
      left: 26px;
      width: 44px;
      height: 12px;
      background: #ff8d79;
      border-radius: 10px;
      animation: sway 2.2s ease-in-out infinite;
      transform-origin: top center;
    }

    .slide {
      bottom: 130px;
      left: 470px;
      width: 125px;
      height: 138px;
      background: linear-gradient(140deg, #f6db84 12%, #f39a5d 12% 28%, transparent 28%);
      border-radius: 18px;
    }

    .slide::before {
      content: "";
      position: absolute;
      left: 18px;
      top: 10px;
      width: 24px;
      height: 68px;
      background: #ef5d5d;
      border-radius: 18px 18px 8px 8px;
      box-shadow: 52px 0 0 #ef5d5d;
    }

    .slide::after {
      content: "";
      position: absolute;
      left: 26px;
      bottom: 10px;
      width: 78px;
      height: 16px;
      background: #5cb2ff;
      border-radius: 12px;
      transform: rotate(-26deg);
      transform-origin: left center;
    }

    .bench-bg {
      right: 165px;
      bottom: 140px;
      width: 120px;
      height: 56px;
      border-bottom: 10px solid #9d6936;
      border-top: 10px solid #d2a06d;
      border-radius: 12px;
    }

    .bench-bg::before, .bench-bg::after {
      content: "";
      position: absolute;
      bottom: -34px;
      width: 8px;
      height: 34px;
      background: #8b5a2f;
    }

    .bench-bg::before { left: 24px; }
    .bench-bg::after { right: 24px; }

    .ground {
      position: absolute;
      inset: auto 0 0 0;
      height: 145px;
      background:
        linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,0.08)),
        linear-gradient(180deg, #92da74 0 35%, #78c75f 35% 100%);
      box-shadow: inset 0 12px 0 rgba(255,255,255,0.22);
    }

    .path {
      position: absolute;
      left: 90px;
      right: 90px;
      bottom: 68px;
      height: 54px;
      background: var(--path);
      border-radius: 44px;
      box-shadow: inset 0 8px 0 rgba(255,255,255,0.22);
    }

    .menu-card, .help-card, .transition-card, .pause-card, .final-card {
      position: relative;
      width: 760px;
      max-width: calc(var(--world-width) - 60px);
      padding: 26px;
      border-radius: 28px;
      background: rgba(255,255,255,0.78);
      box-shadow: 0 24px 60px rgba(33, 78, 111, 0.25);
      backdrop-filter: blur(8px);
      z-index: 2;
      text-align: center;
    }

    .publisher-credit {
      display: block;
      width: 220px;
      max-width: 100%;
      height: auto;
      margin: 0 auto 12px;
      filter: drop-shadow(0 8px 18px rgba(31, 66, 92, 0.16));
    }

    .developer-credit {
      position: absolute;
      left: 50%;
      bottom: 18px;
      transform: translateX(-50%);
      width: 260px;
      max-width: calc(var(--world-width) - 80px);
      height: auto;
      z-index: 2;
      filter: drop-shadow(0 10px 24px rgba(31, 66, 92, 0.22));
      pointer-events: none;
    }

    .menu-card h1 {
      margin: 0;
      font-size: 4.5rem;
      line-height: 0.95;
      color: #ff7b54;
      text-shadow: 0 4px 0 rgba(255,255,255,0.55);
    }

    .menu-card h2 {
      margin: 12px 0 18px;
      font-size: 1.8rem;
      color: #2c6d8b;
    }

    .menu-row, .pause-actions, .final-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 14px;
      justify-content: center;
      margin-top: 18px;
    }

    .primary-btn, .secondary-btn {
      padding: 15px 26px;
      font-size: 1.12rem;
      font-weight: 700;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .primary-btn {
      background: linear-gradient(180deg, #ffd262, #ffb24f);
      box-shadow: 0 10px 20px rgba(255, 183, 74, 0.35);
      animation: pulseBtn 2s ease-in-out infinite;
    }

    .secondary-btn {
      background: linear-gradient(180deg, #d8f3ff, #bde7ff);
      box-shadow: 0 10px 20px rgba(83, 169, 216, 0.18);
    }

    button:hover, button:focus-visible {
      transform: translateY(-2px) scale(1.02);
      outline: none;
    }

    #gameScreen {
      flex-direction: column;
      justify-content: flex-start;
      padding: 0;
      background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
    }

    #hud {
      position: absolute;
      inset: 0;
      z-index: 20;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 14px;
      pointer-events: none;
    }

    #topLevelBadge {
      align-self: flex-start;
      background: rgba(var(--hud-background), var(--hud-opacity));
      border-radius: 999px;
      padding: 10px 14px;
      box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
      font-size: 0.95rem;
      font-weight: 800;
      color: rgba(var(--hud-color), 0.94);
      pointer-events: auto;
      cursor: pointer;
      transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    }

    #topLevelBadge:hover,
    #topLevelBadge:focus-visible {
      transform: translateY(-1px);
      box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
      background: rgba(var(--hud-background), min(0.92, calc(var(--hud-opacity) + 0.1)));
      outline: none;
    }

    #musicBtn {
      position: absolute;
      right: 16px;
      bottom: 16px;
      width: 46px;
      height: 46px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      font-size: 1.25rem;
      background: rgba(var(--hud-background), var(--hud-opacity));
      color: rgba(var(--hud-color), 0.94);
      box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
    }

    #musicBtn .music-note {
      position: relative;
      z-index: 1;
      color: rgba(var(--hud-color), 0.94);
      line-height: 1;
    }

    #musicBtn.muted::after {
      content: "";
      position: absolute;
      width: 28px;
      height: 3px;
      border-radius: 999px;
      background: #e25050;
      transform: rotate(-35deg);
    }

    #musicBtn + *,
    #topLevelBadge + div {
      pointer-events: auto;
    }

    #settingsBtn {
      position: absolute;
      left: 16px;
      bottom: 16px;
      width: 54px;
      height: 54px;
      border-radius: 50%;
      display: none;
      align-items: center;
      justify-content: center;
      box-shadow: 0 14px 28px rgba(31, 66, 92, 0.22);
      z-index: 24;
      pointer-events: auto;
    }

    #settingsBtn.visible { display: inline-flex; }

    .hud-box {
      background: rgba(var(--hud-background), var(--hud-opacity));
      color: rgba(var(--hud-color), 0.94);
      border-radius: 18px;
      padding: 12px 16px;
      box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
      pointer-events: auto;
    }

    #hudLevel {
      font-size: 1rem;
      font-weight: 700;
    }

    #hudProgress {
      font-size: 0.92rem;
      font-weight: 700;
      color: #2d738f;
    }

    #bottomProgress { display: none; }

    #pauseBtn {
      min-width: 120px;
      background: linear-gradient(180deg, #ffefae, #ffd977);
      font-weight: 700;
    }

    #gameViewport {
      position: absolute;
      inset: 0;
      overflow: hidden;
    }

    #gameWorld {
      position: absolute;
      left: 0;
      top: 0;
      width: var(--world-width);
      height: var(--world-height);
      max-height: none;
      overflow: visible;
      border-radius: 0;
      box-shadow: none;
      background: linear-gradient(180deg, #8fd4ff, #edfafd);
      transform: translate(var(--game-offset-x), var(--game-offset-y)) scale(var(--game-scale));
      transform-origin: top left;
    }

    #gameWorld.theme-parking {
      background: linear-gradient(180deg, #88caff, #d7f0ff 48%, #f1e8db 48%, #d8d0c3 100%);
    }

    #gameWorld.theme-choice {
      background: linear-gradient(180deg, #89d1ff, #dff6ff 48%, #e8f0d5 48%, #b8d68d 100%);
    }

    #gameWorld.theme-warm {
      background: linear-gradient(180deg, #ffdca4, #fff0cf 44%, #f9efc6 44%, #add57e 100%);
    }

    #gameWorld.theme-stage {
      background: linear-gradient(180deg, #9fbcff, #dfd9ff 38%, #f6ddbc 38%, #d29972 100%);
    }

    #worldBack, #worldItems, #worldFX {
      position: absolute;
      inset: 0;
    }

    #worldBack { z-index: 0; }
    #worldItems { z-index: 2; }
    #worldFX { z-index: 3; }

    .backdrop-sky {
      position: absolute;
      left: var(--game-cover-x);
      top: var(--game-cover-y);
      width: var(--game-cover-width);
      height: var(--game-cover-height);
      background:
        radial-gradient(circle at 82% 14%, rgba(255, 244, 188, 0.74), transparent 11%),
        linear-gradient(180deg, #8fd4ff 0%, #dff7ff 62%, #fff7e4 100%);
    }

    .backdrop-clouds {
      position: absolute;
      left: var(--game-cover-x);
      top: var(--game-cover-y);
      width: var(--game-cover-width);
      height: var(--game-cover-height);
      overflow: hidden;
      pointer-events: none;
      z-index: 1;
    }

    .backdrop-cloud-track {
      position: absolute;
      inset: 0 auto 0 0;
      width: calc(var(--cloud-loop-width, 1400px) * 2);
      height: 100%;
      animation: cloudTrackDrift var(--cloud-loop-duration, 40s) linear infinite;
      will-change: transform;
    }

    .backdrop-cloud {
      position: absolute;
      display: block;
      height: auto;
      user-select: none;
      pointer-events: none;
      filter: drop-shadow(0 8px 14px rgba(71, 107, 126, 0.035));
    }

    .backdrop-sun {
      position: absolute;
      width: 128px;
      height: 128px;
      border-radius: 50%;
      background:
        radial-gradient(circle at 35% 35%, #fff9cb 0%, #ffe676 38%, #ffd24a 66%, #ffbf33 100%);
      box-shadow: 0 0 42px rgba(255, 208, 84, 0.72);
      animation: pulseSun 3s ease-in-out infinite;
      transform: translate(-50%, -50%) scale(var(--entity-scale, 1));
      transform-origin: center center;
      z-index: 0;
      pointer-events: auto;
    }

    body.editor-active .backdrop-sun {
      z-index: 5;
    }

    .backdrop-sun.editor-selected {
      box-shadow: 0 0 0 4px rgba(47, 127, 196, 0.22), 0 0 42px rgba(255, 208, 84, 0.72);
    }

    .stage-photo {
      position: absolute;
      left: var(--game-cover-x);
      top: var(--game-cover-y);
      width: var(--game-cover-width);
      height: var(--game-cover-height);
      background-position: center center;
      background-size: cover;
      background-repeat: no-repeat;
      z-index: 2;
      pointer-events: none;
    }

    .menu-backdrop .stage-photo {
      opacity: 0.96;
    }

    .menu-backdrop .backdrop-clouds {
      z-index: 1;
    }

    .entity, .zone, .bubble, .fx, .helper {
      position: absolute;
      transform: translate(-50%, -50%);
    }

    .entity {
      width: 72px;
      height: 96px;
      z-index: 3;
      transform: translateX(-50%) translateY(-100%) scale(var(--entity-scale, 1));
      transform-origin: center bottom;
    }

    .sprite-wrap {
      position: absolute;
      left: 50%;
      bottom: 0;
      transform: translateX(-50%);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      width: 100%;
      height: 100%;
    }

    .sprite-img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: center bottom;
      filter: drop-shadow(0 8px 10px rgba(25, 65, 89, 0.18));
      user-select: none;
      pointer-events: none;
    }

    .sprite-sheet {
      display: none;
      width: 100%;
      height: 100%;
      background-repeat: no-repeat;
      background-position: var(--sheet-x, 0%) var(--sheet-y, 0%);
      background-size: calc(var(--sheet-columns, 1) * 100%) calc(var(--sheet-rows, 1) * 100%);
      filter: drop-shadow(0 8px 10px rgba(25, 65, 89, 0.18));
      user-select: none;
      pointer-events: none;
      transform-origin: center bottom;
    }

    .entity.ana,
    .entity.stranger {
      width: 88px;
      height: 124px;
    }

    .entity.mom {
      width: 136px;
      height: 124px;
    }

    .entity.owl {
      width: 98px;
      height: 108px;
    }

    .entity.dog {
      width: 96px;
      height: 74px;
    }

    .entity.car {
      width: 166px;
      height: 96px;
    }

    .editor-active .entity,
    .editor-active .zone,
    .editor-active .decoration {
      outline: none;
      cursor: default;
    }

    .editor-active .bubble {
      outline: none;
      cursor: default;
    }

    .editor-box {
      position: absolute;
      box-sizing: border-box;
      --editor-mark-color: rgba(255, 255, 255, 0.96);
      --editor-mark-thickness: 3px;
      border: 0;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.05);
      z-index: 40;
      cursor: move;
      pointer-events: auto;
      touch-action: none;
    }

    .editor-box::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      pointer-events: none;
      background:
        repeating-linear-gradient(90deg, var(--editor-mark-color) 0 9px, transparent 9px 18px) left top / 28px var(--editor-mark-thickness) repeat-x,
        repeating-linear-gradient(90deg, var(--editor-mark-color) 0 9px, transparent 9px 18px) left bottom / 28px var(--editor-mark-thickness) repeat-x,
        repeating-linear-gradient(180deg, var(--editor-mark-color) 0 9px, transparent 9px 18px) left top / var(--editor-mark-thickness) 28px repeat-y,
        repeating-linear-gradient(180deg, var(--editor-mark-color) 0 9px, transparent 9px 18px) right top / var(--editor-mark-thickness) 28px repeat-y;
      animation: editorDashFlow 0.75s linear infinite;
    }

    .editor-box.selected {
      --editor-mark-color: #2f7fc4;
      box-shadow: 0 0 0 4px rgba(47, 127, 196, 0.22), 0 10px 24px rgba(22, 48, 70, 0.22);
    }

    .horizon-line-editor-target {
      position: absolute;
      height: 28px;
      transform: translateY(-50%);
      z-index: 39;
      pointer-events: auto;
      touch-action: none;
      cursor: ns-resize;
    }

    .horizon-fade-editor-layer {
      position: absolute;
      background: linear-gradient(180deg, rgba(7, 18, 28, 0.42), rgba(13, 31, 45, 0.3) 58%, rgba(13, 31, 45, 0.18));
      backdrop-filter: blur(6px) saturate(0.78);
      -webkit-backdrop-filter: blur(6px) saturate(0.78);
      pointer-events: none;
      z-index: 4;
    }

    .horizon-line-editor-target::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      top: 50%;
      height: 14px;
      transform: translateY(-50%);
      background: rgba(238, 43, 43, 0.98);
      box-shadow: 0 0 0 2px rgba(255,255,255,0.62), 0 8px 18px rgba(111, 18, 18, 0.36);
    }

    .editor-box.horizon-line-box {
      --editor-mark-color: rgba(238, 43, 43, 0.95);
      height: 28px !important;
      border-radius: 999px;
      border: 0;
      background: transparent;
      box-shadow: none;
      cursor: ns-resize;
      z-index: 40;
    }

    .editor-box.horizon-line-box::before {
      display: none;
    }

    .editor-box.horizon-line-box.selected {
      --editor-mark-color: #2f7fc4;
      box-shadow: none;
    }

    .editor-grip {
      position: absolute;
      right: -12px;
      bottom: -12px;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      cursor: nwse-resize;
      background: transparent;
    }

    .editor-grip::before {
      content: "";
      position: absolute;
      inset: 5px;
      border-radius: 50%;
      border: 2px solid #fff;
      background: linear-gradient(180deg, #5eb6ff, #2f7fc4);
      box-shadow: 0 6px 14px rgba(31, 66, 92, 0.22);
    }

    .editor-active .resize-handle {
      display: none;
    }

    .resize-handle {
      display: none;
      position: absolute;
      right: -10px;
      bottom: -10px;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: transparent;
      cursor: nwse-resize;
      z-index: 5;
      pointer-events: auto;
    }

    .resize-handle::before {
      content: "";
      position: absolute;
      inset: 7px;
      border-radius: 50%;
      border: 2px solid #fff;
      background: linear-gradient(180deg, #5eb6ff, #2f7fc4);
      box-shadow: 0 6px 14px rgba(31, 66, 92, 0.22);
    }

    .entity .resize-handle {
      right: -12px;
      bottom: -12px;
    }

    .bubble .resize-handle {
      right: -12px;
      bottom: -12px;
    }

    .entity.editor-selected,
    .zone.editor-selected,
    .decoration.editor-selected {
      outline: none;
      box-shadow: none;
    }

    .entity.ana {
      z-index: 6;
    }

    .character {
      position: absolute;
      left: 50%;
      bottom: 0;
      transform: translateX(-50%);
    }

    .body {
      position: absolute;
      left: 50%;
      bottom: 0;
      transform: translateX(-50%);
      width: 38px;
      height: 40px;
      border-radius: 16px 16px 14px 14px;
    }

    .head {
      position: absolute;
      left: 50%;
      top: 10px;
      width: 34px;
      height: 34px;
      border-radius: 50%;
      transform: translateX(-50%);
      background: #ffd7b3;
      z-index: 2;
    }

    .eye {
      position: absolute;
      top: 13px;
      width: 4px;
      height: 5px;
      border-radius: 50%;
      background: #243f56;
    }

    .eye.left { left: 10px; }
    .eye.right { right: 10px; }

    .smile {
      position: absolute;
      left: 50%;
      top: 22px;
      width: 12px;
      height: 6px;
      border-bottom: 2px solid #c86c6c;
      border-radius: 0 0 10px 10px;
      transform: translateX(-50%);
    }

    .hair {
      position: absolute;
      left: 50%;
      top: 4px;
      transform: translateX(-50%);
      width: 38px;
      height: 20px;
      border-radius: 18px 18px 10px 10px;
      background: #6b4b3e;
      z-index: 3;
    }

    .legs, .arms {
      position: absolute;
      left: 50%;
      bottom: 0;
      transform: translateX(-50%);
    }

    .legs::before, .legs::after,
    .arms::before, .arms::after {
      content: "";
      position: absolute;
      background: currentColor;
      border-radius: 8px;
      transform-origin: top center;
    }

    .legs::before, .legs::after {
      width: 7px;
      height: 24px;
      top: 0;
    }

    .legs::before { left: -9px; }
    .legs::after { right: -9px; }

    .arms::before, .arms::after {
      width: 6px;
      height: 20px;
      top: 0;
    }

    .arms::before { left: -17px; }
    .arms::after { right: -17px; }

    .entity.walking .legs::before { animation: legA 0.28s linear infinite; }
    .entity.walking .legs::after { animation: legB 0.28s linear infinite; }

    .ana .body { background: #ff7b96; }
    .ana .legs, .ana .arms { color: #5a4d61; }
    .ana .hair::after {
      content: "";
      position: absolute;
      right: -4px;
      top: 7px;
      width: 10px;
      height: 16px;
      border-radius: 10px;
      background: #6b4b3e;
    }

    .mom .body { background: #7fcaef; }
    .mom .legs, .mom .arms { color: #4d5668; }
    .mom .hair { background: #4c3b2e; width: 40px; }
    .mom.phone .phone {
      position: absolute;
      right: 7px;
      top: 38px;
      width: 8px;
      height: 14px;
      background: #2b5676;
      border-radius: 3px;
      transform: rotate(14deg);
      z-index: 5;
    }

    .stranger .body { background: #7ac57f; }
    .stranger .legs, .stranger .arms { color: #525f65; }
    .stranger .hair { background: #486154; }

    .owl {
      width: 86px;
      height: 90px;
      z-index: 8;
      animation: floatOwl 2.6s ease-in-out infinite;
    }

    .owl .owl-body {
      position: absolute;
      left: 50%;
      bottom: 0;
      transform: translateX(-50%);
      width: 64px;
      height: 72px;
      border-radius: 32px 32px 26px 26px;
      background: linear-gradient(180deg, #c89562, #8a5b35);
    }

    .owl .owl-eye {
      position: absolute;
      top: 18px;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #fff9dd;
      box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08);
    }

    .owl .owl-eye.left { left: 18px; }
    .owl .owl-eye.right { right: 18px; }

    .owl .owl-eye::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #243f56;
      transform: translate(-50%, -50%);
    }

    .owl .beak {
      position: absolute;
      left: 50%;
      top: 42px;
      transform: translateX(-50%);
      width: 0;
      height: 0;
      border-left: 8px solid transparent;
      border-right: 8px solid transparent;
      border-top: 14px solid #f2ca49;
    }

    .dog {
      width: 70px;
      height: 54px;
      z-index: 4;
    }

    .dog .dog-body {
      position: absolute;
      left: 50%;
      bottom: 10px;
      transform: translateX(-50%);
      width: 46px;
      height: 24px;
      border-radius: 18px;
      background: #ffe0a1;
      box-shadow: inset 0 -4px 0 rgba(0,0,0,0.08);
    }

    .dog .dog-head {
      position: absolute;
      left: 18px;
      top: 9px;
      width: 22px;
      height: 20px;
      border-radius: 50%;
      background: #ffe0a1;
    }

    .dog .dog-head::before, .dog .dog-head::after {
      content: "";
      position: absolute;
      top: 1px;
      width: 10px;
      height: 12px;
      background: #d09c60;
      border-radius: 10px;
    }

    .dog .dog-head::before { left: -2px; }
    .dog .dog-head::after { right: -2px; }

    .dog .tail {
      position: absolute;
      right: 10px;
      top: 18px;
      width: 20px;
      height: 6px;
      background: #d09c60;
      border-radius: 6px;
      transform-origin: left center;
    }

    .car {
      width: 140px;
      height: 70px;
      z-index: 2;
    }

    .car .car-body {
      position: absolute;
      inset: auto 0 0 0;
      height: 48px;
      background: #72a3ff;
      border-radius: 18px 26px 16px 16px;
      box-shadow: inset 0 -8px 0 rgba(0,0,0,0.12);
    }

    .car .car-top {
      position: absolute;
      left: 34px;
      top: 8px;
      width: 64px;
      height: 28px;
      background: #4c80db;
      border-radius: 18px 18px 8px 8px;
    }

    .car .wheel {
      position: absolute;
      bottom: -2px;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: #39454f;
      box-shadow: inset 0 0 0 5px #9ba7af;
    }

    .car .wheel.left { left: 22px; }
    .car .wheel.right { right: 22px; }

    .car.danger {
      animation: dangerFlash 0.6s linear infinite;
    }

    .zone {
      border-radius: 26px;
      padding: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      color: var(--ink);
      font-weight: 800;
      font-size: clamp(0.8rem, 1.7vw, 1rem);
      line-height: 1.15;
      background: rgba(255,255,255,0.72);
      border: 3px solid rgba(255,255,255,0.55);
      box-shadow: var(--glow);
      animation: pulseZone 2s ease-in-out infinite;
      z-index: 10;
    }

    .zone.choice-road {
      border-radius: 999px;
    }

    .zone.character-choice {
      width: 120px !important;
      height: 130px !important;
      padding-top: 50px;
    }

    .zone.active-near {
      transform: translate(-50%, -50%) scale(calc(var(--zone-scale, 1) * 1.05));
    }

    .zone.correct {
      background: rgba(98, 212, 107, 0.84);
      border-color: rgba(255,255,255,0.9);
      animation: none;
    }

    .zone.wrong {
      background: rgba(255, 107, 107, 0.82);
      border-color: rgba(255,255,255,0.9);
      animation: none;
    }

    .zone.locked {
      opacity: 0.52;
      filter: grayscale(0.25);
    }

    .bubble {
      max-width: 310px;
      background: rgba(255,255,255,0.95);
      padding: 12px 14px;
      border-radius: 18px;
      box-shadow: 0 12px 24px rgba(28, 72, 92, 0.14);
      font-size: 0.95rem;
      line-height: 1.25;
      z-index: 9;
      animation: bubbleIn 0.3s ease;
      white-space: normal;
      overflow-wrap: break-word;
    }

    .bubble.active-speaking {
      animation: bubbleIn 0.3s ease, bubblePulse 1.45s ease-in-out infinite;
    }

    .bubble-text {
      display: block;
      min-height: 1.2em;
    }

    .bubble.typing .bubble-text::after {
      content: "";
      display: inline-block;
      width: 2px;
      height: 1em;
      margin-left: 3px;
      vertical-align: -0.1em;
      background: currentColor;
      animation: caretBlink 0.75s steps(1) infinite;
    }

    .bubble::after {
      content: "";
      position: absolute;
      left: 20px;
      bottom: -10px;
      width: 18px;
      height: 18px;
      background: inherit;
      transform: rotate(45deg);
      border-radius: 4px;
    }

    .bubble.owl-bubble {
      background: #fff9db;
      border: 2px solid rgba(255, 195, 74, 0.55);
    }

    .helper {
      z-index: 7;
      font-size: 2rem;
      font-weight: 900;
      color: #ff6b6b;
      text-shadow: 0 4px 10px rgba(255,255,255,0.7);
      animation: pulseZone 1.1s ease-in-out infinite;
    }

    .helper.shield {
      color: #57d391;
      font-size: 2.4rem;
    }

    .fx.star {
      width: 18px;
      height: 18px;
      background: #fff3a6;
      clip-path: polygon(50% 0%, 62% 35%, 100% 35%, 69% 57%, 80% 100%, 50% 72%, 20% 100%, 31% 57%, 0% 35%, 38% 35%);
      animation: starBurst 0.9s ease forwards;
      z-index: 12;
    }

    .fx.confetti {
      width: 12px;
      height: 20px;
      border-radius: 3px;
      animation: confettiFall 3.2s linear forwards;
    }

    #touchControls {
      position: absolute;
      left: max(18px, env(safe-area-inset-left));
      bottom: max(18px, env(safe-area-inset-bottom));
      width: calc(clamp(132px, 18vw, 176px) * var(--joystick-size));
      height: calc(clamp(132px, 18vw, 176px) * var(--joystick-size));
      z-index: 12;
      display: block;
      border-radius: 50%;
      touch-action: none;
      opacity: 0.94;
    }

    .joystick-base {
      position: absolute;
      inset: 0;
      border-radius: 50%;
      background: radial-gradient(circle at 42% 32%, rgba(var(--joystick-background), min(0.96, calc(var(--joystick-opacity) + 0.08))), rgba(var(--joystick-background), var(--joystick-opacity)) 62%, rgba(var(--joystick-background), max(0.56, calc(var(--joystick-opacity) - 0.12))));
      border: 1px solid rgba(255, 255, 255, 0.08);
      box-shadow: 0 18px 34px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255,255,255,0.08);
      pointer-events: none;
    }

    .touch-btn {
      position: absolute;
      z-index: 2;
      width: 27%;
      height: 27%;
      border-radius: 9px;
      background: rgba(255,255,255,0.94);
      box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22), inset 0 -2px 0 rgba(20, 32, 42, 0.08);
      padding: 0;
      color: transparent;
      user-select: none;
      -webkit-user-select: none;
      touch-action: none;
      transition: transform 0.12s ease, background 0.12s ease;
    }

    .touch-btn:active {
      background: rgba(255,255,255,0.78);
    }

    .touch-btn::before {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }

    .touch-up {
      left: 50%;
      top: 11%;
      transform: translateX(-50%);
      border-bottom-left-radius: 13px;
      border-bottom-right-radius: 13px;
    }

    .touch-down {
      left: 50%;
      bottom: 11%;
      transform: translateX(-50%);
      border-top-left-radius: 13px;
      border-top-right-radius: 13px;
    }

    .touch-left {
      left: 11%;
      top: 50%;
      transform: translateY(-50%);
      border-top-right-radius: 13px;
      border-bottom-right-radius: 13px;
    }

    .touch-right {
      right: 11%;
      top: 50%;
      transform: translateY(-50%);
      border-top-left-radius: 13px;
      border-bottom-left-radius: 13px;
    }

    .touch-up:active,
    .touch-down:active { transform: translateX(-50%) scale(0.96); }
    .touch-left:active,
    .touch-right:active { transform: translateY(-50%) scale(0.96); }

    .touch-up::before {
      border-left: 9px solid transparent;
      border-right: 9px solid transparent;
      border-bottom: 16px solid rgba(var(--joystick-color), 0.94);
    }

    .touch-down::before {
      border-left: 9px solid transparent;
      border-right: 9px solid transparent;
      border-top: 16px solid rgba(var(--joystick-color), 0.94);
    }

    .touch-left::before {
      border-top: 9px solid transparent;
      border-bottom: 9px solid transparent;
      border-right: 16px solid rgba(var(--joystick-color), 0.94);
    }

    .touch-right::before {
      border-top: 9px solid transparent;
      border-bottom: 9px solid transparent;
      border-left: 16px solid rgba(var(--joystick-color), 0.94);
    }

    #transitionScreen, #helpScreen, #pauseOverlay, #dangerOverlay {
      background: rgba(41, 89, 122, 0.34);
      backdrop-filter: blur(5px);
    }

    #dangerOverlay {
      align-items: center;
      justify-content: center;
      flex-direction: column;
      color: white;
      text-align: center;
      padding: 20px;
      z-index: 20;
    }

    #dangerOverlay h2 {
      margin: 0;
      font-size: clamp(2rem, 6vw, 4.6rem);
      color: #ffb7b7;
      text-shadow: 0 8px 24px rgba(0,0,0,0.38);
    }

    #dangerOverlay p {
      max-width: 520px;
      font-size: clamp(1rem, 2vw, 1.25rem);
      line-height: 1.35;
    }

    .fade-in { animation: fadeIn 0.45s ease; }
    .fade-out { animation: fadeOut 0.45s ease; }

    .instruction {
      font-size: 1rem;
      line-height: 1.45;
    }

    .progress-badges {
      display: flex;
      justify-content: center;
      gap: 8px;
      margin-top: 12px;
      flex-wrap: wrap;
    }

    .badge-dot {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: rgba(113, 168, 196, 0.26);
      box-shadow: inset 0 0 0 2px rgba(255,255,255,0.8);
    }

    .badge-dot.done {
      background: linear-gradient(180deg, #ffe48c, #ffb74f);
    }

    .final-rules {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 12px;
      margin-top: 18px;
    }

    .rule-card {
      padding: 12px;
      border-radius: 18px;
      background: rgba(255,255,255,0.84);
      box-shadow: 0 10px 20px rgba(28, 72, 92, 0.12);
      font-weight: 700;
    }

    .badge-medal {
      width: 116px;
      height: 116px;
      margin: 0 auto 10px;
      border-radius: 50%;
      background: radial-gradient(circle, #fff7c7, #ffd54a 55%, #ffaf47 100%);
      box-shadow: 0 0 0 10px rgba(255,255,255,0.4), 0 16px 30px rgba(255, 190, 75, 0.34);
      position: relative;
    }

    .badge-medal::before, .badge-medal::after {
      content: "";
      position: absolute;
      bottom: -20px;
      width: 28px;
      height: 36px;
      background: #5cb2ff;
      clip-path: polygon(0 0, 100% 0, 75% 100%, 50% 78%, 25% 100%);
    }

    .badge-medal::before { left: 20px; }
    .badge-medal::after { right: 20px; }

    .badge-medal span {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      font-size: 1.9rem;
      font-weight: 900;
      color: #926128;
    }

    @media (max-width: 760px) {
      .bubble { max-width: 240px; font-size: 0.82rem; }
      .entity { transform-origin: center bottom; }
      .menu-card, .help-card, .transition-card, .pause-card, .final-card {
        padding: 20px;
        border-radius: 24px;
      }
    }

    @media (pointer: fine) {
      #touchControls { display: none; }
    }

    @keyframes cloudDrift {
      from { transform: translateX(0); }
      to { transform: translateX(calc(100vw + var(--cloud-exit, 260px))); }
    }

    @keyframes cloudTrackDrift {
      from { transform: translateX(0); }
      to { transform: translateX(calc(-1 * var(--cloud-loop-width, 1400px))); }
    }
    @keyframes pulseSun {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.06); }
    }
    @keyframes pulseBtn {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.05); }
    }
    @keyframes pulseZone {
      0%, 100% { box-shadow: var(--glow); }
      50% { box-shadow: 0 0 0 5px rgba(255,255,255,0.55), 0 0 34px rgba(255,255,255,0.88); }
    }
    @keyframes floatOwl {
      0%, 100% { transform: translate(-50%, -50%) translateY(0); }
      50% { transform: translate(-50%, -50%) translateY(-8px); }
    }
    @keyframes bubbleIn {
      from { opacity: 0; transform: translate(-50%, -42%) scale(0.92); }
      to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    }
    @keyframes bubblePulse {
      0%, 100% { box-shadow: 0 12px 24px rgba(28, 72, 92, 0.14); transform: translate(-50%, -50%) scale(1); }
      50% { box-shadow: 0 14px 28px rgba(28, 72, 92, 0.22), 0 0 0 4px rgba(255, 222, 130, 0.2); transform: translate(-50%, -50%) scale(1.015); }
    }

    @keyframes editorDashFlow {
      from {
        background-position: 0 0, 0 100%, 0 0, 100% 0;
      }
      to {
        background-position: 28px 0, -28px 100%, 0 28px, 100% -28px;
      }
    }
    @keyframes caretBlink {
      0%, 50% { opacity: 1; }
      50.01%, 100% { opacity: 0; }
    }
    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    @keyframes fadeOut {
      from { opacity: 1; }
      to { opacity: 0; }
    }
    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-5px); }
      50% { transform: translateX(5px); }
      75% { transform: translateX(-4px); }
    }
    @keyframes starBurst {
      from { opacity: 1; transform: translate(-50%, -50%) scale(0.3); }
      to { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.35); }
    }
    @keyframes confettiFall {
      from { transform: translate(-50%, -120px) rotate(0deg); opacity: 1; }
      to { transform: translate(calc(-50% + var(--spread)), 120vh) rotate(720deg); opacity: 0; }
    }
    @keyframes sway {
      0%, 100% { transform: rotate(-6deg); }
      50% { transform: rotate(6deg); }
    }
    @keyframes wag {
      from { transform: translate(-50%, -50%) translateY(0); }
      to { transform: translate(-50%, -50%) translateY(-2px); }
    }
    @keyframes wagTail {
      from { transform: rotate(-20deg); }
      to { transform: rotate(18deg); }
    }
    @keyframes legA {
      from { transform: rotate(14deg); }
      to { transform: rotate(-14deg); }
    }
    @keyframes legB {
      from { transform: rotate(-14deg); }
      to { transform: rotate(14deg); }
    }
    @keyframes orientationTilt {
      0%, 100% { transform: rotate(0deg) scale(1); }
      35% { transform: rotate(0deg) scale(1); }
      50% { transform: rotate(90deg) scale(0.92); }
      65% { transform: rotate(90deg) scale(0.92); }
    }
    @keyframes dangerFlash {
      0%, 100% { filter: drop-shadow(0 0 0 rgba(255,0,0,0.0)); }
      50% { filter: drop-shadow(0 0 20px rgba(255,0,0,0.85)); }
    }



