:root{
  --g2048-text:#334239;
  --g2048-muted:#6d786f;
  --g2048-line:#dfe9e2;
  --g2048-board:#dce9df;
  --g2048-cell:#edf4ef;
  --g2048-green:#2f7d5a;
  --g2048-font:'Trebuchet MS','Arial Rounded MT Bold','Comic Sans MS','Segoe UI',system-ui,sans-serif;
}

.game-2048-page{
  min-height:100vh;
  color:var(--g2048-text);
  font-family:var(--g2048-font);
  background:
    linear-gradient(rgba(255,251,244,.60), rgba(255,250,243,.72)),
    url('/assets/2048/cozy-owner-bg.png') center top / cover no-repeat fixed;
}

.game-2048-shell{
  width:min(100% - 32px, 620px);
  margin:0 auto;
  padding:34px 0 64px;
}


.game-2048-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:24px;
  margin-bottom:14px;
}

.game-2048-head h1{
  margin:9px 0 0;
  font-size:40px;
  line-height:1.05;
  letter-spacing:-.01em;
  font-weight:800;
}

.game-2048-back{
  display:inline-flex;
  align-items:center;
  color:#667269;
  font-size:14px;
  text-decoration:none;
}

.game-2048-back:hover{color:var(--g2048-green)}

.game-2048-reset{
  flex:0 0 auto;
  min-height:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:#536159;
  font:inherit;
  font-size:13px;
  font-weight:500;
  box-shadow:none;
  cursor:pointer;
}

.game-2048-reset:hover{
  background:transparent;
  color:var(--g2048-green);
  box-shadow:none;
}

.game-2048-stats{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:14px 26px;
  margin-bottom:10px;
}

.game-2048-stat{
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:#36564a;
}

.game-2048-stat strong{
  color:#31574b;
  font-size:28px;
  line-height:1;
  font-weight:700;
  letter-spacing:.01em;
  font-variant-numeric:tabular-nums;
}

.game-2048-stat-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}

.game-2048-star{
  font-size:31px;
  line-height:1;
  filter:drop-shadow(0 2px 2px rgba(93,73,20,.15));
}

.game-2048-target-mark{
  width:13px;
  height:13px;
  flex:0 0 auto;
  border-radius:3px;
  background:#4f9d72;
  transform:rotate(45deg);
  box-shadow:0 2px 5px rgba(61,104,78,.14);
}

.game-2048-target-label{
  margin-left:1px;
  color:#4f7e68;
  font-size:17px;
  line-height:1;
  font-weight:800;
}

.game-2048-collected-stat{
  transition:transform .18s ease;
}

.game-2048-collected-stat.is-pop{
  transform:scale(1.045);
}

.game-2048-card{
  position:relative;
}

.game-2048-start-hint{
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 24px;
  box-sizing:border-box;
  pointer-events:none;
  z-index:3;
  opacity:0;
  visibility:hidden;
  transition:opacity .18s ease, visibility .18s ease;
}

.game-2048-start-hint.is-visible{
  opacity:1;
  visibility:visible;
}

.game-2048-start-hint-text{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:6px;
  padding:12px 16px;
  border-radius:16px;
  background:rgba(255,255,255,.82);
  color:#55645a;
  font-size:15px;
  font-weight:700;
  line-height:1.35;
  text-align:center;
  box-shadow:0 10px 24px rgba(59,88,70,.10);
  backdrop-filter:blur(4px);
}

.game-2048-start-hint-text strong{
  color:#365a45;
  font-weight:800;
  letter-spacing:.04em;
}

.game-2048-board{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  width:100%;
  padding:10px;
  box-sizing:border-box;
  border:none;
  border-radius:24px;
  background:rgba(223,237,227,.90);
  box-shadow:0 18px 36px rgba(61,104,78,.12);
  outline:none;
  touch-action:none;
  user-select:none;
  backdrop-filter:blur(2px);
}

.game-2048-board:focus-visible{
  box-shadow:0 0 0 3px rgba(47,125,90,.15), 0 12px 28px rgba(61,104,78,.10);
}

.game-2048-cell{
  position:relative;
  min-width:0;
  aspect-ratio:1 / 1;
  border-radius:15px;
  background:var(--g2048-cell);
  overflow:hidden;
}

.game-2048-tile{
  display:flex;
  position:absolute;
  inset:0;
  align-items:center;
  justify-content:center;
  border-radius:15px;
  background:#f8fbf9;
  color:#385046;
  font-family:var(--g2048-font);
  font-size:clamp(25px,7vw,42px);
  font-weight:800;
  line-height:1;
  letter-spacing:-.02em;
  font-variant-numeric:tabular-nums;
  box-shadow:0 8px 14px rgba(64,107,80,.08);
}

.game-2048-tile[data-value="2"]{background:#faf9f4;color:#53685e}
.game-2048-tile[data-value="4"]{background:#eee7d8;color:#4e5f55}
.game-2048-tile[data-value="8"]{background:#d6eadb;color:#365a45}
.game-2048-tile[data-value="16"]{background:#cde8d4;color:#2e5d42}
.game-2048-tile[data-value="32"]{background:#b7dec2;color:#26573b}
.game-2048-tile[data-value="64"]{background:#97cfaa;color:#1e5034}
.game-2048-tile[data-value="128"]{background:#79be92;color:#fff}
.game-2048-tile[data-value="256"]{background:#60ab7e;color:#fff}
.game-2048-tile[data-value="512"]{background:#48966a;color:#fff}
.game-2048-tile[data-value="1024"]{background:#367f59;color:#fff;font-size:clamp(21px,6vw,36px)}
.game-2048-tile[data-value="2048"]{background:#256b49;color:#fff;font-size:clamp(21px,6vw,36px);box-shadow:inset 0 0 0 2px rgba(255,255,255,.16),0 0 18px rgba(37,107,73,.22)}
.game-2048-tile[data-value="4096"],
.game-2048-tile[data-value="8192"],
.game-2048-tile[data-value="16384"]{background:#1d593d;color:#fff;font-size:clamp(18px,5.5vw,32px)}

.game-2048-tile.is-new{animation:g2048-new .18s ease-out}
.game-2048-tile.is-merged{animation:g2048-merge .22s ease-out}

@keyframes g2048-new{
  0%{transform:scale(.45);opacity:.35}
  100%{transform:scale(1);opacity:1}
}

@keyframes g2048-merge{
  0%{transform:scale(.84)}
  60%{transform:scale(1.08)}
  100%{transform:scale(1)}
}

.game-2048-status{
  display:none;
  margin:0 0 10px;
  padding:0;
  color:#6a5e55;
  font-size:15px;
  font-weight:700;
  line-height:1.4;
}

.game-2048-status.is-visible{display:block}

@media (max-width:900px){
  .game-2048-page{
    background:
      linear-gradient(rgba(255,251,244,.68), rgba(255,250,243,.78)),
      url('/assets/2048/cozy-owner-bg.png') center top / cover no-repeat;
  }
}

@media (max-width:640px){
  .game-2048-shell{
    width:min(100% - 24px, 540px);
    padding:24px 0 48px;
  }

  .game-2048-head{
    align-items:flex-start;
    gap:14px;
  }

  .game-2048-head h1{font-size:34px}

  .game-2048-reset{
    font-size:12px;
  }

  .game-2048-board{
    gap:7px;
    padding:7px;
    border-radius:18px;
  }

  .game-2048-cell,
  .game-2048-tile{border-radius:12px}
}

@media (max-width:420px){
  .game-2048-head{
    display:block;
  }

  .game-2048-reset{
    margin-top:12px;
  }

  .game-2048-stats{
    gap:10px 18px;
  }

  .game-2048-stat{
    gap:7px;
  }

  .game-2048-stat strong{
    font-size:24px;
  }

  .game-2048-star{
    font-size:27px;
  }

  .game-2048-target-mark{
    width:12px;
    height:12px;
  }

  .game-2048-target-label{
    font-size:16px;
  }

  .game-2048-start-hint{
    padding:0 16px;
  }

  .game-2048-start-hint-text{
    font-size:14px;
    padding:11px 14px;
  }
}
