* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: #030406; overflow: hidden; }
body {
  font-family: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "MS PMincho", serif;
  color: #c7ced6;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1280px; height: 720px;
  transform-origin: 50% 50%;
  overflow: hidden;
  background: #07090c;
  cursor: default;
}
#bg { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; }
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 45%, rgba(0,0,0,.55) 85%, rgba(0,0,0,.85) 100%);
}
#fade {
  position: absolute; inset: 0; background: #000; pointer-events: none;
  opacity: 1; transition: opacity 2.4s ease;
}

/* ---------- 共通テキスト ---------- */
#center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
  text-align: center;
}
#center .line {
  font-size: 34px; letter-spacing: .32em; color: #d3d9e0;
  text-shadow: 0 0 6px rgba(0,0,0,.9), 0 0 18px rgba(0,0,0,.8), 0 0 30px rgba(160,180,210,.2);
  opacity: 0; transition: opacity 2s ease;
  padding-left: .32em; line-height: 1.8;
}
#center .line.show { opacity: 1; }
#center .line.small { font-size: 16px; letter-spacing: .4em; color: #8793a0; }
#center .line.huge { font-size: 46px; }
#center .line.event { font-size: 38px; letter-spacing: .18em; }
#center .line.sys {
  font-family: "Yu Gothic", "YuGothic", "Hiragino Sans", "Meiryo", sans-serif;
  letter-spacing: .12em; font-size: 30px; color: #e6e8ea; text-shadow: none;
}

/* ---------- ダイアログ ---------- */
#dialog {
  position: absolute; left: 0; right: 0; bottom: 0; height: 190px;
  padding: 34px 230px 0;
  background: linear-gradient(to bottom, rgba(3,5,8,0) 0%, rgba(3,5,8,.78) 38%, rgba(3,5,8,.92) 100%);
  cursor: pointer;
}
#speaker {
  font-size: 14px; letter-spacing: .35em; color: #7f8a96; height: 22px; margin-bottom: 8px;
}
#text {
  font-size: 22px; line-height: 1.9; letter-spacing: .1em; color: #d4dae1;
  min-height: 84px; white-space: pre-wrap;
}
#dialog.narr #text { color: #9aa5b1; font-size: 19px; }
#dialog.friend #speaker { color: #93a08c; }
#dialog.friend #text { color: #cdd5c6; }
#dialog.system #speaker { color: #9da3a8; }
#dialog.system #text, #dialog.news #text {
  font-family: "Yu Gothic", "YuGothic", "Hiragino Sans", "Meiryo", sans-serif;
  letter-spacing: .06em; color: #eceeef; font-size: 20px;
}
#dialog.news #speaker { color: #c46a62; }
#next {
  position: absolute; right: 240px; bottom: 36px; font-size: 12px; color: #6f7a86;
  opacity: 0; animation: blink 2.4s ease-in-out infinite;
}
#dialog.ready #next { opacity: 1; }
@keyframes blink { 0%,100% { opacity: .15; } 50% { opacity: .8; } }

/* ---------- HUD ---------- */
#hud {
  position: absolute; left: 34px; top: 26px; font-size: 12px; letter-spacing: .15em;
  color: #6c7783; line-height: 2; pointer-events: none;
  transition: opacity 2s;
}
#hud .k { display: inline-block; width: 100px; }
#hud .v { color: #a9b3bd; font-family: "Yu Gothic", "Meiryo", sans-serif; letter-spacing: .05em; }
#hud .v.flash { color: #e8ecf0; text-shadow: 0 0 10px rgba(200,220,240,.6); }

#mute {
  position: absolute; right: 22px; top: 18px; width: 34px; height: 34px;
  background: transparent; border: 1px solid rgba(150,165,180,.25); border-radius: 50%;
  color: #7b8692; font-size: 14px; cursor: pointer; z-index: 50;
}
#mute.off { text-decoration: line-through; opacity: .5; }

/* ---------- グラフ ---------- */
#graph { position: absolute; inset: 0; pointer-events: none; }
#lines { position: absolute; left: 0; top: 0; overflow: visible; }
#nodes { position: absolute; inset: 0; }
.node {
  position: absolute; width: 140px; transform: translate(-50%, -50%);
  padding: 9px 10px; font-size: 13px; line-height: 1.6; letter-spacing: .04em;
  color: #c4ccd5; background: rgba(8,11,16,.78);
  border: 1px solid rgba(160,178,196,.32);
  box-shadow: 0 0 22px rgba(0,0,0,.6);
  text-align: center; opacity: 0; transition: opacity 1.2s ease, filter 1.2s, color 1s, border-color 1s;
}
.node.show { opacity: 1; }
.node.event {
  width: 170px; font-size: 15px; color: #e2dccf; border-color: rgba(214,196,160,.45);
  letter-spacing: .08em;
}
.node.event::before {
  content: "事象"; display: block; font-size: 10px; letter-spacing: .4em; color: #8d8574; margin-bottom: 2px;
}
.node.me {
  width: 96px; font-size: 18px; letter-spacing: .3em; padding-left: 1.3em;
  color: #eef2f6; border-color: rgba(220,230,240,.7);
  box-shadow: 0 0 30px rgba(180,200,230,.25), 0 0 22px rgba(0,0,0,.6);
}
.node.escape { color: #7d8791; border-style: dashed; }
.node.dead { color: #545c64; border-color: rgba(90,96,104,.3); text-decoration: line-through; filter: blur(.4px); }
.node.pending { color: #dfe4ea; border-color: rgba(200,212,226,.6); }

/* ---------- 選択肢 ---------- */
#options {
  position: absolute; left: 0; right: 0; bottom: 34px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding: 0 60px;
}
.opt {
  position: relative; width: 250px; min-height: 86px; padding: 22px 16px 14px;
  background: rgba(6,9,13,.82); border: 1px solid rgba(150,166,182,.28);
  font-size: 15px; line-height: 1.7; letter-spacing: .05em; color: #c3cbd3;
  cursor: pointer; opacity: 0; transform: translateY(8px);
  transition: opacity 1s ease, transform 1s ease, border-color .6s, color .6s, background .6s;
}
.opt.show { opacity: 1; transform: translateY(0); }
.opt:hover { border-color: rgba(205,216,228,.7); color: #eef2f6; background: rgba(14,19,26,.9); }
.opt .tag {
  position: absolute; left: 12px; top: 6px; font-size: 10px; letter-spacing: .3em; color: #66717c;
}
.opt.final {
  width: 360px; text-align: center; font-size: 20px; letter-spacing: .3em;
  border-color: rgba(210,220,232,.5); color: #e5eaef;
}
#options.battle { gap: 10px; bottom: 26px; padding: 0 70px; }
#options.battle .opt { width: 218px; min-height: 64px; font-size: 13px; padding: 18px 12px 10px; }
#options.battle .opt.used { opacity: .25; pointer-events: none; text-decoration: line-through; }
#options.locked .opt { pointer-events: none; }

/* ---------- 判定書 ---------- */
#doc {
  position: absolute; left: 50%; top: 50%; width: 600px; transform: translate(-50%, -50%);
  background: #d6d3cb; color: #25272a; padding: 34px 44px 30px;
  font-family: "Yu Gothic", "YuGothic", "Hiragino Sans", "Meiryo", sans-serif;
  box-shadow: 0 30px 80px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .9s ease;
  cursor: pointer;
}
#doc.show { opacity: 1; }
#doc .h1 { font-size: 13px; letter-spacing: .5em; color: #55585c; }
#doc .no { position: absolute; right: 44px; top: 34px; font-size: 12px; color: #55585c; }
#doc .case { font-size: 20px; margin: 14px 0 16px; letter-spacing: .06em; border-bottom: 1px solid #9c9a94; padding-bottom: 12px; }
#doc table { width: 100%; border-collapse: collapse; font-size: 13px; }
#doc td { padding: 5px 0; vertical-align: top; border-bottom: 1px dotted #aaa7a0; }
#doc td.g { width: 150px; text-align: right; color: #3b3d40; white-space: nowrap; }
#doc td.p { width: 76px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#doc tr { opacity: 0; transition: opacity .5s; }
#doc tr.show { opacity: 1; }
#doc .sum { text-align: right; margin-top: 12px; font-size: 16px; letter-spacing: .08em; }
#doc .memo { margin-top: 12px; font-size: 12px; color: #45484c; line-height: 1.7; }
#doc .result { margin-top: 18px; font-size: 26px; letter-spacing: .5em; opacity: 0; transition: opacity .6s; }
#doc .result.show { opacity: 1; }
#doc .stamp {
  position: absolute; right: 40px; bottom: 12px; width: 100px; height: 100px;
  border: 4px solid rgba(150,36,30,.82); border-radius: 50%;
  color: rgba(150,36,30,.85); font-size: 22px; letter-spacing: .1em;
  display: flex; align-items: center; justify-content: center; flex-direction: column; line-height: 1.2;
  transform: rotate(-14deg) scale(1.8); opacity: 0;
  transition: transform .18s cubic-bezier(.3,1.6,.6,1), opacity .12s;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-weight: bold;
}
#doc .stamp small { font-size: 10px; letter-spacing: .1em; font-weight: normal; }
#doc .stamp.show { opacity: 1; transform: rotate(-14deg) scale(1); }
#doc .stamp.gray { border-color: rgba(60,60,60,.7); color: rgba(60,60,60,.8); }
#doc .click { position: absolute; left: 44px; bottom: 12px; font-size: 10px; color: #77797c; letter-spacing: .2em; }

/* ---------- 通知 ---------- */
#notice {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
  opacity: 0; transition: opacity 2s ease;
}
#notice.show { opacity: 1; }
#notice .a { font-size: 15px; letter-spacing: .35em; color: #8e99a5; margin-bottom: 20px; }
#notice .b { font-size: 26px; letter-spacing: .25em; color: #dbe1e7; margin-bottom: 12px; }
#notice .c { font-size: 13px; letter-spacing: .25em; color: #717c88; }
#notice hr { width: 60px; margin: 18px auto; border: none; border-top: 1px solid rgba(150,165,180,.35); }

/* ---------- 最終審査 ---------- */
#meter {
  position: absolute; left: 50%; top: 24px; transform: translateX(-50%);
  font-family: "Yu Gothic", "Meiryo", sans-serif; font-size: 12px; letter-spacing: .2em;
  color: #8a949e; text-align: center; pointer-events: none;
}
#meter b { display: block; font-size: 24px; letter-spacing: .05em; color: #d4d9de; font-weight: normal; font-variant-numeric: tabular-nums; }
#verdict {
  position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%);
  font-family: "Yu Gothic", "YuGothic", "Hiragino Sans", "Meiryo", sans-serif;
  font-size: 46px; letter-spacing: .2em; padding: 18px 50px 18px 60px;
  background: rgba(230,232,234,.94); color: #1b1d20;
  opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
#verdict.show { opacity: 1; }
#verdict.small { font-size: 26px; letter-spacing: .1em; }

/* ---------- ティッカー ---------- */
#ticker {
  position: absolute; left: 0; right: 0; top: 70px; height: 40px;
  background: rgba(96,14,12,.88); display: flex; align-items: center; overflow: hidden;
  font-family: "Yu Gothic", "Meiryo", sans-serif; color: #f3e9e6;
  border-top: 1px solid rgba(255,120,110,.3); border-bottom: 1px solid rgba(255,120,110,.3);
}
#ticker .label { flex: none; background: #d8d2c8; color: #6c1510; padding: 0 16px; height: 100%; display: flex; align-items: center; font-weight: bold; letter-spacing: .2em; z-index: 1; }
#ticker .track { flex: 1; overflow: hidden; white-space: nowrap; }
#ticker-text { display: inline-block; padding-left: 100%; font-size: 18px; letter-spacing: .1em; animation: tick 38s linear infinite; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---------- タイトル ---------- */
#title-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: opacity 2.5s ease; z-index: 20;
}
#title-main {
  font-size: 44px; letter-spacing: .45em; padding-left: .45em; color: #d5dbe2;
  text-shadow: 0 0 24px rgba(150,170,200,.3);
  margin-top: -250px;
  opacity: 0; animation: tin 4s ease 1s forwards;
}
#title-sub { margin-top: 26px; font-size: 14px; letter-spacing: .4em; color: #8894a0; min-height: 20px; opacity: 0; animation: tin 3s ease 3s forwards; }
#title-start { margin-top: 56px; font-size: 14px; letter-spacing: .5em; color: #7e8994; opacity: 0; animation: tin 3s ease 3.5s forwards, blink 3s ease-in-out 6.5s infinite; }
#title-note { position: absolute; bottom: 28px; font-size: 11px; letter-spacing: .2em; color: #525c66; }
@keyframes tin { to { opacity: 1; } }

/* ---------- ゲームオーバー ---------- */
#gameover {
  position: absolute; inset: 0; background: #000; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
#gameover .go {
  font-family: "Yu Gothic", "Meiryo", sans-serif; font-size: 40px; letter-spacing: .5em; padding-left: .5em;
  color: #d8dadc; opacity: 0; transition: opacity 3s;
}
#gameover .reason { margin-top: 26px; font-size: 18px; letter-spacing: .25em; color: #9aa2aa; opacity: 0; transition: opacity 3s; }
#gameover .stats {
  margin-top: 56px; font-family: "Yu Gothic", "Meiryo", sans-serif; font-size: 13px; line-height: 2.1;
  color: #6f7881; letter-spacing: .12em; opacity: 0; transition: opacity 3s;
}
#gameover .stats span { color: #aeb5bc; }
#gameover .back {
  margin-top: 44px; font-size: 13px; letter-spacing: .4em; color: #6b747c; cursor: pointer;
  border: 1px solid rgba(120,130,140,.3); padding: 10px 26px; opacity: 0; transition: opacity 3s, color .5s;
}
#gameover .back:hover { color: #d0d5da; }
#gameover .show { opacity: 1 !important; }
