/* 老化する鏡 / APOPTOSIS — 「未定着 (UNFIXED)」
   パレット (仕様§1・厳守):
   基底黒 #060606 / 最深黒 #000000 / 銀塩ハイライト #EDEAE3 / 中間銀 #8F8C85
   粒子銀 #C6C3BB / 三次銀 #6E6B65 / セーフライト赤 #BF3100 (登録印+レバーティックのみ)
   モーション憲法: linear と指数減衰のみ。ease-in-out 禁止 (仕様§9) */

:root {
  --black: #060606;
  --paper: #EDEAE3;
  --silver-mid: #8F8C85;
  --silver-3: #6E6B65;
  --safelight: #BF3100;
}

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

[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--black);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: "IBM Plex Mono", monospace;
  color: var(--paper);
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#cam { display: none; }

/* ── アンビエント微粒子 ───────────────────────── */
#ambient {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 5;
  pointer-events: none;
  transition: opacity 1.2s linear;
}
#ambient.gone { opacity: 0; }

/* ── エントリー ──────────────────────────────── */
.entry {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(1100px 700px at 50% 42%, #0c0c0b, transparent 70%);
}

/* 静かな入場: フェード + わずかな浮上 (段差ディレイ) */
.entry > * {
  opacity: 0;
  transform: translateY(12px);
  animation: entry-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.entry > *:nth-child(1) { animation-delay: 0.10s; }
.entry > *:nth-child(2) { animation-delay: 0.22s; }
.entry > *:nth-child(3) { animation-delay: 0.38s; }
.entry > *:nth-child(4) { animation-delay: 0.58s; }
.entry > *:nth-child(5) { animation-delay: 0.74s; }
.entry > *:nth-child(6) { animation-delay: 0.86s; }
@keyframes entry-in {
  to { opacity: 1; transform: none; }
}
/* 入場完了後はアニメーションを外し、以後のトランジションに道を譲る */
.entry.settled > * { animation: none; opacity: 1; transform: none; }

.entry .fade-out { transition: opacity 0.8s linear; }
.entry.dissolve .fade-out { opacity: 0; }
.entry.dissolve .begin {
  color: transparent;
  transition: color 0.8s linear, transform 0.25s linear,
    background-color 0.8s linear, box-shadow 0.8s linear;
  background: transparent;
  box-shadow: none;
}

.entry-kicker {
  font-size: 10px;
  letter-spacing: 0.42em;
  color: var(--silver-3);
  margin-bottom: 26px;
}

.entry-title {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 300;
  font-size: clamp(30px, 4.6vw, 46px);
  letter-spacing: 0.3em;
  text-indent: 0.3em; /* 字間ぶんの光学センター補正 */
  color: var(--paper);
}

.entry-sub {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--silver-mid);
  margin-top: 20px;
}

/* はじめる — 静かなピル。ホバーで紙白に満ちる */
.begin {
  margin-top: 60px;
  padding: 15px 72px;
  border-radius: 999px;
  border: 1px solid rgba(237, 234, 227, 0.26);
  background: transparent;
  color: var(--paper);
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 300;
  font-size: 13.5px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  cursor: pointer;
  transition: background-color 0.18s linear, color 0.18s linear,
    border-color 0.18s linear, box-shadow 0.18s linear;
  transform-origin: 50% 50%;
}
.begin:hover, .begin:focus-visible {
  background: var(--paper);
  color: var(--black);
  border-color: var(--paper);
  box-shadow: 0 0 32px rgba(237, 234, 227, 0.10);
  outline: none;
}
.begin:disabled { cursor: default; opacity: 0.7; }
.begin.collapse { transform: scaleX(0.003); }

.entry-steps {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--silver-3);
  margin-top: 66px;
  display: flex;
  align-items: center;
}
.entry-steps .sep {
  display: inline-block;
  width: 26px;
  height: 1px;
  background: rgba(237, 234, 227, 0.16);
  margin: 0 18px;
}

.entry-note {
  font-family: "IBM Plex Sans JP", sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--silver-3);
  opacity: 0.75;
  margin-top: 16px;
}

.plate-error {
  margin-top: 18px;
  font-family: "IBM Plex Sans JP", sans-serif;
  font-size: 11px;
  line-height: 1.8;
  color: var(--paper);
  opacity: 0.9;
}

/* ── シグネチャームーブの光線 ─────────────────── */
#morphline {
  position: fixed;
  width: 1px;
  background: var(--paper);
  opacity: 0;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 0 4px rgba(237, 234, 227, 0.06);
}

/* ── 時間レバー (完全に消えた世界に現れる) ─────── */
.lever {
  position: fixed;
  right: 42px; /* レール中心 = 右端から64px */
  top: 50%;
  transform: translateY(-50%);
  height: 56vh;
  z-index: 15;
  opacity: 0;
  transition: opacity 1.6s linear;
}
.lever.on { opacity: 1; }

.lever-zone {
  position: relative;
  width: 44px; /* 不可視のグラブゾーン */
  height: 100%;
  cursor: ns-resize;
  touch-action: none;
  outline: none;
}
.lever-zone:focus-visible::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px dotted rgba(237, 234, 227, 0.18);
}

.lever-rail {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 12px;
  height: 100%;
  pointer-events: none;
}

.lever-handle {
  position: absolute;
  left: 50%;
  top: -1px;
  pointer-events: none;
  will-change: transform;
}

.lever-handle-bar {
  width: 20px;
  height: 2px;
  background: var(--paper);
  opacity: 0.9;
  box-shadow: 0 0 8px rgba(237, 234, 227, 0.12);
  transition: opacity 0.12s linear;
}

/* 現在位置ティック — 作品中唯一の色②。色として知覚できる最小の滲みを許す */
.lever-red-tick {
  width: 20px;
  height: 1px;
  background: var(--safelight);
  opacity: 0.85;
  margin-top: 3px;
  box-shadow: 0 0 5px rgba(191, 49, 0, 0.45);
  transition: opacity 0.12s linear;
}

/* デクラッチ: 減光・赤消灯・入力拒否 (仕様§5) */
.lever.declutched .lever-handle-bar { opacity: 0.3; }
.lever.declutched .lever-red-tick { opacity: 0; }
.lever.declutched .lever-zone { cursor: default; }

/* ── ガイガー・トグル ─────────────────────────── */
.sound-toggle {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: var(--silver-3);
  opacity: 0.12;
  cursor: pointer;
  transition: opacity 0.12s linear;
  z-index: 15;
}
.sound-toggle:hover, .sound-toggle:focus-visible { opacity: 0.4; outline: none; }
.sound-toggle .wave { opacity: 0; transition: opacity 0.12s linear; }
.sound-toggle.on .wave { opacity: 1; }
.sound-toggle.on { opacity: 0.25; }
