:root {
  --bg: #f6f4ee;
  --card: #ffffff;
  --ink: #2c2a26;
  --muted: #8a857b;
  --accent: #b5543b;
  --accent-soft: #f3e3de;
  --line: #e6e1d6;
  --chip: #efece4;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  background: var(--bg); color: var(--ink);
  padding-bottom: 64px;
}
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 14px 18px 0; text-align: center;
}
header h1 { font-size: 22px; letter-spacing: 2px; color: var(--accent); }
#tabs { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.tab {
  border: none; background: transparent; font-size: 16px;
  padding: 10px 26px; cursor: pointer; color: var(--muted);
  border-bottom: 3px solid transparent; font-family: inherit;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.view { max-width: 760px; margin: 0 auto; padding: 16px 14px; }
.hidden { display: none !important; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.seg { display: inline-flex; background: var(--chip); border-radius: 8px; padding: 3px; }
.segbtn {
  border: none; background: transparent; padding: 7px 16px; font-size: 14px;
  cursor: pointer; border-radius: 6px; color: var(--muted); font-family: inherit;
}
.segbtn.active { background: var(--accent); color: #fff; font-weight: 600; }
input[type="search"], select {
  flex: 1; min-width: 140px; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--ink); font-family: inherit; outline: none;
}
input[type="search"]:focus, select:focus { border-color: var(--accent); }
.toolbtn {
  border: 1px solid var(--accent); color: var(--accent); background: var(--card);
  border-radius: 8px; padding: 9px 14px; font-size: 13px; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.toolbtn:hover { background: var(--accent); color: #fff; }

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

/* ---- 条目卡片 ---- */
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s;
  display: flex; align-items: center; gap: 12px;
}
.item:hover { border-color: var(--accent); }
.item.playing { border-color: var(--accent); background: var(--accent-soft); }
.item .no { color: var(--muted); font-size: 12px; min-width: 34px; }
.item .main { flex: 1; min-width: 0; }
.item .hanji { font-size: 19px; font-weight: 600; line-height: 1.35; }
.item .lomaji { font-size: 14px; color: var(--accent); margin-top: 2px; }
.item .huagi { font-size: 13px; color: var(--muted); margin-top: 2px; }
.item .suhui {
  font-size: 13px; color: var(--ink); margin-top: 6px; line-height: 1.8;
  padding-top: 6px; border-top: 1px dashed var(--line);
}
.item .suhui .rom { color: var(--accent); font-size: 12px; }
.btns { display: flex; gap: 6px; flex-shrink: 0; }
.pbtn {
  border: 1px solid var(--accent); color: var(--accent); background: transparent;
  border-radius: 19px; min-width: 42px; height: 30px; padding: 0 12px;
  font-size: 12px; cursor: pointer; flex-shrink: 0; font-family: inherit;
}
.pbtn:hover, .pbtn.on { background: var(--accent); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- 文章目录 ---- */
.artitem .hanji { font-size: 17px; }
/* ---- 文章阅读 ---- */
#reader { max-width: 760px; margin: 0 auto; }
.btn-back {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 8px 16px; cursor: pointer; font-size: 14px; color: var(--ink);
  margin-bottom: 14px; font-family: inherit;
}
.btn-back:hover { border-color: var(--accent); color: var(--accent); }
.btn-back:disabled { opacity: .45; cursor: default; }
.btn-back:disabled:hover { border-color: var(--line); color: var(--ink); }
.artnav {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 16px;
}
.artnav .btn-back { max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- 詞語詳情頁 ---- */
.wdetail { text-align: center; padding: 28px 22px; }
.wdetail .wpage { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.wdetail .bighanji { font-size: 52px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.wdetail .biglomaji { font-size: 24px; color: var(--accent); margin-top: 6px; }
.wdetail .bighuagi { font-size: 17px; color: var(--muted); margin-top: 8px; }
.wdetail .dbtns { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.wdetail .dbtns .pbtn {
  min-width: 92px; height: 40px; font-size: 14px; border-radius: 20px;
}
.wdetail .dtl {
  font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 22px;
  padding-top: 16px; border-top: 1px dashed var(--line);
}
.wdetail .dsuhui {
  font-size: 16px; line-height: 2; margin-top: 8px; text-align: left;
}
.wdetail .dsuhui .rom { color: var(--accent); font-size: 13px; }
.wdetail .djump { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.wdetail .djump input {
  width: 160px; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; outline: none; font-family: inherit;
}
.wdetail .djump input:focus { border-color: var(--accent); }
.wdetail .djump .toolbtn { padding: 8px 18px; }

/* 詞句詳情：句子較長，用較小大字 */
.sent-detail .bighanji { font-size: 30px; line-height: 1.7; }
.sent-detail .biglomaji { font-size: 19px; }
.sent-detail .bighuagi { font-size: 16px; }
.paper { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.paper h2 { font-size: 21px; color: var(--ink); margin-bottom: 4px; line-height: 1.4; }
.paper .ameta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.paper .playAll { margin: 10px 0 16px; }
.paper .playAll button {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 9px 22px; font-size: 15px; cursor: pointer; font-family: inherit;
}
.paper .playAll button.on { opacity: .75; }
.paper p.body { font-size: 16px; line-height: 2; margin-bottom: 14px; text-align: justify; }
.paper .note { font-size: 13px; color: var(--muted); line-height: 1.7; }
.paper .learn { font-size: 14px; line-height: 1.9; background: var(--chip); border-radius: 8px; padding: 10px 14px; margin-top: 14px; }
.paper h3 { font-size: 16px; margin: 20px 0 10px; color: var(--accent); }
.vrow {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px dashed var(--line); cursor: pointer;
}
.vrow:last-child { border-bottom: none; }
.vrow .vhanji { font-weight: 600; font-size: 16px; min-width: 88px; }
.vrow .vlomaji { color: var(--accent); font-size: 14px; min-width: 130px; }
.vrow .vhuagi { color: var(--muted); font-size: 13px; flex: 1; }
.vrow .pbtn { height: 26px; min-width: 36px; font-size: 11px; padding: 0 10px; }

/* ---- 底部播放条 ---- */
#nowBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
}
#nowToggle {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 16px; flex-shrink: 0;
}
#nowText { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 560px) {
  .item .no { display: none; }
  .vrow .vlomaji { min-width: 0; }
}
