/* 2048 variants — loaded after main.css */

.variant .grid-row { margin-bottom: var(--gap, 15px); }
.variant .grid-row:last-child { margin-bottom: 0; }
.variant .grid-cell {
  width: var(--cell, 106.25px);
  height: var(--cell, 106.25px);
  margin-right: var(--gap, 15px);
}
.variant .grid-cell:last-child { margin-right: 0; }

.variant .tile,
.variant .tile .tile-inner {
  width: var(--cell, 107px);
  height: var(--cell, 107px);
  line-height: var(--cell, 107px);
}
.variant .tile .tile-inner { position: relative; overflow: hidden; }

.variant .tile-num {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: 11px;
  line-height: 1;
  font-weight: bold;
  opacity: .75;
}

.variant .game-intro { line-height: 1.5; }
.variant h1.title { font-size: 60px; }
.variant h1.title.title-long { font-size: 42px; }
.variant h1.hub-title { float: none; margin-bottom: 10px; }

/* ---------- page content ---------- */
.variant-nav { font-size: 14px; margin: 0 0 10px; color: #8f7a66; }
.variant-nav a { color: #8f7a66; }

.variant-content { margin-top: 30px; line-height: 1.65; }
.variant-content h2 { font-size: 24px; margin: 28px 0 8px; color: #776e65; }
.variant-content h3 { font-size: 18px; margin: 18px 0 6px; color: #776e65; }
.variant-content ul { padding-left: 20px; }
.variant-content li { margin-bottom: 6px; }
.variant-content table { border-collapse: collapse; width: 100%; font-size: 15px; }
.variant-content th, .variant-content td { border: 1px solid #d8d4d0; padding: 6px 8px; text-align: left; }

.variant-cta {
  display: block;
  margin: 24px 0;
  padding: 14px 16px;
  background: #8f7a66;
  color: #f9f6f2 !important;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
}

.variant-content ul.variant-grid { padding: 0; }
.variant-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0;
  list-style: none;
}
.variant-grid li { margin: 0; }
.variant-grid a {
  display: block;
  height: 100%;
  box-sizing: border-box;
  padding: 12px;
  border-radius: 6px;
  background: #eee4da;
  color: #776e65;
  text-decoration: none;
}
.variant-grid a:hover { background: #ede0c8; }
.variant-grid strong { display: block; font-size: 16px; }
.variant-grid span { font-size: 13px; }
.variant-grid a.current { outline: 2px solid #8f7a66; }

@media screen and (max-width: 520px) {
  .variant h1.title, .variant h1.title.title-long { font-size: 27px; }
  .variant-content h2 { font-size: 20px; }
  .variant-grid { grid-template-columns: 1fr; }
  .variant .tile-num { font-size: 8px; right: 2px; bottom: 2px; }
}

/* ---------- Dark theme ---------- */
body.theme-dark { background: #1e1e1e; color: #ddd; }
body.theme-dark h1.title, body.theme-dark .variant-content h2,
body.theme-dark .variant-content h3, body.theme-dark .variant-nav,
body.theme-dark .variant-nav a { color: #ddd; }
body.theme-dark a { color: #e0b973; }
body.theme-dark .game-container { background: #3a3a3c; }
body.theme-dark .grid-cell { background: rgba(255, 255, 255, .06); }
body.theme-dark .score-container, body.theme-dark .best-container,
body.theme-dark .restart-button { background: #4a4a4c; }
body.theme-dark .variant-grid a { background: #2c2c2e; color: #ddd; }
body.theme-dark .variant-grid a:hover { background: #3a3a3c; }
body.theme-dark .variant-content th, body.theme-dark .variant-content td { border-color: #444; }
body.theme-dark .game-container .game-message { background: rgba(30, 30, 30, .6); }
body.theme-dark .game-container .game-message p { color: #eee; }
body.theme-dark .tile .tile-inner { color: #f2f2f2; }
body.theme-dark .tile.tile-2 .tile-inner { background: #4b4b4f; color: #f2f2f2; }
body.theme-dark .tile.tile-4 .tile-inner { background: #5b5470; }
body.theme-dark .tile.tile-8 .tile-inner { background: #3f6fb5; }
body.theme-dark .tile.tile-16 .tile-inner { background: #2f8f9d; }
body.theme-dark .tile.tile-32 .tile-inner { background: #2f9d6a; }
body.theme-dark .tile.tile-64 .tile-inner { background: #7ba336; }
body.theme-dark .tile.tile-128 .tile-inner { background: #c9a227; box-shadow: none; }
body.theme-dark .tile.tile-256 .tile-inner { background: #d4802a; box-shadow: none; }
body.theme-dark .tile.tile-512 .tile-inner { background: #d4562a; box-shadow: none; }
body.theme-dark .tile.tile-1024 .tile-inner { background: #c43d55; box-shadow: none; }
body.theme-dark .tile.tile-2048 .tile-inner { background: #9b3fc4; box-shadow: 0 0 20px 4px rgba(155, 63, 196, .5); }
body.theme-dark .tile.tile-super .tile-inner { background: #111; }

/* ---------- Doge quips ---------- */
.variant .quip {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive;
  font-size: 22px;
  font-weight: bold;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .8);
  animation: quip-float 1.2s ease-out forwards;
}
@keyframes quip-float {
  0% { opacity: 0; transform: translateY(10px) scale(.8); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(1.05); }
}

/* ---------- 2048 Drop ---------- */
.drop-wrap { position: relative; width: 380px; max-width: 100%; margin: 0 auto; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.drop-lane { position: relative; cursor: pointer; }
.drop-lane .lane-tile { box-shadow: 0 4px 0 rgba(0, 0, 0, .15); }
.drop-lane.shake { animation: drop-shake .25s; }
@keyframes drop-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.drop-board { position: relative; background: #bbada0; border-radius: 6px; cursor: pointer; overflow: hidden; }
.drop-cell, .drop-wrap .tile {
  position: absolute; left: 0; top: 0;
  width: var(--cell); height: var(--cell);
  border-radius: 4px;
}
.drop-cell { background: rgba(238, 228, 218, .35); transition: background .1s; }
.drop-cell.active { background: rgba(238, 228, 218, .6); }
.drop-wrap .tile { transition: transform 100ms ease-in-out, opacity 100ms; z-index: 2; }
.drop-wrap .tile .tile-inner { width: var(--cell); height: var(--cell); line-height: var(--cell); border-radius: 4px; }
.drop-wrap .tile.drop-gone { opacity: 0; }
.drop-tiles { position: absolute; inset: 0; }

.drop-above { display: flex; align-items: center; gap: 10px; }
.drop-above:after { display: none; }
.drop-above .game-intro { float: none; flex: 1; margin: 0; }
.drop-above .restart-button { float: none; flex: none; }
.drop-next { display: inline-flex; flex: none; align-items: center; gap: 6px; font-weight: bold; color: #776e65; }
.drop-next-tile { display: inline-block; min-width: 34px; height: 34px; line-height: 34px; padding: 0 4px; border-radius: 4px; text-align: center; font-size: 15px; background: #eee4da; color: #776e65; }
.drop-next-tile.tile-8, .drop-next-tile.tile-16, .drop-next-tile.tile-32, .drop-next-tile.tile-64 { color: #f9f6f2; }
.drop-next-tile.tile-8 { background: #f2b179; } .drop-next-tile.tile-16 { background: #f59563; }
.drop-next-tile.tile-32 { background: #f67c5f; } .drop-next-tile.tile-64 { background: #f65e3b; }
.drop-next-tile.tile-4 { background: #ede0c8; }

.drop-message { display: none; position: absolute; inset: 0; z-index: 100; background: rgba(238, 228, 218, .75); border-radius: 6px; text-align: center; flex-direction: column; justify-content: center; align-items: center; }
.drop-message.show { display: flex; }
.drop-message p { font-size: 48px; font-weight: bold; color: #776e65; margin: 0 0 20px; }
.drop-message a { display: inline-block; margin: 0 4px; background: #8f7a66; border-radius: 3px; padding: 0 20px; color: #f9f6f2; height: 40px; line-height: 42px; cursor: pointer; text-decoration: none; }
.drop-hint { text-align: center; font-size: 14px; color: #8f7a66; margin: 8px 0 0; }

@media screen and (max-width: 520px) {
  .drop-wrap { width: 280px; }
  .drop-above { flex-wrap: wrap; }
  .drop-above .game-intro { flex-basis: 100%; }
  .drop-above .drop-next { margin-left: auto; }
  .drop-message p { font-size: 30px; }
  .drop-next-tile { min-width: 28px; height: 28px; line-height: 28px; font-size: 13px; }
}
