@font-face{font-family:Rubik;src:url('/rubik.woff2') format('woff2');font-weight:300 900;font-display:swap}
.intro-content{max-width:704px;width:calc(100% - 32px)}
#restart-dialog .dialog-actions button{position:static;display:inline-block;width:auto;height:auto;border-radius:10px;padding:11px 18px;background:var(--sand)}
#restart-dialog .dialog-actions #confirm-restart{background:var(--ink);color:var(--bg)}
#board .cell[role=button]{cursor:pointer}
:root{color-scheme:light;--bg:#faf8f0;--ink:#756452;--muted:#988876;--sand:#eae7d9;--leather:#baac9a;--panel:#e0dad1;--board-top:#998c7e;--board-bottom:#988776;--empty:#baac9a}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:Rubik,Arial,system-ui,sans-serif;line-height:1.6}a{color:inherit;text-underline-offset:3px}button,select,input{font:inherit;color:inherit}button{cursor:pointer;border:0}button:disabled{cursor:default;opacity:.38}button,a,select,input{touch-action:manipulation}button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible,#board:focus-visible{outline:3px solid #c77940;outline-offset:4px}button{transition:background-color 75ms,transform 120ms}button:hover:not(:disabled){filter:brightness(.96)}[hidden]{display:none!important}h1,h2,h3,p{margin-top:0}h1{line-height:1.05}h2{line-height:1.25}svg{display:block;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.skip-link{position:absolute;top:-60px;left:16px;background:var(--ink);color:var(--bg);padding:8px 16px;z-index:99}.skip-link:focus{top:8px}
.game-shell{width:min(100% - 32px,492px);margin:28px auto 0}.game-header{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px 10px}.game-header h1{font-size:48px;letter-spacing:-2px;font-weight:700;margin:0}.mode-label{display:block;text-align:center;font-size:10px;letter-spacing:2px;line-height:1.8;font-weight:500;text-transform:uppercase}.mode-label:empty{display:none}.game-header>button{width:44px;height:44px;display:grid;place-items:center;border-radius:12px;background:transparent}.game-header>button:last-of-type{justify-self:end}.game-header>button:hover{background:var(--panel)}.game-header>button svg{width:27px;height:27px}.scores{grid-column:1/-1;display:flex;justify-content:center;gap:10px}.score-card{min-width:108px;min-height:56px;position:relative;border-radius:14px;background:var(--sand);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:5px 22px;line-height:1.3;color:var(--muted)}.score-card label{font-weight:500;font-size:11px;letter-spacing:1px}.score-card strong{font-size:22px;font-weight:500;font-variant-numeric:tabular-nums}.score-card.best{border:2px solid var(--sand);background:transparent}.score-gain{position:absolute;left:50%;top:10px;pointer-events:none;font-weight:600;animation:gain 650ms forwards}.game-header+.scores{margin-top:12px}#game-intro{text-align:center;font-size:14px;margin:16px 0 18px;color:var(--muted)}
.board-wrap{width:100%;position:relative}#board{width:100%;aspect-ratio:1;position:relative;isolation:isolate;border-radius:22px;background:linear-gradient(var(--board-top),var(--board-bottom));box-shadow:0 7px 18px #75645220,inset 0 1px 0 #fff3;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;outline:none}.grid-background{position:absolute;inset:2.44%;display:grid;grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(4,1fr);gap:1.67%}.cell{background:var(--empty);border-radius:10px;box-shadow:inset 0 2px 4px #75645216}#tiles{position:absolute;inset:0}.tile{--x:0;--y:0;position:absolute;left:calc(2.03% + var(--x)*24.39%);top:calc(2.03% + var(--y)*24.39%);width:22.76%;height:22.76%;border-radius:12px;display:grid;place-items:center;font-size:clamp(26px,8vw,48px);font-weight:500;line-height:1;color:#fff;background:var(--tile);box-shadow:0 2px 3px #5b453f19,inset 0 1px 0 #fff5;transition:left 120ms ease-out,top 120ms ease-out;cursor:default}.tile[data-value='2']{--tile:#ece4db;color:#756452}.tile[data-value='4']{--tile:#e8d8ba;color:#756452}.tile[data-value='8']{--tile:linear-gradient(#e9b582,#e6af79)}.tile[data-value='16']{--tile:linear-gradient(#e99a6d,#e79362)}.tile[data-value='32']{--tile:linear-gradient(#e8886e,#e57a5d)}.tile[data-value='64']{--tile:linear-gradient(#e67051,#e26240)}.tile[data-value='128']{--tile:linear-gradient(#ebd47f,#edcf64)}.tile[data-value='256']{--tile:linear-gradient(#edda8c,#edcf64)}.tile[data-value='512']{--tile:linear-gradient(#efde9c,#edcf64)}.tile[data-value='1024']{--tile:linear-gradient(#f0df9e,#efd16a)}.tile[data-value='2048']{--tile:linear-gradient(#efdb94,#edc74c);box-shadow:0 0 22px #edc53f55,inset 0 1px 0 #fff8}.tile.large{font-size:clamp(21px,7vw,40px)}.tile.huge{font-size:clamp(19px,6vw,33px)}.tile.super{--tile:#3c3a32;color:#c4bdb7}.tile.new{animation:appear 160ms ease-out}.tile.merged{animation:pop 190ms ease-out}.tile.selected{outline:4px solid #fff;outline-offset:-4px;transform:scale(.92)}#board.selecting .tile{cursor:pointer}#board.selecting .tile:hover{filter:brightness(1.12)}.message{position:absolute;inset:0;z-index:5;border-radius:22px;background:#faf8f0e8;backdrop-filter:blur(3px);display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px;text-align:center}.message h2{font-size:38px;margin:0 0 10px}.message p{max-width:280px;margin-bottom:20px}.message button{margin:4px;padding:10px 20px;border-radius:10px;background:var(--ink);color:var(--bg);font-weight:500}#continue-button{background:#d9ad3b;color:#fff}#status{font-size:13px;min-height:24px;text-align:center;margin:12px 0 7px;color:var(--muted)}
.powerups{display:flex;justify-content:center;gap:10px;background:var(--sand);padding:12px;border-radius:22px;width:fit-content;max-width:100%;margin:0 auto}.powerups button{padding:0;position:relative;background:transparent;display:flex;flex-direction:column;align-items:center;gap:5px;min-width:48px}.powerups .icon{width:48px;height:48px;display:grid;place-items:center;background:var(--leather);color:var(--bg);border-radius:10px}.powerups svg{width:29px;height:29px}.powerups .power-name{font-size:10px;line-height:1.3}.powerups .power-count{font-size:10px;line-height:1.2;letter-spacing:3px}.powerups button[aria-pressed=true] .icon{background:var(--muted)}.powerups button:disabled .icon{background:var(--leather)}.game-links{display:flex;justify-content:center;gap:18px;margin:16px 0 0;font-size:12px;color:var(--muted)}.game-links button{background:transparent;text-decoration:underline;padding:0;font-size:inherit}#tutorial-help{background:var(--sand);border-radius:16px;padding:20px;margin-top:16px}#tutorial-title{font-size:20px;margin-bottom:8px}#tutorial-text{font-size:14px;margin-bottom:12px}#tutorial-next{border-radius:8px;background:var(--ink);color:var(--bg);padding:8px 15px}
.intro-content{border-top:1px solid var(--panel);margin:44px auto 0;padding-top:28px;font-size:14px;line-height:1.8}.intro-content h2{font-size:23px;letter-spacing:-.5px}.intro-content h3{font-size:16px;margin:24px 0 8px}.intro-content p{color:var(--muted);margin-bottom:14px}.intro-content ol,.intro-content ul{padding-left:22px;color:var(--muted)}.intro-content details{padding:14px 0;border-top:1px solid var(--sand)}.intro-content summary{cursor:pointer;font-weight:500}.intro-content details p{margin:10px 0 0}footer{max-width:768px;margin:38px auto 0;padding:24px 16px 28px;text-align:center;color:var(--muted);font-size:11px}footer nav{display:flex;justify-content:center;flex-wrap:wrap;gap:8px 16px;margin-bottom:15px}footer a{text-decoration:none}footer a:hover{text-decoration:underline}footer p{margin:6px 0}
dialog{border:0;padding:28px;border-radius:20px;width:min(100% - 32px,410px);max-height:calc(100svh - 40px);overflow:auto;background:var(--bg);color:var(--ink);box-shadow:0 15px 60px #483d3440}dialog::backdrop{background:#4d423b55;backdrop-filter:blur(3px)}dialog h2{font-size:25px;margin:0 40px 20px 0}dialog p{font-size:14px;color:var(--muted)}dialog>button[data-close]{position:absolute;right:18px;top:17px;background:var(--sand);width:32px;height:32px;border-radius:50%;display:grid;place-items:center}dialog>button[data-close] svg{width:18px;height:18px}dialog nav{display:flex;flex-direction:column;gap:8px}dialog nav a{padding:10px 12px;border-radius:10px;background:var(--sand);text-decoration:none;font-size:15px}dialog nav a:hover{background:var(--panel)}dialog nav a[aria-current=page]{background:var(--leather);color:#fff}dialog .secondary-links{border-top:1px solid var(--sand);margin-top:18px;padding-top:16px;display:grid;grid-template-columns:1fr 1fr;gap:12px;font-size:12px}dialog label{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:20px 0;font-size:14px}dialog select{background:var(--sand);border:0;border-radius:8px;padding:8px}dialog input[type=checkbox]{width:20px;height:20px;accent-color:var(--ink)}#confirm-restart{background:var(--ink);color:var(--bg);border-radius:10px;padding:11px 18px;font-weight:500}#restart-dialog .cancel{position:static;width:auto;height:auto;display:inline-block;background:var(--sand);border-radius:10px;padding:11px 18px;margin-left:8px}
.document{width:min(100% - 32px,704px);margin:34px auto 0}.document header{display:flex;justify-content:space-between;align-items:center;margin-bottom:54px}.document header a{text-decoration:none;font-size:14px}.document header .brand{font-size:26px;font-weight:700;letter-spacing:-1px}.document h1{font-size:40px;letter-spacing:-1.5px;margin-bottom:20px}.document .lead{font-size:19px;color:var(--muted);line-height:1.7}.document h2{font-size:25px;margin:36px 0 12px}.document h3{font-size:18px;margin:24px 0 8px}.document p,.document li{font-size:16px;color:var(--muted)}.document ol,.document ul{padding-left:24px}.document li{margin-bottom:9px}.document .play-link{display:inline-block;padding:12px 22px;border-radius:12px;background:var(--ink);color:var(--bg);text-decoration:none;margin:15px 0}.document code,.document kbd{background:var(--sand);border-radius:4px;padding:2px 6px;font-size:.88em}.document details{border-top:1px solid var(--sand);padding:16px 0}.document summary{cursor:pointer;font-weight:500}
:root[data-theme=dark]{color-scheme:dark;--bg:#242321;--ink:#eee5d8;--muted:#c0b3a2;--sand:#35322d;--leather:#74685c;--panel:#454037;--board-top:#65594c;--board-bottom:#544b42;--empty:#7b6b5a}:root[data-theme=dark] .message{background:#242321e8}body[data-mode=plus] #board{--board-top:#403e39;--board-bottom:#302e29;--empty:#625f57}.reduced-motion *,.reduced-motion *::before,.reduced-motion *::after{animation:none!important;transition:none!important}
@media(max-width:600px){.game-shell{margin-top:16px}.game-header h1{font-size:38px}.game-header{gap:10px}.score-card{min-height:42px;min-width:110px;flex-direction:row;gap:9px;padding:7px 14px}.score-card strong{font-size:19px}.score-card label{font-size:10px}#game-intro{margin:12px 0 16px;font-size:13px}.powerups{gap:8px}.powerups .icon{width:43px;height:43px}.powerups button{min-width:43px}.powerups svg{width:26px;height:26px}.intro-content{margin-top:32px}.document{margin-top:20px}.document header{margin-bottom:36px}.document h1{font-size:33px}.document .lead{font-size:17px}.document p,.document li{font-size:15px}}
@media(max-width:370px){.game-shell{width:calc(100% - 24px)}.powerups{gap:6px;padding:8px}.powerups button{min-width:36px}.powerups .icon{width:36px;height:36px}.powerups .power-name{font-size:9px}.tile{border-radius:8px}.cell{border-radius:7px}.message h2{font-size:30px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
@keyframes appear{from{transform:scale(.3);opacity:.4}to{transform:scale(1);opacity:1}}@keyframes pop{0%{transform:scale(.92)}50%{transform:scale(1.12)}100%{transform:scale(1)}}@keyframes gain{to{transform:translate(-50%,-32px);opacity:0}}

/* Follow-up source comparison and small-screen interaction fixes. */
.game-shell{width:min(100% - 32px,704px);margin-top:24px}
.game-header{grid-template-columns:1fr auto 1fr;gap:8px}
.game-brand{grid-column:1;grid-row:1;display:flex;align-items:center;gap:6px;justify-self:start}
.game-header h1{letter-spacing:0}
#menu-button{display:grid;place-items:center;width:32px;min-height:44px;background:transparent;border-radius:10px;padding:0}
.game-header>.scores{grid-column:2;grid-row:1;justify-self:center;gap:16px}
.score-card{min-width:72px;min-height:52px;padding:6px 16px;border-radius:12px}
.score-card label{font-size:12px;letter-spacing:0}.score-card strong{font-size:20px;font-weight:700}
.game-header>#restart-button{grid-column:3;grid-row:1;width:auto;min-width:110px;height:40px;padding:0 14px;display:flex;gap:8px;background:var(--muted);color:var(--bg);border-radius:8px;box-shadow:inset 0 1px 0 #fff3,0 2px 3px #75645220;font-size:14px}
#restart-button svg{display:none}.board-wrap{max-width:492px;margin:0 auto}
.grid-background{inset:2.439%;gap:2.5641%}
@media(min-width:601px) and (min-height:501px){.game-shell{margin-top:26px}.score-card{height:52px;padding:0 16px}}
#power-actions{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;margin:12px auto 0}
#rotation-options{display:inline-flex;gap:8px}#power-actions button{min-height:44px;border-radius:9px;padding:8px 16px;background:var(--sand);font-size:14px}
.powerups button{min-width:44px;min-height:44px}
.message{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:safe center;gap:10px;padding:16px;overflow:auto}
.message h2,.message p{grid-column:1/-1;width:100%;max-width:none;margin:0}
.message h2{font-size:clamp(23px,6vw,34px)}.message p{font-size:13px;line-height:1.4}
.message button{width:100%;min-width:0;min-height:44px;margin:0;padding:8px;font-size:13px}
#board:has(.message:not([hidden])){touch-action:pan-y}
@media(max-width:600px){
 .game-shell{margin-top:12px}.game-header{grid-template-columns:1fr auto 1fr;gap:10px 6px}
 .game-brand{display:contents}#menu-button{grid-column:1;grid-row:1;justify-self:start}
 .game-header h1{grid-column:2;grid-row:1;justify-self:center;font-size:30px;line-height:36px}.game-header>.scores{grid-column:1/-1;grid-row:2;width:100%;gap:12px}
 .score-card{flex:1;min-width:0;min-height:40px;flex-direction:row;justify-content:space-between;padding:6px 16px}.score-card strong{font-size:18px}
 .game-header>#restart-button{grid-column:3;min-width:44px;width:44px;height:44px;padding:0;justify-content:center;background:transparent;color:var(--ink);box-shadow:none}
 #restart-button svg{display:block}#restart-button .restart-label{display:none}
 #game-intro{font-size:12px;margin:10px 0 14px}.powerups .icon{width:44px;height:44px}
}
@media(max-width:370px){
 body[data-mode=plus] .powerups{display:grid;grid-template-columns:repeat(3,48px);gap:8px;padding:12px}
 .powerups button{min-width:44px}.powerups .icon{width:44px;height:44px}
 .message h2{font-size:24px}.message p{font-size:12px}
}
@media(max-height:500px) and (min-width:480px){
 .game-shell{display:grid;grid-template-columns:1fr 1fr;column-gap:24px;row-gap:8px;margin-top:12px}
 .game-brand{display:flex}
 .game-header{grid-template-columns:1fr auto 1fr;gap:8px}.game-header h1{font-size:32px;line-height:36px}
 .game-header>.scores{grid-column:2;grid-row:1;width:auto;gap:8px}.score-card{flex:none;min-width:64px;min-height:44px;flex-direction:column;justify-content:center;gap:0;padding:4px 10px}
 .game-header,#game-intro{grid-column:1/-1}#game-intro{margin:0;font-size:12px}
 .board-wrap{grid-column:1;grid-row:3/8;width:min(100%,calc(100svh - 108px));align-self:start}
 #status,.powerups,#power-actions,.game-links,#tutorial-help{grid-column:2;margin:0 auto}
 #status{min-height:20px}.powerups{flex-wrap:wrap;max-width:260px}
 .message p{display:none}.message h2{font-size:24px}
}
.language-switcher{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:5px 7px;max-width:720px;margin:22px auto 0;line-height:1.8;font-size:13px}
.site-footer .language-switcher a{display:inline-block;min-width:24px;padding:2px 3px;text-decoration:none}
.language-switcher a[aria-current]{font-weight:700;text-decoration:underline;text-underline-offset:4px}
.language-switcher span{opacity:.4}
html[dir="rtl"] .document,html[dir="rtl"] .intro-content,html[dir="rtl"] dialog{text-align:right}
.game-header,#board,.powerups,#power-actions,.scores{direction:ltr}
html:not([lang="en"]) .power-name{font-size:11px}
html:not([lang="en"]) .powerups{flex-wrap:wrap}
@media(max-width:370px){html:not([lang="en"]) body[data-mode="plus"] .powerups{grid-template-columns:repeat(3,minmax(0,1fr));width:100%}}
