/* games/tetris/style.css */

/* ── 主布局：棋盤 + 側邊面板左右並排 ── */
.tetris-layout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: center;
  margin-top: 8px;
}

/* ── 遊戲棋盤 Canvas ── */
#tetris-canvas {
  display: block;
  border-radius: var(--border-radius);
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-card);
  touch-action: none; /* 防止手機滑動干擾 */
  flex-shrink: 0;
}

/* ── 側邊欄 ── */
.tetris-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

/* ── 側邊資訊卡 ── */
.tetris-panel {
  background: var(--color-bg-card);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border);
  padding: 8px 10px;
  text-align: center;
  box-shadow: var(--shadow-card);
  min-width: 70px;
}

.panel-label {
  font-size: 10px;
  color: var(--color-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.panel-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
}

/* ── 下一個方塊 Canvas ── */
#tetris-next {
  display: block;
  margin: 0 auto;
  border-radius: 4px;
}

/* ── 鍵盤提示文字 ── */
.tetris-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 14px;
  line-height: 1.9;
}

/* ── 小螢幕隱藏提示（畫面空間有限） ── */
@media (max-width: 420px) {
  .tetris-hint {
    display: none;
  }
}

/* ── 手機觸控按鈕（桌機就隱藏） ── */
.tetris-dpad {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.dpad-row {
  display: flex;
  gap: 6px;
  width: calc(100% - 16px);
  max-width: 400px;
}

.dpad-btn {
  flex: 1;
  min-width: 0;
  height: 50px;
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--color-border);
  background: var(--color-bg-card);
  font-size: 20px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s;
  box-shadow: var(--shadow-card);
  -webkit-tap-highlight-color: transparent;
  color: var(--color-text);
}

.dpad-rotate {
  flex: 1.6;
  font-size: 16px;
}

.dpad-drop-btn {
  flex: 1.3;
  font-size: 16px;
}

.dpad-btn:active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ── 分數狀態列（桌機 / 手機共用） ── */
.tetris-info-bar {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 10px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0,0,0,0.05), inset 0 2px 4px rgba(255,255,255,0.8);
}

[data-theme="dark"] .tetris-info-bar {
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.05);
}

.tib-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

/* 桌機上遊戲進行中隐藏行數 / 等級（側邊面板已有） */
.tib-lines,
.tib-level {
  display: none;
}

.tib-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tib-score-val {
  font-size: 32px;
  font-weight: 900;
  color: var(--color-primary);
  line-height: 1.1;
}

.tib-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1.1;
}

.tib-best {
  font-size: 22px;
  color: var(--color-text-muted);
  font-weight: 700;
}

/* ── 難度切換確認提示條 ── */
.diff-confirm {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--color-bg-card);
  border: 2px solid var(--color-secondary);
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.diff-confirm.hidden { display: none; }
.diff-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── 手機專用版面配置（< 600px） ── */
@media (max-width: 599px) {
  /* 標題隱藏，節省約 56px */
  .game-title { display: none; }

  .tetris-layout {
    flex-direction: column;
    align-items: center;
    margin-top: 4px;
  }

  /* 側邊面板隱藏（改用 Canvas 疊層 + info-bar） */
  .tetris-side { display: none; }

  /* 顯示行數 / 等級（桌機剩 side panel，手機用 info-bar） */
  .tib-lines,
  .tib-level { display: flex; }

  /* 部面紧湊的狀態列 */
  .tetris-info-bar {
    padding: 5px 8px;
    gap: 0;
    margin-bottom: 5px;
    border-radius: 10px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .tib-item {
    flex: 1;
    min-width: 0;
    padding: 2px 2px;
    border-right: 1px solid var(--color-border);
  }
  .tib-item:last-child { border-right: none; }

  .tib-label { font-size: 9px; }

  .tib-score-val { font-size: 22px; }
  .tib-val       { font-size: 18px; }
  .tib-best      { font-size: 16px; color: var(--color-primary); }

  /* 顯示觸控按鈕 */
  .tetris-dpad { display: flex; }
}
