/* 渡易 · SpaceX 骨架 + 莫兰蒂色板 */

/* ---------- 浅色莫兰蒂 ---------- */
:root {
  --bg: #F0EDE7;
  --bg-2: #E5E1D9;
  --surface: #FBFAF7;
  --surface-2: #F4F1EB;
  --line: rgba(58, 54, 48, 0.12);
  --line-2: rgba(58, 54, 48, 0.22);
  --ink: #33312D;
  --ink-2: #6E6A63;
  --ink-3: #A09A90;
  --accent: #7C8B99;
  --accent-ink: #5C6B79;
  --accent-soft: rgba(124, 139, 153, 0.12);
  --rose: #B3918D;
  --rose-soft: rgba(179, 145, 141, 0.14);
  --green: #7E9080;
  --green-soft: rgba(126, 144, 128, 0.14);
  --clay: #B0856A;
  --clay-soft: rgba(176, 133, 106, 0.14);
  --radius: 3px;
}

/* ---------- 深色莫兰蒂 ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #232529;
    --bg-2: #1C1E21;
    --surface: #2C2F34;
    --surface-2: #34383E;
    --line: rgba(228, 225, 218, 0.12);
    --line-2: rgba(228, 225, 218, 0.24);
    --ink: #E4E1DA;
    --ink-2: #A8A49C;
    --ink-3: #75726B;
    --accent: #93A4B3;
    --accent-ink: #B4C2CE;
    --accent-soft: rgba(147, 164, 179, 0.15);
    --rose: #C9A9A5;
    --rose-soft: rgba(201, 169, 165, 0.16);
    --green: #9CAF95;
    --green-soft: rgba(156, 175, 149, 0.16);
    --clay: #C79B80;
    --clay-soft: rgba(199, 155, 128, 0.16);
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body { overscroll-behavior-y: none; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 96px; }

h1, h2, h3 { margin: 0; font-weight: 400; }
h1 { font-size: 32px; font-weight: 300; line-height: 1.35; letter-spacing: 0.01em; }
h2 { font-size: 21px; font-weight: 400; line-height: 1.5; letter-spacing: 0.01em; }
h3 { font-size: 15px; }
p { margin: 0; }
button { font-family: inherit; font-size: 15px; cursor: pointer; border: 0; background: none; color: inherit; }

/* 小标签：全大写 + 宽字距，SpaceX 的标志性元素 */
.eyebrow {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 14px;
}

textarea, input {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  width: 100%;
  outline: none;
  resize: none;
  line-height: 1.7;
  transition: border-color .18s;
}
textarea:focus, input:focus { border-color: var(--accent); }
textarea::placeholder, input::placeholder { color: var(--ink-3); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 14px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--radius);
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  color: var(--accent-ink); font-size: 14px;
}
.brand-name { font-size: 16px; letter-spacing: 0.14em; }
.brand-sub { font-size: 9px; color: var(--accent-ink); letter-spacing: 0.34em; }

.chip {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.06em;
}
.chip.on { color: var(--green); border-color: var(--green); }

/* ---------- 视图 ---------- */
.view { display: none; padding: 0 20px; }
.view.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { padding: 60px 0 52px; }
.hero h1 { margin-bottom: 16px; }
.hero p { color: var(--ink-2); font-size: 14px; }
.tagline { color: var(--accent-ink) !important; font-size: 11px !important; letter-spacing: 0.22em; margin-top: 20px !important; }

/* ---------- 模式卡 ---------- */
.mode-card {
  display: block; width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  margin-bottom: 14px;
  transition: border-color .2s, background .2s;
}
.mode-card:active { background: var(--surface-2); }
.mode-card.primary { border-color: var(--accent); }
.mc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.mc-title { font-size: 19px; letter-spacing: 0.04em; margin-top: 10px; }
.mc-desc { color: var(--ink-2); font-size: 13px; margin-top: 8px; line-height: 1.75; }
.mc-go {
  font-size: 11px; letter-spacing: 0.2em; color: var(--accent-ink);
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
}
.mark { width: 34px; height: 34px; flex: 0 0 34px; color: var(--accent-ink); }
.arrow { display: none; }

/* ---------- 统计 ---------- */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin: 8px 0 0;
}
.stat { padding: 22px 6px; text-align: center; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-size: 28px; font-weight: 300; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10px; color: var(--ink-3); letter-spacing: 0.14em; }

/* ---------- 分区 ---------- */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 56px 0 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.sec-head h3 { letter-spacing: 0.06em; }
.sec-head .more { font-size: 11px; color: var(--ink-3); letter-spacing: 0.1em; }

/* ---------- 记录 ---------- */
.rec {
  border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: transparent;
  padding: 16px 2px; margin-bottom: 0;
}
.rec-pending { padding-left: 12px; border-left: 2px solid var(--accent); }
.rec-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.rec-wish { font-size: 14px; line-height: 1.6; }
.rec-meta { font-size: 11px; color: var(--ink-3); margin-top: 6px; letter-spacing: 0.04em; }
.tag { font-size: 10px; padding: 3px 9px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; letter-spacing: 0.1em; flex: 0 0 auto; }
.tag.done { color: var(--green); border-color: var(--green); }
.tag.open { color: var(--accent-ink); border-color: var(--accent); }
.tag.miss { color: var(--clay); border-color: var(--clay); }
.tag.local { color: var(--ink-3); }

.empty { color: var(--ink-3); font-size: 13px; padding: 40px 0; text-align: center; letter-spacing: 0.04em; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 52px; padding: 0 20px; border-radius: var(--radius);
  background: transparent; border: 1px solid var(--line-2);
  color: var(--ink); font-size: 14px; letter-spacing: 0.08em; width: 100%;
  transition: background .18s, color .18s, border-color .18s, opacity .18s;
}
.btn:disabled { opacity: .35; cursor: default; }
.btn:not(:disabled):active { background: var(--surface-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:not(:disabled):active { background: var(--ink-2); }
.btn.ghost { border-color: var(--line); color: var(--ink-2); }
.btn.sm { height: 40px; font-size: 12px; padding: 0 16px; width: auto; letter-spacing: 0.12em; }
.btn-row { display: flex; gap: 10px; }

/* ---------- 流程：思考预算 ---------- */
.thinkbar {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 15px; margin: 20px 0 18px;
}
.thinkbar-top { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.18em; color: var(--ink-3); }
.thinkbar-top b { color: var(--ink); font-weight: 400; font-variant-numeric: tabular-nums; font-size: 12px; letter-spacing: 0.04em; }
.track { height: 2px; background: var(--line); margin-top: 10px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--accent); transition: width .4s linear, background .3s; }
.thinkbar.over .track i { background: var(--clay); }
.thinkbar.over b { color: var(--clay); }

.steps { display: flex; gap: 3px; margin-bottom: 8px; }
.steps i { flex: 1; height: 2px; background: var(--line); }
.steps i.on { background: var(--accent-ink); }
.steps i.done { background: var(--accent); }

.panel { display: none; }
.panel.active { display: block; animation: fade .25s ease; }
.step-tag { font-size: 10px; color: var(--accent-ink); letter-spacing: 0.26em; margin-bottom: 18px; }
.panel h2 { margin-bottom: 12px; }
.hint { color: var(--ink-2); font-size: 13px; margin-bottom: 22px; line-height: 1.8; }
.rule { list-style: none; padding: 0; margin: 0 0 22px; }
.rule li { font-size: 13px; color: var(--ink-2); padding-left: 18px; position: relative; margin-bottom: 7px; }
.rule li::before { content: ''; position: absolute; left: 0; top: 11px; width: 6px; height: 1px; background: var(--accent); }

.ai-out {
  background: var(--surface); border-left: 2px solid var(--accent);
  border-radius: 0; padding: 14px 16px; margin-top: 14px;
  font-size: 14px; white-space: pre-wrap; min-height: 46px; line-height: 1.75;
}
.ai-out .lbl { font-size: 10px; color: var(--accent-ink); letter-spacing: 0.24em; display: block; margin-bottom: 8px; text-transform: uppercase; }
.ai-out .lbl.warn { color: var(--clay); }
.ai-line { padding: 8px 0; border-top: 1px solid var(--line); }
.ai-line:first-of-type { border-top: 0; }
.ai-line b { color: var(--accent-ink); font-weight: 400; }
.ai-line.bad b { color: var(--clay); }
.ai-line.idea { cursor: pointer; }
.ai-line.idea.on { background: var(--accent-soft); padding-left: 8px; margin-left: -8px; }
.ai-line.idea.on b { color: var(--accent-ink); }

.slot { margin-bottom: 14px; }
.slot label { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.16em; color: var(--ink-3); margin-bottom: 6px; }

.choice { display: flex; gap: 10px; margin-top: 6px; }
.choice button { flex: 1; height: 50px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-size: 14px; letter-spacing: 0.08em; transition: all .18s; }
.choice button.on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }

.callout {
  background: var(--green-soft); border-left: 2px solid var(--green);
  border-radius: 0; padding: 14px 16px; font-size: 13px; margin-top: 14px; line-height: 1.8;
}
.callout.warn { background: var(--clay-soft); border-left-color: var(--clay); }
.callout b { font-weight: 400; color: var(--ink); }

.flow-foot { display: flex; gap: 10px; margin-top: 32px; }
.flow-foot .btn { flex: 1; }
.flow-foot .btn.back { flex: 0 0 88px; }

.brake {
  display: none;
  background: var(--clay-soft); border-left: 2px solid var(--clay);
  padding: 16px 16px 14px; margin-bottom: 18px;
}
.brake.on { display: block; }
.brake h3 { margin-bottom: 6px; letter-spacing: 0.06em; }
.brake p { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; line-height: 1.75; }

.timer { text-align: center; padding: 44px 0 12px; }
.timer b { font-size: 52px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.timer span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 10px; letter-spacing: 0.06em; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  z-index: 40;
}
.tabbar-inner { display: flex; width: 100%; max-width: 560px; }
.tabbar button {
  flex: 1; padding: 4px 0; font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.18em;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.tabbar button.on { color: var(--ink); }
.tabbar .dot { width: 12px; height: 1px; background: transparent; }
.tabbar button.on .dot { background: var(--accent-ink); }

/* ---------- 登录弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(30, 28, 25, 0.42);
  backdrop-filter: blur(3px);
  display: none; align-items: flex-end; justify-content: center; z-index: 60;
}
.mask.on { display: flex; }
.sheet {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: var(--radius) var(--radius) 0 0; padding: 24px 22px max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-2); max-height: 88vh; overflow-y: auto;
}
.sheet h2 { margin-bottom: 6px; }
.sheet .sh-sub { color: var(--ink-2); font-size: 13px; margin-bottom: 24px; }
.tabs { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.tabs button { flex: 1; height: 38px; font-size: 12px; color: var(--ink-2); letter-spacing: 0.08em; border-right: 1px solid var(--line); }
.tabs button:last-child { border-right: 0; }
.tabs button.on { background: var(--ink); color: var(--bg); }
.field { margin-bottom: 12px; }
.field .row { display: flex; gap: 10px; }
.field .row .btn { width: auto; flex: 0 0 116px; height: 48px; font-size: 12px; }
.msg { font-size: 12px; margin-top: 12px; min-height: 20px; color: var(--clay); letter-spacing: 0.04em; }
.msg.ok { color: var(--green); }
.link { color: var(--ink-2); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; margin-top: 14px; display: inline-block; }

/* ---------- 设置 ---------- */
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 2px; border-bottom: 1px solid var(--line);
}
.set-row .sr-l { font-size: 14px; letter-spacing: 0.04em; }
.set-row .sr-l small { display: block; color: var(--ink-3); font-size: 11px; margin-top: 3px; letter-spacing: 0.04em; }
.seg { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; flex: 0 0 auto; }
.seg button { padding: 7px 12px; font-size: 11px; color: var(--ink-2); letter-spacing: 0.08em; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--bg); }
#segModel { flex-wrap: wrap; }
#segModel button { border-bottom: 1px solid var(--line); }

/* ---------- 日程：等级条 ---------- */
.xpbar { margin: 22px 0 4px; padding-top: 18px; border-top: 1px solid var(--line); }
.xp-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; letter-spacing: 0.24em; color: var(--ink-3); }
.xp-top span:first-child { color: var(--accent-ink); font-size: 12px; }
.xp-hint { font-size: 11px; color: var(--ink-3); margin-top: 10px; letter-spacing: 0.04em; }

/* ---------- 日程：日历 ---------- */
.cal { margin-top: 30px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-nav { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); font-size: 15px; line-height: 1; }
.cal-title { font-size: 14px; letter-spacing: 0.18em; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week span { text-align: center; font-size: 10px; color: var(--ink-3); letter-spacing: 0.1em; padding: 4px 0 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-cell {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  min-height: 54px; padding: 7px 3px 5px; text-align: center; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: background .18s;
}
.cal-cell .n { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; line-height: 1.2; }
.cal-cell.out .n { color: var(--ink-3); opacity: .45; }
.cal-cell.today .n { color: var(--accent-ink); font-weight: 500; }
.cal-cell.sel { background: var(--accent-soft); }
.cal-dots { display: flex; justify-content: center; gap: 3px; height: 5px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-dots i.ok { background: var(--green); }
.cal-dots i.od { background: var(--clay); }

/* ---------- 日程：任务行 ---------- */
.todo { display: flex; align-items: flex-start; gap: 12px; padding: 16px 2px; border-bottom: 1px solid var(--line); }
.todo .check {
  flex: 0 0 22px; width: 22px; height: 22px; margin-top: 2px;
  border: 1px solid var(--line-2); border-radius: 2px; position: relative;
  transition: background .18s, border-color .18s;
}
.todo .check.on { background: var(--green); border-color: var(--green); }
.todo .check.on::after {
  content: ''; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
  border-right: 1.6px solid var(--bg); border-bottom: 1.6px solid var(--bg); transform: rotate(40deg);
}
.td-body { flex: 1; min-width: 0; text-align: left; }
.td-time { font-size: 10px; letter-spacing: 0.16em; color: var(--ink-3); margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.td-name { font-size: 14px; line-height: 1.6; }
.td-rw { font-size: 11px; color: var(--accent-ink); margin-top: 6px; letter-spacing: 0.02em; }
.todo.od .td-time { color: var(--clay); }
.todo.done .td-name { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.todo.done .td-rw { color: var(--green); }
.td-bell { flex: 0 0 auto; color: var(--ink-3); padding-top: 5px; opacity: .7; }

.ob {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--clay-soft); border-left: 2px solid var(--clay);
  padding: 12px 15px; margin-top: 26px; font-size: 12px; color: var(--ink-2);
}
.ob button { font-size: 11px; color: var(--clay); letter-spacing: 0.12em; white-space: nowrap; flex: 0 0 auto; }

/* ---------- 奖励卡 ---------- */
.rw-card {
  margin-top: 20px; padding: 34px 22px; text-align: center;
  border: 1px solid var(--line-2); background: var(--surface-2);
  animation: flip .6s cubic-bezier(.2, .8, .3, 1);
}
@keyframes flip {
  0% { transform: perspective(700px) rotateX(72deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
.rw-rare { font-size: 10px; letter-spacing: 0.32em; color: var(--ink-3); margin-bottom: 16px; text-transform: uppercase; }
.rw-rare.rare { color: var(--accent-ink); }
.rw-rare.legendary { color: var(--clay); }
.rw-text { font-size: 20px; font-weight: 300; line-height: 1.6; }

/* ---------- 卡池列表 ---------- */
.pool { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pool span { font-size: 13px; line-height: 1.6; flex: 1; }
.pool .pr { flex: 0 0 auto; font-size: 9px; letter-spacing: 0.2em; color: var(--ink-3); margin-right: 10px; }
.pool .pd { flex: 0 0 auto; color: var(--clay); font-size: 12px; padding: 0 4px; }

.mini { font-size: 10px; color: var(--ink-3); letter-spacing: 0.16em; display: block; margin-bottom: 7px; text-transform: uppercase; }
.link.danger { color: var(--clay); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 104px; background: var(--ink); color: var(--bg);
  font-size: 12px; letter-spacing: 0.08em; padding: 12px 20px;
  border-radius: var(--radius); z-index: 80; opacity: 0;
  transition: opacity .25s; pointer-events: none; max-width: 86%; text-align: center;
}
.toast.on { opacity: 1; }
