/* Vocab Ear Trainer PWA — warm paper / deep ink dual theme. */
:root {
  --accent: #f5a623;
  --accent2: #38bdf8;
  --accent-grad: linear-gradient(120deg, #f7b733, #fc4a1a 55%, #38bdf8 130%);
  --radius: 18px;
  --tab-h: 60px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
           "Songti SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
}
html[data-theme="light"], html[data-theme="paper"] {
  --bg: #f6f1e7; --bg2: #efe6d4; --card: #fffdf8; --card2: #f3ead9;
  --ink: #233044; --dim: #7a7466; --line: #e4d9c4;
  --shadow: 0 10px 30px rgba(120, 90, 20, .12);
  --hero-ink: #fff8ec;
}
html[data-theme="dark"], html[data-theme="ink"] {
  --bg: #0e1420; --bg2: #0a0f18; --card: #182233; --card2: #1f2c42;
  --ink: #eef3f9; --dim: #93a4bb; --line: #263650;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --hero-ink: #fff8ec;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { user-select: none; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-icon { width: 40px; height: 40px; border-radius: 11px; box-shadow: var(--shadow); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 19px; letter-spacing: .5px; white-space: nowrap; }
@media (max-width: 480px) {
  .brand-text b { font-size: 16.5px; }
  .brand-text i { display: none; }
  .chip { padding: 8px 10px; font-size: 12.5px; }
}
.brand-text i { font-style: normal; font-size: 12px; color: var(--dim); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  width: 40px; height: 40px; border-radius: 50%; font-size: 19px;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip {
  background: var(--accent-grad); color: #fff; border: none;
  padding: 9px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
}

/* ---------- layout ---------- */
#view { max-width: 1060px; margin: 0 auto; padding: 6px 18px 30px; }
.hero {
  background: var(--accent-grad); color: var(--hero-ink);
  border-radius: 26px; padding: 26px 24px 22px; margin: 8px 0 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after {
  content: "Aa"; position: absolute; right: 6px; top: -38px;
  font-family: var(--serif); font-size: 170px; font-weight: 700;
  opacity: .16; transform: rotate(8deg);
}
.hero h1 { margin: 0 0 4px; font-size: clamp(24px, 5.4vw, 36px); }
.hero p { margin: 0 0 16px; opacity: .92; font-size: clamp(13.5px, 3.4vw, 15.5px); }
.hero .stats { display: flex; gap: 20px; flex-wrap: wrap; }
.hero .stat b { font-size: 21px; display: block; }
.hero .stat span { font-size: 12.5px; opacity: .85; }
.hero .continue {
  margin-top: 18px; background: rgba(255,255,255,.92); color: #b3540c;
  border: none; padding: 11px 18px; border-radius: 999px; font-weight: 700;
  font-size: 15px; box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
h2.section { font-size: 19px; margin: 22px 2px 12px; }

/* ---------- shelf ---------- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); } }
.book-card {
  border-radius: var(--radius); padding: 18px 16px 14px; color: #fff;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
  min-height: 148px; display: flex; flex-direction: column; justify-content: flex-end;
  transition: transform .15s ease;
}
.book-card:active { transform: scale(.975); }
.book-card .bk-ic { position: absolute; top: 12px; left: 14px; font-size: 26px; opacity: .92; }
.book-card .bk-name { font-size: 17.5px; font-weight: 700; line-height: 1.25; }
.book-card .bk-meta { font-size: 12.5px; opacity: .85; margin-top: 3px; }
.book-card .bk-prog { height: 5px; background: rgba(255,255,255,.32); border-radius: 3px; margin-top: 10px; }
.book-card .bk-prog i { display: block; height: 100%; background: #fff; border-radius: 3px; }

/* ---------- word lists ---------- */
.toolbar {
  position: sticky; top: 64px; z-index: 20; display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tbtn {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
}
.tbtn.primary { background: var(--accent-grad); color: #fff; border: none; }
.tbtn.on { border-color: var(--accent); color: var(--accent); }
.word-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--card); border: 1px solid var(--line); text-align: left;
  border-radius: 14px; padding: 12px 14px; margin-bottom: 9px; color: var(--ink);
}
.word-row .wr-main { flex: 1; min-width: 0; }
.word-row .wr-w { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.word-row .wr-ph { color: var(--dim); font-size: 12.5px; margin-left: 7px; font-weight: 400; }
.word-row .wr-m {
  color: var(--dim); font-size: 13.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.mini-btn {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card2); color: var(--ink);
  font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
}
.mini-btn.starred { color: var(--accent); border-color: var(--accent); }
.book-head { display: flex; align-items: baseline; gap: 10px; margin: 10px 2px 2px; }
.book-head h1 { font-size: 24px; margin: 0; }
.book-head .cnt { color: var(--dim); font-size: 14px; }

/* ---------- search / forms ---------- */
.search-box {
  display: flex; gap: 9px; margin: 12px 0 6px;
}
.search-box input {
  flex: 1; background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 13px 18px; font-size: 16px; outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.empty { text-align: center; color: var(--dim); padding: 44px 20px; font-size: 15px; }
.loading { text-align: center; color: var(--dim); padding: 40px 0; }
.result-book { font-size: 13px; color: var(--accent); font-weight: 700; margin: 16px 2px 8px; }

/* ---------- settings ---------- */
.set-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.set-group h3 { margin: 0; padding: 14px 16px 4px; font-size: 13px; color: var(--dim); letter-spacing: 1px; }
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-top: 1px solid var(--line); font-size: 15.5px;
}
.set-row:first-of-type { border-top: none; }
.set-row select {
  background: var(--card2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font-size: 15px; max-width: 55%;
}
.seg { display: flex; background: var(--card2); border-radius: 999px; padding: 3px; }
.seg button {
  border: none; background: transparent; color: var(--dim); padding: 7px 13px;
  border-radius: 999px; font-size: 14px; font-weight: 600;
}
.seg button.on { background: var(--accent-grad); color: #fff; }
.danger { color: #e5484d; }
.about-box { color: var(--dim); font-size: 13.5px; line-height: 1.7; padding: 4px 2px 10px; }
.about-box a { color: var(--accent2); }

/* ---------- tab bar ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
#tabbar a {
  flex: 1; max-width: 170px; display: flex; flex-direction: column; align-items: center;
  gap: 1px; padding: 5px 0 3px; border-radius: 12px; color: var(--dim);
  font-size: 11.5px; font-weight: 600;
}
#tabbar a .tab-ic { font-size: 21px; }
#tabbar a.active { color: var(--accent); }

/* ---------- mini player bar ---------- */
#playerbar {
  position: fixed; left: 12px; right: 12px; z-index: 45;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
  max-width: 700px; margin: 0 auto;
  display: flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 8px 7px 18px;
  box-shadow: var(--shadow);
}
.pb-main { flex: 1; background: none; border: none; text-align: left; color: var(--ink); min-width: 0; }
#pb-word { font-family: var(--serif); font-weight: 700; font-size: 17px; }
#pb-sub { color: var(--dim); font-size: 12px; margin-left: 8px; }
.pb-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none; flex: none;
  background: var(--accent-grad); color: #fff; font-size: 17px;
}
.pb-btn:last-child { background: var(--card2); color: var(--ink); }

/* ---------- full player ---------- */
#player {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(56,189,248,.35), transparent 55%),
    radial-gradient(120% 90% at 0% 110%, rgba(245,166,35,.30), transparent 55%),
    var(--bg2);
  padding: calc(12px + env(safe-area-inset-top)) 22px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.pl-top { display: flex; align-items: center; justify-content: space-between; }
.pl-book { color: var(--dim); font-size: 14px; font-weight: 600; }
#pl-star { font-size: 23px; }
#pl-star.starred { color: var(--accent); border-color: var(--accent); }
.pl-progress { height: 5px; background: var(--line); border-radius: 3px; margin: 14px 0 8px; }
#pl-progress-fill { height: 100%; width: 0%; background: var(--accent-grad); border-radius: 3px; transition: width .4s ease; }
.pl-stage { text-align: center; color: var(--accent); font-weight: 700; letter-spacing: 2px; font-size: 13px; min-height: 20px; }
.pl-body { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 10px 0; }
.pl-word { font-family: var(--serif); font-weight: 700; font-size: clamp(44px, 13vw, 76px); line-height: 1.1; word-break: break-word; }
.pl-word.hidden-word { letter-spacing: 6px; color: var(--dim); }
.pl-phon { color: var(--dim); font-size: clamp(16px, 4.6vw, 21px); margin-top: 10px; min-height: 28px; }
.pl-phon button { background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 5px 12px; margin: 4px 3px 0; font-size: 14px; }
.pl-meaning { font-size: clamp(17px, 5vw, 22px); margin-top: 18px; line-height: 1.6; }
.pl-example { color: var(--dim); margin-top: 16px; font-size: clamp(14.5px, 4.2vw, 17px); line-height: 1.65; }
.pl-example .ex-en { color: var(--ink); font-family: var(--serif); font-size: 1.12em; }
.pl-hint { text-align: center; color: var(--dim); font-size: 13.5px; min-height: 20px; }
.pl-controls { display: flex; align-items: center; justify-content: center; gap: 26px; margin-top: 12px; }
.pl-btn { border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.pl-btn.side { width: 58px; height: 58px; font-size: 21px; }
.pl-btn.main { width: 78px; height: 78px; font-size: 30px; background: var(--accent-grad); color: #fff; border: none; box-shadow: var(--shadow); }
.pl-tools { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.pl-tools .tbtn { background: color-mix(in srgb, var(--card) 80%, transparent); }

/* ---------- detail sheet ---------- */
#sheet {
  position: fixed; inset: 0; z-index: 55; background: rgba(5, 8, 14, .5);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 86dvh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(26px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-card .d-word { font-family: var(--serif); font-size: 40px; font-weight: 700; }
.sheet-card .d-phon { color: var(--dim); margin: 6px 0 2px; font-size: 16px; }
.sheet-card .d-mean { font-size: 17.5px; line-height: 1.65; margin-top: 10px; }
.sheet-card .d-ex { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; }
.sheet-card .d-ex .en { font-family: var(--serif); font-size: 17px; }
.sheet-card .d-ex .zh { color: var(--dim); margin-top: 5px; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.d-actions .tbtn { flex: 1; text-align: center; padding: 11px 8px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 80;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 76px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap;
}
@media (min-width: 900px) {
  .pl-word { font-size: 84px; }
  #sheet { align-items: center; }
  .sheet-card { border-radius: 24px; }
}

/* groups, pictures, phonics/root meta lines */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.chipbtn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 13px; font-size: 13.5px; cursor: pointer;
}
.chipbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.g-cnt { color: var(--dim); font-size: 13px; font-weight: 400; }
.d-pic {
  width: 100%; max-height: 300px; object-fit: contain; border-radius: 14px;
  background: var(--soft); margin-top: 12px;
}
.pl-pic {
  width: 132px; height: 132px; object-fit: contain; border-radius: 16px;
  background: rgba(255, 255, 255, .18); margin-top: 14px;
}
.pl-meta, .d-meta { margin-top: 12px; text-align: left; }
.meta-line { display: flex; gap: 8px; font-size: 14px; line-height: 1.55; margin-top: 5px; }
.ml-k {
  flex: none; font-size: 12px; font-weight: 700; color: var(--accent);
  border: 1px solid currentColor; border-radius: 6px; padding: 0 6px;
  height: fit-content; margin-top: 2px;
}
.d-meta .ml-v { color: var(--ink); }
.pl-meta .ml-v { color: var(--ink); }


/* ================= theme gallery (settings) ================= */
.theme-row { padding-bottom: 2px; }
.theme-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 9px; padding: 10px 14px 14px;
}
.theme-chip {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  background: var(--card2); border: 2px solid var(--line); border-radius: 13px;
  padding: 7px; cursor: pointer; color: var(--ink);
}
.theme-chip.on { border-color: var(--accent); box-shadow: var(--shadow); }
.th-prev { height: 34px; border-radius: 8px; border: 1px solid rgba(0,0,0,.12); }
.th-name { font-size: 12.5px; text-align: center; line-height: 1.25; }

/* ================= extra themes ================= */
html[data-theme="minecraft"] {
  --bg: #2f4423; --bg2: #243418; --card: #405c2e; --card2: #4a6836;
  --ink: #f2f7e4; --dim: #b9cc9c; --line: #5d7d43;
  --shadow: 6px 6px 0 rgba(0, 0, 0, .30);
  --hero-ink: #f7ffe9;
  --accent: #6abe30; --accent2: #63a4ff;
  --accent-grad: linear-gradient(120deg, #6abe30, #a06a35 60%, #63a4ff 130%);
  --radius: 6px;
  --sans: "Courier New", ui-monospace, "PingFang SC", monospace;
}
html[data-theme="minecraft"] body {
  background-image: conic-gradient(rgba(255,255,255,.045) 25%, transparent 0 50%, rgba(255,255,255,.045) 0 75%, transparent 0);
  background-size: 34px 34px;
}
html[data-theme="hacker"] {
  --bg: #000000; --bg2: #020604; --card: #031007; --card2: #06230f;
  --ink: #3dff73; --dim: #1f9e49; --line: #0f3d1e;
  --shadow: 0 0 18px rgba(0, 255, 102, .22);
  --hero-ink: #d8ffe2;
  --accent: #00ff66; --accent2: #00e5ff;
  --accent-grad: linear-gradient(120deg, #00ff66, #00e5ff);
  --radius: 8px;
  --sans: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --serif: ui-monospace, Menlo, Consolas, "Courier New", monospace;
}
html[data-theme="hacker"] body {
  background-image:
    linear-gradient(rgba(0, 255, 102, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 102, .05) 1px, transparent 1px);
  background-size: 28px 28px;
}
html[data-theme="hacker"] .book-card {
  background: linear-gradient(150deg, #063d1a, #02140a) !important;
  border: 1px solid #0f3d1e;
}
html[data-theme="hacker"] .brand-text b,
html[data-theme="hacker"] .hero h1 { text-shadow: 0 0 9px rgba(0, 255, 102, .45); }
html[data-theme="sketch"] {
  --bg: #fdfdf8; --bg2: #f2f2e8; --card: #ffffff; --card2: #f7f7ef;
  --ink: #22242a; --dim: #6d6a5e; --line: #c9c9bb;
  --shadow: 2px 3px 0 rgba(30, 30, 30, .20);
  --hero-ink: #ffffff;
  --accent: #3056d3; --accent2: #e03131;
  --accent-grad: linear-gradient(120deg, #3056d3, #e03131);
  --radius: 4px;
}
html[data-theme="sketch"] body {
  background-image:
    linear-gradient(rgba(48, 86, 211, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 86, 211, .07) 1px, transparent 1px);
  background-size: 26px 26px;
}
html[data-theme="sketch"] .book-card {
  background: #ffffff !important; color: #22242a;
  border: 2px solid #22242a; box-shadow: 3px 4px 0 rgba(30,30,30,.55);
}
html[data-theme="sketch"] .book-card .bk-meta { color: #6d6a5e; }
html[data-theme="ocean"] {
  --bg: #06283d; --bg2: #041a29; --card: #0b3d5c; --card2: #10506f;
  --ink: #e8f6ff; --dim: #8fc3dd; --line: #14506e;
  --shadow: 0 10px 30px rgba(0, 10, 20, .45);
  --hero-ink: #eafcff;
  --accent: #22d3ee; --accent2: #34d399;
  --accent-grad: linear-gradient(120deg, #22d3ee, #34d399);
}
html[data-theme="sunset"] {
  --bg: #2b1035; --bg2: #1d0b26; --card: #3d1a47; --card2: #4c2257;
  --ink: #ffe9d6; --dim: #d9a08c; --line: #5c2a52;
  --shadow: 0 10px 30px rgba(10, 0, 16, .5);
  --hero-ink: #fff3e2;
  --accent: #fb923c; --accent2: #f472b6;
  --accent-grad: linear-gradient(120deg, #fb923c, #f472b6 60%, #a78bfa 130%);
}
html[data-theme="sakura"] {
  --bg: #fdf0f3; --bg2: #fbe3ea; --card: #fffafd; --card2: #ffeef4;
  --ink: #4a2530; --dim: #a97a89; --line: #f3ccd8;
  --shadow: 0 10px 30px rgba(190, 90, 130, .15);
  --hero-ink: #fff5f9;
  --accent: #ec5f92; --accent2: #a78bfa;
  --accent-grad: linear-gradient(120deg, #f78fb8, #ec5f92 55%, #a78bfa 130%);
}
html[data-theme="forest"] {
  --bg: #0e241a; --bg2: #08160f; --card: #16382a; --card2: #1d4734;
  --ink: #e6f4e8; --dim: #93b8a0; --line: #24503a;
  --shadow: 0 10px 30px rgba(0, 8, 4, .5);
  --hero-ink: #effff2;
  --accent: #4ade80; --accent2: #a3e635;
  --accent-grad: linear-gradient(120deg, #4ade80, #a3e635);
}
html[data-theme="royal"] {
  --bg: #17102e; --bg2: #100a22; --card: #241845; --card2: #2e1f57;
  --ink: #f3ead2; --dim: #a793c9; --line: #3a2a63;
  --shadow: 0 12px 32px rgba(4, 0, 16, .55);
  --hero-ink: #fdf6da;
  --accent: #d4af37; --accent2: #8b5cf6;
  --accent-grad: linear-gradient(120deg, #d4af37, #8b5cf6);
}
html[data-theme="candy"] {
  --bg: #fff5fa; --bg2: #ffeef7; --card: #ffffff; --card2: #fff0f7;
  --ink: #50304a; --dim: #b083a5; --line: #ffd3e8;
  --shadow: 0 10px 26px rgba(255, 111, 181, .18);
  --hero-ink: #ffffff;
  --accent: #ff6fb5; --accent2: #4cc9f0;
  --accent-grad: linear-gradient(120deg, #ff6fb5, #4cc9f0);
  --radius: 22px;
}
html[data-theme="candy"] body {
  background-image: radial-gradient(rgba(255, 111, 181, .13) 2.5px, transparent 3.2px);
  background-size: 26px 26px;
}
html[data-theme="retro"] {
  --bg: #efe3c8; --bg2: #e6d5ae; --card: #f7edd3; --card2: #efe0ba;
  --ink: #3b2d1c; --dim: #8a7350; --line: #cbb27f;
  --shadow: 0 8px 22px rgba(90, 64, 20, .20);
  --hero-ink: #fdf6da;
  --accent: #b3541e; --accent2: #365f3a;
  --accent-grad: linear-gradient(120deg, #b3541e, #365f3a);
  --sans: Georgia, "Songti SC", "SimSun", serif;
}

/* author card + about page */
.author-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 16px;
}
.author-qr { width: 84px; height: 84px; border-radius: 12px; flex: none; }
.author-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.author-meta b { font-size: 16.5px; }
.author-meta i { font-style: normal; color: var(--dim); font-size: 13.5px; }
.author-meta em { font-style: normal; color: var(--accent); font-size: 13.5px; font-weight: 600; }
.author-go { margin-left: auto; font-size: 24px; color: var(--dim); flex: none; }
.qr-hero {
  text-align: center; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px 8px; margin-bottom: 16px;
}
.qr-hero img { width: min(300px, 78vw); border-radius: 14px; }
.qr-hero p { color: var(--accent); font-weight: 700; margin: 10px 0 12px; }
.about-sec p, .about-sec li { line-height: 1.75; }
.about-sec ol { margin: 6px 0 12px; padding-left: 22px; }
.about-sec li { margin-bottom: 7px; }
.mail { color: var(--accent); font-weight: 600; }

.about-sec p { padding: 0 14px 12px; }
.about-sec ol { margin-left: 14px; margin-right: 14px; }

html[data-theme="minecraft"] .book-card {
  background: linear-gradient(150deg, #5d8f36, #3c5a20) !important;
  border: 2px solid #243418; border-radius: 6px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .35);
}
html[data-theme="minecraft"] .book-card:nth-child(3n) {
  background: linear-gradient(150deg, #9a6a3a, #6e4a26) !important;
}
html[data-theme="minecraft"] .book-card:nth-child(4n) {
  background: linear-gradient(150deg, #6f7d72, #47544b) !important;
}

/* ---------- picture block with emoji fallback ---------- */
.pic-wrap { margin-top: 12px; }
.d-pic .pic-img {
  width: 100%; max-height: 300px; object-fit: contain; display: block;
  border-radius: 14px; background: var(--soft);
}
.pl-pic { text-align: center; background: none; width: auto; height: auto; }
.pl-pic .pic-img {
  width: 132px; height: 132px; object-fit: cover; border-radius: 16px;
  background: rgba(255, 255, 255, .18);
}
.pic-emoji {
  display: grid; place-items: center; border-radius: 16px;
  background:
    radial-gradient(120% 120% at 20% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%),
    color-mix(in srgb, var(--card2) 80%, transparent);
  border: 1px solid var(--line);
}
.d-pic .pic-emoji { height: 220px; font-size: 96px; }
.pl-pic .pic-emoji { width: 132px; height: 132px; font-size: 58px; margin: 0 auto; }

/* ---------- modern UI pass: glass, glow, motion ---------- */
.ic {
  width: 1.18em; height: 1.18em; display: inline-block; flex: none;
  vertical-align: -0.22em;
}
button { -webkit-tap-highlight-color: transparent; }
.tbtn, .chipbtn, .seg button, .mini-btn, .icon-btn, .theme-chip,
.pl-phon button, .gchip, .continue {
  transition: transform .16s ease, box-shadow .25s ease, background .25s ease,
    color .2s ease, border-color .2s ease;
}
.tbtn:active, .chipbtn:active, .mini-btn:active, .icon-btn:active,
.pl-btn:active, .pb-btn:active, .gchip:active { transform: scale(.93); }
.tbtn {
  background: color-mix(in srgb, var(--card) 72%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: 0 2px 10px rgba(10, 15, 30, .07);
}
.tbtn.primary {
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 38%, transparent);
}
.tbtn.on {
  border-color: var(--accent); color: var(--accent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 25%, transparent);
}
.icon-btn {
  background: color-mix(in srgb, var(--card) 68%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: inline-grid; place-items: center; text-decoration: none;
}
.icon-btn .ic { width: 20px; height: 20px; }
.mini-btn {
  display: inline-grid; place-items: center;
  background: color-mix(in srgb, var(--card) 78%, transparent);
}
.mini-btn .ic { width: 18px; height: 18px; }
.mini-btn.starred {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
}
.seg { box-shadow: inset 0 1px 4px rgba(10, 15, 30, .10); }
.seg button.on {
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
select#set-lang {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 34px 8px 16px; font: inherit; font-weight: 600; color: var(--ink);
  background-color: color-mix(in srgb, var(--card) 78%, transparent);
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 19px) 55%, calc(100% - 14px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
#tabbar a .tab-ic {
  width: 54px; height: 31px; display: grid; place-items: center;
  border-radius: 999px; font-size: 0;
  transition: background .25s ease, color .2s ease, transform .2s ease;
}
#tabbar a .tab-ic .ic { width: 22px; height: 22px; }
#tabbar a.active .tab-ic {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
#tabbar a:active .tab-ic { transform: scale(.9); }
.pl-btn.main {
  box-shadow: 0 16px 36px color-mix(in srgb, var(--accent) 45%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .35);
  display: inline-grid; place-items: center;
}
.pl-btn.main .ic { width: 34px; height: 34px; }
.pl-btn.side {
  background: color-mix(in srgb, var(--card) 68%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: inline-grid; place-items: center;
}
.pl-btn.side .ic { width: 24px; height: 24px; }
#pl-star.starred { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.pb-btn {
  display: inline-grid; place-items: center;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 32%, transparent);
}
.pb-btn .ic { width: 19px; height: 19px; }
.pb-btn:last-child {
  background: color-mix(in srgb, var(--card2) 80%, transparent);
  box-shadow: none;
}
.pl-phon button {
  background: color-mix(in srgb, var(--card) 72%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.book-card { transition: transform .18s ease, box-shadow .25s ease; }
.book-card:active { transform: scale(.965); }
.word-row { transition: transform .15s ease, border-color .2s ease; }
.word-row:active { transform: scale(.99); }
.set-group h3 { position: relative; padding-left: 13px; }
.set-group h3::before {
  content: ""; position: absolute; left: 0; top: 2px; bottom: 2px;
  width: 4px; border-radius: 2px; background: var(--accent-grad);
}
h1 .ic, h2 .ic { width: .92em; height: .92em; vertical-align: -0.08em; }
.empty .ic { width: 44px; height: 44px; color: var(--dim); }

.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 14px 14px; }
@media (max-width: 480px) { .qr-grid { grid-template-columns: 1fr; } }
.qr-card {
  text-align: center; background: color-mix(in srgb, var(--card2) 55%, transparent);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px;
}
.qr-card img { width: 100%; max-width: 180px; border-radius: 10px; background: #fff; }
.qr-name { font-weight: 700; margin-top: 10px; }
.qr-card .addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--dim); word-break: break-all;
  margin: 8px 0 10px; line-height: 1.5;
}
.qr-note { color: var(--dim); font-size: 12px; margin-top: 8px; line-height: 1.5; }
.qr-link { display: inline-block; margin-top: 10px; text-decoration: none; }

.ex-one { margin-top: 10px; }
.ex-one:first-child { margin-top: 0; }
.ex-one + .ex-one { border-top: 1px dashed var(--line); padding-top: 10px; }
.d-ex .ex-en { font-family: var(--serif); font-size: 17px; }
.d-ex .ex-zh { color: var(--dim); margin-top: 4px; }
.pl-example .ex-zh { margin-top: 3px; }
