/* 随身语文 · 青墨主题 */
:root {
  --bg: #131a16;
  --bg2: #1b241e;
  --card: #202b23;
  --line: #33443a;
  --ink: #e6ede4;
  --ink2: #b0bfb2;
  --ink3: #829487;
  --red: #c2452f;
  --red2: #e0553a;
  --green: #7fae7c;
  --gold: #c9a25e;
  --radius: 14px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "STSong", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
main { max-width: 720px; margin: 0 auto; padding: 12px 14px 28px; }

#topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, var(--bg) 82%, rgba(19,26,22,0));
  padding: 14px 16px 8px;
}
#topbar .logo { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; }
#topbar h1 { font-size: 1.35rem; letter-spacing: 0.12em; font-weight: 700; }
#topbar p { font-size: 0.72rem; color: var(--ink3); letter-spacing: 0.08em; margin-top: 2px; }
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: 0 0 42px;
  background: linear-gradient(135deg, #5a8f57, #3d6b3c);
  color: #f2f7ef; font-weight: 700; font-size: 1.3rem;
  border-radius: 9px; box-shadow: 0 2px 8px rgba(90,143,87,.35);
  user-select: none;
}

.card {
  background: linear-gradient(180deg, var(--card), #1d271f);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.card-title { font-size: 0.95rem; color: var(--green); letter-spacing: 0.08em; margin-bottom: 10px; }

/* 倒计时 */
.count-card { text-align: center; }
.count-main { display: flex; justify-content: space-around; }
.count-block { display: flex; flex-direction: column; gap: 4px; }
.count-block b { font-size: 1.9rem; color: var(--green); line-height: 1.1; }
.count-block span { font-size: 0.72rem; color: var(--ink3); }
.progress { height: 8px; background: var(--line); border-radius: 4px; margin: 14px 0 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #5a8f57, #7fae7c); border-radius: 4px; transition: width .4s; }
.phase-tip { font-size: 0.8rem; color: var(--ink2); line-height: 1.8; }

.task-list { list-style: none; }
.task-list li {
  display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line);
  font-size: 0.88rem; color: var(--ink2); align-items: flex-start;
}
.task-list li:last-child { border-bottom: none; }
.task-list i {
  font-style: normal; flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center;
  background: rgba(127,174,124,.14); color: var(--green); border-radius: 50%; font-size: 0.75rem; margin-top: 1px;
}
.task-list li.done i { background: var(--green); color: #0d120e; }
.task-list li.done span { color: var(--ink3); text-decoration: line-through; }
.task-night {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: rgba(194,69,47,.08); border: 1px solid rgba(194,69,47,.3);
  font-size: 0.84rem; color: #e8a08e; line-height: 1.8;
}
.task-night b { color: var(--red2); }

#progress-list .prow { margin-bottom: 10px; }
#progress-list .prow:last-child { margin-bottom: 0; }
.prow-head { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--ink2); margin-bottom: 4px; }
.prow-head b { color: var(--green); }
.prow-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.prow-bar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid button {
  background: #1a241c; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 6px; color: var(--ink); font-size: 0.85rem; cursor: pointer;
  font-family: var(--serif); display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.quick-grid button i { font-style: normal; color: var(--green); font-size: 1.15rem; }
.quick-grid button:active { background: #26331f; }

.tip { background: rgba(201,162,94,.06); border-color: rgba(201,162,94,.25); color: var(--ink2); font-size: 0.82rem; line-height: 1.85; }
.tip b { color: var(--gold); }

/* 学习库 */
.lib-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.lib-tabs button {
  flex: 0 0 auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 7px 16px; color: var(--ink2); font-size: 0.85rem; cursor: pointer;
  font-family: var(--serif); letter-spacing: 0.05em;
}
.lib-tabs button.active { background: rgba(127,174,124,.16); border-color: var(--green); color: var(--green); }
.lib-tools { display: flex; gap: 10px; align-items: center; margin: 4px 0 10px; }

.item-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px;
}
.item-head { display: flex; align-items: center; gap: 10px; }
.item-head .big { font-size: 1.5rem; color: var(--green); font-weight: 700; min-width: 40px; text-align: center; }
.item-head .mid { flex: 1; min-width: 0; }
.item-head h4 { font-size: 0.95rem; }
.item-head p { font-size: 0.76rem; color: var(--ink3); margin-top: 2px; line-height: 1.6; }
.item-head p .warn { color: #e8a08e; }
.star {
  flex: 0 0 auto; background: none; border: none; font-size: 1.15rem; color: var(--ink3);
  cursor: pointer; padding: 4px;
}
.star.on { color: var(--gold); }
.item-body { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; display: none; }
.item-card.open .item-body { display: block; }
.item-body .row { padding: 6px 0; font-size: 0.86rem; line-height: 1.75; color: var(--ink2); }
.item-body .row b { color: var(--ink); }
.item-body .row .ex { color: var(--ink3); font-size: 0.8rem; display: block; margin-top: 1px; }
.item-body .row .yi { color: #e8a08e; font-size: 0.78rem; }
.item-body p { font-size: 0.86rem; line-height: 1.85; color: var(--ink2); padding: 5px 0; }
.item-body p b { color: var(--gold); }
.item-tag {
  display: inline-block; background: rgba(194,69,47,.14); color: #e8a08e;
  border-radius: 4px; padding: 1px 8px; font-size: 0.7rem; margin-right: 6px;
}
.lib-end { text-align: center; margin-top: 4px; }

/* 计划页 */
.map-title { text-align: center; padding: 10px 0 16px; }
.map-title h2 { font-size: 1.3rem; letter-spacing: 0.25em; margin-bottom: 6px; }
.map-title p { color: var(--ink3); font-size: 0.8rem; }
.map-h { font-size: 0.95rem; color: var(--green); letter-spacing: 0.08em; margin-bottom: 10px; }
.map-p { font-size: 0.86rem; line-height: 1.9; color: var(--ink2); }
.lvl-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.lvl-table th, .lvl-table td { border: 1px solid var(--line); padding: 8px 8px; text-align: left; line-height: 1.7; }
.lvl-table th { color: var(--green); background: rgba(127,174,124,.07); }
.lvl-table b { color: var(--red2); }

/* 收藏 */
.sub-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.sub-tabs button {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px; color: var(--ink2); font-size: 0.88rem; cursor: pointer;
  font-family: var(--serif);
}
.sub-tabs button.active { border-color: var(--green); color: var(--green); background: rgba(127,174,124,.1); }

/* 设置 */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 14px 2px 10px; }
.section-title h2 { font-size: 1.1rem; letter-spacing: 0.15em; }
.form-card label { display: block; font-size: 0.8rem; color: var(--ink3); margin: 14px 0 6px; }
.form-card label:first-child { margin-top: 0; }
.form-card input {
  width: 100%; background: #182119; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 0.9rem; font-family: var(--sans); outline: none;
}
.form-card input:focus { border-color: var(--green); }
.hint { font-size: 0.78rem; color: var(--ink3); line-height: 1.7; margin-top: 6px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
.btn-main {
  flex: 1; background: linear-gradient(135deg, #6da56a, #3d6b3c);
  color: #f2f7ef; border: none; border-radius: 10px;
  padding: 12px; font-size: 0.95rem; letter-spacing: 0.2em; cursor: pointer;
  font-family: var(--serif);
}
.btn-main:active { opacity: .85; }
.btn-mini {
  background: rgba(127,174,124,.16); color: #a8cfa4;
  border: 1px solid rgba(127,174,124,.4); border-radius: 8px;
  padding: 7px 14px; font-size: 0.8rem; cursor: pointer; font-family: var(--serif);
}
.btn-mini.ghost { background: none; color: var(--ink2); border-color: var(--line); }
.danger-btn { background: rgba(194,69,47,.12); color: #d98a77; }

/* tabbar */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(19,26,22,.96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
#tabbar button {
  flex: 1; background: none; border: none; color: var(--ink3);
  padding: 9px 0 7px; font-size: 0.7rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: var(--serif); letter-spacing: 0.1em;
}
#tabbar button.active { color: var(--green); }
.tab-ico {
  width: 24px; height: 24px; line-height: 24px; border-radius: 50%;
  font-size: 0.7rem; text-align: center;
  border: 1px solid currentColor; opacity: .75;
}
#tabbar button.active .tab-ico { background: var(--green); border-color: var(--green); color: #0d120e; opacity: 1; }

.view { display: none; }
.view.active { display: block; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 闪卡 */
.flash {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
.flash.open { transform: none; }
.flash-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.flash-head .back { background: none; border: none; color: var(--ink2); font-size: 0.88rem; cursor: pointer; font-family: var(--serif); }
.flash-progress { flex: 1; font-size: 0.8rem; color: var(--ink3); text-align: center; }
.flash-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; max-width: 720px; width: 100%; margin: 0 auto; overflow-y: auto;
}
.flash-card {
  width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 22px; text-align: center;
  cursor: pointer; user-select: none; min-height: 260px;
  display: flex; flex-direction: column; justify-content: center;
}
.flash-card .fbig { font-size: 3.4rem; color: var(--green); font-weight: 700; margin-bottom: 10px; }
.flash-card .fq { font-size: 1rem; color: var(--ink2); line-height: 1.9; }
.flash-card .fa { font-size: 0.88rem; color: var(--ink2); line-height: 2; text-align: left; }
.flash-card .fa b { color: var(--ink); }
.flash-card .fa .ex { color: var(--ink3); font-size: 0.8rem; }
.flash-card .fa .yi { color: #e8a08e; }
.flash-hint { color: var(--ink3); font-size: 0.76rem; margin-top: 16px; }
.flash-foot {
  display: flex; gap: 12px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  max-width: 720px; width: 100%; margin: 0 auto;
}
.flash-btn {
  flex: 1; border-radius: 12px; padding: 14px; font-size: 0.95rem; cursor: pointer;
  font-family: var(--serif); letter-spacing: 0.15em;
}
.flash-btn.forget { background: rgba(194,69,47,.14); border: 1px solid rgba(194,69,47,.45); color: #e8a08e; }
.flash-btn.known { background: rgba(127,174,124,.16); border: 1px solid rgba(127,174,124,.5); color: #a8cfa4; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: rgba(30,40,32,.97); color: var(--ink);
  border: 1px solid var(--green); border-radius: 10px;
  padding: 10px 18px; font-size: 0.84rem; z-index: 80;
  opacity: 0; pointer-events: none; transition: all .25s ease;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 760px) {
  #tabbar { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}
