/* Coin's Creative Cabin · 壁纸玻璃主题
   在 styles.css 之后加载：沿用原有组件结构，只替换配色、外壳与排版。 */

:root {
  color-scheme: light;

  --wallpaper: url("../img/story-library.jpg");
  --wallpaper-dim: 0.5;
  --glass-alpha: 0.78;
  --card-alpha: 0.5;
  --glass-blur: 20px;
  --rim-strength: 1;
  --reading-scale: 1;
  /* 外壳只做承载层：轻雾即可（iOS 主屏幕的页面≈壁纸），
     雾度集中在玻璃件自身的 backdrop blur 上；
     仍跟随玻璃滑块，但只取其 24%，避免把壁纸垫成白底 */
  --glass: rgba(255, 255, 255, calc(var(--glass-alpha) * 0.24));
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-soft: rgba(255, 255, 255, calc(var(--card-alpha) - 0.04));
  /* 官方厚度感描边：顶边宽亮带 → 侧面渐弱 → 底边收暗（180° 而非对角） */
  --glass-rim: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.58) 26%,
    rgba(202, 214, 236, 0.3) 58%,
    rgba(118, 134, 172, 0.44) 100%
  );
  --rule: rgba(38, 42, 51, 0.12);
  --accent-rgb: 79, 109, 245;
  --accent-weak: rgba(var(--accent-rgb), 0.09);
  --text: #262a33;
  --sidebar-w: 244px;

  /* 把原来的纸感变量映射到蓝灰玻璃色板 */
  --paper: #eef1f8;
  --paper-deep: #e8ecf6;
  --card: #f4f7fd;
  --card-raised: #ffffff;
  --ink: #232838;
  --ink-soft: #3c4356;
  --muted: #5f6778;
  --faint: #8991a4;
  --line: var(--rule);
  --line-soft: rgba(38, 42, 51, 0.07);
  --line-strong: rgba(38, 42, 51, 0.22);
  --accent: #4f6df5;
  --accent-deep: #3b55d4;
  --accent-pair: #8a5cf6;
  --accent-soft: rgba(var(--accent-rgb), 0.1);
  --danger: #d24848;
  --amber: #a9751f;
  --amber-soft: rgba(217, 154, 43, 0.14);
  --green: #2d7a56;
  --green-soft: rgba(47, 158, 111, 0.13);
  --indigo: #5a5fa8;
  --indigo-soft: rgba(90, 95, 168, 0.13);
  --shadow-sm: 0 1px 2px rgba(30, 40, 90, 0.04);
  --shadow-md: 0 14px 34px -18px rgba(30, 40, 90, 0.32), 0 2px 8px rgba(30, 40, 90, 0.05);
  --radius: 14px;
  --maxw: 1060px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "Microsoft YaHei", "PingFang SC", sans-serif;
  --serif: var(--sans);
  --reading: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC",
    "SimSun", Georgia, serif;
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background-color: #16203a;
  background-image:
    linear-gradient(
      180deg,
      rgba(12, 19, 38, calc(0.1 + var(--wallpaper-dim) * 0.52)),
      rgba(12, 19, 38, calc(var(--wallpaper-dim) * 0.2)) 42%,
      rgba(12, 19, 38, calc(0.12 + var(--wallpaper-dim) * 0.52))
    ),
    var(--wallpaper);
  background-position: center, center;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(var(--accent-rgb), 0.2);
}

:focus-visible {
  outline-color: var(--accent);
}

/* ---------- 磨砂外壳 ---------- */

.page {
  width: calc(100% - 3rem);
  max-width: var(--maxw);
  margin: 2.8rem auto 3.2rem;
  padding: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  background: var(--glass);
  box-shadow: 0 20px 60px rgba(18, 28, 65, 0.3), 0 2px 8px rgba(18, 28, 65, 0.14);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.25);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.25);
  overflow: hidden;
}

.content {
  min-width: 0;
  padding: 2.4rem 2.6rem 1.5rem;
}

/* ---------- 左侧栏 ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.7rem 1.05rem 1.3rem;
  /* HIG：侧栏属于功能层玻璃——更透，右缘一道亮线勾出玻璃分隔 */
  border-right: 1px solid rgba(255, 255, 255, calc(0.34 * var(--rim-strength)));
  background: rgba(255, 255, 255, calc(var(--card-alpha) * 0.36));
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, calc(0.16 * var(--rim-strength)));
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0 0.3rem;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-pair));
  color: #fff;
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.35);
}

.avatar svg {
  width: 26px;
  height: 26px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-text .name {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.brand-text .tagline {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.22em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.46rem 0.8rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  color: var(--text);
  background: var(--accent-weak);
  text-decoration: none;
}

button.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-kbd {
  margin-left: auto;
  padding: 0.04rem 0.38rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.5;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .nav-kbd {
    display: none;
  }
}

.nav-item.is-active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 16px -8px rgba(var(--accent-rgb), 0.85);
}

.nav-svg {
  width: 15px;
  height: 15px;
  flex: none;
  opacity: 0.75;
}

.nav-item.is-active .nav-svg {
  opacity: 1;
}

.nav-count {
  min-width: 1.35rem;
  margin-left: auto;
  padding: 0.02rem 0.4rem;
  border-radius: 999px;
  background: rgba(38, 42, 51, 0.08);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  text-align: center;
}

.nav-item.is-active .nav-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.nav-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-top: 1.05rem;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  padding: 0 0.55rem;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.nav-label-icon {
  width: 14px;
  height: 14px;
  flex: none;
  opacity: 0.8;
}

.subnav {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
  margin: 0;
  padding-left: 0.55rem;
  border-left: 2px solid var(--rule);
}

.side-novel-list {
  max-height: 30vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.side-novel-list::-webkit-scrollbar {
  width: 5px;
}

.side-novel-list::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 3px;
}

.side-novel-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.32rem 0.6rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.side-novel-link:hover {
  color: var(--accent);
  background: var(--accent-weak);
  text-decoration: none;
}

.side-novel-link.is-active {
  color: var(--accent);
  background: var(--accent-weak);
  font-weight: 600;
}

.side-novel-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--cover-a, #9aa3b8);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.side-novel-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-empty {
  margin: 0;
  padding: 0.2rem 0.6rem;
  color: var(--faint);
  font-size: 0.8rem;
}

.side-current-group {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.side-current-reveal {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.side-current-group.is-open .side-current-reveal {
  grid-template-rows: 1fr;
}

.side-current-inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 200ms ease,
    transform 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.side-current-group.is-open .side-current-inner {
  opacity: 1;
  transform: none;
}

.side-current-group.is-settled .side-current-inner {
  overflow: visible;
}

.side-current-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.45rem;
  padding: 0 0.55rem;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.side-current-label::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.side-book {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.35rem;
  padding: 0.42rem 0.6rem;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 9px;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.side-book:hover {
  color: var(--accent-deep);
  text-decoration: none;
}

.side-book-icon {
  width: 14px;
  height: 14px;
  flex: none;
  opacity: 0.85;
}

.side-book-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-sections {
  margin-top: 0.35rem;
  padding-left: 0.55rem;
  border-left: 2px solid var(--accent-weak);
}

.sidebar .workspace-nav-link {
  gap: 0.5rem;
  padding: 0.34rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  box-shadow: none;
}

.sidebar .workspace-nav-link:hover {
  background: var(--accent-weak);
  color: var(--accent);
}

.sidebar .workspace-nav-link.is-active {
  border-color: transparent;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 600;
  box-shadow: none;
}

.sidebar .workspace-nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  background: none;
  color: inherit;
}

.sidebar .workspace-nav-icon .icon {
  width: 15px;
  height: 15px;
}

.sidebar .workspace-nav-link.is-active .workspace-nav-icon {
  background: none;
  color: inherit;
}

.sidebar .workspace-nav-count {
  margin-left: auto;
  padding: 0;
  border-radius: 0;
  background: none;
  color: var(--faint);
  font-size: 0.7rem;
}

.sidebar .workspace-nav-link.is-active .workspace-nav-count {
  background: none;
  color: var(--accent);
}

.sidebar-footer {
  position: relative;
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.side-actions {
  display: flex;
  gap: 0.4rem;
}

.side-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--glass-soft);
  color: var(--muted);
  font-size: 0.8rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.side-action:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

.side-action .icon {
  width: 14px;
  height: 14px;
}

/* ---------- 外观设置 ---------- */

.appearance-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 260px;
  max-height: min(600px, calc(100vh - 24px));
  padding: 0.75rem 0.85rem 0.5rem;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(252, 253, 255, 0.95);
  box-shadow: 0 18px 44px -18px rgba(15, 25, 60, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.appearance-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.appearance-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.1rem;
  scrollbar-color: rgba(95, 103, 120, 0.32) transparent;
  scrollbar-width: thin;
}

.appearance-scroll::-webkit-scrollbar {
  width: 4px;
}

.appearance-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(95, 103, 120, 0.26);
}

.appearance-group + .appearance-group {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--rule);
}

.appearance-subtitle {
  margin: 0;
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.5;
}

.appearance-subtitle-spaced {
  margin-top: 0.5rem;
}

.appearance-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.appearance-preset {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.38rem 0.45rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.appearance-preset:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-deep);
}

.appearance-preset.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-deep);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.16);
}

.preset-dot {
  width: 14px;
  height: 14px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--rule);
}

.appearance-preset[data-preset="mist"] .preset-dot {
  background: linear-gradient(135deg, #e7edff, #7d93f8);
}

.appearance-preset[data-preset="dusk"] .preset-dot {
  background: linear-gradient(135deg, #a99cf5, #2a2f66);
}

.appearance-preset[data-preset="warm"] .preset-dot {
  background: linear-gradient(135deg, #f4e5c7, #b98a3e);
}

.appearance-preset[data-preset="clear"] .preset-dot {
  background: linear-gradient(135deg, #d8f4f0, #4aa9a1);
}

.appearance-preset[data-preset="liquid"] .preset-dot {
  background: linear-gradient(135deg, #f2f7ff, #8fb0f8 52%, #4f6df5);
}

.appearance-swatches {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin-top: 0.3rem;
}

.accent-swatch {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--swatch);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(38, 42, 51, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.accent-swatch:hover {
  transform: scale(1.08);
}

.accent-swatch.is-active {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 3.5px var(--accent);
}

.accent-swatch .icon {
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.accent-swatch.is-active .icon {
  opacity: 1;
}

.appearance-title {
  margin: 0;
  padding-left: 0.55rem;
  border-left: 3px solid var(--accent);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
}

.appearance-close {
  margin: -0.2rem -0.25rem -0.2rem 0;
}

.appearance-field {
  display: block;
  margin-top: 0.42rem;
}

.appearance-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.5;
}

.appearance-label output {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.appearance-field input[type="range"] {
  width: 100%;
  height: 16px;
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.appearance-tip {
  margin: 0.45rem 0 0;
  color: var(--faint);
  font-size: 0.62rem;
  line-height: 1.5;
}

.appearance-foot {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
}

.appearance-reset {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.72rem;
}

.appearance-reset:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

.appearance-saved {
  color: var(--faint);
  font-size: 0.66rem;
  line-height: 1.4;
  text-align: right;
}

html.is-sheer {
  --muted: #4d566a;
  --faint: #646e82;
}

html.is-sheer .page {
  /* 通透档位下仍要保住可读性：外壳白雾不低于 0.3，雾度不低于 9px */
  background: rgba(
    255,
    255,
    255,
    clamp(0.3, calc(var(--glass-alpha) * 0.3 + 0.06), 0.62)
  );
  backdrop-filter: blur(clamp(9px, var(--glass-blur), 30px)) saturate(1.25);
  -webkit-backdrop-filter: blur(clamp(9px, var(--glass-blur), 30px))
    saturate(1.25);
}

html.is-sheer .sidebar {
  background: rgba(
    255,
    255,
    255,
    clamp(0.38, calc(var(--card-alpha) * 0.36 + 0.12), 0.7)
  );
}

/* 通透状态下次级按钮垫实一点，避免与背景拉不开 */
html.is-sheer .btn.ghost {
  border-color: rgba(139, 152, 180, 0.55);
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
}

/* 文字清晰度原则（修「白晕糊字」）：
   白色文字阴影会把字形边缘晕开，尤其是浅灰字在深壁纸上——一律不用。
   · 玻璃件内的文字：雾底已足够，无需任何阴影；
   · 直接坐在壁纸上的文字（页脚/面包屑）：加深颜色或垫轻玻璃。 */
html.is-sheer .page-desc,
html.is-sheer .section-note,
html.is-sheer .side-note,
html.is-sheer .empty-state p,
html.is-sheer .trash-summary,
html.is-sheer .novel-card-summary,
html.is-sheer .entry-card-excerpt,
html.is-sheer .brand-text,
html.is-sheer .section-head,
html.is-sheer .panel-title,
html.is-sheer .entry-notes {
  text-shadow: none;
}

/* 确定使用浅灰色的次要文字，加深一档保证壁纸上可读
   （不动激活态导航与标题的颜色，避免覆盖） */
html.is-sheer .page-desc,
html.is-sheer .section-note,
html.is-sheer .side-note,
html.is-sheer .empty-state p,
html.is-sheer .trash-summary,
html.is-sheer .novel-card-summary,
html.is-sheer .entry-card-excerpt {
  color: var(--ink-soft);
}

html.is-sheer .muted,
html.is-sheer .back-link,
html.is-sheer .workspace-breadcrumb,
html.is-sheer .site-footer,
html.is-sheer .site-footer a {
  text-shadow: none;
}

html.is-sheer .back-link,
html.is-sheer .workspace-breadcrumb {
  color: var(--ink-soft);
}

/* 页脚不做任何底垫：保持原有细线分隔，直接透在壁纸上；
   可读性只靠文字颜色加深到近黑（小字号 + 纹理壁纸需要更强对比） */
html.is-sheer .site-footer,
html.is-sheer .footer-brand,
html.is-sheer .footer-note,
html.is-sheer .footer-year,
html.is-sheer .footer-moon {
  color: var(--ink);
}

html.is-sheer .site-footer a,
html.is-sheer .footer-link {
  color: var(--accent-deep);
}

.side-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.7rem 0.15rem 0;
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1.5;
}

/* ---------- 按钮与通用文字 ---------- */

.eyebrow {
  color: var(--accent);
  font-size: 9.5px;
  letter-spacing: 0.22em;
}

.caption-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.btn {
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(var(--accent-rgb), 0.75);
}

.btn.primary:hover {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  box-shadow: 0 12px 26px -12px rgba(var(--accent-rgb), 0.85);
}

.btn.primary kbd {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.82);
}

.btn.ghost {
  border-color: var(--rule);
  background: var(--glass-soft);
  color: var(--ink-soft);
}

.btn.ghost:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent);
}

.btn.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.link-btn {
  color: var(--accent);
}

.link-btn:hover {
  border-bottom-color: rgba(var(--accent-rgb), 0.4);
  color: var(--accent-deep);
}

/* ---------- 页面头部 ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin: 0 0 1.6rem;
}

.page-head-copy {
  min-width: 0;
}

.page-head h1 {
  margin: 0.55rem 0 0;
  font-family: var(--sans);
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.page-desc {
  max-width: 34em;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.85;
  text-wrap: pretty;
}

.page-head > .btn {
  flex: none;
}

/* ---------- 书架列表 ---------- */

.shelf-section {
  padding-bottom: 0.5rem;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.4rem;
  margin: 0 0 1.1rem;
}

.section-head h2 {
  margin: 0.5rem 0 0;
  padding-left: 0.6rem;
  border-left: 4px solid var(--accent);
  font-family: var(--sans);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
}

.section-note {
  margin: 0 0 0.15rem;
  color: var(--faint);
  font-size: 0.8rem;
}

.shelf-toolbar {
  padding: 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--glass-soft);
  box-shadow: none;
  backdrop-filter: none;
}

.search-box {
  height: 42px;
  border-color: var(--rule);
  border-radius: 10px;
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.22));
}

.search-box:hover {
  border-color: var(--line-strong);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.search-box input {
  font-size: 0.88rem;
}

.search-kbd {
  border-color: var(--rule);
  background: rgba(38, 42, 51, 0.04);
}

.sort-control {
  height: 42px;
  border-color: var(--rule);
  border-radius: 10px;
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.22));
}

.shelf-new-btn {
  flex: none;
  height: 42px;
  padding: 0 0.95rem;
  white-space: nowrap;
}

.filter-pill {
  padding: 6px 11px;
  font-size: 0.8rem;
}

.filter-pill:hover {
  border-color: var(--rule);
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.05));
}

.filter-pill.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.filter-pill.is-active .filter-count {
  color: #e7ecff;
}

.list-meta {
  margin: 1.3rem 2px 0.9rem;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ---------- 回收站 ---------- */

.trash-head .page-desc {
  max-width: 40em;
}

.trash-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.trash-card {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: rgba(255, 255, 255, var(--card-alpha));
}

.trash-card.is-entry {
  background: rgba(255, 255, 255, calc(var(--card-alpha) - 0.08));
}

.trash-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--accent-weak);
  color: var(--accent);
}

.trash-card.is-entry .trash-icon {
  background: rgba(38, 42, 51, 0.06);
  color: var(--muted);
}

.trash-icon .icon {
  width: 18px;
  height: 18px;
}

.trash-main {
  flex: 1;
  min-width: 0;
}

.trash-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.trash-type {
  padding: 0.06rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.6;
}

.trash-warning {
  color: var(--danger);
  font-size: 0.7rem;
}

.trash-title {
  margin: 0.35rem 0 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-meta {
  margin: 0.15rem 0 0;
  color: var(--faint);
  font-size: 0.74rem;
}

.trash-summary {
  display: -webkit-box;
  overflow: hidden;
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.trash-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  padding-top: 0.15rem;
}

.trash-actions .btn {
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
}

.trash-actions .icon-btn {
  width: 34px;
  height: 34px;
  border-color: var(--rule);
  background: var(--glass-soft);
  color: var(--muted);
}

.trash-actions .icon-btn:hover {
  border-color: rgba(210, 72, 72, 0.35);
  color: var(--danger);
}

.trash-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 0.15rem;
  border-radius: 16px;
  background: var(--accent-weak);
  color: var(--accent);
}

.trash-empty-icon .icon {
  width: 24px;
  height: 24px;
}

.novel-card {
  border-color: var(--rule);
  border-radius: 15px;
  background: rgba(255, 255, 255, var(--card-alpha));
  box-shadow: none;
}

.novel-card:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.22));
  box-shadow: 0 14px 30px -22px rgba(30, 40, 90, 0.5);
  transform: translateY(-2px);
}

.novel-card.is-pinned {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, calc(var(--card-alpha) + 0.22)), rgba(238, 242, 255, calc(var(--card-alpha) + 0.12)));
}

.novel-card.is-pinned::before {
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.6), transparent);
}

.novel-card-main {
  gap: 1.1rem;
  padding: 1.1rem;
}

.book-cover.cover-shelf {
  width: 92px;
  height: 130px;
}

.book-cover.has-image {
  padding-left: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.book-cover.has-image::before {
  opacity: 0.05;
}

.book-cover.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 12, 24, 0.22), transparent 16%, transparent 84%, rgba(8, 12, 24, 0.14)),
    linear-gradient(0deg, rgba(8, 12, 24, 0.2), transparent 34%);
  pointer-events: none;
}

.book-cover.has-image .cover-frame {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 0 20px rgba(8, 12, 24, 0.16);
}

.cover-title,
.cover-seal {
  font-family: var(--reading);
}

.cover-shelf .cover-title {
  font-size: 17px;
}

.cover-shelf.is-long .cover-title {
  font-size: 14.5px;
}

.cover-shelf.is-very-long .cover-title {
  font-size: 12.5px;
}

.novel-card-info {
  padding-top: 0.1rem;
}

.novel-card-title {
  margin-top: 0.65rem;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.14rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
}

.novel-card-summary {
  margin-top: 0.35rem;
  font-size: 0.83rem;
  line-height: 1.75;
}

.novel-card-meta {
  padding-top: 0.8rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.novel-card-date {
  margin-top: 0.2rem;
  font-size: 0.7rem;
}

.novel-kicker {
  gap: 0.55rem;
}

.novel-genre {
  border-left-color: var(--rule);
  font-size: 0.62rem;
}

.novel-actions,
.entry-actions {
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px -8px rgba(30, 40, 90, 0.4);
}

.icon-btn:hover {
  background: var(--paper-deep);
}

.danger-hover:hover {
  background: rgba(210, 72, 72, 0.1);
}

/* ---------- 小说工作区 ---------- */

.workspace-breadcrumb {
  margin: 0 0 1.1rem;
  font-size: 0.78rem;
}

.workspace {
  display: block;
  padding: 1.6rem 0 0;
}

#novelView.is-entry-view .novel-hero,
#novelView.is-section-view .novel-hero {
  display: none;
}

#novelView.is-entry-view .workspace,
#novelView.is-section-view .workspace {
  padding-top: 0;
}

#novelView.is-entry-view .workspace-breadcrumb,
#novelView.is-section-view .workspace-breadcrumb {
  margin-bottom: 0.85rem;
}

#novelView.is-section-view .workspace-content,
#novelView.is-entry-view .workspace-content {
  display: flex;
  flex-direction: column;
  min-height: clamp(500px, 48vh, 560px);
}

#novelView.is-section-view .section-empty {
  flex: 1;
  justify-content: center;
}

.novel-hero {
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 1.9rem;
  padding: 1.6rem 1.8rem;
  border-color: var(--rule);
  border-radius: 16px;
  background: var(--glass-soft);
  box-shadow: none;
}

.novel-hero::after {
  display: none;
}

.novel-hero-cover .book-cover {
  transform: none;
}

.book-cover.cover-hero {
  width: 150px;
  height: 212px;
}

.cover-hero .cover-title {
  font-size: 22px;
}

.novel-hero h1 {
  margin-top: 0.55rem;
  font-family: var(--sans);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.novel-hero-summary {
  margin-top: 0.55rem;
  font-family: var(--reading);
  font-size: calc(0.96rem * var(--reading-scale));
  line-height: 1.9;
}

.novel-hero-meta {
  margin-top: 0.7rem;
  font-size: 0.76rem;
}

.novel-hero-actions {
  margin-top: 1rem;
}

.novel-hero-actions .icon-btn {
  border-color: var(--rule);
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.15));
}

.novel-hero-actions .icon-btn:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.novel-hero-actions .pin-btn.is-pinned {
  border-color: rgba(var(--accent-rgb), 0.35);
  background: var(--accent-weak);
  color: var(--accent);
}

.panel {
  border-color: var(--rule);
  border-radius: 14px;
  background: var(--glass-soft);
  box-shadow: none;
}

.synopsis-card {
  padding: 1.4rem 1.6rem;
}

.synopsis-card::before {
  top: 1.3rem;
  bottom: 1.3rem;
  background: linear-gradient(180deg, var(--accent), transparent);
}

.panel-title,
.overview-title,
.content-title,
.entry-detail-title,
.entry-card-title,
.section-card-title,
.section-empty h3,
.empty-state h3,
.missing-card h1 {
  font-family: var(--sans);
  font-weight: 700;
}

.panel-title {
  margin-top: 0.5rem;
  font-size: 1.15rem;
  letter-spacing: 0;
}

.synopsis-body {
  color: var(--ink-soft);
  font-family: var(--reading);
  font-size: calc(0.98rem * var(--reading-scale));
  line-height: 1.95;
}

.overview-head-block {
  margin: 1.8rem 0 0.8rem;
}

.overview-title {
  margin-top: 0.45rem;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.overview-note {
  font-size: 0.74rem;
}

.section-card-grid {
  gap: 0.7rem;
}

.section-card {
  border-color: var(--rule);
  border-radius: 12px;
  background: rgba(255, 255, 255, var(--card-alpha));
  box-shadow: none;
}

.section-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 26px -20px rgba(30, 40, 90, 0.5);
}

.section-icon {
  border-color: var(--rule);
  background: var(--accent-weak);
  color: var(--accent);
}

.section-card-title {
  font-size: 1rem;
  letter-spacing: 0;
}

.section-card-title small {
  font-size: 0.58rem;
}

.section-card-count strong {
  font-family: var(--sans);
  font-size: 1.25rem;
}

.recent-item:hover {
  background: var(--accent-weak);
}

.recent-title {
  font-family: var(--sans);
  font-size: 0.88rem;
}

.content-head {
  margin-bottom: 1.2rem;
  padding-bottom: 0.9rem;
  border-bottom-color: var(--rule);
}

.content-title {
  font-size: clamp(1.5rem, 2.6vw, 1.8rem);
  letter-spacing: -0.01em;
}

.content-desc {
  font-size: 0.82rem;
}

.entry-card {
  border-color: var(--rule);
  border-radius: 14px;
  background: rgba(255, 255, 255, var(--card-alpha));
  box-shadow: none;
}

.entry-card:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.18));
  box-shadow: 0 12px 28px -22px rgba(30, 40, 90, 0.5);
}

.entry-card.is-pinned {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, calc(var(--card-alpha) + 0.22)), rgba(238, 242, 255, calc(var(--card-alpha) + 0.1)));
}

.entry-card.is-pinned::before {
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.55), transparent);
}

.entry-card.is-highlighted {
  animation: card-highlight-blue 1.9s ease;
}

@keyframes card-highlight-blue {
  0%,
  100% {
    box-shadow: var(--shadow-sm);
  }
  30% {
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18), 0 16px 32px -26px rgba(30, 40, 90, 0.45);
  }
}

.entry-card-main {
  padding: 1.05rem 1.15rem 0.9rem;
}

.entry-card-title {
  font-size: 1.08rem;
  letter-spacing: 0;
}

.entry-card-subtitle {
  color: var(--accent);
  font-size: 0.8rem;
}

.entry-card-excerpt {
  font-size: 0.83rem;
  line-height: 1.75;
}

.entry-tag {
  border-color: var(--rule);
  border-radius: 5px;
  background: var(--accent-weak);
  color: var(--muted);
}

.entry-card-date {
  font-size: 0.7rem;
}

.section-empty-icon {
  border-color: var(--rule);
  background: var(--accent-weak);
  color: var(--accent);
}

.entry-detail {
  padding: 1.7rem 2rem 1.3rem;
}

.entry-detail-head {
  border-bottom-color: var(--rule);
}

.entry-lead {
  border-left-color: var(--accent);
  font-family: var(--reading);
  font-size: calc(0.98rem * var(--reading-scale));
}

.entry-notes {
  color: var(--ink-soft);
  font-family: var(--reading);
  font-size: calc(1rem * var(--reading-scale));
  line-height: 2;
}

.entry-notes-empty {
  border-color: var(--line-strong);
}

.entry-detail-actions .btn.ghost.pin-btn.is-pinned {
  border-color: rgba(var(--accent-rgb), 0.35);
  background: var(--accent-weak);
  color: var(--accent);
}

/* ---------- 大纲整页编辑 ---------- */

.outline-editor-page {
  min-width: 0;
}

.outline-editor-back {
  margin-bottom: 0.9rem;
}

.outline-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.outline-editor-heading {
  min-width: 0;
}

.outline-editor-title {
  margin: 0.35rem 0 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.outline-editor-desc {
  max-width: 54em;
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.outline-editor-head-actions {
  display: flex;
  flex: none;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.outline-editor-form {
  padding: 1.5rem 1.8rem 1.1rem;
}

.outline-editor-form .field > input,
.outline-editor-form .field > textarea {
  background: #fff;
}

.outline-editor-form .outline-title-field {
  margin-bottom: 0.9rem;
}

.outline-editor-form .field > input.outline-title-input {
  padding: 0.78rem 0.95rem;
  font-family: var(--sans);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0;
}

.outline-editor-meta {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0 1rem;
}

.outline-editor-form .outline-notes-field > textarea {
  min-height: clamp(320px, 50vh, 720px);
  padding: 0.95rem 1.05rem;
  font-family: var(--reading);
  font-size: calc(1rem * var(--reading-scale));
  line-height: 1.95;
}

.outline-editor-form .field-foot .counter {
  flex: none;
  white-space: nowrap;
}

#outlineEditorTagInput {
  flex: 1;
  width: auto;
  min-width: 120px;
  padding: 3px 2px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.5;
}

#outlineEditorTagInput::placeholder {
  color: var(--faint);
}

#outlineEditorTagInput:hover,
#outlineEditorTagInput:focus {
  border-color: transparent;
  box-shadow: none;
}

.outline-editor-footer {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem -1.8rem -1.1rem;
  padding: 0.85rem 1.8rem;
  border-top: 1px solid var(--rule);
  border-radius: 0 0 14px 14px;
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.42));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.outline-editor-footer-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
}

.outline-editor-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.outline-editor-state::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.outline-editor-state.is-dirty {
  color: var(--amber);
}

.outline-editor-state.is-dirty::before {
  background: var(--amber);
}

.outline-editor-footer-actions {
  display: flex;
  flex: none;
  gap: 0.5rem;
}

.outline-editor-footer .dialog-hint {
  margin: 0;
}

.empty-state {
  border-color: var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, calc(var(--card-alpha) - 0.16));
}

.empty-state h3 {
  letter-spacing: 0;
}

.empty-state p {
  font-size: 0.85rem;
}

.missing-view {
  padding: 4.5rem 0 5rem;
}

.missing-card h1 {
  letter-spacing: 0;
}

/* ---------- 页脚 ---------- */

.site-footer {
  margin-top: 2.8rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 0.76rem;
}

.footer-rule {
  display: none;
}

.footer-content {
  gap: 0.8rem;
}

.footer-brand {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.footer-year {
  margin-top: 0.8rem;
  font-size: 0.64rem;
}

.footer-link {
  color: var(--accent);
}

.footer-link:hover {
  color: var(--accent-deep);
}

/* ---------- 对话框与表单 ---------- */

.dialog::backdrop {
  background: rgba(16, 24, 46, 0.45);
  backdrop-filter: blur(6px);
}

.dialog-head {
  border-bottom-color: var(--rule);
  background: linear-gradient(180deg, #fbfcff 72%, rgba(251, 252, 255, 0.92));
}

.dialog-head h2,
.confirm-content h2 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0;
}

.dialog-actions {
  border-top-color: var(--rule);
  background: linear-gradient(0deg, #fbfcff 70%, rgba(251, 252, 255, 0.9));
}

.field > input,
.field > textarea,
.tag-editor {
  border-color: var(--rule);
  background: #fff;
}

.field > textarea {
  font-family: var(--reading);
}

.field > input:hover,
.field > textarea:hover {
  border-color: var(--line-strong);
}

.field > input:focus,
.field > textarea:focus,
.tag-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.field.has-error > input {
  box-shadow: 0 0 0 3px rgba(210, 72, 72, 0.08);
}

.status-option span {
  border-color: var(--rule);
  background: #fff;
}

.status-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.tone-option input:checked + .tone-swatch {
  box-shadow: 0 0 0 2px #fbfcff, 0 0 0 4px var(--accent);
}

.cover-editor {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.cover-edit-preview {
  display: flex;
  flex: none;
  align-items: flex-start;
}

.cover-edit-preview .book-cover {
  box-shadow: 0 12px 22px -14px rgba(30, 40, 90, 0.6);
}

.cover-editor-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-width: 0;
}

.cover-editor-copy .field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.cover-editor-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.cover-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.cover-editor-actions .btn {
  padding: 7px 12px;
  font-size: 12px;
}

.cover-editor-actions .btn .icon {
  width: 14px;
  height: 14px;
}

#novelCoverRemoveBtn[hidden] {
  display: none;
}

.cover-editor-status {
  min-height: 15px;
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  line-height: 1.4;
}

.cover-editor-status:empty {
  min-height: 0;
}

.cover-editor-status.is-error {
  color: var(--danger);
}

.toast {
  background: rgba(31, 38, 60, 0.94);
}

.toast .icon {
  color: #a9b8ff;
}

/* ---------- 地图工坊 ---------- */

.map-dialog {
  width: min(1480px, calc(100vw - 2.5rem));
  height: min(940px, calc(100dvh - 2.5rem));
  max-width: none;
  max-height: none;
  overflow: hidden;
  border-radius: 22px;
  background: #f7f9fe;
}

.map-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.map-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex: none;
  padding: 1.1rem 1.4rem 1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 249, 254, 0.9));
}

.map-title-group {
  min-width: 0;
}

.map-title-group .dialog-eyebrow {
  margin-bottom: 0.2rem;
}

.map-title-group h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: 0;
}

.map-subtitle {
  margin: 0.15rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-save-state {
  margin-right: 0.2rem;
  color: var(--faint);
  font-size: 0.7rem;
}

.map-save-state.is-dirty {
  color: var(--amber);
}

.map-topbar-actions .btn {
  min-height: 34px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
}

.map-topbar-actions .icon-btn {
  border-color: var(--rule);
  background: #fff;
}

.map-top-export {
  display: none;
}

@media (min-width: 981px) {
  .map-top-export {
    display: inline-grid;
  }
}

.map-body {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr) 274px;
  min-height: 0;
  flex: 1;
}

.map-tools,
.map-inspector {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.55);
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 103, 120, 0.3) transparent;
}

.map-tools::-webkit-scrollbar,
.map-inspector::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.map-tools::-webkit-scrollbar-thumb,
.map-inspector::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(95, 103, 120, 0.28);
}

.map-tools::-webkit-scrollbar-track,
.map-inspector::-webkit-scrollbar-track {
  background: transparent;
}

.map-tools {
  padding: 1rem 0.85rem 1.2rem;
  border-right: 1px solid var(--rule);
}

.map-inspector {
  padding: 1rem 0.95rem 1.4rem;
  border-left: 1px solid var(--rule);
}

.map-tool-label {
  margin: 0 0 0.45rem;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.map-tool-group + .map-tool-group {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
}

.map-tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.map-tool {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.44rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.map-tool .icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.map-tool:hover {
  border-color: var(--line-strong);
}

.map-tool.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-deep);
  font-weight: 600;
}

.terrain-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem;
}

.terrain-option {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  min-width: 0;
  padding: 0.3rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.73rem;
  text-align: left;
  cursor: pointer;
}

.terrain-option:hover {
  border-color: var(--rule);
  background: rgba(255, 255, 255, 0.75);
}

.terrain-option.is-active {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 2px var(--accent-weak);
  color: var(--ink);
}

.terrain-chip {
  width: 17px;
  height: 17px;
  flex: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  background: var(--terrain-fill);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.terrain-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.map-view-actions .icon-btn {
  border-color: var(--rule);
  background: #fff;
}

.map-view-actions .icon-btn:disabled {
  background: rgba(255, 255, 255, 0.45);
  cursor: not-allowed;
  opacity: 0.4;
}

.map-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.42rem 0.5rem;
  border: 1px solid rgba(210, 72, 72, 0.28);
  border-radius: 8px;
  background: rgba(210, 72, 72, 0.06);
  color: var(--danger);
  font: inherit;
  font-size: 0.73rem;
  cursor: pointer;
}

.map-clear-btn .icon {
  width: 13px;
  height: 13px;
}

.map-clear-btn:hover {
  background: rgba(210, 72, 72, 0.12);
}

.map-action-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.map-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.42rem 0.5rem;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--accent-deep);
  font: inherit;
  font-size: 0.73rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.map-action-btn .icon {
  width: 13px;
  height: 13px;
}

.map-action-btn:hover {
  border-color: rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.13);
}

.map-brush-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}

.map-brush-row button {
  padding: 0.32rem 0.2rem;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.map-brush-row button:hover {
  border-color: var(--line-strong);
}

.map-brush-row button.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-deep);
  font-weight: 600;
}

.map-size-row {
  display: grid;
  gap: 0.35rem;
}

.map-size-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.map-size-name {
  width: 1.4rem;
  flex: none;
  color: var(--muted);
  font-size: 0.72rem;
}

.map-size-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.map-size-btn:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.map-size-value {
  min-width: 2.2rem;
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: center;
}

.map-path-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
}

.map-path-head {
  margin-bottom: 0.4rem;
}

.map-path-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.map-path-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.map-path-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.map-path-item:hover {
  border-color: var(--line-strong);
}

.map-path-item.is-selected {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.map-path-dot {
  width: 11px;
  height: 11px;
  flex: none;
  border-radius: 50%;
  background: var(--path-color, var(--accent));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.map-path-name {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 600;
}

.map-path-meta {
  margin-left: auto;
  color: var(--faint);
  font-size: 0.66rem;
}

.map-path-remove {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.map-path-remove .icon {
  width: 11px;
  height: 11px;
}

.map-path-remove:hover {
  background: rgba(210, 72, 72, 0.12);
  color: var(--danger);
}

/* 地图画布上的河流道路与吸管光标 */
.map-stage.is-path-mode .map-canvas {
  cursor: crosshair;
}

.map-stage.is-dropper-mode .map-canvas {
  cursor: copy;
}

.map-stage.is-path-mode .map-path-item {
  cursor: default;
}

.map-stage.is-path-mode .map-city-marker {
  cursor: pointer;
}

.map-path-item .map-path-line {
  transition: stroke-width 0.12s ease;
}

.map-path-item:hover .map-path-line {
  stroke-width: 4.4;
}

.map-path-item.is-selected .map-path-line {
  stroke-width: 4.8;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
}

.map-path-hit {
  cursor: pointer;
}

/* 文明式无缝观感：隐藏格线；打开网格时用清晰描边 */
.map-canvas.no-grid .map-hex-shape {
  stroke: transparent;
}

.map-canvas:not(.no-grid) .map-hex-shape {
  stroke-opacity: 0.8;
  stroke-width: 1;
}

.terrain-chip-feature {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-color: rgba(0, 0, 0, 0.06);
  background: rgba(233, 240, 244, 0.9);
}

.terrain-chip-feature svg {
  width: 22px;
  height: 22px;
}

.terrain-chip-none {
  background:
    linear-gradient(
      135deg,
      transparent 44%,
      rgba(210, 72, 72, 0.55) 44%,
      rgba(210, 72, 72, 0.55) 56%,
      transparent 56%
    ),
    #f4f6f9;
}

.map-hint {
  margin: 1rem 0 0;
  color: var(--faint);
  font-size: 0.66rem;
  line-height: 1.7;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 12%, rgba(255, 255, 255, 0.9), transparent 55%),
    radial-gradient(ellipse at center, transparent 52%, rgba(24, 34, 64, 0.14) 100%),
    linear-gradient(160deg, #eef2f9, #e3e9f2);
}

.map-stage::before {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(68, 82, 118, 0.14) 0.7px, transparent 0.7px);
  background-size: 16px 16px;
  content: "";
  pointer-events: none;
}

.map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.map-stage .map-canvas {
  cursor: grab;
}

.map-stage.is-paint-mode .map-canvas {
  cursor: crosshair;
}

.map-stage.is-city-mode .map-canvas {
  cursor: copy;
}

.map-stage.is-panning .map-canvas {
  cursor: grabbing;
}

.map-zoom-badge {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  padding: 0.16rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.66rem;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.map-stage-tip {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  padding: 0.28rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(31, 38, 60, 0.72);
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  transform: translateX(-50%);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.map-stage-tip[hidden] {
  display: none;
}

.map-stage-controls {
  display: none;
}

.map-hex-shape {
  transition: stroke 0.12s ease;
}

.map-stage.is-paint-mode .map-hex:hover .map-hex-shape,
.map-stage.is-city-mode .map-hex:hover .map-hex-shape {
  stroke: #ffffff;
  stroke-width: 2;
}

.map-decor,
.map-feature-decor,
.map-territory-tile,
.map-territory-border,
.map-city-label {
  pointer-events: none;
}

.map-city-marker {
  cursor: pointer;
}

.map-city-label {
  fill: #293044;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.map-city-marker.is-selected .map-city-select-ring {
  animation: map-ring-dash 3.2s linear infinite;
}

@keyframes map-ring-dash {
  to {
    stroke-dashoffset: -18;
  }
}

.map-inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.map-inspector-head .map-tool-label {
  margin-bottom: 0.12rem;
}

.map-inspector-head h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.map-inspector-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.map-inspector-toggle {
  display: none;
}

.map-city-count {
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.66rem;
  white-space: nowrap;
}

.map-city-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.map-city-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
  padding: 0.44rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.map-city-item:hover {
  border-color: var(--rule);
  background: rgba(255, 255, 255, 0.7);
}

.map-city-item.is-selected {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 2px var(--accent-weak);
}

.map-city-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--city-color);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.map-city-item-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 0.79rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-city-item-meta {
  color: var(--faint);
  font-size: 0.64rem;
  white-space: nowrap;
}

.map-city-list-empty {
  margin: 0;
  padding: 0.9rem 0.8rem;
  border: 1px dashed var(--rule);
  border-radius: 9px;
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.7;
}

.map-city-editor {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--rule);
}

.map-city-editor[hidden] {
  display: none;
}

.map-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.map-field > span {
  font-weight: 600;
}

.map-field > input[type="text"] {
  width: 100%;
  padding: 0.48rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.83rem;
}

.map-field > input[type="text"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.map-radius-row {
  display: flex;
  gap: 0.3rem;
}

.map-radius-row button {
  flex: 1;
  padding: 0.3rem 0.2rem;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.map-radius-row button.is-active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-deep);
  font-weight: 600;
}

.map-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.map-color-swatch {
  width: 21px;
  height: 21px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--city-color);
  box-shadow: 0 0 0 1px var(--rule);
  cursor: pointer;
}

.map-color-swatch:hover {
  transform: scale(1.08);
}

.map-color-swatch.is-active {
  box-shadow: 0 0 0 2px var(--accent);
}

.map-coord {
  margin: 0;
  color: var(--faint);
  font-size: 0.66rem;
}

.map-delete-city {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.42rem;
  border: 1px solid rgba(210, 72, 72, 0.28);
  border-radius: 8px;
  background: rgba(210, 72, 72, 0.06);
  color: var(--danger);
  font: inherit;
  font-size: 0.73rem;
  cursor: pointer;
}

.map-delete-city .icon {
  width: 13px;
  height: 13px;
}

.map-delete-city:hover {
  background: rgba(210, 72, 72, 0.12);
}

.map-inspector-empty p {
  margin: 0;
  padding: 0.9rem 0.8rem;
  border: 1px dashed var(--rule);
  border-radius: 9px;
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.75;
}

.map-inspector-empty[hidden] {
  display: none;
}

/* 详情页地图预览与卡片缩略图 */

.entry-map-block {
  margin-top: 1.7rem;
}

.entry-map-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.entry-map-caption {
  margin: 0.28rem 0 0;
  color: var(--faint);
  font-size: 0.72rem;
}

.map-preview-btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: #eef2f8;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.map-preview-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 16px 32px -26px rgba(30, 40, 90, 0.5);
}

.map-preview {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.map-preview-hint {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  padding: 0.24rem 0.65rem;
  border-radius: 999px;
  background: rgba(31, 38, 60, 0.82);
  color: #fff;
  font-size: 0.68rem;
  opacity: 1;
  transform: none;
  pointer-events: none;
  box-shadow: 0 8px 20px -12px rgba(31, 38, 60, 0.55);
  transition: background 0.16s ease;
}

.map-preview-btn:hover .map-preview-hint,
.map-preview-btn:focus-visible .map-preview-hint {
  background: rgba(31, 38, 60, 0.95);
}

.map-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.2rem;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
  text-align: center;
}

.map-preview-empty .icon {
  width: 30px;
  height: 30px;
  color: var(--accent);
  opacity: 0.7;
}

.map-preview-empty h4 {
  margin: 0.6rem 0 0.2rem;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.map-preview-empty p {
  margin: 0 0 0.9rem;
  color: var(--faint);
  font-size: 0.78rem;
}

.entry-card-map {
  position: relative;
  display: block;
  margin: 0.55rem 0 0.15rem;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: #eef2f8;
}

.entry-card-map .map-thumb {
  display: block;
  width: 100%;
  height: 88px;
  pointer-events: none;
}

.entry-card-map .map-city-label {
  display: none;
}

.entry-card-map-badge {
  position: absolute;
  right: 0.42rem;
  bottom: 0.42rem;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  background: rgba(31, 38, 60, 0.78);
  color: #fff;
  font-size: 0.6rem;
  letter-spacing: 0.02em;
}

/* ---------- 响应式 ---------- */

@media (min-width: 881px) {
  /* 书架、分区与条目共用同高画布，底边渐隐进壁纸 */
  #shelfView {
    min-height: 542px;
  }

  .content {
    padding-bottom: 120px;
  }

  .page:has(#shelfView:not([hidden])) .sidebar,
  .page:has(#novelView:not([hidden]).is-section-view) .sidebar,
  .page:has(#novelView:not([hidden]).is-entry-view) .sidebar {
    padding-bottom: 130px;
  }

  .page:has(#shelfView:not([hidden])) .sidebar-footer,
  .page:has(#novelView:not([hidden]).is-section-view) .sidebar-footer,
  .page:has(#novelView:not([hidden]).is-entry-view) .sidebar-footer {
    margin-top: auto;
  }

  /* 大纲编辑器很长，脚注保持紧跟导航，不推到页面底部 */
  .page:has(#novelView:not([hidden]).is-entry-view):has(#outlineEditorForm) .sidebar {
    padding-bottom: 1.3rem;
  }

  .page:has(#novelView:not([hidden]).is-entry-view):has(#outlineEditorForm) .sidebar-footer {
    margin-top: 1.4rem;
  }

  .page {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 120px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 120px), transparent 100%);
  }
}

@media (max-width: 880px) {
  body {
    background-attachment: scroll, scroll;
  }

  .page {
    width: calc(100% - 2.4rem);
    margin: 1.6rem auto 2.4rem;
    grid-template-columns: 1fr;
    border-radius: 20px;
  }

  .sidebar {
    padding: 1.2rem 1.1rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .brand {
    margin-bottom: 0.9rem;
  }

  .nav-group {
    margin-top: 0.7rem;
  }

  .subnav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0 0 0.15rem;
    border-left: 0;
  }

  .side-novel-list {
    max-height: none;
  }

  .side-novel-link,
  .sidebar .workspace-nav-link {
    flex: none;
    padding: 0.38rem 0.65rem;
    border: 1px solid var(--rule);
    background: rgba(255, 255, 255, calc(var(--card-alpha) - 0.08));
    white-space: nowrap;
  }

  .side-novel-link.is-active,
  .sidebar .workspace-nav-link.is-active {
    border-color: var(--accent);
    background: var(--accent-weak);
  }

  .sidebar .workspace-nav-count {
    display: none;
  }

  .side-book {
    margin-bottom: 0.3rem;
  }

  .side-sections {
    padding-left: 0;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.9rem;
    padding-top: 0.8rem;
  }

  .side-actions {
    flex: none;
  }

  .side-note {
    margin: 0;
    text-align: right;
  }

  .content {
    padding: 1.6rem 1.35rem 1.1rem;
  }

  .novel-grid,
  .entry-grid {
    grid-template-columns: 1fr;
  }

  .novel-hero {
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 1.4rem;
    padding: 1.3rem 1.4rem;
  }

  .book-cover.cover-hero {
    width: 128px;
    height: 180px;
  }

  .entry-detail {
    padding: 1.4rem 1.5rem 1.2rem;
  }

  .outline-editor-form {
    padding: 1.35rem 1.5rem 1rem;
  }

  .outline-editor-footer {
    margin: 0.5rem -1.5rem -1rem;
    padding: 0.8rem 1.5rem;
  }
}

@media (max-width: 680px) {
  .page {
    width: calc(100% - 1.2rem);
    margin: 0.6rem auto 1.2rem;
    padding: 0;
    border-radius: 18px;
  }

  .sidebar {
    padding: 1rem 0.9rem 0.85rem;
  }

  .avatar {
    width: 40px;
    height: 40px;
  }

  .avatar svg {
    width: 23px;
    height: 23px;
  }

  .brand-text .name {
    font-size: 1rem;
  }

  .brand-text .tagline {
    font-size: 7px;
  }

  .nav-label {
    font-size: 0.74rem;
  }

  .side-note {
    display: none;
  }

  .side-actions {
    flex: 1;
  }

  .content {
    padding: 1.25rem 1rem 0.9rem;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .page-head h1 {
    font-size: 1.65rem;
  }

  .page-desc {
    font-size: 0.9rem;
  }

  .page-head > .btn {
    width: 100%;
  }

  .trash-card {
    flex-wrap: wrap;
    padding: 0.85rem;
  }

  .trash-main {
    flex-basis: calc(100% - 38px - 0.9rem);
  }

  .trash-actions {
    width: 100%;
    padding-left: calc(38px + 0.9rem);
  }

  .trash-actions .btn {
    flex: 1;
  }

  .trash-actions .icon-btn {
    width: 36px;
    height: 36px;
  }

  .section-note {
    display: none;
  }

  .section-head h2 {
    font-size: 1.1rem;
  }

  .search-box {
    flex: 1 1 100%;
  }

  .sort-control {
    border-color: var(--rule);
    background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.05));
  }

  .shelf-new-btn {
    padding: 0 0.85rem;
  }

  .shelf-new-btn kbd {
    display: none;
  }

  .novel-card-main {
    gap: 0.9rem;
    padding: 0.95rem;
  }

  .book-cover.cover-shelf {
    width: 84px;
    height: 118px;
  }

  .cover-shelf .cover-title {
    font-size: 15px;
  }

  .cover-shelf.is-long .cover-title {
    font-size: 13px;
  }

  .cover-shelf.is-very-long .cover-title {
    font-size: 11.5px;
  }

  .novel-card-title {
    margin-top: 0.55rem;
    font-size: 1.05rem;
  }

  .novel-card-info .novel-kicker {
    padding-right: 78px;
  }

  .novel-hero {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 1rem;
    padding: 1.05rem;
    border-radius: 14px;
  }

  .book-cover.cover-hero {
    width: 96px;
    height: 136px;
  }

  .cover-hero .cover-title {
    font-size: 16px;
  }

  .cover-hero.is-long .cover-title,
  .cover-hero.is-very-long .cover-title {
    font-size: 12.5px;
  }

  .novel-hero-summary {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
  }

  .workspace {
    padding-top: 1.2rem;
  }

  .synopsis-card {
    padding: 1.15rem 1.15rem 1.15rem 1.3rem;
  }

  .novel-stats-panel {
    padding: 1.15rem 1.15rem 1.15rem 1.3rem;
  }

  .section-card-grid {
    gap: 0.55rem;
  }

  .section-card-title {
    font-size: 0.95rem;
  }

  .section-card-count strong {
    font-size: 1.15rem;
  }

  .content-title {
    font-size: 1.45rem;
  }

  .entry-card-main {
    min-height: 0;
    padding: 0.95rem;
  }

  .entry-card-title {
    font-size: 1.02rem;
  }

  .entry-detail {
    padding: 1.1rem 1rem 1rem;
  }

  .outline-editor-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }

  .outline-editor-head-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .outline-editor-meta {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .outline-editor-form {
    padding: 1.15rem 1rem 0.75rem;
  }

  .outline-editor-form .outline-notes-field > textarea {
    min-height: 46vh;
  }

  .outline-editor-footer {
    flex-wrap: wrap;
    margin: 0.5rem -1rem -0.75rem;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  }

  .outline-editor-footer-hint,
  .outline-editor-footer-actions {
    flex: 1 1 100%;
  }

  .outline-editor-footer-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .entry-notes {
    font-size: calc(0.98rem * var(--reading-scale));
  }

  .missing-view {
    padding: 2.5rem 0 3rem;
  }

  .site-footer {
    margin-top: 2rem;
  }

  .footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .footer-year {
    display: none;
  }

  .toast-stack {
    bottom: 14px;
  }
}

@media (max-width: 420px) {
  .section-head h2 {
    font-size: 1.02rem;
  }

  .novel-genre {
    display: none;
  }

  .trash-icon {
    width: 34px;
    height: 34px;
  }

  .trash-main {
    flex-basis: calc(100% - 34px - 0.9rem);
  }

  .trash-actions {
    padding-left: 0;
  }
}

@media (max-width: 1180px) {
  .map-body {
    grid-template-columns: 192px minmax(0, 1fr) 252px;
  }

  .map-topbar {
    padding: 0.95rem 1.1rem 0.9rem 1.2rem;
  }
}

@media (max-width: 980px) {
  .map-dialog {
    width: calc(100vw - 1.2rem);
    height: calc(100dvh - 1.2rem);
    border-radius: 18px;
  }

  .map-topbar {
    padding: 0.8rem 0.9rem;
    gap: 0.8rem;
  }

  .map-title-group h2 {
    font-size: 1.1rem;
  }

  .map-subtitle {
    max-width: 42vw;
  }

  .map-save-state {
    display: none;
  }

  .map-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .map-tools {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.55rem 0.7rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .map-action-row {
    flex-direction: row;
  }

  .map-action-row .map-action-btn,
  .map-action-row .map-clear-btn {
    width: auto;
    flex: none;
    white-space: nowrap;
  }

  .map-size-row {
    grid-auto-flow: column;
    grid-template-columns: repeat(2, auto);
    gap: 0.8rem;
  }

  .map-tool-group {
    flex: none;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .map-tool-group .map-tool-label {
    margin-bottom: 0.25rem;
    font-size: 0.55rem;
  }

  .map-tool-grid {
    display: flex;
    gap: 0.25rem;
  }

  .map-tool {
    padding: 0.32rem 0.48rem;
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .terrain-palette {
    display: flex;
    gap: 0.18rem;
  }

  .terrain-option {
    padding: 0.22rem 0.3rem;
    font-size: 0.68rem;
    white-space: nowrap;
  }

  .terrain-chip {
    width: 14px;
    height: 14px;
  }

  .map-view-group {
    display: none;
  }

  .map-stage-controls {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.22rem;
    border: 1px solid var(--rule);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 8px 22px rgba(31, 38, 60, 0.14);
    backdrop-filter: blur(10px);
    pointer-events: none;
  }

  .map-stage-controls .icon-btn {
    width: 30px;
    height: 30px;
    border-color: transparent;
    background: transparent;
    pointer-events: auto;
  }

  .map-stage-controls .icon-btn:hover {
    background: rgba(var(--accent-rgb), 0.08);
  }

  .map-stage-controls .icon-btn:disabled {
    background: transparent;
    cursor: not-allowed;
    opacity: 0.35;
  }

  .map-hint {
    display: none;
  }

  .map-clear-btn {
    width: auto;
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
  }

  .map-inspector {
    max-height: 30vh;
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding: 0.65rem 0.8rem 0.8rem;
  }

  .map-inspector > .map-inspector-head {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -0.65rem -0.8rem 0.55rem;
    padding: 0.5rem 0.8rem 0.45rem;
    border-bottom: 1px solid var(--rule);
    background: rgba(250, 252, 255, 0.94);
    backdrop-filter: blur(8px);
  }

  .map-inspector.is-collapsed {
    max-height: none;
  }

  .map-inspector.is-collapsed > .map-inspector-head {
    align-items: center;
    margin-bottom: 0;
    padding-top: 0.4rem;
    padding-bottom: 0.35rem;
    border-bottom: 0;
  }

  .map-inspector.is-collapsed > .map-inspector-head .map-tool-label {
    display: none;
  }

  .map-inspector.is-collapsed > .map-inspector-head h3 {
    font-size: 0.9rem;
  }

  .map-inspector.is-collapsed .map-inspector-body {
    display: none;
  }

  .map-inspector-toggle {
    display: grid;
    width: 30px;
    height: 30px;
    border-color: var(--rule);
    background: #fff;
  }

  .map-inspector-toggle .icon {
    transition: transform 0.18s ease;
  }

  .map-inspector:not(.is-collapsed) .map-inspector-toggle .icon {
    transform: rotate(180deg);
  }

  .map-city-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .map-city-item {
    width: auto;
    max-width: 100%;
  }

  .map-city-list-empty {
    width: 100%;
  }

  .map-city-editor {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    gap: 0.55rem;
  }

  .map-inspector-empty p {
    padding: 0.6rem 0.7rem;
  }

  .entry-map-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
  }
}

@media (max-width: 680px) {
  .map-dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .map-title-group .dialog-eyebrow {
    display: none;
  }

  .map-title-group h2 {
    font-size: 1rem;
  }

  .map-subtitle {
    max-width: 36vw;
    font-size: 0.66rem;
  }

  .map-topbar-actions {
    gap: 0.35rem;
  }

  .map-topbar-actions .btn {
    min-height: 30px;
    padding: 0.25rem 0.55rem;
    font-size: 0.72rem;
  }

  .map-body {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .map-stage-tip {
    top: 0.5rem;
    font-size: 0.64rem;
  }

  .map-city-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .map-city-editor .map-field:first-child {
    grid-column: 1 / -1;
  }

  .map-city-editor .map-color-row {
    align-content: center;
    min-height: 28px;
  }

  .map-city-editor .map-coord {
    grid-column: 1 / -1;
  }

  .map-city-editor .map-delete-city {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) and (max-height: 640px) {
  .map-topbar {
    padding: 0.55rem 0.8rem;
  }

  .map-title-group h2 {
    font-size: 1rem;
  }

  .map-title-group .dialog-eyebrow,
  .map-subtitle {
    display: none;
  }

  .map-tools {
    padding: 0.45rem 0.6rem;
  }
}


@media (max-width: 680px) {
  .cover-editor {
    gap: 12px;
    padding: 12px;
  }

  .cover-editor-copy {
    gap: 6px;
  }

  .cover-editor-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* ---------- 角色关系图 ---------- */

.content-head-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.42);
}

.view-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.view-switch-btn .icon {
  width: 14px;
  height: 14px;
}

.view-switch-btn:hover {
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.view-switch-btn.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 8px -4px rgba(30, 40, 90, 0.45);
}

.view-switch-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.character-graph-panel {
  overflow: hidden;
}

.graph-switcher {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem 0.5rem 0.95rem;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.3);
}

.graph-switcher-label {
  flex: none;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.1em;
}

.graph-tabs {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.3rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.graph-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.35rem;
  height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.graph-tab:hover {
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--accent);
}

.graph-tab.is-active {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
}

.graph-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.graph-tab-count {
  color: var(--faint);
  font-size: 10px;
}

.graph-tab.is-active .graph-tab-count {
  color: var(--accent);
}

.graph-tab-add {
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.graph-tab-add .icon {
  width: 12px;
  height: 12px;
}

.graph-edit-btn {
  flex: none;
  width: 28px;
  height: 28px;
}

.graph-edit-btn .icon {
  width: 14px;
  height: 14px;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--rule);
}

.graph-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.graph-meta strong {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
}

.graph-meta-sep {
  color: var(--faint);
}

.graph-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.graph-actions .btn {
  padding: 8px 12px;
  font-size: 12px;
}

.graph-actions .btn .icon {
  width: 14px;
  height: 14px;
}

.graph-zoom {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.graph-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.graph-zoom-btn:hover:not(:disabled) {
  background: var(--accent-weak);
  color: var(--accent);
}

.graph-zoom-btn:focus-visible,
.graph-zoom-level:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.graph-zoom-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.graph-zoom-btn .icon {
  width: 13px;
  height: 13px;
}

.graph-zoom-level {
  min-width: 42px;
  height: 26px;
  padding: 0 4px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.graph-zoom-level:hover {
  color: var(--accent);
}

.character-graph-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  background-color: rgba(255, 255, 255, 0.3);
  background-image: radial-gradient(rgba(73, 86, 116, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
}

.character-graph {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
  aspect-ratio: 1000 / 620;
  user-select: none;
}

.character-graph.is-dragging {
  cursor: grabbing;
}

.character-graph.is-zoomed {
  cursor: grab;
}

.character-graph.is-panning {
  cursor: grabbing;
}

.graph-edge {
  cursor: pointer;
  outline: none;
}

.graph-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
}

.graph-edge-line {
  fill: none;
  stroke: rgba(79, 91, 123, 0.4);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 0.16s ease, stroke-width 0.16s ease;
}

.graph-edge:hover .graph-edge-line,
.graph-edge:focus-visible .graph-edge-line {
  stroke: var(--accent);
  stroke-width: 2.2;
}

.graph-edge-arrow {
  fill: rgba(79, 91, 123, 0.55);
  pointer-events: none;
  transition: fill 0.16s ease;
}

.graph-edge:hover .graph-edge-arrow,
.graph-edge:focus-visible .graph-edge-arrow {
  fill: var(--accent);
}

.graph-edge-label {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  fill: #606a7e;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(248, 250, 255, 0.94);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: auto;
  cursor: pointer;
  transition: fill 0.16s ease;
}

.graph-edge:hover .graph-edge-label,
.graph-edge:focus-visible .graph-edge-label {
  fill: var(--accent);
}

.graph-node {
  cursor: grab;
  touch-action: none;
  outline: none;
}

.graph-node.is-dragging {
  cursor: grabbing;
}

.graph-node-halo {
  fill: rgba(var(--accent-rgb), 0);
  stroke: rgba(var(--accent-rgb), 0);
  transition: fill 0.16s ease, stroke 0.16s ease;
}

.graph-node-core {
  fill: var(--node-fill, #eef2ff);
  stroke: var(--node-stroke, #9caddd);
  stroke-width: 1.6;
  filter: drop-shadow(0 4px 6px rgba(31, 45, 90, 0.1));
  transition: stroke-width 0.16s ease;
}

.graph-node:hover .graph-node-core,
.graph-node:focus-visible .graph-node-core {
  stroke-width: 2.6;
}

.graph-node:hover .graph-node-halo {
  fill: rgba(var(--accent-rgb), 0.06);
}

.graph-node:focus-visible .graph-node-halo {
  fill: rgba(var(--accent-rgb), 0.1);
  stroke: rgba(var(--accent-rgb), 0.38);
  stroke-width: 1.5;
}

.graph-node-initial {
  font-family: var(--sans);
  font-size: 24px;
  font-weight: 600;
  fill: var(--node-ink, var(--accent-deep));
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.graph-node-name {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(248, 250, 255, 0.95);
  stroke-width: 4px;
  stroke-linejoin: round;
  pointer-events: auto;
}

.graph-node-role {
  font-family: var(--sans);
  font-size: 12px;
  fill: var(--faint);
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(248, 250, 255, 0.95);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: auto;
}

.graph-node.is-highlighted .graph-node-core {
  animation: graph-node-highlight 1.9s ease;
}

@keyframes graph-node-highlight {
  0%,
  100% {
    stroke-width: 1.6;
  }
  30% {
    stroke-width: 4.2;
  }
}

.graph-hint {
  margin: 0;
  padding: 0.55rem 0.95rem 0.65rem;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.graph-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 3rem 1.5rem;
  background-color: rgba(255, 255, 255, 0.3);
  background-image: radial-gradient(rgba(73, 86, 116, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  text-align: center;
}

.graph-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 0.9rem;
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.09);
  color: var(--accent);
}

.graph-empty-icon .icon {
  width: 24px;
  height: 24px;
}

.graph-empty h3 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.graph-empty p {
  max-width: 360px;
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

/* ---------- 关系编辑 ---------- */

.relation-dialog {
  width: min(560px, calc(100vw - 32px));
}

.relation-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 0.5rem;
}

.relation-route .field {
  margin-bottom: 0.9rem;
}

.relation-route-mark {
  padding-top: 2.15rem;
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}

.relation-select {
  width: 100%;
  height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.72);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 18px,
    calc(100% - 11px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  appearance: none;
  -webkit-appearance: none;
}

.relation-select:hover {
  border-color: var(--accent);
}

.relation-select:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-weak);
  outline-offset: 1px;
}

.relation-form-error {
  margin: -0.35rem 0 0.9rem;
}

.relation-direction-field {
  margin-bottom: 0.95rem;
}

.relation-directions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.relation-direction {
  position: relative;
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.relation-direction:hover {
  border-color: rgba(var(--accent-rgb), 0.42);
}

.relation-direction.is-active {
  border-color: rgba(var(--accent-rgb), 0.6);
  background: var(--accent-weak);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.16) inset;
}

.relation-direction:focus-within {
  outline: 2px solid var(--accent-weak);
  outline-offset: 1px;
}

.relation-direction input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.relation-direction-text {
  display: block;
  min-width: 0;
}

.relation-direction-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
}

.relation-direction.is-active .relation-direction-title {
  color: var(--accent);
}

.relation-direction-mark {
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
}

.relation-direction-desc {
  display: block;
  margin-top: 2px;
  padding-left: 1.35rem;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.relation-direction-note {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.graph-dialog {
  width: min(500px, calc(100vw - 32px));
}

.relation-preset-field {
  margin-bottom: 0.4rem;
}

.relation-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.relation-preset {
  padding: 4px 9px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.relation-preset:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

.relation-hint {
  margin: 0.15rem 0 0.9rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.055);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.btn.ghost.relation-delete {
  color: var(--danger);
  border-color: rgba(210, 72, 72, 0.3);
}

.btn.ghost.relation-delete:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(210, 72, 72, 0.07);
}

@media (max-width: 560px) {
  .content-head {
    flex-wrap: wrap;
  }

  .content-head-actions {
    width: 100%;
    justify-content: space-between;
  }

  .graph-toolbar {
    flex-wrap: wrap;
  }

  .graph-switcher {
    gap: 0.4rem;
    padding: 0.45rem 0.6rem 0.45rem 0.7rem;
  }

  .graph-switcher-label {
    display: none;
  }

  .graph-actions {
    width: 100%;
    justify-content: space-between;
  }

  .graph-zoom {
    flex: none;
  }

  .graph-actions .btn {
    flex: 1;
  }

  .character-graph {
    min-width: 680px;
  }

  .relation-route {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .relation-route-mark {
    display: none;
  }

  .relation-dialog .dialog-hint {
    display: none;
  }
}

/* 打开条目时先淡出再淡入，遮住回到开头的跳变 */
::view-transition-old(root) {
  animation: route-fade-out 110ms ease-out both;
}

::view-transition-new(root) {
  animation: route-fade-in 210ms ease-out 100ms both;
}

@keyframes route-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes route-fade-in {
  from {
    opacity: 0;
  }
}

#novelView.is-route-entering {
  animation: entry-view-enter 220ms ease-out;
}

@keyframes entry-view-enter {
  from {
    opacity: 0.35;
  }
}

/* ---------- 评论与标注 ---------- */

.comment-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 44px;
  padding: 0 0.95rem 0 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-deep);
  box-shadow: 0 18px 40px -16px rgba(18, 28, 65, 0.55), 0 2px 6px rgba(18, 28, 65, 0.12);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.comment-fab:hover {
  transform: translateY(-2px);
  background: #fff;
  box-shadow: 0 22px 46px -16px rgba(18, 28, 65, 0.6), 0 2px 6px rgba(18, 28, 65, 0.1);
}

.comment-fab .icon {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.comment-fab-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1;
}

.comments-head {
  margin-bottom: 1.5rem;
}

.comments-toolbar {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--glass-soft);
}

.comments-toolbar .search-box {
  flex: 1;
}

.comments-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.comments-meta p {
  margin: 0;
}

.comment-directory {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.comment-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 2px 0.65rem;
  padding-left: 0.55rem;
  border-left: 3px solid var(--accent);
}

.comment-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.comment-group-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 8px;
  background: var(--accent-weak);
  color: var(--accent);
}

.comment-group-icon .icon {
  width: 13px;
  height: 13px;
}

.comment-group-link,
.comment-group-name {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.comment-group-link:hover {
  color: var(--accent);
}

.comment-group-count {
  flex: none;
  color: var(--faint);
  font-size: 0.72rem;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.comment-card {
  padding: 0.9rem 1rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 13px;
  background: rgba(255, 255, 255, var(--card-alpha));
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.comment-card:hover {
  border-color: rgba(var(--accent-rgb), 0.34);
  background: rgba(255, 255, 255, calc(var(--card-alpha) + 0.08));
  box-shadow: 0 12px 28px -24px rgba(30, 40, 90, 0.5);
}

.comment-card.is-unavailable {
  border-style: dashed;
  background: rgba(255, 255, 255, calc(var(--card-alpha) - 0.1));
}

.comment-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.comment-target-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.comment-target-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.16rem 0.58rem;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent-deep);
  font-size: 0.73rem;
  font-weight: 600;
  line-height: 1.65;
}

.comment-target-chip .icon {
  width: 12px;
  height: 12px;
  flex: none;
}

.comment-target-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-missing-chip {
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: rgba(210, 72, 72, 0.08);
  color: var(--danger);
  font-size: 0.68rem;
  line-height: 1.6;
}

.comment-time {
  flex: none;
  padding-top: 0.12rem;
  color: var(--faint);
  font-size: 0.7rem;
  white-space: nowrap;
}

.comment-body {
  margin: 0.6rem 0 0.55rem;
  color: var(--ink-soft);
  font-family: var(--reading);
  font-size: 0.9rem;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-card.is-unavailable .comment-body {
  color: var(--muted);
}

.comment-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line-soft);
}

.comment-card-actions .btn {
  height: 29px;
  padding: 0 0.65rem;
  border-radius: 8px;
  font-size: 0.75rem;
}

.comment-card-actions .btn .icon {
  width: 12px;
  height: 12px;
}

.comment-card-actions .icon-btn {
  width: 29px;
  height: 29px;
  border-radius: 8px;
}

.comment-card-actions .comment-jump {
  margin-right: auto;
}

.comment-card-actions .comment-jump:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.comment-card-actions .comment-jump:disabled:hover {
  border-color: var(--rule);
  background: var(--glass-soft);
  color: var(--ink-soft);
}

.comments-empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 0.9rem;
  border-radius: 16px;
  background: var(--accent-weak);
  color: var(--accent);
}

.comments-empty-icon .icon {
  width: 24px;
  height: 24px;
}

#commentsEmpty {
  padding: 3.2rem 1.5rem;
}

.comment-dialog {
  width: min(600px, calc(100vw - 32px));
}

.comment-context-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 1.05rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.05);
}

.comment-context-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--accent-weak);
  color: var(--accent);
}

.comment-context-icon .icon {
  width: 16px;
  height: 16px;
}

.comment-context-copy {
  min-width: 0;
}

.comment-context-label {
  margin: 0;
  color: var(--faint);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.comment-context-target {
  margin: 0.2rem 0 0;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.comment-context-note {
  margin: 0.15rem 0 0;
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.6;
}

.comment-select {
  width: 100%;
  height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 18px,
    calc(100% - 11px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}

.comment-select:hover {
  border-color: var(--accent);
}

.comment-select:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.comment-body-field > textarea {
  min-height: 160px;
  font-family: var(--reading);
  font-size: 0.93rem;
  line-height: 1.8;
}

.comment-dialog .dialog-actions .relation-delete {
  margin-right: 0.2rem;
}

.is-comment-focus {
  animation: comment-focus-ring 2.2s ease-out;
}

@keyframes comment-focus-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
  }
  12% {
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.34);
  }
  58% {
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.16);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
  }
}

/* ---------- Apple 液态玻璃描边 ---------- */

.page {
  border-color: rgba(255, 255, 255, 0.58);
  background-image: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0.1)
  );
  box-shadow:
    0 24px 64px rgba(18, 28, 65, 0.32),
    0 2px 10px rgba(18, 28, 65, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.panel,
.trash-card,
.shelf-toolbar,
.comments-toolbar,
.novel-hero {
  position: relative;
}

.novel-card,
.entry-card,
.section-card,
.panel,
.novel-hero,
.comment-card,
.trash-card,
.shelf-toolbar,
.comments-toolbar,
.appearance-panel,
.empty-state {
  box-shadow:
    0 1px 1px rgba(19, 29, 62, 0.03),
    0 12px 28px -26px rgba(19, 29, 62, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(19, 29, 62, 0.08),
    inset 0 14px 24px -22px rgba(255, 255, 255, 0.95);
}

.novel-card,
.entry-card,
.section-card,
.panel,
.novel-hero,
.comment-card,
.trash-card,
.shelf-toolbar,
.comments-toolbar,
.appearance-panel {
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.26),
    rgba(255, 255, 255, 0) 34%
  );
}

.novel-card::after,
.entry-card::after,
.section-card::after,
.panel::after,
.comment-card:not(.is-unavailable)::after,
.trash-card::after,
.shelf-toolbar::after,
.comments-toolbar::after,
.appearance-panel::after,
.novel-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 1.4px;
  border-radius: inherit;
  background: var(--glass-rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: var(--rim-strength);
  pointer-events: none;
}

.novel-card.is-pinned::before,
.entry-card.is-pinned::before {
  z-index: 3;
}

.novel-card:hover,
.entry-card:hover,
.section-card:hover,
.comment-card:hover {
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.34),
    rgba(255, 255, 255, 0) 36%
  );
  box-shadow:
    0 0 0 1px rgba(var(--accent-rgb), 0.24),
    0 16px 34px -26px rgba(30, 40, 90, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(19, 29, 62, 0.08),
    inset 0 14px 24px -22px rgba(255, 255, 255, 1);
}

.dialog {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 30px 90px -20px rgba(15, 25, 60, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.comment-fab {
  border-color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.94),
    rgba(242, 246, 255, 0.82)
  );
  box-shadow:
    0 18px 40px -16px rgba(18, 28, 65, 0.55),
    0 2px 6px rgba(18, 28, 65, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(19, 29, 62, 0.06);
}

.comment-fab:hover {
  box-shadow:
    0 22px 46px -16px rgba(18, 28, 65, 0.6),
    0 2px 6px rgba(18, 28, 65, 0.1),
    inset 0 1px 0 #fff;
}

@media (min-width: 881px) {
  #commentsView {
    min-height: 542px;
  }
}

@media (max-width: 680px) {
  .comment-fab {
    right: 0.9rem;
    bottom: 0.9rem;
    height: 42px;
    padding: 0 0.85rem 0 0.75rem;
    font-size: 0.78rem;
  }

  .comments-toolbar {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.7rem;
  }

  .comments-toolbar .sort-control {
    align-self: flex-end;
    height: 32px;
    padding: 0 4px;
    border-color: transparent;
    background: transparent;
  }

  .comments-meta {
    align-items: flex-end;
  }

  .comment-card-head {
    flex-direction: column;
    gap: 0.4rem;
  }

  .comment-time {
    padding-top: 0;
  }

  .comment-card-actions {
    flex-wrap: wrap;
  }

  .comment-card-actions .comment-jump {
    margin-right: 0;
  }

  .comment-body-field > textarea {
    min-height: 130px;
  }
}

@media (max-width: 420px) {
  .comment-fab-label {
    display: none;
  }

  .comment-fab {
    padding: 0 0.72rem;
  }

  #commentsEmpty {
    padding: 2.6rem 1rem;
  }
}

/* ---------- 公开范围 ---------- */

.visibility-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
  padding: 0.1rem 0.5rem 0.1rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.visibility-chip .icon {
  width: 11px;
  height: 11px;
}

.visibility-chip.is-public {
  border-color: rgba(47, 158, 111, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.visibility-chip.is-private {
  color: var(--muted);
}

.entry-card-tags .visibility-chip {
  margin: 0 2px 0 0;
}

.word-count-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
  padding: 0.1rem 0.5rem 0.1rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.word-count-chip .icon {
  width: 11px;
  height: 11px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex: none;
}

.visibility-hint {
  margin-top: 0.4rem;
}

.field.visibility-field {
  margin-bottom: 19px;
}

.visibility-switch {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.54);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.visibility-switch:hover {
  border-color: rgba(var(--accent-rgb), 0.32);
  background: rgba(255, 255, 255, 0.82);
}

.visibility-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.visibility-switch-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: rgba(38, 42, 51, 0.18);
  box-shadow: inset 0 1px 2px rgba(20, 28, 50, 0.16);
  transition: background 0.2s ease;
}

.visibility-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(20, 28, 50, 0.3);
  transition: transform 0.2s ease;
}

.visibility-switch input:checked ~ .visibility-switch-track {
  background: var(--accent);
}

.visibility-switch input:checked ~ .visibility-switch-track .visibility-switch-thumb {
  transform: translateX(16px);
}

.visibility-switch input:focus-visible ~ .visibility-switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visibility-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.visibility-switch-title {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
}

.visibility-switch-hint {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.visibility-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.visibility-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.52);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.visibility-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.visibility-option::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 0.25rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.visibility-option:hover {
  border-color: rgba(var(--accent-rgb), 0.32);
  background: rgba(255, 255, 255, 0.8);
}

.visibility-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-weak);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.16);
}

.visibility-option:has(input:checked)::before {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 42%, transparent 44%);
}

.visibility-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visibility-option-copy {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.visibility-option-title {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.5;
}

.visibility-option-desc {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

/* ---------- 公开作品页 ---------- */

.publish-head {
  align-items: flex-end;
}

.publish-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: none;
}

.publish-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.9rem;
}

.publish-summary-card {
  padding: 1rem 1.05rem;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-sm);
}

.publish-summary-card.is-public {
  border-color: rgba(47, 158, 111, 0.24);
}

.publish-summary-card.is-private {
  background: rgba(255, 255, 255, 0.44);
}

.publish-summary-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.publish-summary-head .icon {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.publish-summary-card.is-public .publish-summary-head {
  color: var(--green);
}

.publish-summary-value {
  display: block;
  margin-top: 0.35rem;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.publish-summary-hint {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.publish-section {
  margin-bottom: 1.7rem;
}

.publish-novel-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.publish-novel-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.publish-novel-row.is-public {
  border-color: rgba(47, 158, 111, 0.26);
  background: rgba(249, 255, 252, 0.68);
  box-shadow: 0 10px 26px -24px rgba(35, 90, 65, 0.7);
}

.publish-novel-cover {
  display: block;
}

.book-cover.cover-publish {
  width: 44px;
  height: 62px;
  padding-left: 5px;
  border-radius: 2px 5px 5px 2px;
}

.cover-publish .cover-spine {
  width: 5px;
}

.cover-publish .cover-frame {
  inset: 4px 4px 4px 8px;
}

.cover-publish .cover-title {
  max-height: calc(100% - 12px);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.cover-publish .cover-seal {
  display: none;
}

.cover-publish.is-long .cover-title,
.cover-publish.is-very-long .cover-title {
  font-size: 8.5px;
  letter-spacing: 0.03em;
}

.publish-novel-main {
  min-width: 0;
}

.publish-novel-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.publish-novel-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publish-novel-name:hover {
  color: var(--accent);
  text-decoration: none;
}

.publish-novel-meta {
  margin: 0.2rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publish-switch {
  padding: 0.48rem 0.7rem;
  background: rgba(255, 255, 255, 0.55);
}

.publish-switch .visibility-switch-title {
  font-size: 0.78rem;
}

.publish-switch .visibility-switch-hint {
  font-size: 0.68rem;
}

.publish-entries-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.4rem 0.62rem;
  border: 1px dashed var(--rule);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.publish-entries-toggle:hover {
  color: var(--accent-deep);
  border-color: rgba(var(--accent-rgb), 0.36);
  background: rgba(255, 255, 255, 0.66);
}

.publish-entries-toggle-label {
  flex: none;
  font-weight: 600;
}

.publish-entries-toggle-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}

.publish-entries-toggle-chevron {
  display: inline-flex;
  flex: none;
}

.publish-entries-toggle-chevron .icon {
  width: 13px;
  height: 13px;
  transition: transform 0.18s ease;
}

.publish-entries-toggle.is-open .publish-entries-toggle-chevron .icon {
  transform: rotate(180deg);
}

.publish-novel-row > .publish-entries-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.75rem;
  margin-top: 0.15rem;
  padding: 0.7rem 0.8rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.44);
}

.publish-novel-row > .publish-entries-panel[hidden] {
  display: none;
}

.publish-entries-note {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.6;
}

.publish-entries-note .icon {
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 0.18rem;
}

.publish-entries-group + .publish-entries-group {
  padding-top: 0.75rem;
  border-top: 1px dashed var(--rule);
}

.publish-entries-group-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.publish-entries-group-head .icon {
  width: 13px;
  height: 13px;
}

.publish-entries-group-count {
  margin-left: auto;
  font-weight: 400;
}

.publish-entries-list {
  display: grid;
  gap: 0.15rem;
}

.publish-entry-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.24rem 0.4rem;
  border-radius: 8px;
}

.publish-entry-row:hover {
  background: rgba(255, 255, 255, 0.55);
}

.publish-entry-link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.8rem;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publish-entry-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.publish-vis-seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.55);
}

.publish-vis-option {
  position: relative;
  display: inline-flex;
}

.publish-vis-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.publish-vis-option span {
  padding: 0.14rem 0.52rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.5;
  transition: color 0.15s ease, background 0.15s ease;
}

.publish-vis-option:hover span {
  color: var(--ink);
}

.publish-vis-option:has(input:checked) span {
  background: var(--accent-weak);
  color: var(--accent-deep);
  font-weight: 600;
}

.publish-vis-option:has(input[value='private']:checked) span {
  background: rgba(38, 42, 51, 0.1);
  color: var(--ink);
}

.publish-vis-option:has(input:focus-visible) span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.publish-guide {
  margin-top: 0.4rem;
  padding: 1.3rem 1.4rem;
}

.publish-guide-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.publish-guide-head h2 {
  margin: 0.45rem 0 0;
  font-size: 1.05rem;
  line-height: 1.4;
}

.publish-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}

.publish-steps li {
  display: flex;
  gap: 0.65rem;
  min-width: 0;
}

.publish-step-index {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent-deep);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
}

.publish-step-copy strong {
  display: block;
  color: var(--ink);
  font-size: 0.86rem;
}

.publish-step-copy p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.7;
}

.publish-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 1.2rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--accent-weak);
}

.publish-safety-note .icon {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 0.22rem;
  color: var(--accent-deep);
}

.publish-safety-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.7;
}

.publish-snapshot-status {
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--rule);
  color: var(--faint);
  font-size: 0.72rem;
  line-height: 1.7;
}

.publish-snapshot-status.is-stale {
  color: var(--amber);
}

.side-public-mark {
  display: inline-flex;
  flex: none;
  margin-left: auto;
  color: var(--green);
  opacity: 0.85;
}

.side-public-mark .icon {
  width: 11px;
  height: 11px;
}

@media (max-width: 880px) {
  .publish-steps {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }
}

@media (max-width: 680px) {
  .publish-head {
    flex-direction: column;
    align-items: stretch;
  }

  .publish-head-actions {
    justify-content: stretch;
  }

  .publish-head-actions .btn {
    flex: 1;
  }

  .publish-novel-row {
    gap: 0.7rem;
    padding: 0.7rem 0.75rem;
  }

  .publish-switch {
    padding: 0.35rem;
    border-color: transparent;
    background: transparent;
  }

  .publish-switch .visibility-switch-copy {
    display: none;
  }

  .publish-guide {
    padding: 1.1rem 1rem;
  }

  .publish-guide-head {
    flex-direction: column;
    align-items: stretch;
  }

  .publish-guide-head .btn {
    justify-content: center;
  }

  .publish-entry-row {
    gap: 0.4rem;
    padding: 0.24rem 0.2rem;
  }

  .publish-vis-option span {
    padding: 0.14rem 0.4rem;
    font-size: 0.66rem;
  }

  .publish-novel-row > .publish-entries-panel {
    padding: 0.6rem 0.55rem 0.7rem;
  }
}

@media (max-width: 560px) {
  .visibility-picker {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .publish-summary {
    grid-template-columns: 1fr 1fr;
  }

  .publish-summary-card:last-child {
    grid-column: 1 / -1;
  }

  .book-cover.cover-publish {
    width: 38px;
    height: 54px;
  }
}

/* ---------- iOS 液态玻璃（Liquid Glass） ----------
   在原有磨砂主题之上叠加：折射感高光、渐变玻璃底色、
   分层阴影与更圆润的外壳。全部跟随外观面板的
   卡片不透明度 / 磨砂模糊 / 玻璃描边滑块。 */

:root {
  --lg-edge: calc(0.62 * var(--rim-strength));
  --lg-top-light: calc(0.9 * var(--rim-strength));
  --lg-bottom-light: calc(0.38 * var(--rim-strength));
  --lg-radius: 24px; /* iOS widget 级大圆角 */
  --lg-pill: 999px;
  /* 缓动与反馈时长采用 Lens 设计系统 token（MIT，
     ruiqichenbiec/design-systems）：spring 果冻曲线 */
  --lg-ease: cubic-bezier(0.2, 0.9, 0.25, 1.22);
  --lg-fast: 160ms;
  --lg-feedback: 520ms;
}

/* 整块外壳：一块有厚度的玻璃 */
.page {
  border-color: rgba(255, 255, 255, var(--lg-edge));
  background:
    linear-gradient(
      168deg,
      rgba(255, 255, 255, 0.14),
      rgba(255, 255, 255, 0) 36%,
      rgba(206, 220, 244, 0.16) 100%
    ),
    var(--glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.7);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.7);
  box-shadow:
    0 26px 74px -24px rgba(15, 25, 60, 0.46),
    0 4px 14px rgba(15, 25, 60, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, var(--lg-top-light)),
    inset 0 -1px 0 rgba(255, 255, 255, var(--lg-bottom-light)),
    inset 1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.7)),
    inset -1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.7));
}

/* 玻璃卡片：书架小说卡 */
.novel-card {
  border: 1px solid rgba(255, 255, 255, var(--lg-edge));
  border-radius: var(--lg-radius);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, calc(var(--card-alpha) + 0.18)),
    rgba(255, 255, 255, calc(var(--card-alpha) - 0.06)) 52%,
    rgba(233, 240, 252, calc(var(--card-alpha) + 0.06))
  );
  box-shadow:
    0 2px 6px rgba(18, 28, 65, 0.04),
    0 18px 40px -22px rgba(18, 28, 65, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, var(--lg-top-light)),
    inset 0 -1px 0 rgba(255, 255, 255, var(--lg-bottom-light)),
    inset 1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.8)),
    inset -1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.8));
  backdrop-filter: blur(calc(var(--glass-blur) * 0.7)) saturate(1.7);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.7)) saturate(1.7);
  transition:
    transform 0.24s var(--lg-ease),
    box-shadow 0.24s ease,
    border-color 0.18s ease;
}

.novel-card:hover {
  border-color: rgba(255, 255, 255, calc(0.85 * var(--rim-strength)));
  box-shadow:
    0 4px 10px rgba(18, 28, 65, 0.05),
    0 26px 52px -24px rgba(18, 28, 65, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, calc(var(--lg-top-light) + 0.08)),
    inset 0 -1px 0 rgba(255, 255, 255, var(--lg-bottom-light)),
    inset 1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.8)),
    inset -1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.8));
}

/* 玻璃卡片：词条卡与通用面板 */

.entry-card:hover {
  border-color: rgba(255, 255, 255, calc(0.85 * var(--rim-strength)));
}

/* 弹窗与浮层：更通透的玻璃板（大圆角分级参考 Lens panel token） */
.dialog {
  border: 1px solid rgba(255, 255, 255, calc(0.8 * var(--rim-strength)));
  border-radius: 28px;
  background:
    linear-gradient(
      172deg,
      rgba(255, 255, 255, calc(var(--glass-alpha) - 0.02)),
      rgba(244, 247, 253, calc(var(--glass-alpha) - 0.06)) 60%,
      rgba(233, 239, 251, calc(var(--glass-alpha) - 0.04))
    );
  box-shadow:
    /* 官方式悬浮影：超大柔影 + 极近贴影，边缘无硬过渡 */
    0 44px 120px -34px rgba(15, 25, 60, 0.5),
    0 4px 14px rgba(15, 25, 60, 0.1),
    /* 双侧镜面：顶亮线 + 底部最外亮线，内侧保留厚度暗线；
       左缘亮线取自 Lens surface-shadow 的双亮线结构 */
    inset 0 1px 0 rgba(255, 255, 255, var(--lg-top-light)),
    inset 1px 0 0 rgba(255, 255, 255, calc(0.2 * var(--rim-strength))),
    inset 0 -1px 0 rgba(255, 255, 255, calc(0.55 * var(--rim-strength))),
    inset 0 -2px 0 rgba(19, 29, 62, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, calc(0.22 * var(--rim-strength)));
  backdrop-filter: blur(calc(var(--glass-blur) + 4px)) saturate(1.6);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) + 4px)) saturate(1.6);
}

.appearance-panel {
  border: 1px solid rgba(255, 255, 255, calc(0.8 * var(--rim-strength)));
  border-radius: 24px;
  background:
    linear-gradient(
      172deg,
      rgba(255, 255, 255, 0.9),
      rgba(240, 245, 253, 0.84) 62%,
      rgba(232, 238, 250, 0.86)
    );
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  box-shadow:
    0 26px 64px -22px rgba(15, 25, 60, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, var(--lg-top-light)),
    inset 1px 0 0 rgba(255, 255, 255, calc(0.2 * var(--rim-strength))),
    inset 0 -1px 0 rgba(255, 255, 255, var(--lg-bottom-light));
}

/* 侧边搜索面板同样使用液态玻璃 */
.search-dialog {
  border: none;
  border-right: 1px solid rgba(255, 255, 255, calc(0.8 * var(--rim-strength)));
  border-radius: 0 24px 24px 0;
  background:
    linear-gradient(
      175deg,
      rgba(255, 255, 255, calc(var(--glass-alpha) + 0.06)),
      rgba(243, 247, 253, calc(var(--glass-alpha))) 55%,
      rgba(233, 239, 251, calc(var(--glass-alpha) + 0.02))
    );
  backdrop-filter: blur(calc(var(--glass-blur) + 2px)) saturate(1.55);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) + 2px)) saturate(1.55);
  box-shadow:
    26px 0 80px -30px rgba(15, 25, 60, 0.5),
    inset -1px 0 0 rgba(255, 255, 255, calc(0.5 * var(--rim-strength)));
}

/* 按钮：玻璃胶囊高光 */
.btn.primary {
  border-color: rgba(255, 255, 255, 0.4);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0) 46%
  ),
  var(--accent);
  box-shadow:
    0 10px 26px -10px rgba(var(--accent-rgb), 0.7),
    0 2px 6px rgba(var(--accent-rgb), 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(15, 25, 60, 0.18);
}

.btn.primary:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.3),
    rgba(255, 255, 255, 0) 46%
  ),
  var(--accent-deep);
  box-shadow:
    0 14px 30px -12px rgba(var(--accent-rgb), 0.78),
    0 2px 8px rgba(var(--accent-rgb), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(15, 25, 60, 0.18);
}

.btn.ghost,
.side-action,
.icon-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, calc(0.55 * var(--rim-strength)));
}

/* 小玻璃件：导航与工具芯片 */
.nav-item.is-active,
.terrain-option.is-active,
.map-tool.is-active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(var(--accent-rgb), 0.12),
    0 6px 16px -8px rgba(var(--accent-rgb), 0.4);
}

/* 控件胶囊化：按钮、搜索框与侧栏导航改为 iOS 胶囊 */
.btn,
.icon-btn,
.side-action,
.nav-item,
.side-novel-link,
.sidebar .workspace-nav-link,
.search-box,
.sort-control,
.appearance-preset,
.filter-pill {
  border-radius: var(--lg-pill);
}

.btn.ghost,
.side-action,
.search-box,
.sort-control,
.filter-pill {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, calc(0.5 * var(--rim-strength)));
}

/* 评论悬浮按钮：官方 clear 观感——tint 很轻（约 8%），
   主要靠磨砂 + 亮度 + 边缘折射成形。
   站点壁纸明暗不一，tint 过轻会让按钮沉进暗壁纸：
   折中 50%/38% + 亮度抬升，任何壁纸上按钮与文字都保持分离 */
.comment-fab {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.5),
    rgba(226, 236, 252, 0.38)
  );
  backdrop-filter: blur(16px) saturate(1.6) brightness(1.08);
  -webkit-backdrop-filter: blur(16px) saturate(1.6) brightness(1.08);
}

.comment-fab .icon,
.comment-fab-label {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.55);
}

/* 控件过渡统一 Lens spring 缓动（果冻回弹） */
.btn,
.icon-btn,
.side-action,
.nav-item,
.filter-pill,
.appearance-preset {
  transition-timing-function: var(--lg-ease);
}

/* 官方按压反馈：玻璃在按下瞬间「聚光」——内圈泛白光并轻微收缩 */
.btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.side-action:active,
.nav-item:active:not(.is-active),
.filter-pill:active,
.appearance-preset:active,
.side-novel-link:active,
.sidebar .workspace-nav-link:active,
.comment-fab:active {
  box-shadow:
    inset 0 2px 12px rgba(255, 255, 255, calc(0.55 * var(--rim-strength))),
    inset 0 1px 0 rgba(255, 255, 255, calc(0.8 * var(--rim-strength)));
  transform: scale(0.97);
  transition-duration: 0.08s;
}

/* 边缘折射由 assets/js/liquid-glass.js 按元素尺寸生成
   （改编自 shuding/liquid-glass，MIT）：SDF 位移图 + feDisplacementMap，
   仅 Chromium 生效，其余浏览器保持上方普通磨砂。 */

/* 地图工坊为全屏工作台：使用近实心底色，减轻合成层负担 */
.map-dialog {
  background: linear-gradient(178deg, #fbfcff 78%, #eef2fa);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

@media (max-width: 980px) {
  .search-dialog {
    width: min(340px, 94vw);
  }
}

@media (max-width: 680px) {
  .search-dialog {
    width: 100vw;
    border-radius: 0;
    border-right: none;
    box-shadow: none;
  }
}

/* 物产与大陆 */
.terrain-chip-resource {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e9b23c;
  border: 1.5px solid #8a6a1e;
  color: #5c430f;
  font-size: 12px;
  font-weight: 600;
}

.terrain-chip-continent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(79, 109, 245, 0.16);
  border: 1.5px solid rgba(79, 109, 245, 0.55);
  color: #3a56c4;
  font-size: 12px;
  font-weight: 600;
}

.map-resource-label {
  fill: #6b4e12;
  font-family: -apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 9px;
  font-weight: 600;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 2.5px;
  stroke-linejoin: round;
}

.map-continent-layer {
  pointer-events: none;
}

.map-river-name {
  margin-top: 10px;
}

.map-river-name input {
  width: 100%;
}

.form-check.civ6-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* Civ6 导出指南 */

.civ6-credit {
  margin: 0;
  font-size: 12px;
}

.civ6-credit a {
  color: var(--accent, #4f6df5);
}
.civ6-guide {
  display: grid;
  gap: 12px;
  max-width: 560px;
}

.civ6-guide h3 {
  margin: 4px 0 0;
}

.civ6-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.civ6-mapping {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}

.civ6-path {
  display: block;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--muted, rgba(120, 130, 155, 0.14));
  font-size: 12.5px;
  user-select: all;
  overflow-wrap: anywhere;
}

.civ6-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 12.5px;
  white-space: pre-line;
}

/* 城址推荐标记 */
.map-suggest-layer {
  pointer-events: none;
}

.map-suggest-rank {
  fill: #a8791b;
  font-family: -apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.map-city-type-row button {
  min-width: 52px;
}

/* ---------- 流动玻璃：hover 光泽 ----------
   严格移植 glass-lens-react（MIT License）GlassSurface 的光角 rim 模型
   https://github.com/jvreeken/glass-lens-react
   · rim 双侧结构照搬原版 boxShadow：光侧 inset(ox·1.3, oy·1.3) 0.5px 锐边
     主亮线 + 暗侧对向 inset(-ox, -oy) 2px × 24% 强度（ox=-sinθ, oy=cosθ）
   · shimmer：进入 hover 时光角围绕指针方位 ±180° 扫掠一圈后停回光位
     （原版 700ms eased sweep；以 --lg-light-base 为中心避免回跳闪变）
   · reveal：hover/focus/active 时亮度抬升淡入（原版 .glass-reveal
     300ms ease-out；原版 1.5 针对深色透镜，亮玻璃控件取 1.35 防过曝）
   · 指针方位 --lg-light-base 由 liquid-glass.js 委托 pointermove 写入
     （原版光角来自 deviceorientation 倾角；Web 端以指针方位为光源）
   光角经 @property 注册并用 CSS sin()/cos() 换算（Chromium 111+）；
   不支持的浏览器 rim 与扫掠整体失效，回退到基础磨砂样式。 */
@property --lg-light {
  syntax: '<angle>';
  /* 必须可继承：rim 画在 ::after/::before 上，
     伪元素要从宿主元素拿动画中的光角值 */
  inherits: true;
  initial-value: 0deg;
}

/* 全部可点击件：button 元素通配（对话框内按钮、地图工具、面板开关、
   练笔房、演算等一网打尽）+ 非 button 的玻璃件与可点击卡片。
   卡片的 ::after 已被玻璃描边占用，流光层放 ::before；
   is-pinned 卡片与 synopsis-card 的 ::before 已被占用，跳过。 */
button,
.nav-item,
.side-novel-link,
.sidebar .workspace-nav-link,
.search-box,
.sort-control,
.filter-pill,
.novel-card:not(.is-pinned),
.entry-card:not(.is-pinned),
.section-card,
.panel,
.trash-card,
.comment-card:not(.is-unavailable),
.drill-card {
  --lg-light: var(--lg-light-base, 0deg);
  position: relative;
}

/* 流光层：按钮与链接类玻璃件用 ::after */
button::after,
.nav-item::after,
.side-novel-link::after,
.sidebar .workspace-nav-link::after,
.search-box::after,
.sort-control::after,
.filter-pill::after,
.comment-fab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  box-shadow:
    inset calc(-1.3px * sin(var(--lg-light))) calc(1.3px * cos(var(--lg-light)))
      0.5px 0 rgba(255, 255, 255, 0.9),
    inset calc(1.3px * sin(var(--lg-light))) calc(-1.3px * cos(var(--lg-light)))
      2px 0 rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: brightness(1.35);
  backdrop-filter: brightness(1.35);
}

/* 流光层：可点击卡片用 ::before（::after 被 rim 描边占用） */
.novel-card:not(.is-pinned)::before,
.entry-card:not(.is-pinned)::before,
.section-card::before,
.panel::before,
.trash-card::before,
.comment-card:not(.is-unavailable)::before,
.drill-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  box-shadow:
    inset calc(-1.3px * sin(var(--lg-light))) calc(1.3px * cos(var(--lg-light)))
      0.5px 0 rgba(255, 255, 255, 0.9),
    inset calc(1.3px * sin(var(--lg-light))) calc(-1.3px * cos(var(--lg-light)))
      2px 0 rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: brightness(1.2);
  backdrop-filter: brightness(1.2);
}

button:hover::after,
button:focus-visible::after,
button:active::after,
.nav-item:hover::after,
.nav-item:active::after,
.side-novel-link:hover::after,
.sidebar .workspace-nav-link:hover::after,
.search-box:focus-within::after,
.sort-control:hover::after,
.filter-pill:hover::after,
.comment-fab:hover::after,
.novel-card:not(.is-pinned):hover::before,
.entry-card:not(.is-pinned):hover::before,
.section-card:hover::before,
.panel:hover::before,
.trash-card:hover::before,
.comment-card:not(.is-unavailable):hover::before,
.drill-card:hover::before {
  opacity: 1;
}

button:hover,
.nav-item:hover,
.side-novel-link:hover,
.sidebar .workspace-nav-link:hover,
.filter-pill:hover,
.novel-card:not(.is-pinned):hover,
.entry-card:not(.is-pinned):hover,
.section-card:hover,
.panel:hover,
.trash-card:hover,
.comment-card:not(.is-unavailable):hover,
.drill-card:hover {
  animation: lg-shimmer 0.7s ease-out;
}

@keyframes lg-shimmer {
  from {
    --lg-light: calc(var(--lg-light-base, 0deg) - 180deg);
  }
  to {
    --lg-light: calc(var(--lg-light-base, 0deg) + 180deg);
  }
}

/* ---------- 全框液态玻璃：内容层统一材质 ----------
   对齐 iOS 26 主屏幕：widget 与 inset grouped 卡片同为玻璃材质，
   整页像浮在壁纸上的一组玻璃件。所有容器框在此统一：
   rim 双亮线 + 雾度渐变 + 近贴影/大柔影，材质参数与官方式样一致。
   （地图工坊保持近实心：大画布上玻璃折射开销过高） */
.novel-card,
.entry-card,
.section-card,
.panel,
.synopsis-card,
.trash-card,
.comment-card:not(.is-unavailable),
.drill-card,
.shelf-toolbar,
.comments-toolbar {
  border: 1px solid rgba(255, 255, 255, var(--lg-edge));
  border-radius: var(--lg-radius);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, calc(var(--card-alpha) + 0.16)),
    rgba(255, 255, 255, calc(var(--card-alpha) - 0.05)) 55%,
    rgba(234, 240, 251, calc(var(--card-alpha) + 0.05))
  );
  box-shadow:
    0 2px 6px rgba(18, 28, 65, 0.04),
    0 20px 44px -22px rgba(18, 28, 65, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, var(--lg-top-light)),
    inset 0 -1px 0 rgba(255, 255, 255, var(--lg-bottom-light)),
    inset 1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.8)),
    inset -1px 0 0 rgba(255, 255, 255, calc(var(--lg-bottom-light) * 0.8)),
    inset 0 0 0 1px rgba(255, 255, 255, calc(0.14 * var(--rim-strength)));
  backdrop-filter: blur(calc(var(--glass-blur) * 0.65)) saturate(1.65);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.65)) saturate(1.65);
}

.synopsis-card,
.section-card {
  backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(1.6);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(1.6);
}

/* 输入框与下拉：iOS inset 玻璃感（浅雾填充 + 内凹亮边） */
.field > input,
.field > select,
.field > textarea,
.tag-editor {
  border: 1px solid rgba(255, 255, 255, calc(0.7 * var(--rim-strength)));
  background: rgba(255, 255, 255, 0.52);
  box-shadow:
    inset 0 1px 2px rgba(18, 28, 65, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(calc(var(--glass-blur) * 0.5)) saturate(1.4);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5)) saturate(1.4);
  border-radius: 12px;
}

.field > input:focus,
.field > select:focus,
.field > textarea:focus,
.tag-editor:focus-within {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(255, 255, 255, 0.72);
}

/* 内容网格间距：iOS 主屏幕的疏朗节奏 */
.novel-grid,
.entry-grid {
  gap: 1.05rem;
}

/* 大浮层（对话框/外观面板）不做整圈扫掠，改为柔和的指针光斑：
   光斑位置 --mx/--my 由 liquid-glass.js 在指针移动时写入 */
.dialog[open]::before,
.appearance-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    170px circle at var(--mx, 50%) var(--my, 30%),
    rgba(255, 255, 255, 0.34),
    rgba(255, 255, 255, 0.1) 55%,
    transparent 75%
  );
}

.dialog[open]:hover::before,
.appearance-panel:hover::before {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- 移动端适配补强（390/360 实测；响应式覆盖归 theme.css） ---------- */

@media (max-width: 420px) {
  .panel-head {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .panel-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 10px;
  }
}

@media (max-width: 680px) {
  .filter-pill {
    padding: 10px 14px;
  }

  .continue-banner-dismiss {
    width: 40px;
    height: 40px;
    margin: -8px -6px -8px -10px;
  }

  .fate-roster-row {
    padding: 10px 12px;
  }
}

/* ---------- 液态玻璃 v2：受光面与低透明度偏好 ----------
   .has-liquid-glass 只由 liquid-glass.js 在 Chromium 支持
   backdrop-filter: url() 时挂到根元素；其余浏览器保持原磨砂。 */

/* 浮层降低底色不透明度，让边缘折射真正看得见；
   同时叠一层随指针方位移动的受光渐变（不随内容滚动）。 */
html.has-liquid-glass .dialog {
  background:
    linear-gradient(
      calc(var(--lg-light-base, 0deg) + 180deg),
      rgba(255, 255, 255, 0.3),
      rgba(255, 255, 255, 0) 42%
    ),
    linear-gradient(
      172deg,
      rgba(255, 255, 255, calc(var(--glass-alpha) - 0.02)),
      rgba(244, 247, 253, calc(var(--glass-alpha) - 0.06)) 60%,
      rgba(233, 239, 251, calc(var(--glass-alpha) - 0.04))
    );
}

html.has-liquid-glass .search-dialog {
  background:
    linear-gradient(
      calc(var(--lg-light-base, 0deg) + 180deg),
      rgba(255, 255, 255, 0.28),
      rgba(255, 255, 255, 0) 44%
    ),
    linear-gradient(
      175deg,
      rgba(255, 255, 255, calc(var(--glass-alpha) + 0.06)),
      rgba(243, 247, 253, var(--glass-alpha)) 55%,
      rgba(233, 239, 251, calc(var(--glass-alpha) + 0.02))
    );
}

html.has-liquid-glass .appearance-panel {
  background:
    linear-gradient(
      calc(var(--lg-light-base, 0deg) + 180deg),
      rgba(255, 255, 255, 0.34),
      rgba(255, 255, 255, 0) 46%
    ),
    linear-gradient(
      172deg,
      rgba(255, 255, 255, calc(var(--glass-alpha) + 0.08)),
      rgba(240, 245, 253, calc(var(--glass-alpha) + 0.02)) 62%,
      rgba(232, 238, 250, calc(var(--glass-alpha) + 0.04))
    );
}

/* 指针光斑略强，贴近 iOS 26 的镜面高光 */
html.has-liquid-glass .dialog[open]::before,
html.has-liquid-glass .appearance-panel::before {
  background: radial-gradient(
    200px circle at var(--mx, 50%) var(--my, 30%),
    rgba(255, 255, 255, 0.42),
    rgba(255, 255, 255, 0.12) 52%,
    transparent 76%
  );
}

/* 降低透明度：所有玻璃面退回不透明浅色，并停用折射层 */
@media (prefers-reduced-transparency: reduce) {
  html .page,
  html .dialog,
  html .appearance-panel,
  html .search-dialog,
  html .novel-card,
  html .entry-card,
  html .section-card,
  html .panel,
  html .synopsis-card,
  html .trash-card,
  html .comment-card,
  html .drill-card,
  html .shelf-toolbar,
  html .comments-toolbar,
  html .comment-fab,
  html .field > input,
  html .field > select,
  html .field > textarea,
  html .tag-editor {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background-image: none !important;
    background-color: #f5f8fd;
  }

  html .dialog[open]::before,
  html .appearance-panel::before {
    display: none;
  }
}

html.lg-reduced-transparency .page,
html.lg-reduced-transparency .dialog,
html.lg-reduced-transparency .appearance-panel,
html.lg-reduced-transparency .search-dialog,
html.lg-reduced-transparency .novel-card,
html.lg-reduced-transparency .entry-card,
html.lg-reduced-transparency .section-card,
html.lg-reduced-transparency .panel,
html.lg-reduced-transparency .synopsis-card,
html.lg-reduced-transparency .trash-card,
html.lg-reduced-transparency .comment-card,
html.lg-reduced-transparency .drill-card,
html.lg-reduced-transparency .shelf-toolbar,
html.lg-reduced-transparency .comments-toolbar,
html.lg-reduced-transparency .comment-fab,
html.lg-reduced-transparency .field > input,
html.lg-reduced-transparency .field > select,
html.lg-reduced-transparency .field > textarea,
html.lg-reduced-transparency .tag-editor {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-image: none !important;
  background-color: #f5f8fd;
}

html.lg-reduced-transparency .dialog[open]::before,
html.lg-reduced-transparency .appearance-panel::before {
  display: none;
}

/* ---------- 整书 AI 设定包 ---------- */

.ai-pack-dialog {
  width: min(780px, calc(100vw - 32px));
}

.ai-pack-intro {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.ai-pack-presets {
  flex-wrap: wrap;
  margin-bottom: 0.95rem;
}

.ai-pack-section-head,
.ai-pack-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.ai-pack-section-hint,
.ai-pack-count {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.ai-pack-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 0.45rem;
}

.ai-pack-section {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.ai-pack-section:hover {
  border-color: rgba(var(--accent-rgb), 0.38);
  background: #fff;
}

.ai-pack-section.is-empty {
  opacity: 0.52;
  cursor: default;
}

.ai-pack-section input {
  margin: 0;
  accent-color: var(--accent);
}

.ai-pack-section-count {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.ai-pack-focus {
  margin-top: 0.9rem;
}

.ai-pack-preview-head {
  margin-top: 1rem;
}

.ai-pack-preview {
  width: 100%;
  min-height: 230px;
  max-height: 42vh;
  resize: vertical;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
}

.ai-pack-notice {
  margin-top: 0.5rem;
  color: var(--danger);
}

.ai-pack-dialog .dialog-actions {
  flex-wrap: wrap;
}

@media (max-width: 680px) {
  .ai-pack-dialog {
    width: calc(100vw - 20px);
  }

  .ai-pack-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-pack-preview {
    min-height: 180px;
    max-height: 36vh;
    font-size: 11.5px;
  }
}

@media (max-width: 560px) {
  .ai-pack-dialog .dialog-actions .btn {
    flex: 1 1 120px;
  }
}

/* ---------- 网页构想 ---------- */

.ideas-section .content-head {
  margin-bottom: 14px;
}

.ideas-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.ideas-toolbar .search-box {
  flex: 1 1 240px;
}

.ideas-status-filters {
  margin-top: 2px;
}

.ideas-meta {
  margin-top: 10px;
}

.idea-draw {
  position: relative;
  margin: 14px 0 16px;
  padding: 18px 20px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 16px;
  background:
    radial-gradient(120% 170% at 0% 0%, rgba(var(--accent-rgb), 0.13), transparent 58%),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 32px rgba(35, 45, 85, 0.08);
  animation: idea-draw-in 0.3s ease;
}

@keyframes idea-draw-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.idea-draw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.idea-draw-head .eyebrow {
  margin: 0;
}

.idea-draw-kicker {
  margin: 7px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.idea-draw-title {
  margin: 6px 0 0;
  font-family: var(--reading);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
}

.idea-draw-next {
  margin: 10px 0 0;
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.idea-draw-next strong {
  color: var(--accent-deep);
  font-weight: 600;
}

.idea-draw-next.is-empty {
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--faint);
}

.idea-draw-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.idea-draw-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.idea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.idea-card {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--card);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.idea-card:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.32);
  box-shadow: 0 10px 24px rgba(35, 45, 85, 0.07);
}

.idea-card.is-picked {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 10px 28px rgba(var(--accent-rgb), 0.14);
}

.idea-card.is-shipped {
  opacity: 0.82;
}

.idea-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.idea-kind-chip,
.idea-status-chip {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.idea-kind-chip {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.idea-status-chip {
  background: var(--line-soft);
  color: var(--muted);
}

.idea-status-chip.is-planned {
  background: var(--amber-soft);
  color: var(--amber);
}

.idea-status-chip.is-building {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-deep);
}

.idea-status-chip.is-shipped {
  background: var(--green-soft);
  color: var(--green);
}

.idea-status-chip.is-parked {
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--faint);
}

.idea-card-time {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
}

.idea-card-title {
  margin: 9px 0 0;
  font-family: var(--reading);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
}

.idea-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
}

.idea-card-next {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.idea-card-next strong {
  color: var(--accent-deep);
  font-weight: 600;
}

.idea-card-next.is-empty {
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--faint);
}

.idea-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.idea-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: var(--faint);
}

.idea-stars .icon {
  width: 11px;
  height: 11px;
}

.idea-stars .is-on {
  color: var(--amber);
}

.idea-stars .is-on .icon {
  fill: currentColor;
}

.idea-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
}

.idea-advance-btn {
  margin-right: auto;
  color: var(--accent-deep);
}

.idea-advance-btn:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
}

.idea-dialog {
  width: min(680px, calc(100vw - 32px));
}

.idea-excitement {
  display: flex;
  align-items: center;
  gap: 3px;
}

.idea-excitement-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.idea-excitement-btn .icon {
  width: 20px;
  height: 20px;
}

.idea-excitement-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.idea-excitement-btn.is-on {
  color: var(--amber);
}

.idea-excitement-btn.is-on .icon {
  fill: currentColor;
}

.idea-excitement-hint {
  margin-left: 7px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
}

@media (max-width: 680px) {
  .idea-grid {
    grid-template-columns: 1fr;
  }

  .idea-dialog {
    width: calc(100vw - 20px);
  }
}

@media (max-width: 560px) {
  .ideas-toolbar .search-box {
    flex-basis: 100%;
  }

  .idea-card-actions {
    flex-wrap: wrap;
  }

  .idea-draw-actions .btn {
    flex: 1 1 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .idea-draw {
    animation: none;
  }

  .idea-card {
    transition: none;
  }
}

/* ---------- Glass Select：自绘玻璃下拉（方案 A） ----------
   原生 <select> 弹出层由系统绘制，无法主题化。glass-select.js
   保留原生 select 作为值与表单数据源，用 Popover + listbox
   呈现玻璃弹层；不支持 Popover 的浏览器自动回退原生控件。 */

.gs {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.gs--field,
.gs--plain {
  display: flex;
  width: 100%;
}

.gs--sort {
  height: 100%;
}

.gs > .gs-native {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.gs-trigger {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, calc(0.7 * var(--rim-strength)));
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow:
    inset 0 1px 2px rgba(18, 28, 65, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(calc(var(--glass-blur) * 0.5)) saturate(1.4);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.5)) saturate(1.4);
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.gs-trigger:hover {
  border-color: rgba(var(--accent-rgb), 0.42);
}

.gs-trigger:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.58);
  outline: 2px solid var(--accent-weak);
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.72);
}

.gs.is-open .gs-trigger {
  border-color: rgba(var(--accent-rgb), 0.5);
}

.gs-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gs-arrow {
  flex: none;
  width: 11px;
  height: 11px;
  color: var(--muted);
  transition: transform 0.2s var(--lg-ease);
}

.gs.is-open .gs-arrow {
  transform: rotate(180deg);
}

.gs.is-disabled .gs-trigger,
.gs-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gs.is-disabled .gs-trigger:hover {
  border-color: rgba(255, 255, 255, calc(0.7 * var(--rim-strength)));
}

/* 排序控件：沿用外层胶囊，只保留文字与箭头 */
.gs--sort .gs-trigger {
  width: auto;
  height: 100%;
  min-height: 30px;
  padding: 0 19px 0 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--ink-soft);
  font-size: 12.5px;
  gap: 7px;
}

.gs--sort .gs-trigger:hover,
.gs--sort.is-open .gs-trigger {
  color: var(--ink);
}

.gs--sort .gs-trigger:focus-visible {
  border: 0;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  background: transparent;
}

.gs--sort .gs-value {
  max-width: 10.5em;
}

.gs--sort .gs-arrow {
  width: 9px;
  height: 9px;
}

/* 弹层：顶层玻璃板，不透明底色保证任何壁纸上可读 */
.gs-popover {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  border: 0;
  max-width: none;
  max-height: none;
  overflow: visible;
  background: transparent;
  color: var(--ink);
}

.gs-popover::backdrop {
  background: transparent;
}

.gs-panel {
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, calc(0.9 * var(--rim-strength)));
  border-radius: 16px;
  background:
    linear-gradient(
      165deg,
      rgba(255, 255, 255, 0.94),
      rgba(244, 248, 255, 0.9) 58%,
      rgba(235, 242, 253, 0.92)
    );
  box-shadow:
    0 26px 60px -20px rgba(15, 25, 60, 0.42),
    0 4px 14px rgba(15, 25, 60, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 1px 0 0 rgba(255, 255, 255, calc(0.45 * var(--rim-strength))),
    inset 0 -1px 0 rgba(255, 255, 255, calc(0.5 * var(--rim-strength))),
    inset 0 0 0 1px rgba(255, 255, 255, calc(0.18 * var(--rim-strength)));
  backdrop-filter: blur(24px) saturate(1.75);
  -webkit-backdrop-filter: blur(24px) saturate(1.75);
  overflow: hidden;
  transform-origin: top center;
  animation: gs-pop-in 0.16s var(--lg-ease);
}

.gs-popover[data-placement="top"] .gs-panel {
  transform-origin: bottom center;
  animation-name: gs-pop-in-top;
}

@keyframes gs-pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes gs-pop-in-top {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gs-listbox {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(320px, 48vh);
  padding: 2px;
  overflow: auto;
  overscroll-behavior: contain;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(38, 42, 51, 0.18) transparent;
}

.gs-listbox::-webkit-scrollbar {
  width: 9px;
}

.gs-listbox::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(38, 42, 51, 0.16);
  background-clip: content-box;
}

.gs-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gs-group-label {
  padding: 8px 12px 4px;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.gs-group:first-child .gs-group-label {
  padding-top: 4px;
}

.gs-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.12s ease,
    color 0.12s ease;
}

.gs-option:hover {
  background: rgba(var(--accent-rgb), 0.07);
}

.gs-option.is-active {
  background: rgba(var(--accent-rgb), 0.1);
}

.gs-option[aria-selected="true"] {
  background: rgba(var(--accent-rgb), 0.13);
  color: var(--accent-deep);
  font-weight: 600;
}

.gs-option[aria-selected="true"].is-active {
  background: rgba(var(--accent-rgb), 0.17);
}

.gs-option.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.gs-option.is-disabled:hover {
  background: transparent;
}

.gs-option-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gs-check {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.gs-option[aria-selected="true"] .gs-check {
  opacity: 1;
}

.gs-empty {
  padding: 14px 12px;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 12.5px;
  text-align: center;
}

@media (pointer: coarse) {
  .gs-option {
    min-height: 44px;
  }
}

@media (max-width: 680px) {
  .gs--sort .gs-trigger {
    padding-right: 17px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .gs-panel {
    background: #f5f8fd;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

html.lg-reduced-transparency .gs-panel {
  background: #f5f8fd;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
