/* ui.css —— 框架、标题页、档案类页面、模态 */

/* 顶部栏(游戏内常驻) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  background: rgba(14, 12, 9, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(2px);
}
.back-btn { flex-shrink: 0; }
.topbar-title {
  flex: 1;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.95rem;
  letter-spacing: 0.25em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 底部档案导航 */
.hud-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
  background: rgba(14, 12, 9, 0.96);
  border-top: 1px solid var(--line);
}
.hud-nav button {
  min-height: 44px;
  min-width: 52px;
  font-size: 0.88rem;
  padding: 0.4rem 0.55rem;
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
}
.hud-nav button:hover { border-color: var(--line); }
.hud-nav button .badge {
  display: inline-block;
  min-width: 1.2em;
  margin-left: 0.25em;
  color: var(--accent);
  font-size: 0.78em;
}

/* 标题页 */
.title-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem 6rem;
}
.title-village {
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  margin: 0;
  color: #d9d0bb;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.8);
}
.title-menu { display: flex; flex-direction: column; gap: 0.8rem; width: min(16rem, 80vw); }
.title-menu button { width: 100%; font-size: 1.05rem; letter-spacing: 0.3em; text-indent: 0.3em; }
.title-footnote {
  margin-top: 3.5rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
}

/* 档案类通用页面 */
.archive-page {
  flex: 1;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.4rem 1.25rem 6.5rem;
}
.archive-page h2 {
  font-size: 1.25rem;
  letter-spacing: 0.3em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.7rem;
  margin: 0 0 1.3rem;
}
.archive-empty { color: var(--ink-faint); text-align: center; padding: 3rem 0; letter-spacing: 0.15em; }

.card-list { display: flex; flex-direction: column; gap: 0.6rem; }
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  padding: 0.85rem 1rem;
  text-align: left;
  width: 100%;
}
.card .card-title { letter-spacing: 0.12em; }
.card .card-sub { color: var(--ink-faint); font-size: 0.84rem; margin-top: 0.25rem; }
.card.unread { border-left: 3px solid var(--accent-dim); }

/* 人物 */
.char-card .char-role { color: var(--accent-dim); font-size: 0.82rem; letter-spacing: 0.2em; }
.char-detail { margin-top: 0.5rem; color: var(--ink-dim); font-size: 0.92rem; line-height: 1.8; }

/* 未解之谜(推理页) */
.question-item {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-faint);
  background: var(--paper-raised);
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
}
.question-item.answered { border-left-color: var(--safe); opacity: 0.85; }
.question-item .q-status {
  float: right;
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.2em;
}
.question-item.answered .q-status { color: var(--safe); }
.question-text { letter-spacing: 0.06em; }
.question-notes { margin: 0.5rem 0 0; padding-left: 1.1em; color: var(--ink-dim); font-size: 0.9rem; }
.question-notes li { margin-bottom: 0.25rem; }

/* 详情折叠区 */
.detail-block { border-top: 1px dashed var(--line); margin-top: 0.6rem; padding-top: 0.6rem; color: var(--ink-dim); font-size: 0.92rem; line-height: 1.85; white-space: pre-line; }

/* 存档页 */
.save-slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.save-info { flex: 1; min-width: 12rem; }
.save-info .save-name { letter-spacing: 0.15em; }
.save-info .save-meta { color: var(--ink-faint); font-size: 0.82rem; margin-top: 0.2rem; }
.save-actions { display: flex; gap: 0.5rem; }

/* 设置页 */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0.2rem;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.setting-row label { letter-spacing: 0.1em; }
.setting-row .setting-desc { width: 100%; color: var(--ink-faint); font-size: 0.82rem; margin: 0; }
.segmented { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.segmented button.active { border-color: var(--accent); color: #e6ddc8; background: rgba(154, 91, 60, 0.12); }
input[type="range"] { accent-color: var(--accent); min-height: 44px; }

/* 模态 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 4, 3, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.modal-box {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  max-width: 34rem;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.4rem 1.5rem;
}
.modal-box h3 { margin-top: 0; letter-spacing: 0.2em; }
.modal-body { color: var(--ink-dim); line-height: 1.9; white-space: pre-line; }
.modal-actions { display: flex; gap: 0.7rem; margin-top: 1.4rem; justify-content: flex-end; flex-wrap: wrap; }

/* 错误页 */
.error-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  gap: 1.2rem;
}
