/* =========================================================================
   One-Tap Chain — style.css
   ミニマルデザイン / モバイル・タブレット最適化 / 没入型フルスクリーンUI
   ========================================================================= */

:root {
  --bg-top: #070b14;
  --bg-bottom: #02040a;
  --accent: #6cf2ff;
  --text: rgba(255, 255, 255, 0.82);
  --text-dim: rgba(255, 255, 255, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* タップ時の青いハイライトを消す */
  -webkit-touch-callout: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-bottom);
  /* セーフエリア（ノッチ）対応 */
  height: 100dvh;
  touch-action: none; /* スクロール・ズームなどのブラウザ既定ジェスチャを無効化 */
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Noto Sans JP", sans-serif;
}

/* ===== キャンバス：画面中央に配置。実ピクセルはJSが設定する ===== */
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ===== 最小HUD ===== */
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none; /* タップはキャンバスへ透過させる */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px
           calc(env(safe-area-inset-bottom, 0px) + 18px) 20px;
}

.hud-text {
  color: var(--text-dim);
  font-size: clamp(12px, 3.4vw, 18px);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  transition: opacity 0.4s ease;
}

#level-label { opacity: 0.55; }

.hint {
  align-self: center;
  margin-top: auto;
  opacity: 0;
  color: var(--accent);
}
.hint.show { opacity: 0.7; }

/* ===== スタートベール（初回タップでオーディオを解放） ===== */
#start-veil {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, #0b1426 0%, #02040a 70%);
  z-index: 10;
  transition: opacity 0.6s ease;
}
#start-veil.hidden {
  opacity: 0;
  pointer-events: none;
}

.veil-inner { text-align: center; animation: floaty 3.2s ease-in-out infinite; }

.veil-title {
  color: var(--text);
  font-size: clamp(26px, 8vw, 56px);
  font-weight: 800;
  letter-spacing: 0.16em;
}
.veil-sub {
  margin-top: 18px;
  color: var(--text-dim);
  font-size: clamp(13px, 3.6vw, 18px);
  letter-spacing: 0.22em;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.75; }
}

@media (prefers-reduced-motion: reduce) {
  .veil-inner, .veil-sub { animation: none; }
}

/* ===== 実機デバッグ用エラーログ（通常は非表示） ===== */
#errlog {
  display: none;
  position: fixed;
  left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  margin: 0 10px;
  z-index: 9999;
  padding: 10px 12px;
  background: rgba(120, 8, 8, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 8px;
  font-family: ui-monospace, Menlo, monospace;
  word-break: break-word;
  pointer-events: none;
}
