/* ============================================================
 * 第二部「鏡の間」：石碑・禍ツ神紋・鏡の間・真エンド・記録者エンドの共通スタイル
 * 動きのある演出（ひび・揺れ・文字の乱れ）は prefers-reduced-motion で無効にする。
 * ============================================================ */

/* ---- 禍ツ神文字の円環を画像に重ねる ---- */
.ring-figure {
  position: relative;
  max-width: 560px;
  margin: 20px auto;
  background: #050403;
  border: 1px solid #3a2a18;
  line-height: 0;
}
.ring-figure > img { display: block; width: 100%; height: auto; }
.ring-figure .ring-overlay {
  position: absolute;
  inset: 4% 4% 4% 4%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f0b8a8;
  pointer-events: none;
}
.ring-figure .ring-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(4, 2, 2, 0.74) 0%, rgba(4, 2, 2, 0.6) 62%, rgba(4, 2, 2, 0) 76%);
}
.ring-figure .ring-overlay > [data-magatsu-ring-enc] {
  position: relative;
  width: 100%;
  line-height: 0;
  filter: drop-shadow(0 0 4px rgba(255, 90, 70, 0.55));
}
.ring-caption {
  font-size: 11px;
  color: #8a7350;
  line-height: 1.8;
  text-align: center;
  margin: -8px auto 18px;
  max-width: 560px;
}

/* ---- 石碑ページ ---- */
body[data-page="stone"] { background: #0b0907; }
body[data-page="stone"] #site-main { background: #0b0907; }
.stone-record { color: #c9b896; font-size: 13px; line-height: 2; }
.stone-record h2.section-title { color: #d9b866; border-bottom-color: #5a3a10; }
.stone-meta {
  display: grid;
  grid-template-columns: 110px 1fr;
  border-top: 2px solid #5a431f;
  margin: 16px 0 22px;
  font-size: 13px;
}
.stone-meta dt, .stone-meta dd { margin: 0; padding: 8px 10px; border-bottom: 1px solid #3a2c18; }
.stone-meta dt { background: #1a130a; color: #b8995a; }
.stone-meta dd { background: #120d07; color: #c9b896; }
.stone-figure { margin: 18px 0; background: #050403; border: 1px solid #3a2a18; }
.stone-figure img { display: block; width: 100%; height: auto; }
.stone-figure figcaption { font-size: 11px; color: #8a7350; padding: 8px 12px; line-height: 1.8; }
.stone-memo {
  margin: 18px 0 18px auto;
  max-width: 520px;
  padding: 12px 16px;
  border-left: 3px solid #7a2a22;
  background: #170c09;
  color: #d8a79b;
  font-size: 13px;
  line-height: 2;
}
.stone-memo small { display: block; color: #8b5a52; font-size: 11px; margin-top: 6px; }
.stone-form { margin: 22px 0; padding: 16px 18px; background: #120d07; border: 1px solid #4a3820; }
.stone-form label { display: block; font-size: 12px; color: #b8995a; letter-spacing: 0.15em; margin-bottom: 8px; }
.stone-form .row { display: flex; gap: 8px; }
.stone-form input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: #0a0704;
  border: 1px solid #5a431f;
  color: #ead9b4;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0.2em;
}
.stone-form button {
  padding: 10px 20px;
  background: #2a1a0a;
  border: 1px solid #8b6914;
  color: #e0c070;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.stone-form button:hover { background: #3a240e; }
.stone-form input:focus-visible, .stone-form button:focus-visible { outline: 2px solid #e0c070; outline-offset: 2px; }
.stone-result { min-height: 26px; margin-top: 12px; font-size: 13px; color: #a08a60; }
.stone-result.is-wrong { color: #8a7a64; font-style: italic; }
.stone-decoded {
  margin: 22px 0;
  padding: 18px 20px;
  background: #170c09;
  border: 1px solid #7a2a22;
  color: #e3b7ab;
  font-size: 14px;
  line-height: 2.1;
}
.stone-decoded[hidden] { display: none; }
.stone-decoded .reading { font-size: 18px; letter-spacing: 0.25em; color: #f0c8bc; display: block; margin: 6px 0; }
.stone-decoded .yamaguchi { color: #ff9f8c; display: block; margin-top: 10px; font-size: 15px; }
.stone-related { font-size: 13px; line-height: 2; padding-left: 20px; color: #a08a60; }
.stone-related a { color: #d9b866; }
.stone-related a:hover { color: #f0d48d; }
.stone-footer { font-size: 11px; color: #6a5a40; margin-top: 26px; border-top: 1px solid #2a2016; padding-top: 10px; }

/* ---- 鏡の間（kagami/index） ---- */
.kagami-stage {
  position: relative;
  max-width: 880px;
  margin: 20px auto;
  background: #000;
  border: 1px solid #1a1a2a;
  overflow: hidden;
  line-height: 0;
}
.kagami-stage > img.kagami-room { display: block; width: 100%; height: auto; }
.kagami-eye {
  position: absolute;
  left: 50%;
  top: 45.2%;
  width: 21.6%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}
.kagami-eye img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.16;
  filter: saturate(0.5) brightness(0.8) blur(1.5px);
  mix-blend-mode: screen;
  transition: opacity 2.4s ease, filter 2.4s ease;
}
.kagami-stage.is-open .kagami-eye img {
  opacity: 1;
  filter: saturate(1.1) brightness(1) blur(0);
  mix-blend-mode: normal;
}
.kagami-stage.is-open .kagami-eye { box-shadow: 0 0 40px rgba(130, 50, 160, 0.55); }
.kagami-crack {
  position: absolute;
  left: 50%;
  top: 45.2%;
  width: 25.6%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(190, 210, 255, 0.9));
  clip-path: circle(0% at 50% 50%);
}
.kagami-crack img { width: 100%; height: 100%; display: block; }
.kagami-stage.is-cracking .kagami-crack {
  animation: kagami-crack-run 2.6s ease-out forwards;
}
.kagami-stage.is-cracking { animation: kagami-shake 2.6s linear forwards; }
.kagami-stage.is-cracking::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: kagami-flash 2.6s ease-in forwards;
  pointer-events: none;
}
@keyframes kagami-crack-run {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); clip-path: circle(0% at 50% 50%); }
  12%  { opacity: 1; }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(1.02); clip-path: circle(72% at 50% 50%); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); clip-path: circle(75% at 50% 50%); }
}
@keyframes kagami-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2px, 1px); }
  20% { transform: translate(3px, -1px); }
  30% { transform: translate(-3px, 2px); }
  40% { transform: translate(2px, 2px); }
  55% { transform: translate(-2px, -2px); }
  70% { transform: translate(1px, 1px); }
  85% { transform: translate(0, 0); }
}
@keyframes kagami-flash {
  0%, 70% { opacity: 0; }
  92% { opacity: 0.85; }
  100% { opacity: 1; }
}
.kagami-panel {
  max-width: 880px;
  margin: -21px auto 20px;
  padding: 18px 20px 22px;
  background: #000;
  border: 1px solid #1a1a2a;
  border-top: 0;
}
.kagami-hints {
  margin: 14px auto 0;
  max-width: 640px;
  padding: 0;
  list-style: none;
  text-align: center;
  color: #5a5a8a;
  font-size: 13px;
  line-height: 2.3;
  letter-spacing: 0.12em;
}
.kagami-hints li { opacity: 0.9; }
.kagami-utter {
  max-width: 440px;
  margin: 22px auto 6px;
  text-align: center;
}
.kagami-utter[hidden] { display: none; }
.kagami-utter label { display: block; font-size: 12px; color: #6a6aa0; letter-spacing: 0.3em; margin-bottom: 10px; }
.kagami-utter .row { display: flex; gap: 6px; }
.kagami-utter input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: #05050f;
  border: 1px solid #3a3a6a;
  color: #b8b8e0;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0.2em;
  text-align: center;
}
.kagami-utter button {
  padding: 10px 18px;
  background: #0a0a1a;
  border: 1px solid #3a3a6a;
  color: #8a8ac0;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.kagami-utter input:focus-visible, .kagami-utter button:focus-visible { outline: 2px solid #9a9aff; outline-offset: 2px; }
.kagami-utter-result { min-height: 26px; margin-top: 12px; font-size: 13px; color: #6a6a9a; font-style: italic; text-align: center; }

/* ---- 真エンド（kagami/broken） ---- */
body[data-page="kagami-broken"] { background: #020206; color: #8a8aaa; }
body[data-page="kagami-broken"] #site-main { background: #020206; }
.broken-wrap { max-width: 720px; margin: 0 auto; padding: 10px 0 40px; }
.broken-figure { margin: 0 0 30px; background: #000; border: 1px solid #14141f; line-height: 0; }
.broken-figure img { display: block; width: 100%; height: auto; }
.broken-text { font-size: 15px; line-height: 3; color: #8a8aaa; text-align: center; }
.broken-text p { margin-bottom: 26px; }
.broken-text .bright { color: #c4c4ff; }
.broken-choice {
  margin: 34px auto;
  padding: 18px 22px;
  max-width: 560px;
  border-top: 1px solid #1a1a2a;
  border-bottom: 1px solid #1a1a2a;
  color: #9a9ac0;
  font-size: 14px;
  line-height: 2.4;
}
.broken-voice { margin-top: 44px; font-size: 18px; color: #e8e8ff; letter-spacing: 0.15em; line-height: 2.4; }
.broken-credits { margin-top: 56px; text-align: center; font-size: 11px; color: #3a3a5a; line-height: 2.4; font-family: monospace; }
.broken-credits a { color: #4a4a6a; text-decoration: none; }
.broken-credits a:hover { color: #8a8aaa; }
.broken-fade { opacity: 0; animation: broken-fade 2.4s ease forwards; }
.broken-fade.d2 { animation-delay: 1.2s; }
.broken-fade.d3 { animation-delay: 2.6s; }
.broken-fade.d4 { animation-delay: 4.2s; }
@keyframes broken-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- 禍ツ神紋（S-009） ---- */
.crest-meta-note { font-size: 12px; line-height: 1.9; color: #c9b080; }

/* ---- 開扉エンド：文字の乱れ（truth/gate） ---- */
.gate-glitch { display: inline-block; animation: gate-glitch 0.18s steps(2) infinite; text-shadow: 2px 0 rgba(255, 0, 60, 0.6), -2px 0 rgba(0, 200, 255, 0.5); }
@keyframes gate-glitch {
  0% { transform: translate(0, 0) skewX(0deg); }
  25% { transform: translate(-2px, 1px) skewX(4deg); }
  50% { transform: translate(2px, -1px) skewX(-3deg); }
  75% { transform: translate(-1px, -1px) skewX(2deg); }
  100% { transform: translate(1px, 1px) skewX(0deg); }
}

/* ---- 動きを減らす設定：ひび・揺れ・乱れの演出を止める ---- */
@media (prefers-reduced-motion: reduce) {
  .kagami-stage.is-cracking,
  .kagami-stage.is-cracking::after,
  .gate-glitch,
  .broken-fade { animation: none !important; }
  .kagami-stage.is-cracking .kagami-crack {
    animation: none !important;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    clip-path: circle(75% at 50% 50%);
  }
  .kagami-eye img { transition: none; }
  .broken-fade { opacity: 1; transform: none; }
}

@media (max-width: 600px) {
  .stone-meta { grid-template-columns: 84px 1fr; }
  .stone-form .row { flex-direction: column; }
  .broken-text { font-size: 14px; }
}

/* ---- 真エンド：この画面を画像として残すボタン（assets/js/kagami-card.js） ---- */
.kc-wrap { margin-top: 44px; text-align: center; }
.kc-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.kc-btn { box-sizing: border-box; min-height: 44px; max-width: 100%; padding: 8px 18px; font-family: inherit; font-size: 13px; line-height: 1.5; letter-spacing: 0.1em; color: #8a8aaa; background: #05050f; border: 1px solid #2a2a4a; cursor: pointer; }
.kc-btn:hover { color: #c4c4ff; border-color: #4a4a7a; }
.kc-btn:focus-visible { outline: 2px solid #6a6aa0; outline-offset: 2px; }
.kc-btn[hidden] { display: none; }
.kc-btn:disabled { opacity: 0.6; cursor: default; }
.kc-status { min-height: 1.9em; margin: 12px 0 0; font-size: 12px; line-height: 1.9; color: #6a6a8a; }
.kc-status.is-bad { color: #a07a8a; }
