/* ダイブした先のページ（サブページ）で共通に使う見た目 */

:root {
  --bg: #031412;
  --ink: #D8FFE9;
  --soft: #A9D9C2;
  --muted: #8FBFA8;
  --phosphor: #7CFFB2;
  --on-phosphor: #03211B;
  --panel: rgba(3, 20, 18, 0.86);
  --line: rgba(124, 255, 178, 0.45);
  --font: 'DotGothic16', 'MS Gothic', 'Osaka-Mono', monospace;
  --mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--phosphor); }
:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 左上: レーンに戻る ＋ ページの名前 */
.page-head {
  position: fixed;
  left: 16px;
  top: calc(16px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 2;
  pointer-events: none;
}
.page-head > * { pointer-events: auto; }
.page-back {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(124, 255, 178, 0.6);
  background: rgba(3, 20, 18, 0.7);
  color: var(--ink);
}
.page-back:hover { background: rgba(124, 255, 178, 0.12); color: var(--ink); }
.page-back path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-title { pointer-events: none; }
.page-title p { margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--phosphor); }
.page-title h1 { margin: 0; font-weight: 400; font-size: 22px; line-height: 1.2; text-shadow: 0 0 10px rgba(3, 20, 18, 0.9); }

@media (min-width: 761px) {
  .page-head { left: 32px; top: 28px; }
  .page-title h1 { font-size: 30px; }
}

/* 下: 遊び方 */
.page-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom));
  margin: 0;
  padding: 0 16px;
  text-align: center;
  font-size: 13px;
  color: var(--soft);
  pointer-events: none;
  text-shadow: 0 0 8px rgba(3, 20, 18, 0.9);
}

.page-btn {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(3, 20, 18, 0.75);
  border: 1px solid var(--phosphor);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.page-btn:hover { background: rgba(124, 255, 178, 0.12); }
.page-btn[hidden] { display: none; }
.page-btn--solid { background: var(--phosphor); color: var(--on-phosphor); }
.page-btn--solid:hover { background: #A8FFCB; }
.page-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.page-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* 入ってきたとき: ポータルのダイブで画面を満たした緑の光が、ひいていく */
.veil-in {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--phosphor);
  pointer-events: none;
  animation: veil-out 0.9s ease-out forwards;
}
@keyframes veil-out {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

/* WebGL やカメラが使えないとき */
.page-fallback {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  line-height: 1.7;
}

@media (prefers-reduced-motion: reduce) {
  .veil-in { animation-duration: 0.01s; }
}
