/* style.css - ネルとゾンビの町 スタイルシート */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

/* ===== リセット・ベース ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a0a2e;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* ===== ゲームコンテナ ===== */
#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 900px;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}

/* デスクトップでは中央寄せ */
@media (min-width: 481px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #gameContainer {
    border: 3px solid #ff4081;
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(255, 64, 129, 0.5),
                0 0 80px rgba(124, 77, 255, 0.3);
  }
}

/* ===== メインキャンバス ===== */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ===== スマホ用 仮想コントローラー ===== */
#touchControls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 180px;
  display: none; /* デスクトップでは非表示 */
  pointer-events: auto;
  z-index: 10;
}

/* スマホ表示時は仮想コントローラーを出す */
@media (max-width: 600px), (pointer: coarse) {
  #touchControls {
    display: flex;
  }
  #gameContainer {
    max-height: calc(100vh - 180px);
    height: calc(100vh - 180px);
  }
}

/* 十字キーエリア（左側） */
#dpadArea {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 10px 0 0 10px;
  flex-shrink: 0;
}

/* 十字キーボタン共通 */
.dpad-btn {
  position: absolute;
  width: 52px;
  height: 52px;
  background: rgba(255, 64, 129, 0.25);
  border: 2px solid rgba(255, 128, 171, 0.6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  transition: background 0.05s;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
  background: rgba(255, 64, 129, 0.6);
  transform: scale(0.94);
}

#dpad-up    { top: 0;     left: 54px; }
#dpad-down  { bottom: 0;  left: 54px; }
#dpad-left  { left: 0;    top: 54px; }
#dpad-right { right: 0;   top: 54px; }

/* アクションボタンエリア（右側） */
#actionArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px 0 0;
}

.action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 13px;
  font-weight: bold;
  font-family: 'Noto Sans JP', sans-serif;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  line-height: 1.2;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.05s, box-shadow 0.05s;
}

.action-btn:active {
  transform: scale(0.9);
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

#btn-action {
  background: linear-gradient(135deg, #ff4081, #e91e63);
  width: 62px;
  height: 62px;
}

#btn-cancel {
  background: linear-gradient(135deg, #7c4dff, #5e35b1);
}

/* サブボタンエリア（左下） */
#subArea {
  position: absolute;
  bottom: 10px;
  left: 10px;
}

#btn-menu {
  background: linear-gradient(135deg, #00bcd4, #006064);
  width: 52px;
  height: 32px;
  border-radius: 8px;
  font-size: 11px;
  padding: 0 6px;
}

/* ===== ローディング画面 ===== */
#loadingScreen {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a0a2e, #0d0d2b);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: #fff;
  transition: opacity 0.5s;
}

#loadingScreen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-title {
  font-size: 24px;
  font-weight: bold;
  color: #ff80ab;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255, 128, 171, 0.7);
}

.loading-bar-bg {
  width: 200px;
  height: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff4081, #7c4dff);
  border-radius: 6px;
  animation: loadFill 1.5s ease-out forwards;
}

@keyframes loadFill {
  from { width: 0; }
  to   { width: 100%; }
}

.loading-text {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

/* ===== スクリーンエフェクト（フラッシュなど）===== */
#screenEffect {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.1s;
}

#screenEffect.flash-white {
  background: white;
  animation: flashWhite 0.3s ease-out;
}

#screenEffect.flash-red {
  background: rgba(255, 0, 0, 0.4);
  animation: flashRed 0.4s ease-out;
}

@keyframes flashWhite {
  0%   { opacity: 0.8; }
  100% { opacity: 0; }
}

@keyframes flashRed {
  0%   { opacity: 0.6; }
  100% { opacity: 0; }
}

/* ===== キーボードヒント（デスクトップ） ===== */
#keyboardHint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  pointer-events: none;
  display: none;
}

@media (min-width: 601px) and (pointer: fine) {
  #keyboardHint {
    display: block;
  }
}

/* ===== スクロールバー非表示 ===== */
::-webkit-scrollbar {
  display: none;
}
