    :root {
      --ink-dark: #292524;
      --sat: env(safe-area-inset-top, 0px);
      --sab: env(safe-area-inset-bottom, 0px);
      --sal: env(safe-area-inset-left, 0px);
      --sar: env(safe-area-inset-right, 0px);
    }

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

    html, body {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      height: 100dvh;
      overflow: hidden;
      font-family: 'Plus Jakarta Sans', sans-serif;
      color: var(--ink-dark);
      background: #93C5FD;
      user-select: none;
    }

    h1, h2, h3, .font-display {
      font-family: 'Fredoka', sans-serif;
    }

    .safe-top {
      padding-top: max(0.375rem, var(--sat));
    }

    .safe-bottom {
      padding-bottom: max(0.5rem, var(--sab));
    }

    /* Fullscreen 3D Canvas Container */
    #canvas-container {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      height: 100dvh;
      z-index: 0;
      touch-action: none;
    }

    #three-canvas {
      display: block;
      width: 100%;
      height: 100%;
      cursor: grab;
    }

    #three-canvas:active {
      cursor: grabbing;
    }

    /* Projected 2D Speech & Floating Label Layer */
    #projected-overlay {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 10;
      overflow: hidden;
    }

    .projected-bubble {
      position: absolute;
      transform: translate(-50%, -100%);
      background: rgba(255, 255, 255, 0.96);
      border: 2px solid #1C1917;
      border-radius: 12px;
      padding: 3px 9px;
      font-size: 11px;
      font-weight: 800;
      color: #1C1917;
      white-space: nowrap;
      box-shadow: 2px 2px 0px #1C1917;
      transition: opacity 0.15s ease;
    }

    .projected-bubble::after {
      content: '';
      position: absolute;
      bottom: -6px;
      left: 50%;
      transform: translateX(-50%);
      border-width: 6px 5px 0;
      border-style: solid;
      border-color: #1C1917 transparent transparent;
    }

    .projected-float {
      position: absolute;
      transform: translate(-50%, -50%);
      font-family: 'Fredoka', sans-serif;
      font-weight: 700;
      font-size: 14px;
      white-space: nowrap;
      text-shadow:
        -1.5px -1.5px 0 #FFFFFF,
         1.5px -1.5px 0 #FFFFFF,
        -1.5px  1.5px 0 #FFFFFF,
         1.5px  1.5px 0 #FFFFFF,
         0px    2px   4px rgba(0,0,0,0.35);
      pointer-events: none;
    }


    /* Custom Tailwind v3 Compatibility Utilities */
    .border-3 {
      border-width: 3px;
    }
    .border-b-3 {
      border-bottom-width: 3px;
    }
    .border-t-3 {
      border-top-width: 3px;
    }
    .backdrop-blur-xs {
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }

    /* Stylized Toy-Box UI Cards */
    .street-card {
      background: rgba(255, 253, 249, 0.96);
      backdrop-filter: blur(8px);
      border: 3px solid #1C1917;
      border-radius: 1.15rem;
      box-shadow: 4px 4px 0px #1C1917;
    }

    .street-card-sm {
      background: #FFFDF9;
      border: 2.5px solid #1C1917;
      border-radius: 0.9rem;
      box-shadow: 3px 3px 0px #1C1917;
    }

    .street-btn {
      border: 2.5px solid #1C1917;
      border-radius: 0.85rem;
      box-shadow: 3px 3px 0px #1C1917;
      transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
      cursor: pointer;
    }

    .street-btn:hover:not(:disabled) {
      transform: translate(-1px, -1px);
      box-shadow: 4px 4px 0px #1C1917;
    }

    .street-btn:active:not(:disabled) {
      transform: translate(2px, 2px);
      box-shadow: 1px 1px 0px #1C1917;
    }

    .street-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      box-shadow: 1px 1px 0px #1C1917;
    }

    /* Mobile & Tablet Side Drawer Transitions */
    #side-drawer-panel {
      transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
      padding-top: max(0.75rem, var(--sat));
      padding-bottom: max(0.75rem, var(--sab));
      padding-left: max(0.75rem, var(--sal));
    }

    #side-drawer-backdrop {
      transition: opacity 0.22s ease;
    }

    /* Mobile Bottom Navigation Bar */
    .mob-nav-item {
      border: 2px solid transparent;
      border-radius: 0.75rem;
      transition: all 0.14s ease;
    }

    .mob-nav-item.active {
      background: #FBBF24;
      color: #1C1917;
      border-color: #1C1917;
      box-shadow: 2px 2px 0px #1C1917;
      transform: translateY(-2px);
    }

    input[type="range"] {
      -webkit-appearance: none;
      appearance: none;
      height: 11px;
      background: #FDE68A;
      border: 2px solid #1C1917;
      border-radius: 999px;
      outline: none;
    }

    input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #D97706;
      border: 2.5px solid #1C1917;
      cursor: pointer;
      box-shadow: 1px 1px 0px #1C1917;
    }

    input[type="range"]::-moz-range-thumb {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: #D97706;
      border: 2.5px solid #1C1917;
      cursor: pointer;
      box-shadow: 1px 1px 0px #1C1917;
    }

    .custom-scroll::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    .custom-scroll::-webkit-scrollbar-thumb {
      background: #D97706;
      border-radius: 999px;
    }
    .no-scrollbar::-webkit-scrollbar {
      display: none;
    }
    .no-scrollbar {
      -ms-overflow-style: none;
      scrollbar-width: none;
    }

    /* UJIAN JURAGAN: MINI-GAME & 3D EVENT MARKERS */
    .projected-event-marker {
      position: absolute;
      transform: translate(-50%, -100%);
      background: #EF4444;
      color: #FFFFFF;
      border: 2.5px solid #1C1917;
      border-radius: 999px;
      padding: 2px 9px;
      font-family: 'Fredoka', sans-serif;
      font-size: 11px;
      font-weight: 700;
      white-space: nowrap;
      box-shadow: 2px 2px 0px #1C1917;
      animation: markerBounce 0.85s infinite alternate ease-in-out;
      pointer-events: none;
    }

    @keyframes markerBounce {
      from { transform: translate(-50%, -100%) scale(0.96); }
      to   { transform: translate(-50%, -118%) scale(1.06); }
    }

    .takaran-track {
      position: relative;
      height: 30px;
      background: #E7E5E4;
      border: 3px solid #1C1917;
      border-radius: 999px;
      overflow: hidden;
      box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
    }

    .takaran-green-zone {
      position: absolute;
      top: 0;
      bottom: 0;
      background: linear-gradient(180deg, #4ADE80 0%, #16A34A 100%);
      border-left: 2.5px solid #1C1917;
      border-right: 2.5px solid #1C1917;
    }

    .takaran-cursor {
      position: absolute;
      top: -2px;
      bottom: -2px;
      width: 10px;
      background: #EF4444;
      border: 2.5px solid #1C1917;
      border-radius: 999px;
      transform: translateX(-50%);
      box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
    }

    @media (max-width: 639px) {
      .street-card {
        border-width: 2.5px;
        border-radius: 1rem;
        box-shadow: 3px 3px 0px #1C1917;
      }
      .street-btn {
        border-width: 2px;
        border-radius: 0.75rem;
        box-shadow: 2px 2px 0px #1C1917;
      }
    }

/* Stage 11: accessibility, interaction feedback and responsive polish */
:focus-visible {
  outline: 3px solid #0F766E;
  outline-offset: 3px;
  border-radius: 6px;
}

button, [role="button"], input, select, textarea {
  touch-action: manipulation;
}

button:not(.street-btn) { transition: filter 0.12s ease, transform 0.12s ease; }
button:hover:not(:disabled) { filter: brightness(1.04); }
button:active:not(:disabled) { transform: translateY(1px); }

#toast-container {
  padding-top: max(0.5rem, var(--sat));
  padding-right: max(0.5rem, var(--sar));
  padding-left: max(0.5rem, var(--sal));
  max-width: min(100vw, 420px);
}

#modal-overlay > * { max-height: calc(100dvh - var(--sat) - var(--sab) - 1.5rem); }
#modal-body, .custom-scroll { overscroll-behavior: contain; }

@media (max-width: 639px) {
  button, [role="button"] { min-height: 42px; }
  #modal-overlay { padding: max(0.5rem, var(--sat)) max(0.5rem, var(--sal)) max(0.5rem, var(--sab)) max(0.5rem, var(--sar)); }
  .projected-bubble { font-size: 10px; padding: 2px 7px; }
  .projected-float { font-size: 12px; }
}

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


/* Stage P1: clearer feedback, gentle motion and first-run guidance */
.p1-toast {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 42px;
  max-width: 100%;
  padding: .65rem .9rem;
  line-height: 1.35;
  box-shadow: 0 5px 16px rgba(28,25,23,.22), 3px 3px 0 #1c1917;
  animation: p1-toast-in .2s cubic-bezier(.2,.8,.2,1) both;
}
.p1-toast-success { border-color: #065f46; }
.p1-toast-warning { border-color: #991b1b; }
.p1-toast-money { border-color: #92400e; }
.p1-toast-info { border-color: #1e40af; }

@keyframes p1-toast-in {
  from { opacity: 0; transform: translateY(-9px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes p1-value-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); filter: brightness(1.18); }
  100% { transform: scale(1); }
}
.p1-value-change { animation: p1-value-pulse .32s ease-out; transform-origin: center; }
.p1-tap-feedback { animation: p1-tap .24s ease-out; }
@keyframes p1-tap {
  0% { transform: scale(1); }
  45% { transform: scale(.97); }
  100% { transform: scale(1); }
}

.p1-onboarding-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(1rem, var(--sat)) max(1rem, var(--sar)) max(1rem, var(--sab)) max(1rem, var(--sal));
  background: rgba(12, 10, 8, .72);
  backdrop-filter: blur(5px);
}
.p1-onboarding-backdrop.is-visible { display: flex; animation: p1-fade-in .18s ease-out; }
.p1-onboarding-card {
  width: min(100%, 470px);
  max-height: min(90dvh, 650px);
  overflow-y: auto;
  padding: clamp(1.1rem, 4vw, 1.65rem);
  color: #1c1917;
  background: #fffbeb;
  border: 3px solid #1c1917;
  border-radius: 1.25rem;
  box-shadow: 7px 7px 0 #1c1917;
}
.p1-onboarding-top { display:flex; align-items:center; justify-content:space-between; gap:1rem; font-size:.7rem; font-weight:900; letter-spacing:.08em; color:#92400e; }
.p1-tutorial-skip { border:0; background:transparent; color:#57534e; text-decoration:underline; font-weight:800; padding:.45rem; }
.p1-tutorial-icon { display:grid; place-items:center; width:68px; height:68px; margin:1.2rem auto .7rem; border:2px solid #1c1917; border-radius:1.2rem; background:#fde68a; font-size:2.3rem; box-shadow:3px 3px 0 #1c1917; }
.p1-onboarding-card h2 { margin:.4rem 0 .7rem; text-align:center; font-family:'Fredoka',sans-serif; font-size:clamp(1.35rem,5vw,1.8rem); font-weight:700; }
.p1-onboarding-card p { color:#44403c; font-size:.92rem; line-height:1.65; text-align:center; }
.p1-tutorial-tip { margin-top:1rem; padding:.8rem; border:1.5px solid #d6a94c; border-radius:.8rem; background:#fef3c7; color:#78350f; font-size:.8rem; font-weight:700; line-height:1.5; }
.p1-tutorial-progress { height:7px; margin:1.25rem 0 1rem; overflow:hidden; border:1px solid #1c1917; border-radius:99px; background:#e7e5e4; }
.p1-tutorial-progress span { display:block; width:25%; height:100%; background:#16a34a; transition:width .2s ease; }
.p1-tutorial-actions { display:flex; gap:.65rem; justify-content:space-between; }
.p1-tutorial-actions button { flex:1; min-height:44px; padding:.65rem .8rem; border:2px solid #1c1917; border-radius:.75rem; background:#e7e5e4; color:#1c1917; font-size:.82rem; font-weight:900; box-shadow:2px 2px 0 #1c1917; }
.p1-tutorial-actions button:last-child { background:#34d399; }
.p1-tutorial-actions button:disabled { opacity:.4; cursor:not-allowed; }

@keyframes p1-fade-in { from { opacity:0; } to { opacity:1; } }
@media (prefers-reduced-motion: reduce) {
  .p1-toast, .p1-value-change, .p1-tap-feedback, .p1-onboarding-backdrop.is-visible { animation:none !important; }
  .p1-tutorial-progress span { transition:none !important; }
}
