  /* ============ Design Tokens (Candy / Clay 3D) ============ */
  :root {
    --bg-primary: #f0fdf4;
    --primary-color: #22c55e;
    --primary-dark: #15803d;
    --accent-color: #f59e0b;
    --accent-pink: #ec4899;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --radius-card: 30px;
    --radius-pill: 60px;

    --glass-bg: rgba(255, 255, 255, 0.30);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-shadow: 0 16px 36px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.75);

    --clay-shadow: 0 10px 0 rgba(0, 0, 0, 0.14), 0 18px 30px rgba(0, 0, 0, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.6);
    --ring-circumference: 251.2;

    --cat-object: #f59e0b;
    --cat-animal: #22c55e;
    --cat-person: #3b82f6;
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  body {
    font-family: 'Noto Sans Lao', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 20% 10%, #dcfce7 0%, #f0fdf4 45%, #e0f2fe 100%);
    color: var(--text-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
  }

  .svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
  .hidden { display: none !important; }

  /* ============ Layer 0: กล้องเต็มจอ ============ */
  #webcam {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 0;
    pointer-events: none;
  }

  /* ============ Layer 1: Debug HUD ============ */
  .app-version {
    position: fixed;
    bottom: 6px;
    right: 10px;
    z-index: 9997;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
  }

  .debug-hud {
    position: fixed;
    top: 8px; left: 8px;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.78);
    color: #4ade80;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 10px;
    pointer-events: none;
    max-width: 92vw;
    word-break: break-all;
  }

  /* ============ Layer 2: UI ============ */
  .game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 14px;
    z-index: 10;
    pointer-events: none;
  }

  .interactive-card, button { pointer-events: auto; }

  /* ---------- Header ---------- */
  .header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    z-index: 20;
    margin-bottom: 8px;
  }

  .header-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .header-icon { width: 20px; height: 20px; }

  .category-tag { color: var(--cat-animal); }
  .category-tag[data-code="OBJECT"] { color: var(--cat-object); }
  .category-tag[data-code="ANIMAL"] { color: var(--cat-animal); }
  .category-tag[data-code="PERSON"] { color: var(--cat-person); }
  .score-tag { color: var(--accent-color); }
  .progress-tag { color: var(--text-muted); font-size: 0.95rem; }

  .progress-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }

  .progress-track {
    width: 100%;
    height: 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.18);
    overflow: hidden;
  }

  .progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, #86efac, #22c55e);
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .header-action-btn {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffffff, #f1f5f9);
    color: #ef4444;
    cursor: pointer;
    box-shadow: 0 5px 0 #cbd5e1, 0 10px 18px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
  }

  .header-action-btn:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #cbd5e1, 0 4px 10px rgba(0, 0, 0, 0.2);
  }

  .btn-svg { width: 22px; height: 22px; display: block; }

  /* ---------- Status & Hint ---------- */
  .status-banner {
    position: absolute;
    top: 74px; left: 50%;
    transform: translateX(-50%);
    background: rgba(31, 41, 55, 0.92);
    color: #fff;
    padding: 10px 26px;
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-weight: 600;
    z-index: 50;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
  }

  .hand-hint {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(31, 41, 55, 0.92);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
    padding: 13px 28px;
    border-radius: var(--radius-pill);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    z-index: 60;
    pointer-events: none;
    animation: hint-pulse 1.6s infinite ease-in-out;
  }

  .hint-svg { width: 26px; height: 26px; color: #fde68a; }

  @keyframes hint-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
  }

  /* ---------- Screens ---------- */
  .screen-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    pointer-events: none;
  }

  .screen-view.entering { animation: screen-in 0.4s cubic-bezier(0.22, 1, 0.36, 1); }

  @keyframes screen-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: none; }
  }

  /* ---------- Typography on camera ---------- */
  .main-title {
    font-size: 2.6rem;
    font-weight: 800;
    color: #14532d;
    text-align: center;
    margin-bottom: 6px;
    text-shadow: 0 2px 0 #fff, 0 5px 12px rgba(0, 0, 0, 0.25);
  }

  .sub-title {
    font-size: 1.15rem;
    color: #14532d;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .section-title {
    font-size: 2rem;
    font-weight: 800;
    color: #14532d;
    margin-bottom: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.88);
    padding: 8px 30px;
    border-radius: 26px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.9);
  }

  /* ============ Welcome: 3D Title Screen ============ */
  .welcome-stage {
    position: relative;
    perspective: 1000px;
    perspective-origin: 50% 35%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .welcome-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 46px 34px;
    border-radius: 44px;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(240, 253, 244, 0.86));
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 34px 70px rgba(0, 0, 0, 0.30), inset 0 3px 0 rgba(255, 255, 255, 0.95);
    transform-style: preserve-3d;
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    max-width: 92vw;
  }

  /* หน้าแรกเลื่อนได้เมื่อการ์ดสูงเกินจอ (5 โหมด) — จัดกลางเมื่อที่ว่างพอ */
  #screen-welcome {
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    padding: 10px 8px 18px;
  }

  #screen-welcome .welcome-stage { margin: auto; }

  .welcome-glow {
    position: absolute;
    inset: -30% -20%;
    background: radial-gradient(circle at 50% 40%, rgba(134, 239, 172, 0.55), rgba(134, 239, 172, 0) 62%);
    filter: blur(6px);
    z-index: -1;
    animation: glow-breathe 4s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes glow-breathe {
    0%, 100% { opacity: 0.75; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.06); }
  }

  .mascot {
    width: 152px;
    height: auto;
    margin-bottom: 6px;
    transform: translateZ(52px);
    animation: mascot-float 3.4s ease-in-out infinite;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.22));
  }

  @keyframes mascot-float {
    0%, 100% { transform: translateZ(52px) translateY(0); }
    50% { transform: translateZ(52px) translateY(-9px); }
  }

  .mascot-arm {
    transform-origin: 90px 84px;
    animation: arm-wave 1.9s ease-in-out infinite;
  }

  @keyframes arm-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-16deg); }
    60% { transform: rotate(14deg); }
  }

  .mascot-eyes {
    transform-origin: 60px 45px;
    animation: blink 4.2s infinite;
  }

  @keyframes blink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.12); }
  }

  .welcome-card .main-title { transform: translateZ(34px); }
  .welcome-card .sub-title { transform: translateZ(26px); }

  .camera-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #166534;
    margin: 14px 0 22px;
    transform: translateZ(20px);
  }

  .note-svg { width: 22px; height: 22px; color: #16a34a; }

  /* ปุ่ม 3D Candy */
  .btn-primary {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 18px 52px;
    cursor: pointer;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
  }

  .btn-3d {
    background: linear-gradient(180deg, #6ee7a5 0%, #22c55e 55%, #16a34a 100%);
    box-shadow: 0 9px 0 var(--primary-dark), 0 18px 30px rgba(0, 0, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.6);
    transform: translateZ(40px) translateY(0);
    transition: transform 0.09s ease, box-shadow 0.09s ease;
  }

  .btn-3d::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.55) 46%, transparent 60%);
    transform: translateX(-130%);
    animation: shine 3.6s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes shine {
    0%, 55% { transform: translateX(-130%); }
    85%, 100% { transform: translateX(130%); }
  }

  .btn-3d:active {
    transform: translateZ(40px) translateY(8px);
    box-shadow: 0 1px 0 var(--primary-dark), 0 6px 14px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .btn-3d .btn-svg { width: 26px; height: 26px; color: #fff; }

  .btn-secondary {
    background: linear-gradient(180deg, #ffffff, #e2e8f0);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 800;
    border: none;
    border-radius: var(--radius-pill);
    padding: 15px 36px;
    cursor: pointer;
    box-shadow: 0 6px 0 #cbd5e1, 0 12px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.09s ease, box-shadow 0.09s ease;
  }

  .btn-secondary:active {
    transform: translateY(5px);
    box-shadow: 0 1px 0 #cbd5e1, 0 4px 10px rgba(0, 0, 0, 0.2);
  }

  /* ============ GameMode Selector (ເລືອກໂໝດເກມ) ============ */
  .mode-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    transform: translateZ(36px);
  }

  .mode-btn {
    flex-direction: column;
    gap: 2px;
    min-width: 186px;
    padding: 14px 26px 16px;
    font-size: 1.32rem;
    line-height: 1.15;
  }

  .mode-btn .btn-svg {
    width: 36px;
    height: 36px;
    margin-bottom: 2px;
  }

  .mode-btn-label { display: block; }

  .mode-btn-sub {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.95;
    text-shadow: none;
  }

  .mode-slice {
    background: linear-gradient(180deg, #fda4af 0%, #f43f5e 55%, #be123c 100%);
    box-shadow: 0 9px 0 #9f1239, 0 18px 30px rgba(0, 0, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-slice:active {
    box-shadow: 0 1px 0 #9f1239, 0 6px 14px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-wheel {
    background: linear-gradient(180deg, #c084fc 0%, #a855f7 55%, #7e22ce 100%);
    box-shadow: 0 9px 0 #6b21a8, 0 18px 30px rgba(0, 0, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-wheel:active {
    box-shadow: 0 1px 0 #6b21a8, 0 6px 14px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-bird {
    background: linear-gradient(180deg, #7dd3fc 0%, #0ea5e9 55%, #0369a1 100%);
    box-shadow: 0 9px 0 #075985, 0 18px 30px rgba(0, 0, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-bird:active {
    box-shadow: 0 1px 0 #075985, 0 6px 14px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-color {
    background: linear-gradient(180deg, #fda4af 0%, #fb7185 34%, #a855f7 78%, #7e22ce 100%);
    box-shadow: 0 9px 0 #7e22ce, 0 18px 30px rgba(0, 0, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-color:active {
    box-shadow: 0 1px 0 #7e22ce, 0 6px 14px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-draw {
    background: linear-gradient(180deg, #bbf7d0 0%, #34d399 55%, #059669 100%);
    box-shadow: 0 9px 0 #065f46, 0 18px 30px rgba(0, 0, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  .mode-draw:active {
    box-shadow: 0 1px 0 #065f46, 0 6px 14px rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.6);
  }

  /* Sparkles */
  .sparkles { position: absolute; inset: -12% -6%; pointer-events: none; z-index: -1; }

  .sparkles span {
    position: absolute;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, rgba(253, 230, 138, 0.85) 60%, rgba(253, 230, 138, 0) 100%);
    animation: sparkle-rise linear infinite;
    opacity: 0;
  }

  @keyframes sparkle-rise {
    0% { transform: translateY(20px) scale(0.4); opacity: 0; }
    25% { opacity: 0.9; }
    100% { transform: translateY(-120px) scale(1.1); opacity: 0; }
  }

  /* ============ Cards (Glass) ============ */
  .category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 22px;
    width: 100%;
    max-width: 900px;
    padding: 8px;
  }

  .interactive-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: var(--radius-card);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.25s ease, box-shadow 0.25s ease;
  }

  .interactive-card.hovering {
    transform: scale(1.06) translateY(-6px);
    border-color: #22c55e;
    box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.35), 0 24px 46px rgba(0, 0, 0, 0.3);
  }

  .interactive-card.selecting {
    transform: scale(0.97);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0.35), var(--glass-shadow);
  }

  /* Category cards — สีตามหมวด */
  .interactive-card[data-code="OBJECT"] { --accent: var(--cat-object); }
  .interactive-card[data-code="ANIMAL"] { --accent: var(--cat-animal); }
  .interactive-card[data-code="PERSON"] { --accent: var(--cat-person); }

  .category-icon {
    width: 62px;
    height: 62px;
    color: var(--accent, var(--primary-color));
    margin-bottom: 8px;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22));
    transition: transform 0.25s ease;
  }

  .interactive-card:hover .category-icon { transform: scale(1.12) rotate(-4deg); }

  .category-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
    background: var(--accent, var(--primary-color));
    padding: 4px 18px;
    border-radius: var(--radius-pill);
  }

  /* ============ Gameplay ============ */
  .question-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 26px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24), inset 0 2px 0 rgba(255, 255, 255, 0.9);
    max-width: 94vw;
  }

  .question-text {
    font-size: 2rem;
    font-weight: 800;
    color: #14532d;
    text-align: center;
  }

  .btn-sound-replay {
    flex: 0 0 auto;
    width: 52px; height: 52px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #e0f2fe, #bae6fd);
    color: #0284c7;
    cursor: pointer;
    box-shadow: 0 5px 0 #7dd3fc, 0 10px 16px rgba(0, 0, 0, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
  }

  .btn-sound-replay:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #7dd3fc, 0 4px 10px rgba(0, 0, 0, 0.18);
  }

  .choices-grid {
    display: grid;
    gap: 18px;
    width: 100%;
    height: 50vh;
    max-width: 1080px;
  }

  .choices-3 { grid-template-columns: repeat(3, 1fr); }
  .choices-4 { grid-template-columns: repeat(4, 1fr); }

  .choice-card {
    height: 100%;
    padding: 10px;
    animation: card-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  }

  .choice-card:nth-child(1) { animation-delay: 0s; }
  .choice-card:nth-child(2) { animation-delay: 0.07s; }
  .choice-card:nth-child(3) { animation-delay: 0.14s; }
  .choice-card:nth-child(4) { animation-delay: 0.21s; }

  @keyframes card-in {
    from { opacity: 0; transform: scale(0.82) translateY(22px); }
    to { opacity: 1; transform: none; }
  }

  /* แสงนวลหลังรูป → รูปอ่านชัดแม้การ์ดโปร่งใส */
  .choice-card::before {
    content: '';
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.55) 46%, rgba(255, 255, 255, 0) 74%);
    pointer-events: none;
  }

  .choice-card img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: calc(var(--radius-card) - 10px);
    pointer-events: none;
    animation: img-float 3.6s ease-in-out infinite;
  }

  .choice-card:nth-child(2) img { animation-delay: 0.5s; }
  .choice-card:nth-child(3) img { animation-delay: 1s; }
  .choice-card:nth-child(4) img { animation-delay: 1.5s; }

  @keyframes img-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
  }

  /* Feedback ตอบถูก/ผิด */
  .choice-card.correct-answer {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.45), var(--glass-shadow);
  }

  .choice-card.correct-answer img { animation: img-bounce 0.6s ease 2; }

  @keyframes img-bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-14px) scale(1.06); }
  }

  .choice-card.wrong-answer {
    border-color: #fbbf24 !important;
    animation: shake-gentle 0.4s ease-in-out;
  }

  @keyframes shake-gentle {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
  }

  .choice-card.correct-answer::after,
  .choice-card.wrong-answer::after {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    background: rgba(255, 255, 255, 0.5);
    animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 2;
  }

  .choice-card.correct-answer::after { content: '✅'; }
  .choice-card.wrong-answer::after { content: '❌'; }

  @keyframes pop-in {
    from { transform: scale(0.2); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }

  /* ============ Loading states ============ */
  .loading-spinner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.65);
    border-top-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    animation: spinner-spin 0.9s linear infinite;
  }

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

  .category-status,
  .training-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 26px 40px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2), inset 0 2px 0 #fff;
    font-size: 1.2rem;
    font-weight: 700;
    color: #14532d;
  }

  .category-status { grid-column: 1 / -1; }

  .category-retry {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    max-width: 320px;
  }

  .category-retry .category-icon { color: var(--accent-color); }
  .category-retry .category-name { background: var(--accent-color); }

  /* ============ Training ============ */
  .training-target-container { display: flex; align-items: center; justify-content: center; gap: 46px; }

  .training-bubble {
    width: 260px; height: 260px;
    border-radius: 50%;
    border: 7px dashed #22c55e;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0.22), 0 22px 46px rgba(0, 0, 0, 0.28);
    animation: glow-pulse 2s infinite ease-in-out;
  }

  .bubble-icon { font-size: 2.4rem; margin-bottom: 6px; }

  .training-bubble.success {
    border-style: solid;
    border-color: #22c55e;
    animation: success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .training-bubble.success::after {
    content: '✅';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes success-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
  }

  @keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0.22), 0 22px 46px rgba(0, 0, 0, 0.28); }
    50% { box-shadow: 0 0 0 24px rgba(34, 197, 94, 0.34), 0 22px 46px rgba(0, 0, 0, 0.28); }
  }

  .training-hint {
    font-size: 1.15rem;
    font-weight: 600;
    color: #14532d;
    margin-top: 22px;
    background: rgba(255, 255, 255, 0.9);
    padding: 9px 24px;
    border-radius: 24px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    text-align: center;
  }

  /* ============ Summary ============ */
  .summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 26px 42px 30px;
    border-radius: 40px;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(240, 253, 244, 0.9));
    box-shadow: 0 30px 64px rgba(0, 0, 0, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.95);
    max-width: 92vw;
  }

  .trophy {
    width: 96px; height: 96px;
    margin-bottom: 6px;
    animation: trophy-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.25));
  }

  @keyframes trophy-pop {
    0% { transform: scale(0.3) rotate(-18deg); opacity: 0; }
    70% { transform: scale(1.12) rotate(4deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); }
  }

  .score-board { display: flex; gap: 28px; margin: 16px 0 22px; }

  .score-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }

  .stat-label { font-size: 1rem; color: var(--text-muted); font-weight: 600; }
  .stat-value { font-size: 2.4rem; font-weight: 800; color: #14532d; }
  .stat-value.correct { color: var(--primary-color); }
  .stat-value.retry { color: var(--accent-color); }

  .summary-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

  /* ============ Number Game (ເກມນັບເລກ) ============ */
  #screen-number {
    max-width: none;
    justify-content: flex-start;
  }

  .number-hud {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto 10px;
    pointer-events: none;
  }

  .number-hud .header-action-btn,
  .number-hud .btn-sound-replay { pointer-events: auto; }

  .number-hud .btn-sound-replay {
    width: 46px;
    height: 46px;
  }

  .number-star-tag { color: var(--accent-color); }
  .number-star-total { color: var(--text-muted); font-size: 0.85em; }

  .number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    pointer-events: none;
  }

  .number-card {
    aspect-ratio: 1 / 1;
    min-height: 108px;
    padding: 8px;
    border-radius: 24px;
  }

  .number-card::before {
    content: '';
    position: absolute;
    inset: 5%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.55) 46%, rgba(255, 255, 255, 0) 74%);
    pointer-events: none;
  }

  .number-card img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
  }

  /* เงาดำ — ยังเห็นทรงเลข (ต้องเป็น PNG พื้นหลังโปร่งใส) */
  .number-card.upcoming img {
    filter: brightness(0);
    opacity: 0.92;
  }

  /* ค่าเริ่มต้น: ใบที่ยังไม่ถึงคิวกดไม่ได้ (เด็กพุ่งไปที่ใบที่โฟกัสตรงๆ) */
  .number-card.upcoming { pointer-events: none; }
  body.number-allow-wrong .number-card.upcoming { pointer-events: auto; }

  .number-card.focused {
    transform: scale(1.07);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.42), 0 22px 40px rgba(0, 0, 0, 0.3);
  }

  .number-card.focused img { animation: number-pulse 1.1s ease-in-out infinite; }

  @keyframes number-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
  }

  .number-card.collected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.28), var(--glass-shadow);
  }

  .number-star-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 30px;
    height: 30px;
    z-index: 2;
    animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .number-star-badge svg { width: 100%; height: 100%; display: block; }

  .number-card.wrong-pick {
    border-color: #fbbf24 !important;
    animation: number-wrong-shake 0.45s ease-in-out;
  }

  @keyframes number-wrong-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-9px); }
    75% { transform: translateX(9px); }
  }

  .number-banner {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }

  .number-banner span {
    font-size: 2.3rem;
    font-weight: 800;
    color: #14532d;
    background: rgba(255, 255, 255, 0.95);
    padding: 18px 46px;
    border-radius: 40px;
    box-shadow: 0 26px 56px rgba(0, 0, 0, 0.32), inset 0 3px 0 #fff;
    animation: announce-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* ============ Color Game (ເກມຈັບຄູ່ສີ) ============ */
  #screen-color {
    max-width: none;
    justify-content: flex-start;
  }

  .color-hud {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto 12px;
    pointer-events: none;
  }

  .color-hud .header-action-btn { pointer-events: auto; }
  .color-hud .btn-sound-replay { pointer-events: auto; width: 46px; height: 46px; }
  .color-star-pill { color: var(--accent-color); }
  .color-level-pill { color: #7e22ce; }

  .color-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
  }

  .color-target-wrap,
  .color-board-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  .color-target-label,
  .color-board-label {
    font-size: 1rem;
    font-weight: 800;
    color: #14532d;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 22px;
    border-radius: var(--radius-pill);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  }

  .color-target {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--glass-shadow);
    min-height: 74px;
  }

  .color-target .color-dot {
    width: 48px;
    height: 48px;
    border-width: 4px;
    cursor: default;
  }

  .color-connector {
    width: 22px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    flex: 0 0 auto;
  }

  .color-board {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--glass-shadow);
    width: 100%;
  }

  .color-dot {
    position: relative;
    z-index: 2;
    width: 96px;
    height: 96px;
    padding: 0;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.92);
    background-color: var(--dot, #cbd5e1);
    background-image: radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 62%);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28), inset 0 -6px 12px rgba(0, 0, 0, 0.16);
    cursor: pointer;
  }

  .color-dot.matched {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.5), 0 12px 22px rgba(0, 0, 0, 0.28);
    animation: color-dot-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes color-dot-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.14); }
    100% { transform: scale(1); }
  }

  .color-dot.wrong-pick {
    border-color: #fbbf24 !important;
    animation: number-wrong-shake 0.45s ease-in-out;
  }

  .color-dot.hint {
    animation: color-dot-hint 0.9s ease-in-out infinite;
  }

  @keyframes color-dot-hint {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.7), 0 12px 22px rgba(0, 0, 0, 0.28); }
    50% { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0.25), 0 12px 22px rgba(0, 0, 0, 0.28); }
  }

  .color-target .color-dot.done {
    box-shadow: 0 0 0 4px #22c55e, inset 0 -4px 8px rgba(0, 0, 0, 0.16);
  }

  .color-target .color-dot.hint {
    animation: color-dot-hint 0.9s ease-in-out infinite;
  }

  .color-trail-line {
    fill: none;
    stroke: #ffffff;
    stroke-width: 9;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.92;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
    animation: color-trail-draw 0.3s ease-out;
  }

  @keyframes color-trail-draw {
    from { opacity: 0; }
    to { opacity: 0.92; }
  }

  .color-trail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 1;
  }

  .color-banner {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }

  .color-banner span {
    font-size: 2.3rem;
    font-weight: 800;
    color: #4c1d95;
    background: rgba(255, 255, 255, 0.95);
    padding: 18px 46px;
    border-radius: 40px;
    box-shadow: 0 26px 56px rgba(0, 0, 0, 0.32), inset 0 3px 0 #fff;
    animation: announce-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .color-hint {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(126, 34, 206, 0.92);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 12px 26px;
    border-radius: var(--radius-pill);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    pointer-events: none;
  }

  .color-hint .hint-svg { width: 24px; height: 24px; color: #e9d5ff; }

  .color-result-board { flex-wrap: wrap; max-width: 540px; }

  /* ============ Draw Game (ເກມວາດຕາມເສັ້ນ) ============ */
  .draw-hud {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto 10px;
    pointer-events: none;
  }

  .draw-hud .header-action-btn { pointer-events: auto; }
  .draw-star-pill { color: #f59e0b; }
  .draw-name-pill { color: #065f46; }

  .draw-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(88vw, 70vh);
    height: min(88vw, 70vh);
    max-width: 720px;
    max-height: 720px;
    margin: 0 auto;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: var(--glass-shadow);
    --fig: #34d399;
    touch-action: none;
  }

  .draw-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
  }

  .draw-guide {
    fill: none;
    stroke: rgba(255, 255, 255, 0.72);
    stroke-width: 22;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 2 34;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.28));
  }

  .draw-ink {
    fill: none;
    stroke: var(--fig, #34d399);
    stroke-width: 22;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
    transition: fill-opacity 0.3s ease;
  }

  .draw-ink.complete {
    fill: var(--fig, #34d399);
    fill-opacity: 0.82;
    animation: draw-ink-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes draw-ink-pop {
    0% { fill-opacity: 0; }
    100% { fill-opacity: 0.82; }
  }

  .draw-guide-dot {
    fill: rgba(255, 255, 255, 0.9);
    animation: draw-dot-pulse 1.1s ease-in-out infinite;
  }

  .draw-guide-dot.off,
  .draw-start-dot.off { display: none; }

  .draw-guide-dot.stuck {
    fill: #fde047;
    animation: draw-dot-stuck 0.7s ease-in-out infinite;
  }

  @keyframes draw-dot-stuck {
    0%, 100% { r: 16; opacity: 0.6; }
    50% { r: 30; opacity: 1; }
  }

  .draw-start-dot {
    fill: #fbbf24;
    stroke: #fff;
    stroke-width: 6;
    animation: draw-dot-pulse 1.4s ease-in-out infinite;
  }

  @keyframes draw-dot-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); transform-origin: center; }
    50% { opacity: 1; transform: scale(1.35); transform-origin: center; }
  }

  .draw-brush {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9998;
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.05s linear;
  }

  .draw-brush.hidden { display: none; }
  .draw-brush-icon {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  }

  .draw-progress-wrap {
    position: absolute;
    left: 50%;
    bottom: -58px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
  }

  .draw-progress-track {
    width: min(52vw, 320px);
    height: 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.18);
    overflow: hidden;
  }

  .draw-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #6ee7b7, #10b981);
    transition: width 0.12s linear;
  }

  .draw-progress-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: #065f46;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 16px;
    border-radius: var(--radius-pill);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
    font-variant-numeric: tabular-nums;
  }

  .draw-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 72px;
    pointer-events: auto;
  }

  .draw-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
  }

  .draw-action-btn .btn-svg { width: 22px; height: 22px; }

  .draw-banner {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }

  .draw-banner span {
    font-size: 2.3rem;
    font-weight: 800;
    color: #065f46;
    background: rgba(255, 255, 255, 0.95);
    padding: 18px 46px;
    border-radius: 40px;
    box-shadow: 0 26px 56px rgba(0, 0, 0, 0.32), inset 0 3px 0 #fff;
    animation: announce-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .draw-hint {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(5, 150, 105, 0.92);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 12px 26px;
    border-radius: var(--radius-pill);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    pointer-events: none;
  }

  .draw-hint .hint-svg { width: 24px; height: 24px; color: #d1fae5; }

  .draw-intro {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    pointer-events: none;
  }

  .draw-intro-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: #14532d;
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 30px;
    border-radius: var(--radius-pill);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22), inset 0 2px 0 #fff;
  }

  .draw-result-board { flex-wrap: wrap; max-width: 540px; }

  /* ============ Slice Game (ເກມຕັດໝາກໂມ) ============ */
  .slice-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: auto;
    touch-action: none;
  }

  #screen-slice {
    max-width: none;
    justify-content: flex-start;
  }

  .slice-hud {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    pointer-events: none;
  }

  .slice-hud .header-action-btn { pointer-events: auto; }

  .slice-score-pill { color: #be123c; }

  .slice-timer-pill {
    color: #0f766e;
    font-variant-numeric: tabular-nums;
    min-width: 104px;
    justify-content: center;
  }

  .slice-timer-pill.urgent {
    color: #dc2626;
    animation: timer-pulse 1s ease-in-out infinite;
  }

  @keyframes timer-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
  }

  .slice-hearts { display: flex; gap: 8px; }

  .slice-heart {
    width: 34px;
    height: 34px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .slice-heart.lost {
    opacity: 0.4;
    transform: scale(0.82);
  }

  .slice-combo {
    position: fixed;
    top: 26%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    font-size: 3.2rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 4px 0 #be123c, 0 12px 26px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    animation: combo-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes combo-pop {
    0% { transform: translateX(-50%) scale(0.4) rotate(-8deg); opacity: 0; }
    100% { transform: translateX(-50%) scale(1) rotate(0); opacity: 1; }
  }

  .slice-intro,
  .wheel-intro,
  .color-intro {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    pointer-events: none;
  }

  .slice-intro-text,
  .wheel-intro-text,
  .color-intro-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: #14532d;
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 30px;
    border-radius: var(--radius-pill);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22), inset 0 2px 0 #fff;
  }

  .slice-countdown {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 8px 0 #be123c, 0 16px 40px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: combo-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .slice-hint {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(190, 18, 60, 0.92);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 12px 26px;
    border-radius: var(--radius-pill);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    pointer-events: none;
  }

  .slice-hint .hint-svg { width: 24px; height: 24px; color: #fecdd3; }

  .slice-result-board { flex-wrap: wrap; max-width: 540px; }

  .slice-pop {
    position: fixed;
    z-index: 9990;
    transform: translate(-50%, -50%);
    font-size: 1.9rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 3px 0 #be123c, 0 8px 18px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: slice-pop-rise 0.8s ease-out forwards;
  }

  .slice-pop.combo {
    font-size: 2.3rem;
    color: #fef08a;
    text-shadow: 0 3px 0 #b45309, 0 8px 18px rgba(0, 0, 0, 0.4);
  }

  .slice-pop.golden {
    color: #fde047;
    text-shadow: 0 3px 0 #92400e, 0 10px 22px rgba(0, 0, 0, 0.45);
  }

  @keyframes slice-pop-rise {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    25% { opacity: 1; transform: translate(-50%, -70%) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
  }

  /* ============ Wheel Game (ເກມວົງລໍ້ໝຸນໂຊກ) ============ */
  .wheel-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: auto;
    touch-action: none;
  }

  #screen-wheel {
    max-width: none;
    justify-content: flex-start;
  }

  .wheel-hud {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    pointer-events: none;
  }

  .wheel-hud .header-action-btn { pointer-events: auto; }

  .wheel-star-pill { color: #b45309; }
  .wheel-round-pill { color: #7e22ce; }

  .wheel-spin-btn {
    position: fixed;
    left: 50%;
    bottom: 104px;
    transform: translateX(-50%);
    width: 138px;
    height: 138px;
    border-radius: 50%;
    gap: 2px;
    padding: 10px;
    background: linear-gradient(180deg, #fef3c7 0%, #fbbf24 45%, #d97706 100%);
    border: 4px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 10px 0 #b45309, 0 22px 40px rgba(0, 0, 0, 0.34), inset 0 3px 0 rgba(255, 255, 255, 0.7);
    font-size: 1.12rem;
    font-weight: 800;
    color: #7c2d12;
    z-index: 32;
  }

  .wheel-spin-btn .wheel-spin-icon {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
  }

  .wheel-spin-btn:active {
    transform: translateX(-50%) translateY(6px);
    box-shadow: 0 4px 0 #b45309, 0 10px 22px rgba(0, 0, 0, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.7);
  }

  .wheel-spin-btn.pressed { animation: wheel-press 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

  @keyframes wheel-press {
    0% { transform: translateX(-50%) scale(1); }
    45% { transform: translateX(-50%) scale(0.9) rotate(-6deg); }
    100% { transform: translateX(-50%) scale(1) rotate(0); }
  }

  .wheel-prize-banner {
    position: fixed;
    left: 50%;
    top: 38%;
    transform: translate(-50%, -50%);
    z-index: 44;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 44px;
    border-radius: 36px;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.97), rgba(254, 243, 199, 0.94));
    box-shadow: 0 30px 64px rgba(0, 0, 0, 0.34), inset 0 3px 0 #fff;
    pointer-events: none;
    animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .wheel-prize-icon {
    width: 58px;
    height: 58px;
    animation: trophy-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.22));
  }

  .wheel-prize-banner span {
    font-size: 1.6rem;
    font-weight: 800;
    color: #7c2d12;
    text-align: center;
  }

  .wheel-hint {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(126, 34, 206, 0.92);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 12px 26px;
    border-radius: var(--radius-pill);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    pointer-events: none;
  }

  .wheel-hint .hint-svg { width: 24px; height: 24px; color: #e9d5ff; }

  .wheel-result-board { flex-wrap: wrap; max-width: 520px; }

  .wheel-prize-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 540px;
    margin-bottom: 18px;
  }

  .wheel-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14), inset 0 1px 0 #fff;
    font-size: 0.95rem;
    font-weight: 700;
    color: #4c1d95;
  }

  .wheel-chip .chip-star { color: #f59e0b; font-weight: 800; }

  /* ============ Bird Game (ເກມຍິງນົກ) ============ */
  .bird-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: auto;
    touch-action: none;
  }

  #screen-bird {
    max-width: none;
    justify-content: flex-start;
  }

  .bird-hud {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    pointer-events: none;
  }

  .bird-hud .header-action-btn { pointer-events: auto; }

  .bird-score-pill { color: #0369a1; }
  .bird-timer-pill { color: #c2410c; }

  .bird-timer-pill.urgent {
    color: #dc2626;
    animation: timer-pulse 1s ease-in-out infinite;
  }

  .bird-combo {
    position: fixed;
    top: 26%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 4px 0 #075985, 0 12px 26px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    animation: combo-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .bird-intro {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    pointer-events: none;
  }

  .bird-intro-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: #0c4a6e;
    background: rgba(255, 255, 255, 0.92);
    padding: 12px 30px;
    border-radius: var(--radius-pill);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22), inset 0 2px 0 #fff;
  }

  .bird-countdown {
    position: fixed;
    top: 34%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 46;
    font-size: 8rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 6px 0 #075985, 0 16px 34px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    animation: combo-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .bird-golden-banner {
    position: fixed;
    left: 50%;
    top: 38%;
    transform: translate(-50%, -50%);
    z-index: 44;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 44px;
    border-radius: 36px;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.97), rgba(254, 249, 195, 0.94));
    box-shadow: 0 30px 64px rgba(0, 0, 0, 0.34), inset 0 3px 0 #fff;
    pointer-events: none;
    animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .bird-golden-icon {
    width: 58px;
    height: 58px;
    animation: trophy-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.22));
  }

  .bird-golden-banner span {
    font-size: 1.6rem;
    font-weight: 800;
    color: #7c2d12;
    text-align: center;
  }

  /* crosshair + วงแหวนชาร์จ (B3) */
  .bird-crosshair {
    position: fixed;
    left: 0;
    top: 0;
    width: 96px;
    height: 96px;
    z-index: 42;
    pointer-events: none;
    transform: translate(-50%, -50%);
  }

  .bird-crosshair .cross-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
  }

  .bird-crosshair .ring-bg { stroke: rgba(186, 230, 253, 0.55); }

  .bird-crosshair .ring-fill {
    stroke: #38bdf8;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8));
  }

  .bird-crosshair.on-target .ring-bg { stroke: rgba(254, 240, 138, 0.85); }
  .bird-crosshair.on-target .ring-fill { stroke: #fbbf24; }

  .bird-crosshair.on-target .cross-dot {
    transform: translate(-50%, -50%) scale(1.3);
    transition: transform 0.12s ease;
  }

  .bird-crosshair.miss-shake { animation: bird-shake 0.35s ease-in-out; }

  @keyframes bird-shake {
    0%, 100% { margin-left: 0; }
    25% { margin-left: -7px; }
    50% { margin-left: 6px; }
    75% { margin-left: -4px; }
  }

  .bird-crosshair .cross-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26px;
    height: 26px;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
  }

  .bird-hint {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(3, 105, 161, 0.92);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 12px 26px;
    border-radius: var(--radius-pill);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    pointer-events: none;
  }

  .bird-hint .hint-svg { width: 24px; height: 24px; color: #bae6fd; }

  .bird-result-board { flex-wrap: wrap; max-width: 520px; }

  /* ============ Layer 3: Hand Cursor ============ */
  .hand-cursor {
    position: fixed;
    width: 96px; height: 96px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
  }

  /* ไอคอนรูปมือ (สีขอบตาม currentColor, มีขอบขาวใน symbol) */
  .cursor-hand {
    position: absolute;
    width: 50px; height: 50px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-color);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.42));
    transition: transform 0.15s ease, color 0.15s ease;
  }

  .hand-cursor.selecting .cursor-hand {
    transform: translate(-50%, -50%) scale(1.3) rotate(-6deg);
    color: var(--accent-pink);
  }

  .dwell-ring {
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
    transform: rotate(-90deg);
  }

  .ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 6; }

  .ring-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 7;
    stroke-dasharray: var(--ring-circumference);
    stroke-dashoffset: var(--ring-circumference);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.05s linear;
  }

  /* ============ Responsive ============ */

  /* จอเตี้ย (มี 5 โหมด) — ย่อหน้าแรกให้ 5 ปุ่มเห็นครบโดยไม่ต้องเลื่อน */
  @media (max-height: 760px) {
    .mascot { width: 92px; }
    .welcome-card { padding: 20px 30px 22px; border-radius: 34px; }
    .welcome-card .main-title { font-size: 1.9rem; margin-bottom: 2px; }
    .welcome-card .sub-title { display: none; }
    .camera-note { margin: 6px 0 2px; font-size: 0.82rem; }
    .mode-row { gap: 10px; max-width: 520px; }
    .mode-btn { min-width: 150px; padding: 10px 16px 11px; font-size: 1.08rem; }
    .mode-btn .btn-svg { width: 28px; height: 28px; }
    .mode-btn-sub { font-size: 0.72rem; }
  }

  /* จอแนวนอนเตี้ย — จัด 6 ปุ่มเป็นแถวเดียว ให้เห็นครบไม่ต้องเลื่อน */
  @media (orientation: landscape) and (max-height: 640px) {
    .mode-row { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 1100px; gap: 8px; }
    .mode-color { grid-column: auto; }
    .mode-btn { min-width: 0; padding: 8px 8px 9px; font-size: 0.92rem; }
    .mode-btn .btn-svg { width: 24px; height: 24px; margin-bottom: 0; }
    .mode-btn-sub { display: none; }
    .mascot { width: 70px; }
    .welcome-card { padding: 14px 26px 16px; border-radius: 28px; }
    .welcome-card .main-title { font-size: 1.55rem; }
    .camera-note { display: none; }
  }

  @media (orientation: portrait) {
    .choices-3, .choices-4 { grid-template-columns: repeat(2, 1fr); height: 56vh; }
    .question-text { font-size: 1.55rem; }
    .main-title { font-size: 2rem; }
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .category-icon { width: 46px; height: 46px; }
    .category-name { font-size: 1.15rem; }
    .training-bubble { width: 210px; height: 210px; }
    .training-target-container { gap: 26px; }
    .hand-cursor { width: 84px; height: 84px; }
    .number-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .number-card { min-height: 90px; border-radius: 20px; }
    .number-banner span { font-size: 1.7rem; padding: 14px 30px; }
    .score-board { gap: 18px; }
    .stat-value { font-size: 1.9rem; }
    .mascot { width: 120px; }
    .welcome-card { padding: 24px 26px 28px; border-radius: 34px; }
    .mode-btn { min-width: 142px; padding: 12px 16px 14px; font-size: 1.12rem; }
    .mode-btn .btn-svg { width: 30px; height: 30px; }
    .mode-btn-sub { font-size: 0.68rem; }
    .slice-heart { width: 28px; height: 28px; }
    .slice-combo { font-size: 2.4rem; }
    .slice-countdown { font-size: 6rem; }
    .slice-hint { font-size: 1rem; padding: 10px 20px; }
    .slice-result-board { gap: 16px 20px; }
    .bird-combo { font-size: 2.4rem; }
    .bird-countdown { font-size: 6rem; }
    .bird-crosshair { width: 84px; height: 84px; }
    .bird-golden-banner { padding: 18px 30px; border-radius: 30px; }
    .bird-golden-banner span { font-size: 1.3rem; }
    .bird-hint { font-size: 1rem; padding: 10px 20px; }
    .wheel-spin-btn { width: 116px; height: 116px; font-size: 0.98rem; bottom: 92px; }
    .wheel-spin-btn .wheel-spin-icon { width: 42px; height: 42px; }
    .wheel-prize-banner { padding: 18px 30px; border-radius: 30px; }
    .wheel-prize-banner span { font-size: 1.3rem; }
    .wheel-hint { font-size: 1rem; padding: 10px 20px; }
    .color-dot { width: 76px; height: 76px; }
    .color-target .color-dot { width: 40px; height: 40px; }
    .color-board { gap: 14px; padding: 16px; }
    .color-connector { width: 16px; }
    .color-banner span { font-size: 1.7rem; padding: 14px 30px; }
    .color-hint { font-size: 1rem; padding: 10px 20px; }
    .draw-stage { width: min(92vw, 62vh); height: min(92vw, 62vh); border-radius: 30px; }
    .draw-banner span { font-size: 1.7rem; padding: 14px 30px; }
    .draw-hint { font-size: 1rem; padding: 10px 20px; }
    .draw-actions { margin-top: 62px; }
  }

  @media (orientation: landscape) and (max-height: 520px) {
    .choices-grid { height: 54vh; }
    .question-container { margin-bottom: 8px; padding: 6px 18px; }
    .question-text { font-size: 1.35rem; }
    .training-bubble { width: 165px; height: 165px; }
    .header-pill { font-size: 0.92rem; padding: 6px 14px; }
    .mascot { width: 96px; }
    .main-title { font-size: 1.7rem; }
    .wheel-spin-btn { width: 104px; height: 104px; bottom: 78px; font-size: 0.9rem; }
    .wheel-spin-btn .wheel-spin-icon { width: 38px; height: 38px; }
  }

  @media (min-width: 1200px) {
    .choices-grid { height: 54vh; }
    .question-text { font-size: 2.4rem; }
  }

  /* ============ Perf-lite (แท็บเล็ตรุ่นช้า — เปิดอัตโนมัติเมื่อ FPS ต่ำ) ============ */
  body.perf-lite .sparkles,
  body.perf-lite .welcome-glow,
  body.perf-lite .choice-card::before {
    display: none !important;
  }

  body.perf-lite .mascot,
  body.perf-lite .mascot-arm,
  body.perf-lite .mascot-eyes,
  body.perf-lite .choice-card img,
  body.perf-lite .choice-card,
  body.perf-lite .training-bubble,
  body.perf-lite .btn-3d::after,
  body.perf-lite .trophy {
    animation: none !important;
  }

  body.perf-lite .welcome-card {
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.26), inset 0 3px 0 rgba(255, 255, 255, 0.95);
  }

  body.perf-lite .interactive-card {
    transition-duration: 0.15s;
  }

  body.perf-lite .number-card.focused img { animation: none !important; }
  body.perf-lite .number-card::before { display: none !important; }
  body.perf-lite .color-dot.hint,
  body.perf-lite .color-target .color-dot.hint,
  body.perf-lite .color-dot.matched,
  body.perf-lite .color-trail-line { animation: none !important; }
  body.perf-lite .slice-combo,
  body.perf-lite .slice-countdown { animation: none !important; }
  body.perf-lite .bird-combo,
  body.perf-lite .bird-countdown { animation: none !important; }
  body.perf-lite .bird-crosshair.miss-shake { animation: none !important; }
  body.perf-lite .wheel-spin-btn.pressed,
  body.perf-lite .wheel-prize-banner,
  body.perf-lite .wheel-prize-icon { animation: none !important; }
  body.perf-lite .bird-golden-banner,
  body.perf-lite .bird-golden-icon { animation: none !important; }
  body.perf-lite .draw-guide-dot,
  body.perf-lite .draw-start-dot { animation: none !important; opacity: 0.85; }
  body.perf-lite .draw-guide-dot.stuck { r: 26; opacity: 1; }
  body.perf-lite .draw-ink.complete { animation: none !important; }
  body.perf-lite .draw-brush { transition: none !important; }

  /* ============ Reduced motion ============ */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
    }
    .sparkles { display: none; }
  }
