@import url("../../../assets/interactive-workbench.css");

:root {
  --tool-accent: #dc8d1e;
  --tool-accent-strong: #bf6d06;
  --tool-accent-soft: #fff0d7;
}

.play2048-shell {
  grid-template-columns: 1fr;
  align-items: start;
}

.play2048-arena {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(280px, 0.82fr);
  gap: 16px;
  align-items: start;
}

.play2048-board-stage,
.play2048-live-panel {
  min-width: 0;
}

.play2048-live-panel {
  position: sticky;
  top: 12px;
}

.play2048-live-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid #ead6b7;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.98) 0%, rgba(255, 246, 232, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 14px 28px rgba(97, 58, 7, 0.08);
}

.play2048-live-head strong {
  display: block;
  font-size: 18px;
  color: var(--tool-text-1);
}

.play2048-live-head span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--tool-text-3);
}

.play2048-stage {
  display: grid;
  gap: 18px;
  justify-items: center;
}

.play2048-stage-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.play2048-stage-intro strong {
  display: block;
  font-size: 20px;
  color: var(--tool-text-1);
}

.play2048-stage-intro span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--tool-text-3);
}

.play2048-scoreboard {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.play2048-scorebox {
  min-width: 88px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid #edd2a7;
  background: linear-gradient(180deg, #fffaf0 0%, #fff2df 100%);
}

.play2048-scorebox span {
  display: block;
  font-size: 12px;
  color: #8c6b40;
}

.play2048-scorebox strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  color: #6a3f00;
}

.play2048-grid-shell {
  position: relative;
  width: min(100%, 540px);
  padding: 14px;
  margin: 0 auto;
  border-radius: 28px;
  background: linear-gradient(180deg, #bb9d78 0%, #a6835e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 18px 40px rgba(97, 58, 7, 0.16);
}

.play2048-grid {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.play2048-cell {
  border-radius: 20px;
  background: rgba(255, 248, 237, 0.2);
}

.play2048-tile-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.play2048-tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  font-weight: 800;
  color: #735225;
  box-shadow: 0 12px 24px rgba(86, 53, 13, 0.16);
  transition: transform 0.16s ease, left 0.16s ease, top 0.16s ease, background 0.16s ease;
}

.play2048-tile.tile-2 { background: #fff4e0; }
.play2048-tile.tile-4 { background: #ffe8bf; }
.play2048-tile.tile-8 { background: #ffd18b; color: #6d4100; }
.play2048-tile.tile-16 { background: #ffb76a; color: #5f3500; }
.play2048-tile.tile-32 { background: #ff9d54; color: #fff; }
.play2048-tile.tile-64 { background: #f17940; color: #fff; }
.play2048-tile.tile-128 { background: #ecbb4a; color: #fff; }
.play2048-tile.tile-256 { background: #ddb233; color: #fff; }
.play2048-tile.tile-512 { background: #cfa229; color: #fff; }
.play2048-tile.tile-1024 { background: #b47d1b; color: #fff; }
.play2048-tile.tile-2048 { background: linear-gradient(135deg, #f7d86f 0%, #f2b91f 100%); color: #5d3a00; }
.play2048-tile.tile-super { background: linear-gradient(135deg, #ffa94f 0%, #ff6f2d 100%); color: #fff; }

.play2048-overlay {
  position: absolute;
  inset: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 251, 243, 0.88);
  color: #6a4300;
  backdrop-filter: blur(3px);
}

.play2048-overlay[hidden] {
  display: none !important;
}

.play2048-overlay strong {
  font-size: 26px;
}

.play2048-overlay span {
  max-width: 340px;
  line-height: 1.7;
  font-size: 14px;
}

.play2048-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.play2048-pad-wrap {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid #edd8b8;
  background: rgba(255, 255, 255, 0.72);
}

.play2048-pad-label,
.play2048-status-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #8c6b40;
}

.play2048-pad {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.play2048-pad-row {
  display: flex;
  gap: 10px;
}

.play2048-pad-btn {
  min-width: 78px;
}

.play2048-status-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid #eadbbf;
  background: rgba(255, 255, 255, 0.88);
}

.play2048-status-box .studio-status {
  min-height: 0;
  font-size: 13px;
  line-height: 1.7;
}

.play2048-side {
  display: grid;
  gap: 18px;
}

.play2048-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.play2048-metrics .studio-metric-card {
  padding: 10px 12px;
  border-radius: 14px;
}

.play2048-metrics .studio-metric-card strong {
  margin-top: 4px;
  font-size: 17px;
}

@media (max-width: 1120px) {
  .play2048-arena {
    grid-template-columns: 1fr;
  }

  .play2048-live-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .play2048-arena {
    gap: 12px;
  }

  .play2048-grid-shell {
    padding: 10px;
    border-radius: 22px;
  }

  .play2048-grid {
    gap: 10px;
  }

  .play2048-tile,
  .play2048-cell {
    border-radius: 16px;
  }

  .play2048-overlay {
    inset: 10px;
  }

  .play2048-scorebox {
    min-width: 82px;
  }

  .play2048-live-card {
    padding: 12px;
    border-radius: 20px;
  }

  .play2048-actions {
    grid-template-columns: 1fr;
  }
}
