/* 我的閱讀星圖 — 視覺與交互樣式直接復刻 xt.bdfz.net（jc-atlas public/assets/styles.css），
   僅新增 .facts / #empty-state / .rows.history 三處 yw 專用區塊。 */
:root {
  --bg: #0A0C14;
  --ink: #EDEFF7;
  --ink2: #C6CDE0;
  --dim: #98A0B8;
  --faint: #646C84;
  --hair: rgba(198, 205, 224, .13);
  --panel: rgba(13, 16, 26, .92);
  --red: #FF3B30;
  --serif: "Songti TC", "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sans: -apple-system, "PingFang TC", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.65 var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#stage { position: fixed; inset: 0; }
#stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120vmax 90vmax at 62% 42%, rgba(38, 48, 82, .20) 0%, transparent 58%),
    radial-gradient(closest-side at 50% 120%, rgba(10, 12, 20, .0) 60%, rgba(4, 5, 10, .55) 100%);
}
#gl {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: grab;
}
#gl.drag { cursor: grabbing; }

/* ---------- 左上编辑部头版 ---------- */
#hud {
  position: fixed; top: 0; left: 0; z-index: 5;
  padding: 34px 40px;
  max-width: min(430px, 92vw);
  pointer-events: none;
}
#hud .brand {
  font: 700 11px/1 var(--mono);
  letter-spacing: .34em; color: var(--faint);
  margin-bottom: 16px;
}
#hud h1 {
  font-family: var(--serif);
  font-size: 52px; line-height: 1.12; font-weight: 600;
  letter-spacing: .02em;
}
#hud h1 .dot { color: var(--red); }
#hud .lede {
  margin-top: 14px;
  font-weight: 600; font-size: 14.5px; color: var(--ink);
}
#hud .sub {
  margin-top: 8px; font-size: 13.5px; color: var(--dim); line-height: 1.75;
}
#hud .sub b { color: var(--ink2); font-variant-numeric: tabular-nums; }
#hud .fine { margin-top: 10px; font-size: 12px; color: var(--faint); }
#hud .fine b { color: var(--dim); }
#hud .fine a { color: var(--dim); text-decoration-color: var(--faint); pointer-events: auto; }
#hud .fine a:hover { color: var(--ink2); }

#chips { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 4px 2px; pointer-events: auto; max-width: 340px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 9px; border-radius: 8px; border: 0; background: none;
  color: var(--ink2); font: 12.5px var(--sans); cursor: pointer;
  transition: background .15s, opacity .15s;
  user-select: none; -webkit-user-select: none;
}
.chip:hover { background: rgba(198, 205, 224, .07); }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(8,10,18,.4); }
.chip .ct { color: var(--faint); font: 11px var(--mono); }
.chip.off { opacity: .30; }

/* ---------- 搜索 ---------- */
#searchbox { position: fixed; top: 26px; right: 28px; z-index: 6; width: min(280px, 58vw); }
#search {
  width: 100%; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--hair); background: rgba(13, 16, 26, .7); color: var(--ink);
  font: 13px var(--sans); outline: none; backdrop-filter: blur(12px);
  transition: border-color .15s;
}
#search:focus { border-color: rgba(198, 205, 224, .35); }
#search::placeholder { color: var(--faint); }
#search-results {
  margin-top: 8px; border-radius: 12px; overflow: hidden auto; max-height: 46vh;
  border: 1px solid var(--hair); background: var(--panel); backdrop-filter: blur(16px);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .55);
}
.sr {
  display: flex; align-items: baseline; gap: 9px; width: 100%;
  padding: 8px 13px; border: 0; background: none; color: var(--ink2);
  font: 13px var(--sans); text-align: left; cursor: pointer;
}
.sr:hover { background: rgba(198, 205, 224, .08); color: var(--ink); }
.sr .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; align-self: center; }
.sr .lb { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr .ctx { flex: none; color: var(--faint); font-size: 11px; }

/* ---------- 底部提示 ---------- */
#hint {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 4; pointer-events: none; white-space: nowrap;
  font-size: 12px; letter-spacing: .06em; color: var(--faint);
}

/* ---------- 详情卡 ---------- */
#card {
  position: fixed; right: 24px; top: 24px; bottom: 24px; z-index: 7;
  width: min(330px, calc(100vw - 32px));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 20px 18px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--hair);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  animation: cardin .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes cardin { from { opacity: 0; transform: translateX(14px); } }
.card-top { display: flex; justify-content: space-between; align-items: center; min-height: 26px; margin: 0 -6px 4px; }
.ghost {
  border: 0; background: none; color: var(--dim); cursor: pointer;
  font: 13px var(--sans); padding: 3px 8px; border-radius: 7px;
}
#card-close { font-size: 19px; line-height: 1; margin-left: auto; }
.ghost:hover { color: var(--ink); background: rgba(198, 205, 224, .08); }
#card .kind {
  font: 700 10.5px var(--mono); letter-spacing: .22em;
  color: var(--kc, var(--dim));
}
#card h2 {
  font-family: var(--serif);
  margin: 6px 0 12px; font-size: 21px; line-height: 1.4; font-weight: 600;
}
.facts {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px; margin: 0 -2px;
  border: 1px solid var(--hair); border-radius: 12px;
  background: rgba(198, 205, 224, .04);
  font-size: 12px; color: var(--dim);
}
.facts b { color: var(--ink2); font-variant-numeric: tabular-nums; }
.facts .fact { display: inline-flex; gap: 5px; align-items: baseline; }
.facts .word-pill {
  padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--hair); color: var(--ink);
  font-size: 12.5px; background: rgba(237, 239, 247, .05);
}
.sect { margin-top: 15px; }
.sect[hidden] { display: none; }
.sect-h {
  font: 700 10.5px var(--mono); letter-spacing: .22em; color: var(--faint);
  padding-bottom: 6px; border-bottom: 1px solid var(--hair);
}
.sect-h .mono { color: var(--dim); }
.rows { list-style: none; }
.rows li { border-bottom: 1px solid rgba(198, 205, 224, .06); }
.rows button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 2px; border: 0; background: none; color: var(--ink2);
  font: 13px/1.5 var(--sans); text-align: left; cursor: pointer;
}
.rows button:hover { color: var(--ink); }
.rows .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(8,10,18,.4); }
.rows .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .ctx { flex: none; color: var(--faint); font-size: 11px; }
.rows .more { color: var(--faint); font-size: 11.5px; padding: 6px 2px; }
.rows.history li { display: flex; flex-direction: column; gap: 2px; padding: 7px 2px; }
.rows.history .h-words { color: var(--ink2); font-size: 13px; }
.rows.history .h-words.inactive { color: var(--faint); text-decoration: line-through rgba(152,160,184,.5); }
.rows.history .h-meta { color: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.cta {
  display: block; margin-top: 18px; padding: 10px 0; text-align: center;
  border-radius: 10px; border: 1px solid var(--hair);
  background: rgba(237, 239, 247, .06);
  color: var(--ink); text-decoration: none; font-size: 13px; letter-spacing: .04em;
  transition: background .15s;
}
.cta:hover { background: rgba(237, 239, 247, .12); }

/* ---------- tooltip ---------- */
#tooltip {
  position: fixed; z-index: 8; pointer-events: none;
  padding: 6px 12px; border-radius: 9px; max-width: 320px;
  background: rgba(10, 13, 22, .94); border: 1px solid var(--hair);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .5);
  font-size: 12.5px; color: var(--ink);
  transform: translate(14px, -50%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#tooltip .ctx { color: var(--dim); font-size: 11px; margin-left: 7px; }

/* ---------- 空星空 / 未登入 ---------- */
#empty-state {
  position: fixed; inset: 0; z-index: 9; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 92px;
}
#empty-state[hidden] { display: none; }
.empty-inner {
  pointer-events: auto; text-align: center;
  max-width: min(420px, calc(100vw - 48px));
  padding: 22px 26px 20px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--hair);
  backdrop-filter: blur(18px); box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
}
.empty-inner h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 12px 0 8px; }
.empty-inner p { color: var(--dim); font-size: 13px; line-height: 1.75; }
.empty-inner .cta { margin-top: 14px; padding: 9px 18px; display: inline-block; }
.pearl.still { display: inline-block; animation: none; }

/* ---------- loading ---------- */
#loading {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  background: var(--bg); color: var(--faint); letter-spacing: .3em; font-size: 12px;
  transition: opacity .6s;
}
#loading.done { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .6s, visibility 0s .6s; }
.pearl {
  width: 12px; height: 12px; border-radius: 50%;
  background: #EB547D;
  animation: pearl 1.3s ease-in-out infinite;
}
@keyframes pearl { 50% { transform: scale(.5); opacity: .45; background: #4E6CF1; } }

/* ---------- 移动端 ---------- */
@media (max-width: 680px) {
  #hud { padding: 18px 20px; max-width: 100vw; }
  #hud .brand { margin-bottom: 8px; }
  #hud h1 { font-size: 30px; }
  #hud .lede { font-size: 13px; margin-top: 8px; }
  #hud .sub, #hud .fine { display: none; }
  #chips { margin-top: 10px; gap: 0; }
  .chip { padding: 3px 7px; font-size: 11.5px; }
  #searchbox { top: auto; bottom: 46px; right: 12px; left: 12px; width: auto; }
  #search-results { position: absolute; bottom: 100%; margin: 0 0 8px; width: 100%; }
  #hint { bottom: 14px; font-size: 10.5px; }
  #card {
    top: auto; right: 8px; left: 8px; bottom: 96px; width: auto;
    max-height: 48vh;
  }
  #empty-state { padding-bottom: 110px; }
}
