    @font-face {
      font-family: 'Lilita One';
      src: url('../assets/fonts/LilitaOne-Regular.ttf') format('truetype');
      font-weight: 400;
      font-style: normal;
      font-display: swap;
    }    *, *::before, *::after {
      margin: 0; padding: 0; box-sizing: border-box;
      -webkit-tap-highlight-color: transparent; user-select: none;
    }
    :root {
      --app-vh: 100dvh;
      --app-vw: 100vw;
      --safe-top: env(safe-area-inset-top, 0px);
      --safe-bottom: env(safe-area-inset-bottom, 0px);
      --run-btn-border: #a5a7a2;
      --run-btn-bg: #f7f7f2;
      --run-btn-shadow: #4b852c;
      --run-btn-led-off: #3d6e25;
      --run-btn-led-on: #d4f77c;
      --run-btn-led-active: #d4f77c;
      --scene-body-bg: radial-gradient(140% 90% at 50% 0%, #d6f2ff 0%, #dff2cf 45%, #bfdc9d 100%);
      --notebook-page-bg:
        linear-gradient(rgba(205, 211, 202, 0.34) 1px, transparent 1px),
        linear-gradient(90deg, rgba(205, 211, 202, 0.34) 1px, transparent 1px),
        radial-gradient(130% 90% at 50% 0%, rgba(255, 250, 235, 0.82) 0%, rgba(238, 246, 232, 0.78) 54%, rgba(232, 238, 226, 0.9) 100%);
      --notebook-page-bg-size: 24px 24px, 24px 24px, 100% 100%;
      --scene-grid-wrap-bg: #d7efba;
      --bg-base: #e8dfcc;
      --panel-bg: #ede7d7;
      --panel-edge: #d2c9b4;
      --grid-bg: #b7e48c;
      --cell-bg: #cfeaa5;
      --cell-edge: rgba(114, 164, 72, 0.5);
      --cell-hi-bg: rgba(255, 247, 173, 0.88);
      --cell-hi-edge: #d4bc44;
      --cell-hi-ring: rgba(212,188,68,0.5);
      --grid-wrap-radius: 16px;
      --grid-radius: 16px;
      --cell-radius: 8px;
      --obstacle-pattern-radius: 5px;
      --obstacle-bg-top: rgba(205,184,148,0.95);
      --obstacle-bg-bottom: rgba(181,156,116,0.96);
      --obstacle-edge: rgba(133,104,67,0.74);
      --obstacle-pattern: rgba(125,95,57,0.4);
      --toy-red: #f51c24;
      --toy-green: #00aa50;
      --toy-blue: #005abd;
      --toy-yellow: #fdb515;
      --toy-purple: #9e44ad;
      --toy-orange: #e57e22;
      --level-transition-fill: #ddd1bb;
    }
    html {
      background-color: var(--bg-base);
      background-image: var(--scene-body-bg);
    }
    html, body {
      width: 100%; height: 100%;
      min-height: var(--app-vh);
      overflow: hidden;
      background-color: var(--bg-base);
      background-image: var(--scene-body-bg);
      font-family: 'Fredoka', system-ui, sans-serif;
    }

    #app {
      --app-center-shift-x: -50%;
      --app-reveal-y: 0px;
      --app-reveal-scale: 1;
      position: fixed;
      left: 50%;
      top: 0;
      width: min(520px, 100%);
      height: var(--app-vh);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: calc(6px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
      gap: 8px;
      transform-origin: 50% 50%;
      transform: translateX(var(--app-center-shift-x)) translateY(var(--app-reveal-y)) scale(var(--app-reveal-scale));
    }
    #editorLayout,
    #editorMain {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
    }
    #editorSide {
      width: 100%;
      display: contents;
    }
    @media (pointer: fine) {
      html, body {
        overflow-y: auto;
      }
      #app {
        --app-center-shift-x: 0px;
        --app-reveal-y: 0px;
        --app-reveal-scale: 1;
        position: relative;
        left: auto;
        top: auto;
        min-height: var(--app-vh);
        height: auto;
        justify-content: flex-start;
        margin: 0 auto;
        transform: translateX(var(--app-center-shift-x)) translateY(var(--app-reveal-y)) scale(var(--app-reveal-scale));
      }
      @media (min-width: 1120px) {
        body.editor-mode {
          --editor-sidebar-w: 280px;
          --editor-main-w: 460px;
          --editor-shell-w: calc(var(--editor-sidebar-w) + var(--editor-main-w) + 24px);
        }
        body.editor-mode #app {
          width: min(var(--editor-shell-w), calc(100vw - 32px));
          max-width: none;
          padding-top: calc(104px + var(--safe-top));
        }
        body.editor-mode #debugBadge {
          left: max(16px, calc(50% - (min(var(--editor-shell-w), calc(100vw - 32px)) / 2)));
          top: calc(124px + var(--safe-top));
          transform: none;
          width: var(--editor-sidebar-w);
          max-width: var(--editor-sidebar-w);
          white-space: normal;
          pointer-events: none;
        }
        body.editor-mode #animationDebugBadge {
          left: max(16px, calc(50% - (min(var(--editor-shell-w), calc(100vw - 32px)) / 2)));
          top: calc(188px + var(--safe-top));
          transform: none;
          width: var(--editor-sidebar-w);
          max-width: var(--editor-sidebar-w);
        }
        body.editor-mode #editorLayout {
          display: grid;
          grid-template-columns: var(--editor-sidebar-w) var(--editor-main-w);
          align-items: start;
          justify-content: center;
          gap: 0 24px;
        }
        body.editor-mode #editorSide {
          display: flex;
          flex-direction: column;
          align-items: stretch;
          gap: 16px;
          width: 100%;
        }
        body.editor-mode #editorMain {
          width: var(--editor-main-w);
          display: flex;
          flex-direction: column;
          align-items: center;
          gap: 8px;
        }
        body.editor-mode #header,
        body.editor-mode #gridWrap,
        body.editor-mode #bottom {
          width: 100%;
          max-width: var(--editor-main-w);
        }
        body.editor-mode #editorToolbar {
          position: static;
          display: grid;
          grid-template-columns: repeat(3, minmax(0, 1fr));
          min-height: 0;
          width: 100%;
          max-width: none;
          padding: 0;
          gap: 10px;
        }
        body.editor-mode #customLevelsPanel {
          position: static;
          width: 100%;
          max-width: none;
          max-height: none;
          align-self: start;
        }
        body.editor-mode #customLevelsList {
          max-height: none;
        }
        body.editor-mode #elementPalettePanel {
          position: static;
          width: 100%;
          max-width: none;
          align-self: start;
        }
        body.editor-mode #levelThemePanel {
          position: static;
          width: 100%;
          max-width: none;
          align-self: start;
        }
        body.editor-mode #header {
          justify-content: center;
          align-self: center;
          padding-top: 0;
          margin-bottom: 4px;
        }
        body.editor-mode #customLevelsPanel .custom-levels-head {
          position: sticky;
          top: 0;
          z-index: 2;
          background: rgba(255, 249, 234, 0.96);
          padding-bottom: 8px;
        }
      }
    }
    body.compact-ui #app {
      padding: calc(4px + var(--safe-top)) 8px calc(8px + var(--safe-bottom));
      gap: 6px;
    }

    body.tablet-layout {
      background-color: #f7f7f1;
      background-image: var(--notebook-page-bg);
      background-size: var(--notebook-page-bg-size);
    }
    body:not(.tablet-layout) {
      background-color: #f7f7f1;
      background-image: var(--notebook-page-bg);
      background-size: var(--notebook-page-bg-size);
    }
    body.tablet-layout:not(.editor-mode) #app {
      width: min(1040px, calc(var(--app-vw) - 32px));
      max-width: none;
      padding: calc(8px + var(--safe-top)) 20px calc(14px + var(--safe-bottom));
      justify-content: center;
    }
    body.tablet-layout:not(.editor-mode) #editorLayout {
      width: 100%;
    }
    body.tablet-layout:not(.editor-mode) #editorMain {
      display: grid;
      grid-template-columns: minmax(300px, 460px) minmax(300px, 460px);
      grid-template-areas:
        "header header"
        "grid controls";
      align-items: center;
      justify-content: center;
      gap: 18px 48px;
      width: 100%;
    }
    body.tablet-layout:not(.editor-mode) #header {
      grid-area: header;
      justify-self: center;
      align-self: center;
      margin: 0 0 14px;
      padding: 5px 18px;
      background: rgba(255, 249, 234, 0.82);
    }
    body.tablet-layout:not(.editor-mode) #gridWrap {
      grid-area: grid;
      width: 100%;
      max-width: 460px;
      justify-self: center;
      align-self: center;
      background: color-mix(in srgb, var(--panel-bg) 78%, #d9e9bd);
    }
    body.tablet-layout:not(.editor-mode) #bottom {
      grid-area: controls;
      display: flex;
      flex-direction: column;
      justify-self: stretch;
      align-self: center;
      width: 100%;
      max-width: 460px;
      gap: 24px;
    }
    body.tablet-layout:not(.editor-mode) #blocksRow {
      align-self: end;
      justify-self: stretch;
      min-height: 72px;
      padding: 10px 18px;
      background: rgba(237, 231, 215, 0.92);
    }
    body.tablet-layout:not(.editor-mode) #boardRow {
      align-self: start;
      justify-self: stretch;
      padding: 10px;
      background: rgba(237, 231, 215, 0.92);
    }
    body.tablet-layout:not(.editor-mode) #runBtn {
      align-self: center;
      width: min(320px, 78%);
      height: 70px;
      margin-top: 0;
      background:
        linear-gradient(180deg, rgba(255,255,255,0.32) 0%, rgba(255,255,255,0.04) 48%, rgba(93,135,64,0.1) 100%),
        var(--scene-grid-wrap-bg);
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.58),
        inset 0 -4px 8px rgba(81, 117, 48, 0.18),
        0 4px 0 color-mix(in srgb, var(--cell-edge) 55%, #7f9e67),
        0 14px 24px rgba(95, 78, 52, 0.2);
    }
    @media (max-width: 760px) {
      body.tablet-layout:not(.editor-mode) #app {
        width: min(560px, 100%);
        padding-inline: 12px;
      }
      body.tablet-layout:not(.editor-mode) #editorMain {
        display: flex;
        flex-direction: column;
        gap: 10px;
      }
      body.tablet-layout:not(.editor-mode) #bottom {
        display: flex;
        max-width: 460px;
        gap: 6px;
      }
      body.tablet-layout:not(.editor-mode) #runBtn {
      width: 58px;
        height: 48px;
        margin-top: 0;
      }
    }

    /* Header BÖKS */
    #header {
        width: fit-content;
        max-width: 100%;
      flex-shrink: 0;
      display: flex; align-items: center; justify-content: center; gap: 1px;
      letter-spacing: 0.5px;
      cursor: pointer;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
      position: relative;
      overflow: hidden;
      background: rgba(255, 249, 234, 0.58);
      box-shadow: 0 2px 0 rgba(205, 194, 171, 0.82), 0 6px 10px rgba(95, 78, 52, 0.14);
      filter: saturate(1.04);
      transform: translateY(-1px);
      transition: transform 0.12s ease, filter 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
      border-radius: 10px;
      padding: 4px 10px;
        z-index: 9800;
      }
    #header::after {
        content: "";
      position: absolute;
      inset: -35% -28%;
      pointer-events: none;
      border-radius: inherit;
      background: radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 58%);
      opacity: 0;
      transform: translateY(2px) scale(0.96);
      transition: opacity 0.18s ease, transform 0.18s ease;
    }
    body.editor-mode #header {
      width: fit-content;
      max-width: 100%;
    }
    @media (hover: hover) and (pointer: fine) {
      #header:hover {
        transform: translateY(-2px) scale(1.01);
        background: rgba(255, 249, 234, 0.72);
        box-shadow: 0 3px 0 rgba(205, 194, 171, 0.84), 0 9px 16px rgba(95, 78, 52, 0.16), 0 0 18px rgba(255, 238, 172, 0.42);
        filter: saturate(1.1) brightness(1.03);
      }
      #header:hover::after {
        opacity: 0.9;
        transform: translateY(0) scale(1);
      }
      #header:hover .boks-logo {
        transform: scale(1.03);
      }
    }
    #header:active {
      transform: translateY(1px) scale(0.985);
      background: rgba(255, 245, 225, 0.88);
      box-shadow: 0 1px 0 rgba(205, 194, 171, 0.88), 0 3px 7px rgba(95, 78, 52, 0.16);
      filter: saturate(1.06) brightness(0.98);
    }
    #header:active::after {
      opacity: 0.2;
      transform: translateY(3px) scale(0.95);
    }
    #header:focus-visible {
      outline: 2px solid rgba(95, 78, 52, 0.55);
      outline-offset: 4px;
      background: rgba(255, 249, 234, 0.62);
      box-shadow: 0 2px 0 rgba(205, 194, 171, 0.8), 0 6px 10px rgba(95, 78, 52, 0.14);
    }
    #quickEditorBtn {
      position: fixed;
      top: calc(48px + var(--safe-top));
      left: 10px;
      z-index: 12001;
      display: none;
      min-width: 78px;
      min-height: 36px;
      padding: 0 12px;
      border: 2px solid var(--panel-edge);
      border-radius: 999px;
      background: linear-gradient(180deg, #fff6df 0%, var(--panel-bg) 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.82rem;
      font-weight: 700;
      box-shadow: 0 3px 0 #cdc2ab, 0 6px 10px rgba(95, 78, 52, 0.16);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    body:not(.prestart):not(.editor-mode) #quickEditorBtn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    body.editor-mode #quickEditorBtn {
      display: none;
    }
    #quickEditorBtn:active {
      transform: translateY(2px);
      box-shadow: 0 1px 0 #cdc2ab, 0 3px 7px rgba(95, 78, 52, 0.14);
    }
    .boks-logo {
      display: block;
      width: auto;
      height: auto;
      max-width: 100%;
      transform: none;
      transition: transform 0.12s ease;
      pointer-events: none;
      user-select: none;
    }
    .boks-logo--splash,
    .boks-logo--start {
      width: min(72vw, 360px);
    }
    .boks-logo--header {
      width: clamp(60px, 17vw, 86px);
    }
    .boks-logo--settings {
      width: 112px;
    }
    .boks-logo--ending {
      width: min(58vw, 280px);
      margin: 0 auto;
    }
    #splash-logo > span,
    #startGate .start-title > span,
    #header > .logo-letter,
    .settings-brand > .logo-letter,
    .ending-cinematic__brand > .logo-letter {
      display: none;
    }
    .logo-letter {
      font-family: 'Lilita One', cursive;
      font-size: 1.62em;
      line-height: 1;
      display: inline-block;
      -webkit-text-stroke: 0;
      text-shadow: none;
      transform: none;
      transition: transform 0.12s ease;
    }
    body.compact-ui .logo-letter { font-size: 1.45em; }
    .logo-b {
      color: #3f9a62;
    }
    .logo-o {
      color: #ff3b3b;
    }
    .logo-k {
      color: #ffd31a;
    }
    .logo-s {
      color: #2b8fd4;
    }

    #gridWrap {
      position: relative;
      width: 100%;
      max-width: 460px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: var(--grid-wrap-radius);
      overflow: hidden;
      background: var(--panel-bg);
      border: 2px solid var(--panel-edge);
      box-shadow: 0 2px 0 #cdc2ab, 0 8px 14px rgba(95, 78, 52, 0.18);
    }

    #gameGrid {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      grid-template-rows: repeat(6, 1fr);
      gap: 4px;
      position: relative;
      flex-shrink: 0;
      padding: 6px;
      background: var(--grid-bg);
      border-radius: var(--grid-radius);
      border: 1px solid #dfd5bf;
    }
    #gridDecor {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 8;
      overflow: visible;
    }
    #gridDecorFx {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 24;
      overflow: visible;
    }
    body[data-active-theme="level-manuale01"] #gameGrid {
      background: transparent;
      border-color: transparent;
    }
    .grid-decoration-bee {
      position: absolute;
      display: block;
      overflow: visible;
      filter: drop-shadow(0 2px 3px rgba(57, 39, 14, 0.18));
      will-change: transform, left, top;
      transform-origin: 50% 50%;
    }
    .grid-decoration-bee__fallback {
      animation: beeFallbackBuzz 0.22s infinite ease-in-out alternate;
      transform-origin: 50% 50%;
    }
    .grid-decoration-bee__fallback,
    .grid-decoration-bee__lottie,
    .grid-decoration-bee__fallback > svg,
    .grid-decoration-bee__lottie > svg {
      width: 100%;
      height: 100%;
      display: block;
      overflow: visible;
    }
    .grid-decoration-bee__lottie {
      position: absolute;
      inset: 0;
    }
    .grid-decoration-bee--fallback-only .grid-decoration-bee__lottie {
      display: none;
    }
    .grid-decoration-bee.is-lottie-ready .grid-decoration-bee__fallback {
      display: none;
    }
    .cell {
      position: relative;
      overflow: hidden;
      background: var(--cell-bg);
      border: 1px solid var(--cell-edge);
      border-radius: var(--cell-radius);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.65), inset 0 -1px 0 rgba(190,172,139,0.35);
    }
    body[data-active-theme="level-manuale01"] .cell {
      box-shadow: none;
    }
    .cell.goal-cell {
      border-radius: 0;
      overflow: visible;
    }
    .grid-decoration {
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      overflow: visible;
    }
    .grid-decoration--tree_small,
    .grid-decoration--daisy_flower {
      transform-origin: 50% 100%;
      will-change: transform;
    }
    .grid-decoration.is-reacting {
      filter: drop-shadow(0 4px 8px rgba(53, 44, 25, 0.16));
    }
    .grid-decoration-layer--ground {
      z-index: 1;
    }
    .grid-decoration-layer--object {
      z-index: 2;
    }
    .grid-decoration-layer--overlay {
      z-index: 3;
    }
    .cell-decoration-preview {
      width: 38px;
      height: 38px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .cell-decoration-svg {
      width: 100%;
      height: 100%;
      display: block;
      overflow: visible;
      transform-box: fill-box;
    }
    .grid-decoration--tree_small .cell-decoration-svg,
    .grid-decoration--daisy_flower .cell-decoration-svg {
      transform-origin: center bottom;
    }
    .grid-decoration--bridge .cell-decoration-svg {
      transform: scale(0.92);
    }
    .grid-decoration--bee .cell-decoration-svg {
      overflow: visible;
    }
    @keyframes beeFallbackBuzz {
      from {
        transform: translateY(-0.6px) scale(0.985);
      }
      to {
        transform: translateY(0.6px) scale(1.015);
      }
    }
    .goal-bubble {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      transform-origin: 50% 50%;
    }
    .goal-light {
      position: absolute;
      inset: -8%;
      pointer-events: none;
    }
    .goal-light__bloom {
      position: absolute;
      inset: 8%;
      border-radius: 50%;
      opacity: 0.42;
      transform: scale(0.86);
      background:
        radial-gradient(circle, rgba(255, 251, 194, 0.94) 0%, rgba(255, 244, 171, 0.78) 20%, rgba(255, 230, 129, 0.4) 42%, rgba(255, 230, 129, 0) 74%);
      filter: blur(4px);
    }
    .goal-light__core {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 24%;
      height: 24%;
      transform: translate(-50%, -50%) scale(0.9);
      border-radius: 50%;
      opacity: 0.68;
      background:
        radial-gradient(circle, rgba(255,255,255,0.98) 0%, rgba(255,250,196,0.92) 32%, rgba(255,224,112,0.66) 62%, rgba(255,224,112,0) 100%);
      box-shadow:
        0 0 10px rgba(255, 237, 143, 0.92),
        0 0 22px rgba(255, 225, 112, 0.54);
    }
    .goal-light__rays {
      position: absolute;
      inset: -8%;
      opacity: 0.22;
    }
    .goal-light__rays::before,
    .goal-light__rays::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 8%;
      height: 82%;
      border-radius: 999px;
      transform: translate(-50%, -50%);
      background: linear-gradient(180deg, rgba(255, 252, 212, 0) 0%, rgba(255, 247, 180, 0.68) 50%, rgba(255, 252, 212, 0) 100%);
      filter: blur(2px);
    }
    .goal-light__rays::after {
      transform: translate(-50%, -50%) rotate(90deg);
    }
    .goal-light__speck {
      position: absolute;
      width: 10%;
      aspect-ratio: 1;
      border-radius: 50%;
      opacity: 0.3;
      background: radial-gradient(circle, rgba(255,255,255,0.96) 0%, rgba(255,246,187,0.82) 44%, rgba(255,246,187,0) 72%);
      box-shadow: 0 0 10px rgba(255, 233, 137, 0.52);
    }
    .goal-light__speck--a { left: 20%; top: 20%; }
    .goal-light__speck--b { right: 18%; top: 26%; }
    .goal-light__speck--c { left: 24%; bottom: 20%; }
    .goal-light__speck--d { right: 22%; bottom: 18%; }
    .goal-bubble__shell {
      position: relative;
      width: 84%;
      height: 84%;
      border-radius: 50%;
      background:
        radial-gradient(circle at 33% 28%, rgba(255,255,255,0.96) 0 8%, rgba(255,255,255,0) 10%),
        radial-gradient(circle at 68% 70%, rgba(110, 220, 255, 0.22) 0 13%, rgba(110, 220, 255, 0) 15%),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.22) 0 58%, rgba(255,255,255,0.08) 69%, rgba(255,255,255,0) 76%);
      border: 1px solid rgba(255,255,255,0.72);
      box-shadow:
        inset 0 1px 3px rgba(255,255,255,0.48),
        0 0 14px rgba(189, 245, 255, 0.34);
      transform-origin: 50% 50%;
      animation: goalBubbleFloat 4.6s ease-in-out infinite;
    }
    .goal-bubble__flower {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 42%;
      height: 42%;
      border-radius: 50%;
      transform: translate(-50%, -50%);
      background:
        radial-gradient(circle at 50% 50%, #f3c341 0 18%, transparent 20%),
        radial-gradient(circle at 50% 10%, rgba(255,120,120,0.96) 0 13%, transparent 15%),
        radial-gradient(circle at 84% 38%, rgba(255,92,92,0.96) 0 13%, transparent 15%),
        radial-gradient(circle at 72% 82%, rgba(255,74,74,0.96) 0 13%, transparent 15%),
        radial-gradient(circle at 28% 82%, rgba(255,110,110,0.96) 0 13%, transparent 15%),
        radial-gradient(circle at 16% 38%, rgba(255,58,58,0.96) 0 13%, transparent 15%);
      animation: goalBubbleFlowerFloat 4.6s ease-in-out infinite;
    }
    .goal-bubble__glow {
      position: absolute;
      width: 92%;
      height: 92%;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(255,248,193,0.98) 0%, rgba(255,232,128,0.46) 40%, rgba(255,208,92,0.14) 66%, rgba(255,208,92,0) 100%);
      filter: blur(2px);
      opacity: 0.9;
      animation: goalBubbleGlowPulse 3.1s ease-in-out infinite;
    }
    .goal-bubble__burst {
      position: absolute;
      left: 50%;
      top: 50%;
      opacity: 0;
      pointer-events: none;
      transform: translate(-50%, -50%);
    }
    .goal-bubble__burst--ring {
      width: 28%;
      height: 28%;
      border-radius: 50%;
      border: 2px solid rgba(255,255,255,0.92);
      box-shadow: 0 0 12px rgba(198, 244, 255, 0.42);
    }
    .goal-bubble__burst--a,
    .goal-bubble__burst--b,
    .goal-bubble__burst--c,
    .goal-bubble__burst--d {
      width: 10%;
      height: 3px;
      border-radius: 999px;
      background: linear-gradient(90deg, rgba(255,255,255,0.96) 0%, rgba(190,240,255,0.8) 100%);
      box-shadow: 0 0 8px rgba(190,240,255,0.34);
    }
    .goal-bubble__burst--a { transform: translate(-50%, -50%) rotate(18deg); }
    .goal-bubble__burst--b { transform: translate(-50%, -50%) rotate(72deg); }
    .goal-bubble__burst--c { transform: translate(-50%, -50%) rotate(132deg); }
    .goal-bubble__burst--d { transform: translate(-50%, -50%) rotate(-36deg); }
    .cell.goal-cell.is-popping .goal-bubble__shell,
    .cell.goal-cell.is-popping .goal-bubble__flower,
    .cell.goal-cell.is-popping .goal-bubble__glow,
    .cell.goal-cell.is-popping .goal-light__bloom,
    .cell.goal-cell.is-popping .goal-light__core,
    .cell.goal-cell.is-popping .goal-light__rays,
    .cell.goal-cell.is-popping .goal-light__speck {
      animation: none;
    }
    .cell.goal-cell.is-popping .goal-light__bloom {
      animation: goalLightBloomPop 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-light__core {
      animation: goalLightCorePop 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-light__rays {
      animation: goalLightRaysPop 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-light__speck--a {
      animation: goalLightSpeckA 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-light__speck--b {
      animation: goalLightSpeckB 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-light__speck--c {
      animation: goalLightSpeckC 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-light__speck--d {
      animation: goalLightSpeckD 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__shell {
      animation: goalBubblePop 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__flower {
      animation: goalBubbleFlowerPop 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__glow {
      animation: goalBubbleGlowPop 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__burst--ring {
      animation: goalBubbleRingPop 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__burst--a {
      animation: goalBubbleShardA 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__burst--b {
      animation: goalBubbleShardB 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__burst--c {
      animation: goalBubbleShardC 4s ease-out forwards;
    }
    .cell.goal-cell.is-popping .goal-bubble__burst--d {
      animation: goalBubbleShardD 4s ease-out forwards;
    }
    .cell.goal-cell.is-annoyed .goal-bubble__shell,
    .cell.goal-cell.is-annoyed .goal-bubble__flower,
    .cell.goal-cell.is-annoyed .goal-bubble__glow {
      animation-play-state: paused;
    }
    .cell.goal-cell.is-annoyed .goal-bubble {
      animation: goalBubbleAnnoyance 0.52s cubic-bezier(.2,.85,.25,1) both;
    }
    .cell.goal-cell.is-annoyed .goal-bubble__shell {
      animation: goalBubbleShellAnnoyance 0.52s cubic-bezier(.2,.85,.25,1) both;
    }
    .cell.goal-cell.is-annoyed .goal-bubble__flower {
      animation: goalBubbleFlowerAnnoyance 0.52s cubic-bezier(.2,.85,.25,1) both;
    }
    .cell.goal-cell.is-annoyed .goal-bubble__glow {
      animation: goalBubbleGlowAnnoyance 0.52s cubic-bezier(.2,.85,.25,1) both;
    }
    @keyframes goalBubbleFloat {
      0%, 100% { transform: translateY(0) scale(1); }
      30% { transform: translateY(-1.5px) scale(1.012); }
      62% { transform: translateY(-3px) scale(1.018); }
    }
    @keyframes goalBubbleAnnoyance {
      0% { transform: translate3d(0, 0, 0) scale(1); }
      24% { transform: translate3d(0, -13%, 0) scale(0.985, 1.035); }
      58% { transform: translate3d(0, 6%, 0) scale(1.03, 0.975); }
      82% { transform: translate3d(0, -2%, 0) scale(0.995, 1.01); }
      100% { transform: translate3d(0, 0, 0) scale(1); }
    }
    @keyframes goalBubbleShellAnnoyance {
      0% { transform: scale(1); }
      24% { transform: scale(0.95, 1.05); }
      58% { transform: scale(1.035, 0.97); }
      100% { transform: scale(1); }
    }
    @keyframes goalBubbleFlowerAnnoyance {
      0% { transform: translate(-50%, -50%) scale(1); }
      24% { transform: translate(-50%, -56%) scale(0.95); }
      58% { transform: translate(-50%, -47%) scale(1.04); }
      100% { transform: translate(-50%, -50%) scale(1); }
    }
    @keyframes goalBubbleGlowAnnoyance {
      0% { opacity: 0.9; transform: scale(1); }
      24% { opacity: 0.7; transform: scale(0.95); }
      58% { opacity: 1; transform: scale(1.06); }
      100% { opacity: 0.9; transform: scale(1); }
    }
    @keyframes goalBubbleFlowerFloat {
      0%, 100% { transform: translate(-50%, -50%); }
      50% { transform: translate(-50%, calc(-50% - 1.5px)); }
    }
    @keyframes goalBubbleGlowPulse {
      0%, 100% { transform: scale(0.98); opacity: 0.76; }
      50% { transform: scale(1.04); opacity: 0.98; }
    }
    @keyframes goalLightBloomPop {
      0% { opacity: 0.42; transform: scale(0.86); }
      38% { opacity: 0.92; transform: scale(1.42); }
      100% { opacity: 0; transform: scale(2.4); }
    }
    @keyframes goalLightCorePop {
      0% { opacity: 0.68; transform: translate(-50%, -50%) scale(0.9); }
      28% { opacity: 1; transform: translate(-50%, -50%) scale(1.24); }
      100% { opacity: 0; transform: translate(-50%, -50%) scale(0.52); }
    }
    @keyframes goalLightRaysPop {
      0% { opacity: 0.22; transform: scale(0.86) rotate(0deg); }
      34% { opacity: 0.82; transform: scale(1.08) rotate(8deg); }
      100% { opacity: 0; transform: scale(1.32) rotate(18deg); }
    }
    @keyframes goalLightSpeckA {
      0% { opacity: 0.3; transform: translate(0, 0) scale(0.8); }
      32% { opacity: 1; transform: translate(-7px, -12px) scale(1); }
      100% { opacity: 0; transform: translate(-18px, -28px) scale(0.4); }
    }
    @keyframes goalLightSpeckB {
      0% { opacity: 0.3; transform: translate(0, 0) scale(0.8); }
      32% { opacity: 1; transform: translate(10px, -10px) scale(1); }
      100% { opacity: 0; transform: translate(24px, -24px) scale(0.42); }
    }
    @keyframes goalLightSpeckC {
      0% { opacity: 0.3; transform: translate(0, 0) scale(0.8); }
      32% { opacity: 1; transform: translate(-9px, 8px) scale(1); }
      100% { opacity: 0; transform: translate(-22px, 20px) scale(0.42); }
    }
    @keyframes goalLightSpeckD {
      0% { opacity: 0.3; transform: translate(0, 0) scale(0.8); }
      32% { opacity: 1; transform: translate(11px, 10px) scale(1); }
      100% { opacity: 0; transform: translate(24px, 22px) scale(0.42); }
    }
    @keyframes goalBubblePop {
      0% { transform: translateY(-2px) scale(1.02); opacity: 1; }
      60% { transform: translateY(-5px) scale(1.14); opacity: 0.9; }
      100% { transform: translateY(-8px) scale(1.28); opacity: 0; }
    }
    @keyframes goalBubbleFlowerPop {
      0% { transform: translate(-50%, -50%) scale(1); opacity: 0.96; }
      100% { transform: translate(-50%, calc(-50% - 8px)) scale(0.7); opacity: 0; }
    }
    @keyframes goalBubbleGlowPop {
      0% { transform: scale(1); opacity: 0.9; }
      100% { transform: scale(1.34); opacity: 0; }
    }
    @keyframes goalBubbleRingPop {
      0% { transform: translate(-50%, -50%) scale(0.35); opacity: 0; }
      18% { opacity: 0.95; }
      100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; }
    }
    @keyframes goalBubbleShardA {
      0% { transform: translate(-50%, -50%) rotate(18deg) translateX(0) scale(0.7); opacity: 0; }
      16% { opacity: 1; }
      100% { transform: translate(-50%, -50%) rotate(18deg) translateX(20px) scale(1.05); opacity: 0; }
    }
    @keyframes goalBubbleShardB {
      0% { transform: translate(-50%, -50%) rotate(72deg) translateX(0) scale(0.7); opacity: 0; }
      16% { opacity: 1; }
      100% { transform: translate(-50%, -50%) rotate(72deg) translateX(18px) scale(1); opacity: 0; }
    }
    @keyframes goalBubbleShardC {
      0% { transform: translate(-50%, -50%) rotate(132deg) translateX(0) scale(0.7); opacity: 0; }
      16% { opacity: 1; }
      100% { transform: translate(-50%, -50%) rotate(132deg) translateX(18px) scale(1); opacity: 0; }
    }
    @keyframes goalBubbleShardD {
      0% { transform: translate(-50%, -50%) rotate(-36deg) translateX(0) scale(0.7); opacity: 0; }
      16% { opacity: 1; }
      100% { transform: translate(-50%, -50%) rotate(-36deg) translateX(21px) scale(1.05); opacity: 0; }
    }
    .cell.hi {
      background: var(--cell-hi-bg);
      border-color: var(--cell-hi-edge);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 0 0 1px var(--cell-hi-ring);
    }
    .cell.obstacle-cell {
      background:
        linear-gradient(180deg, var(--obstacle-bg-top) 0%, var(--obstacle-bg-bottom) 100%);
      border-color: var(--obstacle-edge);
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.45),
        inset 0 -1px 0 rgba(100,76,46,0.45);
    }
    .cell.obstacle-cell::before {
      content: '';
      position: absolute;
      inset: 20% 12%;
      background:
        repeating-linear-gradient(
          0deg,
          var(--obstacle-pattern) 0 2px,
          transparent 2px 10px
        );
      border-radius: var(--obstacle-pattern-radius);
      opacity: 0.6;
      pointer-events: none;
    }
    .cell.decor-grass::before {
      content: '';
      position: absolute;
      left: 14%;
      bottom: 10%;
      width: 30%;
      height: 34%;
      border-radius: 60% 60% 45% 45%;
      background:
        radial-gradient(circle at 28% 78%, rgba(50,135,40,0.42) 0 12%, transparent 14%),
        radial-gradient(circle at 52% 68%, rgba(80,164,66,0.4) 0 13%, transparent 15%),
        radial-gradient(circle at 74% 82%, rgba(55,142,43,0.38) 0 12%, transparent 14%);
      pointer-events: none;
    }
    .cell.decor-flower::after {
      content: '';
      position: absolute;
      right: 13%;
      top: 14%;
      width: 22%;
      height: 22%;
      border-radius: 50%;
      background:
        radial-gradient(circle at 50% 50%, #f3c341 0 22%, transparent 24%),
        radial-gradient(circle at 50% 5%, rgba(255,243,186,0.9) 0 16%, transparent 18%),
        radial-gradient(circle at 86% 36%, rgba(253,228,236,0.95) 0 16%, transparent 18%),
        radial-gradient(circle at 76% 83%, rgba(213,245,255,0.95) 0 16%, transparent 18%),
        radial-gradient(circle at 24% 83%, rgba(255,226,184,0.95) 0 16%, transparent 18%),
        radial-gradient(circle at 14% 36%, rgba(255,244,163,0.95) 0 16%, transparent 18%);
      pointer-events: none;
      opacity: 0.88;
    }
    .cell.decor-stone::before {
      content: '';
      position: absolute;
      right: 12%;
      bottom: 12%;
      width: 18%;
      height: 10%;
      border-radius: 50%;
      background: rgba(170,162,150,0.52);
      box-shadow: -12px -5px 0 rgba(198,192,182,0.44), 8px -9px 0 rgba(160,154,145,0.38);
      pointer-events: none;
    }
    .cell.decor-city-road::before {
      content: '';
      position: absolute;
      left: 9%;
      right: 9%;
      top: 46%;
      height: 18%;
      border-radius: 4px;
      background:
        repeating-linear-gradient(
          90deg,
          rgba(66, 84, 106, 0.5) 0 18%,
          rgba(222, 232, 244, 0.55) 18% 24%,
          rgba(66, 84, 106, 0.5) 24% 42%
        );
      opacity: 0.75;
      pointer-events: none;
    }
    .cell.decor-city-light::after {
      content: '';
      position: absolute;
      right: 12%;
      top: 14%;
      width: 18%;
      height: 18%;
      border-radius: 50%;
      background: rgba(255, 246, 187, 0.85);
      box-shadow:
        -8px 6px 0 rgba(183, 229, 255, 0.75),
        5px 11px 0 rgba(255, 232, 168, 0.7);
      pointer-events: none;
    }
    .cell.decor-space-dust::before {
      content: '';
      position: absolute;
      inset: 16%;
      border-radius: 999px;
      background:
        radial-gradient(circle at 24% 38%, rgba(168, 245, 255, 0.45) 0 10%, transparent 12%),
        radial-gradient(circle at 68% 62%, rgba(236, 223, 255, 0.4) 0 10%, transparent 12%),
        radial-gradient(circle at 52% 28%, rgba(149, 129, 255, 0.34) 0 10%, transparent 12%);
      pointer-events: none;
      opacity: 0.8;
    }
    .cell.decor-space-crater::after {
      content: '';
      position: absolute;
      left: 14%;
      bottom: 12%;
      width: 28%;
      height: 18%;
      border-radius: 50%;
      background: rgba(41, 37, 78, 0.5);
      box-shadow:
        13px -7px 0 rgba(75, 64, 128, 0.5),
        8px 8px 0 rgba(28, 24, 53, 0.42);
      pointer-events: none;
    }
    .cell.decor-greek-glyph::before {
      content: '';
      position: absolute;
      left: 12%;
      right: 12%;
      bottom: 14%;
      height: 14%;
      border-radius: 3px;
      background:
        linear-gradient(90deg,
          rgba(112, 87, 54, 0.64) 0 12%,
          transparent 12% 20%,
          rgba(112, 87, 54, 0.64) 20% 32%,
          transparent 32% 40%,
          rgba(112, 87, 54, 0.64) 40% 52%,
          transparent 52% 60%,
          rgba(112, 87, 54, 0.64) 60% 72%,
          transparent 72% 80%,
          rgba(112, 87, 54, 0.64) 80% 100%);
      opacity: 0.72;
      pointer-events: none;
    }
    .cell.decor-greek-crystal::after {
      content: '';
      position: absolute;
      right: 12%;
      top: 14%;
      width: 16%;
      height: 28%;
      clip-path: polygon(50% 0%, 100% 38%, 72% 100%, 28% 100%, 0% 38%);
      background: linear-gradient(180deg, rgba(163,255,255,0.98) 0%, rgba(145,120,255,0.92) 52%, rgba(255,102,214,0.86) 100%);
      box-shadow: 0 0 8px rgba(157, 238, 255, 0.46);
      opacity: 0.86;
      pointer-events: none;
    }
    .cell.decor-greek-gleam::before {
      content: '';
      position: absolute;
      left: 18%;
      top: 18%;
      width: 14%;
      height: 14%;
      background:
        linear-gradient(90deg, transparent 0 42%, rgba(255,255,255,0.88) 42% 58%, transparent 58% 100%),
        linear-gradient(180deg, transparent 0 42%, rgba(255,249,214,0.88) 42% 58%, transparent 58% 100%);
      transform: rotate(18deg);
      opacity: 0.9;
      pointer-events: none;
    }

    #sprite {
      position: absolute;
      z-index: 20;
      touch-action: none;
      cursor: default;
      will-change: transform;
      transform: translateZ(0);
      transform-origin: 50% 50%;
      backface-visibility: hidden;
      contain: layout paint;
    }
    #goalIdleCanvas,
    #goalPopCanvas {
      position: absolute;
      pointer-events: none;
      inset: 0;
    }
    #goalIdleCanvas {
      z-index: 12;
    }
    #goalPopCanvas {
      z-index: 30;
    }
    #sandboxGoalDragPreview {
      position: fixed;
      left: 0;
      top: 0;
      z-index: 13000;
      display: none;
      pointer-events: none;
      transform: translate(-50%, -50%);
      touch-action: none;
      will-change: left, top;
    }
    body.sandbox-goal-dragging #goalIdleCanvas,
    body.sandbox-goal-dragging #goalPopCanvas {
      opacity: 0;
    }
    body.editor-mode #sprite { cursor: grab; }
    body.editor-mode #sprite:active { cursor: grabbing; }

    body.tutorial-stage:not(.tutorial-forward-visible) #blocksRow,
    body.tutorial-stage:not(.tutorial-slot-visible) #boardRow,
    body.tutorial-stage:not(.tutorial-play-visible) #runBtn {
      visibility: hidden;
      opacity: 0;
      pointer-events: none;
    }

    body.tutorial-stage #blocksRow,
    body.tutorial-stage #boardRow,
    body.tutorial-stage #runBtn {
      transition: opacity 0.22s ease, visibility 0.22s ease;
    }

    #bottom {
      width: 100%;
      max-width: 460px;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      position: relative;
    }

    /* Available blocks row */
    #blocksRow {
      width: 100%;
      background: var(--panel-bg);
      border: 2px solid var(--panel-edge);
      border-radius: 16px;
      padding: 10px 14px;
      position: relative;
      overflow: visible;
      min-height: 72px;
      box-shadow: 0 2px 0 #cdc2ab, 0 7px 14px rgba(95, 78, 52, 0.12), inset 0 1px 0 rgba(255,255,255,0.72);
    }
    body.compact-ui #blocksRow {
      min-height: 64px;
      padding: 8px 10px;
    }
    .ablock {
      flex-shrink: 0;
      touch-action: none;
      cursor: grab;
      border-radius: 7px;
      filter: drop-shadow(0 3px 0 rgba(96, 75, 40, 0.3)) drop-shadow(0 6px 8px rgba(0,0,0,0.13));
      transition: transform .12s, filter .12s;
    }
    .ablock:active {
      transform: translateY(1px) scale(0.96);
      filter: drop-shadow(0 2px 0 rgba(96, 75, 40, 0.28)) drop-shadow(0 4px 7px rgba(0,0,0,0.12));
    }
    .ablock.disabled {
      opacity: 0.38;
      filter: grayscale(0.45) saturate(0.6);
      cursor: default;
    }
    .ablock.drag-source-hidden {
      opacity: 0 !important;
      filter: none !important;
    }
    .ablock.drag-source-hidden > svg,
    .ablock.drag-source-hidden > img,
    .ablock.drag-source-hidden .available-block-vfx__glow,
    .ablock.drag-source-hidden .available-block-vfx__spark,
    .ablock.drag-source-hidden .available-block-vfx::before {
      animation: none !important;
      opacity: 0 !important;
      filter: none !important;
    }
    .ablock .block-art,
    .pblock .block-art {
      width: 100%;
      height: 100%;
      display: block;
      pointer-events: none;
      user-select: none;
    }
    .ablock .available-block-vfx {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 100%;
      height: 100%;
      transform: translate(-50%, -50%);
      pointer-events: none;
      z-index: 2;
    }
    .ablock .available-block-vfx__glow {
      position: absolute;
      inset: -22%;
      border-radius: 50%;
      opacity: 0;
      background:
        radial-gradient(circle, rgba(255, 251, 214, 0.99) 0%, rgba(255, 231, 104, 0.94) 22%, rgba(255, 205, 46, 0.62) 38%, rgba(255, 184, 46, 0.14) 52%, rgba(255, 184, 46, 0) 68%);
      filter: blur(8px);
      transform: scale(0.7);
    }
    .ablock .available-block-vfx__spark,
    .ablock .available-block-vfx__spark::before {
      position: absolute;
      inset: 0;
      content: "";
      pointer-events: none;
    }
    .ablock .available-block-vfx__spark {
      opacity: 0;
    }
    .ablock .available-block-vfx__spark::before {
      left: 50%;
      top: 50%;
      width: 16%;
      height: 100%;
      transform: translate(-50%, -50%);
      border-radius: 999px;
      background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(233,255,204,0.88) 50%, rgba(255,255,255,0) 100%);
      filter: blur(2px);
    }
    .ablock .available-block-vfx__spark::after {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 100%;
      height: 16%;
      transform: translate(-50%, -50%);
      border-radius: 999px;
      content: "";
      background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(233,255,204,0.8) 50%, rgba(255,255,255,0) 100%);
      filter: blur(2px);
    }
    .ablock .available-block-vfx::before {
      content: "";
      position: absolute;
      inset: -6%;
      border-radius: 16px;
      background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.04) 100%);
      opacity: 0;
      transform: scale(0.92);
      box-shadow:
        0 0 0 2px rgba(255, 234, 155, 0.24),
        0 0 22px rgba(255, 212, 84, 0.36);
    }
    .ablock.tutorial-focus {
      position: relative;
      z-index: 2;
      isolation: isolate;
    }
    .ablock.tutorial-focus > svg,
    .ablock.tutorial-focus > img {
      position: relative;
      z-index: 1;
      filter: drop-shadow(0 4px 0 rgba(58, 138, 57, 0.32)) drop-shadow(0 9px 12px rgba(56, 106, 36, 0.2));
    }
.ablock.tutorial-focus .available-block-vfx__glow {
  animation: availableBlockGlow 1.8s ease-in-out infinite;
  animation-delay: var(--available-block-glow-delay, 0s);
}
#blocksRow.available-block-guided .ablock.tutorial-focus .available-block-vfx__glow {
  animation: availableBlockGlow 1.8s ease-in-out infinite;
  animation-delay: var(--available-block-glow-delay, 0s);
}
.ablock.tutorial-focus .available-block-vfx__spark {
  animation: availableBlockSpark 1.8s ease-in-out infinite;
  animation-delay: var(--available-block-glow-delay, 0s);
}
#blocksRow.available-block-guided .ablock.tutorial-focus .available-block-vfx__spark {
  animation: availableBlockSpark 1.8s ease-in-out infinite;
  animation-delay: var(--available-block-glow-delay, 0s);
}
.ablock.tutorial-focus .available-block-vfx::before {
  animation: availableBlockFlash 1.8s ease-in-out infinite;
  animation-delay: var(--available-block-glow-delay, 0s);
}
#blocksRow.available-block-guided .ablock.tutorial-focus .available-block-vfx::before {
  animation: availableBlockFlash 1.8s ease-in-out infinite;
  animation-delay: var(--available-block-glow-delay, 0s);
}
    .ablock.empty-play-block-hint {
      position: relative;
      z-index: 3;
    }
    .ablock.empty-play-block-hint svg,
    .ablock.empty-play-block-hint img {
      animation: emptyPlayBlockPop 0.54s ease-out;
    }
    .ablock.empty-play-block-hint::after {
      content: '';
      position: absolute;
      inset: -4px;
      border-radius: inherit;
      border: 2px solid rgba(244, 196, 72, 0.9);
      box-shadow: 0 0 0 2px rgba(255, 233, 158, 0.38);
      pointer-events: none;
      animation: emptyPlayBlockRing 0.54s ease-out;
    }
    @keyframes emptyPlayBlockPop {
      0% {
        transform: translateY(0) scale(1);
      }
      45% {
        transform: translateY(-3px) scale(1.05);
      }
      100% {
        transform: translateY(0) scale(1);
      }
    }
    @keyframes emptyPlayBlockRing {
      0% {
        opacity: 0;
        transform: scale(0.9);
      }
      35% {
        opacity: 1;
        transform: scale(1.01);
      }
      100% {
        opacity: 0;
        transform: scale(1.08);
      }
    }
    @keyframes availableBlockGlow {
      0%, 100% { opacity: 0.14; transform: scale(0.78); }
      50% { opacity: 0.78; transform: scale(0.92); }
    }
    @keyframes availableBlockFlash {
      0%, 100% { opacity: 0.1; transform: scale(0.96); }
      50% { opacity: 0.5; transform: scale(1.02); }
    }
    @keyframes availableBlockSpark {
      0%, 100% { opacity: 0.08; transform: scale(0.92) rotate(0deg); }
      50% { opacity: 0.38; transform: scale(1.03) rotate(10deg); }
    }

    #firstLevelOnboarding {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 7;
      opacity: 0;
      transition: opacity 0.18s ease-out;
      --first-onboarding-start-x: 0px;
      --first-onboarding-start-y: 0px;
      --first-onboarding-end-x: 0px;
      --first-onboarding-end-y: 0px;
    }
    #firstLevelOnboarding.active {
      opacity: 1;
    }
    #firstLevelOnboarding[data-stage="drag"] .first-level-onboarding__tap-demo {
      display: none;
    }
    #firstLevelOnboarding[data-stage="play"] .first-level-onboarding__drag-demo,
    #firstLevelOnboarding[data-stage="play"] .first-level-onboarding__path {
      opacity: 0;
    }
    .first-level-onboarding__path {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      overflow: visible;
    }
    .first-level-onboarding__path path {
      fill: none;
      stroke: transparent;
      stroke-width: 3.2;
      stroke-linecap: round;
      stroke-dasharray: 8 8;
      opacity: 0;
      filter: none;
      animation: none;
    }
    .first-level-onboarding__drag-demo,
    .first-level-onboarding__tap-demo {
      position: absolute;
      left: 0;
      top: 0;
      width: 0;
      height: 0;
    }
    #firstLevelOnboarding[data-stage="drag"] .first-level-onboarding__drag-demo {
      animation: firstOnboardingDragLoop 2.35s ease-in-out infinite;
    }
    #firstLevelOnboarding[data-stage="play"] .first-level-onboarding__tap-demo {
      transform: translate(var(--first-onboarding-end-x), var(--first-onboarding-end-y));
      animation: firstOnboardingTapLoop 1.35s ease-in-out infinite;
    }
    .first-level-onboarding__ghost {
      position: absolute;
      left: 0;
      top: 0;
      transform: translate(-50%, -50%) rotate(-12deg);
      filter: drop-shadow(0 6px 10px rgba(58, 98, 104, 0.18));
    }
    .first-level-onboarding__ghost > * {
      width: 100%;
      height: 100%;
      display: block;
    }
    .first-level-onboarding__ghost .available-block-vfx {
      display: none;
    }
    .first-level-onboarding__hand {
      position: absolute;
      width: 72px;
      height: 72px;
      filter: drop-shadow(0 8px 14px rgba(96, 66, 46, 0.18));
    }
    .first-level-onboarding__hand svg {
      width: 100%;
      height: 100%;
      display: block;
    }
    .first-level-onboarding__hand--drag {
      left: 8px;
      top: 10px;
      transform: translate(-18%, -12%) rotate(-8deg);
    }
    .first-level-onboarding__hand--tap {
      left: 0;
      top: 0;
      transform: translate(-20%, -30%) rotate(-10deg);
    }
    .first-level-onboarding__tap-ring {
      position: absolute;
      left: 0;
      top: 0;
      width: 54px;
      height: 54px;
      margin-left: -27px;
      margin-top: -27px;
      border-radius: 999px;
      border: 2px solid rgba(113, 198, 255, 0.85);
      background: radial-gradient(circle, rgba(113,198,255,0.14) 0%, rgba(113,198,255,0.06) 45%, rgba(113,198,255,0) 72%);
      box-shadow: 0 0 0 2px rgba(231, 247, 255, 0.34);
      opacity: 0;
    }
    .first-level-onboarding__tap-ring--a {
      animation: firstOnboardingTapRing 1.35s ease-out infinite;
    }
    .first-level-onboarding__tap-ring--b {
      animation: firstOnboardingTapRing 1.35s ease-out infinite 0.22s;
    }
    @keyframes firstOnboardingDragLoop {
      0% {
        opacity: 0;
        transform: translate(var(--first-onboarding-start-x), var(--first-onboarding-start-y)) scale(0.95);
      }
      14% {
        opacity: 1;
        transform: translate(var(--first-onboarding-start-x), var(--first-onboarding-start-y)) scale(1);
      }
      56% {
        opacity: 1;
        transform: translate(var(--first-onboarding-end-x), var(--first-onboarding-end-y)) scale(1);
      }
      72% {
        opacity: 1;
        transform: translate(var(--first-onboarding-end-x), var(--first-onboarding-end-y)) scale(1);
      }
      82% {
        opacity: 0;
        transform: translate(var(--first-onboarding-end-x), var(--first-onboarding-end-y)) scale(1);
      }
      100% {
        opacity: 0;
        transform: translate(var(--first-onboarding-start-x), var(--first-onboarding-start-y)) scale(0.95);
      }
    }
    @keyframes firstOnboardingTapLoop {
      0%, 100% {
        opacity: 1;
        transform: translate(var(--first-onboarding-end-x), var(--first-onboarding-end-y));
      }
      35% {
        opacity: 1;
        transform: translate(var(--first-onboarding-end-x), calc(var(--first-onboarding-end-y) + 4px));
      }
      60% {
        opacity: 1;
        transform: translate(var(--first-onboarding-end-x), var(--first-onboarding-end-y));
      }
    }
    @keyframes firstOnboardingTapRing {
      0% {
        opacity: 0;
        transform: scale(0.72);
      }
      20% {
        opacity: 1;
      }
      100% {
        opacity: 0;
        transform: scale(1.28);
      }
    }

    /* Program board */
    #boardRow {
      width: 100%;
      background: var(--panel-bg);
      border: 2px solid var(--panel-edge);
      border-radius: 16px;
      padding: 10px;
      position: relative;
      box-shadow: 0 2px 0 #cdc2ab, 0 8px 14px rgba(95, 78, 52, 0.12), inset 0 1px 0 rgba(255,255,255,0.74);
    }
    body.compact-ui #boardRow { padding: 8px; }
    #boardGrid {
      position: relative;
      width: 100%;
    }
    #boardTrack {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      pointer-events: none;
      z-index: 0;
      overflow: hidden;
    }
    #boardSlots {
      position: relative;
      z-index: 1;
      display: flex;
      flex-direction: column;
    }
    .board-row { display: flex; }
    .board-row.reverse { flex-direction: row-reverse; }
  
    .pslot {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      padding: 2px;
      touch-action: none;
      border-radius: 10px;
      background: linear-gradient(180deg, #d3b487 0%, #caa678 100%);
      transition: background .2s, box-shadow .2s;
      position: relative;
      margin: 0 1px;
      border: 1px solid #bc996b;
      box-shadow:
        inset 0 2px 3px rgba(113, 76, 33, 0.3),
        inset 0 -1px 0 rgba(255,255,255,0.2),
        0 1px 0 rgba(255,255,255,0.28);
    }
    .pslot[data-zone="fn"] {
      background: linear-gradient(180deg, #dcc6a2 0%, #d3bb94 100%);
      border-color: #c8ac82;
      box-shadow:
        inset 0 2px 3px rgba(113, 76, 33, 0.22),
        inset 0 -1px 0 rgba(255,255,255,0.24),
        0 1px 0 rgba(255,255,255,0.32);
    }
    .pslot::before {
      content: '';
      position: absolute;
      width: var(--well-size, 34px);
      height: var(--well-size, 34px);
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      border-radius: 9px;
      background: linear-gradient(180deg, rgba(138,96,52,0.14) 0%, rgba(196,157,107,0.06) 55%, rgba(255,255,255,0.08) 100%);
      box-shadow:
        inset 0 2px 3px rgba(86,56,24,0.26),
        inset 0 -1px 1px rgba(255,255,255,0.14);
      opacity: 0.75;
      pointer-events: none;
    }
    .pslot .sinner {
      position: relative;
      z-index: 1;
    }
    .pslot.filled::before { opacity: 0; }
    .pslot.over { border-color: #b98a4e; }
    .pslot[data-zone="fn"].over { border-color: #caa170; }
    .pslot.over::before {
      background: linear-gradient(180deg, rgba(255,236,170,0.72) 0%, rgba(250,214,118,0.42) 100%);
      box-shadow:
        inset 0 2px 3px rgba(143,97,35,0.28),
        inset 0 -1px 1px rgba(255,255,255,0.2),
        0 0 0 1px rgba(212,168,75,0.45);
      opacity: 1;
    }
    .pslot[data-zone="fn"].over::before {
      background: linear-gradient(180deg, rgba(240,225,255,0.74) 0%, rgba(212,185,242,0.45) 100%);
      box-shadow:
        inset 0 2px 3px rgba(102,62,158,0.24),
        inset 0 -1px 1px rgba(255,255,255,0.22),
        0 0 0 1px rgba(152,110,212,0.42);
    }
    .pslot.slot-capture {
      animation: slotCapturePop .34s cubic-bezier(.2, .9, .2, 1);
    }
    .pslot.slot-capture::after {
      content: '';
      position: absolute;
      inset: -6px;
      border-radius: 14px;
      pointer-events: none;
      border: 2px solid rgba(255, 228, 154, 0.9);
      box-shadow: 0 0 0 2px rgba(255, 248, 221, 0.22), 0 0 22px rgba(250, 207, 91, 0.34);
      animation: slotCaptureFlash .34s ease-out forwards;
    }
    .pslot[data-zone="fn"].slot-capture::after {
      border-color: rgba(222, 202, 255, 0.92);
      box-shadow: 0 0 0 2px rgba(246, 239, 255, 0.22), 0 0 22px rgba(163, 118, 232, 0.3);
    }
    .pslot.slot-capture .pblock {
      animation: slotCaptureBlockSnap .24s ease-out;
    }
    .pslot.first-level-onboarding-slot::after,
    .pslot.tutorial-slot-focus::after,
    .pslot.tutorial-function-area-focus::after {
      content: '';
      position: absolute;
      inset: -5px;
      border-radius: 13px;
      border: 2px solid rgba(255, 219, 122, 0.94);
      box-shadow: 0 0 0 2px rgba(255, 239, 202, 0.34), 0 0 20px rgba(255, 205, 92, 0.28);
      pointer-events: none;
      animation: firstOnboardingSlotPulse 1.35s ease-in-out infinite;
    }
    .pslot.tutorial-function-area-focus::after {
      border-color: rgba(137, 203, 255, 0.96);
      box-shadow: 0 0 0 2px rgba(214, 240, 255, 0.46), 0 0 22px rgba(77, 176, 255, 0.34);
    }
    .pslot.locked {
      opacity: 0.34;
      filter: saturate(0.55);
      pointer-events: none;
    }
    .pslot.locked::before {
      opacity: 0.38;
    }
    .pslot.done    { background: #d5bb93; }
    .pslot.active  {
      background: #c6e3ff;
      animation: slotPulse .7s ease-in-out infinite;
    }
    @keyframes slotPulse {
      0%,100% { box-shadow: 0 0 6px rgba(43,143,212,0.2); }
      50%      { box-shadow: 0 0 14px rgba(43,143,212,0.5); }
    }
    @keyframes slotCapturePop {
      0% {
        transform: scale(0.94);
        filter: brightness(1);
      }
      55% {
        transform: scale(1.06);
        filter: brightness(1.08);
      }
      100% {
        transform: scale(1);
        filter: brightness(1);
      }
    }
    @keyframes slotCaptureFlash {
      0% {
        opacity: 0;
        transform: scale(0.92);
      }
      35% {
        opacity: 1;
        transform: scale(1.02);
      }
      100% {
        opacity: 0;
        transform: scale(1.08);
      }
    }
    @keyframes slotCaptureBlockSnap {
      0% { transform: scale(0.86); }
      65% { transform: scale(1.05); }
      100% { transform: scale(1); }
    }
    .sinner { display:flex; align-items:center; justify-content:center; }
    .pblock {
      border-radius: 7px; touch-action: none; cursor: grab;
      filter: drop-shadow(0 3px 0 rgba(96, 75, 40, 0.32)) drop-shadow(0 6px 8px rgba(0,0,0,0.14));
    }

    /* fn slot states */
    .pslot.fn-active {
      background: #e2d0f0;
      animation: slotPulseFn .7s ease-in-out infinite;
    }
    .pslot.fn-done { background: #d5bee6; }
    @keyframes slotPulseFn {
      0%,100% { box-shadow: 0 0 6px rgba(124,58,237,0.2); }
      50%      { box-shadow: 0 0 14px rgba(124,58,237,0.6); }
    }

    /* Run button - toy plastic style */
    #runBtn {
      width: 164px;
      height: 56px;
      flex-shrink: 0;
      border-radius: 14px;
      border: 7px solid var(--panel-edge);
      outline: none;
      background: var(--panel-bg);
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.32),
        inset 0 -2px 0 rgba(125, 107, 77, 0.22),
        0 4px 0 color-mix(in srgb, var(--panel-edge) 82%, #8a6d4b),
        0 8px 14px rgba(125, 107, 77, 0.18);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      isolation: isolate;
      cursor: pointer;
      touch-action: manipulation;
      transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
      -webkit-appearance: none;
      appearance: none;
      -webkit-tap-highlight-color: transparent;
      padding: 0px;
      overflow: hidden;
    }
    body.compact-ui #runBtn {
      width: 164px;
      height: 56px;
      border-radius: 13px;
      padding: 0px;
    }
    .run-btn-shell {
      position: relative;
      width: 100%;
      height: 100%;
      display: grid;
      place-items: center;
      border-radius: 10px;
      background: color-mix(in srgb, var(--panel-bg) 88%, #fff8ee);
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.48),
        inset 0 -3px 0 rgba(125, 107, 77, 0.18);
    }
    .run-btn-shell::before {
      content: "";
      position: absolute;
      left: 10px;
      right: 10px;
      top: 6px;
      height: 12px;
      border-radius: 999px;
      background: linear-gradient(to bottom, rgba(255,255,255,0.42), rgba(255,255,255,0));
      pointer-events: none;
    }
    .run-btn-progress {
      position: relative;
      z-index: 1;
      display: grid;
      grid-template-columns: repeat(8, 1fr);
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: auto;
      max-width: 100%;
      padding: 0;
    }
    .run-step-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: color-mix(in srgb, var(--panel-edge) 68%, #6f7e55);
      transition: background-color 0.14s ease, box-shadow 0.14s ease;
    }
    .run-step-dot.is-done,
    .run-step-dot.is-active {
      background: #d4f77c;
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.6),
        0 0 0 1px rgba(185, 221, 101, 0.7),
        0 0 8px rgba(212, 247, 124, 0.88),
        0 0 16px rgba(212, 247, 124, 0.5);
    }
    #runBtn.first-level-onboarding-run,
    #runBtn.tutorial-play-focus {
      position: relative;
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.58),
        inset 0 -4px 8px rgba(81, 117, 48, 0.18),
        0 4px 0 var(--run-btn-shadow),
        0 10px 18px rgba(43, 143, 212, 0.18);
    }
    #runBtn.first-level-onboarding-run::after,
    #runBtn.tutorial-play-focus::after {
      content: '';
      position: absolute;
      inset: -6px;
      border-radius: 10px;
      border: 2px solid rgba(107, 196, 255, 0.72);
      box-shadow: 0 0 0 2px rgba(210, 241, 255, 0.2), 0 0 14px rgba(43, 143, 212, 0.16);
      pointer-events: none;
      animation: firstOnboardingRunRing 1.35s ease-in-out infinite;
    }
    @media (hover: hover) and (pointer: fine) {
      #runBtn:hover {
        transform: translateY(-1px);
        background: color-mix(in srgb, var(--panel-bg) 92%, #fffdf7);
        box-shadow:
          inset 0 2px 0 rgba(255,255,255,0.36),
          inset 0 -2px 0 rgba(125, 107, 77, 0.18),
          0 5px 0 color-mix(in srgb, var(--panel-edge) 84%, #8a6d4b),
          0 10px 16px rgba(125, 107, 77, 0.22);
      }
      #runBtn:hover .run-btn-shell {
        background: color-mix(in srgb, var(--panel-bg) 82%, #ffffff);
      }
    }
    #runBtn:active,
    #runBtn.is-pressed {
      transform: translateY(3px);
      background: color-mix(in srgb, var(--panel-bg) 88%, #d8ccb6);
      box-shadow:
        inset 0 2px 0 rgba(255,255,255,0.18),
        inset 0 -1px 0 rgba(125, 107, 77, 0.2),
        0 1px 0 color-mix(in srgb, var(--panel-edge) 80%, #8a6d4b),
        0 3px 6px rgba(125, 107, 77, 0.16);
    }
    #runBtn:active .run-btn-shell,
    #runBtn.is-pressed .run-btn-shell {
      background: color-mix(in srgb, var(--panel-bg) 76%, #ffffff);
      transform: translateY(1px);
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.5),
        inset 0 -1px 0 rgba(125, 107, 77, 0.16);
    }
    #runBtn:focus-visible {
      outline: 2px solid rgba(95, 78, 52, 0.55);
      outline-offset: 4px;
    }
    #runBtn:active svg,
    #runBtn.is-pressed svg { transform: translateY(1px); }
    #runBtn.running {
      animation: none;
    }
    @keyframes firstOnboardingSlotPulse {
      0%, 100% { opacity: 0.52; transform: scale(0.98); }
      50% { opacity: 1; transform: scale(1.04); }
    }
    @keyframes firstOnboardingRunRing {
      0%, 100% { opacity: 0.32; transform: scale(0.98); }
      50% { opacity: 0.86; transform: scale(1.04); }
    }
    #ghost {
      position: fixed; left: 0; top: 0; z-index: 9999;
      pointer-events: none;
      transform: translate3d(-9999px, -9999px, 0) translate(-50%, -50%);
      will-change: transform;
      transition: none !important;
      opacity: .9; display: none; border-radius: 5px;
      filter: drop-shadow(0 6px 12px rgba(0,0,0,0.25));
    }

    #toast {
      position: fixed;
      left: 50%; transform: translateX(-50%);
      background: #fff9ea; border-radius: 20px;
      padding: 6px 16px; font-size: .85em; font-weight: 700;
      color: #5f4e34;
      border: 1px solid #dfcda9;
      box-shadow: 0 4px 16px rgba(0,0,0,.12);
      opacity: 0; transition: opacity .3s;
      pointer-events: none; white-space: nowrap; z-index: 200;
    }
    #toast.show { opacity: 1; }
    #toast.win  {
      color: #e0a000;
      font-size: 1.6em;
      padding: 12px 28px;
      background: #fffbe6;
      box-shadow: 0 6px 24px rgba(255,200,0,0.3);
    }
    #winBurst {
      position: fixed;
      inset: 0;
      z-index: 9400;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.12s linear;
      --wb-x: 50vw;
      --wb-y: 36vh;
    }
    #winBurst.show {
      opacity: 1;
    }
    #winBurst .win-core {
      position: fixed;
      left: var(--wb-x);
      top: var(--wb-y);
      width: 22px;
      height: 22px;
      border-radius: 999px;
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.3);
      background: radial-gradient(circle, rgba(255, 252, 232, 0.98) 0%, rgba(255, 224, 126, 0.78) 58%, rgba(255, 214, 82, 0) 100%);
      box-shadow: 0 0 20px rgba(255, 213, 94, 0.4);
      filter: blur(0.15px);
    }
    #winBurst.bursting .win-core {
      animation: winCorePulse 280ms ease-out forwards;
    }
    @keyframes winCorePulse {
      0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
      }
      20% {
        opacity: 1;
      }
      100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.1);
      }
    }
    #winBurst .win-spark {
      position: fixed;
      left: var(--wb-x);
      top: var(--wb-y);
      width: 10px;
      height: 10px;
      border-radius: 3px;
      border: 1px solid rgba(103, 73, 8, 0.45);
      background: linear-gradient(180deg, #fff6b5 0%, #ffd147 100%);
      opacity: 0;
      transform: translate(-50%, -50%) rotate(var(--a, 0deg)) translateX(0) scale(0.3);
      box-shadow: 0 2px 5px rgba(98, 72, 12, 0.3);
    }
    #winBurst.bursting .win-spark {
      animation: winSparkBurst 740ms ease-out forwards;
      animation-delay: var(--d, 0ms);
    }
    @keyframes winSparkBurst {
      0% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(var(--a, 0deg)) translateX(0) scale(0.2);
      }
      18% {
        opacity: 1;
      }
      100% {
        opacity: 0;
      transform: translate(-50%, -50%) rotate(var(--a, 0deg)) translateX(var(--r, 100px)) scale(1);
      }
    }
    #winBurst .win-ring {
      position: fixed;
      left: var(--wb-x);
      top: var(--wb-y);
      width: 14px;
      height: 14px;
      border-radius: 999px;
      border: 2px solid rgba(255, 230, 147, 0.85);
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.2);
      box-shadow: 0 0 0 2px rgba(255, 241, 193, 0.28);
    }
    #winBurst .win-flash {
      position: fixed;
      left: var(--wb-x);
      top: var(--wb-y);
      width: 24px;
      height: 24px;
      border-radius: 999px;
      opacity: 0;
      transform: translate(-50%, -50%) scale(0.25);
      background: radial-gradient(circle, rgba(255,255,236,0.98) 0%, rgba(255,224,126,0.74) 56%, rgba(255,214,82,0) 100%);
      filter: blur(0.2px);
    }
    #winBurst.bursting .win-ring {
      animation: winRingPulse 700ms ease-out forwards;
      animation-delay: var(--d, 0ms);
    }
    #winBurst.bursting .win-flash {
      animation: winFlashBurst 260ms ease-out forwards;
    }
    @keyframes winRingPulse {
      0% {
        opacity: 0.96;
        transform: translate(-50%, -50%) scale(0.25);
      }
      100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(9.2);
      }
    }
    @keyframes winFlashBurst {
      0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.25);
      }
      16% {
        opacity: 1;
      }
      100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.2);
      }
    }
    #levelTransition {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        opacity: 0;
        pointer-events: none;
        z-index: 9900;
        overflow: hidden;
        transition: opacity 0.12s linear;
      }
    #levelTransition.show { opacity: 1; }
    #levelTransition .level-transition-mask {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        overflow: visible;
      }
    #levelTransition .level-transition-fill {
      fill: var(--level-transition-fill);
      }
    #levelTransition .level-transition-hole {
      will-change: transform;
    }

    #debugBadge {
      position: fixed;
      top: calc(8px + var(--safe-top));
      left: 10px;
      z-index: 12000;
      display: none;
      padding: 6px 10px;
      border-radius: 10px;
      border: 1px solid rgba(95, 78, 52, 0.35);
      background: rgba(255, 250, 236, 0.92);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.82rem;
      font-weight: 700;
      letter-spacing: 0.2px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.12);
      pointer-events: none;
      white-space: nowrap;
    }
    body.debug-visible #debugBadge {
      display: block;
    }
    body.debug-tools-disabled #debugBadge {
      display: none !important;
    }

    #animationDebugBadge {
      position: fixed;
      top: calc(44px + var(--safe-top));
      left: 10px;
      z-index: 12000;
      display: none;
      min-width: 320px;
      max-width: min(86vw, 560px);
      padding: 8px 10px;
      border-radius: 10px;
      border: 1px solid rgba(62, 49, 30, 0.34);
      background: rgba(28, 24, 17, 0.86);
      color: #f7ecd6;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
      font-size: 0.72rem;
      font-weight: 600;
      line-height: 1.35;
      letter-spacing: 0.01em;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
      pointer-events: none;
      white-space: pre-line;
      user-select: none;
    }
    body.animation-debug-visible #animationDebugBadge {
      display: block;
    }
    body.debug-tools-disabled #animationDebugBadge {
      display: none !important;
    }
    body:not(.prestart):not(.editor-mode).animation-debug-visible #animationDebugBadge {
      top: calc(92px + var(--safe-top));
    }

    #buildBadge {
      position: fixed;
      left: 10px;
      top: calc(92px + var(--safe-top));
      z-index: 12000;
      min-width: 142px;
      padding: 8px 10px;
      border-radius: 14px;
      background: rgba(255, 250, 236, 0.96);
      border: 2px solid rgba(95, 78, 52, 0.28);
      color: #5e4c31;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.76rem;
      font-weight: 700;
      letter-spacing: 0.03em;
      line-height: 1.35;
      text-align: left;
      box-shadow: 0 6px 16px rgba(0,0,0,0.12);
      pointer-events: none;
      user-select: none;
      white-space: pre-line;
    }
    body.prestart #buildBadge,
    body.editor-mode #buildBadge {
      top: calc(10px + env(safe-area-inset-top, 0px));
    }
    #buildBadge strong {
      display: block;
      font-size: 0.64rem;
      letter-spacing: 0.08em;
      color: #9b7b44;
    }
    #buildBadge.build-fresh {
      border-color: rgba(245, 189, 55, 0.56);
      box-shadow:
        0 6px 16px rgba(0,0,0,0.12),
        0 0 0 3px rgba(255, 220, 112, 0.28);
    }
    body.build-badge-disabled #buildBadge {
      display: none;
    }
    body.editor-disabled #startEditorBtn,
    body.editor-disabled #quickEditorBtn,
    body.editor-disabled #editorToolbar,
    body.editor-disabled #customLevelsPanel,
    body.editor-disabled #levelThemePanel,
    body.editor-disabled #elementPalettePanel {
      display: none !important;
    }
    body.sandbox-mode #customLevelsPanel,
    body.sandbox-mode #saveLevelBtn,
    body.sandbox-mode #quickEditorBtn {
      display: none !important;
    }
    #sandboxToolbar {
      display: none;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      padding: 4px 0;
    }
    body.sandbox-mode #sandboxToolbar {
      display: flex;
    }
    .sandbox-tool {
      width: 46px;
      height: 46px;
      display: grid;
      place-items: center;
      border: 2px solid rgba(190, 174, 144, 0.95);
      border-radius: 13px;
      background: linear-gradient(180deg, #fffdf6 0%, #efe3cb 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 2px 0 #c7b894;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .sandbox-tool.active {
      background: linear-gradient(180deg, #dfffe9 0%, #bdeccd 100%);
      border-color: rgba(74, 168, 104, 0.82);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 2px 0 rgba(69, 139, 89, 0.56), 0 0 0 3px rgba(109, 213, 139, 0.22);
    }
    body.debug-tools-disabled #openSpritePreviewBtn,
    body.debug-tools-disabled #openTutorialEditorBtn,
    body.debug-tools-disabled #openVfxToolBtn,
    body.debug-tools-disabled #openLottieInspectorBtn,
    body.debug-tools-disabled #openLottieInspectorBtnEditor {
      display: none !important;
    }

    #rotateNotice {
      position: fixed;
      inset: 0;
      z-index: 10000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
      background: linear-gradient(180deg, #f0e7d5 0%, #e2f2d3 100%);
      text-align: center;
    }
    #rotateNotice .rotate-card {
      width: min(420px, calc(var(--app-vw) - 48px));
      background: #fff9ea;
      border: 2px solid #d2c9b4;
      border-radius: 18px;
      padding: 18px 14px;
      box-shadow: 0 4px 16px rgba(95, 78, 52, 0.2);
    }
    #rotateNotice h2 {
      color: #5f4e34;
      font-size: 1.24rem;
      margin-bottom: 8px;
      font-family: 'Lilita One', cursive;
      letter-spacing: 0.3px;
    }
    #rotateNotice p {
      color: #6f6049;
      font-size: 0.98rem;
      line-height: 1.4;
    }
    body.landscape-block #rotateNotice { display: flex; }
    body.landscape-block #app,
    body.landscape-block #toast,
    body.landscape-block #ghost {
      visibility: hidden;
      pointer-events: none;
    }
    body.prestart #app,
    body.prestart #toast,
    body.prestart #ghost {
      opacity: 0;
      pointer-events: none;
    }
    body.prestart #app {
      --app-reveal-y: 10px;
      --app-reveal-scale: 0.985;
      filter: blur(16px) saturate(0.94);
    }
    body.prestart {
      background: var(--notebook-page-bg);
      background-color: #f7f7f1;
      background-size: var(--notebook-page-bg-size);
    }
    #app,
    #toast,
    #ghost {
      transition:
        opacity 4.2s cubic-bezier(0.22, 1, 0.36, 1),
        transform 3.2s cubic-bezier(0.22, 1, 0.36, 1),
        filter 3.2s cubic-bezier(0.22, 1, 0.36, 1);
    }

    /* ── Splash screen ── */
    #splash {
      position: fixed; inset: 0; z-index: 9999;
      background:
        radial-gradient(120% 95% at 50% 0%, #fbf5e8 0%, #efe5cf 56%, #e4d8c3 100%);
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 0;
      transition: opacity 0.18s ease;
    }
    #splash.hide { opacity: 0; pointer-events: none; }
    #splash-logo { display: none; }
    .splash-stage {
      display: none;
    }
    .splash-track {
      width: 100%;
      min-height: 112px;
      padding: 18px 20px;
      border-radius: 28px;
      background: rgba(255, 249, 234, 0.88);
      border: 2px solid rgba(210, 201, 180, 0.8);
      box-shadow: 0 4px 24px rgba(95, 78, 52, 0.12);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 14px;
      backdrop-filter: blur(6px);
    }
    .splash-chip {
      width: 46px;
      height: 46px;
      border-radius: 14px;
      display: inline-block;
      box-shadow: 0 3px 0 rgba(96, 75, 40, 0.24), 0 8px 12px rgba(0,0,0,0.1);
      animation: splashFloat 1.2s ease-in-out infinite;
    }
    .splash-chip-forward { background: linear-gradient(180deg, #80dc7a 0%, #4ea950 100%); animation-delay: 0s; }
    .splash-chip-left { background: linear-gradient(180deg, #ffd865 0%, #f0b51f 100%); animation-delay: 0.12s; }
    .splash-chip-right { background: linear-gradient(180deg, #ff837c 0%, #df4a42 100%); animation-delay: 0.24s; }
    .splash-chip-function { background: linear-gradient(180deg, #7bc4ff 0%, #2b8fd4 100%); animation-delay: 0.36s; }
    .splash-kicker {
      color: #6c5b41;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.88rem;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }
    .splash-loader {
      width: min(180px, 60vw);
      height: 6px;
      border-radius: 999px;
      background: rgba(95, 78, 52, 0.14);
      overflow: hidden;
    }
    .splash-loader span {
      display: block;
      width: 42%;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, #3f9a62 0%, #2b8fd4 100%);
      animation: splashLoad 1.15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    }

    #startGate {
      position: fixed;
      inset: 0;
      z-index: 9800;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 18px;
      padding: 24px;
      background: var(--notebook-page-bg);
      background-color: #f7f7f1;
      background-size: var(--notebook-page-bg-size);
      opacity: 0;
      transform: scale(1);
      filter: blur(0px) saturate(1);
      pointer-events: none;
      transition:
        opacity 1.65s cubic-bezier(0.22, 1, 0.36, 1),
        transform 1.65s cubic-bezier(0.22, 1, 0.36, 1),
        filter 1.65s cubic-bezier(0.22, 1, 0.36, 1);
    }
    #startGate.show {
      display: flex;
      opacity: 1;
      pointer-events: auto;
    }
    #startGate.show.hiding {
      opacity: 0;
      transform: scale(1.025);
      filter: blur(14px) saturate(0.92);
      pointer-events: none;
    }
    #startGate .start-title {
      display: flex;
      align-items: center;
      gap: 2px;
      margin: 0;
    }
    #startGate .start-title span {
      font-family: 'Lilita One', cursive, Arial Black, sans-serif;
      font-size: min(22vw, 110px);
      line-height: 1;
      display: inline-block;
    }
    #startGate .start-hero {
      position: relative;
      width: min(92vw, 560px);
      min-height: clamp(148px, 34vw, 240px);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      gap: 10px;
      margin-bottom: 4px;
    }
    #startGate .start-bubble-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: center;
      gap: clamp(14px, 5vw, 34px);
      width: 100%;
    }
    body.tutorial-menu-locked #startBoksBtn,
    body.tutorial-menu-locked #startGameBtn {
      display: none;
    }
    body.tutorial-menu-locked #startGate .start-bubble-row {
      gap: 0;
    }
    body.tutorial-menu-reveal-sequence #startGate .start-bubble-row {
      gap: clamp(14px, 5vw, 34px);
    }
    #startGate .start-actions {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
    }
    #customLevelsPanel {
      width: 100%;
      max-width: 460px;
      padding: 12px;
      border-radius: 18px;
      background: rgba(255, 249, 234, 0.9);
      border: 2px solid rgba(210, 201, 180, 0.9);
      box-shadow: 0 2px 0 #cdc2ab, 0 8px 14px rgba(95, 78, 52, 0.12);
      backdrop-filter: blur(4px);
      display: none;
    }
    body.editor-mode #customLevelsPanel {
      display: block;
    }
    #levelThemePanel {
      width: 100%;
      max-width: 460px;
      padding: 12px;
      border-radius: 18px;
      background: rgba(255, 249, 234, 0.9);
      border: 2px solid rgba(210, 201, 180, 0.9);
      box-shadow: 0 2px 0 #cdc2ab, 0 8px 14px rgba(95, 78, 52, 0.12);
      backdrop-filter: blur(4px);
      display: none;
    }
    body.editor-mode.editor-style-open #levelThemePanel {
      display: block;
    }
    .style-panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 10px;
    }
    .style-panel-head h3 {
      color: #5f4e34;
      font-size: 0.95rem;
    }
    #closeStyleEditorBtn {
      min-height: 32px;
      padding: 0 10px;
      border: 2px solid var(--panel-edge);
      border-radius: 999px;
      background: linear-gradient(180deg, #fff6df 0%, var(--panel-bg) 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.78rem;
      font-weight: 700;
      box-shadow: 0 2px 0 #cdc2ab, 0 4px 8px rgba(95, 78, 52, 0.14);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    #themeTargetInfo {
      margin-bottom: 10px;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.78rem;
      color: #7f6d50;
      letter-spacing: 0.01em;
    }
    #elementPalettePanel {
      width: 100%;
      max-width: 460px;
      padding: 12px;
      border-radius: 18px;
      background: rgba(255, 249, 234, 0.9);
      border: 2px solid rgba(210, 201, 180, 0.9);
      box-shadow: 0 2px 0 #cdc2ab, 0 8px 14px rgba(95, 78, 52, 0.12);
      backdrop-filter: blur(4px);
      display: none;
    }
    body.editor-mode #elementPalettePanel {
      display: block;
    }
    .custom-levels-head h3 {
      color: #5f4e34;
      font-size: 0.95rem;
      margin-bottom: 10px;
    }
    #themePicker {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
    }
    #characterPicker {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-top: 4px;
    }
    .theme-choice {
      width: 100%;
      border: 2px solid rgba(210, 201, 180, 0.95);
      border-radius: 16px;
      background: linear-gradient(180deg, #fffdf6 0%, #f1e6d1 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 2px 0 #cdc2ab, 0 6px 10px rgba(95, 78, 52, 0.1);
      padding: 8px 10px;
      display: grid;
      grid-template-columns: 54px 1fr;
      gap: 10px;
      align-items: center;
      cursor: pointer;
      text-align: left;
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
    }
    .theme-choice-art {
      width: 54px;
      height: 54px;
      border-radius: 14px;
      overflow: hidden;
      border: 1px solid rgba(191, 175, 145, 0.9);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
      display: block;
    }
    .theme-choice-copy {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }
    .theme-choice-title {
      color: #5f4e34;
      font-size: 0.92rem;
      font-weight: 700;
      line-height: 1.15;
    }
    .theme-choice-hint {
      color: #8a775b;
      font-size: 0.74rem;
      line-height: 1.25;
    }
    .theme-choice.active {
      border-color: #76ad4d;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.74), 0 0 0 3px rgba(118, 173, 77, 0.18), 0 2px 0 rgba(118, 173, 77, 0.55);
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
    }
    .theme-choice.active .theme-choice-title {
      color: #3d6e2c;
    }
    .character-choice {
      width: 100%;
      border: 2px solid rgba(210, 201, 180, 0.95);
      border-radius: 16px;
      background: linear-gradient(180deg, #fffdf6 0%, #f1e6d1 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 2px 0 #cdc2ab, 0 6px 10px rgba(95, 78, 52, 0.1);
      padding: 8px 10px;
      display: grid;
      grid-template-columns: 54px 1fr;
      gap: 10px;
      align-items: center;
      cursor: pointer;
      text-align: left;
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      min-height: 66px;
    }
    .character-choice-art {
      width: 54px;
      height: 54px;
      border-radius: 14px;
      border: 1px solid rgba(191, 175, 145, 0.9);
      background: rgba(255, 255, 255, 0.55);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      position: relative;
    }
    .character-choice-art .boks-hero {
      width: 100%;
      height: 100%;
      transform: scale(0.88);
      transform-origin: center;
    }
    .character-choice-copy {
      display: flex;
      flex-direction: column;
      gap: 3px;
      min-width: 0;
    }
    .character-choice-title {
      color: #5f4e34;
      font-size: 0.92rem;
      font-weight: 700;
      line-height: 1.15;
      text-transform: capitalize;
    }
    .character-choice-hint {
      color: #8a775b;
      font-size: 0.74rem;
      line-height: 1.25;
    }
    .character-choice.active {
      border-color: #76ad4d;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.74), 0 0 0 3px rgba(118, 173, 77, 0.18), 0 2px 0 rgba(118, 173, 77, 0.55);
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
    }
    .character-choice.active .character-choice-title {
      color: #3d6e2c;
    }
    .level-hint-item {
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: center;
      gap: 10px;
      min-height: 52px;
      padding: 10px 12px;
      border-radius: 14px;
      border: 2px solid rgba(210, 201, 180, 0.95);
      background: linear-gradient(180deg, #fffdf6 0%, #f3e9d4 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
    }
    .level-hint-copy {
      display: flex;
      flex-direction: column;
      min-width: 0;
      gap: 3px;
    }
    .level-hint-label {
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.84rem;
      font-weight: 700;
      line-height: 1.15;
    }
    .level-hint-hint {
      color: #8a775b;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.72rem;
      line-height: 1.25;
    }
    .level-hint-toggle {
      min-width: 70px;
      min-height: 34px;
      padding: 0 12px;
      border-radius: 999px;
      border: 2px solid rgba(210, 201, 180, 0.95);
      background: linear-gradient(180deg, #fff6df 0%, var(--panel-bg) 100%);
      color: #7a6750;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.8rem;
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 2px 0 #cdc2ab, 0 5px 8px rgba(95, 78, 52, 0.12);
    }
    .level-hint-toggle.active {
      border-color: #76ad4d;
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
      color: #3d6e2c;
      box-shadow: 0 2px 0 rgba(118, 173, 77, 0.55), 0 5px 8px rgba(95, 78, 52, 0.12);
    }
    #themeColorControls {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-top: 4px;
    }
    .theme-color-item {
      display: grid;
      grid-template-columns: 1fr auto auto;
      align-items: center;
      gap: 8px;
      min-height: 44px;
      padding: 7px 8px;
      border-radius: 12px;
      border: 2px solid rgba(210, 201, 180, 0.95);
      background: linear-gradient(180deg, #fffdf6 0%, #f3e9d4 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
    }
    .theme-color-copy {
      display: flex;
      flex-direction: column;
      min-width: 0;
      gap: 1px;
    }
    .theme-color-label {
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.8rem;
      font-weight: 700;
      line-height: 1.2;
    }
    .theme-color-key {
      color: #8b7a5f;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.66rem;
      line-height: 1.2;
      letter-spacing: 0.01em;
    }
    .theme-color-input {
      width: 44px;
      height: 28px;
      border: 1px solid rgba(171, 153, 118, 0.7);
      border-radius: 8px;
      background: #fff;
      cursor: pointer;
    }
    .theme-color-reset,
    #resetThemeColorsBtn,
    #applyThemeStyleBtn {
      min-height: 28px;
      padding: 0 8px;
      border: 2px solid rgba(190, 174, 144, 0.95);
      border-radius: 999px;
      background: linear-gradient(180deg, #fff6df 0%, #efe2c8 100%);
      color: #6d5938;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.72rem;
      font-weight: 700;
      cursor: pointer;
    }
    .theme-color-reset:disabled {
      opacity: 0.45;
      cursor: default;
    }
    #themeColorActions {
      margin-top: 10px;
      display: none;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }
    #resetThemeColorsBtn,
    #applyThemeStyleBtn {
      min-height: 34px;
      padding: 0 12px;
    }
    #applyThemeStyleBtn {
      border-color: #76ad4d;
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
      color: #3d6e2c;
    }
    #applyThemeStyleBtn:disabled {
      opacity: 0.45;
      cursor: default;
    }
    #stylePresetPanel {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-top: 8px;
    }
    .style-preset-save {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: center;
    }
    #stylePresetNameInput {
      min-height: 38px;
      padding: 0 12px;
      border-radius: 12px;
      border: 2px solid rgba(190, 174, 144, 0.95);
      background: linear-gradient(180deg, #fffdf6 0%, #f3e9d4 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.82rem;
      font-weight: 500;
      outline: none;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
    }
    #stylePresetNameInput::placeholder {
      color: #9a886e;
    }
    #saveStylePresetBtn {
      min-height: 38px;
      padding: 0 12px;
      border: 2px solid rgba(190, 174, 144, 0.95);
      border-radius: 999px;
      background: linear-gradient(180deg, #fff6df 0%, #efe2c8 100%);
      color: #6d5938;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.76rem;
      font-weight: 700;
      cursor: pointer;
      white-space: nowrap;
    }
    #stylePresetList {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
    }
    .style-preset-empty {
      padding: 10px 12px;
      border-radius: 12px;
      border: 2px dashed rgba(198, 185, 158, 0.9);
      color: #8a775b;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.74rem;
      line-height: 1.3;
      background: rgba(255, 251, 242, 0.7);
    }
    .style-preset-item {
      display: grid;
      grid-template-columns: 1fr auto auto;
      gap: 8px;
      align-items: center;
      min-height: 48px;
      padding: 8px 10px;
      border-radius: 12px;
      border: 2px solid rgba(210, 201, 180, 0.95);
      background: linear-gradient(180deg, #fffdf6 0%, #f3e9d4 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
    }
    .style-preset-copy {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .style-preset-name {
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.82rem;
      font-weight: 700;
      line-height: 1.15;
    }
    .style-preset-meta {
      color: #8a775b;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.68rem;
      line-height: 1.2;
    }
    .style-preset-apply,
    .style-preset-delete {
      min-height: 30px;
      padding: 0 10px;
      border-radius: 999px;
      border: 2px solid rgba(190, 174, 144, 0.95);
      background: linear-gradient(180deg, #fff6df 0%, #efe2c8 100%);
      color: #6d5938;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.7rem;
      font-weight: 700;
      cursor: pointer;
    }
    .style-preset-apply {
      border-color: #76ad4d;
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
      color: #3d6e2c;
    }
    body.editor-mode.editor-style-open #customLevelsPanel,
    body.editor-mode.editor-style-open #elementPalettePanel {
      display: none !important;
    }
    #customLevelsList {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 8px;
      max-height: 180px;
      overflow-y: auto;
    }
    .editor-level-tile-item {
      position: relative;
      min-width: 0;
    }
    .editor-level-tile {
      width: 100%;
      aspect-ratio: 1;
      border-radius: 16px;
      border: 3px solid #4d8034;
      background: #68ab39;
      color: #f8fff0;
      font-family: 'Lilita One', cursive;
      font-size: 1.35rem;
      line-height: 1;
      cursor: pointer;
      box-shadow: none;
    }
    .editor-level-delete {
      position: absolute;
      top: 6px;
      right: 6px;
      width: 24px;
      height: 24px;
      border: 1px solid rgba(194, 117, 86, 0.95);
      border-radius: 999px;
      background: rgba(255, 244, 240, 0.96);
      color: #a24f34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 1rem;
      line-height: 1;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 1px 3px rgba(95, 78, 52, 0.14);
    }
    .editor-level-delete:hover {
      background: rgba(255, 232, 225, 0.98);
    }
    .editor-level-tile.active {
      border-color: #3d6e25;
      box-shadow: none;
      color: #f8fff0;
    }
    .editor-level-tile.dragging {
      opacity: 0.45;
    }
    .editor-level-tile.drop-target {
      border-style: dashed;
      border-color: #3d6e25;
      background: #7bbc4e;
    }
    .editor-level-tile.theme-level-base,
    .editor-level-tile.theme-level-city,
    .editor-level-tile.theme-level-universe,
    .editor-level-tile.theme-level-zelda-greco,
    .editor-level-tile.theme-level-manuale01,
    .editor-level-tile.theme-level-thomas {
      border-color: #4d8034;
      background: #68ab39;
      box-shadow: none;
      color: #f8fff0;
    }
    .editor-level-tile.theme-level-base.active,
    .editor-level-tile.theme-level-city.active,
    .editor-level-tile.theme-level-universe.active,
    .editor-level-tile.theme-level-zelda-greco.active,
    .editor-level-tile.theme-level-manuale01.active,
    .editor-level-tile.theme-level-thomas.active {
      border-color: #3d6e25;
      box-shadow: none;
      color: #f8fff0;
    }
    .editor-level-tile-empty {
      border-style: dashed;
      border-color: #4d8034;
      background: #68ab39;
      color: #f8fff0;
      font-size: 1.6rem;
    }
    .editor-level-tile-empty.active {
      border-color: #3d6e25;
      color: #f8fff0;
      box-shadow: none;
    }
    #elementPalette {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
    }
    .element-tool {
      width: 100%;
      border: 2px solid rgba(210, 201, 180, 0.95);
      border-radius: 16px;
      background: linear-gradient(180deg, #fffdf6 0%, #f1e6d1 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 2px 0 #cdc2ab, 0 6px 10px rgba(95, 78, 52, 0.1);
      padding: 10px 12px;
      display: grid;
      grid-template-columns: 52px 1fr auto;
      grid-template-areas:
        "icon label status"
        "icon hint hint";
      align-items: center;
      gap: 2px 10px;
      text-align: left;
      cursor: pointer;
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
    }
    .element-tool.active {
      border-color: #76ad4d;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.74), 0 0 0 3px rgba(118, 173, 77, 0.18), 0 2px 0 rgba(118, 173, 77, 0.55);
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
    }
    .element-tool.placed {
      background: linear-gradient(180deg, #fffaf0 0%, #ede2ce 100%);
    }
    .element-tool-icon {
      grid-area: icon;
      width: 52px;
      height: 52px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 14px;
      background: rgba(255,255,255,0.45);
      border: 1px solid rgba(202, 190, 164, 0.9);
    }
    .element-tool-label {
      grid-area: label;
      font-size: 0.9rem;
      font-weight: 700;
    }
    .element-tool-status {
      grid-area: status;
      justify-self: end;
      min-width: 72px;
      padding: 3px 8px;
      border-radius: 999px;
      background: rgba(95, 78, 52, 0.1);
      color: #6b5a43;
      font-size: 0.66rem;
      font-weight: 700;
      text-align: center;
      letter-spacing: 0.05em;
    }
    .element-tool.active .element-tool-status {
      background: rgba(84, 142, 52, 0.16);
      color: #3d6e2c;
    }
    .element-tool-hint {
      grid-area: hint;
      color: #8a775b;
      font-size: 0.72rem;
      line-height: 1.25;
    }
    .element-tool-action {
      width: 100%;
      min-height: 36px;
      border: 2px solid rgba(210, 201, 180, 0.95);
      border-radius: 999px;
      background: linear-gradient(180deg, #fffaf0 0%, #eadfcb 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 2px 0 #cdc2ab;
      color: #6b5a43;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.78rem;
      font-weight: 700;
      cursor: pointer;
    }
    .element-tool-action--danger {
      border-color: rgba(190, 118, 96, 0.72);
      background: linear-gradient(180deg, #fff4ed 0%, #f0d9cc 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 2px 0 rgba(190, 118, 96, 0.36);
      color: #8a4c39;
    }
    .element-tool-action:active {
      transform: translateY(1px);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 1px 0 #cdc2ab;
    }
    .editor-setup-card {
      border: 2px solid rgba(210, 201, 180, 0.95);
      border-radius: 16px;
      background: linear-gradient(180deg, #fffdf6 0%, #f1e6d1 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), 0 2px 0 #cdc2ab, 0 6px 10px rgba(95, 78, 52, 0.1);
      padding: 10px 12px;
      display: grid;
      gap: 8px;
    }
    .editor-setup-hint {
      padding: 8px 10px;
      border-radius: 12px;
      background: rgba(255, 251, 240, 0.9);
      border: 1px solid rgba(214, 203, 178, 0.92);
      color: #7a6951;
      font-size: 0.75rem;
      line-height: 1.35;
    }
    .editor-decor-summary {
      color: #7f6a50;
      font-size: 0.74rem;
      font-weight: 700;
    }
    .editor-decor-grid {
      display: grid;
      gap: 8px;
    }
    .editor-decor-controls {
      display: grid;
      gap: 8px;
      margin-bottom: 8px;
      padding: 10px;
      border-radius: 12px;
      background: rgba(255, 250, 239, 0.88);
      border: 1px solid rgba(214, 203, 178, 0.92);
    }
    .editor-decor-control {
      display: grid;
      gap: 6px;
      color: #6b5a43;
      font-size: 0.75rem;
      font-weight: 700;
    }
    .editor-decor-control--color {
      grid-template-columns: 1fr auto;
      align-items: center;
    }
    .editor-decor-control-label {
      color: #6b5a43;
    }
    .editor-decor-control-value {
      color: #8a775b;
      justify-self: end;
    }
    .editor-decor-control input[type="range"] {
      width: 100%;
      accent-color: #6ea851;
    }
    .editor-decor-control input[type="color"] {
      width: 42px;
      height: 32px;
      padding: 0;
      border: 1px solid rgba(183, 168, 139, 0.95);
      border-radius: 8px;
      background: transparent;
      cursor: pointer;
    }
    .editor-decor-list {
      display: grid;
      gap: 8px;
      margin-top: 4px;
      padding-top: 4px;
      border-top: 1px dashed rgba(183, 168, 139, 0.72);
    }
    .editor-decor-list-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.72);
      border: 1px solid rgba(214, 203, 178, 0.92);
    }
    .editor-decor-list-copy {
      display: grid;
      gap: 2px;
      min-width: 0;
    }
    .editor-decor-list-label {
      color: #5f4e34;
      font-size: 0.78rem;
      font-weight: 700;
    }
    .editor-decor-list-meta {
      color: #8a775b;
      font-size: 0.7rem;
      line-height: 1.3;
    }
    .editor-decor-remove {
      appearance: none;
      border: 1px solid rgba(194, 117, 86, 0.95);
      background: #fff3ee;
      color: #9a5538;
      border-radius: 999px;
      padding: 6px 10px;
      font-size: 0.74rem;
      font-weight: 700;
      cursor: pointer;
      flex-shrink: 0;
    }
    .decor-tool-icon {
      overflow: hidden;
    }
    .decor-tool-icon--erase {
      background: rgba(255, 244, 236, 0.82);
    }
    .editor-setup-hint strong {
      color: #5f4e34;
      font-weight: 700;
    }
    .editor-setup-title {
      color: #6b5a43;
      font-size: 0.74rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    .editor-orientation-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
    .editor-orientation-btn {
      min-height: 44px;
      border: 2px solid rgba(210, 201, 180, 0.95);
      border-radius: 12px;
      background: linear-gradient(180deg, #fffdf6 0%, #efe3cc 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      cursor: pointer;
    }
    .editor-orientation-btn.active {
      border-color: #76ad4d;
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
      color: #3d6e2c;
      box-shadow: 0 0 0 2px rgba(118, 173, 77, 0.16);
    }
    .editor-orientation-glyph {
      font-size: 1rem;
      line-height: 1;
    }
    .editor-orientation-label {
      font-size: 0.76rem;
      line-height: 1;
    }
    .editor-character-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .editor-character-btn {
      min-height: 34px;
      padding: 0 10px;
      border: 2px solid rgba(210, 201, 180, 0.95);
      border-radius: 999px;
      background: linear-gradient(180deg, #fffdf6 0%, #efe3cc 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.78rem;
      font-weight: 700;
      cursor: pointer;
    }
    .editor-character-btn.active {
      border-color: #76ad4d;
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
      color: #3d6e2c;
      box-shadow: 0 0 0 2px rgba(118, 173, 77, 0.16);
    }
    .custom-level-card,
    .custom-level-empty {
      border-radius: 14px;
      border: 1px solid rgba(210, 201, 180, 0.95);
      background: linear-gradient(180deg, rgba(255,255,255,0.88) 0%, rgba(247,239,221,0.95) 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
    }
    .custom-level-empty {
      grid-column: 1 / -1;
      padding: 14px 12px;
      color: #7a6951;
      font-size: 0.86rem;
      text-align: center;
    }
    .custom-level-card {
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .custom-level-launch {
      border: 0;
      background: transparent;
      text-align: left;
      padding: 0;
      cursor: pointer;
      position: relative;
    }
    .custom-level-thumb {
      width: 100%;
      aspect-ratio: 1;
      border-radius: 14px;
      overflow: hidden;
      border: 1px solid rgba(190, 174, 144, 0.9);
      background: linear-gradient(180deg, #f6f3e8 0%, #ebe2cf 100%);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
      margin-bottom: 8px;
    }
    .custom-level-icon {
      width: 34px;
      height: 34px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 11px;
      background: rgba(255, 249, 234, 0.95);
      border: 1px solid rgba(190, 174, 144, 0.95);
      box-shadow: 0 4px 10px rgba(73, 54, 26, 0.12), inset 0 1px 0 rgba(255,255,255,0.7);
      position: absolute;
      top: 8px;
      right: 8px;
    }
    .custom-level-name {
      color: #5f4e34;
      font-size: 0.86rem;
      font-weight: 700;
      line-height: 1.2;
      min-height: 2.3em;
    }
    .custom-level-meta {
      color: #85745d;
      font-size: 0.72rem;
      margin-top: 4px;
    }
    .custom-level-actions {
      display: flex;
      gap: 6px;
    }
    .custom-level-actions button,
    #cancelSaveLevelBtn,
    #confirmSaveLevelBtn {
      min-height: 32px;
      padding: 0 12px;
      border-radius: 999px;
      border: 2px solid var(--panel-edge);
      background: linear-gradient(180deg, #fff6df 0%, var(--panel-bg) 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.78rem;
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 2px 0 #cdc2ab, 0 5px 8px rgba(95, 78, 52, 0.12);
    }
    .custom-level-actions button {
      flex: 1;
    }
    #startGameBtn,
    #startBoksBtn,
    #startTutorialBtn {
      position: relative;
      right: auto;
      top: auto;
      width: clamp(96px, 18vw, 132px);
      height: clamp(96px, 18vw, 132px);
      border: 0;
      outline: none;
      background: transparent;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      isolation: isolate;
      cursor: pointer;
      transition: transform 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
      -webkit-tap-highlight-color: transparent;
      padding: 0;
      overflow: visible;
      touch-action: manipulation;
      animation: startGoalDrift 5.2s ease-in-out infinite;
    }
    #startGameBtn.start-bubble-hidden,
    #startBoksBtn.start-bubble-hidden {
      opacity: 0;
      transform: translateY(26px) scale(0.68) rotate(-8deg);
      filter: blur(10px) saturate(0.84);
      pointer-events: none;
      animation: none;
    }
    #startGameBtn.start-bubble-revealed,
    #startBoksBtn.start-bubble-revealed {
      animation: startBubbleReveal 820ms cubic-bezier(0.18, 0.9, 0.24, 1.22) both, startGoalDrift 5.2s ease-in-out 860ms infinite;
    }
    #startBoksBtn.start-bubble-revealed {
      animation: startBubbleReveal 820ms cubic-bezier(0.18, 0.9, 0.24, 1.22) both, startGoalDrift 5.8s ease-in-out 860ms infinite;
    }
    #startTutorialBtn.start-bubble-revealed {
      animation: startGoalDrift 6.3s ease-in-out infinite;
    }
    #startBoksBtn {
      animation-duration: 5.8s;
      animation-delay: -2.1s;
      cursor: pointer;
    }
    #startTutorialBtn {
      animation-duration: 6.3s;
      animation-delay: -3.4s;
      cursor: pointer;
    }
    .start-goal-trigger__visual {
      position: relative;
      width: 100%;
      height: 100%;
      display: block;
      filter: drop-shadow(0 12px 18px rgba(255, 204, 105, 0.14));
    }
    .start-boks-trigger__visual {
      filter: drop-shadow(0 12px 18px rgba(72, 161, 126, 0.18));
    }
    .start-tutorial-trigger__visual {
      filter: drop-shadow(0 12px 18px rgba(43, 143, 212, 0.18));
    }
    #startGameBtn .goal-bubble,
    #startTutorialBtn .goal-bubble {
      inset: 0;
    }
    #startBoksBtn .goal-bubble {
      inset: 0;
    }
    #startGameBtn .goal-light__bloom {
      inset: 12%;
      opacity: 0.26;
      background:
        radial-gradient(circle, rgba(255, 247, 170, 0.72) 0%, rgba(255, 230, 129, 0.42) 24%, rgba(171, 224, 235, 0.24) 52%, rgba(171, 224, 235, 0) 74%);
      filter: blur(3px);
    }
    #startGameBtn .goal-light__core {
      width: 18%;
      height: 18%;
      opacity: 0.52;
      box-shadow:
        0 0 8px rgba(255, 237, 143, 0.64),
        0 0 14px rgba(255, 225, 112, 0.32);
    }
    #startBoksBtn .goal-light__bloom {
      inset: 8%;
      opacity: 0.24;
      background:
        radial-gradient(circle, rgba(212, 255, 230, 0.78) 0%, rgba(127, 224, 180, 0.42) 30%, rgba(177, 236, 202, 0.18) 58%, rgba(177, 236, 202, 0) 76%);
      filter: blur(4px);
    }
    #startBoksBtn .goal-light__core {
      width: 16%;
      height: 16%;
      opacity: 0.42;
      background:
        radial-gradient(circle, rgba(255,255,255,0.96) 0%, rgba(199,255,224,0.82) 38%, rgba(81,199,151,0.5) 68%, rgba(81,199,151,0) 100%);
      box-shadow:
        0 0 9px rgba(165, 245, 204, 0.6),
        0 0 16px rgba(109, 213, 139, 0.2);
    }
    #startBoksBtn .goal-light__speck {
      opacity: 0.24;
      background: radial-gradient(circle, rgba(255,255,255,0.96) 0%, rgba(197,255,223,0.74) 44%, rgba(197,255,223,0) 72%);
      box-shadow: 0 0 10px rgba(94, 220, 164, 0.36);
    }
    #startGameBtn .goal-bubble__glow {
      width: 86%;
      height: 86%;
      opacity: 0.66;
      background:
        radial-gradient(circle, rgba(255,244,168,0.88) 0%, rgba(255,228,118,0.34) 34%, rgba(160,223,232,0.24) 58%, rgba(160,223,232,0) 74%);
      filter: blur(1px);
    }
    #startGameBtn .goal-bubble__shell {
      width: 86%;
      height: 86%;
      background:
        radial-gradient(circle at 33% 28%, rgba(255,255,255,0.96) 0 8%, rgba(255,255,255,0) 10%),
        radial-gradient(circle at 70% 72%, rgba(154, 220, 211, 0.64) 0 18%, rgba(154, 220, 211, 0) 20%),
        radial-gradient(circle at 50% 52%, rgba(241, 248, 209, 0.42) 0 54%, rgba(204, 239, 221, 0.22) 68%, rgba(255,255,255,0.06) 79%, rgba(255,255,255,0) 84%);
      border: 1px solid rgba(255,255,255,0.82);
      box-shadow:
        inset 0 1px 3px rgba(255,255,255,0.52),
        0 0 10px rgba(189, 245, 255, 0.2);
    }
    #startBoksBtn .goal-bubble__glow {
      width: 86%;
      height: 86%;
      opacity: 0.58;
      background:
        radial-gradient(circle, rgba(196,255,222,0.86) 0%, rgba(77, 199, 145, 0.32) 35%, rgba(154, 229, 184, 0.16) 60%, rgba(154, 229, 184, 0) 76%);
      filter: blur(1.5px);
    }
    #startTutorialBtn .goal-light__bloom {
      inset: 10%;
      opacity: 0.25;
      background:
        radial-gradient(circle, rgba(225, 245, 255, 0.8) 0%, rgba(117, 197, 238, 0.42) 32%, rgba(255, 231, 142, 0.2) 58%, rgba(255, 231, 142, 0) 76%);
      filter: blur(4px);
    }
    #startTutorialBtn .goal-light__core {
      width: 16%;
      height: 16%;
      opacity: 0.44;
      background:
        radial-gradient(circle, rgba(255,255,255,0.98) 0%, rgba(218,244,255,0.82) 38%, rgba(70,170,222,0.48) 68%, rgba(70,170,222,0) 100%);
      box-shadow:
        0 0 9px rgba(166, 224, 255, 0.58),
        0 0 16px rgba(255, 218, 96, 0.18);
    }
    #startBoksBtn .goal-bubble__shell {
      width: 86%;
      height: 86%;
      overflow: hidden;
      background:
        radial-gradient(circle at 24% 20%, rgba(255,255,255,0.98) 0 8%, rgba(255,255,255,0) 11%),
        radial-gradient(circle at 44% 60%, rgba(232, 255, 225, 0.52) 0 46%, rgba(164, 238, 210, 0.26) 62%, rgba(255,255,255,0.08) 77%, rgba(255,255,255,0) 84%);
      border: 1px solid rgba(235,255,245,0.86);
      box-shadow:
        inset 0 1px 4px rgba(255,255,255,0.58),
        0 0 12px rgba(112, 224, 178, 0.26),
        0 0 26px rgba(109, 213, 139, 0.1);
    }
    .start-pencil-mark {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 46%;
      height: 12%;
      transform: translate(-50%, -50%) rotate(-34deg);
      border-radius: 999px 5px 5px 999px;
      background:
        linear-gradient(90deg, #f67f72 0 14%, #f7e3b6 14% 22%, #f3c94f 22% 74%, #d99a24 74% 82%, #f7e3b6 82% 100%);
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.58),
        inset 0 -2px 0 rgba(136, 91, 30, 0.18),
        0 2px 4px rgba(45, 93, 64, 0.22);
    }
    .start-pencil-mark::before {
      content: '';
      position: absolute;
      right: -12%;
      top: 50%;
      width: 18%;
      height: 150%;
      transform: translateY(-50%);
      clip-path: polygon(0 0, 100% 50%, 0 100%);
      background: linear-gradient(90deg, #f6dba6 0 62%, #4f3d2d 63% 100%);
    }
    .start-pencil-mark::after {
      content: '';
      position: absolute;
      left: 27%;
      top: 50%;
      width: 46%;
      height: 2px;
      transform: translateY(-50%);
      border-radius: 999px;
      background: rgba(126, 84, 24, 0.28);
    }
    #startTutorialBtn .goal-bubble__glow {
      width: 86%;
      height: 86%;
      opacity: 0.58;
      background:
        radial-gradient(circle, rgba(218,244,255,0.88) 0%, rgba(83, 178, 228, 0.32) 34%, rgba(255, 224, 126, 0.18) 61%, rgba(255, 224, 126, 0) 77%);
      filter: blur(1.5px);
    }
    #startTutorialBtn .goal-bubble__shell {
      width: 86%;
      height: 86%;
      overflow: hidden;
      background:
        radial-gradient(circle at 26% 22%, rgba(255,255,255,0.98) 0 8%, rgba(255,255,255,0) 11%),
        radial-gradient(circle at 58% 58%, rgba(228, 248, 255, 0.56) 0 44%, rgba(144, 213, 235, 0.26) 62%, rgba(255,244,188,0.12) 78%, rgba(255,255,255,0) 84%);
      border: 1px solid rgba(236,248,255,0.88);
      box-shadow:
        inset 0 1px 4px rgba(255,255,255,0.58),
        0 0 12px rgba(120, 202, 238, 0.26),
        0 0 26px rgba(255, 218, 96, 0.1);
    }
    .start-tutorial-mark {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 46%;
      height: 34%;
      transform: translate(-50%, -50%);
      border-radius: 9px 9px 12px 12px;
      background:
        linear-gradient(90deg, rgba(255, 246, 196, 0.96) 0 47%, rgba(245, 230, 166, 0.96) 48% 52%, rgba(255, 249, 213, 0.96) 53% 100%);
      box-shadow:
        inset 0 -2px 0 rgba(197, 160, 72, 0.25),
        0 2px 3px rgba(72, 79, 91, 0.18);
    }
    .start-tutorial-mark::before,
    .start-tutorial-mark::after {
      content: '';
      position: absolute;
      top: 8px;
      width: 26%;
      height: 3px;
      border-radius: 999px;
      background: rgba(74, 129, 153, 0.42);
      box-shadow: 0 7px 0 rgba(74, 129, 153, 0.28);
    }
    .start-tutorial-mark::before {
      left: 15%;
    }
    .start-tutorial-mark::after {
      right: 15%;
    }
    #startGameBtn .goal-bubble__flower {
      width: 50%;
      height: 50%;
      background:
        radial-gradient(circle at 50% 50%, #f4c32d 0 16%, #d79b16 17%, transparent 23%),
        radial-gradient(circle at 50% 8%, rgba(255,112,112,0.98) 0 15%, rgba(220,72,72,0.98) 16%, transparent 20%),
        radial-gradient(circle at 86% 38%, rgba(255,92,92,0.98) 0 15%, rgba(220,72,72,0.98) 16%, transparent 20%),
        radial-gradient(circle at 74% 84%, rgba(255,86,86,0.98) 0 15%, rgba(220,72,72,0.98) 16%, transparent 20%),
        radial-gradient(circle at 26% 84%, rgba(255,102,102,0.98) 0 15%, rgba(220,72,72,0.98) 16%, transparent 20%),
        radial-gradient(circle at 14% 38%, rgba(255,80,80,0.98) 0 15%, rgba(220,72,72,0.98) 16%, transparent 20%);
      filter: drop-shadow(0 1px 1px rgba(160, 98, 12, 0.22));
    }
    @media (hover: hover) and (pointer: fine) {
      #startGameBtn:hover {
        transform: scale(1.06) translateY(-4px);
        filter: saturate(1.06) brightness(1.03);
      }
      #startBoksBtn:hover,
      #startTutorialBtn:hover {
        filter: saturate(1.05) brightness(1.02);
      }
      #startGameBtn:hover .goal-bubble__shell {
        box-shadow:
          inset 0 1px 3px rgba(255,255,255,0.58),
          0 0 14px rgba(189, 245, 255, 0.34),
          0 0 28px rgba(255, 222, 115, 0.2);
      }
      #startGameBtn:hover .goal-bubble__flower {
        transform: translate(-50%, -50%) scale(1.08);
        filter: drop-shadow(0 2px 2px rgba(160, 98, 12, 0.26));
      }
      #startGameBtn:hover .goal-bubble__glow {
        opacity: 0.82;
        transform: scale(1.05);
      }
      #startBoksBtn:hover .goal-bubble__glow,
      #startTutorialBtn:hover .goal-bubble__glow {
        opacity: 0.72;
        transform: scale(1.04);
      }
    }
    #startGameBtn:active,
    #startGameBtn.is-pressed,
    #startBoksBtn:active,
    #startBoksBtn.is-pressed,
    #startTutorialBtn:active,
    #startTutorialBtn.is-pressed {
      transform: scale(0.96);
      filter: saturate(0.98) brightness(0.98);
    }
    #startGameBtn:disabled,
    #startTutorialBtn:disabled {
      cursor: default;
    }
    #startGameBtn:disabled:not(.is-pressed),
    #startTutorialBtn:disabled:not(.is-pressed) {
      filter: saturate(0.96);
    }
    #startGameBtn:focus-visible,
    #startBoksBtn:focus-visible,
    #startTutorialBtn:focus-visible {
      outline: 2px solid rgba(95, 78, 52, 0.55);
      outline-offset: 4px;
    }
    #startGameBtn.is-popping,
    #startBoksBtn.is-popping,
    #startTutorialBtn.is-popping {
      pointer-events: none;
      animation: none;
    }
    #startGameBtn.is-popping .goal-bubble__shell,
    #startGameBtn.is-popping .goal-bubble__flower,
    #startGameBtn.is-popping .goal-bubble__glow,
    #startGameBtn.is-popping .goal-light__bloom,
    #startGameBtn.is-popping .goal-light__core,
    #startGameBtn.is-popping .goal-light__rays,
    #startGameBtn.is-popping .goal-light__speck,
    #startBoksBtn.is-popping .goal-bubble__shell,
    #startBoksBtn.is-popping .goal-bubble__glow,
    #startBoksBtn.is-popping .goal-light__bloom,
    #startBoksBtn.is-popping .goal-light__core,
    #startBoksBtn.is-popping .goal-light__rays,
    #startBoksBtn.is-popping .goal-light__speck,
    #startTutorialBtn.is-popping .goal-bubble__shell,
    #startTutorialBtn.is-popping .goal-bubble__glow,
    #startTutorialBtn.is-popping .goal-light__bloom,
    #startTutorialBtn.is-popping .goal-light__core,
    #startTutorialBtn.is-popping .goal-light__rays,
    #startTutorialBtn.is-popping .goal-light__speck {
      animation: none;
    }
    #startGameBtn.is-popping .goal-light__bloom,
    #startBoksBtn.is-popping .goal-light__bloom,
    #startTutorialBtn.is-popping .goal-light__bloom {
      animation: goalLightBloomPop 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-light__core,
    #startBoksBtn.is-popping .goal-light__core,
    #startTutorialBtn.is-popping .goal-light__core {
      animation: goalLightCorePop 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-light__rays,
    #startBoksBtn.is-popping .goal-light__rays,
    #startTutorialBtn.is-popping .goal-light__rays {
      animation: goalLightRaysPop 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-light__speck--a,
    #startBoksBtn.is-popping .goal-light__speck--a,
    #startTutorialBtn.is-popping .goal-light__speck--a {
      animation: goalLightSpeckA 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-light__speck--b,
    #startBoksBtn.is-popping .goal-light__speck--b,
    #startTutorialBtn.is-popping .goal-light__speck--b {
      animation: goalLightSpeckB 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-light__speck--c,
    #startBoksBtn.is-popping .goal-light__speck--c,
    #startTutorialBtn.is-popping .goal-light__speck--c {
      animation: goalLightSpeckC 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-light__speck--d,
    #startBoksBtn.is-popping .goal-light__speck--d,
    #startTutorialBtn.is-popping .goal-light__speck--d {
      animation: goalLightSpeckD 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__shell,
    #startBoksBtn.is-popping .goal-bubble__shell,
    #startTutorialBtn.is-popping .goal-bubble__shell {
      animation: goalBubblePop 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__flower {
      animation: goalBubbleFlowerPop 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__glow,
    #startBoksBtn.is-popping .goal-bubble__glow,
    #startTutorialBtn.is-popping .goal-bubble__glow {
      animation: goalBubbleGlowPop 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__burst--ring,
    #startBoksBtn.is-popping .goal-bubble__burst--ring,
    #startTutorialBtn.is-popping .goal-bubble__burst--ring {
      animation: goalBubbleRingPop 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__burst--a,
    #startBoksBtn.is-popping .goal-bubble__burst--a,
    #startTutorialBtn.is-popping .goal-bubble__burst--a {
      animation: goalBubbleShardA 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__burst--b,
    #startBoksBtn.is-popping .goal-bubble__burst--b,
    #startTutorialBtn.is-popping .goal-bubble__burst--b {
      animation: goalBubbleShardB 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__burst--c,
    #startBoksBtn.is-popping .goal-bubble__burst--c,
    #startTutorialBtn.is-popping .goal-bubble__burst--c {
      animation: goalBubbleShardC 0.74s ease-out forwards;
    }
    #startGameBtn.is-popping .goal-bubble__burst--d,
    #startBoksBtn.is-popping .goal-bubble__burst--d,
    #startTutorialBtn.is-popping .goal-bubble__burst--d {
      animation: goalBubbleShardD 0.74s ease-out forwards;
    }
    @media (max-width: 520px) {
      #startGate .start-hero {
        min-height: 212px;
      }
      #startGameBtn,
      #startBoksBtn,
      #startTutorialBtn {
        width: clamp(86px, 28vw, 104px);
        height: clamp(86px, 28vw, 104px);
      }
      #startGate .start-bubble-row {
        gap: 16px;
      }
    }
    @keyframes startBubbleReveal {
      0% {
        opacity: 0;
        transform: translateY(26px) scale(0.68) rotate(-8deg);
        filter: blur(10px) saturate(0.84);
      }
      22% {
        opacity: 1;
        transform: translateY(8px) scale(0.88) rotate(5deg);
        filter: blur(2px) saturate(0.94);
      }
      54% {
        opacity: 1;
        transform: translateY(-14px) scale(1.16) rotate(-4deg);
        filter: blur(0) saturate(1.08);
      }
      76% {
        opacity: 1;
        transform: translateY(3px) scale(0.97) rotate(1.6deg);
        filter: none;
      }
      100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: none;
      }
    }
    #startEditorBtn,
    #openTutorialEditorBtn,
    #openSpritePreviewBtn,
    #openVfxToolBtn,
    #openLottieInspectorBtn,
    #exitEditorBtn,
    #editorToolbar button {
      border: 2px solid var(--panel-edge);
      background: linear-gradient(180deg, #fff6df 0%, var(--panel-bg) 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-weight: 700;
      border-radius: 999px;
      box-shadow: 0 3px 0 #cdc2ab, 0 6px 10px rgba(95, 78, 52, 0.16);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    #startEditorBtn,
    #openTutorialEditorBtn,
    #openSpritePreviewBtn,
    #openVfxToolBtn {
      min-width: 148px;
      min-height: 42px;
      padding: 0 16px;
      font-size: 0.96rem;
    }
    #openSpritePreviewBtn,
    #openTutorialEditorBtn,
    #openVfxToolBtn,
    #openLottieInspectorBtn {
      min-width: 172px;
    }
    #editorToolbar {
      width: 100%;
      max-width: 460px;
      display: none;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      padding: 0 2px;
      min-height: 0;
      background: transparent;
      border: 0;
      box-shadow: none;
    }
    body.editor-mode #editorToolbar {
      display: flex;
    }
    #editorToolbar button {
      width: 100%;
      min-height: 40px;
      justify-self: stretch;
    }
    body.editor-style-open #openStyleEditorBtn {
      border-color: #76ad4d;
      box-shadow: 0 2px 0 rgba(118, 173, 77, 0.56), 0 5px 10px rgba(95, 78, 52, 0.14);
      background: linear-gradient(180deg, #f5ffe9 0%, #e0efc4 100%);
      color: #3d6e2c;
    }
    @media (pointer: fine) and (min-width: 1120px) {
      body.editor-mode #editorToolbar {
        display: grid;
      }
    }
    #exitEditorBtn {
      min-width: 74px;
      padding: 0 12px;
      font-size: 0.9rem;
    }
    #exportLevelsBtn,
    #importLevelsBtn,
    #resetLevelsBtn,
    #saveLevelBtn,
    #openStyleEditorBtn,
    #openVfxEditorBtn,
    #openLottieInspectorBtnEditor {
      min-width: 84px;
      padding: 0 12px;
      font-size: 0.84rem;
    }
    #resetLevelsBtn {
      color: #8a4c39;
    }
    #editorToolbar button:active,
    #startEditorBtn:active,
    #openTutorialEditorBtn:active,
    #openSpritePreviewBtn:active,
    #openVfxToolBtn:active,
    #openLottieInspectorBtn:active,
    #exitEditorBtn:active,
    .custom-level-actions button:active,
    #cancelSaveLevelBtn:active,
    #confirmSaveLevelBtn:active,
    .custom-level-launch:active {
      transform: translateY(2px);
      box-shadow: 0 1px 0 #cdc2ab, 0 3px 7px rgba(95, 78, 52, 0.14);
    }
    body.editor-mode #runBtn.editor-run-locked {
      opacity: 0.45;
      pointer-events: none;
      filter: grayscale(0.2);
    }
    body.editor-mode .ablock.tutorial-focus {
      animation: none;
      filter: drop-shadow(0 3px 0 rgba(96, 75, 40, 0.3)) drop-shadow(0 6px 8px rgba(0,0,0,0.13));
    }
    body.editor-mode .ablock.tutorial-focus .available-block-vfx__glow,
    body.editor-mode .ablock.tutorial-focus .available-block-vfx__spark,
    body.editor-mode .ablock.tutorial-focus .available-block-vfx::before {
      animation: none;
      opacity: 0;
    }
    body.editor-mode #blocksRow.editor-blocks-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      flex-wrap: wrap;
      min-height: 94px;
    }
    .editor-block-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      position: relative;
    }
    .editor-block-toggle {
      min-width: 48px;
      height: 24px;
      padding: 0 8px;
      border-radius: 999px;
      border: 1px solid rgba(95, 78, 52, 0.24);
      background: linear-gradient(180deg, #fffaf0 0%, #efe5d2 100%);
      color: #6d5a3d;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.72rem;
      font-weight: 700;
      cursor: pointer;
    }
    .editor-block-item.enabled .editor-block-toggle {
      background: linear-gradient(180deg, #eaf7df 0%, #d3eeb6 100%);
      color: #356b2f;
    }
    .editor-block-item.disabled .editor-block-toggle {
      background: linear-gradient(180deg, #f4eee3 0%, #e6dcc8 100%);
      color: #7c6b54;
    }
    body.editor-mode .pslot {
      cursor: pointer;
    }
    body.editor-mode .pslot.locked {
      opacity: 0.42;
      filter: saturate(0.55);
      pointer-events: auto;
    }
    body.editor-mode .pslot.locked::after {
      content: 'OFF';
      position: absolute;
      right: 6px;
      top: 5px;
      font-size: 0.55rem;
      font-weight: 700;
      color: rgba(95, 78, 52, 0.72);
      letter-spacing: 0.05em;
    }
    body.editor-mode .pslot:not(.locked)::after {
      content: 'ON';
      position: absolute;
      right: 6px;
      top: 5px;
      font-size: 0.55rem;
      font-weight: 700;
      color: rgba(54, 124, 62, 0.82);
      letter-spacing: 0.05em;
    }
    @media (max-width: 460px) {
      #quickEditorBtn {
        min-width: 72px;
        min-height: 34px;
        padding: 0 10px;
        font-size: 0.78rem;
      }
      #editorToolbar {
        flex-wrap: wrap;
        justify-content: center;
      }
      #customLevelsList {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }
    }
    #settingsModal {
      position: fixed;
      inset: 0;
      z-index: 13050;
      display: grid;
      place-items: center;
      padding: calc(18px + var(--safe-top)) 16px calc(18px + var(--safe-bottom));
      opacity: 0;
      pointer-events: none;
      background:
        radial-gradient(120% 90% at 50% 0%, rgba(255, 248, 232, 0.38) 0%, rgba(235, 228, 209, 0.22) 44%, rgba(88, 73, 45, 0.16) 100%);
      backdrop-filter: blur(14px) saturate(0.86);
      transition: opacity 220ms ease;
    }
    #settingsModal.show {
      opacity: 1;
      pointer-events: auto;
    }
    .settings-shell {
      width: min(430px, calc(100vw - 32px));
      max-height: min(720px, calc(var(--app-vh) - 36px - var(--safe-top) - var(--safe-bottom)));
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .settings-card {
      position: relative;
      width: 100%;
      max-height: 100%;
      overflow: auto;
      padding: 20px 18px 18px;
      border-radius: 28px;
      border: 1px solid rgba(210, 201, 180, 0.88);
      background: linear-gradient(180deg, rgba(255, 252, 244, 0.62) 0%, rgba(246, 238, 221, 0.54) 100%);
      backdrop-filter: blur(10px) saturate(0.9);
      box-shadow: 0 24px 48px rgba(62, 48, 28, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.76);
      font-family: 'Fredoka', system-ui, sans-serif;
      transform: translateY(16px) scale(0.985);
      transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
    }
    #settingsModal.show .settings-card {
      transform: translateY(0) scale(1);
    }
    .settings-card::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      pointer-events: none;
      background: radial-gradient(120% 78% at 50% 0%, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0) 48%);
    }
    .settings-close {
      appearance: none;
      position: absolute;
      top: 14px;
      right: 14px;
      width: 38px;
      height: 38px;
      border: 0;
      border-radius: 999px;
      background: rgba(255, 251, 240, 0.92);
      color: #7a6750;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 1.55rem;
      line-height: 1;
      box-shadow: 0 3px 10px rgba(95, 78, 52, 0.14);
      cursor: pointer;
    }
    .settings-head {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      margin-bottom: 14px;
      padding-top: 4px;
      text-align: center;
    }
    .settings-brand {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 1px;
      min-width: 112px;
      min-height: 48px;
      padding: 6px 14px;
      border-radius: 16px;
      background: rgba(255, 248, 231, 0.92);
      box-shadow: 0 2px 0 rgba(205, 194, 171, 0.9), 0 8px 18px rgba(95, 78, 52, 0.12);
    }
    .settings-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .settings-row {
      appearance: none;
      width: 100%;
      min-height: 68px;
      padding: 0 14px;
      border: 1px solid rgba(214, 204, 182, 0.92);
      border-radius: 22px;
      background: rgba(255, 252, 245, 0.88);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 8px 14px rgba(95, 78, 52, 0.08);
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) auto;
      align-items: center;
      gap: 12px;
      text-align: left;
      color: inherit;
      font-family: 'Fredoka', system-ui, sans-serif;
      cursor: pointer;
      transition: transform 0.14s ease, box-shadow 0.18s ease, background-color 0.18s ease;
    }
    .settings-row--volume {
      grid-template-columns: 42px minmax(0, 1fr) minmax(132px, 150px);
      cursor: default;
    }
    .settings-row:active {
      transform: scale(0.985);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 4px 8px rgba(95, 78, 52, 0.08);
    }
    .settings-row--volume:active {
      transform: none;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 8px 14px rgba(95, 78, 52, 0.08);
    }
    .settings-row__icon {
      width: 42px;
      height: 42px;
      border-radius: 14px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(243, 234, 216, 0.92) 100%);
      border: 1px solid rgba(214, 204, 182, 0.88);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.78), 0 4px 8px rgba(95, 78, 52, 0.08);
      overflow: hidden;
      pointer-events: none;
    }
    .settings-row__icon img {
      display: block;
      width: 24px;
      height: 24px;
    }
    .settings-row__copy {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 0;
    }
    .settings-row__copy strong {
      color: #5b4b32;
      font-size: 1rem;
      font-weight: 700;
      letter-spacing: 0.01em;
    }
    .settings-switch {
      width: 58px;
      height: 34px;
      padding: 4px;
      border-radius: 999px;
      background: rgba(206, 197, 178, 0.84);
      box-shadow: inset 0 2px 4px rgba(88, 69, 39, 0.12);
      transition: background-color 0.18s ease;
    }
    .settings-switch__thumb {
      display: block;
      width: 26px;
      height: 26px;
      border-radius: 999px;
      background: linear-gradient(180deg, #fffdf7 0%, #f0e5d2 100%);
      box-shadow: 0 3px 8px rgba(83, 63, 31, 0.18);
      transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .settings-switch.is-on {
      background: linear-gradient(180deg, #9ae089 0%, #69b764 100%);
    }
    .settings-switch.is-on .settings-switch__thumb {
      transform: translateX(24px);
    }
    .settings-volume {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      min-width: 0;
    }
    .settings-volume__slider {
      appearance: none;
      width: 100%;
      min-width: 0;
      height: 6px;
      border-radius: 999px;
      background: rgba(191, 176, 146, 0.34);
      outline: none;
    }
    .settings-volume__slider::-webkit-slider-runnable-track {
      height: 6px;
      border-radius: 999px;
      background: linear-gradient(90deg, rgba(130, 198, 122, 0.9) 0%, rgba(105, 183, 100, 0.9) 100%);
    }
    .settings-volume__slider::-webkit-slider-thumb {
      appearance: none;
      width: 18px;
      height: 18px;
      margin-top: -6px;
      border: 1px solid rgba(202, 189, 164, 0.96);
      border-radius: 999px;
      background: linear-gradient(180deg, #fffdf7 0%, #f0e5d2 100%);
      box-shadow: 0 3px 8px rgba(83, 63, 31, 0.18);
    }
    .settings-volume__slider::-moz-range-track {
      height: 6px;
      border: 0;
      border-radius: 999px;
      background: linear-gradient(90deg, rgba(130, 198, 122, 0.9) 0%, rgba(105, 183, 100, 0.9) 100%);
    }
    .settings-volume__slider::-moz-range-thumb {
      width: 18px;
      height: 18px;
      border: 1px solid rgba(202, 189, 164, 0.96);
      border-radius: 999px;
      background: linear-gradient(180deg, #fffdf7 0%, #f0e5d2 100%);
      box-shadow: 0 3px 8px rgba(83, 63, 31, 0.18);
    }
    .settings-volume__value {
      min-width: 42px;
      text-align: right;
      color: #7b694d;
      font-size: 0.8rem;
      font-weight: 700;
      letter-spacing: 0.02em;
    }
    .settings-pill {
      min-width: 62px;
      min-height: 32px;
      padding: 0 12px;
      border-radius: 999px;
      background: rgba(111, 168, 217, 0.14);
      color: #5b6f82;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.8rem;
      font-weight: 700;
      letter-spacing: 0.03em;
    }
    .settings-pill--ghost {
      background: rgba(125, 107, 77, 0.08);
      color: #7b694d;
    }
    .settings-row--quiet {
      background: rgba(255, 250, 242, 0.84);
    }
    .settings-credits {
      margin-top: 12px;
      padding: 14px 16px;
      border-radius: 20px;
      background: rgba(255, 251, 241, 0.82);
      border: 1px solid rgba(213, 202, 180, 0.88);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.76);
    }
    .settings-credits__title {
      color: #5b4b32;
      font-size: 0.94rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }
    .settings-credits__text,
    .settings-credits__meta {
      margin-top: 6px;
      color: #7d6a4e;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.84rem;
      line-height: 1.45;
      white-space: pre-line;
    }
    .settings-credits--warning {
      background: rgba(255, 247, 235, 0.9);
      border-color: rgba(221, 192, 146, 0.88);
    }
    .settings-inline-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 12px;
    }
    .settings-inline-btn {
      appearance: none;
      min-width: 108px;
      min-height: 38px;
      padding: 0 14px;
      border: 1px solid rgba(210, 201, 180, 0.96);
      border-radius: 999px;
      background: rgba(255, 252, 245, 0.92);
      color: #6e5a3f;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.84rem;
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 3px 8px rgba(95, 78, 52, 0.08);
    }
    .settings-inline-btn--primary {
      background: linear-gradient(180deg, #f8e6c5 0%, #eecf96 100%);
      color: #6a4d22;
      border-color: rgba(212, 179, 117, 0.96);
    }
    .settings-actions {
      display: flex;
      justify-content: center;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 16px;
    }
    .settings-secondary-btn {
      appearance: none;
      min-width: 172px;
      min-height: 44px;
      padding: 0 18px;
      border: 2px solid rgba(210, 201, 180, 0.96);
      border-radius: 999px;
      background: linear-gradient(180deg, #fff6df 0%, #efe5d0 100%);
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.92rem;
      font-weight: 700;
      box-shadow: 0 3px 0 #cdc2ab, 0 8px 14px rgba(95, 78, 52, 0.12);
      cursor: pointer;
    }
    .settings-secondary-btn:active,
    .settings-close:active {
      transform: translateY(1px) scale(0.985);
    }
    @media (pointer: fine) {
      .settings-row:hover {
        background: rgba(255, 253, 248, 0.96);
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.84), 0 10px 18px rgba(95, 78, 52, 0.1);
      }
    }
    #endingCinematic {
      position: fixed;
      inset: 0;
      z-index: 13150;
      opacity: 0;
      pointer-events: none;
      transition: opacity 320ms ease;
      --ending-x: 50vw;
      --ending-y: 40vh;
    }
    #endingCinematic.show {
      opacity: 1;
    }
    #endingCinematic .ending-cinematic__veil {
      position: absolute;
      inset: 0;
      background:
        radial-gradient(120% 90% at 50% 0%, rgba(255, 247, 225, 0.18) 0%, rgba(237, 239, 211, 0.14) 44%, rgba(103, 140, 77, 0.12) 100%);
      backdrop-filter: blur(2px) saturate(1.05);
    }
    #endingCinematic .ending-cinematic__sun,
    #endingCinematic .ending-cinematic__ring,
    #endingCinematic .ending-cinematic__spark,
    #endingCinematic .ending-cinematic__petal {
      position: absolute;
      left: var(--ending-x);
      top: var(--ending-y);
      transform: translate(-50%, -50%);
      pointer-events: none;
    }
    #endingCinematic .ending-cinematic__sun {
      width: 44px;
      height: 44px;
      border-radius: 999px;
      background: radial-gradient(circle, rgba(255,255,238,0.98) 0%, rgba(255,236,168,0.88) 36%, rgba(255,228,138,0.28) 62%, rgba(255,228,138,0) 100%);
      box-shadow: 0 0 28px rgba(255, 235, 150, 0.62);
      animation: endingSunPulse 2800ms ease-in-out infinite;
    }
    #endingCinematic .ending-cinematic__ring {
      width: 20px;
      height: 20px;
      border-radius: 999px;
      border: 2px solid rgba(255, 245, 194, 0.92);
      opacity: 0;
      box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
    }
    #endingCinematic.show .ending-cinematic__ring--a {
      animation: endingWave 2800ms ease-out infinite;
    }
    #endingCinematic.show .ending-cinematic__ring--b {
      animation: endingWave 2800ms ease-out 560ms infinite;
    }
    #endingCinematic .ending-cinematic__spark {
      width: 10px;
      height: 10px;
      border-radius: 999px;
      background: radial-gradient(circle, rgba(255,255,255,0.98) 0%, rgba(255,245,184,0.74) 52%, rgba(255,245,184,0) 100%);
      opacity: 0;
      transform:
        translate(-50%, -50%)
        rotate(var(--spark-angle, 0deg))
        translateX(var(--spark-distance, 0px))
        scale(0.35);
    }
    #endingCinematic.show .ending-cinematic__spark {
      animation: endingSparkFloat 2400ms ease-out infinite;
      animation-delay: var(--spark-delay, 0ms);
    }
    #endingCinematic .ending-cinematic__petal {
      width: 14px;
      height: 22px;
      border-radius: 14px 14px 14px 14px / 18px 18px 10px 10px;
      background: linear-gradient(180deg, rgba(255, 248, 214, 0.94) 0%, rgba(255, 214, 156, 0.8) 100%);
      opacity: 0;
      transform:
        translate(-50%, -50%)
        rotate(var(--petal-angle, 0deg))
        translateX(var(--petal-distance, 0px))
        scale(0.35);
      filter: blur(0.3px);
    }
    #endingCinematic.show .ending-cinematic__petal {
      animation: endingPetalDrift 3400ms cubic-bezier(0.22, 1, 0.36, 1) infinite;
      animation-delay: var(--petal-delay, 0ms);
    }
    #endingCinematic .ending-cinematic__message {
      position: absolute;
      left: 50%;
      top: min(18vh, 132px);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      transform: translate(-50%, 8px);
      opacity: 0;
      pointer-events: none;
      text-align: center;
    }
    #endingCinematic.show .ending-cinematic__message {
      animation: endingMessageReveal 2200ms cubic-bezier(0.22, 1, 0.36, 1) 1250ms forwards;
    }
    #endingCinematic .ending-cinematic__thanks {
      color: rgba(92, 77, 51, 0.94);
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: clamp(1.02rem, 2.6vw, 1.4rem);
      font-weight: 600;
      letter-spacing: 0.03em;
      text-shadow: 0 2px 10px rgba(255, 248, 229, 0.45);
      white-space: nowrap;
    }
    #endingCinematic .ending-cinematic__brand {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 2px;
      padding: 8px 16px;
      border-radius: 18px;
      background: rgba(255, 248, 231, 0.72);
      box-shadow: 0 6px 20px rgba(95, 78, 52, 0.12), inset 0 1px 0 rgba(255,255,255,0.7);
      backdrop-filter: blur(6px) saturate(1.04);
    }
    #endingCinematic .ending-cinematic__brand .logo-letter {
      font-size: clamp(2rem, 6vw, 3rem);
    }
    body.ending-cinematic-active #app {
      filter: saturate(1.08) brightness(1.03);
      transform: translateX(var(--app-center-shift-x)) translateY(calc(var(--app-reveal-y) - 4px)) scale(calc(var(--app-reveal-scale) * 1.012));
    }
    body.ending-cinematic-active #gridWrap {
      box-shadow: 0 2px 0 #cdc2ab, 0 16px 28px rgba(95, 78, 52, 0.2), 0 0 42px rgba(255, 230, 145, 0.24);
    }
    body.ending-cinematic-active .cell {
      animation: endingCellWake 1800ms ease-out forwards;
      animation-delay: var(--ending-delay, 0ms);
    }
    body.ending-cinematic-active #blocksRow .ablock {
      animation: endingBlockLift 1800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
      animation-delay: var(--ending-delay, 0ms);
    }
    body.ending-cinematic-active #header {
      box-shadow: 0 3px 0 rgba(205, 194, 171, 0.84), 0 12px 22px rgba(95, 78, 52, 0.18), 0 0 20px rgba(255, 236, 172, 0.48);
    }
    @keyframes endingSunPulse {
      0%, 100% { transform: translate(-50%, -50%) scale(0.92); opacity: 0.7; }
      50% { transform: translate(-50%, -50%) scale(1.14); opacity: 1; }
    }
    @keyframes endingWave {
      0% { opacity: 0.94; transform: translate(-50%, -50%) scale(0.2); }
      100% { opacity: 0; transform: translate(-50%, -50%) scale(18); }
    }
    @keyframes endingSparkFloat {
      0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--spark-angle, 0deg)) translateX(8px) scale(0.2); }
      18% { opacity: 1; }
      100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--spark-angle, 0deg)) translateX(var(--spark-distance, 120px)) scale(1); }
    }
    @keyframes endingPetalDrift {
      0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--petal-angle, 0deg)) translateX(0) translateY(0) scale(0.28); }
      16% { opacity: 0.92; }
      100% { opacity: 0; transform: translate(-50%, -50%) rotate(calc(var(--petal-angle, 0deg) + 38deg)) translateX(var(--petal-distance, 96px)) translateY(36px) scale(1); }
    }
    @keyframes endingCellWake {
      0% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.65), inset 0 -1px 0 rgba(190,172,139,0.35); filter: saturate(1); }
      40% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), inset 0 -1px 0 rgba(190,172,139,0.28), 0 0 0 2px rgba(255, 245, 184, 0.44), 0 0 18px rgba(255, 235, 145, 0.26); filter: saturate(1.08) brightness(1.05); }
      100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.74), inset 0 -1px 0 rgba(190,172,139,0.3), 0 0 0 1px rgba(255, 245, 184, 0.16), 0 0 10px rgba(255, 235, 145, 0.14); filter: saturate(1.04) brightness(1.02); }
    }
    @keyframes endingBlockLift {
      0% { transform: translateY(0) scale(1); }
      28% { transform: translateY(-7px) scale(1.03); }
      100% { transform: translateY(-2px) scale(1.01); }
    }
    @keyframes endingMessageReveal {
      0% { opacity: 0; transform: translate(-50%, 18px) scale(0.96); }
      100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    }
    #saveLevelModal {
      position: fixed;
      inset: 0;
      z-index: 11000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(48, 35, 18, 0.34);
    }
    #saveLevelModal.show {
      display: flex;
    }
    .save-level-card {
      width: min(420px, calc(100vw - 32px));
      padding: 18px;
      border-radius: 20px;
      background: #fff9ea;
      border: 2px solid #d2c9b4;
      box-shadow: 0 12px 28px rgba(49, 33, 13, 0.22);
    }
    .save-level-card h2 {
      color: #5f4e34;
      font-size: 1.2rem;
      margin-bottom: 14px;
      font-family: 'Lilita One', cursive;
      letter-spacing: 0.02em;
    }
    .save-field {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 14px;
    }
    .save-field span {
      color: #6b593f;
      font-size: 0.84rem;
      font-weight: 700;
    }
    #levelNameInput {
      width: 100%;
      min-height: 42px;
      padding: 0 14px;
      border-radius: 14px;
      border: 2px solid #d7ccb4;
      background: #fffdf5;
      color: #5f4e34;
      font-family: 'Fredoka', system-ui, sans-serif;
      font-size: 0.95rem;
      outline: none;
    }
    #levelNameInput:focus {
      border-color: #c7ae77;
      box-shadow: 0 0 0 3px rgba(212, 188, 68, 0.16);
    }
    #iconPicker {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
    }
    .icon-choice {
      min-height: 54px;
      border-radius: 14px;
      border: 2px solid #d7ccb4;
      background: linear-gradient(180deg, #fffdf6 0%, #f4ecd8 100%);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .icon-choice.active {
      border-color: #6aa856;
      box-shadow: 0 0 0 3px rgba(106, 168, 86, 0.14);
      background: linear-gradient(180deg, #f7fff1 0%, #e3f3d5 100%);
    }
    .save-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 6px;
    }

    @keyframes splashFloat {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-8px); }
    }
    @keyframes startGoalDrift {
      0%, 100% { transform: translate3d(0, 0, 0) rotate(-4deg); }
      25% { transform: translate3d(2px, -5px, 0) rotate(-1deg); }
      50% { transform: translate3d(-3px, -10px, 0) rotate(3deg); }
      75% { transform: translate3d(3px, -4px, 0) rotate(1deg); }
    }
    @keyframes splashLoad {
      0% { transform: translateX(-120%); }
      100% { transform: translateX(260%); }
    }

    /* Thomas: geometria squadrata solo su questo tema */
    body.theme-thomas #gridWrap,
    body.theme-thomas #gameGrid,
    body.theme-thomas .cell,
    body.theme-thomas .cell.obstacle-cell::before,
    body.theme-thomas #blocksRow,
    body.theme-thomas #boardRow,
    body.theme-thomas .pslot,
    body.theme-thomas .pslot::before,
    body.theme-thomas .ablock,
    body.theme-thomas .pblock,
    body.theme-thomas #editorToolbar button,
    body.theme-thomas #startEditorBtn,
    body.theme-thomas #openTutorialEditorBtn,
    body.theme-thomas #openSpritePreviewBtn,
    body.theme-thomas #openVfxToolBtn,
    body.theme-thomas #openLottieInspectorBtn,
    body.theme-thomas #exitEditorBtn,
    body.theme-thomas #customLevelsPanel,
    body.theme-thomas #levelThemePanel,
    body.theme-thomas #elementPalettePanel,
    body.theme-thomas .editor-level-tile,
    body.theme-thomas .element-tool,
    body.theme-thomas .element-tool-icon,
    body.theme-thomas .element-tool-status,
    body.theme-thomas .theme-choice,
    body.theme-thomas .theme-choice-art,
    body.theme-thomas .character-choice,
    body.theme-thomas .character-choice-art,
    body.theme-thomas #closeStyleEditorBtn,
    body.theme-thomas .theme-color-item,
    body.theme-thomas .theme-color-input,
    body.theme-thomas .theme-color-reset,
    body.theme-thomas #applyThemeStyleBtn,
    body.theme-thomas #resetThemeColorsBtn,
    body.theme-thomas .editor-block-toggle,
    body.theme-thomas .save-level-card,
    body.theme-thomas #levelNameInput,
    body.theme-thomas .icon-choice,
    body.theme-thomas #toast,
    body.theme-thomas #debugBadge,
    body.theme-thomas #buildBadge {
      border-radius: 0 !important;
    }

    body.theme-thomas #gridWrap,
    body.theme-thomas #gameGrid,
    body.theme-thomas #blocksRow,
    body.theme-thomas #boardRow,
    body.theme-thomas #customLevelsPanel,
    body.theme-thomas #levelThemePanel,
    body.theme-thomas #elementPalettePanel,
    body.theme-thomas .save-level-card,
    body.theme-thomas .theme-color-item {
      box-shadow: none !important;
    }

    body.theme-thomas .ablock,
    body.theme-thomas .pblock {
      filter: none;
    }

    body.low-end-device #startGate.show.hiding {
      filter: none;
    }

    body.low-end-device #customLevelsPanel,
    body.low-end-device #levelThemePanel,
    body.low-end-device #elementPalettePanel,
    body.low-end-device #settingsModal,
    body.low-end-device .settings-card,
    body.low-end-device .ending-message,
    body.low-end-device .ending-return-btn {
      backdrop-filter: none !important;
    }

    body.low-end-device .goal-light__bloom,
    body.low-end-device .goal-light__rays::before,
    body.low-end-device .goal-light__rays::after,
    body.low-end-device .goal-bubble__glow,
    body.low-end-device .ablock .available-block-vfx__glow,
    body.low-end-device .ablock .available-block-vfx__spark::before,
    body.low-end-device .ablock .available-block-vfx__spark::after {
      filter: none !important;
    }

    body.low-end-device .ablock.tutorial-focus .available-block-vfx__glow,
    body.low-end-device #blocksRow.available-block-guided .ablock.tutorial-focus .available-block-vfx__glow,
    body.low-end-device .ablock.tutorial-focus .available-block-vfx__spark,
    body.low-end-device #blocksRow.available-block-guided .ablock.tutorial-focus .available-block-vfx__spark,
    body.low-end-device .ablock.tutorial-focus .available-block-vfx::before,
    body.low-end-device #blocksRow.available-block-guided .ablock.tutorial-focus .available-block-vfx::before {
      animation: none !important;
    }

