/* ========================================================
   首页专用样式（三栏布局：文章树 + 游戏区 + 游戏说明）
   ======================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  color: #24292f;
}

/* 顶部导航栏 */
.my-header {
  background: #ffffff;
  border-bottom: 1px solid #e1e4e8;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.index-link {
  display: flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
  color: #24292f;
  transition: all 0.25s ease;
}
.index-link h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
}
.index-link h2::before {
  content: "⚡";
  margin-right: 8px;
  font-size: 1.1rem;
}
.index-link:hover {
  color: #0969da;
  transform: translateX(2px);
}

/* 主体：三栏并排 */
.my-main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 左侧文章树 */
.sidebar-left {
  width: 280px;
  flex-shrink: 0;
  height: auto;                 /* 覆盖 sidebar-left.css 里的 height:100vh，改为拉伸填满 */
  border-right: 1px solid #e1e4e8;
  background: #f6f8fa;
  overflow-y: auto;
  padding: 10px 10px 80px;
}

/* 中间游戏区（淡点阵背景，避免大面积空白显得空） */
.home-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 36px;
  background-color: #ffffff;
  background-image:
    radial-gradient(1100px 520px at 50% -20%, #eaf2ff 0%, rgba(234, 242, 255, 0) 60%),
    radial-gradient(circle, rgba(13, 17, 23, 0.05) 1.2px, transparent 1.2px);
  background-size: auto, 22px 22px;
}

/* 右侧游戏说明面板 */
.sidebar-right {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid #e1e4e8;
  background: #f6f8fa;
  overflow-y: auto;
  padding: 16px 12px;
}
.sidebar-right-title {
  font-size: 13px;
  color: #57606a;
  margin: 0 0 12px;
  padding: 0 4px;
  letter-spacing: 1px;
}

.game-help {
  font-size: 13px;
  color: #57606a;
}
.help-section {
  margin-bottom: 18px;
}
.help-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #8b949e;
  margin-bottom: 6px;
}
.help-section p {
  margin: 0;
  line-height: 1.9;
  color: #24292f;
}
.help-section b {
  color: #0969da;
}
.help-restart {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #0969da;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.help-restart:hover {
  background: #0550ae;
}

/* ========================================================
   2048 游戏窗口样式（由 games/2048.js 注入，类名以 c2048- 前缀避免冲突）
   ======================================================== */
.c2048-panel {
  background: #faf8ef;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}
.c2048-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.c2048-title {
  font-size: 36px;
  font-weight: 800;
  color: #776e65;
  line-height: 1;
}
.c2048-scores {
  display: flex;
  gap: 8px;
}
.c2048-box {
  background: #bbada0;
  border-radius: 6px;
  padding: 6px 12px;
  min-width: 64px;
  text-align: center;
}
.c2048-box-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: #eee4da;
}
.c2048-box-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.c2048-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  background: #bbada0;
  border-radius: 8px;
  --cs: 100px;
}
.c2048-cell {
  background: #cdc1b4;
  border-radius: 6px;
}

.c2048-tile {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  transition: transform 0.12s ease-in-out;
}
.c2048-tile.is-new { transition: none; }
.c2048-board.no-anim .c2048-tile { transition: none; }

.c2048-tile-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  color: #776e65;
  background: #cdc1b4;
  font-size: calc(var(--cs, 100px) * 0.5);
}
.c2048-tile-inner.is-new { animation: c2048-pop 0.15s ease; }
.c2048-tile-inner.is-merged { animation: c2048-merge 0.2s ease; }
@keyframes c2048-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes c2048-merge { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }

.c2048-tile-inner.tile-2   { background: #eee4da; }
.c2048-tile-inner.tile-4   { background: #ede0c8; }
.c2048-tile-inner.tile-8   { background: #f2b179; color: #f9f6f2; }
.c2048-tile-inner.tile-16  { background: #f59563; color: #f9f6f2; }
.c2048-tile-inner.tile-32  { background: #f67c5f; color: #f9f6f2; }
.c2048-tile-inner.tile-64  { background: #f65e3b; color: #f9f6f2; }
.c2048-tile-inner.tile-128 { background: #edcf72; color: #f9f6f2; font-size: calc(var(--cs, 100px) * 0.38); }
.c2048-tile-inner.tile-256 { background: #edcc61; color: #f9f6f2; font-size: calc(var(--cs, 100px) * 0.38); }
.c2048-tile-inner.tile-512 { background: #edc850; color: #f9f6f2; font-size: calc(var(--cs, 100px) * 0.38); }
.c2048-tile-inner.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: calc(var(--cs, 100px) * 0.3); }
.c2048-tile-inner.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: calc(var(--cs, 100px) * 0.3); }
.c2048-tile-inner.tile-super { background: #3c3a32; color: #f9f6f2; font-size: calc(var(--cs, 100px) * 0.3); }

.c2048-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(238, 228, 218, 0.73);
  color: #776e65;
  font-weight: 800;
  font-size: 30px;
  border-radius: 8px;
}
.c2048-overlay.show { display: flex; }
