/* ============================================================
   Hanzi Academy · 汉字学院  — 设计系统
   东方纸墨美学 × 现代产品界面
   ============================================================ */

:root {
  /* 色彩 */
  --ink: #1c1917;          /* 墨色 */
  --ink-2: #57534e;
  --ink-3: #8a857e;
  --paper: #fffaf2;        /* 宣纸 */
  --paper-2: #faf3e6;
  --card: #ffffff;
  --line: #e8dfce;
  --vermilion: #c2410c;    /* 朱砂 */
  --vermilion-deep: #9a3412;
  --vermilion-soft: #fdeee6;
  --gold: #d97706;         /* 金 */
  --gold-soft: #fdf3e0;
  --jade: #0d9488;         /* 青玉 */
  --jade-soft: #e6f7f4;
  --blue: #1d4ed8;
  --blue-soft: #e8eefd;
  --purple: #7c3aed;
  --purple-soft: #f0eafd;
  --pink: #db2777;
  --pink-soft: #fce8f1;
  --good: #15803d;
  --bad: #dc2626;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-han: "Songti SC", "Noto Serif SC", "STSong", "SimSun", "Kaiti SC", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* 尺寸 */
  --sidebar-w: 236px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .05), 0 1px 3px rgba(28, 25, 23, .06);
  --shadow-md: 0 4px 12px rgba(28, 25, 23, .08), 0 2px 4px rgba(28, 25, 23, .05);
  --shadow-lg: 0 12px 32px rgba(28, 25, 23, .14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------------- 布局 ---------------- */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #2b2118 0%, #1f1812 100%);
  color: #e9e2d6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-seal {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, var(--vermilion), #b91c1c);
  color: #fff; font-family: var(--font-han); font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(192, 38, 38, .35);
  flex-shrink: 0;
}
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .02em; color: #fff; }
.brand-sub { font-size: 11px; color: #a89e8e; letter-spacing: .14em; text-transform: uppercase; }

.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-section { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #8d8374; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 10px;
  color: #cfc6b6; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px; width: 100%; border: none; background: none; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--vermilion); color: #fff; box-shadow: 0 3px 10px rgba(192,38,38,.35); }
.nav-item .nav-ico { width: 20px; text-align: center; font-size: 16px; }
.nav-item .nav-badge {
  margin-left: auto; background: rgba(255,255,255,.16); color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 20px; font-weight: 600;
}
.nav-item:not(.active) .nav-badge { background: var(--gold); color: #431407; }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: #8d8374; }
.sidebar-foot .level-bar { height: 5px; background: rgba(255,255,255,.12); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.sidebar-foot .level-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--vermilion)); border-radius: 4px; transition: width .4s; }

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

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: rgba(255,250,242,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar .crumb { font-size: 13px; color: var(--ink-3); }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line); border-radius: 30px;
  padding: 6px 13px; font-size: 13px; font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
.stat-pill .fire { color: var(--vermilion); }
.stat-pill .xp-ico { color: var(--gold); }

.content { flex: 1; padding: 26px 30px 60px; max-width: 1080px; width: 100%; margin: 0 auto; }

/* ---------------- 通用组件 ---------------- */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 25px; font-weight: 800; letter-spacing: -.01em; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; font-size: 14px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 10px; padding: 9px 16px;
  font-size: 14px; font-weight: 600; transition: all .15s;
}
.btn-primary { background: var(--vermilion); color: #fff; box-shadow: 0 2px 8px rgba(194,65,12,.3); }
.btn-primary:hover { background: var(--vermilion-deep); transform: translateY(-1px); }
.btn-ghost { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f1e8d6; }
.btn-jade { background: var(--jade); color: #fff; }
.btn-jade:hover { background: #0f766e; }
.btn-soft { background: var(--vermilion-soft); color: var(--vermilion-deep); }
.btn-soft:hover { background: #fbe0d2; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--ink); transition: all .15s;
}
.icon-btn:hover { background: var(--paper-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn.active { background: var(--vermilion); border-color: var(--vermilion); color: #fff; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 20px;
  padding: 3px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.chip.verm { background: var(--vermilion-soft); border-color: #f3cdb8; color: var(--vermilion-deep); }
.chip.gold { background: var(--gold-soft); border-color: #eed3a3; color: #92400e; }
.chip.jade { background: var(--jade-soft); border-color: #b8e4dc; color: #115e59; }
.chip.blue { background: var(--blue-soft); border-color: #c6d6f6; color: #1e3a8a; }
.chip.purple { background: var(--purple-soft); border-color: #d9ccf7; color: #5b21b6; }

.tag { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 2px 8px; }
.tag-lv1 { background: #e6f7e9; color: #166534; }
.tag-lv2 { background: var(--blue-soft); color: #1e40af; }
.tag-lv3 { background: var(--purple-soft); color: #6d28d9; }

.progress { height: 7px; background: #efe7d7; border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--jade), #14b8a6); transition: width .4s ease; }
.progress.verm i { background: linear-gradient(90deg, var(--vermilion), #f97316); }
.progress.gold i { background: linear-gradient(90deg, #b45309, var(--gold)); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.empty { text-align: center; color: var(--ink-3); padding: 40px 20px; font-size: 14px; }

/* ---------------- 首页 ---------------- */
.hero {
  border-radius: var(--radius); padding: 30px 28px; color: #fff;
  background:
    radial-gradient(1000px 300px at 90% -40%, rgba(249,115,22,.5), transparent 60%),
    linear-gradient(135deg, #331f10 0%, #201410 60%, #2b1b10 100%);
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.hero::after {
  content: '汉'; position: absolute; right: -18px; bottom: -58px;
  font-family: var(--font-han); font-size: 220px; opacity: .07; line-height: 1;
}
.hero .hi { font-size: 22px; font-weight: 800; }
.hero .hi .seal {
  display: inline-flex; width: 30px; height: 30px; border-radius: 7px; background: var(--vermilion);
  color: #fff; font-family: var(--font-han); font-size: 16px; align-items: center; justify-content: center;
  margin-right: 8px; vertical-align: -2px;
}
.hero .desc { color: #d8cdbd; margin-top: 6px; font-size: 14px; max-width: 560px; }
.hero-stats { display: flex; gap: 26px; margin-top: 20px; flex-wrap: wrap; }
.hero-stat .num { font-size: 24px; font-weight: 800; color: var(--gold); }
.hero-stat .lbl { font-size: 12px; color: #b9ac99; }

.module-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--card);
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s;
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.module-card .mc-top { display: flex; align-items: center; justify-content: space-between; }
.module-card .mc-emoji {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: var(--paper-2);
}
.module-card h3 { font-size: 16.5px; font-weight: 700; }
.module-card p { font-size: 13px; color: var(--ink-3); flex: 1; }
.module-card .mc-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-3); }

.hanzi-big {
  font-family: var(--font-han); font-size: 96px; line-height: 1.1; font-weight: 700;
  color: var(--ink); text-shadow: 0 1px 0 #fff;
  user-select: none;
}

/* ---------------- 汉字解码器 ---------------- */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-bar input {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  font-size: 15px; background: var(--card); outline: none; transition: border .15s, box-shadow .15s;
}
.search-bar input:focus { border-color: var(--vermilion); box-shadow: 0 0 0 3px rgba(194,65,12,.12); }

.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.char-cell {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 10px 6px; text-align: center; cursor: pointer; transition: all .15s;
}
.char-cell:hover { border-color: var(--vermilion); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.char-cell .ch { font-family: var(--font-han); font-size: 30px; font-weight: 700; display: block; }
.char-cell .py { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.char-cell.hot { border-color: #eec9a6; background: linear-gradient(180deg, #fffdf8, #fdf3e6); }

/* 汉字详情 */
.char-detail { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.char-left {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; text-align: center; box-shadow: var(--shadow-sm); position: sticky; top: 80px;
}
.char-left .hanzi-display { font-family: var(--font-han); font-size: 110px; line-height: 1.15; font-weight: 700; }
.char-left .py-display { font-size: 22px; color: var(--vermilion); font-weight: 700; margin-top: 2px; }
.char-left .def-display { color: var(--ink-2); font-size: 14px; margin-top: 8px; min-height: 22px; }
.char-left .rad-row { margin-top: 12px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.char-left .stroke-count { margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.char-left .actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

.decomp-box { border: 1px dashed #d8c9ae; background: var(--paper-2); border-radius: 12px; padding: 14px; margin-top: 14px; }
.decomp-box .lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; font-weight: 700; }
.decomp-tree { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.decomp-node {
  width: 52px; height: 52px; border-radius: 10px; background: #fff; border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-han);
  font-size: 30px; font-weight: 700; cursor: pointer; transition: all .15s;
}
.decomp-node:hover { border-color: var(--vermilion); transform: scale(1.06); }
.decomp-node .sub {
  position: absolute; font-size: 9px; color: var(--ink-3); background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 0 3px; transform: translateY(30px); white-space: nowrap;
}
.decomp-link { color: var(--ink-3); font-size: 16px; }

/* 笔顺 SVG */
.stroke-box { margin-top: 14px; }
.stroke-canvas { width: 100%; aspect-ratio: 1; background: #fffdf8; border: 1.5px solid var(--line); border-radius: 12px; }
.stroke-controls { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.stroke-controls .slider { width: 110px; accent-color: var(--vermilion); }

/* 手写练习 */
.write-box { margin-top: 14px; }
.write-canvas { width: 100%; aspect-ratio: 1; border: 1.5px dashed #d8c9ae; border-radius: 12px; background:
  repeating-linear-gradient(0deg, transparent, transparent 49px, #f0e7d3 50px),
  repeating-linear-gradient(90deg, transparent, transparent 49px, #f0e7d3 50px), #fffdf8;
  touch-action: none; cursor: crosshair; }

/* 故事 */
.story-box {
  background: linear-gradient(180deg, #fffdf6, #fdf4e3);
  border: 1px solid #eed9ae; border-radius: var(--radius); padding: 18px 20px;
}
.story-box .story-title { font-weight: 800; font-size: 15px; color: #92400e; display: flex; align-items: center; gap: 8px; }
.story-box .story-body { margin-top: 8px; font-size: 14px; color: #57534e; }
.story-box .story-culture { margin-top: 10px; font-size: 13px; color: #7c6a4f; border-top: 1px dashed #e8d5ae; padding-top: 9px; }

/* ---------------- 声调教练 ---------------- */
.tone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tone-card {
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
  padding: 16px; cursor: pointer; transition: all .18s; text-align: center;
}
.tone-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tone-card.sel { border-color: var(--vermilion); box-shadow: 0 0 0 3px rgba(194,65,12,.14); }
.tone-card .tone-num { font-size: 30px; font-weight: 800; }
.tone-card .tone-name { font-size: 14px; font-weight: 700; margin-top: 2px; }
.tone-card .tone-desc { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.tone-card svg { width: 100%; height: 52px; margin-top: 8px; }

.mini-pair { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mini-cell {
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 14px 8px; text-align: center; cursor: pointer; transition: all .15s;
}
.mini-cell:hover { border-color: var(--vermilion); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.mini-cell .ch { font-family: var(--font-han); font-size: 34px; font-weight: 700; display: block; }
.mini-cell .py { font-size: 14px; font-weight: 700; margin-top: 3px; }
.mini-cell .en { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.quiz-card { max-width: 520px; margin: 0 auto; text-align: center; padding: 30px 24px; }
.quiz-hanzi { font-family: var(--font-han); font-size: 72px; font-weight: 700; }
.quiz-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 20px; }
.quiz-opt {
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 14px; font-size: 15px; font-weight: 600; transition: all .15s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--vermilion); background: var(--vermilion-soft); }
.quiz-opt.correct { background: #dcfce7; border-color: var(--good); color: var(--good); }
.quiz-opt.wrong { background: #fee2e2; border-color: var(--bad); color: var(--bad); }
.quiz-opt:disabled { cursor: default; }

/* 麦克风 */
.mic-panel { border: 1.5px dashed #d8c9ae; border-radius: var(--radius); padding: 18px; background: var(--paper-2); }
.mic-btn {
  width: 64px; height: 64px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--vermilion), #dc2626); color: #fff; font-size: 26px;
  box-shadow: 0 4px 14px rgba(194,65,12,.4); transition: all .18s; display: inline-flex;
  align-items: center; justify-content: center;
}
.mic-btn:hover { transform: scale(1.06); }
.mic-btn.rec { animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.45);} 50% { box-shadow: 0 0 0 16px rgba(220,38,38,0);} }
.mic-status { font-size: 13px; color: var(--ink-2); margin-top: 8px; min-height: 20px; }
.live-curve { width: 100%; height: 110px; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; }

/* ---------------- 情境中文 ---------------- */
.chat { display: flex; flex-direction: column; gap: 12px; padding: 10px 0; }
.bubble { display: flex; gap: 10px; max-width: 86%; }
.bubble .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.bubble.other { align-self: flex-start; }
.bubble.you { align-self: flex-end; flex-direction: row-reverse; }
.bubble .b-body { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; box-shadow: var(--shadow-sm); }
.bubble.other .b-body { border-top-left-radius: 4px; background: #fff; }
.bubble.you .b-body { border-top-right-radius: 4px; background: var(--vermilion-soft); border-color: #f3cdb8; }
.bubble .b-zh { font-size: 16.5px; font-weight: 700; }
.bubble .b-py { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.bubble .b-en { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.bubble .b-actions { display: flex; gap: 6px; margin-top: 8px; }
.bubble .mini-btn {
  border: 1px solid var(--line); background: var(--paper-2); border-radius: 7px;
  padding: 3px 9px; font-size: 12px; color: var(--ink-2);
}
.bubble .mini-btn:hover { background: #f1e8d6; }
.bubble.note { align-self: center; max-width: 92%; }
.bubble.note .b-body { background: transparent; border: none; box-shadow: none; color: var(--ink-3); font-size: 13px; text-align: center; }

.roleplay-opt {
  display: block; width: 100%; text-align: left; border: 1.5px solid var(--line);
  border-radius: 12px; background: var(--card); padding: 13px 15px; margin-bottom: 9px; transition: all .15s;
}
.roleplay-opt:hover:not(:disabled) { border-color: var(--jade); background: var(--jade-soft); }
.roleplay-opt .r-zh { font-size: 15.5px; font-weight: 700; }
.roleplay-opt .r-py { font-size: 12.5px; color: var(--ink-3); }
.roleplay-opt.correct { border-color: var(--good); background: #dcfce7; }
.roleplay-opt.wrong { border-color: var(--bad); background: #fee2e2; }
.roleplay-opt:disabled { cursor: default; }

/* ---------------- HSK ---------------- */
.word-row {
  display: grid; grid-template-columns: 90px 130px 1fr 52px 90px; gap: 10px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid #f0e8d8; cursor: pointer; transition: background .12s;
}
.word-row:hover { background: var(--paper-2); }
.word-row:last-child { border-bottom: none; }
.word-row .w-h { font-family: var(--font-han); font-size: 21px; font-weight: 700; }
.word-row .w-p { color: var(--ink-2); font-size: 13.5px; }
.word-row .w-m { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-row .w-star { text-align: center; font-size: 16px; }
.word-row .w-learned { text-align: right; }

/* 闪卡 */
.flash-wrap { max-width: 560px; margin: 0 auto; perspective: 1200px; }
.flash-card {
  position: relative; width: 100%; aspect-ratio: 4/3; cursor: pointer;
  transition: transform .5s; transform-style: preserve-3d;
}
.flash-card.flip { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); box-shadow: var(--shadow-md);
}
.flash-front { background: linear-gradient(160deg, #fffdf8, #fbf3e4); }
.flash-back { background: var(--card); transform: rotateY(180deg); }
.flash-front .f-h { font-family: var(--font-han); font-size: 84px; font-weight: 700; }
.flash-front .f-p { font-size: 22px; color: var(--vermilion); font-weight: 700; margin-top: 6px; }
.flash-back .f-m { font-size: 22px; font-weight: 700; padding: 0 30px; text-align: center; }
.flash-back .f-more { font-size: 13px; color: var(--ink-3); margin-top: 10px; }
.flash-progress { display: flex; gap: 5px; margin-bottom: 14px; }
.flash-progress i { flex: 1; height: 6px; border-radius: 4px; background: #efe7d7; }
.flash-progress i.done { background: var(--jade); }

.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.grade-btn { padding: 12px 6px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; transition: all .15s; }
.grade-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.grade-again { color: var(--bad); } .grade-again:hover { border-color: var(--bad); }
.grade-hard { color: var(--gold); } .grade-hard:hover { border-color: var(--gold); }
.grade-good { color: var(--jade); } .grade-good:hover { border-color: var(--jade); }
.grade-easy { color: var(--blue); } .grade-easy:hover { border-color: var(--blue); }

/* ---------------- Toast / Modal ---------------- */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 18px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px; animation: slidein .25s ease;
  max-width: 340px;
}
.toast.ok { background: #0f766e; }
.toast.bad { background: #b91c1c; }
.toast.gold { background: #92400e; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-back {
  position: fixed; inset: 0; background: rgba(28,25,23,.5); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadein .18s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow-lg);
  max-width: 460px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 24px;
  animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-size: 18px; margin-bottom: 10px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; bottom: 0; top: auto; width: 100%; height: auto; z-index: 50; flex-direction: row; }
  .brand, .sidebar-foot { display: none; }
  .nav { display: flex; padding: 6px 4px; gap: 2px; overflow-x: auto; }
  .nav-section { display: none; }
  .nav-item { flex: 1; justify-content: center; padding: 9px 4px; font-size: 0; flex-direction: column; gap: 2px; }
  .nav-item .nav-ico { font-size: 20px; }
  .nav-item .nav-label { font-size: 10px; display: block; }
  .nav-item .nav-badge { display: none; }
  .content { padding: 18px 14px 90px; }
  .topbar { padding: 10px 14px; }
  .char-detail { grid-template-columns: 1fr; }
  .char-left { position: static; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .word-row { grid-template-columns: 64px 96px 1fr 40px; }
  .word-row .w-learned { display: none; }
}

@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .mini-pair { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 22px 18px; }
  .topbar .crumb { display: none; }
}

/* ===== Pro / 许可证 (license.js) ===== */
.pro-btn {
  margin-top: 10px; width: 100%; padding: 9px 12px;
  border: 1px dashed var(--gold); border-radius: 10px;
  background: var(--gold-soft); color: #92400e;
  font-weight: 700; font-size: 13px; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.pro-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(217,119,6,.25); }
.pro-btn.is-pro { border-style: solid; background: var(--jade-soft); border-color: var(--jade); color: #115e59; }

.lock-card { opacity: .92; border: 1px dashed #eed3a3; background: linear-gradient(180deg, #fffdf6, #fff); }
.lock-card:hover { border-color: var(--gold); }
.tag-pro { background: var(--gold-soft); color: #92400e; border: 1px solid #eed3a3; }

.lic-lead { font-size: 14px; line-height: 1.6; margin: 0 0 12px; }
.lic-row { margin-bottom: 10px; }
.lic-input {
  width: 100%; padding: 10px 12px; font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1.5px solid #e7e0d4; border-radius: 10px; outline: none;
  box-sizing: border-box; letter-spacing: .5px;
}
.lic-input:focus { border-color: var(--vermilion); }
.lic-status { min-height: 20px; font-size: 13px; font-weight: 600; }
.lic-status.ok { color: var(--jade); }
.lic-status.bad { color: #b91c1c; }
.lic-hint { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 0; }
.lic-hint a { color: var(--blue); font-weight: 600; text-decoration: none; }
.lic-hint a:hover { text-decoration: underline; }
