/* ==========================================================================
   四级词汇通 · CET-4 Vocabulary — 全局样式
   手机 / 电脑 自适应
   ========================================================================== */

:root {
  --bg:          #f4f5fb;
  --bg-grad:     radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0%, transparent 60%),
                 radial-gradient(900px 500px at 100% 0%, #fae8ff 0%, transparent 55%), #f4f5fb;
  --surface:     #ffffff;
  --surface-2:   #f8f9fd;
  --surface-3:   #eef0f8;
  --border:      #e3e5f0;
  --text:        #1a1c2e;
  --text-2:      #5b6079;
  --text-3:      #8b90a8;
  --primary:     #4f46e5;
  --primary-2:   #6366f1;
  --primary-soft:#eef0ff;
  --primary-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --success:     #10b981;
  --success-soft:#e7f8f1;
  --warn:        #f59e0b;
  --warn-soft:   #fef4e2;
  --danger:      #ef4444;
  --danger-soft: #fdecec;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 1px 2px rgba(24,26,45,.05), 0 8px 24px -12px rgba(24,26,45,.18);
  --shadow-lg:   0 20px 60px -20px rgba(24,26,45,.35);
  --side-w:      236px;
  --safe-b:      env(safe-area-inset-bottom, 0px);
  --safe-t:      env(safe-area-inset-top, 0px);
}

html[data-theme="dark"] {
  --bg:          #0f1018;
  --bg-grad:     radial-gradient(1000px 500px at 8% -10%, #1e2340 0%, transparent 55%),
                 radial-gradient(900px 450px at 100% 0%, #241a3a 0%, transparent 55%), #0f1018;
  --surface:     #171926;
  --surface-2:   #1d2030;
  --surface-3:   #262a3d;
  --border:      #2b2f45;
  --text:        #eef0f8;
  --text-2:      #a7adc4;
  --text-3:      #767d95;
  --primary:     #818cf8;
  --primary-2:   #a78bfa;
  --primary-soft:#232547;
  --primary-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --success-soft:#13291f;
  --warn-soft:   #2c2210;
  --danger-soft: #2d1617;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 10px 30px -16px rgba(0,0,0,.7);
  --shadow-lg:   0 24px 70px -24px rgba(0,0,0,.85);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

#app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============================ 侧边栏 ============================ */
.sidebar {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  padding: 20px 14px;
  gap: 18px;
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--primary-grad);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px -6px rgba(79,70,229,.7);
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; }
.brand-text span { font-size: 11px; color: var(--text-3); letter-spacing: .5px; }

.nav-side { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background .16s, color .16s, transform .1s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:active { transform: scale(.98); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.nav-item .ico { font-size: 17px; width: 22px; text-align: center; flex: 0 0 auto; }
.nav-item .badge-count {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.nav-item.active .badge-count { background: var(--primary); color: #fff; }

.side-foot { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--text-3); }
.tiny { font-size: 11px; line-height: 1.5; }

/* ============================ 主区 ============================ */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px clamp(14px, 4vw, 36px);
  padding-top: calc(14px + var(--safe-t));
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: 17px;
  margin: 0;
  font-weight: 650;
  letter-spacing: .2px;
}
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 17px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .16s, color .16s, transform .1s;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.93); }

.only-mobile { display: none; }

.content {
  flex: 1;
  padding: clamp(14px, 4vw, 36px);
  padding-bottom: calc(96px + var(--safe-b));
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn .28s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================ 底部导航（手机） ============================ */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
  z-index: 55;
}
.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  max-width: 640px;
  margin: 0 auto;
}
.nav-tab {
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
  font-size: 11px;
  padding: 9px 4px 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  transition: color .16s;
}
.nav-tab .ico { font-size: 20px; line-height: 1; }
.nav-tab.active { color: var(--primary); font-weight: 650; }

/* ============================ 通用组件 ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(14px, 3vw, 22px);
  box-shadow: var(--shadow);
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 550;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s, transform .1s, box-shadow .16s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }

.btn.primary {
  background: var(--primary-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(79,70,229,.85);
}
.btn.primary:hover { filter: brightness(1.07); background: var(--primary-grad); }

.btn.success { background: var(--success); border-color: transparent; color: #fff; }
.btn.danger  { background: var(--danger);  border-color: transparent; color: #fff; }
.btn.ghost   { background: transparent; }
.btn.small    { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn.large    { padding: 14px 24px; font-size: 16px; border-radius: 12px; }
.btn.full     { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 7px; }
.spacer { flex: 1; }
.section-title {
  font-size: 15px; font-weight: 680; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .hint { font-size: 12px; font-weight: 400; color: var(--text-3); }
.section { margin-bottom: 26px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* 表单 */
input[type=text], input[type=number], input[type=search], select, textarea {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  width: 100%;
  transition: border-color .16s, box-shadow .16s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.7; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 550; }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: 20px;
  background: var(--surface-3); border: 1px solid var(--border);
  position: relative; transition: background .2s; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* 标签 / 徽章 */
.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 550;
  white-space: nowrap;
}
.tag.primary { background: var(--primary-soft); color: var(--primary); }
.tag.success { background: var(--success-soft); color: var(--success); }
.tag.warn    { background: var(--warn-soft); color: var(--warn); }
.tag.danger  { background: var(--danger-soft); color: var(--danger); }

/* 统计块 */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(14px, 3vw, 19px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -28px; top: -28px;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--primary-soft); opacity: .55;
}
.stat .label { font-size: 12.5px; color: var(--text-3); margin-bottom: 5px; }
.stat .value { font-size: clamp(22px, 5vw, 30px); font-weight: 720; line-height: 1.2; letter-spacing: -.5px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .sub { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.stat.ok .value { color: var(--success); }
.stat.warn .value { color: var(--warn); }

/* 进度条 */
.bar { height: 9px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: 20px;
  background: var(--primary-grad);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.bar.sm { height: 6px; }

/* ============================ 首页 ============================ */
.hero {
  background: var(--primary-grad);
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 30px);
  margin-bottom: 20px;
  box-shadow: 0 18px 44px -22px rgba(79,70,229,.95);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.22), transparent 45%);
}
.hero > * { position: relative; }
.hero h2 { margin: 0 0 6px; font-size: clamp(19px, 4.4vw, 25px); letter-spacing: .3px; }
.hero p { margin: 0; opacity: .92; font-size: 14px; }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero-actions .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; backdrop-filter: blur(6px); }
.hero-actions .btn:hover { background: rgba(255,255,255,.26); }
.hero-actions .btn.solid { background: #fff; color: var(--primary); border-color: #fff; font-weight: 680; }

/* ============================ 词库列表 ============================ */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.toolbar .search { position: relative; flex: 1 1 220px; min-width: 160px; }
.toolbar .search input { padding-left: 38px; }
.toolbar .search::before {
  content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: .55; pointer-events: none;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 20px;
  padding: 7px 15px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: all .16s;
  white-space: nowrap;
}
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.word-list { display: flex; flex-direction: column; gap: 9px; }

.word-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color .16s, background .16s, transform .1s;
  cursor: pointer;
}
.word-row:hover { border-color: var(--primary-2); background: var(--surface-2); }
.word-row:active { transform: scale(.995); }
.word-row .w-main { flex: 1; min-width: 0; }
.word-row .w-en { font-weight: 680; font-size: 15.5px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.word-row .w-ph { font-size: 12.5px; color: var(--text-3); font-family: ui-monospace, Consolas, monospace; }
.word-row .w-cn { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-row .w-act { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.word-row.unknown .w-en { color: var(--text-2); }
.word-row.known .w-en { color: var(--success); }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--text-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty .big { font-size: 44px; display: block; margin-bottom: 10px; }

/* ============================ 背诵卡片 ============================ */
.study-top {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.study-progress-text { font-size: 13px; color: var(--text-2); font-weight: 550; }

.card-stage { perspective: 1500px; }

.flip {
  position: relative;
  width: 100%;
  min-height: clamp(290px, 46vh, 400px);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
}
.flip.flipped { transform: rotateY(180deg); }

.face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: auto;
}

.face-front {
  background: var(--surface);
  background-image: radial-gradient(circle at 50% 0%, var(--primary-soft) 0%, transparent 55%);
}
.face-back {
  background: var(--surface);
  transform: rotateY(180deg);
  gap: 12px;
}

.face .f-pos { font-size: 12px; color: var(--text-3); letter-spacing: 1.5px; text-transform: uppercase; }
.face .f-word {
  font-size: clamp(30px, 8.5vw, 52px);
  font-weight: 750;
  letter-spacing: -1px;
  margin: 8px 0 4px;
  word-break: break-word;
  line-height: 1.25;
}
.face .f-ph { font-size: clamp(14px, 3.6vw, 18px); color: var(--primary); font-family: ui-monospace, Consolas, monospace; }
.face .f-hint { margin-top: 22px; font-size: 12.5px; color: var(--text-3); }
.face .f-hint kbd {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-size: 11px; font-family: inherit;
}

.face .f-meaning { font-size: clamp(17px, 4.4vw, 23px); font-weight: 640; line-height: 1.55; }
.face .f-example {
  font-size: clamp(14px, 3.5vw, 17px);
  color: var(--text-2);
  font-style: italic;
  max-width: 640px;
  line-height: 1.7;
}
.face .f-example b { color: var(--primary); font-style: normal; font-weight: 680; }
.face .f-exampleCn { font-size: clamp(13px, 3.2vw, 15px); color: var(--text-3); max-width: 640px; }

.study-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.study-controls .btn { padding: 13px 10px; font-size: 15px; }

/* ============================ 测验 ============================ */
.quiz-wrap { max-width: 720px; margin: 0 auto; }

.quiz-progress {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.quiz-progress .bar { flex: 1; }
.quiz-progress .num { font-size: 13px; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.quiz-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 5vw, 30px);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.quiz-stem { font-size: clamp(22px, 6vw, 32px); font-weight: 700; margin-bottom: 6px; word-break: break-word; }
.quiz-stem .ph { font-family: ui-monospace, Consolas, monospace; color: var(--primary); }
.quiz-stem .cn { font-size: .82em; color: var(--text-3); font-weight: 500; }
.quiz-qzh { font-size: clamp(17px, 4.4vw, 21px); font-weight: 620; margin-bottom: 6px; }
.quiz-qzh .pos { color: var(--text-3); font-weight: 400; font-size: .78em; margin-right: 8px; }

.opts { display: grid; gap: 10px; margin-top: 16px; }
.opt {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  transition: all .16s;
  line-height: 1.5;
}
.opt .key {
  width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: 8px; background: var(--surface-3);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
}
.opt:hover:not(:disabled) { border-color: var(--primary-2); background: var(--primary-soft); }
.opt:disabled { cursor: default; }
.opt.correct { border-color: var(--success); background: var(--success-soft); color: var(--success); font-weight: 600; }
.opt.correct .key { background: var(--success); color: #fff; }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.opt.wrong .key { background: var(--danger); color: #fff; }

.feedback {
  margin-top: 14px; padding: 13px 15px;
  border-radius: 12px; font-size: 14px; line-height: 1.75;
  animation: fadeIn .25s ease;
}
.feedback.ok { background: var(--success-soft); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 30%, transparent); }
.feedback.no { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.feedback b { font-weight: 700; }

.quiz-result { text-align: center; }
.quiz-score {
  font-size: clamp(52px, 16vw, 88px);
  font-weight: 800;
  line-height: 1;
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
}
.score-ring { display: flex; justify-content: center; margin-bottom: 6px; }

/* ============================ 统计 ============================ */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .dow { text-align: center; font-size: 11px; color: var(--text-3); padding-bottom: 4px; }
.cal .day {
  aspect-ratio: 1; border-radius: 7px; background: var(--surface-3);
  display: grid; place-items: center; font-size: 12px; color: var(--text-2);
  border: 1px solid transparent;
}
.cal .day.lv1 { background: color-mix(in srgb, var(--primary) 28%, transparent); color: var(--primary); }
.cal .day.lv2 { background: color-mix(in srgb, var(--primary) 55%, transparent); color: #fff; }
.cal .day.lv3 { background: var(--primary); color: #fff; }
.cal .day.today { border-color: var(--primary); font-weight: 700; }
.cal .day.empty { background: transparent; }

/* ============================ 导入导出 ============================ */
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
pre.code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 15px;
  font-size: 12px; line-height: 1.75; overflow: auto;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  margin: 0; white-space: pre; color: var(--text-2);
}
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px 18px;
  text-align: center;
  color: var(--text-3);
  cursor: pointer;
  transition: all .18s;
  background: var(--surface-2);
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone .big { font-size: 38px; display: block; margin-bottom: 8px; }

.preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview-table th, .preview-table td {
  padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.preview-table th { color: var(--text-3); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--surface); }
.preview-scroll { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }

/* ============================ 模态框 ============================ */
.modal-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(12,14,25,.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-scrim.show { display: flex; animation: fadeIn .2s ease; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%; max-width: 620px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: pop .24s cubic-bezier(.3,1.3,.5,1);
  border: 1px solid var(--border);
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

/* ============================ Toast ============================ */
.toast-wrap {
  position: fixed; z-index: 300;
  top: calc(16px + var(--safe-t)); right: 16px;
  display: flex; flex-direction: column; gap: 9px;
  pointer-events: none;
  max-width: min(340px, 88vw);
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 12px 15px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: slideIn .3s cubic-bezier(.3,1.2,.5,1);
  pointer-events: auto;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.toast.out { animation: slideOut .3s ease forwards; }
@keyframes slideOut { to { opacity: 0; transform: translateX(40px); } }

/* 加载 */
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================ 响应式 ============================ */
@media (max-width: 899px) {
  #app { display: block; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 262px;
    transform: translateX(-102%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  .only-mobile { display: grid; }
  .bottom-nav { display: block; }
  .content { padding-bottom: calc(88px + var(--safe-b)); }
  .scrim {
    position: fixed; inset: 0; z-index: 59;
    background: rgba(12,14,25,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .study-controls { grid-template-columns: 1fr 1fr; }
  .import-grid { grid-template-columns: 1fr; }
  .toast-wrap { left: 16px; right: 16px; top: auto; bottom: calc(96px + var(--safe-b)); max-width: none; }
  .word-row { flex-wrap: wrap; }
  .word-row .w-cn { white-space: normal; width: 100%; }
}

@media (max-width: 420px) {
  .grid-3, .grid-4 { grid-template-columns: minmax(0,1fr); }
  .content { padding: 13px; }
  .opt { font-size: 14px; padding: 12px 13px; }
}

@media (min-width: 900px) {
  .nav-bottom-hide { }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================ 云端同步 & 管理员 UI ============================ */
.form-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.form-row label { min-width: 80px; color: var(--text-2); font-size: 14px; }
.form-row input, .form-row select, .form-row textarea { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 14px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-row .checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.form-row .checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

.table-wrap { overflow-x: auto; margin-top: 12px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap th, .table-wrap td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.table-wrap th { background: var(--surface-2); color: var(--text-2); font-weight: 600; position: sticky; top: 0; }
.table-wrap tr:hover td { background: var(--surface-2); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.badge.admin { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; }
.badge.user { background: var(--primary-soft); color: var(--primary); }

.user-menu { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-name { font-weight: 600; font-size: 14px; color: var(--text); }
.user-name .badge { margin-left: 6px; vertical-align: middle; }

.account-info h4 { margin: 16px 0 8px; font-size: 14px; color: var(--text-2); }
.account-info hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-grid div { background: var(--surface-2); padding: 10px; border-radius: var(--radius-sm); text-align: center; }
.stat-grid strong { display: block; font-size: 18px; color: var(--primary); }
.stat-grid span { font-size: 11px; color: var(--text-3); text-transform: uppercase; }

.admin-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 2px solid var(--border); }
.tab-btn { padding: 8px 16px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; transition: color .2s, border-color .2s; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { animation: fadeIn .2s; }
.tab-panel.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.modal-body .form-row textarea { min-height: 120px; resize: vertical; font-family: inherit; }

.btn.tiny { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn.ghost.tiny { color: var(--danger); }
.btn.ghost.tiny:hover { background: var(--danger-soft); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
