.mini-apps {
  border-top: 1px solid var(--line);
}

.game-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.game-tab,
.mini-button,
.controls-2048 button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.game-tab {
  padding: 0 16px;
}

.game-tab.active,
.mini-button:hover,
.controls-2048 button:hover {
  background: var(--accent);
  color: #07140f;
}

.game-shell {
  display: none;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 24px;
  align-items: start;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.game-shell.active {
  display: grid;
}

.game-copy p {
  color: var(--muted);
  line-height: 1.7;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.mini-button {
  padding: 0 14px;
}

.gomoku-board {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  width: min(100%, 540px);
  aspect-ratio: 1;
  margin-left: auto;
  border: 1px solid rgba(239, 183, 93, 0.55);
  background: #c8954a;
}

.gomoku-cell {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 1px solid rgba(69, 43, 18, 0.45);
  border-bottom: 1px solid rgba(69, 43, 18, 0.45);
  background: transparent;
  cursor: pointer;
}

.gomoku-cell::after {
  content: "";
  width: 68%;
  height: 68%;
  border-radius: 50%;
}

.gomoku-cell.black::after {
  background: radial-gradient(circle at 35% 30%, #5e5e5e, #080808 70%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.gomoku-cell.white::after {
  background: radial-gradient(circle at 35% 30%, #fff, #d8d8d8 72%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.board-2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: min(100%, 420px);
  aspect-ratio: 1;
  margin-left: auto;
  padding: 10px;
  border-radius: 8px;
  background: #2a2f3a;
}

.tile-2048 {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: clamp(18px, 5vw, 32px);
  font-weight: 800;
}

.tile-2048[data-value="2"] { background: #eee4da; color: #3a3128; }
.tile-2048[data-value="4"] { background: #ede0c8; color: #3a3128; }
.tile-2048[data-value="8"] { background: #f2b179; color: #fff; }
.tile-2048[data-value="16"] { background: #f59563; color: #fff; }
.tile-2048[data-value="32"] { background: #f67c5f; color: #fff; }
.tile-2048[data-value="64"] { background: #f65e3b; color: #fff; }
.tile-2048[data-value="128"] { background: #edcf72; color: #fff; }
.tile-2048[data-value="256"] { background: #edcc61; color: #fff; }
.tile-2048[data-value="512"] { background: #6fc3a3; color: #07140f; }
.tile-2048[data-value="1024"],
.tile-2048[data-value="2048"] { background: #53c7a0; color: #07140f; }

.controls-2048 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(100%, 420px);
  margin: 12px 0 0 auto;
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: min(100%, 420px);
  margin-left: auto;
}

.memory-card {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #242a35;
  color: transparent;
  font-size: clamp(22px, 7vw, 40px);
  font-weight: 800;
  cursor: pointer;
}

.memory-card.open,
.memory-card.matched {
  background: var(--accent-2);
  color: #21170b;
}

.memory-card.matched {
  opacity: 0.78;
  cursor: default;
}

@media (max-width: 820px) {
  .game-shell {
    grid-template-columns: 1fr;
  }

  .gomoku-board,
  .board-2048,
  .controls-2048,
  .memory-board {
    margin-left: 0;
  }
}
