* { box-sizing: border-box; }
:root {
  --blue: #1a73e8; --blue-dark: #1557b0; --green: #1e8e3e; --red: #d93025;
  --amber: #e37400; --bg: #f6f8fb; --card: #fff; --text: #202124;
  --muted: #5f6368; --border: #dadce0; --chip: #e8f0fe; --radius: 14px;
}
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }

.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 680px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 700; font-size: 18px; }
.topbar-user { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.topbar-user button { background: none; border: none; color: var(--blue); font-size: 13px; padding: 4px; cursor: pointer; }

.container { max-width: 680px; margin: 0 auto; padding: 16px 16px 110px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--border); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; padding: 12px 4px 10px; font-size: 13px; color: var(--muted); }
.tabs a.active { color: var(--blue); font-weight: 700; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

.btn { display: inline-block; border: none; border-radius: 10px; padding: 12px 20px; font-size: 16px; cursor: pointer; background: var(--blue); color: #fff; font-weight: 600; }
.btn:active { background: var(--blue-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-secondary { background: #f1f3f4; color: var(--text); }
.btn-danger { background: #fce8e6; color: var(--red); }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost { background: none; color: var(--blue); padding: 8px 10px; font-size: 14px; }
.btn-sm { padding: 8px 14px; font-size: 14px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
  width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; color: var(--text); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }
textarea { min-height: 110px; resize: vertical; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 90px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat .num { font-size: 24px; font-weight: 700; }
.stat .lbl { font-size: 12px; color: var(--muted); }

.progress-bar { height: 10px; background: #e8eaed; border-radius: 5px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--blue); transition: width .3s; }

.word-big { font-size: 34px; font-weight: 700; line-height: 1.2; word-break: break-word; }
.phonetic { color: var(--muted); font-size: 16px; margin: 6px 0; }
.sense { margin: 8px 0; }
.sense .pos { display: inline-block; background: var(--chip); color: var(--blue-dark); border-radius: 6px; padding: 1px 8px; font-size: 13px; margin-right: 6px; }
.example { background: #f8f9fa; border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.example .zh { color: var(--muted); font-size: 13px; margin-top: 2px; }
.chip { display: inline-block; background: var(--chip); color: var(--blue-dark); border-radius: 20px; padding: 3px 12px; font-size: 13px; margin: 2px 4px 2px 0; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 12px; margin-left: 6px; }
.badge-new { background: #e8f0fe; color: var(--blue-dark); }
.badge-learning { background: #fef7e0; color: #b06000; }
.badge-review { background: #e6f4ea; color: var(--green); }
.badge-mastered { background: #e6f4ea; color: var(--green); font-weight: 700; }
.badge-due { background: #fce8e6; color: var(--red); }

.quiz-option { display: block; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--border); border-radius: 12px; padding: 14px 16px; font-size: 17px; margin-bottom: 10px; cursor: pointer; color: var(--text); }
.quiz-option:active { border-color: var(--blue); background: #f8fbff; }
.quiz-option.correct { border-color: var(--green); background: #e6f4ea; }
.quiz-option.wrong { border-color: var(--red); background: #fce8e6; }
.quiz-option:disabled { cursor: default; opacity: 1; }

.feedback { border-radius: 12px; padding: 14px; margin-top: 12px; }
.feedback.ok { background: #e6f4ea; }
.feedback.bad { background: #fce8e6; }
.feedback .title { font-weight: 700; font-size: 18px; }

.audio-btn { background: var(--chip); border: none; border-radius: 50%; width: 56px; height: 56px; font-size: 26px; cursor: pointer; }
.audio-btn-sm { background: var(--chip); border: none; border-radius: 20px; padding: 6px 14px; font-size: 15px; cursor: pointer; margin-right: 6px; }

.bank-row { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.bank-row .w { font-weight: 700; font-size: 17px; }
.bank-row .zh { color: var(--muted); font-size: 14px; margin-top: 2px; }
.bank-row.expanded { cursor: default; }
.bank-detail { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; flex: 1; min-width: 110px; padding: 10px; font-size: 14px; }
.filters .toggle { background: #fff; border: 1.5px solid var(--border); border-radius: 20px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.filters .toggle.on { background: var(--blue); color: #fff; border-color: var(--blue); }

.nb-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .nb-grid { grid-template-columns: 1fr 1fr; } }
.nb-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.nb-card.removed { opacity: .55; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { aspect-ratio: 1; border-radius: 6px; background: #ebedf0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--muted); }
.cal-cell.l1 { background: #c6e48b; color: #1e4620; }
.cal-cell.l2 { background: #7bc96f; color: #fff; }
.cal-cell.l3 { background: #239a3b; color: #fff; }
.cal-cell.l4 { background: #196127; color: #fff; }
.cal-cell.today { outline: 2px solid var(--blue); }

.bar-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.bar-row .d { width: 74px; color: var(--muted); }
.bar-row .bar { flex: 1; height: 12px; background: #e8eaed; border-radius: 6px; overflow: hidden; }
.bar-row .bar > div { height: 100%; background: var(--blue); }
.bar-row .n { width: 30px; text-align: right; }

.hist-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f3f4; font-size: 14px; }
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button { width: 44px; height: 44px; font-size: 22px; border-radius: 50%; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.stepper .val { font-size: 26px; font-weight: 700; min-width: 48px; text-align: center; }
.error { background: #fce8e6; color: var(--red); border-radius: 10px; padding: 12px; margin-bottom: 12px; font-size: 14px; }
.ok-msg { background: #e6f4ea; color: var(--green); border-radius: 10px; padding: 12px; margin-bottom: 12px; font-size: 14px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 16px 100px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
