:root {
  color-scheme: light;
  --paper: #f3f0e7;
  --paper-blur: rgba(243, 240, 231, 0.86);
  --card: #fbf9f3;
  --card-2: #eeeade;
  --ink: #20251f;
  --muted: #74796e;
  --faint: #9a9d92;
  --line: rgba(32, 37, 31, 0.11);
  --line-strong: rgba(32, 37, 31, 0.18);
  --accent: #c15b37;
  --accent-deep: #a54828;
  --accent-soft: #f0d9cc;
  --green: #2c4437;
  --green-deep: #203429;
  --sage: #71836f;
  --cream: #faf4e7;
  --gold: #b28a4c;
  --shadow: 0 12px 30px rgba(47, 45, 35, 0.06);
  --shadow-soft: 0 4px 14px rgba(47, 45, 35, 0.045);
  --radius: 24px;
  --nav: 78px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Songti SC", "STSong", "SimSun", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #141612;
    --paper-blur: rgba(20, 22, 18, 0.88);
    --card: #1c1f19;
    --card-2: #252920;
    --ink: #f0ece0;
    --muted: #a7ab9d;
    --faint: #7e8377;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);
    --accent: #e0805d;
    --accent-deep: #f09a78;
    --accent-soft: #3d2a21;
    --green: #2d4939;
    --green-deep: #203529;
    --sage: #93a68e;
    --cream: #f5efdf;
    --gold: #cba66b;
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.2);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

html::-webkit-scrollbar { display: none; }

body {
  margin: 0;
  min-height: 100dvh;
  background: #e7e1d3;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  body { background: #0c0e0b; }
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ic {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 80px rgba(50, 45, 30, 0.13);
  overflow-x: clip;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 20px 10px;
  background: linear-gradient(to bottom, var(--paper-blur) 70%, rgba(243, 240, 231, 0));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

@media (prefers-color-scheme: dark) {
  .topbar { background: linear-gradient(to bottom, var(--paper-blur) 70%, rgba(20, 22, 18, 0)); }
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: var(--green);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(44, 68, 55, 0.2);
}

.wordmark-text {
  display: flex;
  flex-direction: column;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.05;
}

.wordmark-text small {
  margin-top: 4px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--card) 70%, transparent);
  font-size: 12px;
  font-weight: 600;
}

.streak-pill .ic {
  width: 15px;
  height: 15px;
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
}

.streak-pill b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.round-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: color-mix(in srgb, var(--card) 58%, transparent);
  transition: transform 0.15s var(--ease), background 0.15s;
}

.round-btn:active {
  transform: scale(0.92);
  background: var(--card-2);
}

.round-btn.small {
  width: 34px;
  height: 34px;
}

.round-btn.small .ic {
  width: 17px;
  height: 17px;
}

/* ---------- page ---------- */
main {
  padding: 0 18px calc(var(--nav) + 36px + env(safe-area-inset-bottom));
}

.view {
  animation: view-in 0.42s var(--ease) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  padding: 22px 2px 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(30px, 8.5vw, 37px);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.today-head h1 {
  font-size: clamp(34px, 9.5vw, 41px);
}

.lede {
  max-width: 34em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.72;
}

/* ---------- progress ---------- */
.progress-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 17px;
  min-height: 132px;
  padding: 21px 20px;
  border-radius: 27px;
  background:
    radial-gradient(circle at 88% 10%, rgba(250, 244, 231, 0.09), transparent 35%),
    linear-gradient(140deg, var(--green) 0%, var(--green-deep) 100%);
  color: var(--cream);
  box-shadow: 0 18px 38px rgba(34, 51, 41, 0.2);
  overflow: hidden;
}

.progress-ring {
  --p: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(250, 244, 231, 0.14) 0);
  transition: background 0.5s var(--ease);
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--green-deep);
}

.ring-inner {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.ring-inner b {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.ring-inner span {
  color: rgba(250, 244, 231, 0.55);
  font-size: 11px;
  font-weight: 600;
}

.progress-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  padding-right: 10px;
}

.progress-label {
  display: block;
  margin-bottom: 5px;
  color: rgba(250, 244, 231, 0.56);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.progress-copy strong {
  display: block;
  margin-bottom: 5px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.progress-copy p {
  margin: 0;
  color: rgba(250, 244, 231, 0.62);
  font-size: 11.5px;
  line-height: 1.55;
}

.sun-mark {
  position: absolute;
  right: -18px;
  top: 50%;
  width: 98px;
  height: 98px;
  transform: translateY(-50%);
  opacity: 0.55;
}

.sun-mark span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(250, 244, 231, 0.1);
  border-radius: 50%;
}

.sun-mark span:nth-child(2) { inset: 14px; }
.sun-mark span:nth-child(3) { inset: 28px; background: rgba(250, 244, 231, 0.04); }

.install-tip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 11px 10px 11px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent-soft) 42%, var(--card));
}

.install-tip-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.install-tip-copy strong {
  font-size: 11.5px;
  font-weight: 650;
}

.install-tip-copy span {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

.install-tip-action {
  height: 30px;
  padding: 0 11px;
  border-radius: 99px;
  color: var(--cream);
  background: var(--accent);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.install-tip-close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--faint);
}

.install-tip-close .ic { width: 12px; height: 12px; }

/* ---------- blocks ---------- */
.block {
  margin-top: 16px;
  padding: 19px 17px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 74%, transparent);
  box-shadow: var(--shadow-soft);
}

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

.kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.block-head h2,
.library-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.count-pill,
.era-pill {
  display: inline-flex;
  align-items: center;
  height: 25px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--card-2);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.era-pill {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.source-line {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.01em;
}

.block-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.done-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.done-dot {
  position: relative;
  width: 17px;
  height: 17px;
  border: 1.4px solid var(--line-strong);
  border-radius: 50%;
  transition: all 0.2s var(--ease);
}

.done-btn.is-done .done-dot {
  border-color: var(--green);
  background: var(--green);
}

.done-btn.is-done .done-dot::after {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid var(--cream);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(42deg);
}

.done-btn.is-done .done-text {
  color: var(--green);
}

@media (prefers-color-scheme: dark) {
  .done-btn.is-done .done-dot::after { border-color: #1c1f19; }
  .done-btn.is-done .done-text { color: var(--sage); }
}

.block-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}

.block-link .ic {
  width: 15px;
  height: 15px;
  transition: transform 0.15s;
}

.block-link:active .ic { transform: translateX(4px); }

.page-foot {
  padding: 30px 0 8px;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-align: center;
}

/* ---------- news ---------- */
.news-list {
  display: grid;
  gap: 0;
}

.news-item {
  display: grid;
  grid-template-columns: 26px 1fr 15px;
  gap: 8px;
  width: 100%;
  padding: 12px 0;
  text-align: left;
  border-top: 1px solid var(--line);
  transition: opacity 0.15s;
}

.news-item:first-child {
  padding-top: 2px;
  border-top: 0;
}

.news-item:active { opacity: 0.62; }

.news-index {
  padding-top: 2px;
  color: var(--faint);
  font-family: var(--sf-mono, "SFMono-Regular", Consolas, monospace);
  font-size: 9.5px;
  letter-spacing: -0.04em;
}

.news-main { min-width: 0; }

.news-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}

.news-cat {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.news-time {
  color: var(--faint);
  font-size: 9px;
}

.news-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 590;
  letter-spacing: -0.012em;
  line-height: 1.52;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.news-item:first-child .news-title {
  font-size: 15.5px;
  line-height: 1.48;
}

.news-arrow {
  align-self: center;
  width: 13px;
  height: 13px;
  color: var(--faint);
}

.news-skeleton {
  height: 55px;
  margin-top: 8px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--card-2) 25%, color-mix(in srgb, var(--card-2) 55%, var(--card)) 37%, var(--card-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

body.sheet-open { overflow: hidden; }

.news-error {
  padding: 15px 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.news-error button {
  display: inline;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- today words ---------- */
.today-words {
  display: grid;
}

.today-word {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 31px 27px;
  align-items: center;
  gap: 7px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.today-word:first-child {
  padding-top: 1px;
  border-top: 0;
}

.word-num {
  color: var(--faint);
  font-family: var(--sf-mono, "SFMono-Regular", Consolas, monospace);
  font-size: 9px;
}

.word-open {
  min-width: 0;
  padding: 0;
  text-align: left;
}

.word-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.word-en {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.018em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-ipa {
  overflow: hidden;
  color: var(--faint);
  font-family: "SF Pro Text", var(--font);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-cn {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos {
  margin-right: 3px;
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 700;
}

.mini-icon-btn {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  transition: all 0.15s var(--ease);
}

.mini-icon-btn:active {
  transform: scale(0.9);
  background: var(--card-2);
}

.mini-icon-btn .ic {
  width: 14px;
  height: 14px;
}

.check-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1.4px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  background: transparent;
  transition: all 0.2s var(--ease);
}

.check-btn .ic {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
}

.check-btn.is-done {
  border-color: var(--green);
  color: var(--cream);
  background: var(--green);
}

@media (prefers-color-scheme: dark) {
  .check-btn.is-done { color: #1c1f19; }
}

/* ---------- history feature ---------- */
.history-feature {
  display: block;
  width: 100%;
  padding: 1px 0 0;
  text-align: left;
}

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

.history-feature h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.35;
}

.history-points {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.history-points li {
  position: relative;
  padding-left: 13px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.history-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.exam-note {
  margin-top: 12px;
  padding: 10px 11px;
  border-left: 2px solid var(--accent);
  border-radius: 0 9px 9px 0;
  background: color-mix(in srgb, var(--accent-soft) 40%, transparent);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.exam-note b {
  color: var(--accent);
  font-weight: 700;
}

.history-feature .tap-hint {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 12px;
  color: var(--faint);
  font-size: 10px;
}

.history-feature .tap-hint .ic {
  width: 12px;
  height: 12px;
}

/* ---------- stats / search / chips ---------- */
.stat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  box-shadow: var(--shadow-soft);
}

.stat-num {
  display: flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
}

.stat-num b {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 35px;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
}

.stat-num span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
}

.stat-copy {
  min-width: 0;
}

.stat-copy strong {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 650;
}

.stat-copy small {
  display: block;
  margin-top: 7px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.bar {
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage), var(--green));
  transition: width 0.5s var(--ease);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 43px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 68%, transparent);
}

.search-box .ic {
  width: 16px;
  height: 16px;
  color: var(--faint);
}

.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.search-box input::placeholder { color: var(--faint); }

.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

.clear-search {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--faint);
  background: var(--card-2);
}

.clear-search .ic { width: 12px; height: 12px; }

.chips {
  display: flex;
  gap: 7px;
  margin: 13px -18px 16px;
  padding: 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--card) 55%, transparent);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.16s var(--ease);
}

.chip.active {
  border-color: var(--ink);
  color: var(--paper);
  background: var(--ink);
}

/* ---------- word bank ---------- */
.wordbank {
  display: grid;
  gap: 9px;
}

.word-row {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.word-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 29px 26px;
  gap: 8px;
  align-items: center;
  padding: 12px 13px;
}

.word-row-main {
  min-width: 0;
  padding: 0;
  text-align: left;
}

.word-row .word-en {
  font-size: 16.5px;
}

.word-row .word-cn {
  font-size: 11px;
  margin-top: 3px;
}

.word-row-extra {
  display: none;
  padding: 0 13px 13px;
}

.word-row.expanded .word-row-extra {
  display: block;
  animation: extra-in 0.25s var(--ease) both;
}

@keyframes extra-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.example {
  margin: 0;
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--card-2);
  font-size: 11.5px;
  line-height: 1.65;
}

.example .en {
  display: block;
  color: var(--ink);
  font-weight: 500;
}

.example .cn {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.col-note {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10.5px;
}

.col-note b {
  color: var(--sage);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.bank-empty {
  padding: 34px 12px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

/* ---------- education ---------- */
.edu-today-card {
  margin-top: 0;
}

.edu-today-card .block-head h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
}

.edu-today-card .history-points li {
  font-size: 12px;
}

.quiz-card {
  margin-top: 16px;
  padding: 19px 17px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 15px 32px rgba(25, 28, 23, 0.14);
}

@media (prefers-color-scheme: dark) {
  .quiz-card { background: #262b22; }
}

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.quiz-head .kicker {
  margin: 0;
  color: rgba(250, 244, 231, 0.45);
}

.quiz-badge {
  padding: 3px 8px;
  border: 1px solid rgba(250, 244, 231, 0.17);
  border-radius: 99px;
  color: rgba(250, 244, 231, 0.56);
  font-size: 9px;
  font-weight: 600;
}

.quiz-badge.correct {
  border-color: transparent;
  color: var(--green-deep);
  background: #c8d8bd;
}

.quiz-badge.wrong {
  border-color: transparent;
  color: #5c2116;
  background: #efb9a5;
}

.quiz-card h2 {
  margin: 0 0 15px;
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  .quiz-card h2 { color: #f3eee1; }
}

.quiz-options {
  display: grid;
  gap: 7px;
}

.quiz-option {
  display: grid;
  grid-template-columns: 21px 1fr;
  gap: 8px;
  align-items: start;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid rgba(250, 244, 231, 0.13);
  border-radius: 12px;
  color: rgba(250, 244, 231, 0.82);
  background: rgba(250, 244, 231, 0.035);
  text-align: left;
  font-size: 11.5px;
  line-height: 1.5;
  transition: all 0.16s var(--ease);
}

.quiz-option:active { transform: scale(0.99); }

.quiz-option .letter {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(250, 244, 231, 0.22);
  border-radius: 50%;
  color: rgba(250, 244, 231, 0.66);
  font-size: 9px;
  font-weight: 700;
}

.quiz-option.selected {
  border-color: rgba(250, 244, 231, 0.55);
  background: rgba(250, 244, 231, 0.1);
}

.quiz-option.correct {
  border-color: #9dbb8f;
  color: #eef6e8;
  background: rgba(138, 173, 120, 0.2);
}

.quiz-option.correct .letter {
  border-color: #9dbb8f;
  color: #1f3424;
  background: #c8d8bd;
}

.quiz-option.wrong {
  border-color: rgba(224, 128, 93, 0.6);
  background: rgba(224, 128, 93, 0.14);
}

.quiz-feedback {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(250, 244, 231, 0.12);
  color: rgba(250, 244, 231, 0.7);
  font-size: 10.5px;
  line-height: 1.7;
}

.quiz-feedback strong {
  display: block;
  margin-bottom: 3px;
  color: #d8e5cf;
  font-size: 11.5px;
}

.quiz-feedback.is-wrong strong { color: #f1b9a2; }

.retry-btn {
  margin-top: 8px;
  padding: 0;
  color: #e9c7a8;
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 30px 2px 0;
}

#eduFilters {
  margin-left: -18px;
  margin-right: -18px;
}

.edu-library {
  display: grid;
  gap: 9px;
}

.edu-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 66%, transparent);
  text-align: left;
  transition: background 0.15s;
}

.edu-card:active { background: var(--card-2); }

.edu-card .era {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.edu-card h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.4;
}

.edu-card .done-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 5px;
  color: var(--sage);
  font-size: 9px;
  font-weight: 600;
}

.edu-card .done-mark .ic { width: 10px; height: 10px; }

.edu-card > .ic {
  width: 13px;
  height: 13px;
  color: var(--faint);
}

/* ---------- settings ---------- */
.settings-card {
  margin-bottom: 12px;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  box-shadow: var(--shadow-soft);
}

.setting-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 64px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child { border-bottom: 0; }

.setting-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.setting-icon .ic { width: 17px; height: 17px; }

.setting-copy { min-width: 0; }

.setting-copy strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12.5px;
  font-weight: 650;
}

.setting-copy small {
  display: block;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.45;
}

.pill-btn {
  min-width: 50px;
  height: 30px;
  padding: 0 12px;
  border-radius: 99px;
  color: var(--paper);
  background: var(--ink);
  font-size: 10px;
  font-weight: 650;
}

@media (prefers-color-scheme: dark) {
  .pill-btn { color: #141612; }
}

.pill-btn.is-on {
  color: var(--green-deep);
  background: #c8d8bd;
}

.pill-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.time-row input[type="time"] {
  width: 79px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--card-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.setting-actions {
  padding: 11px 0 12px;
  border-top: 1px solid var(--line);
}

.ghost-btn {
  height: 37px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: transparent;
  font-size: 10.5px;
  font-weight: 600;
}

.ghost-btn:active { background: var(--card-2); }

.ghost-btn:disabled { opacity: 0.42; cursor: default; }

.ghost-btn.wide {
  width: 100%;
  margin: 2px 0 12px;
}

.push-note {
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.6;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 15px 0;
}

.mini-stat-grid div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border-left: 1px solid var(--line);
}

.mini-stat-grid div:first-child { border-left: 0; }

.mini-stat-grid b {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.mini-stat-grid span {
  color: var(--faint);
  font-size: 9px;
}

.about-card {
  padding: 16px;
}

.about-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
}

.about-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.about-card p.muted { color: var(--faint); }

.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

.danger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 42px;
  margin-top: 4px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 13px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
}

.danger-btn .ic { width: 14px; height: 14px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 480px;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  transform: translateX(-50%);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 46px;
  border-radius: 12px;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.tab .ic {
  width: 20px;
  height: 20px;
  stroke-width: 1.65;
}

.tab.active { color: var(--accent); }

.tab.active .ic {
  stroke-width: 1.9;
}

/* ---------- sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 18, 14, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 0.2s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 100;
  width: 100%;
  max-width: 480px;
  max-height: 84dvh;
  padding: 9px 20px calc(22px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 60px rgba(20, 20, 14, 0.2);
  transform: translateX(-50%);
  animation: sheet-up 0.34s var(--ease) both;
}

@keyframes sheet-up {
  from { transform: translate(-50%, 100%); }
  to { transform: translate(-50%, 0); }
}

.sheet-grab {
  width: 33px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: var(--line-strong);
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sheet-top .kicker { margin: 0; }

.sheet-body {
  max-height: calc(84dvh - 80px);
  padding-top: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sheet-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.35;
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--faint);
  font-size: 10px;
}

.sheet-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.sheet-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.sheet-actions a,
.sheet-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  height: 43px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  font-size: 11px;
  font-weight: 650;
}

.sheet-actions .primary {
  border-color: transparent;
  color: var(--paper);
  background: var(--ink);
}

@media (prefers-color-scheme: dark) {
  .sheet-actions .primary { color: #141612; }
}

.sheet-actions .ic { width: 14px; height: 14px; }

.steps {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 35px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 9px;
  font-weight: 700;
}

.steps strong { color: var(--ink); }

.sheet-word {
  margin-bottom: 4px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.sheet-word-ipa {
  color: var(--faint);
  font-size: 13px;
}

.sheet-word-cn {
  margin: 10px 0 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

.sheet-word-cn .pos {
  font-size: 10px;
}

.sheet-example {
  padding: 14px;
  border-radius: 13px;
  background: var(--card-2);
  font-size: 12.5px;
  line-height: 1.75;
}

.sheet-example .cn {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.sheet-col {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.sheet-actions .speak-wide {
  flex: 0 0 44px;
  width: 44px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav) + 24px + env(safe-area-inset-bottom));
  z-index: 120;
  max-width: min(340px, calc(100vw - 40px));
  padding: 10px 15px;
  border-radius: 99px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-color-scheme: dark) {
  .toast { color: #141612; }
}

/* ---------- desktop ---------- */
@media (min-width: 560px) {
  body {
    padding: 18px 0;
  }

  .app-shell {
    min-height: calc(100dvh - 36px);
    border-radius: 34px;
    overflow: hidden;
  }

  .tabbar {
    bottom: 18px;
    width: 480px;
    border-radius: 0 0 34px 34px;
  }

  .sheet {
    bottom: 18px;
    border-radius: 28px;
  }

  .sheet-grab { display: none; }

  .topbar {
    padding-top: 16px;
  }
}

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