.t-board {
  --gap: 10px;
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
  margin: 0 auto;
  padding: var(--gap);
  background: var(--c-grid);
  border-radius: var(--radius-sm);
  touch-action: none;
  user-select: none;
}
[data-theme="retro"] .t-board { background: #000; border: 3px solid #000; box-shadow: inset 0 0 0 2px var(--line); }
.t-grid, .t-tiles { position: absolute; inset: var(--gap); }
.t-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.t-grid div { background: var(--panel-2); border-radius: calc(var(--radius-sm) - 2px); }
[data-theme="retro"] .t-grid div { background: #120f26; }
.t-tile {
  --size: calc((100% - 3 * var(--gap)) / 4);
  position: absolute;
  width: var(--size);
  height: var(--size);
  left: calc(var(--c) * (var(--size) + var(--gap)));
  top: calc(var(--r) * (var(--size) + var(--gap)));
  display: grid;
  place-items: center;
  border-radius: calc(var(--radius-sm) - 2px);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 6vw, 34px);
  transition: left .1s ease, top .1s ease;
  background: var(--t-bg, var(--a2));
  color: var(--t-fg, var(--on-accent));
}
[data-theme="retro"] .t-tile { font-weight: 400; font-size: clamp(12px, 3.6vw, 20px); text-shadow: 2px 2px 0 rgba(0,0,0,.4); box-shadow: inset -3px -3px 0 rgba(0,0,0,.3), inset 3px 3px 0 rgba(255,255,255,.25); }
.t-tile[data-v="2"] { --t-bg: color-mix(in srgb, var(--a2) 22%, var(--panel)); --t-fg: var(--fg); }
.t-tile[data-v="4"] { --t-bg: color-mix(in srgb, var(--a2) 45%, var(--panel)); --t-fg: var(--fg); }
.t-tile[data-v="8"] { --t-bg: var(--a2); }
.t-tile[data-v="16"] { --t-bg: var(--a4); }
.t-tile[data-v="32"] { --t-bg: var(--a3); }
.t-tile[data-v="64"] { --t-bg: var(--a5); color: #fff; }
.t-tile[data-v="128"] { --t-bg: var(--a1); color: #fff; font-size: clamp(16px, 5vw, 28px); }
.t-tile[data-v="256"] { --t-bg: var(--a1); color: #fff; font-size: clamp(16px, 5vw, 28px); box-shadow: 0 0 18px var(--a1); }
.t-tile[data-v="512"] { --t-bg: var(--bad); color: #fff; font-size: clamp(16px, 5vw, 28px); box-shadow: 0 0 22px var(--bad); }
.t-tile[data-v="1024"], .t-tile[data-v="2048"], .t-tile[data-v="4096"], .t-tile[data-v="big"] { --t-bg: var(--a3); color: #000; font-size: clamp(13px, 4vw, 22px); box-shadow: 0 0 28px var(--a3); }
[data-theme="retro"] .t-tile[data-v="1024"], [data-theme="retro"] .t-tile[data-v="2048"], [data-theme="retro"] .t-tile[data-v="4096"], [data-theme="retro"] .t-tile[data-v="big"] { font-size: clamp(9px, 2.6vw, 14px); }
.t-tile.pop { animation: t-pop .16s ease .08s backwards; }
.t-tile.merge { animation: t-merge .16s ease; z-index: 2; }
.t-tile.gone { z-index: 1; }
@keyframes t-pop { from { transform: scale(0); } }
@keyframes t-merge { 50% { transform: scale(1.15); } }
.t-over { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: color-mix(in srgb, var(--bg) 82%, transparent); border-radius: inherit; text-align: center; padding: 20px; }
.t-over[hidden] { display: none; }
.t-over h2 { margin: 0; font-size: 28px; }
[data-theme="retro"] .t-over h2 { font-size: 18px; color: var(--a3); }
.t-over .big { font-family: var(--font-display); font-size: 26px; }
[data-theme="retro"] .t-over .big { font-size: 16px; color: var(--a2); }
.t-over .newbest { font-family: var(--font-display); color: var(--a3); font-size: 12px; }
