:root {
  --bg: #0b0c0e;
  --panel: #131519;
  --panel-2: #191c22;
  --line: #262a32;
  --text: #e8eaed;
  --dim: #8b929e;
  --accent: #d8a24a;
  --danger: #c0574f;
  --ok: #5aa36b;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* ---------- 登录 ---------- */
#login {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg); padding: 24px;
}
#login h1 { font-size: 20px; margin: 0; letter-spacing: .12em; }
#login p { color: var(--dim); font-size: 13px; margin: 0 0 8px; text-align: center; }
#login input { width: min(320px, 100%); }
#login button { width: min(320px, 100%); }

/* ---------- 布局 ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11,12,14,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
header .t { font-size: 13px; letter-spacing: .16em; color: var(--dim); text-transform: uppercase; }
header .streak { font-size: 12px; color: var(--accent); white-space: nowrap; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.on { display: block; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card > h2 {
  font-size: 12px; letter-spacing: .16em; color: var(--dim);
  margin: 0 0 12px; text-transform: uppercase; font-weight: 600;
}
.card.stake { border-color: #46302e; }
.card.win { border-color: #3a4230; }

.hint { color: var(--dim); font-size: 12.5px; margin: -4px 0 12px; }
.big { font-size: 17px; line-height: 1.55; margin: 0; white-space: pre-wrap; }
.big.empty { color: #5b626d; font-size: 14px; }
.stake .big { color: #e0a099; }
.win .big { color: #a9cfa0; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12.5px; color: var(--dim); margin: 12px 0 6px; }
label:first-child { margin-top: 0; }

input[type="text"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font: inherit; font-size: 16px; /* 16px 防 iOS 缩放 */
  resize: vertical;
}
textarea { min-height: 92px; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 16px; font: inherit; cursor: pointer;
}
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #17130a; font-weight: 600; }
button.ghost { background: transparent; color: var(--dim); }
button.sm { padding: 7px 12px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }

/* ---------- 杠杆 / 清单 ---------- */
.lever {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.lever:last-child { border-bottom: none; }
.lever input[type="checkbox"] {
  appearance: none; width: 21px; height: 21px; flex: none; margin-top: 1px;
  border: 1.5px solid #3d434e; border-radius: 6px; background: var(--panel-2); cursor: pointer;
}
.lever input[type="checkbox"]:checked { background: var(--ok); border-color: var(--ok); }
.lever input[type="checkbox"]:checked::after {
  content: "✓"; display: block; text-align: center; color: #0b0c0e;
  font-size: 14px; line-height: 18px; font-weight: 700;
}
.lever span { flex: 1; }
.lever.done span { color: var(--dim); text-decoration: line-through; }
.lever .x { color: #4d535d; background: none; border: none; padding: 0 4px; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; display: flex; align-items: center; gap: 7px;
}
.chip .x { color: #4d535d; background: none; border: none; padding: 0; cursor: pointer; }

/* ---------- 打分 ---------- */
.scale { display: flex; gap: 5px; }
.scale button {
  flex: 1; padding: 9px 0; font-size: 13px; border-radius: 8px; min-width: 0;
}
.scale button.sel { background: var(--accent); border-color: var(--accent); color: #17130a; font-weight: 700; }
.scale.neg button.sel { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- 打断 ---------- */
.slot { border-bottom: 1px solid var(--line); padding: 13px 0; }
.slot:last-child { border-bottom: none; }
.slot .q { display: flex; gap: 10px; align-items: baseline; }
.slot .time { color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.slot .qt { font-size: 14px; }
.slot.answered .qt { color: var(--dim); }
.slot textarea { margin-top: 8px; min-height: 62px; }
.slot .a { margin: 6px 0 0 46px; color: var(--dim); font-size: 13.5px; white-space: pre-wrap; }

/* ---------- 协议 ---------- */
.q-block { padding: 16px 0; border-bottom: 1px solid var(--line); }
.q-block:last-child { border-bottom: none; }
.q-num { color: var(--accent); font-size: 12px; letter-spacing: .1em; }
.q-text { margin: 5px 0 9px; font-size: 15.5px; line-height: 1.55; }
.q-en { color: #5b626d; font-size: 12px; margin: -6px 0 9px; }
.phase {
  margin: 22px 0 6px; padding: 12px 14px; background: var(--panel-2);
  border-left: 2px solid var(--accent); border-radius: 0 10px 10px 0;
}
.phase b { display: block; margin-bottom: 3px; font-size: 14px; }
.phase span { color: var(--dim); font-size: 12.5px; }
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* ---------- 趋势 ---------- */
.trend { width: 100%; height: 110px; display: block; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--dim); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--dim); }

/* ---------- 底部导航 ---------- */
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(11,12,14,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  flex: 1; background: none; border: none; border-radius: 0;
  padding: 11px 0 13px; color: var(--dim); font-size: 11px; letter-spacing: .06em;
}
nav button b { display: block; font-size: 17px; font-weight: 400; margin-bottom: 2px; }
nav button.on { color: var(--accent); }

#toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: #21252c; border: 1px solid var(--line); color: var(--text);
  padding: 9px 18px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .22s; z-index: 60; white-space: nowrap;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.muted { color: var(--dim); font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
