/* ===== 轮回魏晋 · 样式 ===== */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  background: var(--bg);
  color: var(--fg);
  transition: background .6s ease, color .6s ease;
}

body.theme-human { --bg: #f5f0e6; --fg: #2b2b2b; --ink: #2b2b2b; --line: #cfc4ae; --card: #ffffff; --card-dim: #ebe4d6; }
body.theme-court { --bg: #0a0a0a; --fg: #8b1a1a; --ink: #8b1a1a; --line: #3a1414; --card: #151515; --card-dim: #1a1a1a; }
body.theme-term  { --bg: #1a2a2a; --fg: #c8c8c8; --ink: #c8c8c8; --line: #33484a; --card: #1f3333; --card-dim: #243a3a; }

.hidden { display: none !important; }

/* ===== 顶部时间栏 ===== */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  letter-spacing: .08em;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
  transition: background .6s ease, color .6s ease;
}

#timeinfo { opacity: .9; }

#controls { display: flex; gap: 8px; flex-wrap: wrap; }

.ctrl {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 12px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--ink);
  cursor: pointer;
  letter-spacing: .06em;
  transition: background .2s ease, color .2s ease;
}

.ctrl:hover, .ctrl.active {
  background: var(--ink);
  color: var(--bg);
}

.ctrl-restart { opacity: .75; }

/* ===== 时间线容器 ===== */
#timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 140px;
  gap: 0;
  transition: opacity .6s ease;
}

#timeline.fading { opacity: 0; }

/* ===== 通用节点 ===== */
.tl-node {
  width: 100%;
  max-width: 720px;
  margin: 0 0 24px;
  animation: nodeIn .4s ease;
}

@keyframes nodeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ===== chapter 节点 ===== */
.tl-chapter {
  text-align: center;
  font-size: 17px;
  letter-spacing: .3em;
  opacity: .55;
  margin: 36px 0 28px;
}

/* ===== event / anchor 节点 ===== */
.tl-event, .tl-anchor {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 22px 26px;
  border-radius: 2px;
}

.tl-anchor {
  background: var(--card-dim);
  border-left: 4px solid var(--ink);
}

.tl-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .16em;
  margin: 0 0 18px;
}

.tl-anchor .tl-title::before { content: "◆ "; }

.tl-scene {
  font-size: 16px;
  line-height: 2.1;
  margin: 0 0 24px;
  text-align: justify;
  opacity: .92;
}

/* 已读状态 */
.tl-event.tl-read, .tl-anchor.tl-read { opacity: .82; }

.tl-result {
  font-size: 15px;
  line-height: 2;
  padding: 16px 18px;
  border-left: 2px solid var(--ink);
  background: rgba(0,0,0,.02);
}

.tl-anchor .tl-result { background: rgba(0,0,0,.04); }

.tl-result p { margin: 0 0 8px; }
.tl-result p:last-child { margin-bottom: 0; }

.tl-choice-mark { font-weight: 600; }

/* ===== 选项按钮 ===== */
.tl-choices { display: flex; flex-direction: column; gap: 10px; }

.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.8;
  padding: 12px 18px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--ink);
  cursor: pointer;
  letter-spacing: .04em;
  transition: background .2s ease, color .2s ease;
}

.choice-btn:hover { background: var(--ink); color: var(--bg); }

/* ===== narrative 节点 ===== */
.tl-narrative {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 22px 26px;
  border-radius: 2px;
}

.tl-narrative .tl-title { opacity: .8; font-size: 18px; }

.tl-paragraph {
  font-size: 16px;
  line-height: 2.2;
  margin: 0 0 16px;
  text-align: justify;
}

.tl-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.main-btn {
  font-family: inherit;
  font-size: 16px;
  padding: 10px 30px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--ink);
  cursor: pointer;
  letter-spacing: .16em;
  transition: background .2s ease, color .2s ease;
  align-self: flex-start;
}

.main-btn:hover { background: var(--ink); color: var(--bg); }

/* ===== divider 节点 ===== */
.tl-divider {
  width: 100%;
  max-width: 720px;
  margin: 40px 0;
}

.tl-divider hr {
  border: none;
  border-top: 3px double var(--line);
  margin: 0;
}

/* ===== judgment 节点 ===== */
.tl-judgment {
  width: 100%;
  max-width: 760px;
  background: #0a0a0a;
  color: #8b1a1a;
  border: 1px solid #3a1414;
  padding: 30px 32px;
  border-radius: 2px;
}

.court-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: .5em;
  margin: 0 0 30px;
  text-align: center;
  color: #8b1a1a;
}

.tl-verdict-lines { min-height: 60px; }

.verdict-line {
  font-size: 17px;
  line-height: 2.3;
  margin: 0 0 12px;
  letter-spacing: .08em;
  color: #8b1a1a;
  animation: fadeIn .35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ===== hell 节点 ===== */
.tl-hell {
  width: 100%;
  max-width: 720px;
  background: #1a2a2a;
  color: #c8c8c8;
  border: 1px solid #33484a;
  padding: 24px 28px;
  border-radius: 2px;
}

.tl-hell .tl-title { color: #c8c8c8; opacity: .8; }

.tl-question {
  font-size: 17px;
  line-height: 2.1;
  margin: 0 0 24px;
  color: #c8c8c8;
}

.tl-hell .choice-btn {
  color: #c8c8c8;
  border-color: #c8c8c8;
}

.tl-hell .choice-btn:hover { background: #c8c8c8; color: #1a2a2a; }

.tl-hell-reply {
  font-size: 16px;
  line-height: 2.1;
  padding: 16px 18px;
  border-left: 2px solid #c8c8c8;
  color: #c8c8c8;
  opacity: .9;
}

/* ===== rebirth 节点 ===== */
.tl-rebirth {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 30px 32px;
  border-radius: 2px;
}

.rebirth-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: .4em;
  margin: 0 0 22px;
  text-align: center;
}

.tl-rebirth p {
  font-size: 16px;
  line-height: 2;
  margin: 0 0 10px;
}

.rebirth-memory { margin: 18px 0 24px; }

.rebirth-memory p {
  font-size: 14px;
  line-height: 2;
  opacity: .7;
  border-left: 1px solid var(--line);
  padding-left: 14px;
  margin: 0 0 10px;
}

.naming-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 18px 0 14px;
  flex-wrap: wrap;
}

.naming-input-row input {
  flex: 1;
  min-width: 160px;
  max-width: 320px;
  font-family: inherit;
  font-size: 17px;
  padding: 9px 12px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--ink);
  outline: none;
  letter-spacing: .12em;
}

.naming-input-row input:focus { border-color: var(--fg); }

.candidates {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.candidate {
  font-family: inherit;
  font-size: 15px;
  padding: 6px 14px;
  background: transparent;
  color: var(--fg);
  border: 1px dashed var(--ink);
  cursor: pointer;
  letter-spacing: .1em;
}

.candidate:hover { background: var(--ink); color: var(--bg); }

.naming-hint {
  font-size: 13px;
  opacity: .7;
  margin-top: 10px;
  min-height: 18px;
}

/* ===== 底部状态栏 ===== */
#statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 22px;
  font-size: 13px;
  letter-spacing: .06em;
  background: var(--bg);
  color: var(--fg);
  border-top: 1px solid var(--line);
  transition: background .6s ease, color .6s ease;
  z-index: 20;
}

@media (max-width: 560px) {
  #topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  #timeline { padding: 24px 14px 140px; }
  .tl-event, .tl-anchor, .tl-narrative, .tl-judgment, .tl-hell, .tl-rebirth { padding: 18px 16px; }
  .tl-title { font-size: 18px; }
  .tl-scene, .tl-paragraph, .verdict-line { font-size: 15px; }
}
