/* ==========================================================================
   2048 — orange & yellow theme
   ========================================================================== */

:root {
  --g48-orange:        #ff7a00;
  --g48-orange-dark:   #d9600a;
  --g48-orange-darker: #b34d05;
  --g48-yellow:        #ffcc33;
  --g48-yellow-dark:   #f0b400;
  --g48-cream:         #fff4de;
  --g48-text:          #5a3a12;
  --g48-bright-text:   #fffaf0;

  --g48-board-bg:      #d9822b;
  --g48-cell-bg:       rgba(255, 244, 222, 0.35);

  --g48-gap:           3cqw;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, var(--g48-yellow) 0%, var(--g48-orange) 100%);
  color: var(--g48-text);
  font-family: "Poppins", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  overflow: hidden;
  touch-action: none;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  padding: 20px 0;
}

a {
  color: var(--g48-text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

strong.g48-text-strong {
  text-transform: uppercase;
}

/* ================= ROTATE / PORTRAIT NOTICE ================= */
/* shown only on phones held in landscape (short viewport); portrait hides it */
.rotate-notice{ display:none; }
@media (orientation:landscape) and (max-height:500px){
  body{overflow: hidden;}
  .rotate-notice{
    display:flex;position:fixed;inset:0;z-index:9999;
    align-items:center;justify-content:center;text-align:center;
    padding:24px;
    background:url("https://akm-img-a-in.tosshub.com/sites/epaper/games/anarkali/assets/bg-cave.webp") center/cover no-repeat, #0a0704;
  }
  .rotate-notice::after{ content:"";position:absolute;inset:0;background:rgba(0,0,0,.72); }
  .rotate-inner{ position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:12px;max-width:420px; }
  .rotate-inner svg{ width:52px;height:52px;color:#f2c14e;animation:rotateHint 2s ease-in-out infinite; }
  .rotate-hi{ font-weight:800;font-size:18px;line-height:1.3;color:#fff; }
  .rotate-en{ font-weight:600;font-size:13px;color:#f2c14e; }
  @keyframes rotateHint{ 0%,60%,100%{ transform:rotate(0); } 30%{ transform:rotate(-90deg); } }
}

/* ================= LOADING SCREEN ================= */
/* Covers the whole app until every tile/background/icon image has been
   fetched once, so nothing pops in mid-animation during real gameplay. */
.g48-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, #E2A123 0%, #C37F0D 100%);
  transition: opacity 300ms ease;
}

.g48-loading-screen--done {
  opacity: 0;
  pointer-events: none;
}

.g48-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 220px;
  padding: 0 24px;
}

.g48-loading-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: g48LoadingSpin 800ms linear infinite;
}

@keyframes g48LoadingSpin {
  to { transform: rotate(360deg); }
}

.g48-loading-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.g48-loading-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #fff;
  transition: width 160ms ease;
}

.g48-loading-text {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--g48-bright-text);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}


/* --------------------------------------------------------------------------
   App frame
   -------------------------------------------------------------------------- */

.g48-app {
  position: relative;
  width: 100%;
  max-width: 360px;
  max-height: 640px;
  overflow: hidden;
  background: var(--g48-cream);
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(140, 70, 0, 0.35);
}

.g48-screen {
  width: 100%;
  height: 100%;
  min-height: 640px;
}

.g48-screen--hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Home screen
   -------------------------------------------------------------------------- */

.g48-home-screen {
  position: relative;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 18px;
  overflow: hidden;
}

.g48-home-art {
  position: absolute;
  inset: 0;
  background-image: url('https://akm-img-a-in.tosshub.com/sites/games/2048/images/home_bg.jpg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}
.g48-at-logo{
  position: relative; 
  margin:auto auto -50px;
}
.g48-game-logo{
  width:100%;
  max-width: 320px;
  margin:auto;
  position: relative;
}
.g48-game-logo img{
  width:100%;
  height: auto;
}


.g48-home-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0px 24px 45px;
}

.g48-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 9px 0;
  font-family: inherit;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.g48-btn:active {
  transform: scale(0.97);
}

.g48-btn-play {
  background: #F1C155;
  background: linear-gradient(to bottom, #FFE169 0%, #E2A123 50%, #C37F0D 100%);
  color: #1b2225;
    box-shadow: 
    inset 0 3px 3px rgba(255, 255, 255, 0.7),
    inset 0 -4px 6px rgba(115, 65, 0, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1.5px solid #dbd576;
  padding:11px 0px;
}

.g48-btn-rules {
  color: #fff;
  background:#0f1820 linear-gradient(180deg, rgba(35, 50, 68, 1) 0%, rgba(21, 30, 43, 1) 100%);
  border: 1.5px solid #3a4652;
  box-shadow: 0 3px 0px rgba(0, 0, 0, 0.3);
}

/* --------------------------------------------------------------------------
   Game Rules screen
   -------------------------------------------------------------------------- */

.g48-rules-screen {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 56px 16px 20px;
  background: #121d2b url('https://akm-img-a-in.tosshub.com/sites/games/2048/images/gameover-bg.jpg') center center no-repeat;
  background-size: cover;
  border-radius: 18px;
  box-sizing: border-box;
}

.g48-rules-close {
  position: absolute;
  background: none;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  cursor: pointer;
}

.g48-rules-panel {
  background: #0a121c;
  border:2px solid #1a2332;
  border-radius: 20px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  max-height: calc(640px - 90px);
  min-height: 0;
}

.g48-rules-title {
  margin: 0 0 16px;
  text-align: center;
  font-size: 21px;
  font-weight: 800;
  color: var(--g48-bright-text);
}

.g48-rules-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 16px;
}

.g48-rules-section {
  padding: 10px 0;
}

.g48-rules-subtitle {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--g48-yellow);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.g48-rules-feature {
  margin: 12px 0 0;
}

.g48-rules-feature-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--g48-bright-text);
}

.g48-rules-bullets {
  list-style: disc;
  margin: 0;
  padding: 0 0 0 18px;
}

.g48-rules-bullets li {
  color: var(--g48-bright-text);
  font-size: 13px;
  line-height: 1.55;
  padding: 3px 0;
}

.g48-rules-bullets li strong {
  color: var(--g48-yellow);
}

.g48-rules-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.g48-rules-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
}

.g48-rules-number {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--g48-bright-text);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.g48-rules-item p {
  margin: 0;
  color: var(--g48-bright-text);
  font-size: 13px;
  line-height: 1.55;
}

.g48-rules-sep {
  height: 0;
  margin: 2px auto;
  width: 55%;
  border-top: 2px dashed rgba(255, 255, 255, 0.35);
}

.g48-rules-play {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Game screen — header
   -------------------------------------------------------------------------- */

.g48-game-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.g48-game-screen{
  background: url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/home_bg.jpg) left top no-repeat;
  background-size: cover;

}

.g48-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 16px 13px;
  border-radius: 18px 18px 0 0;
}

.g48-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #bbd3f8;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px;
  border-radius: 7px;
  border:1.5px solid #727379;
  background-color:#161a22;
  width: 35px;
  height:35px;
}
.g48-header-btn img{
  width:18px;
  height: auto;
}

.g48-header-restart {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 3px;
  color: #fff;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 6px;
  cursor: pointer;
  border:1.5px solid #727379;
  background-color:#161a22;
  padding:5px 6px;
  text-transform: capitalize;
  width:35px;
  height:35px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.g48-header-restart img{
  width:18px;
  height: auto;
}

.g48-header-restart:active {
  transform: scale(0.96);
}

.g48-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.g48-header-help {
  font-size: 15px;
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   Swap Two Tiles — top instruction panel (overlays the header while active)
   -------------------------------------------------------------------------- */

.g48-swap-panel {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px;
  background: linear-gradient(135deg, #21c2f2 0%, #0c6fa8 100%);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.g48-swap-panel--open {
  display: flex;
  animation: g48-fade-in 200ms ease both;
}

.g48-swap-panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--g48-bright-text);
}

.g48-swap-panel-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  transition: opacity 150ms ease;
}

.g48-swap-panel-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: var(--g48-bright-text);
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.g48-swap-panel-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.g48-swap-panel-close:active {
  transform: scale(0.9);
}

.g48-game-text{
  margin:-54px auto 0;
  width:140px;
  line-height: 0px;
}
.g48-game-text img{
  width:100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Game screen — body
   -------------------------------------------------------------------------- */

.g48-body {
  container-type: inline-size;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Scores
   -------------------------------------------------------------------------- */

.g48-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding:0 16px;
  margin-bottom: 15px;
}

.g48-scores-divider {
  width: 1px;
  height: 26px;
  background: rgb(114 115 121);
}

.g48-score-box {
  position: relative;
  width: 100%;
  flex:0 0 124px;
  max-width: 124px;
  background: #161c24;
  border: 1.5px solid #727379;
  border-radius: 10px;
  padding: 8px 10px 3px;
  display: flex;
  align-items: center;
}
.g48-cup-icon, .g48-crown-icon{
  line-height: 0px;
}
.g48-cup-icon svg{
   width:30px;
   height: 30px;
}

.g48-crown-icon svg{
  width:35px;
   height: 35px;
}

.g48-score{
  display: flex;
  flex-direction: column;
  align-items: center;
  margin:0 auto;
}
.g48-score-label {
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  margin-bottom: -3px;
}

.g48-score-value {
  font-size:22px;
  font-weight: 800;
  color: #fff;
}

@keyframes g48-move-up {
  0%   { top: 0; opacity: 1; }
  100% { top: -24px; opacity: 0; }
}

.g48-score-pop {
  position: absolute;
  right: -6px;
  top: -4px;
  color: var(--g48-yellow);
  font-size: 13px;
  font-weight: 700;
  z-index: 100;
  animation: g48-move-up 600ms ease-in both;
}

/* --------------------------------------------------------------------------
   Power-up cards (Undo / Swap / Delete Tiles)
   -------------------------------------------------------------------------- */

.g48-powerups {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin-top: clamp(22px, 1vw, 120px);
  margin-bottom: 17px;
}
.g48-powerup-card {
  position: relative;
  min-width: 0;
  border-radius: 12px;
  padding: 6px 6px;
  font-family: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 120ms ease, transform 120ms ease, opacity 200ms ease, filter 200ms ease;
  border: none;
}

.g48-powerup-card:active {
  transform: scale(0.97);
}

.g48-powerup-card--active {
  box-shadow: 0 0 0 2px var(--g48-orange-dark);
}

.g48-powerup-card--faded {
  opacity: 0.35;
  filter: grayscale(0.5);
  pointer-events: none;
}

.g48-powerup-card--disabled {
  cursor: not-allowed;
  pointer-events: none;
}

.g48-powerup-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 5px;
  margin-bottom: 2px;
}

.g48-powerup-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--g48-orange-dark);
  color: var(--g48-bright-text);
}

.g48-powerup-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--g48-text);
  line-height: 1.2;
  width:calc(100% - 25px);
}

.g48-powerup-uses {
  font-size: 9px;
  font-weight: 600;
  color: var(--g48-orange-dark);
}

.g48-powerup-hint {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.35;
  color: #9a7a52;
}

.g48-powerup-card--disabled {
  background: #f0ede8;
  border-color: rgba(120, 110, 95, 0.25);
     background: url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/game-options.png) -144px top no-repeat;
    background-size: 210px;
    border: none;
    width: 50px;
    flex: 0 0 64px;
}

.g48-powerup-card--disabled .g48-powerup-icon {
  background: #b9b3a6;
}

.g48-powerup-card--disabled .g48-powerup-title,
.g48-powerup-card--disabled .g48-powerup-uses {
  color: #8a8377;
}

.g48-powerup-card--disabled .g48-powerup-hint {
  color: #a4a094;
}

/* --------------------------------------------------------------------------
   Undo / Swap / Delete cards — icon tile with corner-badge use count and a
   label below (replaces the old icon+title+hint row layout for all three)
   -------------------------------------------------------------------------- */

.g48-powerup-card--undo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  flex:0 0 50px;
  width: 50px;
  height: 50px;
  background:#161c24 url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/undo-icon.png) center center no-repeat;
  background-size:20px;
  box-shadow: inset 0 0 5px rgba(241,241,241, 0.5);
}

.g48-powerup-card--swap{
   flex:0 0 50px;
  width: 50px;
  height: 50px;
  background:#161c24 url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/swap-icon2.png) center center no-repeat;
  background-size:25px;
  box-shadow: inset 0 0 7px rgba(241,241,241, 0.3);
}

.g48-powerup-card--delete{
  flex:0 0 50px;
  width: 50px;
  height: 50px;
  background:#161c24 url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/delete-icon2.png) center center no-repeat;
  background-size:32px;
  box-shadow: inset 0 0 7px rgba(241,241,241, 0.3);
}
.g48-powerup-card *, .g48-powerup-card span{display:none;}

/* Counter badge — overrides the blanket span-hide rule above via a more
   specific selector so it stays visible on top of the icon tile. */
.g48-powerup-card .g48-powerup-badge {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  background: linear-gradient(160deg, #ffb75c 0%, var(--g48-orange) 55%, var(--g48-orange-dark) 100%);
  border: 1.5px solid #fff6ea;
  color: var(--g48-bright-text);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 1px rgba(120, 50, 0, 0.35);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1.5px 1.5px rgba(255, 255, 255, 0.65),
    inset 0 -2px 2px rgba(140, 60, 0, 0.25);
  z-index: 1;
}

.g48-powerup-card--disabled .g48-powerup-badge {
  background: linear-gradient(160deg, #cac3b6 0%, #a29a8b 55%, #8a8171 100%);
  border-color: #ede9df;
  text-shadow: none;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.15),
    inset 0 1.5px 1.5px rgba(255, 255, 255, 0.4);
}

/* Swap — glossy cyan/teal badge */
.g48-powerup-card--swap .g48-powerup-badge {
  background: linear-gradient(160deg, #6fe3ff 0%, #14a8dd 55%, #0c6fa8 100%);
  border-color: #eafcff;
  text-shadow: 0 1px 1px rgba(5, 55, 80, 0.4);
}

/* Delete — glossy crimson/red badge, distinct from Undo (orange) and Swap (teal) */
.g48-powerup-card--delete .g48-powerup-badge {
  background: linear-gradient(160deg, #ff9a8b 0%, #e53946 55%, #a81d2c 100%);
  border-color: #fff0ee;
  text-shadow: 0 1px 1px rgba(90, 10, 15, 0.4);
}

/* Disabled always wins over the per-type colors above, regardless of source order */
.g48-powerup-card--swap.g48-powerup-card--disabled .g48-powerup-badge,
.g48-powerup-card--delete.g48-powerup-card--disabled .g48-powerup-badge {
  background: linear-gradient(160deg, #cac3b6 0%, #a29a8b 55%, #8a8171 100%);
  border-color: #ede9df;
  text-shadow: none;
}

.g48-powerup-card .g48-powerup-label {
  display: block !important;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: uppercase;
  color: #e7e7ea;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25),
    0 2px 1px rgba(0, 0, 0, 0.55),
    0 -1px 0 rgba(0, 0, 0, 0.35);
}

.g48-powerup-card--disabled .g48-powerup-label {
  color: #a29a8b;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* --------------------------------------------------------------------------
   Toast — informational hint pinned to the top of the game screen
   -------------------------------------------------------------------------- */

.g48-toast {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 138, 31, 0.12);
  color: var(--g48-orange-dark);
  border: 1px solid rgba(255, 138, 31, 0.25);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 4px 10px rgba(180, 100, 0, 0.12);
  display: none;
}

/* --------------------------------------------------------------------------
   Board / grid / tiles
   -------------------------------------------------------------------------- */

.g48-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #12181f;
  border-radius: 10px;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  background-color: #0f131a;
  box-shadow: inset 0 0 3px rgba(241,241,241, 0.5);
}

@keyframes g48-fade-in {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Game Over / You Win modal — covers the whole screen, centered
   -------------------------------------------------------------------------- */

.g48-message {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  animation: g48-fade-in 250ms ease both;
}

.g48-message--won,
.g48-message--over {
  display: flex;
}

.g48-message-panel {
  width: 100%;
  max-width: 320px;
  max-height: 100%;
  overflow-y: auto;
  background:#121d2b url('https://akm-img-a-in.tosshub.com/sites/games/2048/images/gameover-bg.jpg') center center no-repeat;
  background-size:cover;
  border: 1px solid #435167;
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(90, 40, 0, 0.4);
  animation: g48-pop 220ms ease both;
}

.g48-message-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
}

.g48-message-burst {
  flex-shrink: 0;
  color: var(--g48-yellow-dark);
}

.g48-message-emoji {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
}

.g48-message-text {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 20px;
}

.g48-message-subtext {
  margin: 2px 0 16px;
  font-size: 13px;
  color: #8a6a44;
}

.g48-message-scores {
  display: flex;
  gap: 10px;
  margin-bottom: 40px;
}

.g48-message-score-box {
  flex: 1;
  background: #0f1927;
  border: 1px solid #516275;
  border-radius: 10px;
  padding: 7px 8px 5px;
}

.g48-message-score-label {
  display: block;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #9ca6b0;
  margin-bottom: 2px;
}

.g48-message-score-value {
  display: block;
  font-size: 30px;
  line-height: 32px;
  font-weight: 800;
  color: #fff;
}

.g48-message-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.g48-message-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 120ms ease;
}

.g48-message-btn:active {
  transform: scale(0.97);
}

.g48-message-btn--primary {
  background: #F1C155;
  background: linear-gradient(to bottom, #FFE169 0%, #E2A123 50%, #C37F0D 100%);
  color: #1b2225;
   box-shadow: 
    inset 0 3px 3px rgba(255, 255, 255, 0.7),
    inset 0 -4px 6px rgba(115, 65, 0, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1.5px solid #dbd576;
  font-size:22px;
}

.g48-message-btn--secondary {
  background: #233244;
  background: linear-gradient(180deg, rgba(35, 50, 68, 1) 0%, rgba(21, 30, 43, 1) 100%);
  border-color: #3a4652;
  box-shadow: 0 3px 0px rgba(0,0,0,0.3);
  color: #fff;
  font-size: 20px;
}

.g48-message-btn--secondary.g48-message-btn--disabled {
  border-color: #cdc6b9;
  color: #a29a8b;
  cursor: not-allowed;
  pointer-events: none;
}

.g48-btn-keep-playing {
  display: none;
}

.g48-message--won .g48-btn-keep-playing {
  display: flex;
}

/* Win screen: Undo isn't relevant once the game is won — only Restart and
   Keep Going remain. Game Over keeps Undo unchanged. */
.g48-message--won #g48-message-undo,
.g48-message--won .g48-message-hint {
  display: none;
}

.g48-message-hint {
  margin: 30px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #0f1825;
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  border:1px solid #506275;
}

/* --------------------------------------------------------------------------
   New Game confirmation modal
   -------------------------------------------------------------------------- */

.g48-confirm {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 12, 4, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: g48-fade-in 200ms ease both;
}

.g48-confirm--open {
  display: flex;
}

.g48-confirm-panel {
  width: 100%;
  max-width: 300px;
  background:#13171e;
  border:1px solid #4a4d55;
  border-radius: 20px;
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  animation: g48-pop 220ms ease both;
}

.g48-confirm-title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--g48-yellow);
}

.g48-confirm-text {
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #fff;
}

.g48-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.g48-confirm-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 10px 0;
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.g48-confirm-btn:active {
  transform: scale(0.97);
}

.g48-confirm-btn--primary {
    background: linear-gradient(to bottom, #FFE169 0%, #E2A123 50%, #C37F0D 100%);
    color: var(--g48-bright-text);
    box-shadow: inset 0 3px 3px rgba(255, 255, 255, 0.7), inset 0 -4px 6px rgba(115, 65, 0, 0.6);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1.5px solid #dbd576;
    color: #1b2225;
}

.g48-confirm-btn--secondary {
    background: #161a20;
    border: 1.5px solid #383b41;
    color: #fff;
}

.g48-grid,
.g48-tiles {
  position: absolute;
  top: var(--g48-gap);
  left: var(--g48-gap);
  right: var(--g48-gap);
  bottom: var(--g48-gap);
}

.g48-grid {
  z-index: 1;
}

.g48-tiles {
  z-index: 2;
}

.g48-grid-row {
  display: flex;
  height: calc((100% - var(--g48-gap) * 3) / 4);
  margin-bottom: var(--g48-gap);
}

.g48-grid-row:last-child {
  margin-bottom: 0;
}

.g48-grid-cell {
  flex: 1;
  margin-right: var(--g48-gap);
  background:#151c26;
  background-size: cover;
  border-radius: 15px;
  border:1px solid #282e3d;
}

.g48-grid-cell:last-child {
  margin-right: 0;
}

.g48-tile {
  position: absolute;
  top: 0;
  left: 0;
  width: calc((100cqw - var(--g48-gap) * 5) / 4);
  height: calc((100cqw - var(--g48-gap) * 5) / 4);
  transition: transform 100ms ease-in-out;
  --g48-step: calc((100cqw - var(--g48-gap) * 5) / 4 + var(--g48-gap));
}

.g48-tile-inner {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  font-size: 9cqw;
  z-index: 10;
  transition: box-shadow 120ms ease, transform 180ms ease, opacity 220ms ease;
  color:#fff;
  background-size: cover !important;
  overflow: hidden;
  text-indent: 200px;
}

.g48-board--picking {
  cursor: pointer;
}


/* --------------------------------------------------------------------------
   Swap Two Tiles — tile picking/animation states
   -------------------------------------------------------------------------- */

.g48-tile--selected .g48-tile-inner,
.g48-tile--selected-second .g48-tile-inner {
  transform: scale(1.16);
  z-index: 30;
}

/* Once a first tile is picked, dim every other tile so the pick reads clearly */
.g48-tiles--fade-others .g48-tile {
  transition: opacity 220ms ease;
  opacity: 0.32;
}

.g48-tiles--fade-others .g48-tile--selected,
.g48-tiles--fade-others .g48-tile--selected-second {
  opacity: 1;
}

/* Smoother, slightly slower slide while the two picked tiles cross positions */
.g48-tile--swap-anim {
  transition: transform 380ms cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 40;
}

/* Tile grid positions (4x4) */
.g48-tile-pos-1-1 { transform: translate(0, 0); }
.g48-tile-pos-1-2 { transform: translate(0, var(--g48-step)); }
.g48-tile-pos-1-3 { transform: translate(0, calc(var(--g48-step) * 2)); }
.g48-tile-pos-1-4 { transform: translate(0, calc(var(--g48-step) * 3)); }
.g48-tile-pos-2-1 { transform: translate(var(--g48-step), 0); }
.g48-tile-pos-2-2 { transform: translate(var(--g48-step), var(--g48-step)); }
.g48-tile-pos-2-3 { transform: translate(var(--g48-step), calc(var(--g48-step) * 2)); }
.g48-tile-pos-2-4 { transform: translate(var(--g48-step), calc(var(--g48-step) * 3)); }
.g48-tile-pos-3-1 { transform: translate(calc(var(--g48-step) * 2), 0); }
.g48-tile-pos-3-2 { transform: translate(calc(var(--g48-step) * 2), var(--g48-step)); }
.g48-tile-pos-3-3 { transform: translate(calc(var(--g48-step) * 2), calc(var(--g48-step) * 2)); }
.g48-tile-pos-3-4 { transform: translate(calc(var(--g48-step) * 2), calc(var(--g48-step) * 3)); }
.g48-tile-pos-4-1 { transform: translate(calc(var(--g48-step) * 3), 0); }
.g48-tile-pos-4-2 { transform: translate(calc(var(--g48-step) * 3), var(--g48-step)); }
.g48-tile-pos-4-3 { transform: translate(calc(var(--g48-step) * 3), calc(var(--g48-step) * 2)); }
.g48-tile-pos-4-4 { transform: translate(calc(var(--g48-step) * 3), calc(var(--g48-step) * 3)); }

/* Tile value colors — matches reference palette (cream → orange → red → gold) */
.g48-tile-2    .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile2.png) center center no-repeat; }
.g48-tile-4    .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile4.png) center center no-repeat; }
.g48-tile-8    .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile8.png) center center no-repeat;  }
.g48-tile-16   .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile16.png) center center no-repeat;    }
.g48-tile-32   .g48-tile-inner {background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile32.png) center center no-repeat;   }
.g48-tile-64   .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile64.png) center center no-repeat;   }
.g48-tile-128  .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile128.png) center center no-repeat;    }
.g48-tile-256  .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile256.png) center center no-repeat;   }
.g48-tile-512  .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile512.png) center center no-repeat;   }
.g48-tile-1024 .g48-tile-inner {background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/tile1024.png) center center no-repeat;   }
.g48-tile-2048 .g48-tile-inner { background:url(https://akm-img-a-in.tosshub.com/sites/games/2048/images/tiles/2048.png) center center no-repeat;    }

.g48-tile-super .g48-tile-inner {
  background: #7a1f00;
  color: var(--g48-bright-text);
  font-size: 6cqw;
  box-shadow: 0 0 24px 8px rgba(255, 204, 51, 0.8);
}

@keyframes g48-appear {
  0%   { opacity: 0; transform: scale(0); }
  100% { opacity: 1; transform: scale(1); }
}

.g48-tile-new .g48-tile-inner {
  animation: g48-appear 200ms ease 100ms backwards;
}

@keyframes g48-pop {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.g48-tile-merged .g48-tile-inner {
  z-index: 20;
  animation: g48-pop 200ms ease 100ms backwards;
}

/* --------------------------------------------------------------------------
   Bottom info pill
   -------------------------------------------------------------------------- */

.g48-info-pill {
  flex-shrink: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  padding: 8px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  margin-top: auto;
  margin-bottom: -10px;
}

/* --------------------------------------------------------------------------
   Mobile portrait — full width, no fixed frame
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .g48-app {
    max-width: 100%;
    max-height: none;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }


 .g48-screen {
    min-height: 100dvh;
    border-radius: 0px;
  }

  .g48-header {
    border-radius: 0;
  }
}

/* ==========================================================================
   Coach Marks — first-time "How to Play" tutorial
   ========================================================================== */

.g48-coach {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 800;
}

.g48-coach--open {
  display: block;
}

.g48-coach-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 6, 2, 0);
  transition: background 320ms ease;
}

.g48-coach--final .g48-coach-overlay {
  background: rgba(10, 6, 2, 0.7);
}

.g48-coach-spotlight {
  position: absolute;
  z-index: 801;
  border: 2px solid #e8ae31;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(10, 6, 2, 0.8), 0 0 22px 4px rgba(255, 122, 0, 0.55);
  transition: top 260ms ease, left 260ms ease, width 260ms ease, height 260ms ease, opacity 200ms ease;
  pointer-events: none;
}

.g48-coach-spotlight--hidden {
  opacity: 0;
  border-width: 0;
  box-shadow: 0 0 0 9999px rgba(10, 6, 2, 0.7);
}

.g48-coach-overlay div {
  opacity: 0;
  visibility: hidden;
  transition: opacity 320ms ease;
}

.g48-coach--final .g48-coach-overlay div {
  opacity: 1;
  visibility: visible;
}

.g48-coach-card {
  position: absolute;
  z-index: 802;
  width: 100%;
  max-width: 280px;
  overflow-y: auto;
  background: #13171e;
  border: 1px solid #4a4d55;
  border-radius: 18px;
  padding: 15px 18px 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  transition: top 260ms ease, left 260ms ease, transform 220ms ease, opacity 200ms ease;
}

.g48-coach-step-count {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--g48-yellow);
}

.g48-coach-title {
  margin: 0 0 3px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.g48-coach-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #a3a3a7;
}

.g48-coach-message {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 0;
  background: #212b3d;
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 10.5px;
  font-weight: 500;
}

.g48-coach-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin: 14px 0 12px;
}

.g48-coach-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4e4f58;
  transition: background 150ms ease, transform 150ms ease;
}

.g48-coach-dot--active {
  background: var(--g48-yellow);
  transform: scale(1.3);
}

.g48-coach-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid #4a4d55;
  padding-top: 10px;
  margin-top: 10px;
}

.g48-coach-skip {
  border: none;
  background: none;
  color: #f3f3f3;
  opacity: 0.65;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 2px;
}

.g48-coach-nav {
  display: flex;
  gap: 8px;
}

.g48-coach-btn {
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  padding: 6px 16px;
  cursor: pointer;
  transition: transform 120ms ease;
}

.g48-coach-btn:active {
  transform: scale(0.96);
}

.g48-coach-btn--prev {
  background: #161a20;
  border: 1.5px solid #383b41;
  color: #fff;
}

.g48-coach-btn--prev[disabled] {
  visibility: hidden;
}

.g48-coach-btn--next {
  background: linear-gradient(to bottom, #FFE169 0%, #E2A123 50%, #C37F0D 100%);
  color: var(--g48-bright-text);
  box-shadow:inset 0 3px 3px rgba(255, 255, 255, 0.7),
    inset 0 -4px 6px rgba(115, 65, 0, 0.6);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    border:1.5px solid #dbd576;
    color:#1b2225;
}

.g48-coach-final {
  text-align: center;
}

.g48-coach-final-emoji {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 10px;
}

@media (max-height:600px) and (orientation: landscape){
  .g48-board{
    width:275px;
    margin: 0 auto;
  }
  .g48-screen{
    min-height: 586px;
  }
  .g48-tile{
    width: 56.45px;
    height:56.45px;
  }
  .g48-powerups{
    margin-top: 12px;
  }
  .g48-info-pill{
    margin-bottom: -5px;
  }
  .g48-game-logo{
    max-width:310px;
  }
  .g48-at-logo {
    margin: auto auto -20px;
}
.g48-home-actions {
    padding: 0px 24px 25px;
}
.g48-tile{
  transition: transform 100ms ease-in-out;
  --g48-step: calc((100cqw - 6cqw * 5) / 4 + var(--g48-gap));
}
.g48-rules-panel{
  max-height: calc(100vh - 90px);
}
}

@media (min-height:668px) and (max-height:1000px)and (orientation: portrait){
  .g48-header{
    padding:6dvh 16px 13px;
    margin-bottom: 2dvh;
  }
  .g48-scores{
    margin-top: 1dvh;
    margin-bottom: 3dvh;
  }
  .g48-powerups{
    margin-top: auto;
  }
  .g48-game-text{
    margin: calc(-8dvh - 7px) auto 0;
  }
}