:root {
  --bg: #f4f5fb;
  --bg-glow: rgba(91, 108, 255, 0.16);
  --surface: #ffffff;
  --surface-2: #f7f8fe;
  --line: #e6e8f4;
  --text: #16182b;
  --text-soft: #5a6079;
  --text-mute: #737a94;
  --accent: #5b6cff;
  --accent-strong: #3f4ccc;
  --accent-soft: #eef0ff;
  --ok: #0f8a5c;
  --ok-soft: #e6f7ef;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --radius: 22px;
  --shadow: 0 18px 40px -28px rgba(22, 24, 43, 0.55);
  --shadow-lift: 0 26px 60px -30px rgba(22, 24, 43, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1018;
    --bg-glow: rgba(91, 108, 255, 0.22);
    --surface: #171a26;
    --surface-2: #1e2231;
    --line: #272c3d;
    --text: #f2f4ff;
    --text-soft: #a8aec6;
    --text-mute: #878ea8;
    --accent: #8b98ff;
    --accent-strong: #b7c0ff;
    --accent-soft: #232a45;
    --ok: #3ddc97;
    --ok-soft: #16301f;
    --bad: #ff6b6b;
    --bad-soft: #331a1c;
    --shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.9);
    --shadow-lift: 0 26px 60px -30px rgba(0, 0, 0, 0.95);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1000px 520px at 50% -240px, var(--bg-glow), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

.app {
  max-width: 620px;
  margin: 0 auto;
  padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */

.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 14px;
}

.brand { display: flex; align-items: center; gap: 11px; }

.logo {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--accent), #9b7bff);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: 0 10px 22px -12px rgba(91, 108, 255, 0.95);
}

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--text-mute);
}

.streak {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-soft);
  box-shadow: var(--shadow);
}

.streak.is-zero { opacity: 0.6; }
.streak.is-zero .flame { fill: var(--text-mute); }
.streak.is-zero .flame path[fill="#fff"] { fill: var(--surface); }
.streak b { font-size: 15px; color: var(--text); }
.streak .unit { font-size: 11px; color: var(--text-mute); }

/* ---------- 标签栏 ---------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.tab {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 6px 16px -12px rgba(22, 24, 43, 0.55);
}

.badge {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* ---------- 学段筛选 ---------- */

.levelbar {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 14px;
  scrollbar-width: none;
}

.levelbar::-webkit-scrollbar { display: none; }
.levelbar--compact { padding: 0; }

.chip {
  flex: 0 0 auto;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px -12px var(--accent);
}

.chip small { font-weight: 500; opacity: 0.75; margin-left: 3px; }

/* ---------- 进度 ---------- */

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #9b7bff);
  transition: width 0.35s ease;
}

.progress-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-mute);
}

.progress-text {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute);
}

/* ---------- 卡片 ---------- */

.round-hint {
  margin: -6px 0 12px;
  padding-left: 2px;
  font-size: 12px;
  color: var(--text-mute);
}

.round-hint:empty { display: none; }

.pool-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-mute);
}

.stage { position: relative; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 22px 20px 18px;
  animation: cardIn 0.32s cubic-bezier(0.22, 0.68, 0.32, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.dots { display: flex; gap: 5px; }

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s, transform 0.2s;
}

.dots i.is-ok { background: var(--ok); }
.dots i.is-bad { background: var(--bad); }
.dots i.is-now { transform: scale(1.5); background: var(--accent); }

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

.tag.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.word-block { text-align: center; padding: 4px 0 0; }

.word {
  margin: 0;
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.2;
  word-break: break-word;
}

.phonetic {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-mute);
  letter-spacing: 0.01em;
}

.speak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
}

.speak:hover { border-color: var(--accent); }
.speak:active { transform: scale(0.97); }
.speak svg { width: 15px; height: 15px; fill: currentColor; }
.speak svg path[fill="none"] { fill: none; }
.speak.is-playing { color: #fff; background: var(--accent); }

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  text-align: left;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.12s;
}

.option:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option:not(:disabled):active { transform: scale(0.99); }

.option .key {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 700;
}

.option .mark {
  margin-left: auto;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
}

.option:disabled { cursor: default; }

.option.is-correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

.option.is-correct .key { border-color: var(--ok); color: var(--ok); background: transparent; }
.option.is-correct .mark { opacity: 1; }

.option.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--bad);
}

.option.is-wrong .key { border-color: var(--bad); color: var(--bad); background: transparent; }
.option.is-wrong .mark { opacity: 1; }

.option.is-dim { opacity: 0.45; }

/* ---------- 答题反馈 ---------- */

.feedback {
  margin-top: 16px;
  padding: 15px 16px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  animation: cardIn 0.26s ease;
}

.feedback-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.feedback.is-ok .feedback-head { color: var(--ok); }
.feedback.is-bad .feedback-head { color: var(--bad); }

.feedback-meaning {
  margin: 9px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.example {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  color: var(--text-soft);
}

.example .en { color: var(--text); }
.example .cn { margin: 2px 0 0; color: var(--text-mute); font-size: 13px; }

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.card-actions .btn { flex: 1 1 130px; }

.btn {
  flex: 1;
  padding: 13px 18px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 26px -16px var(--accent);
  transition: transform 0.12s, filter 0.16s;
}

.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }

.btn:disabled {
  opacity: 0.45;
  filter: none;
  cursor: default;
  box-shadow: none;
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-soft);
  box-shadow: none;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: none;
}

/* ---------- 结算 ---------- */

.summary {
  text-align: center;
  padding: 26px 22px 20px;
}

.summary .ring {
  width: 96px;
  height: 96px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) var(--pct, 0%), var(--line) 0);
  position: relative;
}

.summary .ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--surface);
}

.summary .ring b {
  position: relative;
  z-index: 1;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ring-caption {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-mute);
}

.summary h2 { margin: 0 0 6px; font-size: 20px; }
.summary p.sub { margin: 0; color: var(--text-soft); font-size: 13px; }

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0 0;
}

.summary-stats div { text-align: center; }
.summary-stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.summary-stats span { font-size: 12px; color: var(--text-mute); }
.summary-stats .ok b { color: var(--ok); }
.summary-stats .bad b { color: var(--bad); }

.wrong-block {
  margin-top: 16px;
  text-align: left;
}

.wrong-block h3 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

.wrong-preview {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.wrong-preview.is-scroll {
  padding-right: 4px;
  padding-bottom: 4px;
}

.wrong-preview::-webkit-scrollbar { width: 6px; }
.wrong-preview::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }

.wrong-preview li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.wrong-preview li:last-child { border-bottom: 0; }
.wrong-preview b { font-weight: 700; }
.wrong-preview .x { color: var(--bad); font-size: 12px; }
.wrong-preview li span:last-child {
  color: var(--text-soft);
  font-size: 13px;
  margin-left: auto;
  text-align: right;
}

/* ---------- 复习本 ---------- */

.review-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.review-head h2 { margin: 0; font-size: 17px; }
.review-head p { margin: 3px 0 0; font-size: 13px; color: var(--text-mute); }
.review-head .btn { flex: 0 0 auto; padding: 10px 16px; font-size: 14px; }

.empty {
  padding: 46px 22px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-mute);
}

.empty .empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.empty .empty-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text-mute);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.streak .flame {
  width: 13px;
  height: 13px;
  fill: #f0722f;
  align-self: center;
}
.empty b { color: var(--text); }
.empty p { margin: 6px 0 0; font-size: 13px; }

.wrong-list { list-style: none; margin: 0; padding: 0; }

.wrong-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, transform 0.12s;
}

.wrong-item:hover { border-color: var(--accent); }
.wrong-item:active { transform: scale(0.995); }

.wrong-item .w { font-size: 16px; font-weight: 700; }
.wrong-item .t {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wrong-item .count {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--bad);
  background: var(--bad-soft);
  border-radius: 999px;
  padding: 2px 8px;
}

.wrong-item .body { min-width: 0; flex: 1; }

/* ---------- 词库 ---------- */

.library-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap svg {
  position: absolute;
  left: 13px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-mute);
  stroke-width: 2;
  stroke-linecap: round;
}

.search-wrap input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.search-wrap input::placeholder { color: var(--text-mute); }

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.lib-count {
  margin: 0 2px 10px;
  font-size: 12px;
  color: var(--text-mute);
}

.lib-list { display: flex; flex-direction: column; gap: 8px; }

.lib-row {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.16s;
}

.lib-row.is-open { border-color: var(--accent); }

.lib-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 15px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.lib-summary .w { font-size: 16px; font-weight: 700; }
.lib-summary .p { font-size: 12px; color: var(--text-mute); }
.lib-summary .t {
  margin-left: auto;
  max-width: 52%;
  font-size: 13px;
  color: var(--text-soft);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-detail {
  padding: 0 15px 14px;
  font-size: 13px;
  color: var(--text-soft);
  animation: cardIn 0.22s ease;
}

.lib-detail .example { border-top: 1px dashed var(--line); }
.lib-detail .row-actions { display: flex; gap: 8px; margin-top: 10px; }
.lib-detail .speak { margin-top: 8px; padding: 6px 12px; font-size: 12px; }

/* ---------- 页脚 ---------- */

.foot {
  margin-top: auto;
  padding-top: 26px;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-mute);
  text-wrap: balance;
}

.foot .dot { margin: 0 5px; }

/* ---------- 其他 ---------- */

.view[hidden] { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 400px) {
  .app { padding: 16px 14px 24px; }
  .card { padding: 22px 16px 18px; }
  .option { font-size: 14px; padding: 12px 13px; }
  .summary-stats { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
/* ---------- 账号 ---------- */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 128px;
  padding: 7px 12px 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.16s, color 0.16s;
}

.account-chip:hover { border-color: var(--accent); color: var(--accent); }

.account-chip svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.account-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-layer[hidden] { display: none; }

.account-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  background: rgba(13, 15, 26, 0.5);
  backdrop-filter: blur(6px);
  animation: layerIn 0.2s ease;
}

@keyframes layerIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.account-sheet {
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 70px -30px rgba(10, 12, 25, 0.6);
  animation: cardIn 0.28s cubic-bezier(0.22, 0.68, 0.32, 1);
}

.account-sheet h2 {
  margin: 0 0 4px;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.account-intro {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-mute);
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 34vh;
  overflow-y: auto;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  overflow: hidden;
}

.account-row.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.account-pick {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 11px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.account-pick .avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #4f5bd5;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.account-pick .meta { min-width: 0; flex: 1; }

.account-pick .name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 21px;
  min-width: 0;
}

.account-pick .meta b {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-pick .name-line .tag {
  flex: 0 0 auto;
  padding: 1px 7px;
  font-size: 10px;
  line-height: 15px;
}
.account-pick .meta .stat {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--text-soft);
}

.account-del {
  flex: 0 0 auto;
  align-self: center;
  height: 34px;
  margin-right: 8px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-mute);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.16s, background 0.16s;
}

.account-del:focus-visible,
.account-del:hover {
  color: var(--bad);
  background: var(--bad-soft);
}

.account-del:hover { color: var(--bad); background: var(--bad-soft); }

.account-tips {
  margin: 12px 0 0;
  padding: 0 0 0 16px;
  list-style: disc;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-soft);
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

/* 有账号列表时，表单与列表之间加分隔 */
.account-list:not(:empty) + .account-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.account-form-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
}

.account-input-row {
  display: flex;
  gap: 8px;
}

.account-cancel {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.account-admin-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-mute);
}

.account-input-row input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.account-input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.account-input-row .btn {
  flex: 0 0 auto;
  min-height: 46px;
  padding-left: 16px;
  padding-right: 16px;
}

.account-error {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--bad);
  min-height: 0;
}

.account-error:empty { display: none; }

.account-tip {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.5;
}

.account-close {
  margin-top: 18px;
  width: 100%;
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
  box-shadow: none;
}

.account-close:hover { background: var(--surface-2); }

@media (max-width: 400px) {
  .account-chip { max-width: 96px; }
  .account-sheet { padding: 20px 16px 16px; }
  .account-input-row { flex-wrap: wrap; }
  .account-input-row .btn { flex: 1 1 100%; }
}

/* ---------- 打卡记录 ---------- */

.hist-head { margin-bottom: 14px; }
.hist-head h2 { margin: 0; font-size: 17px; }
.hist-head p { margin: 3px 0 0; font-size: 13px; color: var(--text-mute); }

.cal {
  padding: 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.cal-head b { font-weight: 650; }

.cal-nav {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.cal-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.cal-nav:disabled { opacity: 0.4; cursor: default; }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cal-cell.is-empty { visibility: hidden; }

.cal-cell:not(:disabled):hover { background: var(--surface-2); }

.cal-cell.is-done {
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 650;
}

.cal-cell.is-progress {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.cal-cell .today-dot {
  position: absolute;
  bottom: 6px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.cal-cell.is-today { font-weight: 700; }

.cal-cell.is-selected {
  box-shadow: inset 0 0 0 2px var(--text);
}

.cal-cell.is-future { color: var(--text-mute); opacity: 0.55; cursor: default; }

.day-detail {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.day-empty { margin: 12px 0 0; font-size: 13px; color: var(--text-mute); }

.day-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 4px;
  text-align: center;
}

.day-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.day-stats span { font-size: 11px; color: var(--text-mute); }

.day-levels {
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-top: 1px dashed var(--line);
  list-style: none;
  font-size: 13px;
}

.day-levels li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.day-levels .muted { color: var(--text-mute); }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-mute);
}

.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }

.cal-legend .sw {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  border: 1px solid transparent;
}

.cal-legend .sw.is-done { background: var(--ok-soft); border-color: var(--ok); }
.cal-legend .sw.is-progress { background: var(--accent-soft); border-color: var(--accent); }
.cal-legend .sw.is-ring {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--text-soft);
}

.cal-legend .sw-dot {
  width: 4px;
  height: 4px;
  margin: 0 4px;
  border-radius: 50%;
  background: var(--text-soft);
}

.day-nav { display: flex; gap: 6px; }

.day-nav .cal-nav { width: 34px; height: 34px; font-size: 16px; }

.cal-nav:disabled {
  opacity: 0.35;
  border-style: dashed;
}

.day-detail { padding-bottom: 18px; }

.day-levels { border-top-style: solid; }

.tag-admin {
  background: #fdf3e3;
  border-color: #f0d0a4;
  color: #a2610c;
}

@media (prefers-color-scheme: dark) {
  .tag-admin { background: #33270f; border-color: #5c4620; color: #e0b370; }
}

.account-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin-right: 8px;
}

.account-act.is-danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 30%, var(--line));
}

.account-act {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}

.account-act:hover { color: var(--text); border-color: var(--text-mute); }
.account-act.is-danger:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }


.tag.is-retry {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}

.tag.is-review {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-strong);
}
