:root{color:#776e65;background:#faf8ef;font-family:system-ui,sans-serif}body{margin:0;padding:16px}.game{width:100%;max-width:420px;margin:0 auto}.back{color:#8f7a66;margin-bottom:8px;font-size:.85rem;text-decoration:none;display:inline-block}.back:hover,.back:focus-visible{text-decoration:underline}.header{flex-direction:column;gap:8px;display:flex}.header-top{align-items:stretch;gap:8px;display:flex}.header .logo{color:#f9f6f2;background:#edc22e;border-radius:6px;flex:none;justify-content:center;align-items:center;min-height:56px;margin:0;padding:0 14px;font-size:2rem;font-weight:700;line-height:1;display:flex;box-shadow:0 2px #c9a21f}.score-box{box-sizing:border-box;color:#fff;background:#bbada0;border-radius:6px;flex-direction:column;flex:1 1 0;justify-content:center;align-items:center;min-width:0;padding:4px 6px;display:flex;overflow:hidden}.score-label{color:#f9f6f2;text-transform:uppercase;white-space:nowrap;font-size:.7rem;font-weight:700;line-height:1.2}.score-value{white-space:nowrap;font-variant-numeric:tabular-nums;max-width:100%;font-size:1.4rem;font-weight:700;line-height:1.2}.header-actions{gap:8px;display:flex}button{color:#fff;cursor:pointer;background:#7a6655;border:0;border-radius:4px;padding:8px 12px;font-size:1rem}.header .btn{color:#fff;background:#7a6653;border-radius:6px;flex:1 1 0;min-width:0;min-height:44px;padding:6px 8px;font-size:.9rem;font-weight:700;line-height:1.2;transition:transform .1s,box-shadow .1s;box-shadow:0 2px #5c4c3d}.header .btn.primary{background:#d0401c;box-shadow:0 2px #9c2f13}.header .btn:active{box-shadow:none;transform:translateY(2px)}.header .btn:focus-visible{outline-offset:2px;outline:3px solid #edc22e}@media (prefers-reduced-motion:reduce){.header .btn{transition:none}.header .btn:active{transform:none}}.message{text-align:center;min-height:1.5em;margin:8px 0;font-weight:700}.board{box-sizing:border-box;aspect-ratio:1;touch-action:none;background:#bbada0;border-radius:6px;grid-template-rows:repeat(4,minmax(0,1fr));grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;width:100%;padding:8px;display:grid}.help-dialog{box-sizing:border-box;color:#776e65;background:#faf8ef;border:0;border-radius:8px;width:calc(100% - 32px);max-width:420px;max-height:calc(100dvh - 32px);padding:16px;overflow-y:auto}.help-dialog::backdrop{background:#00000080}.help-dialog h2{margin:0 0 8px;font-size:1.4rem}.close-help{width:100%;min-height:48px;margin-top:12px;display:block}.help{margin:8px 0 0;font-size:.9rem;line-height:1.5}.help p{margin:6px 0}.example{align-items:center;gap:8px;margin:6px 0;display:flex}.mini{background:#bbada0;border-radius:4px;grid-template-columns:repeat(4,28px);grid-auto-rows:28px;gap:3px;padding:3px;display:grid}.mini .cell{font-size:.85rem}.cell.merged{animation:.2s ease-out pop}.cell.new{animation:.2s ease-out appear}@keyframes pop{50%{transform:scale(1.15)}}@keyframes appear{0%{opacity:0;transform:scale(.6)}to{opacity:1;transform:scale(1)}}@media (prefers-reduced-motion:reduce){.cell.merged,.cell.new{animation:none}}.controls{grid-template-columns:repeat(3,64px);grid-template-areas:".up.""left down right";justify-content:center;gap:8px;margin-top:12px;display:grid}.dir{touch-action:manipulation;height:64px;padding:0;font-size:1.6rem}.dir.up{grid-area:up}.dir.left{grid-area:left}.dir.down{grid-area:down}.dir.right{grid-area:right}.cell{background:#cdc1b4;border-radius:4px;justify-content:center;align-items:center;min-width:0;min-height:0;font-size:clamp(1rem,7vw,2rem);font-weight:700;display:flex}.cell[data-value="2"]{background:#eee4da}.cell[data-value="4"]{background:#ede0c8}.cell[data-value="8"]{color:#f9f6f2;background:#f2b179}.cell[data-value="16"]{color:#f9f6f2;background:#f59563}.cell[data-value="32"]{color:#f9f6f2;background:#f67c5f}.cell[data-value="64"]{color:#f9f6f2;background:#f65e3b}.cell[data-value="128"]{color:#f9f6f2;background:#edcf72}.cell[data-value="256"]{color:#f9f6f2;background:#edcc61}.cell[data-value="512"]{color:#f9f6f2;background:#edc850}.cell[data-value="1024"]{color:#f9f6f2;background:#edc53f;font-size:clamp(.8rem,5.5vw,1.6rem)}.cell[data-value="2048"]{color:#f9f6f2;background:#edc22e;font-size:clamp(.8rem,5.5vw,1.6rem)}
