:root {
  --paper: #e8ebe3;      /* 青白宣纸 */
  --paper-2: #dde2d8;
  --ink: #18201d;        /* 墨 */
  --mist: #66736c;       /* 淡墨 */
  --line: #b9c2b8;
  --azurite: #24566b;    /* 石青 */
  --cinnabar: #b33a2b;   /* 朱砂，只用于印章与当前状态 */
  --gamboge: #c28f2c;    /* 藤黄 */
  --song: "Noto Serif SC", "Songti SC", "Source Han Serif SC", "SimSun", serif;
  --kai: "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", "楷体", var(--song);
  --top: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--song);
  font-size: 16px;
  line-height: 1.7;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
a, button { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
:focus-visible { outline: 2px solid var(--azurite); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
small { font-size: .68em; color: var(--mist); font-weight: 400; }

/* ───── 顶栏 ───── */
.top {
  height: var(--top);
  display: flex; align-items: center; gap: 28px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 1200;
  background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-seal {
  width: 38px; height: 38px; flex: none;
  background: var(--cinnabar); color: var(--paper);
  font-weight: 900; font-size: 15px; line-height: 1.05;
  display: grid; place-items: center; text-align: center;
  writing-mode: vertical-rl; letter-spacing: 1px;
  border-radius: 3px;
}
.brand-text { font-weight: 900; font-size: 19px; letter-spacing: .08em; line-height: 1.2; }
.brand-text small { display: block; letter-spacing: 0; font-size: 12px; }
.views { display: flex; gap: 4px; margin-left: 8px; }
.views a {
  padding: 6px 16px 5px; font-weight: 600; font-size: 17px; line-height: 1.2;
  border-bottom: 3px solid transparent; text-align: center;
}
.views a small { display: block; font-size: 11px; }
.views a:hover { background: var(--paper-2); }
.views a[aria-current] { border-bottom-color: var(--cinnabar); }
.search { margin-left: auto; position: relative; width: min(280px, 34vw); }
.search input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: transparent; border: 1px solid var(--line); border-radius: 3px;
  padding: 7px 12px;
}
.search input::placeholder { color: var(--mist); }
.q-results {
  position: absolute; right: 0; top: calc(100% + 6px); width: 340px; max-width: 90vw;
  margin: 0; padding: 6px; list-style: none;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 3px;
  box-shadow: 0 14px 30px -14px rgba(24, 32, 29, .5);
  max-height: 70vh; overflow: auto;
}
.q-results button { display: flex; width: 100%; gap: 12px; align-items: baseline; padding: 7px 10px; border-radius: 2px; }
.q-results button:hover, .q-results button.on { background: var(--paper-2); }
.q-results b { font-size: 18px; letter-spacing: .06em; }
.q-results span { color: var(--mist); font-size: 13px; margin-left: auto; white-space: nowrap; }
.q-results .none { padding: 8px 10px; color: var(--mist); font-size: 14px; }

main { height: calc(100% - var(--top)); position: relative; }
.view { position: absolute; inset: 0; }
.view[hidden] { display: none !important; }

/* ───── 插画占位（图未生成时显示成语首字） ───── */
.pic { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--paper-2); overflow: hidden; }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .35s ease; }
.pic img.in { opacity: 1; }
.pic::before {
  content: attr(data-ch); position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--line); font-weight: 900; font-size: 64px;
}
.detail .pic { background: #0f1513; }

/* ───── 地图 ───── */
#view-map { display: grid; grid-template-columns: 1fr 400px; }
#map { height: 100%; background: #d9dfd6; }
.leaflet-container { font-family: var(--song); background: #d9dfd6; }
.leaflet-tile-pane { filter: contrast(1.25) saturate(.6) sepia(.15); }
.pin { position: relative; }
.pin i {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--azurite); color: var(--paper); font-style: normal; font-weight: 600; font-size: 12px;
  border: 2px solid var(--paper); box-shadow: 0 1px 4px rgba(24, 32, 29, .45);
  width: var(--d); height: var(--d);
}
.pin b {
  position: absolute; left: calc(var(--d) + 4px); top: 50%; transform: translateY(-50%);
  font-size: 14px; font-weight: 900; white-space: nowrap; color: var(--ink);
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 3px var(--paper);
}
.pin.small b { display: none; }
.zoomed .pin.small b { display: block; font-weight: 600; font-size: 13px; }
.pin.on i { background: var(--cinnabar); }
.side { border-left: 1px solid var(--line); overflow-y: auto; padding: 22px 22px 40px; background: var(--paper); }
.side h2 { margin: 0; font-size: 34px; font-weight: 900; letter-spacing: .1em; line-height: 1.2; }
.side .sub { margin: 4px 0 18px; color: var(--mist); font-size: 14px; }
.side .lead { font-size: 15px; margin: 0 0 14px; }
.place-list { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 18px; }
.place-list button { display: flex; width: 100%; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.place-list button:hover { color: var(--azurite); }
.place-list span { color: var(--mist); font-variant-numeric: tabular-nums; }
.back { font-size: 14px; color: var(--azurite); margin-bottom: 12px; display: inline-block; }
.back:hover { text-decoration: underline; }

/* 列表里的成语条目（地图侧栏、典故地图侧栏） */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 132px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; align-items: start; }
.row .pic::before { font-size: 34px; }
.row h3 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: .1em; line-height: 1.3; }
.row p { margin: 2px 0 0; font-size: 13px; color: var(--mist); line-height: 1.55; }
.row:hover h3 { color: var(--azurite); }

/* ───── 详情 ───── */
.detail {
  width: min(1180px, 100vw - 32px); max-height: calc(100vh - 32px);
  padding: 0; border: 0; border-radius: 4px; overflow: hidden auto;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
}
.detail::backdrop { background: rgba(24, 32, 29, .72); }
.detail .hero { position: relative; aspect-ratio: 16 / 9; background: #0f1513; max-height: 62vh; width: 100%; overflow: hidden; }
.detail .hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail .hero .pending { position: absolute; inset: 0; display: grid; place-items: center; color: #5d6b65; font-size: 15px; }
.detail .bar { position: sticky; top: 0; z-index: 5; height: 0; display: flex; justify-content: flex-end; align-items: flex-start; gap: 8px; padding: 0 12px; }
.detail .bar > * { margin-top: 12px; backdrop-filter: blur(4px); box-shadow: 0 0 0 1px rgba(232, 235, 227, .18); }
.nw { white-space: nowrap; }
.detail:focus { outline: none; }
.detail .bar button, .detail .bar a {
  background: rgba(24, 32, 29, .78); color: var(--paper); border-radius: 3px; padding: 5px 12px; font-size: 14px; line-height: 1.5;
}
.detail .bar button:hover, .detail .bar a:hover { background: var(--cinnabar); }
.detail .body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 44px; padding: 34px 44px 30px; }
.detail h2 { margin: 0; font-size: clamp(40px, 5.4vw, 68px); font-weight: 900; line-height: 1.5; letter-spacing: .1em; white-space: nowrap; }
.detail h2 rt { font-size: 15px; font-weight: 400; letter-spacing: 0; color: #a9b5ad; font-family: Georgia, serif; }
.detail .meaning { margin: 14px 0 4px; font-size: 18px; }
.detail .en { margin: 0; color: #a9b5ad; font-size: 15px; font-style: italic; font-family: Georgia, serif; }
.detail blockquote { margin: 24px 0 0; padding: 0 0 0 16px; border-left: 3px solid var(--gamboge); font-family: var(--kai); font-size: 20px; line-height: 1.75; }
.detail blockquote cite { display: block; font-style: normal; font-family: var(--song); font-size: 14px; color: #a9b5ad; margin-top: 6px; }
.facts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 22px; border-top: 1px solid #3b4843; border-bottom: 1px solid #3b4843; }
.facts-grid dt { font-size: 13px; color: #a9b5ad; }
.facts-grid dd { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.facts-grid dd small { display: block; color: #a9b5ad; font-size: 13px; }
.facts-grid button:hover dd { color: var(--gamboge); }
.detail .story { margin: 0; font-size: 17px; line-height: 1.95; max-width: 34em; }
.detail .nav {
  display: flex; justify-content: space-between; gap: 16px; padding: 12px 44px 16px; font-size: 15px;
  position: sticky; bottom: 0; z-index: 4; background: var(--ink); border-top: 1px solid #2c3833;
}
.detail .nav button { color: #a9b5ad; }
.detail .nav button:hover { color: var(--paper); }
.detail .nav b { color: var(--paper); letter-spacing: .08em; margin: 0 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

.detail h2.long { font-size: clamp(30px, 3.6vw, 46px); white-space: normal; line-height: 1.9; }
.detail .hero .pending { align-content: center; gap: 6px; justify-items: center; }
.detail .hero .pending b { font-size: 120px; line-height: 1; color: #2c3833; font-weight: 900; }
.detail .src-note { margin: 22px 0 0; color: #a9b5ad; font-size: 14px; }
.facts-grid > * { padding: 12px 14px 12px 0; display: block; }
.facts-grid > * + * { padding-left: 14px; border-left: 1px solid #3b4843; }
.facts-grid + .facts-grid { margin-top: -22px; border-top: 0; }
.fact dd { color: var(--paper); }
.same-h { margin: 26px 0 10px; font-size: 14px; font-weight: 400; color: #a9b5ad; }
.same { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.same button { display: block; min-width: 0; }
.same .pic { border-radius: 2px; }
.same .pic::before { font-size: 30px; color: #2c3833; }
.same b { display: block; margin-top: 4px; font-size: 15px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.same button:hover b { color: var(--gamboge); }

/* ───── 列表页：常用 / 年代 / 出处 / 搜索 共用 ───── */
.pane { position: absolute; inset: 0; overflow-y: auto; padding: 0 32px 60px; }
.more { display: block; height: 1px; }
.head { padding: 26px 0 18px; max-width: 980px; }
.head h2 { margin: 0; font-size: 34px; font-weight: 900; letter-spacing: .1em; line-height: 1.25; }
.head h2 small { font-size: 14px; letter-spacing: 0; margin-left: 14px; font-weight: 400; }
.head p { margin: 6px 0 0; color: var(--mist); font-size: 15px; max-width: 46em; }
.head a { color: var(--azurite); }
.head a:hover { text-decoration: underline; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px 18px; }
.tile { display: block; min-width: 0; }
.tile .pic { border-radius: 2px; }
.tile .pic img { transition: transform .5s ease, opacity .35s ease; }
.tile:hover .pic img, .tile:focus-visible .pic img { transform: scale(1.04); }
.tile h3 { margin: 8px 0 0; font-size: 22px; font-weight: 900; letter-spacing: .12em; line-height: 1.3; }
.tile.long h3 { font-size: 17px; letter-spacing: .04em; }
.tile p { margin: 1px 0 0; font-size: 13px; color: var(--mist); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile:hover h3 { color: var(--azurite); }
.none { color: var(--mist); font-size: 14px; }

/* 常用：分层标签 */
.tabs {
  display: flex; position: sticky; top: 0; z-index: 2; margin: 0 -32px; padding: 0 32px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.tabs a { flex: 1 1 0; min-width: 0; padding: 10px 12px 8px; border-bottom: 3px solid transparent; }
.tabs a:hover { background: var(--paper-2); }
.tabs a[aria-current] { border-bottom-color: var(--cinnabar); }
.tabs b { display: block; font-size: 17px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs span { display: block; font-size: 12px; color: var(--mist); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 年代：顶部一条朝代带，宽度随条数 */
#view-era .pane { top: 54px; }
.eras {
  position: absolute; top: 0; left: 0; right: 0; height: 54px; display: flex;
  border-bottom: 1px solid var(--line); background: var(--paper-2);
}
.eras a {
  min-width: 0; border-right: 1px solid var(--line); border-bottom: 3px solid transparent;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font-weight: 600; font-size: 15px; line-height: 1.15; white-space: nowrap; overflow: hidden;
}
.eras a small { font-size: 11px; font-variant-numeric: tabular-nums; }
.eras a:hover { background: var(--paper); }
.eras a[aria-current] { background: var(--paper); border-bottom-color: var(--cinnabar); }

/* 出处：左边书目，右边网格 */
#view-book .pane { left: 300px; }
.book-side { position: absolute; top: 0; bottom: 0; left: 0; width: 300px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.book-side input {
  margin: 14px 16px 8px; font: inherit; font-size: 14px; color: var(--ink);
  background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 6px 10px;
}
.book-side input::placeholder { color: var(--mist); }
.book-list { flex: 1; overflow-y: auto; padding: 0 0 40px; }
.book-list a {
  display: grid; grid-template-columns: 1fr auto; column-gap: 10px; padding: 6px 18px 5px 15px;
  border-left: 3px solid transparent;
}
.book-list a:hover { background: var(--paper-2); }
.book-list a[aria-current] { border-left-color: var(--cinnabar); background: var(--paper-2); }
.book-list b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-list span { color: var(--mist); font-size: 13px; align-self: center; font-variant-numeric: tabular-nums; }
.book-list small { grid-column: 1 / -1; font-size: 12px; line-height: 1.3; }
.book-list .none { padding: 10px 18px; }

.q-results .all { display: block; padding: 8px 10px 6px; color: var(--azurite); font-size: 14px; border-top: 1px solid var(--line); margin-top: 4px; }
.q-results .all:hover { text-decoration: underline; }
.q-results span { overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

.book-toggle { display: none; }
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 1100; width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-size: 20px; text-align: center;
  box-shadow: 0 8px 20px -8px rgba(24, 32, 29, .6);
}
.to-top:hover { background: var(--azurite); }
.tile:active .pic img.in { opacity: .82; }

/* ───── 窄屏：上下堆叠 ───── */
@media (max-width: 820px) {
  :root { --top: 104px; }
  .top { flex-wrap: wrap; gap: 6px 12px; padding: 8px 16px; height: var(--top); align-content: center; }
  .brand-text small { display: none; }
  .search { flex: 1; width: auto; min-width: 0; }
  .views { order: 3; width: 100%; margin: 0; }
  .views a { flex: 1; padding: 4px 0; font-size: 16px; }
  .views a small { display: none; }

  .pane { padding: 0 16px 50px; }
  .tabs { margin: 0 -16px; padding: 0 16px; overflow-x: auto; }
  .tabs a { flex: none; padding: 8px 12px 6px; }
  .head h2 { font-size: 26px; }
  .head h2 small { display: block; margin: 2px 0 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .tile h3 { font-size: 18px; letter-spacing: .06em; }
  .tile.long h3 { font-size: 15px; }
  .pic::before { font-size: 40px; }
  .eras { overflow-x: auto; }
  .eras a { flex: none !important; padding: 0 12px; }

  /* 出处：书目收成一行，展开时盖在网格上 */
  #view-book .pane { left: 0; top: 57px; }
  .book-side {
    width: auto; right: 0; bottom: auto; z-index: 3; background: var(--paper);
    flex-flow: row wrap; align-items: center; gap: 0 10px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .book-side input { margin: 0; flex: 1; min-width: 0; padding: 7px 10px; }
  .book-toggle { display: block; font-size: 14px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 3px; white-space: nowrap; }
  .book-toggle::after { content: ' ▾'; color: var(--mist); }
  .book-side.open .book-toggle::after { content: ' ▴'; }
  .book-side .book-list { display: none; }
  .book-side.open { box-shadow: 0 18px 30px -18px rgba(24, 32, 29, .55); }
  .book-side.open .book-list { display: block; flex-basis: 100%; max-height: 62vh; margin: 8px -16px -10px; padding-bottom: 12px; border-top: 1px solid var(--line); }
  .to-top { right: 14px; bottom: 16px; }

  #view-map { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; }
  .side { border-left: 0; border-top: 1px solid var(--line); padding: 16px; }

  .detail { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
  .detail .body { grid-template-columns: 1fr; gap: 24px; padding: 20px 16px; }
  .detail .nav { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); font-size: 14px; }
  .detail .nav b { margin: 0 4px; }
  .detail .hero { max-height: none; }
  .detail h2 { font-size: 44px; }
  .facts-grid > * { padding: 10px 10px 10px 0; }
  .facts-grid > * + * { padding-left: 10px; }
  .facts-grid dd { font-size: 17px; }
  .facts-grid dd small { font-size: 12px; }
  .same { gap: 10px 8px; }
  .same b { font-size: 14px; }
}

/* ───── 测验 ───── */
.quiz { max-width: 980px; margin: 0 auto; }
.quiz kbd {
  display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .3em;
  font: 600 12px/1 Georgia, serif; color: var(--mist); border: 1px solid var(--line); border-radius: 3px;
}
.quiz .note { color: var(--mist); font-size: 13px; margin: 8px 0 0; }
.quiz h3 { margin: 0 0 6px; font-size: 21px; font-weight: 900; letter-spacing: .06em; }
.q-go, .q-acts button {
  font-size: 16px; font-weight: 600; padding: 8px 20px; border-radius: 3px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
}
.q-go:hover, .q-acts button:hover { background: var(--azurite); border-color: var(--azurite); }
.q-acts button:not(.q-next):not(.q-go) { background: transparent; color: var(--ink); }
.q-acts button:not(.q-next):not(.q-go):hover { color: var(--paper); }
.q-acts { display: flex; gap: 10px; margin: 14px 0 0; flex-wrap: wrap; }
.q-acts.center { justify-content: center; margin: 34px 0 10px; }
.q-acts kbd { color: inherit; border-color: currentColor; opacity: .7; margin-left: 4px; }

/* 首页 */
.q-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.q-card { border: 1px solid var(--line); border-radius: 4px; padding: 20px 22px 22px; background: var(--paper); display: flex; flex-direction: column; }
.q-card > p { margin: 0 0 12px; color: var(--mist); font-size: 14px; }
.q-card fieldset { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.q-card legend { font-size: 13px; color: var(--mist); padding: 0; margin-bottom: 6px; }
.q-card .q-go { margin-top: auto; align-self: flex-start; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: block; padding: 4px 12px; border: 1px solid var(--line); border-radius: 3px; font-size: 15px; line-height: 1.4; }
.chip small { display: block; font-size: 11px; }
.chip:hover span { background: var(--paper-2); }
.chip input:checked + span { border-color: var(--cinnabar); box-shadow: inset 0 0 0 1px var(--cinnabar); }
.chip input:focus-visible + span { outline: 2px solid var(--azurite); outline-offset: 2px; }
.q-hist { margin-top: 28px; }
.q-hist ul { list-style: none; margin: 0; padding: 0; }
.q-hist li { display: flex; gap: 16px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.q-hist li span { color: var(--mist); font-size: 14px; min-width: 9em; }
.q-hist li small { margin-left: auto; font-size: 13px; }
.q-method { margin: 28px 0 10px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
.q-method summary { cursor: pointer; color: var(--azurite); }
.q-method p { margin: 10px 0 0; max-width: 46em; }
.q-method a { color: var(--azurite); text-decoration: underline; }

/* 答题 */
.q-play, .q-result { padding-top: 16px; }
.q-top { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--mist); padding-bottom: 10px; }
.q-bar { flex: 1; height: 4px; background: var(--paper-2); border-radius: 2px; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: var(--azurite); transition: width .3s; }
.q-score { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); }
.q-quit { margin-left: auto; color: var(--azurite); }
.q-bar + .q-quit, .q-score + .q-quit { margin-left: 0; }
.q-quit:hover { text-decoration: underline; }
.q-ask { margin: 4px 0 12px; font-size: 18px; font-weight: 600; }
.q-hero { margin: 0 auto; max-width: min(100%, calc(52vh * 16 / 9)); }
.q-hero img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--ink) center / cover; border-radius: 2px; }
.q-opts.words { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px auto 0; max-width: min(100%, calc(52vh * 16 / 9)); }
.q-opts button {
  position: relative; border: 1px solid var(--line); border-radius: 3px; background: var(--paper);
  transition: border-color .15s, background .15s;
}
.q-opts button:not(:disabled):hover { border-color: var(--azurite); background: var(--paper-2); }
.q-opts button:disabled { cursor: default; }
.q-opts.words button { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; padding: 10px 14px; min-height: 58px; }
.q-opts.words b { font-family: var(--kai); font-size: 25px; letter-spacing: .1em; line-height: 1.25; }
.q-opts.words .long b { font-size: 19px; letter-spacing: .03em; }
.q-opts.words small { grid-column: 2; font-size: 13px; line-height: 1.4; }
.q-opts.words small:empty { display: none; }
.q-word { text-align: center; margin: 0 0 14px; font-family: var(--kai); font-size: clamp(44px, 7vw, 76px); letter-spacing: .14em; line-height: 1.2; }
.q-word.long { font-size: clamp(32px, 4.6vw, 52px); letter-spacing: .06em; }
.q-word small { display: block; min-height: 1.6em; font-family: Georgia, serif; font-size: 16px; letter-spacing: .04em; }
.q-opts.pics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 auto; max-width: min(100%, calc(22vh * 32 / 9 + 40px)); }
.q-opts.pics button { padding: 4px; }
.q-opts.pics .pic { border-radius: 2px; }
.q-opts.pics kbd { position: absolute; top: 10px; left: 10px; background: rgba(24, 32, 29, .72); color: var(--paper); border-color: transparent; }
.q-opts.pics b { display: block; text-align: center; font-family: var(--kai); font-size: 19px; letter-spacing: .08em; line-height: 1.4; }
.q-opts.pics b:empty { display: none; }
.q-opts button.right { border-color: var(--azurite); box-shadow: inset 0 0 0 2px var(--azurite); background: var(--paper-2); }
.q-opts button.picked { border-color: var(--cinnabar); box-shadow: inset 0 0 0 2px var(--cinnabar); }
.q-opts:has(.right) button:not(.right):not(.picked) { opacity: .55; }
.q-foot { display: flex; align-items: center; gap: 16px; margin: 14px auto 0; max-width: min(100%, calc(52vh * 16 / 9)); }
.q-opts.pics ~ .q-foot { max-width: min(100%, calc(22vh * 32 / 9 + 40px)); }
.q-skip { display: inline-flex; gap: 8px; align-items: center; padding: 6px 14px; border: 1px solid var(--line); border-radius: 3px; font-size: 15px; flex: none; }
.q-skip:not(:disabled):hover { border-color: var(--azurite); }
.q-skip.picked { border-color: var(--cinnabar); }
.q-hint { margin: 0; font-size: 13px; color: var(--mist); }
.q-reveal { margin: 0 auto; max-width: min(100%, calc(52vh * 16 / 9)); min-height: 20px; }
.q-reveal:not(:empty) { margin-top: 14px; padding: 12px 0 0; border-top: 1px solid var(--line); }
.q-res { margin: 0; font-size: 18px; }
.q-res b { font-weight: 600; margin-right: 4px; }
.q-res.right b { color: var(--azurite); }
.q-res span { color: var(--mist); font-family: Georgia, serif; font-size: 15px; margin-left: 6px; }
.q-mean { margin: 4px 0 0; font-size: 15px; }

/* 结果 */
.q-hero-num { text-align: center; padding: 18px 0 10px; }
.q-hero-num p { margin: 0; color: var(--mist); }
.q-hero-num .big { color: var(--ink); font-size: 24px; line-height: 1.2; margin: 6px 0; }
.q-hero-num .big b { font-size: 76px; font-weight: 900; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.q-hero-num .range { font-size: 15px; }
.q-chart, .q-tiers, .q-missed { margin-top: 30px; }
.q-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 6px; font-size: 13px; color: var(--mist); }
.q-legend span { display: inline-flex; align-items: center; gap: 6px; }
.q-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.q-legend .dot.right { background: var(--azurite); }
.q-legend .dot.wrong { border: 1.5px solid var(--mist); }
.q-legend .dot.skip { background: var(--mist); width: 6px; height: 6px; }
.q-legend .line { width: 16px; height: 2px; background: var(--azurite); display: inline-block; }
.q-plot { position: relative; }
.q-plot svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.q-plot text { font: 12px var(--song); fill: var(--mist); }
.q-plot .tl { fill: var(--ink); font-size: 12px; }
.q-plot .g { stroke: var(--line); stroke-width: 1; }
.q-plot .t { stroke: var(--line); stroke-width: 1; }
.q-plot .l { fill: none; stroke: var(--azurite); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.q-plot .a { fill: var(--azurite); opacity: .08; }
.q-plot .d { stroke: var(--paper); stroke-width: 2; }
.q-plot .d.right { fill: var(--azurite); }
.q-plot .d.wrong { fill: var(--paper); stroke: var(--mist); stroke-width: 1.5; }
.q-plot .d.skip { fill: var(--mist); }
.q-plot .x { stroke: var(--ink); stroke-width: 1; opacity: .35; }
.q-tip {
  position: absolute; pointer-events: none; white-space: nowrap; font-size: 13px; line-height: 1.45;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 3px; padding: 5px 9px;
  box-shadow: 0 8px 20px -10px rgba(24, 32, 29, .5);
}
.q-tip b { display: block; font-size: 15px; }
.q-tiers table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.q-tiers th, .q-tiers td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.q-tiers thead th { font-size: 13px; color: var(--mist); }
.q-tiers tbody th a:hover { color: var(--azurite); }
.q-tiers td.meter { width: 40%; font-size: 14px; color: var(--mist); }
.q-tiers td.meter div { display: flex; align-items: center; gap: 10px; }
.q-tiers .meter span { flex: 1; height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.q-tiers .meter i { display: block; height: 100%; background: var(--azurite); border-radius: 0 4px 4px 0; }
.q-missed .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.q-missed .tile { text-align: left; }
.q-missed .tile h3 { font-size: 20px; margin-top: 8px; }

@media (max-width: 820px) {
  .q-cards { grid-template-columns: 1fr; }
  .q-opts.words { grid-template-columns: 1fr; }
  .q-opts.pics { gap: 8px; }
  .q-opts.words b { font-size: 22px; }
  .q-hint { display: none; }
  .q-hero-num .big b { font-size: 58px; }
  .q-tiers td.meter { width: auto; }
  .q-tiers thead th:last-child, .q-tiers td.meter span { display: none; }
}

/* ───── 详情：近义、反义 ───── */
.detail .rel { margin: 24px 0 0; display: grid; gap: 10px; }
.detail .rel > div { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; }
.detail .rel dt { font-size: 13px; color: #a9b5ad; padding-top: 3px; }
.detail .rel dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.detail .rel button {
  font-family: var(--kai); font-size: 17px; letter-spacing: .06em; line-height: 1.3;
  padding: 3px 10px; border: 1px solid #3b4843; border-radius: 2px; color: var(--paper);
}
.detail .rel button:hover { border-color: var(--gamboge); color: var(--gamboge); }
