/* ─────────────────────────────────────────────────────────────
   Aiden AR Demo - 全画面 + オーバーレイ
   - 背景透過で AR シーンを背面に置く
   - すべてのオーバーレイは pointer-events 制御で AR インタラクションを邪魔しない
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #0a0a0a;
  --fg: #f5f3ee;
  --fg-muted: #b9b3a3;
  --gold: #c9a961;
  --gold-dark: #a8893f;
  --line: rgba(245, 243, 238, 0.18);
  --tap-min: 44px;
  --serif: "Playfair Display", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--fg);
  /* 注意: MindAR は video を z-index:-2 で背面に置くため、
     body 背景は不透明にしてはいけない (映像を覆い隠す)。
     スタート画面の黒は #start-overlay 側で出す。 */
  background: transparent;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  /* ステータスバー領域を巻き込んで全画面化 (iOS) */
  height: 100vh;
  height: 100dvh;
}

/* スタート画面の前は背景色を出したい (video 起動前) */
body.aiden-pre-start {
  background: var(--bg);
}

/* hidden 属性の最優先化
   .overlay の display: flex がブラウザ既定の [hidden] { display: none } を
   上書きしてしまうため、明示的に !important で打ち消す。これがないと
   error-overlay / scan-hint / cta-overlay が常時表示で重なる。 */
[hidden] { display: none !important; }

a-scene {
  width: 100% !important;
  height: 100% !important;
  position: fixed !important;
  inset: 0;
}

.gold { color: var(--gold); }

.eyebrow {
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 12px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  pointer-events: auto;
}

.overlay-start { background: rgba(10, 10, 10, 0.94); backdrop-filter: blur(12px); }
.overlay-error { background: rgba(10, 10, 10, 0.94); backdrop-filter: blur(12px); }
.overlay-scan {
  background: transparent;
  pointer-events: none;
  flex-direction: column;
}
.overlay-cta {
  background: linear-gradient(to top, rgba(10, 10, 10, 0.95) 0%, rgba(10, 10, 10, 0.7) 60%, transparent 100%);
  align-items: flex-end;
}

.overlay-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.overlay-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1.2;
  margin: 0 0 24px;
}

.overlay-body {
  font-size: 15px;
  line-height: 1.8;
  color: var(--fg-muted);
  margin: 0 0 28px;
  text-align: left;
}

.overlay-hint {
  font-size: 12px;
  line-height: 1.7;
  color: var(--fg-muted);
  margin: 16px 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 24px;
  font-size: 15px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  transition: background 200ms, color 200ms, border-color 200ms;
  -webkit-user-select: none;
  user-select: none;
  margin-bottom: 12px;
  text-decoration: none;
}
.btn-primary {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}
.btn-primary:active {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-secondary {
  border-color: rgba(245, 243, 238, 0.3);
  color: var(--fg);
}
.btn-secondary:active {
  border-color: var(--gold);
  color: var(--gold);
}

.link-back {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
  letter-spacing: 0.15em;
  min-height: var(--tap-min);
  line-height: var(--tap-min);
}
.link-back:active { color: var(--gold); }

/* ─── スキャンフレーム ─── */
.scan-frame {
  width: min(70vw, 320px);
  aspect-ratio: 1 / 1;
  position: relative;
}
.scan-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 2px solid var(--gold);
}
.scan-corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.scan-corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.scan-corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.scan-corner.br { bottom: 0; right: 0; border-left: none; border-top: none; }

.scan-text {
  margin-top: 24px;
  font-size: 14px;
  color: var(--fg);
  letter-spacing: 0.1em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

/* ─── ターゲット検出後 CTA ─── */
.cta-card {
  width: 100%;
  max-width: 480px;
  pointer-events: auto;
}
.cta-greeting {
  font-family: var(--serif);
  font-size: clamp(20px, 5.5vw, 26px);
  line-height: 1.5;
  margin: 0 0 16px;
  text-align: center;
}
.cta-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg-muted);
  margin: 0 0 20px;
  text-align: center;
}

/* ─── reduce motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
