* {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }
    html, body {
      width: 100vw;
      height: 100dvh;
      overflow: hidden;
      background: #103320;
      font-family: 'Segoe UI', 'Nunito', 'Inter', system-ui, -apple-system, sans-serif;
      touch-action: none;
    }
    #game-viewport {
      position: fixed;
      inset: 0;
      width: 100vw;
      height: 100dvh;
      overflow: hidden;
      background: #1a4d30;
    }
    #game-canvas {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      display: block;
      z-index: 1;
    }
    /* In-Viewport Top 3D Tactile HUD Bar */
    #hud-bar {
      position: absolute;
      top: max(12px, env(safe-area-inset-top, 12px));
      left: max(14px, env(safe-area-inset-left, 14px));
      right: max(14px, env(safe-area-inset-right, 14px));
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      z-index: 10;
      pointer-events: none;
    }
    .hud-pill {
      pointer-events: auto;
      display: flex;
      align-items: center;
      gap: 10px;
      background: linear-gradient(180deg, rgba(32, 88, 58, 0.94) 0%, rgba(18, 52, 34, 0.96) 100%);
      border: 3px solid #88e868;
      border-bottom-width: 6px;
      border-radius: 999px;
      padding: 7px 18px;
      color: #fff9db;
      font-weight: 800;
      font-size: clamp(13px, 2.1vw, 19px);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
      text-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
    }
    .hud-right-group {
      pointer-events: auto;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .egg-badge {
      background: linear-gradient(180deg, #ffe259 0%, #f59f18 100%);
      border: 3px solid #fff6c2;
      border-bottom: 6px solid #b36606;
      border-radius: 999px;
      padding: 6px 16px;
      color: #382405;
      font-weight: 900;
      font-size: clamp(14px, 2.1vw, 19px);
      display: flex;
      align-items: center;
      gap: 7px;
      box-shadow: 0 6px 14px rgba(0,0,0,0.28);
    }
    .egg-badge img {
      width: 26px;
      height: 26px;
      object-fit: contain;
      filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
    }
    .toy-btn-sm {
      pointer-events: auto;
      min-width: 56px;
      min-height: 50px;
      padding: 8px 14px;
      border-radius: 18px;
      border: 3px solid rgba(255,255,255,0.9);
      font-weight: 900;
      font-size: clamp(13px, 1.9vw, 17px);
      color: #ffffff;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: transform 0.08s ease, box-shadow 0.08s ease;
      text-shadow: 0 2px 2px rgba(0,0,0,0.35);
    }
    .toy-btn-sm:active {
      transform: translateY(5px);
    }
    #btn-mute {
      background: linear-gradient(180deg, #4cd97b 0%, #249c52 100%);
      box-shadow: 0 6px 0 #146332, 0 8px 14px rgba(0,0,0,0.28);
    }
    #btn-pause {
      background: linear-gradient(180deg, #ff9f43 0%, #e66712 100%);
      box-shadow: 0 6px 0 #9c3f05, 0 8px 14px rgba(0,0,0,0.28);
    }
    #zone-dots {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .z-dot {
      width: 13px;
      height: 13px;
      border-radius: 50%;
      background: rgba(255,255,255,0.28);
      border: 2px solid #ffffff;
      transition: all 0.25s ease;
    }
    .z-dot.done {
      background: #4cd97b;
      transform: scale(1.12);
    }
    .z-dot.active {
      background: #ffde59;
      transform: scale(1.28);
      box-shadow: 0 0 10px #ffde59;
    }
    /* In-Viewport 3D Tactile Touch Controls (Bottom Safe Zone) */
    #touch-controls {
      position: absolute;
      bottom: max(16px, env(safe-area-inset-bottom, 16px));
      left: max(18px, env(safe-area-inset-left, 18px));
      right: max(18px, env(safe-area-inset-right, 18px));
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      z-index: 10;
      pointer-events: none;
    }
    .dpad-group {
      display: flex;
      gap: 14px;
      pointer-events: auto;
    }
    .ctrl-btn {
      pointer-events: auto;
      min-width: clamp(86px, 16vw, 128px);
      min-height: clamp(66px, 10.5vh, 86px);
      border-radius: 26px;
      border: 3px solid rgba(255, 255, 255, 0.92);
      font-weight: 900;
      font-size: clamp(16px, 2.4vw, 21px);
      color: #ffffff;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      text-shadow: 0 2px 3px rgba(0, 0, 0, 0.4);
      transition: transform 0.07s ease;
    }
    .ctrl-btn.dir-btn {
      background: linear-gradient(180deg, #42b4ff 0%, #1b78d4 100%);
      box-shadow: 0 8px 0 #0e4a8a, 0 10px 18px rgba(0,0,0,0.32);
    }
    .ctrl-btn.jump-btn {
      min-width: clamp(118px, 22vw, 168px);
      background: linear-gradient(180deg, #ff9933 0%, #e85d04 100%);
      box-shadow: 0 8px 0 #993800, 0 10px 18px rgba(0,0,0,0.32);
    }
    .ctrl-btn.pressed, .ctrl-btn:active {
      transform: translateY(6px);
    }
    #hint-banner {
      position: absolute;
      top: clamp(72px, 11.5vh, 94px);
      left: 50%;
      transform: translateX(-50%);
      background: rgba(20, 62, 40, 0.92);
      border: 2px solid #ffe066;
      color: #fff9db;
      padding: 7px 20px;
      border-radius: 999px;
      font-weight: 800;
      font-size: clamp(13px, 1.9vw, 17px);
      z-index: 9;
      pointer-events: none;
      text-align: center;
      white-space: nowrap;
      box-shadow: 0 4px 12px rgba(0,0,0,0.28);
      transition: opacity 0.3s ease;
    }
    /* Full In-Viewport Overlays */
    .viewport-overlay {
      position: absolute;
      inset: 0;
      z-index: 25;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
      background: radial-gradient(circle at center, rgba(16, 52, 34, 0.72) 0%, rgba(8, 28, 18, 0.88) 100%);
      backdrop-filter: blur(5px);
    }
    .viewport-overlay.hidden {
      display: none !important;
    }
    .modal-card {
      width: min(94vw, 780px);
      max-height: 92dvh;
      overflow-y: auto;
      background: linear-gradient(180deg, #f4fceb 0%, #dcf4d0 100%);
      border: 5px solid #58c45c;
      border-bottom-width: 10px;
      border-radius: 32px;
      padding: clamp(16px, 3vw, 28px);
      text-align: center;
      color: #18442c;
      box-shadow: 0 20px 45px rgba(0,0,0,0.48);
      animation: popIn 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    @keyframes popIn {
      0% { transform: scale(0.76); opacity: 0; }
      100% { transform: scale(1); opacity: 1; }
    }
    .modal-title {
      font-size: clamp(22px, 3.6vw, 34px);
      font-weight: 900;
      color: #154d30;
      margin-bottom: 6px;
    }
    .modal-subtitle {
      font-size: clamp(14px, 2vw, 18px);
      font-weight: 700;
      color: #36694d;
      margin-bottom: 14px;
    }
    .hero-showcase {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: clamp(14px, 3vw, 28px);
      margin: 10px 0 16px;
      padding: 16px;
      background: radial-gradient(circle at 50% 35%, #d4f7ff 0%, #9ce0b2 100%);
      border-radius: 24px;
      border: 3px solid #7ed484;
      box-shadow: inset 0 3px 10px rgba(0,0,0,0.08);
    }
    .hero-showcase img {
      width: clamp(84px, 15vw, 128px);
      height: clamp(84px, 15vw, 128px);
      object-fit: contain;
      filter: drop-shadow(0 10px 14px rgba(0,0,0,0.28));
      animation: floatToy 2.4s ease-in-out infinite;
    }
    .hero-showcase img:nth-child(2) {
      animation-delay: -0.8s;
    }
    .hero-showcase img:nth-child(3) {
      animation-delay: -1.6s;
    }
    @keyframes floatToy {
      0%, 100% { transform: translateY(0px) rotate(-2deg) scale(1); }
      50% { transform: translateY(-9px) rotate(3deg) scale(1.05); }
    }
    .cta-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      min-width: 230px;
      min-height: 62px;
      padding: 14px 32px;
      border-radius: 999px;
      border: 4px solid #ffffff;
      background: linear-gradient(180deg, #52d669 0%, #249e3e 100%);
      box-shadow: 0 8px 0 #146126, 0 12px 24px rgba(0,0,0,0.3);
      color: #ffffff;
      font-weight: 900;
      font-size: clamp(18px, 2.8vw, 24px);
      cursor: pointer;
      text-shadow: 0 2px 3px rgba(0,0,0,0.35);
      transition: transform 0.08s ease;
      margin: 6px;
    }
    .cta-btn:active {
      transform: translateY(6px);
    }
    .cta-btn.secondary {
      background: linear-gradient(180deg, #42b4ff 0%, #1b78d4 100%);
      box-shadow: 0 8px 0 #0e4a8a, 0 12px 24px rgba(0,0,0,0.3);
      min-width: 180px;
      min-height: 54px;
      font-size: clamp(15px, 2.1vw, 19px);
    }
    /* Portal Mission Interactive Stage */
    #mission-stage {
      background: linear-gradient(180deg, #ffffff 0%, #edf9e7 100%);
      border: 3px solid #9ed894;
      border-radius: 24px;
      padding: clamp(14px, 2.5vw, 22px);
      margin-bottom: 12px;
    }
    .mission-prompt {
      font-size: clamp(16px, 2.4vw, 22px);
      font-weight: 900;
      color: #194f32;
      margin-bottom: 14px;
    }
    #mission-visual-showcase {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-wrap: wrap;
      gap: 12px;
      margin-bottom: 14px;
    }
    .showcase-item-card {
      width: 84px;
      height: 84px;
      border-radius: 20px;
      background: radial-gradient(circle at 50% 35%, #ffffff 0%, #d8f4e2 100%);
      border: 3px solid #7bc98a;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 6px 12px rgba(0,0,0,0.12);
    }
    .showcase-item-card img {
      width: 66px;
      height: 66px;
      object-fit: contain;
      filter: drop-shadow(0 6px 8px rgba(0,0,0,0.22));
      animation: floatToy 2.2s ease-in-out infinite;
    }
    .mission-options {
      display: flex;
      align-items: stretch;
      justify-content: center;
      gap: clamp(12px, 2.5vw, 22px);
      flex-wrap: wrap;
    }
    .mission-choice-btn {
      width: clamp(128px, 25vw, 185px);
      min-height: clamp(148px, 22vh, 188px);
      padding: 12px;
      border-radius: 24px;
      border: 4px solid #68c66b;
      border-bottom-width: 8px;
      background: radial-gradient(circle at 50% 35%, #ffffff 0%, #e7f8e2 100%);
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
      font-weight: 900;
      font-size: clamp(14px, 2vw, 18px);
      color: #194b31;
      box-shadow: 0 8px 18px rgba(0,0,0,0.14);
      transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
    }
    .mission-choice-btn:hover {
      transform: translateY(-4px) scale(1.04);
      border-color: #2da843;
    }
    .mission-choice-btn:active {
      transform: translateY(4px);
    }
    .mission-choice-btn img {
      width: clamp(80px, 13vw, 108px);
      height: clamp(80px, 13vw, 108px);
      object-fit: contain;
      filter: drop-shadow(0 8px 10px rgba(0,0,0,0.24));
      animation: floatToy 2.5s ease-in-out infinite;
    }
    .mission-choice-btn.correct-pop {
      background: #cefad0;
      border-color: #1f9d35;
      transform: scale(1.12);
    }
    .mission-choice-btn.gentle-shake {
      background: #fff2d6;
      border-color: #f5931c;
      animation: shakeSoft 0.32s ease;
    }
    @keyframes shakeSoft {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-8px); }
      75% { transform: translateX(8px); }
    }
    #mission-feedback {
      min-height: 28px;
      font-size: clamp(15px, 2.2vw, 20px);
      font-weight: 900;
      color: #1e7e38;
      margin-top: 6px;
    }
    .zone-grid {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px;
      margin: 14px 0;
    }
    .zone-jump-btn {
      padding: 10px 16px;
      border-radius: 16px;
      border: 3px solid #68c86c;
      background: #ffffff;
      color: #1b5234;
      font-weight: 800;
      font-size: 15px;
      cursor: pointer;
    }
    .zone-jump-btn.active {
      background: #ffde59;
      border-color: #d48806;
    }
    @media (max-width: 640px) {
      #hud-bar {
        gap: 6px;
      }
      .hud-pill {
        padding: 5px 12px;
      }
      #hint-banner {
        white-space: normal;
        width: 92vw;
      }
      .mission-choice-btn {
        width: clamp(104px, 28vw, 142px);
        min-height: 138px;
        padding: 8px;
      }
    }
