:root {
      --bg-milk: #FCF9F5;
      --bg-panel: #FFFFFF;
      --bg-soft: #F4EFE6;
      --text-main: #3D342F;
      --text-muted: #7A6E67;
      --accent-terra: #E67E51;
      --accent-mint: #5BBD9C;
      --accent-sky: #5DA9E9;
      --accent-sunny: #F5B841;
      --accent-lavender: #9B87F5;
      --border-warm: #E6DEC8;
      --btn-shadow: 0 4px 0 #D8CEBE;
    }

    body.high-contrast {
      --bg-milk: #121212;
      --bg-panel: #1E1E1E;
      --bg-soft: #2C2C2C;
      --text-main: #FFFFFF;
      --text-muted: #E0E0E0;
      --accent-terra: #FF9E00;
      --accent-mint: #00F5D4;
      --accent-sky: #00BBF9;
      --border-warm: #555555;
      --btn-shadow: 0 4px 0 #000000;
    }

    * {
      box-sizing: border-box;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }

    body {
      margin: 0;
      padding: 0;
      background-color: var(--bg-milk);
      background-image: radial-gradient(#E5DEC9 1.2px, transparent 1.2px);
      background-size: 22px 22px;
      color: var(--text-main);
      font-family: 'Nunito', 'Inter', sans-serif;
      overflow-x: hidden;
    }

    body.high-contrast {
      background-image: none;
    }

    /* Tactile 3D Button Style matching CHILDSIDE */
    .paint-tactile-btn {
      background: var(--bg-panel);
      border: 2px solid var(--border-warm);
      box-shadow: var(--btn-shadow);
      transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
      cursor: pointer;
    }

    .paint-tactile-btn:hover {
      transform: translateY(-1px);
      border-color: var(--accent-terra);
    }

    .paint-tactile-btn:active,
    .paint-tactile-btn.active {
      transform: translateY(3px);
      box-shadow: 0 1px 0 #D8CEBE;
    }

    .paint-tactile-btn.active {
      background-color: #FFF3EC;
      border-color: var(--accent-terra);
      border-width: 3px;
    }

    body.high-contrast .tactile-btn.active {
      background-color: #3A2E00;
      border-color: #FFD60A;
    }

    /* Large motor mode for children with motor impairments */
    body.motor-mode .tool-grid-btn {
      min-height: 68px;
      padding: 10px 12px;
      font-size: 1.05rem;
    }

    body.motor-mode .color-swatch {
      width: 48px;
      height: 48px;
    }

    body.motor-mode .stamp-btn {
      min-height: 64px;
      font-size: 1.75rem;
    }

    /* Letter Cubes Header */
    .letter-cube {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 30px;
      height: 30px;
      border-radius: 8px;
      font-weight: 900;
      font-size: 0.95rem;
      color: #3D342F;
      box-shadow: 0 3px 0 rgba(61, 52, 47, 0.18);
      border: 1.5px solid rgba(255, 255, 255, 0.75);
      transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .letter-cube:hover {
      transform: translateY(-4px) rotate(-4deg);
    }

    /* Canvas Wrapper */
    .canvas-stage {
      position: relative;
      background: #FFFFFF;
      border-radius: 24px;
      border: 4px solid var(--border-warm);
      box-shadow: 0 12px 30px rgba(61, 52, 47, 0.08);
      overflow: hidden;
      touch-action: none;
    }

    #paintCanvas {
      display: block;
      width: 100%;
      height: 100%;
      cursor: crosshair;
      touch-action: none;
    }

    #cursorPreview {
      position: absolute;
      pointer-events: none;
      transform: translate(-50%, -50%);
      border: 2px dashed rgba(61, 52, 47, 0.55);
      border-radius: 50%;
      display: none;
      z-index: 20;
      align-items: center;
      justify-content: center;
      font-size: 24px;
    }

    /* Custom Scrollbar for panels */
    .custom-scroll::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }
    .custom-scroll::-webkit-scrollbar-track {
      background: var(--bg-soft);
      border-radius: 8px;
    }
    .custom-scroll::-webkit-scrollbar-thumb {
      background: #D5C7B8;
      border-radius: 8px;
    }

    /* Color Swatch */
    .color-swatch {
      width: 40px;
      height: 40px;
      border-radius: 14px;
      border: 3px solid #FFFFFF;
      box-shadow: 0 3px 0 rgba(61, 52, 47, 0.18), inset 0 0 0 1px rgba(0,0,0,0.1);
      transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
      cursor: pointer;
    }

    .color-swatch:hover {
      transform: scale(1.1);
    }

    .color-swatch.active {
      transform: scale(1.16) translateY(-2px);
      outline: 3px solid var(--text-main);
      outline-offset: 2px;
    }

    /* Range slider accessible styling */
    input[type="range"].accessible-slider {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 14px;
      background: var(--bg-soft);
      border-radius: 999px;
      border: 2px solid var(--border-warm);
      outline: none;
    }

    input[type="range"].accessible-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--accent-terra);
      border: 3px solid #FFFFFF;
      box-shadow: 0 2px 6px rgba(0,0,0,0.25);
      cursor: pointer;
    }

    /* Stamp button icon fix for WordPress Emoji / Twemoji <img> replacement */
    .stamp-btn img.emoji,
    .stamp-btn img {
      width: 32px !important;
      height: 32px !important;
      max-width: none !important;
      object-fit: contain !important;
      display: inline-block !important;
      vertical-align: middle !important;
    }
    .stamp-btn span:first-child {
      font-size: 2rem !important;
      line-height: 1 !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
    }
