.g2048-page .game-panel {
  display: grid;
  gap: 1rem;
}

.g2048-leaderboard {
  border: 1px solid rgba(132, 173, 255, 0.42);
  border-radius: 1.1rem;
  padding: 0.9rem;
  background:
    radial-gradient(circle at 84% 0%, rgba(55, 204, 255, 0.2), transparent 32%),
    linear-gradient(150deg, rgba(49, 34, 106, 0.95), rgba(21, 35, 88, 0.92));
}

.g2048-leaderboard__head h2 {
  margin: 0;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.g2048-leaderboard__table-wrap {
  margin-top: 0.65rem;
  border: 1px solid rgba(126, 168, 245, 0.34);
  border-radius: 0.75rem;
  overflow: hidden;
}

.g2048-leaderboard__table {
  width: 100%;
  border-collapse: collapse;
}

.g2048-leaderboard__table th,
.g2048-leaderboard__table td {
  padding: 0.46rem 0.62rem;
  font-size: 0.88rem;
}

.g2048-leaderboard__table th {
  text-align: left;
  background: rgba(5, 12, 40, 0.56);
  color: #e5dcff;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.g2048-leaderboard__table td {
  border-top: 1px solid rgba(178, 206, 255, 0.12);
  color: #f5f9ff;
}

.g2048-leaderboard__table td:nth-child(1) {
  width: 3ch;
}

.g2048-leaderboard__table td:nth-child(2) {
  font-family: "Orbitron", system-ui, sans-serif;
  letter-spacing: 0.08em;
}

.g2048-leaderboard__table td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.g2048-ui {
  position: relative;
  border: 1px solid rgba(132, 173, 255, 0.42);
  border-radius: 1.1rem;
  padding: 1rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 79, 198, 0.24), transparent 34%),
    radial-gradient(circle at 84% 8%, rgba(37, 236, 255, 0.23), transparent 31%),
    linear-gradient(160deg, rgba(77, 28, 101, 0.93), rgba(23, 43, 92, 0.9));
}

.g2048-topbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  align-items: center;
}

.g2048-stat {
  border: 1px solid rgba(132, 173, 255, 0.42);
  border-radius: 0.8rem;
  background: rgba(18, 30, 77, 0.56);
  padding: 0.55rem 0.7rem;
  display: grid;
  gap: 0.25rem;
}

.g2048-stat span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e4d9ff;
}

.g2048-stat strong {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1.02rem;
}

.g2048-hint {
  margin: 0.8rem 0 0;
  color: #ddd2ff;
  font-size: 0.9rem;
}

.g2048-board-wrap {
  margin-top: 0.95rem;
  border: 1px solid rgba(126, 168, 245, 0.4);
  border-radius: 0.9rem;
  padding: 0.65rem;
  background:
    linear-gradient(150deg, rgba(206, 224, 255, 0.12), rgba(255, 255, 255, 0.03)),
    linear-gradient(150deg, rgba(79, 37, 106, 0.75), rgba(22, 34, 84, 0.78));
}

.g2048-grid {
  --tile: 78px;
  --gap: 8px;
  position: relative;
  width: calc(var(--tile) * 4 + var(--gap) * 3);
  height: calc(var(--tile) * 4 + var(--gap) * 3);
  margin: 0 auto;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.g2048-grid__bg {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, var(--tile)));
  gap: var(--gap);
}

.g2048-grid__tiles {
  position: absolute;
  inset: 0;
}

.g2048-cell {
  width: var(--tile);
  height: var(--tile);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(14, 24, 64, 0.48);
}

.g2048-tile {
  position: absolute;
  width: var(--tile);
  height: var(--tile);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: grid;
  place-content: center;
  font-family: "Orbitron", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 2vw, 1.45rem);
  color: #f7fbff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  transform: translate(
    calc(var(--col) * (var(--tile) + var(--gap))),
    calc(var(--row) * (var(--tile) + var(--gap)))
  );
  transition: transform 130ms cubic-bezier(0.2, 0.9, 0.32, 1);
  will-change: transform;
}

.g2048-tile--spawn { animation: g2048-pop 140ms ease-out; }
.g2048-tile--merge { animation: g2048-merge 180ms ease-out; z-index: 2; }

@keyframes g2048-pop {
  0% { transform: translate(calc(var(--col) * (var(--tile) + var(--gap))), calc(var(--row) * (var(--tile) + var(--gap)))) scale(0.55); opacity: 0.6; }
  100% { transform: translate(calc(var(--col) * (var(--tile) + var(--gap))), calc(var(--row) * (var(--tile) + var(--gap)))) scale(1); opacity: 1; }
}

@keyframes g2048-merge {
  0% { transform: translate(calc(var(--col) * (var(--tile) + var(--gap))), calc(var(--row) * (var(--tile) + var(--gap)))) scale(1); }
  45% { transform: translate(calc(var(--col) * (var(--tile) + var(--gap))), calc(var(--row) * (var(--tile) + var(--gap)))) scale(1.08); }
  100% { transform: translate(calc(var(--col) * (var(--tile) + var(--gap))), calc(var(--row) * (var(--tile) + var(--gap)))) scale(1); }
}

.g2048-cell--0 { background: rgba(14, 24, 64, 0.48); }
.g2048-cell--2 { background: linear-gradient(160deg, #9de5ff, #66c4ff); color: #07324d; }
.g2048-cell--4 { background: linear-gradient(160deg, #8bffd7, #43deb0); color: #083b2d; }
.g2048-cell--8 { background: linear-gradient(160deg, #ffe392, #ffbc50); color: #4b2d00; }
.g2048-cell--16 { background: linear-gradient(160deg, #ffc18b, #ff8b50); color: #4b1d00; }
.g2048-cell--32 { background: linear-gradient(160deg, #ffa0bd, #ff658f); color: #4e0823; }
.g2048-cell--64 { background: linear-gradient(160deg, #c79dff, #8a5bff); color: #18083f; }
.g2048-cell--128 { background: linear-gradient(160deg, #8df8ff, #3ad5f0); color: #00384b; font-size: clamp(0.95rem, 1.8vw, 1.25rem); }
.g2048-cell--256 { background: linear-gradient(160deg, #b1ffa8, #58da62); color: #0b3d10; font-size: clamp(0.95rem, 1.8vw, 1.25rem); }
.g2048-cell--512 { background: linear-gradient(160deg, #ffd6a7, #ffa34b); color: #4a2500; font-size: clamp(0.95rem, 1.8vw, 1.2rem); }
.g2048-cell--1024 { background: linear-gradient(160deg, #ffb0f4, #f473da); color: #4a0842; font-size: clamp(0.85rem, 1.7vw, 1.05rem); }
.g2048-cell--2048 { background: linear-gradient(160deg, #fff9a8, #ffd861); color: #4f3b00; font-size: clamp(0.85rem, 1.7vw, 1.05rem); box-shadow: 0 0 22px rgba(255, 224, 102, 0.42); }
.g2048-cell--big { background: linear-gradient(160deg, #ffffff, #f0f5ff); color: #1f3150; font-size: clamp(0.8rem, 1.6vw, 0.95rem); }

.g2048-submit-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 11, 34, 0.72);
  backdrop-filter: blur(4px);
}

.g2048-submit-overlay[hidden] {
  display: none;
}

.g2048-submit-card {
  width: min(100%, 420px);
  border: 1px solid rgba(150, 193, 255, 0.45);
  border-radius: 0.95rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 111, 215, 0.24), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(117, 246, 255, 0.24), transparent 47%),
    linear-gradient(160deg, rgba(59, 31, 116, 0.96), rgba(18, 42, 102, 0.94));
  box-shadow: 0 20px 40px rgba(4, 10, 30, 0.45);
}

.g2048-submit-card__eyebrow {
  margin: 0;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #cbe9ff;
}

.g2048-submit-card h3 {
  margin: 0.35rem 0 0;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}

.g2048-submit-card__copy {
  margin: 0.65rem 0 0;
  color: #ebf4ff;
  font-size: 0.92rem;
  line-height: 1.45;
}

.g2048-submit-form {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.5rem;
}

.g2048-submit-form label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d5c7ff;
}

.g2048-submit-form input {
  width: 100%;
  border: 1px solid rgba(173, 207, 255, 0.5);
  border-radius: 0.72rem;
  background: rgba(5, 12, 42, 0.75);
  color: #f4f8ff;
  padding: 0.65rem 0.7rem;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.17em;
}

.g2048-submit-form input:focus-visible {
  outline: 2px solid rgba(141, 222, 255, 0.9);
  outline-offset: 2px;
}

.g2048-submit-form__error {
  min-height: 1.1rem;
  margin: 0;
  font-size: 0.84rem;
  color: #ffd7f6;
}

.g2048-submit-form__actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .g2048-page .game-panel { padding: 0.8rem; }
}

@media (max-width: 720px) {
  .g2048-topbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2048-hint { font-size: 0.84rem; }
  .g2048-grid { --tile: 66px; --gap: 7px; }
  .g2048-leaderboard__table th,
  .g2048-leaderboard__table td {
    padding: 0.42rem 0.52rem;
    font-size: 0.82rem;
  }
}
