:root {
  --bg: #0d0f16;
  --bg-lift: #151824;
  --fg: #e9ebf1;
  --fg-2: #a9afbf;
  --fg-3: #6f7688;
  --line: rgba(255, 255, 255, .06);
  --line-2: rgba(255, 255, 255, .13);
  --gold: #d8a657;
  --gold-soft: rgba(216, 166, 87, .13);
  --bad: #b2564f;
  --mid: #8d93a4;
  --q0: #8b93a7;
  --q1: #5f9fd6;
  --q2: #a276d6;
  --q3: #e0913f;
  --r: 11px;
  --shell: 680px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

::selection { background: rgba(216, 166, 87, .26); }

/* ── 提示条 ── */
.toasts {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--toast-top, 10px) + env(safe-area-inset-top));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  max-width: min(520px, 100%);
  padding: 9px 15px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(21, 24, 36, .97);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .42);
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg);
  animation: drop .18s var(--ease) both;
}

.toast.is-out { opacity: 0; transform: translateY(-6px); transition: opacity .18s, transform .18s; }
.toast--good { border-color: rgba(216, 166, 87, .42); color: #eed0a0; }
.toast--err { border-color: rgba(178, 86, 79, .5); color: #e2a9a4; }

.boot {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
  font-size: 13px;
  letter-spacing: .16em;
}

/* ── 登录 ── */
.gate { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 20px calc(32px + env(safe-area-inset-bottom)); }
.gate__box { width: 100%; max-width: 340px; }

.gate__head { margin-bottom: 34px; }
.gate__title { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: .12em; }
.gate__sub { margin: 8px 0 0; font-size: 12px; letter-spacing: .24em; color: var(--fg-3); }

.form { display: flex; flex-direction: column; }
.field { margin-bottom: 7px; font-size: 12px; letter-spacing: .1em; color: var(--fg-3); }

.input {
  height: 46px;
  margin-bottom: 18px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .022);
  outline: none;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}

.input::placeholder { color: #565c6d; }
.input:focus { border-color: rgba(216, 166, 87, .5); background: rgba(255, 255, 255, .04); }

.form__msg { margin: 0 0 14px; font-size: 13px; color: #e2a9a4; }

.linkbtn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  border: 0;
  background: none;
  color: var(--fg-3);
  font-size: 13px;
  cursor: pointer;
  transition: color .16s var(--ease);
}

.linkbtn:hover { color: var(--fg-2); }

.regcode { padding-top: 6px; text-align: center; }
.regcode__v {
  margin: 14px 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: .22em;
  color: var(--gold);
  word-break: break-all;
}
.regcode__note { margin: 0 0 20px; font-size: 12.5px; line-height: 1.8; color: var(--fg-3); }

/* ── 顶栏 ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(13, 15, 22, .93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__in {
  max-width: var(--shell);
  margin: 0 auto;
  padding: calc(11px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
}

.topbar__row { display: flex; align-items: baseline; gap: 18px; }
.stat { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.stat em { font-style: normal; font-size: 11px; color: var(--fg-3); letter-spacing: .06em; }
.stat b { font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

.iconbtn {
  margin-left: auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: -6px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--fg-2);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}

.iconbtn:hover { background: rgba(255, 255, 255, .05); color: var(--fg); }

.hp { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.hp__track { flex: 1 1 auto; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.hp__fill { display: block; height: 100%; width: 0; border-radius: 2px; background: #7fae8c; transition: width .24s var(--ease), background .24s var(--ease); }
.hp__fill[data-tone="warn"] { background: #c39a4d; }
.hp__fill[data-tone="low"] { background: #b2564f; }
.hp__num { flex: 0 0 auto; font-size: 11.5px; color: var(--fg-3); font-variant-numeric: tabular-nums; }

/* ── 菜单 ── */
.menu { position: fixed; inset: 0; z-index: 60; background: rgba(8, 9, 14, .6); animation: fade .16s var(--ease) both; }

.menu__box {
  position: absolute;
  top: calc(52px + env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: min(212px, 70vw);
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--bg-lift);
  box-shadow: 0 20px 44px rgba(0, 0, 0, .5);
  animation: drop .16s var(--ease) both;
}

.menu__item {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  font-size: 14px;
  color: var(--fg-2);
  cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}

.menu__item:hover { background: rgba(255, 255, 255, .05); color: var(--fg); }
.menu__item.is-on { color: var(--gold); }
.menu__item--dim { color: var(--fg-3); font-size: 13px; }
.menu__sep { display: block; height: 1px; margin: 6px 10px; background: var(--line); }

/* ── 布局 ── */
.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.panel { padding-top: 26px; }
.sec { margin-top: 36px; }

.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.panel__title { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .18em; color: var(--fg-3); }
.panel__meta { font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.panel__tools { display: inline-flex; align-items: center; gap: 10px; }

/* ── 按钮 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: none;
  color: var(--fg);
  font-size: 14.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease), opacity .16s var(--ease);
}

.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .2); }
.btn:active:not(:disabled) { background: rgba(255, 255, 255, .08); }
.btn:disabled { opacity: .38; cursor: not-allowed; }

.btn--primary { border-color: var(--gold); background: var(--gold); color: #1b1408; font-weight: 600; }
.btn--primary:hover:not(:disabled) { background: #e2b366; border-color: #e2b366; }
.btn--primary:active:not(:disabled) { background: #cd9b4b; }
.btn--ghost { color: var(--fg-2); }
.btn--sm { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn--block + .btn--block { margin-top: 10px; }

/* ── 探索：入场 ── */
.card { padding-top: 40px; }
.card__rows { margin: 22px 0 26px; display: flex; flex-direction: column; gap: 13px; }
.card__note { margin: 0 0 4px; font-size: 12.5px; color: var(--fg-3); }

.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 13.5px; }
.kv span { flex: 0 0 auto; color: var(--fg-3); }
.kv b { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }

/* ── 探索：事件 ── */
.scene { padding-top: 34px; animation: rise .22s var(--ease) both; }
.scene__meta { margin: 0; font-size: 12px; letter-spacing: .12em; color: var(--fg-3); }

.badge {
  display: inline-block;
  margin-left: 9px;
  padding: 1px 7px;
  border: 1px solid rgba(216, 166, 87, .42);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--gold);
  vertical-align: 1px;
}

.scene__title { margin: 12px 0 0; font-size: 23px; font-weight: 600; line-height: 1.45; letter-spacing: .01em; }
.scene__risk { margin: 9px 0 0; font-size: 12.5px; color: var(--fg-3); font-variant-numeric: tabular-nums; }

.prose { margin-top: 20px; font-size: 15.5px; line-height: 1.95; color: #d6d9e3; }
.prose p { margin: 0 0 15px; }
.prose p:last-child { margin-bottom: 0; }

/* ── 探索：选择 ── */
.choices { margin: 32px 0 0; display: flex; flex-direction: column; gap: 10px; counter-reset: c; }

.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .022);
  text-align: left;
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}

.choice::before {
  counter-increment: c;
  content: counter(c);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  font-size: 11.5px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}

.choice:hover:not(:disabled) { background: rgba(255, 255, 255, .052); border-color: var(--line-2); }
.choice:hover:not(:disabled)::before { border-color: rgba(216, 166, 87, .55); color: var(--gold); }
.choice:active:not(:disabled) { background: rgba(255, 255, 255, .075); }
.choice:disabled { cursor: not-allowed; }
.choice.is-locked { opacity: .4; background: none; }
.choices.is-pending .choice { opacity: .35; }
.choices.is-pending .choice.is-picked { opacity: .6; }

.choice__main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.choice__text { min-width: 0; display: flex; flex-direction: column; }
.choice__label { font-size: 15.5px; line-height: 1.5; }
.choice__hint { margin-top: 3px; font-size: 12.5px; line-height: 1.6; color: var(--fg-3); }
.choice__cost { flex: 0 0 auto; font-size: 12px; color: var(--gold); white-space: nowrap; }

/* ── 探索：结果 ── */
.result { margin-top: 32px; animation: rise .22s var(--ease) both; }
.result__tag { display: inline-block; margin: 0; padding: 2px 11px; border: 1px solid currentColor; border-radius: 999px; font-size: 12px; letter-spacing: .12em; }
.result[data-tone="good"] .result__tag { color: var(--gold); }
.result[data-tone="bad"] .result__tag { color: var(--bad); }
.result[data-tone="neutral"] .result__tag { color: var(--mid); }

.deltas { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 18px; margin-top: 20px; font-size: 13px; font-variant-numeric: tabular-nums; }
.delta { color: var(--fg-2); }
.delta--hp { color: #cf8b85; }
.delta--gold { color: var(--gold); }
.delta--exp { color: #96a6d2; }
.delta--drop { gap: 10px; }
.delta--drop > span:first-child { color: var(--fg-3); font-size: 12.5px; }

.actions { margin-top: 30px; display: flex; flex-direction: column; }

/* ── 列表 ── */
.rows { margin-top: 6px; border-top: 1px solid var(--line); }

.row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row.is-me { padding-left: 10px; padding-right: 10px; border-radius: 10px; background: var(--gold-soft); }
.row__main { flex: 1 1 auto; min-width: 0; }
.row__name { margin: 0; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.row__sub { margin: 3px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--fg-3); }
.row__side { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

.bar { display: block; height: 3px; margin-top: 8px; border-radius: 2px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 2px; background: var(--gold); }
.bar--dim i { background: #4d5468; }

.rank-n { flex: 0 0 auto; width: 22px; font-size: 13px; color: var(--fg-3); font-variant-numeric: tabular-nums; text-align: right; }
.row.is-me .rank-n { color: var(--gold); }

.empty { margin: 14px 0; font-size: 13px; color: var(--fg-3); }
.note { margin: 14px 0 18px; font-size: 12.5px; line-height: 1.75; color: var(--fg-3); }
.dim { color: var(--fg-3); }
.tag { padding: 2px 9px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 11.5px; color: var(--fg-3); }

/* ── 部位卡 ── */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; margin-top: 18px; }
.slotcard { padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--r); background: rgba(255, 255, 255, .018); }
.slotcard__k { margin: 0; font-size: 11px; letter-spacing: .14em; color: var(--fg-3); }
.slotcard__n { margin: 9px 0 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.slotcard__n--empty { color: #4f5566; }
.slotcard__s { margin: 3px 0 0; font-size: 12px; color: var(--fg-3); }
.slotcard__p { margin: 11px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--fg-3); }
.slotcard__p b { font-weight: 500; color: var(--fg-2); font-variant-numeric: tabular-nums; }

/* ── 品质 / 货币 ── */
.q0 { color: var(--q0); }
.q1 { color: var(--q1); }
.q2 { color: var(--q2); }
.q3 { color: var(--q3); }

.money { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 20px; }
.money__i { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--fg-3); }
.money__i b { font-weight: 500; font-size: 13.5px; color: var(--fg); font-variant-numeric: tabular-nums; }

/* ── 小控件 ── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: none;
  color: var(--fg-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.chip:hover { background: rgba(255, 255, 255, .05); color: var(--fg); }
.chip:disabled { opacity: .38; cursor: not-allowed; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.seg button { height: 30px; padding: 0 12px; border: 0; background: none; color: var(--fg-3); font-size: 12.5px; cursor: pointer; transition: background .16s var(--ease), color .16s var(--ease); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.is-on { background: var(--gold-soft); color: var(--gold); }

/* ── 签到 ── */
.signin { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 18px; }
.signin__c {
  aspect-ratio: 1 / 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 10.5px;
  color: var(--fg-3);
}
.signin__c b { font-size: 13px; font-weight: 500; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.signin__c.is-done { border-color: rgba(216, 166, 87, .3); }
.signin__c.is-done b { color: var(--gold); }
.signin__c.is-today { border-color: var(--gold); background: var(--gold-soft); }

/* ── 日志 ── */
.log { margin-top: 14px; display: flex; flex-direction: column; gap: 11px; }
.log__i { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--fg-2); }
.log__t { margin-right: 10px; color: var(--fg-3); font-variant-numeric: tabular-nums; }

/* ── 弹层 ── */
.sheet { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(8, 9, 14, .66); animation: fade .16s var(--ease) both; }

.sheet__card {
  width: 100%;
  max-width: 360px;
  padding: 26px 24px 24px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--bg-lift);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .55);
  animation: rise .18s var(--ease) both;
}

.sheet__title { margin: 12px 0 0; font-size: 19px; font-weight: 600; line-height: 1.5; }
.sheet__text { margin: 12px 0 22px; font-size: 13.5px; line-height: 1.85; color: var(--fg-2); }
.sheet__card .card__rows { margin: 0 0 24px; }
.sheet__acts { display: flex; gap: 10px; }

@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 720px) {
  body { font-size: 15.5px; }
  .shell { padding-bottom: 80px; }
  .topbar__in { padding-top: calc(13px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
