* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body.game-page {
  padding-top: 48px;
  padding-bottom: 20px;
  min-height: 100vh;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  font-family: "MS PGothic", "Yu Gothic", sans-serif;
  color: #e0e0e0;
}

.stack-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stack-title {
  font-size: 1.5rem;
  color: #60a5fa;
  margin-bottom: 16px;
  text-align: center;
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
}

/* HUD */
.stack-hud {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
  width: 100%;
}

.stack-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.2);
  border: 2px solid #3b82f6;
  border-radius: 8px;
  min-width: 80px;
}

.stack-label {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.stack-value {
  font-size: 20px;
  font-weight: bold;
  color: #60a5fa;
}

/* ゲームエリア */
.stack-game-area {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 3px solid #3b82f6;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  touch-action: none;
}

#gameCanvas {
  display: block;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100%;
  max-width: 400px;
  height: auto;
  touch-action: none;
}

.stack-next-block {
  margin-top: 12px;
  text-align: center;
}

.stack-next-label {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}

#nextCanvas {
  display: block;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #3b82f6;
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* コントロール */
.stack-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  margin-bottom: 16px;
}

.stack-btn {
  padding: 12px 24px;
  border: 2px solid #3b82f6;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
}

.stack-btn:hover { transform: scale(1.05); }
.stack-btn:active { transform: scale(0.95); }
.stack-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.stack-btn-left,
.stack-btn-right {
  flex: 1;
  font-size: 24px;
}

.stack-btn-drop {
  flex: 2;
}

.stack-btn-start,
.stack-btn-restart {
  padding: 14px 32px;
  font-size: 18px;
  background: linear-gradient(180deg, #10b981, #059669);
  border-color: #10b981;
}

/* ゲームオーバー画面 */
.stack-gameover {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.stack-gameover.hidden {
  display: none;
}

.stack-gameover-content {
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 3px solid #ef4444;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  max-width: 300px;
  width: 90%;
}

.stack-gameover-content h2 {
  font-size: 24px;
  color: #ef4444;
  margin-bottom: 16px;
}

.stack-final-score {
  margin: 20px 0;
  font-size: 18px;
  color: #e0e0e0;
}

.stack-final-score div {
  margin: 8px 0;
}

.stack-final-score span {
  color: #60a5fa;
  font-weight: bold;
  font-size: 24px;
}

/* スタート画面 */
.stack-start {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.stack-start.hidden {
  display: none;
}

.stack-start-content {
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 3px solid #3b82f6;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  max-width: 300px;
  width: 90%;
}

.stack-start-content h2 {
  font-size: 24px;
  color: #60a5fa;
  margin-bottom: 16px;
}

.stack-start-content p {
  color: #e0e0e0;
  margin-bottom: 8px;
  line-height: 1.6;
}

/* 戻るリンク */
.stack-back {
  display: inline-block;
  margin-top: 16px;
  font-size: 12px;
  color: #60a5fa;
  text-decoration: none;
  text-align: center;
}

.stack-back:hover {
  text-decoration: underline;
}
