/* ============================================================
   base.css —— 设计 token、reset、通用组件
   视觉基调:暖色纸感,唯一强调色 --accent(赭石)。
   ============================================================ */

:root {
  --paper:  #F6F1E7;   /* 页面底,旧纸色 */
  --card:   #FFFDF8;   /* 卡片 */
  --ink:    #2B2620;   /* 主文字,墨色偏暖 */
  --ink-2:  #6E6557;   /* 次级文字 */
  --faint:  #A99F8D;   /* 提示/禁用 */
  --line:   #E4DAC7;   /* 分隔线/描边 */
  --accent: #A65A36;   /* 赭石:进度条、主按钮、选中态 */
  --accent-soft: #F3E3D3;
  --ok:     #6D7F5E;   /* 完成态,灰橄榄 */
  --danger: #A0402F;
  --radius: 12px;
  --serif: 'Songti SC', 'Noto Serif SC', 'STSong', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --shadow: 0 1px 3px rgba(43, 38, 32, .06), 0 4px 14px rgba(43, 38, 32, .05);
  --maxw: 640px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }

h1, h2, h3 { font-weight: 600; }

.view { min-height: 100vh; }
.view[hidden] { display: none !important; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1.4;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
  user-select: none;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #FFFDF8;
}
.btn-primary:not(:disabled):active { background: #8C472B; }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:not(:disabled):active { background: rgba(166, 90, 54, .08); }

.btn-lg {
  padding: 14px 40px;
  font-size: 17px;
}

.btn-danger-text { color: var(--danger); }

.link { font-size: 14px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---- 横幅 / 提示 ---- */
.banner {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #F0E0C8;
  color: var(--ink);
  padding: 10px 16px;
  font-size: 14px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.banner button { text-decoration: underline; margin-left: 8px; }

/* ---- 落地页 ---- */
.home-wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18vh 28px 40px;
  text-align: center;
}
.home-kicker {
  font-size: 14px;
  letter-spacing: .35em;
  color: var(--ink-2);
  margin-bottom: 20px;
}
.home-title {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: .15em;
  text-indent: .15em;
  margin-bottom: 18px;
}
.home-sub {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink-2);
  line-height: 2;
  margin-bottom: 42px;
}
.home-progress {
  margin-top: 14px;
  font-size: 14px;
  color: var(--ink-2);
}
.home-links {
  margin-top: 44px;
}

/* ---- 设置页 ---- */
.settings-wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px;
}
.settings-title {
  font-family: var(--serif);
  font-size: 30px;
  margin-bottom: 24px;
}
.settings-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.settings-card h3 { font-size: 17px; margin-bottom: 10px; }
.settings-card p { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.settings-hint { font-size: 13px !important; color: var(--faint) !important; margin-top: 8px !important; }

/* ---- 模态框 ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(43, 38, 32, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.modal-title { font-size: 18px; margin-bottom: 8px; }
.modal-hint { font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.modal-text {
  width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.5;
  resize: none;
  background: #FBF8F1;
  color: var(--ink);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 110;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
.toast[hidden] { display: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- Debug 面板 ---- */
.debug-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 120;
  background: var(--ink);
  color: var(--paper);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.debug-panel button {
  color: var(--paper);
  background: rgba(255, 255, 255, .12);
  padding: 6px 10px;
  border-radius: 6px;
  text-align: left;
}
.debug-panel[hidden] { display: none; }
