/* ==========================================================
   トップページ：扉 → ダンジョン → コマンドメニュー
   ========================================================== */
.stage {
  position: relative;
  height: 100vh; height: 100svh; min-height: 560px;
  overflow: hidden;
  background: #050608;
  isolation: isolate;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }

/* 周辺減光と下端のなじませ */
.stage::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 70% at 50% 45%, transparent 55%, rgba(0,0,0,.55) 100%),
    linear-gradient(to bottom, transparent 70%, rgba(12,14,19,.9) 100%);
}

/* WebGL が使えない環境・動きを減らす設定のための静止画 */
.stage-fallback {
  position: absolute; inset: 0; z-index: 0; display: none;
  background:
    radial-gradient(ellipse 40% 50% at 50% 55%, rgba(242,166,90,.35), transparent 70%),
    radial-gradient(circle at 18% 40%, rgba(242,166,90,.25), transparent 18%),
    radial-gradient(circle at 82% 40%, rgba(242,166,90,.25), transparent 18%),
    #0b0d11;
}
.stage-fallback::before {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(46vw, 360px); aspect-ratio: 2 / 3;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, #3b2a1a 0 49.6%, #120d08 49.6% 50.4%, #3b2a1a 50.4%);
  box-shadow: 0 0 0 14px #2b2f37, 0 0 80px rgba(242,166,90,.25);
}
.no-webgl .stage-fallback { display: block; }

/* ---- 上部バー ---- */
.stage-top {
  position: absolute; z-index: 3; inset: 0 0 auto 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px var(--gutter);
}
.stage-top .brand { opacity: .9; }
.skip-intro {
  background: none; border: 0; color: var(--parchment-dim); font: inherit; font-size: .88rem;
  cursor: pointer; padding: 10px 4px; text-decoration: underline; text-underline-offset: .3em; text-decoration-color: var(--stone-3);
}
.skip-intro:hover { color: var(--parchment); }
.is-hall .skip-intro { display: none; }

/* ---- 扉の前 ---- */
.gate-ui {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: clamp(36px, 8vh, 88px);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 0 var(--gutter);
  transition: opacity .8s ease, transform .8s ease;
}
.gate-ui h1 { display: flex; flex-direction: column; align-items: center; gap: 4px; text-shadow: 0 2px 18px rgba(0,0,0,.9); }
.gate-ui .h1-main { font-size: clamp(1.5rem, 3.2vw, 2.1rem); letter-spacing: .3em; padding-left: .3em; }
.gate-ui .h1-sub { font-family: var(--f-latin); font-size: clamp(.72rem, 1.3vw, .85rem); letter-spacing: .38em; color: var(--verdigris); font-weight: 400; padding-left: .38em; }
.gate-copy { margin: 14px 0 26px; color: var(--parchment); font-size: clamp(.92rem, 1.6vw, 1.02rem); text-shadow: 0 2px 12px rgba(0,0,0,.95); }

.door-btn { min-width: 220px; position: relative; overflow: hidden; }
.door-btn::before {
  content: ""; position: absolute; inset: -2px; border: 1px solid var(--ember);
  animation: ring 2.6s ease-out infinite; pointer-events: none;
}
@keyframes ring { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.18, 1.5); } }

.is-opening .gate-ui, .is-hall .gate-ui { opacity: 0; transform: translateY(16px); pointer-events: none; }

/* ---- ダンジョン内：コマンドウィンドウ ---- */
.hall-ui {
  position: absolute; z-index: 3;
  left: var(--gutter); right: var(--gutter); bottom: clamp(28px, 6vh, 64px);
  display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 440px); gap: 18px;
  align-items: end;
  opacity: 0; transform: translateY(14px);
  transition: opacity .7s ease .1s, transform .7s ease .1s;
  pointer-events: none;
}
.hall-ui[hidden] { display: grid; visibility: hidden; }
.is-hall .hall-ui { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }

.cmd-window, .cmd-desc {
  background: rgba(8, 10, 14, .78);
  border: 1px solid rgba(232, 220, 194, .55);
  box-shadow: inset 0 0 0 3px rgba(8,10,14,.9), inset 0 0 0 4px rgba(232,220,194,.18), 0 18px 48px rgba(0,0,0,.6);
  border-radius: 6px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.cmd-window { padding: 14px 10px; }
.cmd-list { list-style: none; }
.cmd-list a {
  position: relative; display: flex; align-items: center; gap: 4px;
  padding: 7px 12px 7px 30px; color: var(--parchment); text-decoration: none;
  font-family: var(--f-head); font-size: 1.02rem; letter-spacing: .06em; line-height: 1.5;
  border-radius: 3px;
}
.cmd-list a::before {
  /* ▶ カーソル */
  content: ""; position: absolute; left: 10px; top: 50%; margin-top: -6px;
  border-left: 9px solid var(--ember); border-top: 6px solid transparent; border-bottom: 6px solid transparent;
  opacity: 0;
}
.cmd-list a.is-active { background: rgba(242,166,90,.10); color: #fff6e6; }
.cmd-list a.is-active::before { opacity: 1; animation: blink 1s steps(2, start) infinite; }
.cmd-list a:focus-visible { outline-offset: 0; }
.cmd-list .sep { height: 1px; background: rgba(232,220,194,.18); margin: 8px 10px; }
@keyframes blink { to { visibility: hidden; } }

.cmd-desc { padding: 20px 24px 22px; min-height: 170px; display: flex; flex-direction: column; }
.cmd-title { font-family: var(--f-head); font-size: 1.3rem; margin: 0 0 8px; }
.cmd-text { margin: 0 0 16px; color: var(--parchment); font-size: .95rem; line-height: 1.85; flex: 1; }
.cmd-go { align-self: flex-start; font-size: .92rem; }
.cmd-keys { margin: 10px 0 0; font-size: .78rem; color: var(--parchment-dim); }

@media (max-width: 760px) {
  .hall-ui { grid-template-columns: 1fr; bottom: 20px; }
  .cmd-desc { display: none; }
  .cmd-window { padding: 8px 6px; }
  .cmd-list a { font-size: .95rem; padding: 6px 8px 6px 28px; }
  .cmd-list .sep { margin: 4px 10px; }
}

/* ---- スクロール案内 ---- */
.scroll-hint {
  position: absolute; z-index: 3; right: var(--gutter); bottom: 22px;
  color: var(--parchment-dim); font-size: .8rem; text-decoration: none; letter-spacing: .1em;
  writing-mode: vertical-rl; display: flex; align-items: center; gap: 10px;
}
.scroll-hint::after { content: ""; width: 1px; height: 48px; background: linear-gradient(var(--parchment-dim), transparent); }
@media (max-width: 760px) { .scroll-hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .door-btn::before, .cmd-list a.is-active::before { animation: none; }
}

/* ---- 本文側：トップ固有 ---- */
.intro-statement { font-family: var(--f-head); font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.9; margin-bottom: 1.4em; }
.reasons h3 { font-size: var(--step-1); margin-bottom: .4em; }
.reasons > div { padding: 24px 0; border-bottom: 1px solid var(--stone-2); }
.reasons > div:first-child { border-top: 1px solid var(--stone-3); }
.reasons p { margin: 0; color: var(--parchment-dim); }
