/* =========================================================
   墨卡 · 古诗文单词打卡   设计系统
   ========================================================= */
:root {
  --brand: #5b6cff;
  --brand-2: #8b5cf6;
  --brand-soft: rgba(91, 108, 255, .12);
  --accent: #e5484d;
  --accent-soft: rgba(229, 72, 77, .12);
  --ok: #16a34a;
  --warn: #f59e0b;
  --gold: #d9a441;

  --bg: #f3f5fb;
  --surface: rgba(255, 255, 255, .74);
  --surface-2: rgba(255, 255, 255, .92);
  --surface-solid: #ffffff;
  --border: rgba(23, 26, 45, .09);
  --border-strong: rgba(23, 26, 45, .16);
  --text: #171a26;
  --text-dim: #5a6076;
  --text-mute: #8b90a5;
  --shadow-sm: 0 1px 2px rgba(16, 20, 40, .05), 0 4px 14px rgba(16, 20, 40, .05);
  --shadow-md: 0 2px 6px rgba(16, 20, 40, .06), 0 14px 40px rgba(16, 20, 40, .09);
  --shadow-lg: 0 10px 24px rgba(16, 20, 40, .10), 0 30px 70px rgba(16, 20, 40, .14);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --fs-poem: 1.18rem;
  --anim: 1;
  --sidebar-w: 232px;
}

html[data-theme="dark"] {
  --bg: #0d0f17;
  --surface: rgba(30, 34, 52, .66);
  --surface-2: rgba(38, 43, 64, .92);
  --surface-solid: #1b1f30;
  --border: rgba(255, 255, 255, .085);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e9ebf5;
  --text-dim: #a6abc0;
  --text-mute: #7b8199;
  --brand-soft: rgba(120, 135, 255, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .35), 0 14px 40px rgba(0, 0, 0, .38);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, .45), 0 30px 70px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.6;
}
body.no-anim *, body.no-anim *::before, body.no-anim *::after {
  animation-duration: .001ms !important;
  transition-duration: .001ms !important;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 背景装饰 ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.b1 { width: 46vw; height: 46vw; left: -10vw; top: -14vw; background: radial-gradient(circle, rgba(91,108,255,.55), transparent 68%); animation: float1 26s ease-in-out infinite; }
.b2 { width: 40vw; height: 40vw; right: -8vw; top: 18vh; background: radial-gradient(circle, rgba(139,92,246,.42), transparent 68%); animation: float2 32s ease-in-out infinite; }
.b3 { width: 38vw; height: 38vw; left: 26vw; bottom: -16vw; background: radial-gradient(circle, rgba(236,72,153,.30), transparent 68%); animation: float3 38s ease-in-out infinite; }
html[data-theme="dark"] .blob { opacity: .32; }
@keyframes float1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(6vw,5vh) scale(1.12)} }
@keyframes float2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-7vw,-6vh) scale(1.08)} }
@keyframes float3 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(4vw,-7vh) scale(1.15)} }

/* ---------- 通用 ---------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card { background: var(--surface); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card.pad-lg { padding: 26px; }
.card-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.02rem; margin: 0 0 14px; }
.card-title .sub { font-weight: 400; font-size: .8rem; color: var(--text-mute); }
.spacer { flex: 1; }
.muted { color: var(--text-dim); }
.mute2 { color: var(--text-mute); }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.section-head h2 { font-size: 1.06rem; margin: 0; font-weight: 700; }
.section-head .more { margin-left: auto; font-size: .82rem; color: var(--brand); cursor: pointer; }
.section-head .more:hover { text-decoration: underline; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: .9rem; font-weight: 600;
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, background .2s, border-color .2s;
  user-select: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1.5px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(91,108,255,.32); }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(91,108,255,.42); }
.btn-accent { background: linear-gradient(135deg, #ef5f63, var(--accent)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(229,72,77,.3); }
.btn-ok { background: linear-gradient(135deg, #34c759, var(--ok)); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-lg { padding: 12px 22px; font-size: .98rem; border-radius: 14px; }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: 9px; }
.btn-block { width: 100%; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 1rem; transition: .18s; }
.icon-btn:hover { background: var(--brand-soft); transform: translateY(-1px); }

/* ---------- 登录页 ---------- */
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(430px, 100%); border-radius: var(--r-xl); padding: 34px 30px; box-shadow: var(--shadow-lg); animation: pop .5s cubic-bezier(.2,.9,.3,1.2); }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo { width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center;
  font-family: var(--serif); font-size: 2rem; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 10px 26px rgba(91,108,255,.4); }
.auth-brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: .12em; font-family: var(--serif); }
.auth-brand p { margin: 6px 0 0; color: var(--text-mute); font-size: .86rem; }
.tabs { display: flex; gap: 6px; padding: 5px; background: var(--brand-soft); border-radius: 13px; margin-bottom: 18px; }
.tab { flex: 1; padding: 9px; border-radius: 10px; border: none; background: transparent; cursor: pointer; font-weight: 600; color: var(--text-dim); transition: .2s; }
.tab.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea, .input {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; transition: .18s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-msg { min-height: 20px; margin: 0 0 10px; font-size: .84rem; color: var(--accent); }
.auth-tip { margin: 16px 0 0; font-size: .78rem; color: var(--text-mute); text-align: center; line-height: 1.7; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100dvh; }
.sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px; }
.brand-logo { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-family: var(--serif);
  font-size: 1.3rem; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 16px rgba(91,108,255,.34); }
.brand-text b { display: block; font-size: 1.05rem; letter-spacing: .1em; font-family: var(--serif); }
.brand-text small { color: var(--text-mute); font-size: .74rem; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 13px; color: var(--text-dim);
  font-weight: 600; font-size: .92rem; transition: .18s; position: relative; }
.nav-item .ni { font-size: 1.05rem; width: 22px; text-align: center; }
.nav-item:hover { background: var(--brand-soft); color: var(--text); transform: translateX(2px); }
.nav-item.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 18px rgba(91,108,255,.32); }
.side-foot { margin-top: auto; }
.streak-mini { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 11px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(229,72,77,.14)); border: 1px solid var(--border); }
.streak-mini .flame { font-size: 1.05rem; animation: flicker 2.4s ease-in-out infinite; }
.streak-mini b { font-size: 1.15rem; font-family: var(--serif); }
.streak-mini small { color: var(--text-mute); font-size: .74rem; }
@keyframes flicker { 0%,100%{transform:scale(1) rotate(-2deg)} 50%{transform:scale(1.16) rotate(2deg)} }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom: 1px solid var(--border); }
.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search-wrap input { width: 100%; padding: 10px 15px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); outline: none; transition: .2s; }
.search-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface-2); }
.search-pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: 60vh; overflow: auto; border-radius: var(--r); padding: 8px; z-index: 40; box-shadow: var(--shadow-md); }
.search-item { padding: 9px 12px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.search-item:hover { background: var(--brand-soft); }
.search-item .t { font-weight: 600; }
.search-item .d { margin-left: auto; font-size: .76rem; color: var(--text-mute); }
.top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 13px 5px 5px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; transition: .18s; }
.user-chip:hover { border-color: var(--brand); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.uname { font-size: .86rem; font-weight: 600; }

.view { padding: 24px; flex: 1; max-width: 1180px; width: 100%; margin: 0 auto; animation: fadeUp .32s ease both; }
.tabbar { display: none; }
.loading { display: grid; place-items: center; gap: 12px; padding: 80px 0; color: var(--text-mute); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 28px 30px; margin-bottom: 22px;
  background: linear-gradient(135deg, rgba(91,108,255,.14), rgba(139,92,246,.10) 45%, rgba(236,72,153,.10));
  border: 1px solid var(--border); }
.hero h1 { margin: 0 0 6px; font-size: 1.5rem; font-family: var(--serif); letter-spacing: .04em; }
.hero p { margin: 0; color: var(--text-dim); font-size: .92rem; }
.hero .ring-row { display: flex; align-items: center; gap: 26px; margin-top: 20px; flex-wrap: wrap; }
.ring { position: relative; width: 112px; height: 112px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-size: 1.5rem; font-family: var(--serif); display: block; line-height: 1.1; }
.ring .val small { color: var(--text-mute); font-size: .72rem; }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.hstat b { display: block; font-size: 1.42rem; font-family: var(--serif); line-height: 1.2; }
.hstat small { color: var(--text-mute); font-size: .78rem; }

.mini-card { display: flex; align-items: center; gap: 13px; padding: 15px 16px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); transition: .2s; }
.mini-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.mini-card .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; background: var(--brand-soft); flex: 0 0 auto; }
.mini-card b { display: block; font-size: .95rem; }
.mini-card small { color: var(--text-mute); font-size: .78rem; }

.heat { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat-col { display: flex; flex-direction: column; gap: 3px; }
.heat-cell { width: 13px; height: 13px; border-radius: 3.5px; background: var(--border); transition: .15s; }
.heat-cell:hover { transform: scale(1.28); }
.heat-cell.l1 { background: color-mix(in srgb, var(--brand) 30%, transparent); }
.heat-cell.l2 { background: color-mix(in srgb, var(--brand) 55%, transparent); }
.heat-cell.l3 { background: color-mix(in srgb, var(--brand) 78%, transparent); }
.heat-cell.l4 { background: var(--brand); }
.heat-legend { display: flex; align-items: center; gap: 5px; font-size: .74rem; color: var(--text-mute); margin-top: 8px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--brand), var(--brand-2));
  min-height: 4px; transition: height .5s cubic-bezier(.2,.9,.3,1); position: relative; }
.bars .bar-col:hover .bar { filter: brightness(1.12); }
.bars .lbl { font-size: .7rem; color: var(--text-mute); }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ach { padding: 12px 8px; border-radius: var(--r); text-align: center; border: 1px solid var(--border); background: var(--surface); transition: .2s; }
.ach .em { font-size: 1.5rem; filter: grayscale(1); opacity: .45; transition: .2s; }
.ach.got .em { filter: none; opacity: 1; animation: pop .4s cubic-bezier(.2,.9,.3,1.4); }
.ach.got { border-color: color-mix(in srgb, var(--gold) 55%, transparent); background: linear-gradient(160deg, rgba(217,164,65,.14), transparent); }
.ach b { display: block; font-size: .78rem; margin-top: 4px; }
.ach small { color: var(--text-mute); font-size: .68rem; }

/* ---------- 列表 / 卡片 ---------- */
.book-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.book-tab { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-size: .87rem; font-weight: 600; white-space: nowrap; transition: .18s; color: var(--text-dim); }
.book-tab:hover { border-color: var(--brand); color: var(--text); }
.book-tab.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 5px 14px rgba(91,108,255,.3); }

.poem-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); transition: .2s; }
.poem-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
.poem-card .idx { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-family: var(--serif);
  background: var(--brand-soft); color: var(--brand); font-weight: 700; flex: 0 0 auto; }
.poem-card .info { flex: 1; min-width: 0; }
.poem-card .info b { display: block; font-family: var(--serif); font-size: 1.02rem; }
.poem-card .info small { color: var(--text-mute); font-size: .78rem; }
.poem-card .tail { text-align: right; flex: 0 0 auto; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 600;
  background: var(--brand-soft); color: var(--brand); }
.pill.done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.doing { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.lock { background: var(--border); color: var(--text-mute); }
.pill.ai { background: linear-gradient(135deg, rgba(139,92,246,.18), rgba(91,108,255,.18)); color: var(--brand-2); }

.progress-line { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-line > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .6s cubic-bezier(.2,.9,.3,1); }

/* ---------- 单词 ---------- */
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.word-card { position: relative; padding: 16px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: .2s; overflow: hidden; }
.word-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.word-card .w { font-size: 1.16rem; font-weight: 700; letter-spacing: .01em; }
.word-card .ph { color: var(--text-mute); font-size: .82rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.word-card .cn { margin-top: 7px; font-size: .92rem; color: var(--text-dim); }
.word-card .ex { margin-top: 9px; font-size: .8rem; color: var(--text-mute); border-top: 1px dashed var(--border); padding-top: 8px; }
.word-card .lv { position: absolute; top: 12px; right: 12px; display: flex; gap: 2.5px; }
.word-card .lv i { width: 5px; height: 5px; border-radius: 50%; background: var(--border-strong); }
.word-card .lv i.on { background: var(--brand); }
.word-card .star { position: absolute; bottom: 12px; right: 12px; opacity: .35; }
.word-card.starred .star { opacity: 1; }
.word-card.speaking { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.unit-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; }
.unit-head h3 { margin: 0; font-size: 1rem; font-family: var(--serif); }
.unit-head .progress-line { flex: 1; max-width: 220px; }

/* ---------- 学习卡（翻转） ---------- */
.study-wrap { max-width: 660px; margin: 0 auto; }
.flash { perspective: 1400px; cursor: pointer; }
.flash-inner { position: relative; transition: transform .55s cubic-bezier(.2,.9,.3,1); transform-style: preserve-3d; min-height: 300px; }
.flash.flip .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--r-xl); padding: 34px 28px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px;
  border: 1px solid var(--border); background: var(--surface-2); box-shadow: var(--shadow-md); }
.flash-back { transform: rotateY(180deg); }
.flash-face .big-w { font-size: 2.5rem; font-weight: 800; letter-spacing: -.01em; }
.flash-face .big-ph { color: var(--text-mute); font-family: ui-monospace, Menlo, Consolas, monospace; }
.flash-face .big-cn { font-size: 1.5rem; font-family: var(--serif); }
.study-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* ---------- 详情页 ---------- */
.detail-head { border-radius: var(--r-xl); padding: 26px 28px; margin-bottom: 18px; border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(91,108,255,.10), rgba(139,92,246,.07)); }
.detail-head h1 { margin: 0; font-family: var(--serif); font-size: 1.75rem; letter-spacing: .03em; }
.detail-head .meta { margin-top: 7px; color: var(--text-dim); font-size: .87rem; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.detail-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }

.poem-body { font-family: var(--serif); font-size: var(--fs-poem); line-height: 2.15; }
.poem-body p { margin: 0 0 4px; }
.line { padding: 3px 8px; margin: 0 -8px; border-radius: 9px; transition: background .2s; }
.line.clickable { cursor: pointer; }
.line.clickable:hover { background: var(--brand-soft); }
.line.active { background: color-mix(in srgb, var(--brand) 20%, transparent); }
.line .note { display: block; font-family: var(--sans); font-size: .84rem; color: var(--text-dim); margin-top: 4px;
  padding: 9px 13px; border-left: 3px solid var(--brand); background: var(--surface); border-radius: 0 10px 10px 0; animation: fadeUp .25s both; }
.line .note .tr { color: var(--text-mute); margin-top: 4px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.kv { padding: 11px 13px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border); }
.kv b { font-family: var(--serif); }
.kv span { display: block; color: var(--text-dim); font-size: .84rem; margin-top: 3px; }

/* 挖空 */
.blank { display: inline-block; min-width: 1.1em; border-bottom: 2px solid var(--brand); text-align: center; color: var(--brand); font-weight: 700; }
.blank-input { display: inline-block; width: 1.6em; padding: 0 2px; text-align: center; border: none; border-bottom: 2px solid var(--brand);
  background: transparent; font: inherit; color: var(--brand); outline: none; }
.blank-input.ok { color: var(--ok); border-color: var(--ok); }
.blank-input.bad { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(12, 14, 24, .42); backdrop-filter: blur(6px); animation: fadeIn .2s both; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal { width: min(560px, 100%); max-height: 86dvh; overflow: auto; border-radius: var(--r-xl); padding: 24px;
  background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .3s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 1.1rem; font-family: var(--serif); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: #fff;
  background: rgba(24, 27, 43, .93); box-shadow: var(--shadow-md); animation: toastIn .3s cubic-bezier(.2,.9,.3,1.3); }
.toast.ok { background: linear-gradient(135deg, #2fb457, var(--ok)); }
.toast.err { background: linear-gradient(135deg, #ef5f63, var(--accent)); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.94) } to { opacity: 1; transform: none } }

/* ---------- AI ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 84%; padding: 12px 16px; border-radius: 16px; line-height: 1.75; font-size: .93rem; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-bottom-right-radius: 5px; }
.msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg.ai.pending { color: var(--text-mute); }
.ai-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ai-quick button { padding: 7px 13px; border-radius: 999px; border: 1px dashed var(--border-strong); background: transparent;
  cursor: pointer; font-size: .82rem; color: var(--text-dim); transition: .18s; }
.ai-quick button:hover { border-style: solid; border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.composer { position: sticky; bottom: 0; display: flex; gap: 10px; padding-top: 12px; background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.composer textarea { flex: 1; resize: none; padding: 12px 15px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; max-height: 140px; }
.composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- 设置 ---------- */
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px dashed var(--border); }
.set-row:last-child { border-bottom: none; }
.set-row .info { flex: 1; min-width: 0; }
.set-row .info b { display: block; font-size: .93rem; }
.set-row .info small { color: var(--text-mute); font-size: .78rem; }
.switch { width: 46px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer;
  transition: .24s; flex: 0 0 auto; border: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: .24s cubic-bezier(.2,.9,.3,1.4); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.switch.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.switch.on::after { left: 23px; }
.seg { display: inline-flex; padding: 4px; gap: 3px; background: var(--brand-soft); border-radius: 11px; }
.seg button { padding: 6px 13px; border-radius: 8px; border: none; background: transparent; cursor: pointer; font-size: .83rem; font-weight: 600; color: var(--text-dim); }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }

.empty { text-align: center; padding: 56px 20px; color: var(--text-mute); }
.empty .em { font-size: 2.6rem; margin-bottom: 10px; opacity: .7; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* ---------- 响应式 ---------- */
.only-mobile { display: none; }
@media (max-width: 860px) {
  .only-mobile { display: grid; }
  .tabbar.only-mobile { display: flex; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; background: var(--surface-solid); transform: translateX(-100%); transition: transform .3s cubic-bezier(.2,.9,.3,1); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .view { padding: 16px 14px 84px; }
  .topbar { padding: 11px 14px; }
  .uname { display: none; }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 1.24rem; }
  .detail-head { padding: 20px 18px; }
  .detail-head h1 { font-size: 1.4rem; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: var(--surface-solid);
    border-top: 1px solid var(--border); padding: 7px 4px calc(7px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(0,0,0,.07); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--text-mute); font-weight: 600; }
  .tabbar a span { font-size: 1.15rem; }
  .tabbar a.active { color: var(--brand); }
  .word-grid { grid-template-columns: 1fr; }
  .flash-face { min-height: 250px; padding: 26px 20px; }
  .flash-face .big-w { font-size: 2rem; }
}
@media (min-width: 861px) { .sidebar { display: flex !important; } }
