/* 戦士ともきんぐ — 100dvh フルスクリーンレイアウト */

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: #1a1a2e;
  font-family: sans-serif;
  color: #eee;
  touch-action: manipulation;
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- HUD (プレイ中のみ表示) ---- */
#hud {
  flex: 0 0 auto;
  display: flex;
  gap: 0.4em 1.2em;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  padding: 6px 10px;
  font-size: 0.95rem;
  font-weight: bold;
  background: #14142a;
  border-bottom: 1px solid #2c2c4a;
}
#hud b { color: #ffe082; font-variant-numeric: tabular-nums; }
#powerup-hud { color: #ffb300; }

/* ---- ステージ: canvas を縦横比を保って中央に収める ---- */
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}
canvas {
  background: #3a6e2a;
  border: 3px solid #444;
  border-radius: 4px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ウェーブクリア等のメッセージは canvas の上部に重ねる */
#message {
  position: absolute;
  top: 14%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.3rem;
  font-weight: bold;
  color: #ffe082;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

/* ---- タイトル画面 ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  text-align: center;
  background: #1a1a2e;
  overflow-y: auto;
  user-select: none;
  -webkit-user-select: none;
}
/* 中身が画面より高いとき上端が切れないよう、上下の余白で中央に寄せる */
.screen > :first-child { margin-top: auto; }
.screen > :last-child  { margin-bottom: auto; }

#opening-screen {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 画像は残りの高さに収まる範囲で最大化(横長 1408×768) */
  width: min(100%, 660px, calc((100dvh - 250px) * 1408 / 768));
  min-width: min(100%, 280px);
}
#opening-screen img {
  width: 100%;
  border: 3px solid #444;
  border-radius: 4px;
  display: block;
  transition: opacity 0.1s;
}
#opening-screen:active img { opacity: 0.8; }
#opening-hint {
  color: #ffe082;
  font-size: 0.95rem;
  font-weight: bold;
  margin-top: 6px;
  animation: hint-blink 1.2s ease-in-out infinite;
}
@keyframes hint-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

#last-score {
  font-size: 1.1rem;
  font-weight: bold;
  color: #ffe082;
}

#controls {
  max-width: 30em;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #aaa;
}

/* ---- ボタン ---- */
button {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-family: inherit;
}
#difficultySelect {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.diff-btn {
  padding: 7px 16px;
  font-size: 0.9rem;
  border: 2px solid #555;
  background: #2a2a4e;
  color: #aaa;
}
.diff-btn:hover { border-color: #888; color: #fff; background: #3a3a6e; }
.diff-btn.selected[data-diff="easy"]   { border-color: #64b5f6; color: #fff; background: #0d2a4a; }
.diff-btn.selected[data-diff="normal"] { border-color: #4caf50; color: #fff; background: #1a3a1a; }
.diff-btn.selected[data-diff="hard"]   { border-color: #ef5350; color: #fff; background: #3a0d0d; }

.sound-btn {
  padding: 5px 16px;
  font-size: 0.85rem;
  background: #1a3a4a;
  border: 2px solid #4dd0e1;
  color: #4dd0e1;
  border-radius: 20px;
}
.sound-btn:hover { background: #0d2535; }
.sound-btn.off { border-color: #555; color: #555; background: #1a1a2e; }

.footer-note { margin-top: 0; }

/* ---- なまえ入力 ---- */
.name-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #bbb;
}
.name-box input {
  width: 10em;
  padding: 6px 10px;
  font-size: 1rem;           /* 16px未満だとiOSで入力時にズームされる */
  border: 2px solid #555;
  border-radius: 6px;
  background: #2a2a4e;
  color: #eee;
}
.name-box input:focus { outline: none; border-color: #4dd0e1; }

/* ---- ランキング ---- */
#ranking {
  width: min(100%, 22em);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.85rem;
}
#ranking h3 {
  font-size: 0.85rem;
  color: #4dd0e1;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
#ranking table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#ranking td { padding: 2px 4px; }
#ranking td:first-child { width: 2em; text-align: right; color: #888; }
#ranking td.name {
  max-width: 8em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
#ranking td.wave { color: #888; }
#ranking td.score { text-align: right; font-weight: bold; }
#ranking tr.me td { color: #ffe082; }
#ranking p { color: #888; margin-top: 2px; }

/* 2026.11.03(01) */
