* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100vh; /* dvh非対応の古いブラウザ用フォールバック */
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-brand-dark);
  -webkit-font-smoothing: antialiased;
}

/* ===== ARステージ（video背景＋透過WebGLキャンバス） ===== */
.ar-stage {
  position: fixed;
  inset: 0;
}

.ar-stage__video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh; /* dvh非対応の古いブラウザ用フォールバック */
  height: 100dvh;
  object-fit: cover;
  z-index: var(--z-video);
  background: #000;
}

.ar-stage__canvas {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  pointer-events: none;
}

.ar-stage__canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* カメラなしモード: videoを隠して世界観背景を敷く */
body.is-fallback .ar-stage__video {
  display: none;
}

body.is-fallback .ar-stage {
  background: var(--fallback-bg);
}

/* ===== イントロ（スタート画面） ===== */
.intro {
  position: fixed;
  inset: 0;
  z-index: var(--z-ui);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--color-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.45s ease;
}

.intro.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro__inner {
  padding: 24px;
  max-width: 420px;
}

.intro__brand {
  font-size: 12px;
  letter-spacing: 0.42em;
  color: var(--color-brand-silver);
}

.intro__title {
  margin-top: 10px;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.intro__lead {
  margin-top: 16px;
  font-size: 14px;
  line-height: 2;
  color: var(--color-text-muted);
}

.intro__button {
  margin-top: 28px;
  padding: 16px 48px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-button-text);
  background: var(--color-button-bg);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(158, 23, 34, 0.45);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.intro__button:not(:disabled):hover {
  transform: translateY(-2px);
}

.intro__button:disabled {
  opacity: 0.55;
  cursor: default;
}

.intro__note {
  margin-top: 20px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--color-text-muted);
}

/* ===== トースト（状態のお知らせ） ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: var(--z-toast);
  max-width: min(88vw, 480px);
  padding: 10px 18px;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  color: var(--color-text);
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(201, 205, 210, 0.25);
  border-radius: 12px;
}

/* ===== デバッグパネル（?debug=1 のみ） ===== */
.debug-panel {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 10px;
  z-index: var(--z-debug);
  width: 250px;
  padding: 12px;
  font-size: 11px;
  line-height: 1.6;
  color: #DFE3E8;
  background: rgba(10, 10, 12, 0.85);
  border: 1px solid rgba(201, 205, 210, 0.3);
  border-radius: 10px;
  pointer-events: auto;
}

.debug-panel__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--color-brand-silver);
}

.debug-panel__stats {
  margin-top: 6px;
  white-space: pre-line;
  font-family: Consolas, monospace;
}

.debug-panel__row {
  margin-top: 8px;
}

.debug-panel__row label {
  display: block;
}

.debug-panel__row input[type="range"] {
  width: 100%;
}

.debug-panel__buttons {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.debug-panel__buttons button {
  padding: 5px 10px;
  font-family: inherit;
  font-size: 11px;
  color: #fff;
  background: #333;
  border: 1px solid #555;
  border-radius: 6px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .intro {
    transition: none;
  }
}
