@layer components {
  .level {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    padding: calc(var(--safe-top) + 6px) calc(var(--safe-right) + 8px) calc(var(--safe-bottom) + 6px) calc(var(--safe-left) + 8px);
    overflow: hidden;
    background: #1b0533;
    isolation: isolate;
  }

  .level__bg {
    position: absolute;
    inset: -20px;
    z-index: -2;
    overflow: hidden;
  }

  .level__bg img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    transform: scale(1.08);
    transition: transform 1.4s var(--ease-out), filter 1.4s ease;
    filter: saturate(1.1) blur(2px);
  }

  .level.is-in .level__bg img {
    transform: scale(1);
  }

  .level__tint {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
      radial-gradient(90% 60% at 50% 48%, rgba(20, 0, 40, 0.05) 0%, rgba(20, 0, 40, 0.45) 100%),
      linear-gradient(180deg, rgba(40, 0, 60, 0.35), rgba(20, 0, 40, 0.15) 30%, rgba(20, 0, 40, 0.45));
  }

  .level[data-board='oled'] .level__tint {
    background: rgba(0, 0, 0, 0.88);
  }

  .level[data-board='dark'] .level__tint {
    background: rgba(10, 10, 16, 0.62);
  }

  .lhud {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) minmax(104px, auto);
    gap: 8px;
    align-items: stretch;
    translate: 0 -120%;
    transition: translate 0.6s var(--ease-pop) 0.1s;
  }

  .level.is-in .lhud {
    translate: 0 0;
  }

  .lhud__card {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    padding: 6px 8px 8px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(120, 40, 170, 0.92), rgba(60, 10, 100, 0.94));
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px #3b0d4a, 0 8px 16px rgba(0, 0, 0, 0.35), inset 0 3px 0 rgba(255, 255, 255, 0.3);
  }

  .lhud__label {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #ffd9f0;
  }

  .lhud__movesnum {
    font-size: 40px;
    line-height: 1;
    --ol: #3b0d4a;
  }

  .lhud__movesnum.is-bump {
    animation: mm-hit 0.3s var(--ease-pop);
  }

  .level.is-low .lhud__movesnum {
    color: #ff6b6b;
    animation: mm-pulse 0.8s ease-in-out infinite;
  }

  .lhud__mid {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    min-width: 0;
  }

  .lhud__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 6px;
  }

  .lhud__name {
    font-size: 17px;
    --ol: #3b0d4a;
    white-space: nowrap;
  }

  .lhud__hard {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px 2px 5px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(180deg, #c77dff, #7a22c4);
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(190, 90, 255, 0.7);
    white-space: nowrap;
    line-height: 1.2;
  }

  .lhud__hard .ico {
    width: 13px;
    height: 13px;
  }

  .lhud__hard[data-tier='super'] {
    background: linear-gradient(180deg, #ff8a5c, #d4151a);
    box-shadow: 0 0 10px rgba(255, 90, 40, 0.75);
  }

  .lhud__hard[data-tier='nightmare'] {
    background: linear-gradient(180deg, #7d6bff, #1d0c5c);
    box-shadow: 0 0 10px rgba(110, 90, 255, 0.8);
  }

  .lhud__hard[data-tier='nightmare'] .ico {
    filter: hue-rotate(215deg) saturate(1.3);
  }

  .booster.is-tip::before {
    content: '';
    position: absolute;
    inset: -9px;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 226, 90, 0.95) 0%, rgba(255, 190, 40, 0.55) 45%, rgba(255, 170, 0, 0) 70%);
    animation: tip-glow 1.3s ease-in-out infinite;
    pointer-events: none;
  }

  .booster__tip {
    position: absolute;
    top: -9px;
    left: 50%;
    translate: -50% 0;
    padding: 1px 6px 2px;
    border-radius: 99px;
    background: linear-gradient(180deg, #fff39b, #ffc21a);
    border: 2px solid #fff;
    box-shadow: 0 2px 0 #b86400;
    color: #6a3a00;
    font-size: 10px;
    line-height: 1.1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    pointer-events: none;
  }

  :root[data-motion='reduced'] .booster.is-tip::before {
    animation: none;
  }

  .lhud__score {
    font-size: 30px;
    line-height: 1;
    --ol: #3b0d4a;
  }

  .lhud__meter {
    position: relative;
    width: 100%;
    max-width: 240px;
    height: 26px;
    margin-top: 4px;
  }

  .lhud__track {
    position: absolute;
    left: 0;
    right: 0;
    top: 8px;
    height: 14px;
    border-radius: 99px;
    background: rgba(30, 0, 50, 0.7);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #3b0d4a;
    overflow: hidden;
  }

  .lhud__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: linear-gradient(180deg, #fff39b, #ffc21a 55%, #e28500);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6);
    transition: width 0.25s linear;
  }

  .lhud__star {
    position: absolute;
    top: 0;
    width: 28px;
    height: 28px;
    translate: -50% 0;
    filter: grayscale(1) brightness(0.55);
    transition: filter 0.3s ease, scale 0.3s var(--ease-pop);
  }

  .lhud__star .ico {
    width: 100%;
    height: 100%;
  }

  .lhud__star.is-lit {
    filter: none;
    scale: 1.25;
    animation: mm-hit 0.5s var(--ease-pop);
  }

  .lhud__goallist {
    display: flex;
    gap: 6px;
    justify-content: center;
  }

  .lgoal {
    position: relative;
    display: grid;
    justify-items: center;
    min-width: 42px;
  }

  .lgoal__icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
  }

  .lgoal__icon img,
  .lgoal__icon .ico {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
  }

  .lgoal__count {
    font-size: 18px;
    line-height: 1;
    margin-top: -4px;
    --ol: #3b0d4a;
  }

  .lgoal__tick {
    position: absolute;
    left: 50%;
    bottom: -4px;
    translate: -50% 0;
    width: 26px;
    height: 26px;
    opacity: 0;
    scale: 0.3;
    transition: opacity 0.2s ease, scale 0.35s var(--ease-pop);
  }

  .lgoal__tick .ico {
    width: 100%;
    height: 100%;
  }

  .lgoal.is-done .lgoal__tick {
    opacity: 1;
    scale: 1;
  }

  .lgoal.is-done .lgoal__count {
    opacity: 0;
  }

  .lgoal.is-bump .lgoal__icon {
    animation: mm-hit 0.3s var(--ease-pop);
  }

  .level__stage {
    position: relative;
    min-height: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
  }

  .level.is-in .level__stage {
    opacity: 1;
  }

  .level__board {
    position: absolute;
    inset: 0;
    touch-action: none;
  }

  .board__canvas {
    position: absolute;
    left: 0;
    top: 0;
    touch-action: none;
    cursor: var(--cursor-hand, pointer);
  }

  .lbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 6px;
    translate: 0 130%;
    transition: translate 0.6s var(--ease-pop) 0.2s;
  }

  .level.is-in .lbar {
    translate: 0 0;
  }

  .lbar__pause {
    flex: none;
  }

  .lbar__pause .ico {
    width: 60%;
    height: 60%;
  }

  .lbar__boosters {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    gap: clamp(3px, 1.2vw, 12px);
    padding: 6px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(120, 40, 170, 0.85), rgba(60, 10, 100, 0.9));
    border: 3px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 3px #3b0d4a, 0 8px 18px rgba(0, 0, 0, 0.35);
  }

  .booster {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: clamp(34px, calc((100vw - 118px) / 7), 60px);
    height: clamp(34px, calc((100vw - 118px) / 7), 60px);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #ffffff 0%, #ffe3f1 45%, #f7a8d6 100%);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #7a0f53, 0 4px 0 #7a0f53;
    transition: transform 0.12s var(--ease-pop), box-shadow 0.2s ease;
  }

  .booster:active {
    transform: translateY(3px) scale(0.94);
  }

  .booster.is-active {
    background: radial-gradient(circle at 50% 30%, #fffbd0 0%, #ffe14d 45%, #ffb21f 100%);
    box-shadow: 0 0 0 2px #7a0f53, 0 0 22px 6px rgba(255, 230, 90, 0.85);
    animation: mm-wiggle 0.5s ease-in-out infinite;
  }

  .booster__art {
    width: 72%;
    height: 72%;
    display: grid;
    place-items: center;
  }

  .booster__art img,
  .booster__art .ico {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
  }

  .booster__count {
    position: absolute;
    right: -6px;
    bottom: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    border: 2px solid #fff;
    font-family: var(--font-display);
    font-size: 13px;
    line-height: 1;
    color: #fff;
    background: #3b0d4a;
  }

  .booster__count[data-kind='buy'] {
    background: radial-gradient(circle at 50% 30%, #b3ff8a, #3fb814 70%);
    font-size: 17px;
  }

  .booster__count[data-kind='shop'] {
    background: #1a70d4;
    font-size: 10px;
  }

  .level.is-busy .booster {
    filter: saturate(0.7);
  }

  .level__banner {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: 42%;
    display: grid;
    place-items: center;
    pointer-events: none;
  }

  .lbanner {
    display: inline-block;
    padding: 12px 34px 16px;
    border-radius: 24px;
    font-size: clamp(30px, 9vw, 54px);
    color: #fff;
    -webkit-text-stroke: 2.5px #3b0d4a;
    paint-order: stroke fill;
    text-shadow: 0 5px 0 #3b0d4a;
    border: 4px solid #fff;
    box-shadow: 0 0 0 4px #3b0d4a, 0 16px 34px rgba(0, 0, 0, 0.45);
    opacity: 0;
    scale: 0.3;
  }

  .level__banner.is-on .lbanner {
    animation: banner-pop 1.25s var(--ease-pop) both;
  }

  .lbanner--pink {
    background: linear-gradient(180deg, #ff8fd0, #d6278f);
  }

  .lbanner--gold {
    background: linear-gradient(180deg, #fff08a, #ffc21a 50%, #f08a00);
    color: #fff;
  }

  .lbanner--red {
    background: linear-gradient(180deg, #ff8a8a, #d12a2a);
  }

  .lbanner--blue {
    background: linear-gradient(180deg, #8fdcff, #1a70d4);
    font-size: clamp(22px, 6vw, 34px);
  }

  .level.is-crush .level__tint {
    background: radial-gradient(80% 60% at 50% 50%, rgba(255, 220, 90, 0.18), rgba(40, 0, 60, 0.4));
  }

  .level__help {
    position: absolute;
    z-index: 21;
    left: 50%;
    bottom: calc(var(--safe-bottom) + 92px);
    translate: -50% 0;
    padding: 10px 18px;
    border-radius: 99px;
    background: rgba(30, 0, 50, 0.88);
    border: 2px solid #ffe45c;
    font-size: 15px;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    animation: mm-rise 0.3s var(--ease-pop);
  }

  .level__skip {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    align-items: end;
    justify-items: center;
    padding: 0 0 calc(var(--safe-bottom) + 100px);
    border: 0;
    background: transparent;
    font: inherit;
    cursor: var(--cursor-hand, pointer);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .level__skippill {
    padding: 9px 26px 12px;
    border-radius: 99px;
    background: linear-gradient(180deg, #fff39b, #ffc21a 55%, #e28500);
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px #3b0d4a, 0 8px 18px rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 24px;
    -webkit-text-stroke: 2px #3b0d4a;
    paint-order: stroke fill;
    text-shadow: 0 3px 0 #3b0d4a;
    opacity: 0;
    translate: 0 30px;
    transition: opacity 0.25s ease, translate 0.35s var(--ease-pop);
  }

  .level__skip.is-on .level__skippill {
    opacity: 1;
    translate: 0 0;
    animation: skip-pulse 1.1s ease-in-out 0.4s infinite;
  }

  :root[data-motion='reduced'] .level__skip.is-on .level__skippill {
    animation: none;
  }

  .goal-flyer {
    position: fixed;
    z-index: 60;
    left: 0;
    top: 0;
    pointer-events: none;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
  }

  .gbanner {
    position: absolute;
    inset: 0;
    z-index: 25;
    display: grid;
    place-items: center;
    padding: 20px;
    pointer-events: none;
    background: rgba(20, 0, 40, 0);
    transition: background 0.35s ease;
  }

  .gbanner.is-in {
    background: rgba(20, 0, 40, 0.35);
  }

  .gbanner.is-out {
    background: rgba(20, 0, 40, 0);
  }

  .gbanner__card {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 10px;
    min-width: min(360px, 90vw);
    padding: 34px 20px 18px;
    border-radius: 26px;
    background: linear-gradient(180deg, #fff7fc, #ffe0f0);
    border: 5px solid #d6278f;
    box-shadow: 0 0 0 3px #fff, 0 20px 40px rgba(0, 0, 0, 0.45);
    color: var(--ink);
    translate: -120vw 0;
    rotate: -6deg;
  }

  .gbanner.is-in .gbanner__card {
    animation: gbanner-in 0.55s var(--ease-pop) forwards;
  }

  .gbanner.is-out .gbanner__card {
    animation: gbanner-out 0.45s var(--ease-in) forwards;
  }

  .gbanner__card .ribbon {
    position: absolute;
    top: -26px;
  }

  .gbanner__card ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 18px;
    font-weight: 700;
  }

  .gbanner__card li {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .gbanner__icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
  }

  .gbanner__icon img,
  .gbanner__icon .ico {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .gbanner__warn {
    color: #d12a2a;
  }

  .gbanner__tier {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: -6px;
    padding: 4px 14px 5px;
    border-radius: 99px;
    background: linear-gradient(180deg, #c77dff, #7a22c4);
    border: 2px solid #fff;
    box-shadow: 0 3px 0 #4d0d85, 0 0 14px rgba(190, 90, 255, 0.6);
    color: #fff;
    font-family: var(--font-display);
    font-size: 17px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .gbanner__tier .ico {
    width: 20px;
    height: 20px;
  }

  .gbanner__tier[data-tier='super'] {
    background: linear-gradient(180deg, #ff8a5c, #d4151a);
    box-shadow: 0 3px 0 #7a0508, 0 0 14px rgba(255, 90, 40, 0.65);
  }

  .gbanner__tier[data-tier='nightmare'] {
    background: linear-gradient(180deg, #7d6bff, #1d0c5c);
    box-shadow: 0 3px 0 #10053a, 0 0 14px rgba(110, 90, 255, 0.7);
  }

  .gbanner__tier[data-tier='nightmare'] .ico {
    filter: hue-rotate(215deg) saturate(1.3);
  }

  .gbanner__moves {
    font-family: var(--font-display);
    font-size: 22px;
    color: #8e0f5c;
  }
}

@layer fx {
  @keyframes tip-glow {
    0%, 100% { opacity: 0.55; scale: 0.9; }
    50% { opacity: 1; scale: 1.08; }
  }

  @keyframes skip-pulse {
    0%, 100% { scale: 1; }
    50% { scale: 1.08; }
  }

  @keyframes banner-pop {
    0% { opacity: 0; scale: 0.3; rotate: -8deg; }
    18% { opacity: 1; scale: 1.12; rotate: 2deg; }
    28% { scale: 1; rotate: 0deg; }
    82% { opacity: 1; scale: 1; }
    100% { opacity: 0; scale: 1.25; }
  }

  @keyframes gbanner-in {
    0% { translate: -120vw 0; rotate: -8deg; }
    70% { translate: 12px 0; rotate: 2deg; }
    100% { translate: 0 0; rotate: 0deg; }
  }

  @keyframes gbanner-out {
    from { translate: 0 0; rotate: 0deg; }
    to { translate: 120vw 0; rotate: 8deg; }
  }
}

@layer state {
  @media (min-aspect-ratio: 5/4) {
    .level {
      grid-template-columns: minmax(170px, 230px) minmax(0, 1fr) auto;
      grid-template-rows: minmax(0, 1fr);
      gap: 12px;
    }

    .lhud {
      grid-column: 1;
      grid-template-columns: 1fr;
      grid-auto-rows: min-content;
      align-content: center;
      gap: 12px;
      translate: -140% 0;
    }

    .lhud__mid {
      order: -1;
      padding: 10px 8px;
      border-radius: 18px;
      background: linear-gradient(180deg, rgba(120, 40, 170, 0.92), rgba(60, 10, 100, 0.94));
      border: 3px solid #fff;
      box-shadow: 0 0 0 3px #3b0d4a, 0 8px 16px rgba(0, 0, 0, 0.35);
    }

    .level__stage {
      grid-column: 2;
    }

    .lbar {
      grid-column: 3;
      flex-direction: column;
      justify-content: center;
      translate: 140% 0;
    }

    .lbar__boosters {
      flex: 0;
      flex-direction: column;
      gap: clamp(3px, 1vh, 10px);
    }

    .level.is-in .lhud,
    .level.is-in .lbar {
      translate: 0 0;
    }

    .booster {
      width: clamp(36px, calc((100vh - 150px) / 6.4), 62px);
      height: clamp(36px, calc((100vh - 150px) / 6.4), 62px);
    }

    .level__help {
      bottom: calc(var(--safe-bottom) + 20px);
    }

    .level__skip {
      padding-bottom: calc(var(--safe-bottom) + 22px);
    }
  }

  @media (max-width: 370px) {
    .lhud {
      grid-template-columns: 70px minmax(0, 1fr) minmax(92px, auto);
      gap: 6px;
    }

    .lhud__movesnum {
      font-size: 32px;
    }

    .lhud__score {
      font-size: 24px;
    }

    .lgoal__icon {
      width: 32px;
      height: 32px;
    }
  }
}

@layer components {
  .booster__lock {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    pointer-events: none;
  }

  .booster__lock .ico {
    width: 46%;
    height: 46%;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
  }

  .booster.is-locked {
    background: radial-gradient(circle at 50% 30%, #eceaf2 0%, #bdb6cf 55%, #8d84a8 100%);
    box-shadow: 0 0 0 2px #463a63, 0 4px 0 #463a63;
  }

  .booster.is-locked .booster__art {
    filter: grayscale(1) brightness(0.72);
    opacity: 0.55;
  }

  .booster.is-locked .booster__lock {
    display: grid;
  }

  .booster__count[data-kind='lock'] {
    background: #463a63;
    font-size: 10px;
    white-space: nowrap;
  }

  .booster.is-assist::after,
  .booster.is-guide::after {
    content: '';
    position: absolute;
    inset: -9px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 244, 150, 0) 45%, rgba(255, 236, 90, 0.95) 62%, rgba(255, 200, 40, 0) 74%);
    pointer-events: none;
    animation: assist-glow 1.1s ease-in-out infinite;
  }

  .booster.is-assist {
    background: radial-gradient(circle at 50% 30%, #fffbd0 0%, #ffe14d 45%, #ffb21f 100%);
  }

  .booster.is-guide {
    z-index: 3;
    background: radial-gradient(circle at 50% 30%, #fffbd0 0%, #ffe14d 45%, #ffb21f 100%);
  }

  .booster.is-nudge {
    animation: mm-wiggle 0.45s ease-in-out 2;
  }

  .level.is-guiding .booster:not(.is-guide) {
    opacity: 0.45;
  }

  .guide-hand {
    position: absolute;
    z-index: 40;
    width: 54px;
    height: 54px;
    margin: 6px 0 0 -14px;
    pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
    animation: guide-tap 1s ease-in-out infinite;
  }

  .guide-hand .ico {
    width: 100%;
    height: 100%;
  }

  .tut {
    position: absolute;
    inset: 0;
    z-index: 45;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(20, 0, 40, 0);
    transition: background 0.35s ease;
  }

  .tut.is-in {
    background: rgba(20, 0, 40, 0.6);
  }

  .tut.is-out {
    background: rgba(20, 0, 40, 0);
    pointer-events: none;
  }

  .tut__card {
    position: relative;
    display: grid;
    width: min(440px, 100%);
    padding: 30px 18px 18px;
    border-radius: 26px;
    background: linear-gradient(180deg, #fff7fc, #ffe0f0);
    border: 5px solid #d6278f;
    box-shadow: 0 0 0 3px #fff, 0 20px 40px rgba(0, 0, 0, 0.45);
    color: var(--ink);
    opacity: 0;
    scale: 0.6;
    transition: scale 0.45s var(--ease-pop), opacity 0.25s ease;
  }

  .tut.is-in .tut__card {
    opacity: 1;
    scale: 1;
  }

  .tut.is-out .tut__card {
    opacity: 0;
    scale: 0.85;
  }

  .tut__body {
    display: grid;
    justify-items: center;
    gap: 10px;
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 -10px -14px;
    padding: 4px 10px 14px;
  }

  .tut__card--booster {
    border-color: #1a70d4;
    background: linear-gradient(180deg, #f5fbff, #dcefff);
  }

  .tut__ribbon {
    position: absolute;
    top: -24px;
    left: 50%;
    translate: -50% 0;
    font-size: 22px;
    padding: 8px 24px 10px;
  }

  .tut__ribbon::before,
  .tut__ribbon::after {
    display: none;
  }

  .tut__title {
    font-size: clamp(26px, 7vw, 34px);
    --ol: #3b0d4a;
    text-align: center;
  }

  .tut__text {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    color: #4a1560;
  }

  .tut__extra {
    padding: 6px 14px;
    border-radius: 99px;
    background: #fff3b0;
    border: 2px solid #e0a21a;
    font-size: 15px;
    font-weight: 700;
    color: #7a4a00;
  }

  .tdemo {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 100%;
  }

  .tdemo__hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
  }

  .tdemo__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px 4px 8px;
    border-radius: 99px;
    background: linear-gradient(180deg, rgba(120, 40, 170, 0.95), rgba(60, 10, 100, 0.96));
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #3b0d4a;
    color: #fff;
  }

  .tdemo__chip small {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.85;
  }

  .tdemo__chip b {
    font-size: 22px;
    line-height: 1;
  }

  .tdemo__goal img {
    width: 34px;
    height: 34px;
    object-fit: contain;
  }

  .tdemo__tick {
    display: none;
    width: 22px;
    height: 22px;
  }

  .tdemo__tick .ico {
    width: 100%;
    height: 100%;
  }

  .tdemo__goal.is-done b {
    display: none;
  }

  .tdemo__goal.is-done .tdemo__tick {
    display: block;
  }

  .tdemo__booster {
    position: relative;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #ffffff 0%, #ffe3f1 45%, #f7a8d6 100%);
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #7a0f53, 0 4px 0 #7a0f53;
    transition: background 0.2s ease, box-shadow 0.2s ease;
  }

  .tdemo__booster img,
  .tdemo__booster .ico {
    width: 72%;
    height: 72%;
    object-fit: contain;
  }

  .tdemo__booster.is-on {
    background: radial-gradient(circle at 50% 30%, #fffbd0 0%, #ffe14d 45%, #ffb21f 100%);
    box-shadow: 0 0 0 2px #7a0f53, 0 0 18px 6px rgba(255, 230, 90, 0.85);
  }

  .tdemo__stage {
    --cs: min(52px, calc((min(440px, 92vw) - 70px) / var(--cols)));
    position: relative;
    width: calc(var(--cols) * var(--cs));
    height: calc(var(--rows) * var(--cs));
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 0 6px #3b0d4a, 0 10px 18px rgba(20, 0, 40, 0.35);
    background: rgba(22, 26, 84, 0.95);
  }

  .tdemo__tiles,
  .tdemo__layer {
    position: absolute;
    inset: 0;
  }

  .tdemo__tiles {
    border-radius: 12px;
    overflow: hidden;
  }

  .tdemo__tiles i {
    position: absolute;
    width: var(--cs);
    height: var(--cs);
    background: rgba(34, 40, 110, 0.95);
  }

  .tdemo__tiles i.is-b {
    background: rgba(22, 26, 84, 0.95);
  }

  .tdemo__cage {
    position: absolute;
    width: calc(var(--cs) * 0.6);
    height: calc(var(--cs) * 0.6);
  }

  .tdemo__piece,
  .tdemo__under,
  .tdemo__over,
  .tdemo__cake {
    position: absolute;
    pointer-events: none;
    object-fit: contain;
  }

  .tdemo__under,
  .tdemo__cake {
    z-index: 1;
  }

  .tdemo__piece {
    z-index: 2;
    padding: 2%;
  }

  .tdemo__cq {
    padding: 0;
  }

  .tdemo__over {
    z-index: 3;
  }

  .tdemo__timer {
    position: absolute;
    z-index: 4;
    display: grid;
    place-items: center;
    width: var(--cs);
    height: var(--cs);
    translate: calc(var(--cs) * -0.031) calc(var(--cs) * 0.05);
    font-size: calc(var(--cs) * 0.26);
    color: #2b0a3d;
    pointer-events: none;
  }

  .tdemo__score {
    position: absolute;
    z-index: 6;
    width: calc(var(--cs) * 2);
    text-align: center;
    font-size: calc(var(--cs) * 0.42);
    color: #ffe45c;
    -webkit-text-stroke: 1.5px #3b0d4a;
    paint-order: stroke fill;
    pointer-events: none;
  }

  .tdemo__ring {
    position: absolute;
    z-index: 5;
    border-radius: 50%;
    border: 4px solid var(--ring, #ffffff);
    box-shadow: 0 0 14px var(--ring, #ffffff), inset 0 0 12px var(--ring, #ffffff);
    pointer-events: none;
  }

  .tdemo__beam {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 0 16px 4px rgba(255, 255, 255, 0.85);
  }

  .tdemo__beam--row {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #ffffff 40%, #fff6b0 50%, #ffffff 60%, rgba(255, 255, 255, 0));
  }

  .tdemo__beam--col {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), #ffffff 40%, #fff6b0 50%, #ffffff 60%, rgba(255, 255, 255, 0));
  }

  .tdemo__bolt {
    position: absolute;
    z-index: 5;
    height: 4px;
    margin-top: -2px;
    transform-origin: 0 50%;
    border-radius: 2px;
    background: linear-gradient(90deg, #ffffff, #ffe45c, #ff7ac6);
    box-shadow: 0 0 8px #ffffff;
    pointer-events: none;
  }

  .tdemo__flash {
    position: absolute;
    z-index: 7;
    border-radius: 12px;
    background: #ffffff;
    pointer-events: none;
  }

  .tdemo__plane,
  .tdemo__dig {
    position: absolute;
    z-index: 8;
    left: 0;
    top: 0;
    width: var(--cs);
    height: var(--cs);
    pointer-events: none;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4));
  }

  .tdemo__dig {
    width: calc(var(--cs) * 1.1);
    height: calc(var(--cs) * 1.1);
    transform-origin: 20% 80%;
  }

  .tdemo__plane .ico,
  .tdemo__dig .ico {
    width: 100%;
    height: 100%;
  }

  .tdemo__hand {
    position: absolute;
    z-index: 10;
    left: 0;
    top: 0;
    width: calc(var(--cs) * 0.95);
    height: calc(var(--cs) * 0.95);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.45));
  }

  .tdemo__hand .ico {
    width: 100%;
    height: 100%;
  }

  .moves__own {
    margin-top: 4px;
  }
}

@layer fx {
  @keyframes assist-glow {
    0%, 100% { opacity: 0.45; scale: 0.92; }
    50% { opacity: 1; scale: 1.1; }
  }

  @keyframes guide-tap {
    0%, 100% { translate: 0 0; scale: 1; }
    50% { translate: 0 -8px; scale: 0.9; }
  }
}
