/* 台日新辭書線上版 — 書卷風（沿 review_live 配色精簡化） */
* { box-sizing: border-box; }
:root {
  --bg: #f4f1ea;
  --card: #fffdf7;
  --line: #d8cfbc;
  --ink: #26221c;
  --sub: #6b6053;
  --bar: #2f2a24;
  --bar-ink: #f0ead9;
  --accent: #8a4b2d;      /* 台文/POJ 標示 */
  --jp: #5a6b7a;          /* 日文振假名 */
  --badge: #b08d4f;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 頁首 ── */
header.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--bar); color: var(--bar-ink);
  padding: 10px 16px;
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
}
header.top .title { font-size: 20px; font-weight: 700; color: var(--bar-ink); }
header.top .title:hover { text-decoration: none; }
header.top nav { margin-left: auto; display: flex; gap: 14px; font-size: 14px; }
header.top nav a { color: #cbbfa8; }

main { max-width: 1280px; margin: 0 auto; padding: 18px 16px 60px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.card h2 {
  margin: 0 0 10px; font-size: 15px; color: var(--sub);
  letter-spacing: .1em; font-weight: 700;
  border-bottom: 1px solid var(--line); padding-bottom: 6px;
}

/* ── 搜尋 ── */
.searchbox { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.searchbox input[type=search] {
  flex: 1 1 300px; font-size: 20px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--ink);
}
.searchbox input[type=search]:focus { outline: 2px solid var(--badge); }
.mode { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mode button {
  border: 0; background: #efe9dc; color: var(--sub);
  padding: 9px 16px; font-size: 15px; cursor: pointer;
}
.mode button.on { background: var(--bar); color: var(--bar-ink); }
.hint { font-size: 13px; color: var(--sub); margin-top: 8px; }
.stats { font-size: 13px; color: var(--sub); margin: 10px 2px; }

.results { list-style: none; margin: 0; padding: 0; }
.results li { border-bottom: 1px dashed var(--line); }
.results li:last-child { border-bottom: 0; }
.results a.row {
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
  padding: 10px 6px; color: var(--ink);
}
.results a.row:hover { background: #f6f0e2; text-decoration: none; }
.results .hz { font-size: 24px; font-weight: 700; min-width: 70px; }
.results .kn { font-size: 16px; color: var(--sub); }
.results .pj { font-size: 16px; color: var(--accent); font-style: italic; }
.results .sm {
  flex: 1 1 100%; font-size: 14px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
  font-size: 12px; color: #fff; background: var(--badge);
  border-radius: 4px; padding: 1px 8px; white-space: nowrap;
}
.badge.skel { background: #a09484; }

/* ── 詳細頁 ── */
.entryhead { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; }
.entryhead .hz { font-size: 42px; font-weight: 700; }
.entryhead .kn { font-size: 22px; color: var(--sub); }
.entryhead .pj { font-size: 22px; color: var(--accent); font-style: italic; }
.entryhead .loc { font-size: 13px; color: var(--sub); margin-left: auto; }

.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.imgcard .strips {
  display: flex; flex-direction: row-reverse; justify-content: flex-end;
  gap: 8px; overflow-x: auto; padding: 4px 2px;
}
.imgcard .strips img {
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  height: 640px; width: auto; cursor: zoom-in; flex: 0 0 auto;
}
.imgcard .src { font-size: 12px; color: var(--sub); margin-top: 8px; }
.imgcard .tools { font-size: 14px; margin-top: 6px; }

.sense { margin: 12px 0; }
.sense .marker {
  display: inline-block; font-weight: 700; color: var(--bar-ink);
  background: var(--bar); border-radius: 50%; width: 22px; height: 22px;
  text-align: center; line-height: 22px; font-size: 13px; margin-right: 6px;
}
.gloss { font-size: 18px; }
.zh { font-size: 17px; }
.pending { color: #a09484; font-size: 15px; }
.example {
  margin: 8px 0 8px 14px; padding-left: 12px;
  border-left: 3px solid var(--line);
}
.example .tw { font-size: 19px; }
.example .jp, .example .zhline { font-size: 16px; color: var(--ink); margin-top: 2px; }
.eqsign { color: var(--sub); margin: 0 6px; }
.noteline { font-size: 15px; color: var(--sub); margin: 6px 0 0 14px; }
.refline { font-size: 17px; margin: 6px 0; }
.chip {
  font-size: 12px; color: var(--sub); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 6px; margin-right: 6px; white-space: nowrap;
}

ruby { ruby-position: over; }
rt { font-size: 11px; color: var(--jp); letter-spacing: 0; }
ruby.tw rt { color: var(--accent); }
ruby.poj rt { color: var(--accent); font-style: italic; font-size: 10.5px; }
.fh { background: #f3e8d8; border-radius: 3px; }        /* 由標頭補回的字 */
.ed { border-bottom: 1px dotted var(--accent); cursor: help; }
.unc { border-bottom: 1px dotted #a09484; cursor: help; }
sup.tn { font-size: 10px; color: inherit; }

/* ── lightbox ── */
#lightbox {
  position: fixed; inset: 0; background: rgba(30,25,18,.85);
  display: none; align-items: center; justify-content: center; z-index: 99;
  cursor: zoom-out; overflow: auto; padding: 20px;
}
#lightbox.on { display: flex; }
#lightbox img { max-height: 96vh; max-width: 96vw; background: #fff; }

/* ── 回報 ── */
.reportbtn {
  font-size: 12px; color: var(--sub); background: none;
  border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 8px; cursor: pointer; float: right;
}
.reportbtn:hover { background: #efe9dc; }
#reportbox {
  position: fixed; inset: 0; background: rgba(30,25,18,.5);
  display: none; align-items: center; justify-content: center; z-index: 98; padding: 16px;
}
#reportbox.on { display: flex; }
#reportbox .panel {
  background: var(--card); border-radius: 10px; padding: 18px;
  max-width: 460px; width: 100%;
}
#reportbox textarea {
  width: 100%; min-height: 90px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 6px; padding: 8px;
  font-family: inherit;
}
#reportbox .actions { display: flex; gap: 10px; margin-top: 10px; justify-content: flex-end; }
#reportbox button {
  border: 1px solid var(--line); border-radius: 6px; background: #efe9dc;
  padding: 7px 16px; font-size: 15px; cursor: pointer;
}
#reportbox button.primary { background: var(--bar); color: var(--bar-ink); }

footer.site {
  max-width: 1280px; margin: 0 auto; padding: 14px 16px 40px;
  font-size: 13px; color: var(--sub); border-top: 1px solid var(--line);
}

/* ── 響應式 ── */
@media (max-width: 900px) {
  .twocol { grid-template-columns: 1fr; }
  .imgcard .strips img { height: 420px; }
  .entryhead .hz { font-size: 34px; }
  .results .hz { min-width: 56px; font-size: 21px; }
}

/* ── W1.5：導覽／校對模式／異調 ── */
.nav { margin-left: 12px; display: inline-flex; gap: 8px; }
.navbtn {
  font-size: 14px; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 12px; background: #efe9dc; color: var(--ink); white-space: nowrap;
}
.navbtn:hover { background: var(--bar); color: var(--bar-ink); text-decoration: none; }
.navbtn.off { opacity: .35; cursor: default; }
.entryhead .nav { margin-left: auto; }
.entryhead .loc { margin-left: 12px; }

a.row.othertone { opacity: .55; }
.badge.other { background: #8d8478; }

.chip.proof { background: #6b4b2d; color: #f0ead9; border-color: #6b4b2d; }
body.proof [data-edit] { cursor: text; }
body.proof [data-edit]:hover { outline: 1px dashed var(--badge); outline-offset: 2px; }
.edited { background: #f6e8b8 !important; border-radius: 3px; }

#editbox {
  position: fixed; inset: 0; background: rgba(30,25,18,.5);
  display: none; align-items: center; justify-content: center; z-index: 98; padding: 16px;
}
#editbox.on { display: flex; }
#editbox .panel {
  background: var(--card); border-radius: 10px; padding: 18px;
  max-width: 560px; width: 100%; max-height: 92vh; overflow-y: auto;
}
#editbox label { display: block; margin-top: 8px; }
#editbox textarea {
  width: 100%; min-height: 52px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 6px; padding: 8px;
  font-family: inherit; background: #fff;
}
#editbox #editorig { background: #f3efe6; color: var(--sub); }
#editbox .actions { display: flex; gap: 10px; margin-top: 12px; justify-content: flex-end; }
#editbox button {
  border: 1px solid var(--line); border-radius: 6px; background: #efe9dc;
  padding: 7px 16px; font-size: 15px; cursor: pointer;
}
#editbox button.primary { background: var(--bar); color: var(--bar-ink); }

@media (max-width: 900px) {
  .entryhead .nav { margin-left: 0; width: 100%; justify-content: space-between; }
}

#reportbox input[type=text] {
  width: 100%; font-size: 15px; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px; font-family: inherit; background: #fff;
}
#reportbox label { display: block; margin-top: 8px; }
