:root{--bg-color: #faf8ef;--text-color: #776e65;--board-bg: #bbada0;--grid-cell-bg: rgba(238, 228, 218, .35);--primary-button: #8f7a66;--primary-button-hover: #9f8b77;--font-family: "Outfit", "Clear Sans", "Helvetica Neue", Arial, sans-serif}*{box-sizing:border-box;margin:0;padding:0}body{background-color:var(--bg-color);color:var(--text-color);font-family:var(--font-family);min-height:100vh;display:flex;justify-content:center;align-items:center;padding:20px}.game-container{width:100%;max-width:480px;display:flex;flex-direction:column;gap:18px;margin:auto}.header{display:flex;justify-content:space-between;align-items:flex-start}.title-section h1{font-size:3.5rem;font-weight:800;line-height:.9;color:#776e65}.title-section p{font-size:.95rem;color:#776e65;margin-top:6px;opacity:.85}.scores-section{display:flex;gap:8px}.score-box{background:#bbada0;padding:8px 16px;border-radius:6px;text-align:center;min-width:80px;color:#fff}.score-label{font-size:.7rem;font-weight:700;text-transform:uppercase;color:#eee4da}.score-value{font-size:1.4rem;font-weight:700;margin-top:2px}.controls-bar{display:flex;justify-content:space-between;align-items:center}.instructions{font-size:.9rem;color:#776e65}.new-game-btn{background:var(--primary-button);color:#fff;border:none;border-radius:6px;padding:12px 20px;font-size:1rem;font-weight:700;cursor:pointer;transition:background-color .2s ease,transform .1s ease;font-family:inherit}.new-game-btn:hover{background:var(--primary-button-hover);transform:translateY(-1px)}.new-game-btn:active{transform:translateY(0)}.error-banner{background-color:#f8d7da;color:#721c24;border:1px solid #f5c6cb;border-radius:6px;padding:10px 14px;font-size:.9rem;display:flex;justify-content:space-between;align-items:center}.queue-notice,.pending-status{min-height:1.1rem;font-size:.85rem}.queue-notice{color:#721c24;font-weight:700}.pending-status{text-align:center;color:#8f7a66}.retry-btn{background:#721c24;color:#fff;border:none;border-radius:4px;padding:4px 10px;font-size:.8rem;cursor:pointer}.board-container{position:relative;background-color:var(--board-bg);border-radius:8px;padding:12px;width:100%;aspect-ratio:1 / 1}.grid{display:grid;grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(4,1fr);gap:12px;width:100%;height:100%}.cell{background-color:var(--grid-cell-bg);border-radius:6px;display:flex;justify-content:center;align-items:center;position:relative}.tile{width:100%;height:100%;border-radius:6px;display:flex;justify-content:center;align-items:center;font-size:2.2rem;font-weight:700;animation:tileAppear .15s ease-in-out;-webkit-user-select:none;user-select:none}@keyframes tileAppear{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.tile-2{background:#eee4da;color:#776e65}.tile-4{background:#ede0c8;color:#776e65}.tile-8{background:#f2b179;color:#f9f6f2}.tile-16{background:#f59563;color:#f9f6f2}.tile-32{background:#f67c5f;color:#f9f6f2}.tile-64{background:#f65e3b;color:#f9f6f2}.tile-128{background:#edcf72;color:#f9f6f2;font-size:1.8rem;box-shadow:0 0 10px 1px #edcf724d}.tile-256{background:#edcc61;color:#f9f6f2;font-size:1.8rem;box-shadow:0 0 12px 2px #edcc6166}.tile-512{background:#edc850;color:#f9f6f2;font-size:1.8rem;box-shadow:0 0 15px 3px #edc85080}.tile-1024{background:#edc53f;color:#f9f6f2;font-size:1.4rem;box-shadow:0 0 18px 4px #edc53f99}.tile-2048{background:#edc22e;color:#f9f6f2;font-size:1.4rem;box-shadow:0 0 22px 6px #edc22eb3}.tile-super{background:#3c3a32;color:#f9f6f2;font-size:1.2rem}.overlay{position:absolute;top:0;left:0;right:0;bottom:0;background:#eee4dad9;border-radius:8px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:16px;animation:fadeIn .3s ease-in;z-index:10}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.overlay h2{font-size:2.5rem;font-weight:800;color:#776e65}.overlay p{font-size:1.1rem;color:#776e65}.dpad-container{display:flex;flex-direction:column;align-items:center;gap:6px;margin-top:10px}.dpad-row{display:flex;gap:6px}.dpad-btn{background:#8f7a66;color:#fff;border:none;border-radius:6px;width:50px;height:44px;font-size:1.2rem;font-weight:700;cursor:pointer;display:flex;justify-content:center;align-items:center}.dpad-btn:active{background:#9f8b77}.ai-panel{border:1px solid #ded6cc;border-radius:8px;background:#ffffff8c;padding:16px;display:grid;gap:12px}.ai-heading,.ai-controls{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.ai-heading h2{font-size:1.1rem}.ai-heading span,.ai-panel p{font-size:.85rem}.ai-panel p{line-height:1.45}.stats-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.stats-grid div{background:#eee4da;border-radius:6px;padding:9px;min-width:0}.stats-grid dt{font-size:.7rem;font-weight:700;text-transform:uppercase}.stats-grid dd{font-size:1rem;font-weight:700;overflow-wrap:anywhere;margin-top:3px}.ai-btn{border:0;border-radius:6px;background:var(--primary-button);color:#fff;padding:9px 12px;min-height:42px;font:inherit;font-weight:700;cursor:pointer}.ai-btn:disabled{opacity:.55;cursor:not-allowed}.ai-btn:focus-visible,.new-game-btn:focus-visible,.retry-btn:focus-visible,.dpad-btn:focus-visible{outline:3px solid #edc22e;outline-offset:2px}.hint-copy{font-size:.9rem}.stats-error{color:#721c24}.footer{text-align:center;font-size:.8rem;color:#a0978e;margin-top:10px}@media (max-width: 520px){body{padding:12px;align-items:flex-start}.game-container{gap:12px;max-width:440px}.title-section h1{font-size:2.8rem}.title-section p,.instructions{font-size:.78rem}.score-box{min-width:66px;padding:7px 9px}.score-value{font-size:1.15rem}.controls-bar{gap:8px}.new-game-btn{padding:10px 12px;font-size:.9rem}.board-container{padding:8px}.grid{gap:8px}.tile{font-size:clamp(1.15rem,7vw,2rem)}.tile-128,.tile-256,.tile-512{font-size:clamp(.95rem,5vw,1.5rem)}.tile-1024,.tile-2048,.tile-super{font-size:clamp(.8rem,4vw,1.2rem)}.stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
