    .tutorial-overlay-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.35);
      display: flex;
      align-items: center;
      justify-content: center;
      /* Keep guided overlays beneath system menus while staying above gameplay */
      z-index: 600;
      /* Allow gameplay / UI touches to pass through except where the overlay itself sits */
      pointer-events: none;
    }

    .tutorial-overlay {
      position: absolute;
      max-width: min(95vw, 640px);
      color: white;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 16px;
      text-align: center;
      /* Let gestures pass through bubble except explicit controls */
      pointer-events: none;
      font-family: "Inter", system-ui, sans-serif;
    }
    .tutorial-overlay .controls,
    .tutorial-overlay .controls button,
    .tutorial-overlay [data-role="confirm"],
    .tutorial-overlay [data-role="skip"] {
      pointer-events: auto;
    }

    /* Text-only overlays should not show the center sprite container */
    .tutorial-overlay[data-kind="text"] [data-role="sprite"] {
      display: none !important;
    }

    .anchor-board-center {
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
    .anchor-board-top-center {
      top: 8%;
      left: 50%;
      transform: translateX(-50%);
    }
    .anchor-board-bottom-center {
      bottom: 8%;
      left: 50%;
      transform: translateX(-50%);
    }
    .anchor-board-bottom-left {
      bottom: 8%;
      left: 8%;
    }
    .anchor-board-bottom-right {
      bottom: 8%;
      right: 8%;
    }

    @media (max-width: 768px) {
      /* Nudge overlays downward on mobile so they sit below the top UI chrome */
      .anchor-board-center {
        top: 55%;
        transform: translate(-50%, -50%);
      }
      .anchor-board-top-center {
        top: 14%;
      }
      .anchor-board-bottom-center {
        bottom: 4%;
      }
      .anchor-board-bottom-left {
        bottom: 4%;
      }
      .anchor-board-bottom-right {
        bottom: 4%;
      }
    }

    .bubble {
      background: rgba(17, 24, 39, 0.9);
      border: 1px solid rgba(99, 102, 241, 0.6);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
      border-radius: 12px;
      padding: 16px 20px;
      min-width: 280px;
    }

    .tutorial-overlay [data-role="text"] {
      font-family: "Inter", system-ui, sans-serif;
      font-size: 1rem;
      line-height: 1.6;
      letter-spacing: 0.01em;
      color: rgba(214, 226, 255, 0.94);
    }

    @media (max-width: 768px) {
      .bubble {
        padding: 14px 18px;
        min-width: 320px;
      }
      .tutorial-overlay {
        gap: 20px;
      }
    }

    .sprite {
      width: auto; /* Allow flexible width */
      min-height: 120px; /* minimum height */
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      margin: 8px 0; /* Add margin to prevent overlap */
    }
    .sprite img {
      max-width: 100%;
      max-height: 100%;
      width: auto;
      height: auto;
      object-fit: contain;
      display: block;
    }

    /* Loading spinner for guide images */
    .sprite-loading {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: 3px solid rgba(99, 102, 241, 0.25);
      border-top-color: rgba(129, 140, 248, 0.9);
      animation: sprite-spin 0.8s linear infinite;
      will-change: transform; /* GPU acceleration */
    }
    @keyframes sprite-spin {
      to {
        transform: rotate(360deg);
      }
    }

    .keyboard-hints {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 16px;
      margin: 8px 0;
    }
    .keyboard-hints__action {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
    }
    .keyboard-hints__keys {
      display: flex;
      gap: 8px;
    }
    .keyboard-hints__label {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      color: #cbd5f5;
    }
    .keyboard-hints__empty {
      font-size: 12px;
      color: #94a3b8;
    }
    .keycap {
      min-width: 42px;
      padding: 10px 14px;
      border-radius: 10px;
      border: 1px solid rgba(129, 140, 248, 0.6);
      background: rgba(30, 41, 59, 0.85);
      color: #f8fafc;
      box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      overflow: hidden;
    }
    .keycap__text {
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    .keycap--primary {
      animation: keycapPulse 1.35s ease-in-out infinite;
    }
    .keycap--secondary {
      border-color: rgba(148, 163, 184, 0.45);
      background: rgba(30, 41, 59, 0.6);
      color: rgba(226, 232, 240, 0.75);
      box-shadow: none;
    }
    .keycap--missing {
      border-style: dashed;
      border-color: rgba(148, 163, 184, 0.4);
      color: rgba(148, 163, 184, 0.8);
      background: rgba(15, 23, 42, 0.65);
      font-size: 12px;
      letter-spacing: 0.04em;
    }
    @keyframes keycapPulse {
      0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
      }
      50% {
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 6px 20px rgba(129, 140, 248, 0.42);
      }
      100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
      }
    }

    .tutorial-target-pulse {
      position: relative;
      outline: 3px solid rgba(78, 242, 122, 1);
      outline-offset: 4px;
      box-shadow:
        0 0 0 7px rgba(78, 242, 122, 0.32),
        0 0 24px rgba(78, 242, 122, 0.35);
      border-radius: 10px;
      animation: tutorialTargetPulse 1.2s ease-in-out infinite;
      transition:
        outline-color 120ms ease,
        box-shadow 120ms ease;
    }

    @keyframes tutorialTargetPulse {
      0% {
        box-shadow:
          0 0 0 7px rgba(78, 242, 122, 0.32),
          0 0 0 0 rgba(78, 242, 122, 0.48);
      }
      50% {
        box-shadow:
          0 0 0 7px rgba(78, 242, 122, 0.22),
          0 0 0 12px rgba(78, 242, 122, 0.28);
      }
      100% {
        box-shadow:
          0 0 0 7px rgba(78, 242, 122, 0.32),
          0 0 0 0 rgba(78, 242, 122, 0.48);
      }
    }

    .controls {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .skip-btn {
      padding: 6px 10px;
      background: #374151;
      border: 1px solid #6b7280;
      border-radius: 8px;
      color: #e5e7eb;
      cursor: pointer;
    }
    .skip-btn:hover {
      background: #4b5563;
    }
    .confirm-btn {
      padding: 12px 24px;
      min-width: 100px;
      min-height: 44px;
      background: linear-gradient(135deg, #6366f1, #8b5cf6);
      border: 1px solid #818cf8;
      border-radius: 10px;
      color: #f1f5f9;
      cursor: pointer;
      font-size: 1rem;
      font-weight: 600;
      letter-spacing: 0.5px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
      transition:
        background 160ms ease,
        transform 120ms ease;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }
    .confirm-btn:hover {
      background: linear-gradient(135deg, #818cf8, #a78bfa);
    }
    .confirm-btn:active {
      transform: translateY(1px);
      background: linear-gradient(135deg, #4f46e5, #7c3aed);
    }
    @media (max-width: 768px) {
      .confirm-btn {
        padding: 14px 32px;
        min-width: 120px;
        min-height: 52px;
        font-size: 1.1rem;
      }
    }

    video.tutorial {
      width: 240px;
      border-radius: 8px;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    }
    .bubble.flash-success {
      animation: flashGreen 650ms cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
      position: relative;
    }
    .bubble.flash-success::after {
      content: "";
      position: absolute;
      inset: -4px;
      border-radius: 14px;
      background: radial-gradient(
        circle at 50% 50%,
        rgba(34, 197, 94, 0.65),
        rgba(34, 197, 94, 0) 70%
      );
      opacity: 0;
      animation: flare 650ms ease-out forwards;
      pointer-events: none;
      filter: blur(2px);
    }
    @keyframes flashGreen {
      0% {
        transform: scale(0.92);
        background: rgba(34, 197, 94, 0.15);
        border-color: rgba(34, 197, 94, 0.6);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
      }
      25% {
        transform: scale(1.04);
        background: rgba(34, 197, 94, 0.75);
        border-color: rgba(34, 197, 94, 0.95);
        box-shadow: 0 0 12px 4px rgba(34, 197, 94, 0.45);
      }
      55% {
        transform: scale(1);
        background: rgba(34, 197, 94, 0.35);
        border-color: rgba(34, 197, 94, 0.5);
        box-shadow: 0 0 10px 2px rgba(34, 197, 94, 0.25);
      }
      100% {
        transform: scale(0.88);
        background: rgba(17, 24, 39, 0);
        border-color: rgba(34, 197, 94, 0);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
      }
    }
    @keyframes flare {
      0% {
        opacity: 0;
        transform: scale(0.5);
      }
      30% {
        opacity: 1;
        transform: scale(1);
      }
      70% {
        opacity: 0.4;
      }
      100% {
        opacity: 0;
        transform: scale(1.1);
      }
    }
    /* Overlay wide flash variant */
    .tutorial-overlay.flash-success {
      animation: overlayFlash 650ms cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
    }
    .tutorial-overlay.flash-success::before {
      content: "";
      position: absolute;
      inset: -12px;
      border-radius: 20px;
      background: radial-gradient(
        circle at 50% 50%,
        rgba(34, 197, 94, 0.45),
        rgba(34, 197, 94, 0) 70%
      );
      opacity: 0;
      animation: overlayFlare 650ms ease-out forwards;
      pointer-events: none;
      filter: blur(6px);
    }
    @keyframes overlayFlash {
      0% {
        transform: translate(-50%, -50%) scale(0.94);
      }
      25% {
        transform: translate(-50%, -50%) scale(1.05);
      }
      55% {
        transform: translate(-50%, -50%) scale(1);
      }
      100% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
      }
    }
    @keyframes overlayFlare {
      0% {
        opacity: 0;
        transform: scale(0.6);
      }
      25% {
        opacity: 1;
        transform: scale(1);
      }
      70% {
        opacity: 0.35;
      }
      100% {
        opacity: 0;
        transform: scale(1.15);
      }
    }
