        .color-card {
            width: 36px;
            height: 36px;
            border-radius: 12px;
            cursor: pointer;
            border: 2px solid transparent;
            transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
        }

        .color-card:hover {
            transform: scale(1.1);
        }

        .color-card.active {
            border-color: var(--ink);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            transform: scale(1.1);
        }

        :root {
            --bg: #ffffff;
            --ink: #20222d;
            --ink-soft: #54576a;
            --muted: #a7aabb;
            --dot: #dfe1ec;
            --arrow-color: #20222d;
            --accent: #6a63f6;
            --accent-soft: #edebff;
            --accent-press: #5b54e6;
            --danger: #ff5f6d;
            --heart-empty: #e6e7f1;
            --surface: #f4f4f9;
            --surface-press: #e9e9f3;
            --success: #4ade80;
            --success-soft: rgba(34, 197, 94, 0.12);
            --radius-lg: 28px;
            --radius-md: 18px;
            --safe-top: env(safe-area-inset-top, 0px);
            --safe-bottom: env(safe-area-inset-bottom, 0px)
        }

        [data-theme=dark] {
            --bg: #1a1a2e;
            --ink: #e8e8f0;
            --ink-soft: #8a8db0;
            --muted: #5a5d7a;
            --dot: #3a3d5c;
            --arrow-color: #e8e8f0;
            --accent: #8b84ff;
            --accent-soft: #2a2848;
            --accent-press: #7a73e6;
            --danger: #ff7a86;
            --heart-empty: #3a3d5c;
            --surface: #252540;
            --surface-press: #2e2e52;
            --success: #4ade80;
            --success-soft: rgba(74, 222, 128, 0.15)
        }

        * {
            box-sizing: border-box
        }

        body,
        html {
            height: 100%
        }

        body {
            margin: 0;
            background: var(--bg);
            color: var(--ink);
            font-family: Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            -webkit-tap-highlight-color: transparent;
            overscroll-behavior: none;
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none
        }

        body.no-anim * {
            transition-duration: 1ms !important;
            animation-duration: 1ms !important
        }

        #app {
            position: relative;
            width: 100%;
            max-width: 480px;
            margin: 0 auto;
            height: 100vh;
            height: 100dvh;
            overflow: hidden;
            display: flex;
            flex-direction: column
        }

        .screen {
            position: absolute;
            inset: 0;
            display: flex;
            flex-direction: column;
            padding: calc(20px + var(--safe-top)) 24px calc(20px + var(--safe-bottom));
            opacity: 0;
            transform: translateY(10px);
            pointer-events: none;
            transition: opacity .32s ease, transform .32s ease
        }

        #screen-community,
        #screen-my-levels {
            align-items: stretch;
            align-content: start
        }

        .screen.active {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto
        }

        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
            min-height: 44px
        }

        .topbar h2 {
            font-size: 17px;
            font-weight: 800;
            margin: 0;
            letter-spacing: .02em
        }

        .topbar-spacer {
            width: 40px
        }

        .icon-btn {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: var(--surface);
            color: var(--ink-soft);
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease
        }

        .icon-btn:active {
            background: var(--surface-press);
            transform: scale(.94)
        }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            width: 100%;
            border: none;
            border-radius: 999px;
            padding: 16px 20px;
            font-size: 16.5px;
            font-weight: 800;
            font-family: inherit;
            cursor: pointer;
            transition: transform .1s ease, background .15s ease, opacity .15s ease;
            letter-spacing: .02em
        }

        .btn:active {
            transform: scale(.975)
        }

        .btn-primary {
            background: var(--accent);
            color: #fff
        }

        .btn-primary:active {
            background: var(--accent-press)
        }

        [data-theme=dark] .btn-primary {
            background: var(--accent);
            color: #fff
        }

        [data-theme=dark] .btn-primary:active {
            background: var(--accent-press)
        }

        .btn-community {
            background: #fb4;
            color: #fff
        }

        .btn-community:active {
            background: #ec9532
        }

        [data-theme=dark] .btn-community {
            background: #f8c648;
            color: #1a1a2e
        }

        [data-theme=dark] .btn-community:active {
            background: #f59e0b
        }

        .btn-ghost {
            background: var(--surface);
            color: var(--ink);
            font-weight: 700
        }

        .btn-ghost:active {
            background: var(--surface-press)
        }

        .btn[disabled] {
            opacity: .4;
            pointer-events: none
        }

        .pill-btn {
            border: none;
            border-radius: 999px;
            background: var(--surface);
            color: var(--ink-soft);
            font-family: inherit;
            font-weight: 700;
            font-size: 14.5px;
            padding: 12px 18px;
            display: flex;
            align-items: center;
            gap: 7px;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease
        }

        .pill-btn:active {
            background: var(--surface-press);
            transform: scale(.96)
        }

        .pill-btn svg {
            width: 16px;
            height: 16px
        }

        #btn-editor-publish:hover {
            background: #22c55e
        }

        #btn-editor-publish:active {
            background: #16a34a;
            transform: scale(.96)
        }

        #screen-menu {
            align-items: center;
            justify-content: center;
            text-align: center
        }

        .logo {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            margin-bottom: 2px
        }

        .logo-mark {
            width: 30px;
            height: 28px;
            color: var(--accent)
        }

        .logo-text {
            font-size: 34px;
            font-weight: 800;
            letter-spacing: .04em;
            margin: 0;
            color: var(--ink)
        }

        .menu-sub {
            font-size: 15px;
            color: var(--muted);
            font-weight: 700;
            margin: 0 0 40px;
            letter-spacing: .03em
        }

        .menu-buttons {
            width: 100%;
            max-width: 280px;
            display: flex;
            flex-direction: column;
            gap: 10px
        }

        .level-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 12px;
            margin-top: 12px;
            overflow-y: auto;
            padding: 4px 2px 20px
        }

        .level-btn {
            aspect-ratio: 1;
            border: none;
            border-radius: 12px;
            background: var(--surface);
            color: var(--ink-soft);
            font-family: inherit;
            font-size: 13px;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease, color .15s ease, box-shadow .15s ease;
            max-width: 44px;
            max-height: 44px;
            margin: 0 auto;
            width: 100%;
            position: relative
        }

        .level-btn:active {
            transform: scale(.9)
        }

        .level-btn.current {
            background: var(--accent-soft);
            color: var(--accent);
            box-shadow: 0 0 0 2px var(--accent-soft)
        }

        .level-btn.completed {
            background: var(--accent);
            color: #fff
        }

        .level-btn.locked {
            background: var(--surface);
            color: var(--muted);
            opacity: .5;
            cursor: not-allowed
        }

        .level-btn .check {
            position: absolute;
            bottom: 1px;
            right: 1px;
            width: 12px;
            height: 12px;
            background: #000;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 6px;
            line-height: 1
        }

        #screen-game {
            padding-bottom: calc(14px + var(--safe-bottom))
        }

        .game-title {
            font-size: 15px;
            font-weight: 800;
            color: var(--ink-soft);
            letter-spacing: .03em
        }

        .hearts-row {
            display: flex;
            justify-content: center;
            gap: 8px;
            margin: 6px 0 8px
        }

        .heart {
            width: 24px;
            height: 24px
        }

        .heart.filled path {
            fill: var(--danger)
        }

        .heart.empty path {
            fill: var(--heart-empty)
        }

        .board-wrap {
            touch-action: none;
            -webkit-touch-callout: none
        }

        .piece {
            touch-action: none;
            pointer-events: all
        }

        .piece .hit {
            pointer-events: all
        }

        .board-wrap {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 0;
            padding: 2px 0;
            overflow: hidden;
            position: relative;
            touch-action: manipulation;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            user-select: none;
            background: var(--bg)
        }

        #board-svg {
            width: auto;
            height: auto;
            flex-shrink: 0;
            overflow: visible;
            shape-rendering: geometricPrecision
        }

        #board-svg * {
            shape-rendering: geometricPrecision
        }

        .piece {
            cursor: pointer;
            opacity: 0;
            display: none;
            transform-origin: center;
            transform-box: fill-box;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent
        }

        .piece .hit {
            fill: none;
            stroke: transparent;
            pointer-events: all
        }

        .piece.entered {
            opacity: 1;
            display: block
        }

        .piece .visible-line {
            fill: none;
            stroke: var(--arrow-color);
            stroke-linecap: round;
            stroke-linejoin: round
        }

        .piece .arrowhead-path {
            stroke: var(--arrow-color);
            fill: none;
            stroke-linejoin: round;
            stroke-linecap: round;
            transition: stroke .15s ease
        }

        .piece {
            touch-action: none;
            pointer-events: all
        }

        .piece .hit {
            pointer-events: all
        }

        .piece.blocked .visible-line {
            stroke: var(--danger)
        }

        .piece.blocked .arrowhead-path {
            stroke: var(--danger)
        }

        .piece.remove-fade {
            opacity: .55 !important;
            transition: opacity .18s ease, transform .12s ease;
            cursor: pointer
        }

        .piece.remove-fade:hover {
            opacity: 1 !important;
            transform: scale(1.04)
        }

        .piece.hint-active {
            animation: hintBlink .36s ease-in-out infinite alternate
        }

        .piece.hint-active .visible-line {
            stroke: var(--accent);
            stroke-width: 4px
        }

        [data-theme=dark] .piece.hint-active .visible-line {
            stroke: var(--success)
        }

        .piece.hint-active .arrowhead-path {
            stroke: var(--accent);
            stroke-width: 4px
        }

        [data-theme=dark] .piece.hint-active .arrowhead-path {
            stroke: var(--success)
        }

        @keyframes hintBlink {
            from {
                opacity: 1
            }

            to {
                opacity: .5
            }
        }

        #grid-lines-layer {
            pointer-events: none
        }

        .grid-exit-line {
            stroke: var(--accent);
            stroke-linecap: round;
            stroke-opacity: .35;
            pointer-events: none
        }

        [data-theme=dark] .grid-exit-line {
            stroke: var(--ink)
        }

        .piece.shake {
            animation: shake .32s ease
        }

        @keyframes shake {

            0%,
            100% {
                transform: translateX(0)
            }

            25% {
                transform: translateX(-2.5px)
            }

            75% {
                transform: translateX(2.5px)
            }
        }

        .dot {
            fill: var(--dot);
            transition: fill .2s ease;
            opacity: 1;
            transform-origin: center;
            transform-box: fill-box
        }

        @keyframes dotPop {
            0% {
                transform: scale(1);
                fill: var(--dot)
            }

            35% {
                transform: scale(1.3);
                fill: var(--accent)
            }

            100% {
                transform: scale(1);
                fill: var(--dot)
            }
        }

        @keyframes dotRingPop {
            0% {
                transform: scale(0);
                opacity: 0;
                fill: var(--accent)
            }

            50% {
                transform: scale(1.4);
                opacity: 1;
                fill: var(--accent)
            }

            100% {
                transform: scale(1);
                opacity: 1;
                fill: var(--dot)
            }
        }

        .dot.pop {
            animation: dotPop .7s cubic-bezier(.34, 1.3, .64, 1);
            transform-origin: center;
            transform-box: fill-box
        }

        .game-actions {
            display: flex;
            justify-content: center;
            gap: 12px;
            margin-top: 6px
        }

        .game-action-btn {
            position: relative
        }

        .settings-list {
            margin-top: 12px
        }

        .setting-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--surface);
            border-radius: var(--radius-md);
            padding: 16px 18px;
            margin-bottom: 12px;
            font-size: 15.5px;
            font-weight: 700;
            letter-spacing: .02em
        }

        .toggle {
            width: 46px;
            height: 28px;
            border-radius: 999px;
            border: none;
            background: var(--muted);
            position: relative;
            cursor: pointer;
            padding: 0;
            transition: background .18s ease;
            flex-shrink: 0
        }

        .toggle[data-on=true] {
            background: var(--accent)
        }

        .toggle-knob {
            position: absolute;
            top: 3px;
            left: 3px;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: #fff;
            transition: transform .18s ease
        }

        .toggle[data-on=true] .toggle-knob {
            transform: translateX(18px)
        }

        .overlay {
            position: absolute;
            inset: 0;
            background: rgba(32, 34, 45, .32);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            opacity: 0;
            pointer-events: none;
            transition: opacity .26s ease;
            z-index: 10
        }

        [data-theme=dark] .overlay {
            background: rgba(0, 0, 0, .55)
        }

        .overlay.visible {
            opacity: 1;
            pointer-events: auto
        }

        .overlay-panel {
            position: relative;
            z-index: 2;
            background: var(--bg);
            border-radius: var(--radius-lg);
            padding: 32px 26px 26px;
            width: 100%;
            max-width: 320px;
            text-align: center;
            transform: scale(.94) translateY(6px);
            transition: transform .26s cubic-bezier(.34, 1.3, .64, 1)
        }

        .overlay.visible .overlay-panel {
            transform: scale(1) translateY(0)
        }

        .overlay-panel h2 {
            font-size: 21px;
            font-weight: 800;
            margin: 0 0 6px;
            letter-spacing: .03em
        }

        .overlay-panel p {
            font-size: 14.5px;
            color: var(--muted);
            margin: 0 0 22px;
            font-weight: 700;
            letter-spacing: .02em
        }

        .overlay.visible .overlay-panel {
            transform: scale(1) translateY(0)
        }

        .overlay-panel h2 {
            font-size: 21px;
            font-weight: 800;
            margin: 0 0 6px;
            letter-spacing: .03em
        }

        .overlay-panel p {
            font-size: 14.5px;
            color: var(--muted);
            margin: 0 0 22px;
            font-weight: 700;
            letter-spacing: .02em
        }

        .win-hearts {
            display: flex;
            justify-content: center;
            gap: 9px;
            margin-bottom: 16px
        }

        .win-hearts .heart {
            width: 28px;
            height: 28px
        }

        .overlay-buttons {
            display: flex;
            flex-direction: column;
            gap: 10px
        }

        .toggle-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--surface);
            border: none;
            border-radius: 999px;
            padding: 12px 18px;
            margin-top: 10px;
            font-family: inherit;
            font-size: 15px;
            font-weight: 700;
            color: var(--ink);
            cursor: pointer;
            letter-spacing: .02em
        }

        ::-webkit-scrollbar {
            width: 5px;
            height: 5px
        }

        ::-webkit-scrollbar-track {
            background: 0 0
        }

        ::-webkit-scrollbar-thumb {
            background: var(--dot);
            border-radius: 10px
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--muted)
        }

        * {
            scrollbar-width: thin;
            scrollbar-color: var(--dot) transparent
        }

        #my-levels-container::-webkit-scrollbar,
        .community-grid::-webkit-scrollbar,
        .level-grid::-webkit-scrollbar,
        .settings-list::-webkit-scrollbar {
            width: 4px
        }

        #my-levels-container::-webkit-scrollbar-track,
        .community-grid::-webkit-scrollbar-track,
        .level-grid::-webkit-scrollbar-track,
        .settings-list::-webkit-scrollbar-track {
            background: 0 0;
            margin: 4px 0
        }

        #my-levels-container::-webkit-scrollbar-thumb,
        .community-grid::-webkit-scrollbar-thumb,
        .level-grid::-webkit-scrollbar-thumb,
        .settings-list::-webkit-scrollbar-thumb {
            background: var(--dot);
            border-radius: 10px
        }

        #my-levels-container::-webkit-scrollbar-thumb:hover,
        .community-grid::-webkit-scrollbar-thumb:hover,
        .level-grid::-webkit-scrollbar-thumb:hover,
        .settings-list::-webkit-scrollbar-thumb:hover {
            background: var(--muted)
        }

        @media (max-width:767px) {
            .community-card .pill-btn .btn-label {
                display: none
            }

            .community-card .pill-btn svg {
                margin-right: 0 !important
            }

            .community-card .pill-btn {
                padding: 8px 10px !important;
                justify-content: center;
                min-width: 0
            }
        }

        .ad-icon {
            width: 14px;
            height: 14px;
            color: inherit;
            opacity: .7;
            flex-shrink: 0;
            pointer-events: none
        }

        .ad-icon-badge {
            position: absolute;
            top: -5px;
            right: -5px;
            width: 18px;
            height: 18px;
            background: var(--accent);
            color: #fff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            pointer-events: none
        }

        .ad-icon-badge svg {
            width: 10px;
            height: 10px
        }

        .ad-icon-badge {
            position: absolute;
            top: -5px;
            right: -5px;
            width: 18px;
            height: 18px;
            background: var(--accent);
            color: #fff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            pointer-events: none
        }

        .ad-icon-badge svg {
            width: 10px;
            height: 10px
        }

        .game-action-count {
            position: absolute;
            top: -6px;
            right: -6px;
            min-width: 18px;
            height: 18px;
            background: var(--accent);
            color: #fff;
            border-radius: 50%;
            font-size: 10px;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 4px;
            z-index: 2;
            pointer-events: none
        }

        .game-action-btn {
            position: relative
        }

        #ad-countdown-overlay {
            position: absolute;
            inset: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 25;
            opacity: 0;
            transition: opacity .3s ease
        }

        .unlock-toast {
            position: fixed;
            top: calc(20px + var(--safe-top));
            left: 50%;
            transform: translateX(-50%) translateY(-20px);
            background: var(--accent);
            color: #fff;
            padding: 14px 24px;
            border-radius: 999px;
            font-size: 15px;
            font-weight: 800;
            z-index: 100;
            opacity: 0;
            transition: opacity .3s ease, transform .3s cubic-bezier(.34, 1.3, .64, 1);
            pointer-events: none;
            white-space: nowrap;
            letter-spacing: .03em
        }

        .unlock-toast.visible {
            opacity: 1;
            transform: translateX(-50%) translateY(0)
        }

        .congrats-panel {
            background: var(--bg);
            border-radius: var(--radius-lg);
            padding: 40px 20px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
            text-align: center;
            width: 100%;
            max-width: 320px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transform: scale(.94) translateY(6px);
            animation: panelIn 0.4s ease-out forwards;
        }

        .congrats-text, .win-title {
            font-size: 32px;
            font-weight: 800;
            background: linear-gradient(45deg, #ff5f6d, #ffc371, #4ade80, #3b82f6, #6a63f6);
            background-size: 300% 300%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            animation: congratsIn .55s cubic-bezier(.34, 1.3, .64, 1), gradientParty 3s ease infinite, partyBounce 1.5s ease-in-out infinite alternate;
        }

        @keyframes congratsIn {
            from {
                transform: scale(.3);
                opacity: 0
            }

            to {
                transform: scale(1);
                opacity: 1
            }
        }

        @keyframes gradientParty {
            0% {
                background-position: 0% 50%;
            }

            50% {
                background-position: 100% 50%;
            }

            100% {
                background-position: 0% 50%;
            }
        }

        @keyframes partyBounce {
            0% {
                transform: translateY(0) scale(1) rotate(-3deg);
            }

            100% {
                transform: translateY(-12px) scale(1.05) rotate(3deg);
            }
        }

        #confetti-canvas {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 1
        }

        #overlay-congrats {
            background: rgba(255, 255, 255, .92) !important;
            z-index: 19;
            pointer-events: none !important
        }

        #overlay-congrats.visible {
            pointer-events: auto !important
        }

        [data-theme=dark] #overlay-congrats {
            background: rgba(26, 26, 46, .92) !important
        }

        .menu-buttons {
            max-width: 320px
        }

        .editor-toolbar {
            display: flex;
            gap: 8px;
            padding: 8px 0;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch
        }

        .editor-tool-btn {
            border: none;
            border-radius: 999px;
            background: var(--surface);
            color: var(--ink-soft);
            font-family: inherit;
            font-weight: 700;
            font-size: 13px;
            padding: 10px 16px;
            white-space: nowrap;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease, color .15s ease;
            flex-shrink: 0
        }

        .editor-tool-btn:active {
            transform: scale(.96)
        }

        .editor-tool-btn.active {
            background: var(--accent);
            color: #fff
        }

        .editor-bottom-bar {
            display: flex;
            gap: 8px;
            padding: 10px 0;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch
        }

        .editor-bottom-bar .pill-btn {
            flex: 1;
            justify-content: center;
            white-space: nowrap
        }

        .editor-properties {
            background: var(--surface);
            border-radius: var(--radius-md);
            padding: 14px 16px;
            margin-top: 8px;
            display: none
        }

        .editor-prop-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 700
        }

        .editor-prop-row:last-child {
            margin-bottom: 0
        }

        .editor-meta-row {
            display: flex;
            gap: 8px;
            margin-bottom: 10px;
            align-items: center
        }

        .editor-meta-row label {
            font-size: 13px;
            font-weight: 700;
            color: var(--ink-soft);
            min-width: 60px
        }

        .editor-meta-row input,
        .editor-meta-row select {
            flex: 1;
            border: none;
            border-radius: 12px;
            background: var(--surface);
            padding: 10px 12px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 700;
            color: var(--ink);
            outline: 0
        }

        .editor-meta-row input:focus,
        .editor-meta-row select:focus {
            box-shadow: 0 0 0 2px var(--accent-soft)
        }

        .community-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            margin-top: 12px;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 4px 2px 20px;
            align-items: start;
            align-content: start;
            width: 100%;
            min-width: 0
        }

        .my-levels-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            align-items: start;
            align-content: start;
            width: 100%;
            min-width: 0
        }

        @media (min-width:768px) {
            .community-grid {
                grid-template-columns: repeat(4, 1fr)
            }

            .my-levels-grid {
                grid-template-columns: repeat(4, 1fr)
            }

            .level-grid {
                grid-template-columns: repeat(10, 1fr)
            }
        }

        .community-card {
            background: var(--surface);
            border-radius: var(--radius-md);
            padding: 14px 16px;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease;
            text-align: left;
            border: none;
            box-shadow: none;
            align-self: stretch;
            display: flex;
            flex-direction: column;
            min-width: 0
        }

        .community-card>div:nth-child(2),
        .my-level-card>div:nth-child(2) {
            width: 100% !important;
            height: 80px !important;
            min-height: 0 !important;
            flex-shrink: 0 !important
        }

        .community-card:active {
            background: var(--surface-press);
            transform: scale(.98)
        }

        .my-levels-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            align-items: stretch;
            align-content: start;
            width: 100%;
            min-width: 0
        }

        .my-level-card {
            align-self: stretch;
            display: flex;
            flex-direction: column;
            min-width: 0;
            background: var(--surface);
            border-radius: var(--radius-md);
            padding: 14px 16px;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease;
            border: none;
            box-shadow: none
        }

        .my-level-card:active {
            background: var(--surface-press);
            transform: scale(.98)
        }

        @media (min-width:768px) {
            .my-levels-grid {
                grid-template-columns: repeat(4, 1fr)
            }
        }

        .search-bar {
            width: 100%;
            border: none;
            border-radius: 999px;
            background: var(--surface);
            padding: 12px 18px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 700;
            color: var(--ink);
            outline: 0;
            margin-bottom: 10px
        }

        .search-bar:focus {
            box-shadow: 0 0 0 2px var(--accent-soft)
        }

        .sort-select {
            border: none;
            border-radius: 999px;
            background: var(--surface);
            padding: 10px 14px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 700;
            color: var(--ink);
            outline: 0;
            margin-bottom: 10px
        }

        .editor-piece.selected .editor-visible-line {
            stroke: var(--accent)
        }

        .editor-piece.selected .editor-arrowhead {
            stroke: var(--accent)
        }

        .editor-handle {
            pointer-events: all;
            cursor: grab
        }

        .editor-handle:active {
            cursor: grabbing
        }

        .editor-dot {
            transition: fill .15s ease
        }

        .editor-zoom-controls {
            position: absolute;
            bottom: 12px;
            right: 12px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            z-index: 5
        }

        .editor-zoom-btn {
            width: 36px;
            height: 36px;
            border: none;
            border-radius: 50%;
            background: var(--surface);
            color: var(--ink-soft);
            font-size: 18px;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
            transition: background .15s ease, transform .1s ease
        }

        .editor-zoom-btn:active {
            background: var(--surface-press);
            transform: scale(.94)
        }

        .unsaved-indicator {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--danger);
            margin-left: 6px
        }

        .editor-properties .pill-btn {
            background: var(--surface);
            border: 1.5px solid var(--dot);
            box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
            justify-content: center;
            min-height: 36px
        }

        .editor-properties .pill-btn:active {
            background: var(--surface-press);
            transform: scale(.96)
        }

        .editor-properties .pill-btn#btn-arrow-delete {
            background: rgba(255, 95, 109, .08);
            border-color: rgba(255, 95, 109, .3);
            color: var(--danger)
        }

        #screen-editor {
            padding: calc(12px + var(--safe-top)) 16px calc(12px + var(--safe-bottom))
        }

        #screen-editor .topbar {
            margin-bottom: 4px;
            min-height: 40px;
            padding-right: 160px
        }

        #screen-editor .topbar h2 {
            font-size: 15px;
            padding-left: 10px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex: 1;
            min-width: 0
        }

        #screen-editor .editor-toolbar {
            display: none
        }

        #screen-editor #editor-board-wrap {
            flex: 0 0 auto;
            height: calc(100% - 180px);
            min-height: 320px;
            max-height: 520px;
            border-radius: var(--radius-md);
            background: var(--surface);
            margin: 4px 0;
            position: relative;
            touch-action: none
        }

        #screen-editor .editor-undo-redo {
            display: none
        }

        #screen-editor .editor-zoom-controls {
            position: absolute;
            bottom: 12px;
            right: 12px
        }

        #screen-editor .editor-zoom-btn {
            width: 32px;
            height: 32px;
            font-size: 16px;
            background: var(--bg);
            opacity: .85
        }

        #screen-editor .editor-sidebar {
            display: none
        }

        #screen-editor .editor-bottom-bar {
            display: none
        }

        .mobile-tool-dock {
            position: fixed;
            bottom: calc(20px + var(--safe-bottom));
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            align-items: center;
            gap: 2px;
            background: var(--surface);
            padding: 5px 6px;
            border-radius: 999px;
            z-index: 8;
            transition: transform .2s ease, opacity .2s ease;
            box-shadow: 0 2px 12px rgba(0, 0, 0, .08)
        }

        .mobile-tool-dock.hidden {
            transform: translateX(-50%) translateY(100px);
            opacity: 0;
            pointer-events: none
        }

        .mobile-dock-btn {
            width: 42px;
            height: 42px;
            border: none;
            border-radius: 50%;
            background: 0 0;
            color: var(--ink-soft);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease, color .15s ease;
            flex-shrink: 0
        }

        .mobile-dock-btn:active {
            transform: scale(.92)
        }

        .mobile-dock-btn.active {
            background: var(--accent);
            color: #fff
        }

        .mobile-dock-divider {
            width: 1px;
            height: 24px;
            background: var(--dot);
            margin: 0 3px;
            flex-shrink: 0
        }

        .mobile-dock-more-divider {
            width: 1px;
            height: 24px;
            background: var(--dot);
            margin: 0 3px 0 6px;
            flex-shrink: 0
        }

        .mobile-dock-more {
            border-radius: 50%
        }

        .mobile-prop-panel {
            position: relative;
            left: 0;
            right: 0;
            margin: 8px 0 4px 0;
            background: var(--surface);
            border-radius: var(--radius-md);
            padding: 10px 12px;
            z-index: 9;
            transform: translateY(10px);
            opacity: 0;
            pointer-events: none;
            transition: transform .25s cubic-bezier(.34, 1.3, .64, 1), opacity .2s ease;
            display: none
        }

        .mobile-prop-panel.visible {
            transform: translateY(0);
            opacity: 1;
            pointer-events: auto;
            display: block
        }

        .mobile-prop-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px
        }

        .mobile-prop-header span {
            font-size: 13px;
            font-weight: 800;
            color: var(--ink)
        }

        .mobile-prop-close {
            width: 24px;
            height: 24px;
            border: none;
            background: 0 0;
            color: var(--muted);
            font-size: 14px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center
        }

        .mobile-prop-actions {
            display: flex;
            gap: 6px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 2px
        }

        .mobile-prop-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            padding: 10px 12px;
            border: none;
            border-radius: 12px;
            background: var(--bg);
            color: var(--ink-soft);
            font-family: inherit;
            font-size: 11px;
            font-weight: 700;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease;
            flex-shrink: 0;
            min-width: 56px
        }

        .mobile-prop-btn:active {
            transform: scale(.94);
            background: var(--surface-press)
        }

        .mobile-prop-btn svg {
            width: 18px;
            height: 18px
        }

        .mobile-prop-delete {
            background: rgba(255, 95, 109, .1);
            color: var(--danger)
        }

        .mobile-top-actions {
            position: fixed;
            top: calc(12px + var(--safe-top));
            right: 16px;
            display: flex;
            gap: 6px;
            z-index: 8;
            align-items: center
        }

        .mobile-top-actions .pill-btn {
            justify-content: center;
            padding: 8px 14px;
            font-size: 12px;
            margin-top: 0;
            white-space: nowrap;
            border-radius: 999px;
            font-weight: 700;
            height: 36px
        }

        .mobile-bottom-sheet {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--bg);
            border-radius: var(--radius-lg) var(--radius-lg) 0 0;
            padding: 12px 20px calc(20px + var(--safe-bottom));
            z-index: 15;
            transform: translateY(100%);
            transition: transform .3s cubic-bezier(.34, 1.3, .64, 1);
            max-height: 70vh;
            overflow-y: auto
        }

        .mobile-bottom-sheet.visible {
            transform: translateY(0)
        }

        .mobile-sheet-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(32, 34, 45, .4);
            z-index: 14;
            opacity: 0;
            pointer-events: none;
            transition: opacity .25s ease
        }

        .mobile-sheet-backdrop.visible {
            opacity: 1;
            pointer-events: auto
        }

        .mobile-sheet-handle {
            width: 36px;
            height: 4px;
            background: var(--dot);
            border-radius: 2px;
            margin: 0 auto 16px
        }

        .mobile-sheet-title {
            font-size: 17px;
            font-weight: 800;
            color: var(--ink);
            margin-bottom: 14px
        }

        .mobile-sheet-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            gap: 12px
        }

        .mobile-sheet-row label {
            font-size: 14px;
            font-weight: 700;
            color: var(--ink-soft);
            min-width: 70px
        }

        .mobile-sheet-row input {
            flex: 1;
            border: none;
            border-radius: 12px;
            background: var(--surface);
            padding: 10px 12px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 700;
            color: var(--ink);
            outline: 0
        }

        .mobile-sheet-actions {
            display: flex;
            gap: 8px;
            margin-top: 16px
        }

        .mobile-sheet-actions .pill-btn {
            flex: 1;
            justify-content: center;
            margin-top: 0;
            font-size: 13px;
            padding: 12px 6px
        }

        @media (min-width:768px) {
            #app {
                max-width: 960px;
                margin: 0 auto;
                padding: 0 24px
            }

            #screen-editor {
                display: grid;
                grid-template-columns: 1fr 260px;
                grid-template-rows: auto auto 1fr auto;
                gap: 16px;
                padding: 16px 24px
            }

            #screen-editor .topbar {
                grid-column: 1/-1;
                margin-bottom: 8px
            }

            #screen-editor .editor-toolbar {
                grid-column: 1/-1;
                display: flex !important
            }

            #screen-editor #editor-board-wrap {
                grid-column: 1;
                grid-row: 3;
                height: auto;
                min-height: 0;
                max-height: none;
                margin: 0
            }

            #screen-editor .editor-undo-redo {
                position: absolute;
                top: 12px;
                right: 12px;
                left: auto;
                transform: none;
                display: flex;
                flex-direction: row;
                gap: 8px;
                z-index: 5
            }

            #screen-editor .editor-undo-redo .icon-btn {
                width: 40px;
                height: 40px;
                opacity: 1
            }

            #screen-editor .editor-zoom-controls {
                position: absolute;
                bottom: 12px;
                right: 12px
            }

            #screen-editor .editor-zoom-btn {
                width: 36px;
                height: 36px;
                opacity: 1
            }

            #screen-editor .editor-sidebar {
                grid-column: 2;
                grid-row: 3;
                display: flex !important;
                flex-direction: column;
                gap: 10px;
                overflow-y: auto
            }

            #screen-editor .editor-bottom-bar {
                grid-column: 1/-1;
                display: flex !important;
                justify-content: center;
                gap: 16px;
                padding: 12px 0
            }

            .mobile-bottom-bar,
            .mobile-bottom-sheet,
            .mobile-prop-panel,
            .mobile-sheet-backdrop,
            .mobile-tool-dock,
            .mobile-top-actions {
                display: none !important
            }
        }

        @media (min-width:768px) {
            #app {
                max-width: 960px;
                margin: 0 auto;
                padding: 0 24px
            }

            #screen-editor {
                display: grid;
                grid-template-columns: 1fr 260px;
                grid-template-rows: auto auto 1fr auto;
                gap: 16px;
                padding: 16px 24px
            }

            #screen-editor .topbar {
                grid-column: 1/-1
            }

            #screen-editor .editor-toolbar {
                grid-column: 1/-1
            }

            #screen-editor #editor-board-wrap {
                grid-column: 1;
                grid-row: 3;
                border-radius: var(--radius-md);
                background: var(--surface)
            }

            #screen-editor .editor-sidebar {
                grid-column: 2;
                grid-row: 3;
                display: flex;
                flex-direction: column;
                gap: 10px;
                overflow-y: auto
            }

            #screen-editor .editor-bottom-bar {
                grid-column: 1/-1;
                justify-content: center;
                gap: 16px;
                padding: 12px 0
            }
        }

        .editor-tool-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px
        }

        .editor-tool-btn svg {
            width: 16px;
            height: 16px;
            pointer-events: none
        }

        .icon-only {
            padding: 10px 12px !important
        }

        .icon-only svg {
            width: 18px;
            height: 18px;
            pointer-events: none
        }

        .menu-icon-row {
            display: flex;
            justify-content: center;
            gap: 14px;
            margin-top: 16px
        }

        .menu-circle-btn {
            width: 52px;
            height: 52px;
            border: none;
            border-radius: 50%;
            background: var(--surface);
            color: var(--ink-soft);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background .15s ease, transform .1s ease, color .15s ease
        }

        .menu-circle-btn:active {
            background: var(--surface-press);
            transform: scale(.92)
        }

        .menu-circle-btn svg {
            width: 22px;
            height: 22px;
            pointer-events: none
        }

        #fill-grid-row {
            transition: opacity .2s ease
        }

        #fill-grid-row.visible {
            display: flex !important
        }

        body,
        html {
            overflow: hidden
        }

        .screen {
            overflow: hidden
        }

        .settings-list {
            overflow-y: auto;
            min-height: 0
        }

        .level-grid {
            flex: 1;
            min-height: 0
        }

        .community-grid {
            flex: 1;
            min-height: 0
        }

        #my-levels-container {
            flex: 1;
            min-height: 0
        }

        #screen-menu {
            justify-content: safe center;
            overflow-y: auto;
            scrollbar-width: none
        }

        #screen-menu::-webkit-scrollbar {
            display: none
        }

        .overlay-panel {
            max-height: calc(100% - 32px);
            overflow-y: auto
        }

        @media (max-height:480px) {
            .logo-text {
                font-size: 26px
            }

            .menu-sub {
                margin-bottom: 18px
            }

            .btn {
                padding: 12px 18px;
                font-size: 15px
            }

            .menu-circle-btn {
                width: 46px;
                height: 46px
            }
        }

        .prop-btn {
            flex: 1;
            margin-top: 0 !important;
            padding: 6px 8px !important;
            font-size: 11px !important;
            font-weight: 800 !important;
            justify-content: center;
            gap: 4px;
            min-height: 32px;
            letter-spacing: .02em
        }

        .prop-btn svg {
            width: 14px;
            height: 14px;
            flex-shrink: 0;
            pointer-events: none
        }

        .prop-btn span {
            pointer-events: none
        }

        #btn-arrow-delete.prop-btn {
            background: rgba(255, 95, 109, .08) !important;
            border: 1.5px solid rgba(255, 95, 109, .3) !important;
            color: var(--danger) !important
        }

        .editor-piece.highlighted .editor-visible-line {
            stroke: var(--danger) !important;
            stroke-width: 3px !important
        }

        .editor-piece.highlighted .editor-arrowhead {
            stroke: var(--danger) !important;
            stroke-width: 3px !important
        }

        .editor-piece.highlighted {
            animation: highlightPulse 1s ease-in-out infinite
        }

        @keyframes highlightPulse {

            0%,
            100% {
                opacity: 1
            }

            50% {
                opacity: .6
            }
        }

        .test-spinner {
            width: 40px;
            height: 40px;
            border: 3px solid var(--dot);
            border-top-color: var(--accent);
            border-radius: 50%;
            animation: spin .8s linear infinite
        }

        @keyframes spin {
            to {
                transform: rotate(360deg)
            }
        }

        .test-piece.test-hint .test-visible-line {
            stroke: var(--success) !important;
            stroke-width: 3px !important
        }

        .test-piece.test-hint .test-arrowhead {
            stroke: var(--success) !important;
            stroke-width: 3px !important
        }

        .test-piece.test-hint {
            opacity: 1 !important;
            animation: testHintShine 1.2s ease-in-out 2
        }

        @keyframes testHintShine {

            0%,
            100% {
                opacity: 1
            }

            50% {
                opacity: .4
            }
        }

        .test-piece.test-blocked .test-visible-line {
            stroke: var(--danger);
            stroke-width: 3px
        }

        .test-piece.test-blocked .test-arrowhead {
            stroke: var(--danger);
            stroke-width: 3px
        }

        .test-piece.test-blocked {
            animation: testBlockedPulse 1s ease-in-out infinite
        }

        @keyframes testBlockedPulse {

            0%,
            100% {
                opacity: 1
            }

            50% {
                opacity: .5
            }
        }

        #test-modal-board-wrap {
            touch-action: none;
            position: relative;
            overflow: hidden;
            min-height: 280px;
            max-height: 380px;
            display: flex;
            align-items: center;
            justify-content: center
        }

        #test-modal-svg {
            width: 100%;
            height: 100%;
            flex-shrink: 0;
            overflow: visible;
            max-width: 100%;
            max-height: 100%;
            min-width: 200px;
            min-height: 200px
        }

        #test-modal-board-wrap {
            min-height: 280px !important;
            max-height: 380px !important
        }

        #test-modal-svg {
            min-width: 200px !important;
            min-height: 200px !important
        }

        #publish-confirm:hover {
            background: #22c55e
        }

        #publish-confirm:active {
            background: #16a34a
        }

        .game-action-btn {
            position: relative
        }

        .game-action-btn .ad-badge {
            position: absolute;
            top: -8px;
            right: -8px;
            width: 20px;
            height: 20px;
            background: var(--accent);
            color: #fff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            pointer-events: none
        }

        .game-action-btn .ad-badge svg {
            width: 10px;
            height: 10px
        }

        .lock-icon {
            position: absolute;
            top: -6px;
            right: -6px;
            width: 18px;
            height: 18px;
            background: var(--accent);
            color: #fff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            pointer-events: none;
            font-size: 0
        }

        .lock-icon svg {
            width: 10px;
            height: 10px
        }

        #btn-editor {
            position: relative
        }

        #btn-editor .lock-icon {
            top: -4px;
            right: -4px
        }

        .game-toast {
            animation: fadeUp .3s ease
        }

        @keyframes fadeUp {
            from {
                opacity: 0;
                transform: translateX(-50%) translateY(10px)
            }

            to {
                opacity: 1;
                transform: translateX(-50%) translateY(0)
            }
        }

        .tutorial-overlay {
            position: absolute;
            inset: 0;
            background: rgba(32, 34, 45, .45);
            z-index: 30;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity .3s ease
        }

        #app.tutorial-active #screen-game {
            z-index: 31
        }

        [data-theme=dark] .tutorial-overlay {
            background: rgba(0, 0, 0, .45)
        }

        .tutorial-overlay.visible {
            opacity: 1
        }

        .tutorial-hand {
            position: absolute;
            width: 48px;
            height: 48px;
            z-index: 31;
            pointer-events: none;
            animation: handPoint 1.2s ease-in-out infinite;
            filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .3));
            transform: rotate(180deg)
        }

        @keyframes handPoint {

            0%,
            100% {
                transform: rotate(180deg) translateY(0) scale(1)
            }

            50% {
                transform: rotate(180deg) translateY(-12px) scale(1.05)
            }
        }

        .tutorial-message {
            position: absolute;
            bottom: 120px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg);
            color: var(--ink);
            padding: 16px 24px;
            border-radius: var(--radius-md);
            font-size: 15px;
            font-weight: 800;
            text-align: center;
            max-width: 300px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
            z-index: 31;
            opacity: 0;
            transition: opacity .3s ease;
            pointer-events: none
        }

        .tutorial-message.visible {
            opacity: 1
        }

        .tutorial-highlight {
            position: relative;
            z-index: 35;
            background: var(--bg) !important;
            color: var(--accent) !important;
            box-shadow: 0 0 0 4px var(--accent), 0 0 25px rgba(106, 99, 246, .5);
            border-radius: 999px;
            animation: highlightPulse 1s ease-in-out infinite;
            transform: scale(1.06)
        }

        @keyframes highlightPulse {

            0%,
            100% {
                box-shadow: 0 0 0 4px var(--accent), 0 0 20px rgba(106, 99, 246, .4)
            }

            50% {
                box-shadow: 0 0 0 6px var(--accent), 0 0 30px rgba(106, 99, 246, .6)
            }
        }