.tool-frame--playful .tool-header-block {
    max-width: 38rem;
}

.tool-frame--playful .page-subtitle {
    max-width: 35rem;
}

.number-merge-assist-ui {
    display: block;
}

.arcade-cabinet {
    position: relative;
    display: grid;
    gap: 0.85rem;
    padding: clamp(0.92rem, 2vw, 1.2rem);
    border-radius: 1.85rem;
    border: 1px solid rgba(153, 92, 27, 0.14);
    background:
        radial-gradient(circle at 14% 0%, rgba(255, 208, 140, 0.62), transparent 24%),
        radial-gradient(circle at 88% 18%, rgba(255, 164, 120, 0.3), transparent 28%),
        linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(249, 239, 224, 0.98));
    box-shadow:
        0 28px 56px rgba(112, 67, 24, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.arcade-cabinet::after {
    content: "";
    position: absolute;
    inset: 0.6rem;
    border-radius: 1.45rem;
    border: 1px dashed rgba(179, 113, 45, 0.12);
    pointer-events: none;
}

.arcade-marquee {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.arcade-marquee__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.arcade-marquee__pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.85rem;
    padding: 0.22rem 0.72rem;
    border-radius: 999px;
    border: 1px solid rgba(182, 112, 42, 0.14);
    background: rgba(255, 246, 232, 0.86);
    color: rgba(111, 63, 18, 0.88);
    font-size: 0.8rem;
    font-weight: 700;
}

.arcade-marquee__toggle,
.arcade-marquee__button {
    white-space: nowrap;
}

.arcade-marquee__toggle {
    border-color: rgba(167, 101, 34, 0.2);
    background: linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(245, 232, 210, 0.98));
    color: rgba(86, 50, 16, 0.98);
}

.arcade-marquee__toggle:hover,
.arcade-marquee__toggle:focus-visible,
.arcade-marquee__toggle[aria-pressed="true"] {
    border-color: rgba(75, 140, 183, 0.32);
    background: linear-gradient(180deg, rgba(241, 251, 255, 1), rgba(219, 239, 246, 0.98));
    color: rgba(38, 66, 89, 0.98);
}

.arcade-marquee__button {
    margin-left: 0;
}

.arcade-stage {
    display: grid;
    grid-template-columns: minmax(0, 17.8rem) minmax(14.5rem, 16.25rem);
    gap: 0.95rem;
    align-items: start;
    justify-content: center;
}

.arcade-main {
    display: grid;
    gap: 0.75rem;
    width: min(100%, 17.8rem);
}

.score-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.38rem;
}

.play-cluster {
    display: grid;
    gap: 0.48rem;
}

.score-card,
.side-panel {
    padding: 0.72rem 0.76rem;
    border-radius: 1rem;
    border: 1px solid rgba(179, 114, 44, 0.16);
    background: linear-gradient(180deg, rgba(255, 248, 236, 0.96), rgba(248, 234, 211, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.score-card.is-pulsing {
    border-color: rgba(76, 144, 201, 0.3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.78),
        0 10px 22px rgba(76, 144, 201, 0.12);
    animation: stat-pop 260ms ease;
}

.score-card__label,
.side-panel__label,
.hint-card__label {
    display: block;
    margin-bottom: 0.2rem;
    color: rgba(150, 87, 23, 0.82);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.score-card__value,
.side-panel__value,
.hint-card__value {
    color: rgba(76, 41, 11, 0.96);
    font-size: 1rem;
    line-height: 1.1;
}

.side-panel {
    min-height: 5.6rem;
}

.side-panel__value {
    display: block;
    min-height: 2.3rem;
}

.board-shell {
    --tile-radius: 1rem;
    padding: 0.34rem;
    border-radius: 1.45rem;
    border: 1px solid rgba(167, 101, 34, 0.18);
    background: linear-gradient(180deg, rgba(180, 126, 67, 0.98), rgba(143, 93, 42, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 238, 214, 0.34),
        0 12px 24px rgba(111, 67, 24, 0.12);
    touch-action: none;
    user-select: none;
    cursor: grab;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.board-shell.is-dragging {
    cursor: grabbing;
    transform: translateY(-1px) scale(1.004);
    border-color: rgba(101, 158, 205, 0.3);
    box-shadow:
        inset 0 1px 0 rgba(255, 238, 214, 0.34),
        0 15px 28px rgba(111, 67, 24, 0.18);
}

.board-shell.is-invalid {
    border-color: rgba(214, 100, 78, 0.34);
    animation: board-reject 200ms ease;
}

.gesture-hint {
    margin: 0;
    color: rgba(88, 53, 20, 0.92);
    font-size: 0.82rem;
    line-height: 1.35;
    text-align: center;
}

.game-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.52rem;
    padding: 0;
    transform: translate3d(0, 0, 0);
}

.game-grid.is-shifting-up {
    animation: board-shift-up 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.game-grid.is-shifting-down {
    animation: board-shift-down 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.game-grid.is-shifting-left {
    animation: board-shift-left 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.game-grid.is-shifting-right {
    animation: board-shift-right 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border-radius: var(--tile-radius, 1rem);
    background: rgba(248, 226, 196, 0.52);
    color: rgba(107, 67, 32, 0.5);
    font-size: clamp(1rem, 1.7vw, 1.7rem);
    font-weight: 900;
    letter-spacing: -0.05em;
    transition: transform 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.tile.is-settling {
    opacity: 0;
}

.tile-motion-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
}

.tile-motion-layer__tile {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--tile-radius, 1rem);
    transform: translate3d(0, 0, 0);
    transition: transform 170ms cubic-bezier(0.22, 0.85, 0.24, 1);
    box-shadow: 0 8px 18px rgba(111, 67, 24, 0.12);
    will-change: transform;
}

.tile-motion-layer__tile.is-moving {
    transform: translate3d(var(--move-x, 0), var(--move-y, 0), 0);
}

.tile-motion-layer__tile--merge {
    z-index: 2;
}

.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.tile[data-value="0"] {
    color: transparent;
}

.tile[data-value="2"] {
    background: #f8eddc;
    color: #6d4320;
}

.tile[data-value="4"] {
    background: #f6e0bf;
    color: #6a3d16;
}

.tile[data-value="8"] {
    background: #f6c681;
    color: #5d2f06;
}

.tile[data-value="16"] {
    background: #f1ab60;
    color: #4f2503;
}

.tile[data-value="32"] {
    background: #df7d48;
    color: #351506;
}

.tile[data-value="64"] {
    background: #c55a36;
    color: #2d1205;
}

.tile[data-value="128"] {
    background: #d9d46f;
    color: #50470e;
}

.tile[data-value="256"] {
    background: #b5d36c;
    color: #35501d;
}

.tile[data-value="512"] {
    background: #78c9a0;
    color: #143d29;
}

.tile[data-value="1024"] {
    background: #55b8c7;
    color: #0f3347;
}

.tile[data-value="2048"] {
    background: linear-gradient(180deg, #4ea2ff, #2f74d6);
    color: #f7fbff;
    box-shadow: 0 0 0 2px rgba(45, 116, 214, 0.18), 0 10px 24px rgba(47, 116, 214, 0.28);
}

.tile[data-value="4096"],
.tile[data-value="8192"] {
    background: linear-gradient(180deg, #2d6cf0, #1c3f96);
    color: #f7fbff;
}

.tile.is-hinted {
    box-shadow: 0 0 0 3px rgba(78, 162, 255, 0.22), 0 10px 20px rgba(47, 116, 214, 0.18);
}

.tile.is-spawning {
    animation: tile-spawn 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tile.is-merging {
    z-index: 1;
    animation: tile-merge 320ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.control-deck {
    display: grid;
    gap: 0.72rem;
}

.hint-card {
    padding: 0.82rem 0.86rem;
    box-sizing: border-box;
    height: 9.4rem;
    border-radius: 1rem;
    border: 1px solid rgba(85, 152, 182, 0.16);
    background: linear-gradient(180deg, rgba(237, 249, 252, 0.98), rgba(221, 241, 245, 0.96));
}

.hint-card__text {
    min-height: 3.35rem;
    margin: 0.35rem 0 0;
    color: rgba(70, 85, 103, 0.9);
    line-height: 1.35;
    font-size: 0.9rem;
}

.hint-card__value {
    display: block;
    min-height: 2.25rem;
}

.action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.action-row .button {
    min-height: 5.6rem;
    border-color: rgba(167, 101, 34, 0.2);
    background: linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(245, 232, 210, 0.98));
    color: rgba(86, 50, 16, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.28;
    font-weight: 800;
}

.action-row .button:hover,
.action-row .button:focus-visible {
    background: linear-gradient(180deg, rgba(241, 251, 255, 1), rgba(219, 239, 246, 0.98));
    border-color: rgba(75, 140, 183, 0.32);
}

.arcade-marquee__button:active,
.action-row .button:active,
.result-card__button:active {
    transform: translateY(1px) scale(0.985);
}

.action-row .button:disabled {
    background: rgba(245, 236, 223, 0.96);
    border-color: rgba(167, 101, 34, 0.14);
    color: rgba(127, 95, 61, 0.96);
    opacity: 1;
    cursor: not-allowed;
    transform: none;
}

.move-pad {
    width: min(100%, 13rem);
    margin-inline: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.34rem;
    padding: 0.34rem;
    border-radius: 0.88rem;
    border: 1px dashed rgba(142, 87, 29, 0.28);
    background: rgba(255, 247, 232, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.move-button {
    min-height: 2.5rem;
    border: 1px solid rgba(167, 101, 34, 0.18);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 251, 242, 0.98), rgba(247, 233, 210, 0.98));
    color: rgba(96, 55, 16, 0.96);
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.move-button:hover,
.move-button:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(75, 140, 183, 0.32);
    background: linear-gradient(180deg, rgba(241, 251, 255, 1), rgba(219, 239, 246, 0.98));
    outline: none;
}

.move-button:active,
.move-button.is-fired {
    border-color: rgba(75, 140, 183, 0.38);
    background: linear-gradient(180deg, rgba(234, 247, 255, 1), rgba(206, 232, 244, 0.98));
}

.move-button.is-fired {
    animation: control-tap 220ms ease;
}

.move-button--up {
    grid-column: 2;
}

.move-button--left {
    grid-column: 1;
    grid-row: 2;
}

.move-button--down {
    grid-column: 2;
    grid-row: 2;
}

.move-button--right {
    grid-column: 3;
    grid-row: 2;
}

.arcade-sidecar {
    display: grid;
    gap: 0.68rem;
    max-width: 18.5rem;
}

.feedback-panel {
    box-sizing: border-box;
    height: 6rem;
    padding: 0.84rem 0.88rem;
    border-radius: 1.05rem;
    border: 1px solid rgba(163, 103, 39, 0.15);
    background: rgba(255, 247, 233, 0.92);
    color: rgba(69, 41, 12, 0.98);
    display: flex;
    align-items: flex-start;
    line-height: 1.4;
    font-weight: 600;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 140ms ease, background 140ms ease;
}

.feedback-panel.is-refreshing {
    box-shadow: 0 10px 20px rgba(129, 88, 32, 0.08);
    animation: feedback-lift 220ms ease;
}

.feedback-panel[data-tone="success"] {
    border-color: rgba(71, 159, 110, 0.24);
    background: rgba(228, 247, 238, 0.98);
    color: rgba(21, 96, 60, 0.96);
}

.feedback-panel[data-tone="warn"] {
    border-color: rgba(224, 162, 54, 0.24);
    background: rgba(255, 244, 214, 0.98);
    color: rgba(122, 79, 11, 0.96);
}

.feedback-panel[data-tone="danger"] {
    border-color: rgba(224, 101, 81, 0.26);
    background: rgba(255, 231, 228, 0.98);
    color: rgba(138, 41, 31, 0.96);
}

.legend-panel {
    padding: 0.82rem 0.86rem;
    border-radius: 1rem;
    border: 1px solid rgba(179, 114, 44, 0.14);
    background: rgba(255, 248, 238, 0.94);
}

.legend-panel__title {
    margin: 0;
    color: rgba(133, 78, 24, 0.9);
    font-weight: 800;
    font-size: 0.9rem;
}

.legend-panel__list {
    margin: 0.5rem 0 0;
    padding-left: 1rem;
    color: rgba(73, 49, 28, 0.96);
    line-height: 1.4;
}

.legend-panel__text {
    margin: 0.45rem 0 0;
    color: rgba(73, 49, 28, 0.96);
    line-height: 1.4;
}

.result-layer {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: clamp(0.9rem, 4vw, 1.25rem);
    background: linear-gradient(180deg, rgba(255, 244, 229, 0.12), rgba(154, 84, 22, 0.24));
    backdrop-filter: blur(7px);
    opacity: 0;
    pointer-events: none;
    overflow-y: auto;
    transition: opacity 180ms ease;
    z-index: 18;
}

.result-layer.is-visible {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.result-card {
    width: min(100%, 22rem);
    margin-top: clamp(0.35rem, 4vw, 2.25rem);
    margin-bottom: 0.9rem;
    padding: 1.12rem 1.12rem 1.16rem;
    border-radius: 1.35rem;
    border: 1px solid rgba(162, 101, 38, 0.18);
    background: linear-gradient(180deg, rgba(255, 252, 246, 0.99), rgba(249, 238, 221, 0.99));
    box-shadow: 0 28px 52px rgba(109, 64, 22, 0.18);
    transform-origin: center bottom;
}

.result-card.is-arriving {
    animation: result-rise 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card__kicker {
    margin: 0 0 0.25rem;
    color: rgba(155, 90, 22, 0.82);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-card__title {
    margin: 0.15rem 0 0;
    color: rgba(73, 42, 13, 0.98);
    font-size: 1.65rem;
    line-height: 1.02;
}

.result-card__body {
    margin: 0.65rem 0 0;
    color: rgba(101, 63, 27, 0.92);
    line-height: 1.38;
}

.result-card__actions {
    display: grid;
    gap: 0.55rem;
    margin-top: 1rem;
}

.result-card__button {
    width: 100%;
}

.result-card__button--secondary {
    border-color: rgba(167, 101, 34, 0.2);
    background: linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(245, 232, 210, 0.98));
    color: rgba(86, 50, 16, 0.98);
}

.result-card__button--secondary:hover,
.result-card__button--secondary:focus-visible {
    background: linear-gradient(180deg, rgba(241, 251, 255, 1), rgba(219, 239, 246, 0.98));
    border-color: rgba(75, 140, 183, 0.32);
}

.result-card__button--secondary:disabled {
    background: rgba(245, 236, 223, 0.96);
    border-color: rgba(167, 101, 34, 0.14);
    color: rgba(127, 95, 61, 0.96);
    opacity: 1;
    cursor: not-allowed;
    transform: none;
}

@keyframes board-shift-left {
    0%,
    100% {
        transform: translateX(0);
    }

    38% {
        transform: translateX(-4px);
    }
}

@keyframes board-shift-right {
    0%,
    100% {
        transform: translateX(0);
    }

    38% {
        transform: translateX(4px);
    }
}

@keyframes board-shift-up {
    0%,
    100% {
        transform: translateY(0);
    }

    38% {
        transform: translateY(-4px);
    }
}

@keyframes board-shift-down {
    0%,
    100% {
        transform: translateY(0);
    }

    38% {
        transform: translateY(4px);
    }
}

@keyframes board-reject {
    0%,
    100% {
        transform: translateX(0);
    }

    24% {
        transform: translateX(-2px);
    }

    52% {
        transform: translateX(3px);
    }

    76% {
        transform: translateX(-1.5px);
    }
}

@keyframes tile-spawn {
    0% {
        transform: scale(0.72);
        opacity: 0.3;
    }

    72% {
        transform: scale(1.08);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes tile-merge {
    0% {
        transform: scale(0.92);
    }

    54% {
        transform: scale(1.14);
        box-shadow: 0 0 0 4px rgba(91, 186, 137, 0.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes control-tap {
    0% {
        transform: translateY(0) scale(1);
    }

    42% {
        transform: translateY(1px) scale(0.97);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes stat-pop {
    0% {
        transform: translateY(0) scale(1);
    }

    44% {
        transform: translateY(-2px) scale(1.03);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes feedback-lift {
    0% {
        transform: translateY(0);
    }

    44% {
        transform: translateY(-2px);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes result-rise {
    0% {
        transform: translateY(16px) scale(0.96);
        opacity: 0.2;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-grid,
    .board-shell,
    .score-card,
    .feedback-panel,
    .move-button,
    .tile,
    .result-layer,
    .result-card,
    .action-row .button,
    .arcade-marquee__button,
    .result-card__button {
        transition: none;
        animation: none;
    }
}

@media (min-width: 1180px) {
    .arcade-stage {
        grid-template-columns: minmax(18.75rem, 19.75rem) minmax(16.75rem, 18.25rem);
        gap: 1.2rem;
        max-width: 42.5rem;
        margin-inline: auto;
    }

    .arcade-main {
        width: min(100%, 19.75rem);
    }

    .tile {
        font-size: clamp(1.1rem, 1.5vw, 1.85rem);
    }
}

@media (max-width: 700px) {
    .arcade-stage {
        grid-template-columns: 1fr;
    }

    .arcade-main,
    .arcade-sidecar {
        width: 100%;
        max-width: 24rem;
        margin-inline: auto;
    }
}

@media (max-width: 640px) {
    .tool-frame--playful .tool-header-block {
        padding-inline: 0.4rem;
    }

    .arcade-cabinet {
        padding: 0.82rem;
        border-radius: 1.35rem;
    }

    .arcade-cabinet::after {
        inset: 0.45rem;
        border-radius: 1.08rem;
    }

    .arcade-marquee__button {
        width: 100%;
    }

    .arcade-marquee__actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .score-strip {
        gap: 0.48rem;
    }

    .score-card,
    .side-panel,
    .hint-card,
    .feedback-panel,
    .legend-panel {
        padding: 0.72rem 0.76rem;
    }

    .hint-card {
        height: 8.8rem;
    }

    .hint-card__text {
        min-height: 3rem;
    }

    .side-panel {
        min-height: 5.2rem;
    }

    .board-shell {
        --tile-radius: 0.82rem;
        padding: 0.58rem;
        border-radius: 1.15rem;
    }

    .game-grid {
        gap: 0.42rem;
    }

    .tile {
        font-size: clamp(0.96rem, 6vw, 1.45rem);
    }

    .action-row {
        grid-template-columns: 1fr;
    }

    .action-row .button {
        min-height: 4rem;
    }

    .move-button {
        min-height: 2.3rem;
    }

    .move-pad {
        width: min(100%, 12rem);
        gap: 0.28rem;
        padding: 0.28rem;
    }

    .feedback-panel {
        height: 5.5rem;
    }

    .result-layer {
        padding: 0.82rem;
        align-items: center;
        justify-content: flex-start;
    }

    .result-card {
        width: min(100%, 24rem);
    }
}
