:root {
    color-scheme: light;
    --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --page-gutter: 32px;
    --section-gap: 32px;
    --hero-gradient: linear-gradient(105deg, #b93862 4%, #df547f 50%, #d47724 96%);
    --hero-underline: linear-gradient(90deg, transparent, rgb(223 84 127 / 34%), rgb(243 162 60 / 34%), transparent);
    --page: #f8f8f8;
    --surface: #ffffff;
    --stage: #faf9f7;
    --soft: #f2f3f5;
    --soft-strong: #e9ebef;
    --ink: #0f172a;
    --copy: #475569;
    --muted: #5b6b7e;
    --accent: #df547f;
    --accent-dark: #b93862;
    --accent-soft: #fce8ef;
    --action: #b93862;
    --action-hover: #9e2f51;
    --action-ink: #ffffff;
    --warm: #f3a23c;
    --warm-soft: #fff3e5;
    --success: #237a5e;
    --danger: #b33a4d;
    --danger-ink: #ffffff;
    --board: #e4e0e5;
    --cell: #f2f0f2;
    --tile: #ffffff;
    --tile-ink: #3d343b;
    --focus: #237a5e;
    --scrim: rgb(15 23 42 / 48%);
    --ease: cubic-bezier(.22, 1, .36, 1);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --page: #17171a;
    --surface: #242427;
    --stage: #2c2c30;
    --soft: #323238;
    --soft-strong: #3b3b42;
    --ink: #f6f7fb;
    --copy: #c4c8d2;
    --muted: #969baa;
    --accent: #f06f99;
    --accent-dark: #ff90b2;
    --accent-soft: #512c3a;
    --action: #f06f99;
    --action-hover: #ff90b2;
    --action-ink: #17171a;
    --warm: #ffb65d;
    --warm-soft: #4b3827;
    --success: #74caae;
    --danger: #ff8795;
    --danger-ink: #17171a;
    --board: #403c42;
    --cell: #504a51;
    --tile: #ffffff;
    --tile-ink: #3d343b;
    --focus: #88d8bd;
    --scrim: rgb(0 0 0 / 68%);
    --hero-gradient: linear-gradient(105deg, #ff90b2 4%, #f06f99 50%, #ffb65d 96%);
    --hero-underline: linear-gradient(90deg, transparent, rgb(240 111 153 / 46%), rgb(255 182 93 / 42%), transparent);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

body {
    min-width: 0;
    min-height: 100dvh;
    overflow-x: clip;
    background: var(--page);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: normal;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
}

#game-workspace, #cupcake-order, #game-guide {
    scroll-margin-top: 128px;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
}

button:not(:disabled),
summary,
a {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

:focus-visible {
    outline: 4px solid color-mix(in srgb, var(--focus) 38%, transparent);
    outline-offset: 4px;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 20000;
    padding: 10px 16px;
    border-radius: 18px;
    background: var(--ink);
    color: var(--page);
    transform: translateY(-180%);
    transition: transform 180ms var(--ease);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10240;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    height: 128px;
    padding: 0 32px;
    background: var(--page);
}

.header-wing {
    display: flex;
    align-items: center;
    height: 64px;
    min-width: 0;
    flex: 1;
    border-radius: 32px;
    background: var(--surface);
}

.header-wing--brand {
    justify-content: flex-end;
}

.header-wing--tools {
    justify-content: flex-start;
}

.header-wing__inner {
    display: flex;
    align-items: center;
    width: 516px;
    height: 48px;
}

.header-wing__inner--brand {
    justify-content: flex-start;
    margin-right: 20px;
}

.header-wing__inner--tools {
    justify-content: flex-end;
    gap: 8px;
    margin-left: 20px;
}

.brand-wordmark {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 18px;
    border-radius: 18px;
    background: var(--warm-soft);
    color: var(--ink);
    font-size: 15px;
    font-weight: 650;
    white-space: nowrap;
}

.brand-wordmark strong {
    margin-right: .28em;
    color: var(--accent);
}

.header-logo {
    display: block;
    width: 88px;
    height: 88px;
    flex: 0 0 88px;
    margin: 0 20px;
    border-radius: 50%;
    background: var(--surface);
    transition: opacity 180ms ease, transform 220ms var(--ease);
}

.header-logo:hover {
    transform: scale(1.035);
}

.header-logo:active {
    opacity: .72;
    transform: scale(.98);
}

.header-logo img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.header-nav a,
.header-action,
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    gap: 7px;
    padding: 0 14px;
    border-radius: 18px;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 180ms ease, color 180ms ease, opacity 180ms ease;
}

.header-nav a:hover,
.header-action:hover,
.theme-toggle:hover {
    background: var(--page);
}

.header-action:active,
.theme-toggle:active {
    opacity: .62;
}

.theme-toggle {
    min-width: 44px;
    padding-inline: 12px;
}

.theme-toggle svg,
.header-action svg {
    width: 18px;
    height: 18px;
}

.theme-toggle__to-light {
    display: none;
}

.theme-toggle[data-mode="dark"] .theme-toggle__to-light {
    display: block;
}

.theme-toggle[data-mode="dark"] .theme-toggle__to-dark {
    display: none;
}

main {
    display: flex;
    justify-content: center;
    width: 100%;
    min-width: 0;
    margin-top: 128px;
    flex-wrap: wrap;
}

.hero,
.play-panel,
.collection-panel,
.guide-panel,
.more-games-panel {
    width: min(1200px, calc(100% - (var(--page-gutter) * 2)));
    border-radius: 32px;
    background: var(--surface);
}

.hero {
    padding: 20px 0;
    text-align: center;
}

.hero-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero h1 {
    margin-bottom: 20px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(38px, 5vw, 56px);
    font-weight: 760;
    line-height: 1.08;
    letter-spacing: -.03em;
}

.hero-title-text {
    display: inline-block;
    max-width: 100%;
    background: var(--hero-gradient);
    background-clip: text;
    color: transparent;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    max-width: 820px;
    margin: 0 auto;
    color: var(--copy);
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.6;
}

.hero-underline {
    position: relative;
    isolation: isolate;
    display: inline-block;
    white-space: nowrap;
}

.hero-underline::after {
    position: absolute;
    right: -.08em;
    bottom: -.06em;
    left: -.08em;
    z-index: -1;
    height: .12em;
    border-radius: 999px;
    background: var(--hero-underline);
    content: "";
    opacity: .76;
    transform: scaleX(.92) rotate(-.6deg);
    transform-origin: center;
    transition: opacity 180ms ease, transform 220ms var(--ease);
}

@media (hover: hover) and (pointer: fine) {
    .hero:hover .hero-underline::after {
        opacity: 1;
        transform: scaleX(1) rotate(-.6deg);
    }
}

.play-panel,
.collection-panel,
.guide-panel,
.more-games-panel {
    margin-top: var(--section-gap);
    padding: clamp(56px, 6vw, 72px) clamp(24px, 5vw, 64px);
}

.more-games-panel {
    scroll-margin-top: 128px;
}

.panel-intro--games {
    margin-bottom: 32px;
}

.game-variant-list {
    display: grid;
    gap: 12px;
    width: min(100%, 880px);
    margin: 0 auto;
}

.game-variant-link {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 20px;
    min-height: 112px;
    padding: 8px 12px 8px 8px;
    background: var(--stage);
    color: var(--ink);
    text-decoration: none;
}

.game-variant-preview {
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    overflow: hidden;
    background-color: #fffdf8;
    background-repeat: no-repeat;
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.game-variant-preview--doge,
.game-variant-preview--princess {
    background-position: center;
    background-size: cover;
}

.game-variant-preview--doge {
    background-image: url("../images/variants/doge/preview.jpg");
}

.game-variant-preview--princess {
    background-image: url("../images/variants/princess/preview.jpg");
}

.game-variant-preview--flappy {
    background: #ec6547;
    color: #ffffff;
}

.game-variant-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.game-variant-copy strong {
    font-size: 18px;
    line-height: 1.3;
}

.game-variant-copy span {
    color: var(--copy);
    line-height: 1.55;
}

.game-variant-link > svg {
    width: 20px;
    height: 20px;
    justify-self: center;
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 180ms var(--ease);
}

@media (hover: hover) and (pointer: fine) {
    .game-variant-link:hover > svg {
        transform: translateX(4px);
    }
}

.play-panel {
    position: relative;
    padding-top: 40px;
    padding-bottom: 48px;
}

.panel-intro {
    max-width: 720px;
    margin: 0 auto 30px;
    text-align: center;
}

.panel-intro h2 {
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(32px, 4vw, 44px);
    font-weight: 760;
    line-height: 1.12;
    letter-spacing: -.035em;
}

.panel-intro p {
    margin: 12px auto 0;
    color: var(--copy);
    font-size: 17px;
    line-height: 1.6;
}

.game-controls {
    display: grid;
    width: min(100%, 600px);
    margin: 0 auto 24px;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.score-strip {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 28px;
    background: var(--soft);
}

.score-item {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, auto);
    align-content: center;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 48px;
    padding: 10px 13px;
    gap: 6px;
    border-radius: 24px;
}

.score-item--primary {
    background: var(--surface);
}

.score-item dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.2;
}

.score-item dd {
    min-width: 0;
    margin: 0;
    color: var(--ink);
    font-size: 19px;
    font-variant-numeric: tabular-nums;
    font-weight: 760;
    line-height: 1.1;
    letter-spacing: -.02em;
}

#score-value {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-item--primary dt,
.score-item--primary dd {
    color: var(--accent-dark);
}

.score-addition {
    position: absolute;
    right: 10px;
    bottom: -4px;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
}

.score-addition.is-visible {
    animation: score-rise 720ms var(--ease);
}

.game-toolbar {
    display: flex;
    align-items: center;
    justify-self: center;
    gap: 8px;
    padding: 4px;
    border-radius: 28px;
    background: var(--soft);
    transition: opacity 180ms ease, transform 220ms var(--ease);
}

.tool-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    gap: 7px;
    padding: 0 15px;
    border-radius: 24px;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 720;
    white-space: nowrap;
    transition: background-color 180ms ease, color 180ms ease, opacity 180ms ease, transform 200ms var(--ease);
}

.tool-button:hover:not(:disabled) {
    background: var(--surface);
}

.tool-button:active:not(:disabled) {
    opacity: .66;
    transform: scale(.98);
}

.tool-button--primary {
    background: var(--action);
    color: var(--action-ink);
}

.tool-button--primary:hover:not(:disabled) {
    background: var(--action-hover);
    color: var(--action-ink);
}

.tool-button--danger {
    background: var(--danger);
    color: var(--danger-ink);
}

.tool-button--danger:hover:not(:disabled) {
    background: var(--danger);
}

.tool-button--full {
    width: 100%;
}

.tool-button:disabled {
    cursor: default;
    opacity: .34;
}

.tool-button svg {
    width: 18px;
    height: 18px;
}

.tool-button--icon {
    width: 48px;
    min-width: 48px;
    padding: 0;
}

.game-stage {
    display: flex;
    align-items: center;
    width: min(100%, 780px);
    margin: 0 auto;
    padding: 24px;
    flex-direction: column;
    border-radius: 28px;
    background: var(--stage);
}

.game-status {
    margin: 0 0 18px;
    color: var(--success);
    font-size: 13px;
    font-weight: 760;
    letter-spacing: .04em;
}

.game-board {
    position: relative;
    width: min(100%, 560px, max(360px, calc(100dvh - 520px)));
    max-width: 560px;
    aspect-ratio: 1;
    padding: 10px;
    border-radius: 24px;
    background: var(--board);
    touch-action: none;
    user-select: none;
}

.board-grid,
.tile-layer {
    position: absolute;
    inset: 10px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.board-grid > span {
    min-width: 0;
    border-radius: 12px;
    background: var(--cell);
}

.tile-layer {
    pointer-events: none;
}

.game-tile {
    position: relative;
    display: grid;
    min-width: 0;
    overflow: hidden;
    place-items: center;
    border-radius: 12px;
    background: var(--tile);
    color: var(--tile-ink);
    transform: translate(var(--slide-x, 0), var(--slide-y, 0));
}

.game-tile.is-sliding {
    z-index: 4;
    transition: transform 145ms var(--ease);
}

.game-tile.is-merge-source {
    z-index: 3;
}

.game-tile.is-new {
    animation: tile-appear 190ms var(--ease);
}

.game-tile.is-merged {
    animation: tile-merge 230ms var(--ease);
}

.cupcake-sprite {
    display: block;
    aspect-ratio: 1;
    background-color: #ffffff;
    background-image: url("../images/cupcake-sprites-white-v2.jpg");
    background-repeat: no-repeat;
    background-position: var(--sprite-x, 0%) var(--sprite-y, 0%);
    background-size: 400% 400%;
}

.game-tile__art {
    width: 88%;
}

.game-tile__value {
    position: absolute;
    right: 7%;
    bottom: 6%;
    min-width: 31px;
    padding: 3px 6px;
    border-radius: 8px;
    background: rgb(255 255 255 / 90%);
    color: #3f343c;
    font-size: clamp(.66rem, 1.25vw, .82rem);
    font-variant-numeric: tabular-nums;
    font-weight: 820;
    line-height: 1.1;
    text-align: center;
}

.control-hint {
    max-width: 560px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    text-align: center;
}

.control-hint__touch {
    display: none;
}

.progress-panel {
    display: grid;
    width: min(100%, 780px);
    margin: 24px auto 0;
    padding: 22px;
    grid-template-columns: 1.08fr .92fr;
    gap: 18px 28px;
    border-radius: 28px;
    background: var(--soft);
}

.progress-panel__heading {
    grid-column: 1 / -1;
}

.progress-panel__heading h2 {
    color: var(--ink);
    font-size: 18px;
    font-weight: 760;
    letter-spacing: -.015em;
}

.progress-panel__heading p {
    margin-top: 3px;
    color: var(--copy);
    font-size: 13px;
    line-height: 1.5;
}

.current-cupcake {
    display: grid;
    min-width: 0;
    grid-template-columns: 124px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

.current-cupcake__art {
    display: grid;
    width: 124px;
    overflow: hidden;
    place-items: center;
    aspect-ratio: 1;
    border-radius: 22px;
    background: #ffffff;
}

.current-cupcake__art .cupcake-sprite {
    width: 100%;
}

.current-cupcake__art .is-empty {
    opacity: .35;
}

.current-cupcake__copy {
    min-width: 0;
}

.current-cupcake__copy > span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.current-cupcake__copy > strong {
    display: block;
    color: var(--accent);
    font-size: clamp(42px, 6vw, 62px);
    font-variant-numeric: tabular-nums;
    font-weight: 780;
    letter-spacing: -.04em;
    line-height: 1;
}

.current-cupcake__copy h3 {
    margin-top: 7px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(17px, 2vw, 22px);
    font-weight: 740;
    line-height: 1.15;
    letter-spacing: -.025em;
}

.goal-panel {
    min-width: 0;
    align-self: center;
}

.goal-panel h3 {
    color: var(--ink);
    font-size: 13px;
    font-weight: 740;
}

.next-goal {
    display: grid;
    margin-top: 8px;
    gap: 2px;
}

.next-goal strong {
    color: var(--accent-dark);
    font-size: clamp(32px, 4vw, 40px);
    font-variant-numeric: tabular-nums;
    font-weight: 780;
    letter-spacing: -.035em;
    line-height: 1.05;
}

.next-goal p {
    color: var(--copy);
    font-size: 13px;
    line-height: 1.45;
}

.next-goal small {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.panel-intro--collection {
    position: relative;
    margin-bottom: 24px;
}

.level-example {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 22px 24px;
    gap: clamp(10px, 2.5vw, 24px);
    border-radius: 28px;
    background: var(--warm-soft);
}

.level-example__cupcake {
    display: grid;
    width: clamp(72px, 10vw, 96px);
    flex: 0 1 96px;
    place-items: center;
    gap: 6px;
}

.level-example__cupcake .cupcake-sprite {
    width: 100%;
    border-radius: 16px;
}

.level-example__cupcake strong {
    color: var(--ink);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    font-weight: 780;
}

.level-example__cupcake--result strong {
    color: var(--accent-dark);
}

.level-example__symbol {
    flex: 0 0 auto;
    color: color-mix(in srgb, var(--ink) 66%, var(--warm));
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 580;
}

.collection-state {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 36px;
    margin: 20px auto 0;
    padding: 7px 14px;
    gap: 8px;
    border-radius: 18px;
    background: var(--accent-soft);
    color: var(--accent-dark) !important;
    font-size: 12px !important;
    flex-wrap: wrap;
}

.collection-state strong,
.collection-state span {
    white-space: nowrap;
}

.level-browser {
    width: min(100%, 880px);
    margin: 24px auto 0;
    border-radius: 24px;
    background: var(--soft);
}

.level-browser > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 14px 20px;
    gap: 20px;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.level-browser > summary::-webkit-details-marker {
    display: none;
}

.level-browser > summary > span {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.level-browser > summary strong {
    font-size: 15px;
    font-weight: 740;
}

.level-browser > summary small {
    overflow: hidden;
    color: var(--copy);
    font-size: 12px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.level-browser > summary svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    color: var(--muted);
    transition: transform 180ms var(--ease);
}

.level-browser[open] > summary svg {
    transform: rotate(180deg);
}

.cupcake-track {
    display: grid;
    width: 100%;
    min-width: 0;
    padding: 0 16px 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;
}

.cupcake-step {
    position: relative;
    display: grid;
    align-items: center;
    min-width: 0;
    padding: 8px;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    border-radius: 18px;
    background: transparent;
}

.cupcake-step.is-current {
    background: var(--accent-soft);
}

.cupcake-step .cupcake-sprite {
    width: 72px;
    border-radius: 14px;
    opacity: .42;
}

.cupcake-step.is-reached .cupcake-sprite {
    opacity: 1;
}

.cupcake-step > div {
    display: flex;
    align-items: baseline;
    min-width: 0;
    padding: 0;
    gap: 8px;
}

.cupcake-step strong {
    flex: 0 0 auto;
    color: var(--accent-dark);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 780;
    line-height: 1.2;
}

.cupcake-step h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 13px;
    font-weight: 680;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-details {
    display: grid;
    width: min(100%, 880px);
    margin: 0 auto 24px;
    padding: 20px 22px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    border-radius: 24px;
    background: var(--warm-soft);
}

.game-details > div {
    min-width: 0;
}

.game-details dt {
    color: var(--ink);
    font-size: 12px;
    font-weight: 720;
}

.game-details dd {
    margin-top: 5px;
    color: color-mix(in srgb, var(--ink) 78%, var(--warm));
    font-size: 13px;
    line-height: 1.5;
}

.guide-grid {
    display: grid;
    width: min(100%, 880px);
    margin: 0 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 10px;
}

.guide-group {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 10px;
}

.guide-group h3 {
    margin: 0 4px 2px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

.guide-group details {
    min-width: 0;
    border-radius: 24px;
    background: var(--soft);
}

.guide-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 18px;
    gap: 14px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 720;
    list-style: none;
}

.guide-group summary::-webkit-details-marker {
    display: none;
}

.guide-group summary svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--muted);
    transition: transform 180ms var(--ease);
}

.guide-group details[open] summary svg {
    transform: rotate(180deg);
}

.guide-group details > div {
    padding: 0 18px 18px;
}

.guide-group details p {
    color: var(--copy);
    font-size: 13px;
    line-height: 1.6;
}

.guide-group details p + p {
    margin-top: 8px;
}

.origin-note {
    width: min(100%, 880px);
    margin: 24px auto 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

.origin-note a {
    color: var(--ink);
    font-weight: 680;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--ink) 28%, transparent);
    text-underline-offset: 3px;
}

.site-footer {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 128px;
    padding: 0 32px;
}

.footer-capsule {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    min-width: 0;
    padding: 10px 16px;
    flex: 1;
    border-radius: 32px;
    background: var(--surface);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 44px;
    padding: 6px;
    border-radius: 999px;
    background: radial-gradient(circle, var(--warm-soft) 8%, transparent 100%);
}

.footer-content p {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 8px 10px;
    color: var(--copy);
    font-size: 14px;
    line-height: 1.4;
}

.footer-brand-line {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: radial-gradient(circle, var(--surface) 8%, transparent 100%);
    color: var(--ink);
    font-weight: 650;
    white-space: nowrap;
}

.footer-content a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.footer-links {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    border-radius: 999px;
    background: radial-gradient(circle, var(--surface) 8%, transparent 100%);
}

.dialog {
    position: fixed;
    inset: 0;
    width: min(440px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 32px;
    background: transparent;
    color: var(--ink);
}

.dialog::backdrop {
    background: var(--scrim);
}

.dialog__body {
    position: relative;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    padding: 30px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 32px;
    background: var(--surface);
    scrollbar-color: var(--muted) transparent;
    scrollbar-width: thin;
}

.dialog__body > h2 {
    margin: 4px 46px 8px 0;
    color: var(--ink);
    font-size: 28px;
    font-weight: 760;
    line-height: 1.15;
    letter-spacing: -.03em;
}

.dialog__body > p {
    color: var(--copy);
    font-size: 14px;
    line-height: 1.6;
}

.dialog__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 50%;
    background: var(--soft);
    color: var(--ink);
}

.dialog__close:hover {
    background: var(--soft-strong);
}

.dialog__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
    gap: 8px;
}

.setting-list {
    display: grid;
    margin: 20px 0;
    gap: 8px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 12px 16px;
    gap: 16px;
    border-radius: 24px;
    background: var(--soft);
    cursor: pointer;
}

.setting-row > span {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.setting-row strong {
    color: var(--ink);
    font-size: 14px;
}

.setting-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 999px;
    appearance: none;
    background: var(--soft-strong);
    cursor: pointer;
    transition: background-color 180ms ease;
}

.switch::after {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface);
    content: "";
    transition: transform 200ms var(--ease);
}

.switch:checked {
    background: var(--accent);
}

.switch:checked::after {
    transform: translateX(20px);
}

.dialog__footnote {
    margin: -4px 0 18px !important;
    font-size: 12px !important;
}

.result-dialog__body {
    text-align: center;
}

.result-dialog__art {
    width: 150px;
    margin: 0 auto 16px;
    border-radius: 22px;
}

.result-dialog__body > h2 {
    margin: 0 0 8px;
}

.result-dialog__body .dialog__actions {
    justify-content: center;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 15000;
    max-width: min(360px, calc(100% - 40px));
    padding: 12px 16px;
    border-radius: 18px;
    background: var(--ink);
    color: var(--page);
    font-size: 13px;
    font-weight: 680;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 180ms ease, transform 200ms var(--ease);
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes score-rise {
    0% {
        opacity: 0;
        transform: translateY(4px);
    }
    22% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-18px);
    }
}

@keyframes tile-appear {
    from {
        opacity: .35;
        transform: scale(.78);
    }
}

@keyframes tile-merge {
    45% {
        transform: scale(1.06);
    }
}

@media (pointer: coarse) {
    .control-hint__touch {
        display: inline;
    }

    .control-hint__keyboard {
        display: none;
    }
}

@media (min-width: 1120px) {
    .game-toolbar {
        position: absolute;
        top: calc(clamp(40px, 5vw, 64px) + 80px);
        right: clamp(24px, 6vw, 72px);
        flex-direction: column;
    }
}

@media (min-width: 1120px) and (hover: hover) and (pointer: fine) {
    .game-toolbar {
        opacity: 0;
        pointer-events: none;
        transform: translateX(6px);
    }

    .play-panel:hover .game-toolbar,
    .game-toolbar:focus-within {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(0);
    }
}

@media (max-width: 1263.98px) {
    .header-wing__inner--brand {
        margin-left: 20px;
    }

    .header-wing__inner--tools {
        margin-right: 20px;
    }
}

@media (max-width: 1040px) {
    .header-nav a:nth-child(2) {
        display: none;
    }
}

@media (max-width: 767.98px) {
    :root {
        --page-gutter: 14px;
        --section-gap: 20px;
    }

    body {
        font-size: 14px;
    }

    .site-header {
        display: grid;
        padding: 0 14px;
        grid-template-columns: 88px minmax(0, 1fr) 64px;
        column-gap: 14px;
    }

    .header-logo {
        order: 1;
        grid-column: 1;
        margin: 0;
    }

    .header-wing--brand {
        width: 100%;
        min-width: 0;
        order: 2;
        grid-column: 2;
        justify-content: center;
        overflow: hidden;
    }

    .header-wing__inner--brand {
        width: auto;
        margin: 0;
        justify-content: center;
    }

    .brand-wordmark {
        max-width: 100%;
        padding-inline: 14px;
    }

    .header-wing--tools {
        width: 64px;
        min-width: 64px;
        order: 3;
        grid-column: 3;
        justify-content: center;
        overflow: visible;
    }

    .header-wing__inner--tools {
        width: 64px;
        margin: 0;
        justify-content: center;
    }

    .header-nav,
    #install-actions {
        display: none !important;
    }

    .theme-toggle {
        display: inline-flex;
        width: 44px;
        min-width: 44px;
        padding: 0;
    }

    .hero,
    .play-panel,
    .collection-panel,
    .guide-panel {
        width: calc(100% - (var(--page-gutter) * 2));
    }

    .hero {
        padding: 20px 0;
    }

    .hero-content {
        padding-inline: 18px;
    }

    .hero h1 {
        margin-bottom: 12px;
        font-size: clamp(36px, 10vw, 46px);
    }

    .hero-subtitle {
        font-size: 15px;
    }

    .play-panel,
    .collection-panel,
    .guide-panel {
        padding: 48px 20px;
    }

    .play-panel {
        padding-top: 32px;
    }

    .panel-intro {
        margin-bottom: 24px;
    }

    .panel-intro h2 {
        font-size: clamp(29px, 8.5vw, 38px);
    }

    .panel-intro p {
        font-size: 15px;
    }

    .control-hint__touch {
        display: inline;
    }

    .control-hint__keyboard {
        display: none;
    }

    .game-controls {
        margin-bottom: 18px;
    }

    .score-item {
        grid-template-columns: minmax(0, 1fr);
        min-height: 52px;
        padding: 8px 10px;
        gap: 3px;
        text-align: center;
    }

    .score-item dd {
        font-size: 17px;
    }

    .game-toolbar {
        width: fit-content;
        max-width: 100%;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    .game-toolbar .tool-button {
        width: 48px;
        min-width: 48px;
        flex: 0 0 48px;
    }

    .game-stage {
        padding: 18px;
        border-radius: 24px;
    }

    .game-board {
        width: min(100%, max(280px, calc(100dvh - 550px)));
        border-radius: 20px;
    }

    .progress-panel {
        padding: 18px;
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .progress-panel__heading,
    .current-cupcake,
    .goal-panel {
        grid-column: 1;
    }

    .current-cupcake {
        grid-template-columns: 132px minmax(0, 1fr);
    }

    .current-cupcake__art {
        width: 132px;
    }

    .level-example {
        padding: 18px 16px;
        gap: 8px;
    }

    .collection-state {
        max-width: 100%;
    }

    .level-browser > summary {
        min-height: 68px;
        padding: 12px 16px;
    }

    .cupcake-track {
        width: 100%;
        padding: 0 12px 12px;
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
    }

    .cupcake-step {
        width: 100%;
        min-width: 0;
    }

    .guide-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .game-details {
        padding: 18px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 18px;
    }

    .site-footer {
        padding: 0 14px;
    }

    .footer-capsule {
        margin: 32px 0;
        padding: 10px;
    }

    .footer-content {
        width: 100%;
        padding: 8px;
        border-radius: 24px;
        background: transparent;
    }

    .footer-content p {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .footer-brand-line {
        order: 1;
    }

    .footer-links {
        width: 100%;
        order: 2;
    }
}

@media (max-width: 520px) {
    .brand-wordmark {
        font-size: 14px;
    }

    .progress-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .current-cupcake,
    .goal-panel {
        grid-column: 1;
    }

    .current-cupcake {
        grid-template-columns: 104px minmax(0, 1fr);
    }

    .current-cupcake__art {
        width: 104px;
    }

    .dialog__body {
        padding: 24px;
    }

    .dialog__actions {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 390px) {
    .brand-wordmark {
        padding-inline: 10px;
        font-size: 13px;
    }

    .game-stage {
        padding-inline: 12px;
    }

    .level-example {
        padding-inline: 12px;
        gap: 6px;
    }

    .level-example__cupcake {
        width: 58px;
        flex-basis: 58px;
    }

    .level-example__symbol {
        font-size: 20px;
    }

    .game-board {
        padding: 8px;
    }

    .board-grid,
    .tile-layer {
        inset: 8px;
        gap: 6px;
    }
}

@media (max-width: 560px) {
    .game-variant-link {
        grid-template-columns: 72px minmax(0, 1fr) 32px;
        gap: 12px;
        min-height: 88px;
    }

    .game-variant-preview {
        width: 72px;
        height: 72px;
        font-size: 17px;
    }

    .game-variant-copy strong {
        font-size: 16px;
    }

    .game-variant-copy span {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media (forced-colors: active) {
    .hero-title-text {
        background: none;
        color: CanvasText;
        -webkit-text-fill-color: CanvasText;
    }

    .hero-underline::after {
        display: none;
    }

    .header-wing,
    .hero,
    .play-panel,
    .collection-panel,
    .guide-panel,
    .more-games-panel,
    .game-stage,
    .game-board,
    .dialog__body {
        border: 1px solid CanvasText;
    }

    .tool-button,
    .theme-toggle,
    .header-nav a,
    .guide-grid details,
    .game-details,
    .cupcake-step {
        border: 1px solid CanvasText;
    }
}
