/* 2048's ceramic terrace: game-specific, with all numbers and actions in HTML. */
#mg-2048.mg-shell {background:#dcefe9 url("../game-2048-mint/background.32ef804859a6.webp") center / cover fixed; color:#214a46; padding:20px 16px 32px}
#mg-2048 .mg-wrap--2048 {width:min(100%,1220px);max-width:1220px}
#mg-2048 .mg-play-head--2048 {padding:0;border:0;background:transparent;min-height:0;box-shadow:none}
html[data-classroom-playing] #mg-2048 .mg-play-head--2048:has(> [data-play-native-control]:first-child) {display:none}
#mg-2048 .mg-board-panel--2048 {position:relative;display:grid;grid-template-columns:minmax(0,1fr) minmax(270px,320px);align-items:center;gap:24px;border:0;border-radius:0;padding:8px 0;background:transparent;box-shadow:none;overflow:visible}
#mg-2048 .mg-board-panel--2048::before {display:none}
html[data-classroom-playing] #mg-2048 #mg-2048-board, #mg-2048 #mg-2048-board {grid-column:1;grid-row:1;width:min(100%,590px,calc(100dvh - var(--classroom-play-height,72px) - 68px));min-width:0;margin:0 0 0 auto;padding:clamp(10px,1.5vw,18px);gap:clamp(8px,1.2vw,14px);border:3px solid #e2d6bb;border-radius:25px;background:linear-gradient(150deg,#fdf9ed,#d9d2bf);box-shadow:0 8px 0 #aaa58f,0 20px 35px #28594d36}
#mg-2048 .mg-2048-board:focus-visible {outline:4px solid #095e71;outline-offset:4px}
#mg-2048 .mg-2048-cell {overflow:visible;border-radius:14px;border:1px solid #cec8b8;background:#d6d5c9;box-shadow:inset 0 3px 6px #77756822}
#mg-2048 .mg-2048-tile {border:1px solid #d2cbb9;border-radius:13px;color:#28504c;box-shadow:inset 0 -6px 0 #285c4a18,inset 0 3px 4px #ffffffaa,0 3px 3px #7d826d30;font-size:clamp(26px,5vw,54px);animation:none}
#mg-2048 .mg-2048-tile--v2 {background:#fff9e9;color:#35554f}
#mg-2048 .mg-2048-tile--v4 {background:#a8dfcd;color:#204f43}
#mg-2048 .mg-2048-tile--v8 {background:#ffc3a8;color:#633b2c}
#mg-2048 .mg-2048-tile--v16 {background:#f5a98e;color:#603324}
#mg-2048 .mg-2048-tile--v32 {background:#7bccb5;color:#153f34}
#mg-2048 .mg-2048-tile--v64 {background:#ffdf84;color:#654710}
#mg-2048 :is(.mg-2048-tile--v128,.mg-2048-tile--v256,.mg-2048-tile--v512) {background:#f5b39e;color:#5a3026;font-size:clamp(23px,4.3vw,45px)}
#mg-2048 :is(.mg-2048-tile--v1024,.mg-2048-tile--v2048,.mg-2048-tile--super) {background:#ffdb72;color:#513e14;font-size:clamp(20px,3.8vw,38px)}
#mg-2048 .mg-2048-side {grid-column:2;grid-row:1;display:grid;align-content:center;gap:12px;min-width:0;padding:18px;border:1px solid #b9d6c8;border-radius:24px;background:#fffcf1f5;box-shadow:0 6px 0 #b7ccbd,0 12px 24px #28594d20}
#mg-2048 .mg-2048-side > * {grid-column:1;grid-row:auto}
#mg-2048 .mg-board-intro {display:block;margin:0;padding:0;border:0;background:transparent}
#mg-2048 .mg-board-intro strong {display:block;color:#214d43;font-size:22px;line-height:1.3;word-break:keep-all}
#mg-2048 .mg-board-intro span {display:block;color:#536d61;font-size:15px;line-height:1.5;word-break:keep-all}
#mg-2048 .mg-score-boxes {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#mg-2048 .mg-score-boxes span {display:flex;flex-direction:column;gap:3px;min-height:72px;padding:8px;border:1px solid #bbd8c6;border-radius:14px;background:#e4f3e6;color:#234d41;box-shadow:none}
#mg-2048 .mg-score-boxes small {font-size:14px;line-height:1.2;color:#45695a}
#mg-2048 .mg-score-boxes b {font-size:24px;line-height:1.2;overflow-wrap:anywhere}
#mg-2048 .mg-toolbar--2048 {display:flex;gap:8px;margin:0;padding:0;border:0;background:transparent}
#mg-2048 .mg-toolbar--2048 .mg-primary {background:#2d8471;border-color:#2d8471;color:#fff}
#mg-2048 .mg-toolbar--2048 button {min-height:48px;flex:1;min-width:0;font-size:16px}
html[data-classroom-playing] #mg-2048 .mg-2048-controls,#mg-2048 .mg-2048-controls {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,64px);gap:8px;width:100%;margin:0;align-self:auto}
#mg-2048 .mg-2048-controls button {min-width:0;min-height:64px;padding:8px 4px;border:1px solid #a9cbbf;border-radius:14px;background:#fffdf6;color:#25594e;box-shadow:0 3px 0 #b4cfc2;font-size:16px;line-height:1.2;white-space:nowrap}
#mg-2048 .mg-2048-controls button:disabled {opacity:1;background:#e6eee9;color:#748a7f;border-color:#c9d8cf;box-shadow:none}
#mg-2048 .mg-2048-controls button span {font-size:22px}
#mg-2048 .mg-2048-controls [data-direction=up] {grid-column:2;grid-row:1}
#mg-2048 .mg-2048-controls [data-direction=left] {grid-column:1;grid-row:2}
#mg-2048 .mg-2048-controls [data-direction=right] {grid-column:3;grid-row:2}
#mg-2048 .mg-2048-controls [data-direction=down] {grid-column:2;grid-row:3}
#mg-2048 .mg-status-row {display:flex;gap:8px;min-height:0;margin:0}
#mg-2048 .mg-status-row :is(.mg-status,.mg-thought) {flex:1;min-width:0;min-height:38px;margin:0;padding:8px 10px;border:0;border-radius:10px;background:#e5f2e8;color:#365a4a;font-size:14px;line-height:1.45;word-break:keep-all}
#mg-2048 .mg-status-row .mg-thought:empty {display:none}
#mg-2048 .mg-2048-mascot {display:none;position:absolute;left:0;bottom:20px;width:220px;height:190px;object-fit:contain;pointer-events:none;filter:drop-shadow(0 4px 3px #44634c35)}
@media (min-width:1280px) and (orientation:landscape) {#mg-2048 .mg-2048-mascot {display:block}}
#mg-2048 .mg-board-panel--2048 > [data-game-result-style] {grid-column:1 / -1}
#mg-2048 [data-game-result-style] {border-color:#b7dacb!important;background:#fffdf3!important}
#mg-2048 [data-game-result-style] [data-result-part=title] {color:#205247!important}
#mg-2048 [data-game-result-style] [data-result-part=primary] {border-color:#287e6b!important;background:#287e6b!important;color:#fff!important}
body:has(#mg-2048) #classroom-play-toolbar {background:#f8fbf2;color:#264f45}
body:has(#mg-2048) #classroom-play-toolbar h1 {color:#264f45}
body:has(#mg-2048) #classroom-play-toolbar :is(button,a) {background:#fffdf6;border-color:#c3dcd0;color:#326358}
#mg-2048 :is(button,a):focus-visible {outline:3px solid #075a71;outline-offset:2px}
@media (max-width:850px), (orientation:portrait) {
  #mg-2048.mg-shell {background-attachment:scroll}
  #mg-2048 .mg-board-panel--2048,html[data-classroom-playing] #mg-2048 .mg-board-panel--2048 {grid-template-columns:minmax(0,1fr);gap:10px;padding:0}
  #mg-2048 .mg-2048-side {display:contents}
  #mg-2048 .mg-board-intro {grid-column:1;grid-row:1;text-align:center;background:#fffdf4ef;border-radius:12px;padding:7px}
  #mg-2048 .mg-board-intro strong {font-size:18px}
  #mg-2048 .mg-board-intro span {font-size:14px}
  #mg-2048 .mg-score-boxes {grid-column:1;grid-row:2;max-width:520px;width:100%;justify-self:center}
  #mg-2048 .mg-score-boxes span {min-height:52px;flex-direction:row;align-items:center;justify-content:space-between;padding:7px 12px}
  #mg-2048 .mg-score-boxes b {font-size:21px}
  html[data-classroom-playing] #mg-2048 #mg-2048-board,#mg-2048 #mg-2048-board {grid-column:1;grid-row:4;width:min(100%,520px);margin:0 auto}
  html[data-classroom-playing] #mg-2048 .mg-2048-controls,#mg-2048 .mg-2048-controls {grid-column:1;grid-row:5;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:56px;max-width:520px;justify-self:center}
  #mg-2048 .mg-2048-controls button {min-height:56px}
  #mg-2048 .mg-2048-controls [data-direction=up] {grid-column:1;grid-row:1}
  #mg-2048 .mg-2048-controls [data-direction=left] {grid-column:2;grid-row:1}
  #mg-2048 .mg-2048-controls [data-direction=right] {grid-column:3;grid-row:1}
  #mg-2048 .mg-2048-controls [data-direction=down] {grid-column:4;grid-row:1}
  #mg-2048 .mg-status-row {grid-column:1;grid-row:6;max-width:520px;width:100%;justify-self:center}
  #mg-2048 .mg-toolbar--2048 {grid-column:1;grid-row:3;max-width:520px;width:100%;justify-self:center}
  #mg-2048 .mg-2048-mascot {display:none}
  #mg-2048 .mg-board-panel--2048 > [data-game-result-style] {grid-column:1;grid-row:7}
}
@media(max-width:480px) {
  #mg-2048.mg-shell {padding-left:12px;padding-right:12px}
  html[data-classroom-playing] #mg-2048.mg-shell {padding-top:8px!important}
  #mg-2048 .mg-board-panel--2048 {gap:7px}
  #mg-2048 .mg-board-intro {display:flex;align-items:center;justify-content:center;padding:5px 8px}
  #mg-2048 .mg-board-intro strong {font-size:16px}
  #mg-2048 .mg-board-intro span {display:none}
  #mg-2048 .mg-score-boxes span {min-height:44px}
  #mg-2048 #mg-2048-board {border-radius:18px}
  #mg-2048 .mg-2048-cell,#mg-2048 .mg-2048-tile {border-radius:10px}
  #mg-2048 .mg-2048-controls button {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;font-size:14px;line-height:1.1}
  #mg-2048 .mg-2048-controls button span {font-size:19px;line-height:1}
}
@media(prefers-reduced-motion:reduce) {#mg-2048 :is(.mg-2048-tile,.mg-2048-board,.mg-2048-controls button) {animation:none!important;transition:none!important}}
/* The server's actual move is shown before the new tile settles. */
#mg-2048 .mg-2048-cell:has(.is-slide,.is-spawn,.is-merged) {z-index:2}
#mg-2048 .mg-2048-tile.is-slide {animation:mint-slide 180ms ease-out both}
#mg-2048 .mg-2048-tile.is-spawn {animation:mint-spawn 200ms ease-out both}
#mg-2048 .mg-2048-tile.is-merged {animation:mint-merge 260ms ease-out both}
@keyframes mint-slide {from{transform:translate(calc(var(--mg-from-x,0) * (100% + var(--mg-cell-gap,0px))),calc(var(--mg-from-y,0) * (100% + var(--mg-cell-gap,0px))))}to{transform:translate(0,0)}}
@keyframes mint-spawn {from{opacity:.45;transform:scale(.65)}to{opacity:1;transform:scale(1)}}
@keyframes mint-merge {0%{transform:translate(calc(var(--mg-from-x,0) * (100% + var(--mg-cell-gap,0px))),calc(var(--mg-from-y,0) * (100% + var(--mg-cell-gap,0px)))) scale(.92)}60%{transform:translate(0,0) scale(1.09)}100%{transform:translate(0,0) scale(1)}}
@media(prefers-reduced-motion:reduce) {#mg-2048 .mg-2048-tile:is(.is-slide,.is-spawn,.is-merged) {animation:none!important}}
/* The game page loads this separately; shared guides retain their own layout. */
@media (max-width: 400px) and (max-height: 700px) {
  dialog[data-screen-guide] #pg-guide:has(.pg-screen-link img[src*="/guide-screens/game_2048/next.jpg"]) {
    grid-template-rows: 44px auto auto minmax(240px, 1fr) 0 auto 56px;
  }
  dialog[data-screen-guide] #pg-guide:has(.pg-screen-link img[src*="/guide-screens/game_2048/next.jpg"]) .pg-progress {
    height: 44px;
    flex-wrap: nowrap;
    justify-content: space-between;
  }
  dialog[data-screen-guide] .pg-screen-link:has(img[src*="/guide-screens/game_2048/next.jpg"]) {
    max-width: 210px !important;
  }
  dialog[data-screen-guide] .pg-screen-link:has(img[src*="/guide-screens/game_2048/next.jpg"]) .pg-screen-label {
    padding-bottom: 0;
  }
}
