﻿/* =========================================================
   一心剑法 · 创作工作台
   墨纸 / 朱砂 / 青铜色系，桌面优先
   ========================================================= */

:root {
  --font-ui: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;

  --bg: #f3eee4;
  --bg-2: #ece4d6;
  --panel: #fbf8f1;
  --panel-2: #f6f0e5;
  --panel-3: #efe7d8;
  --ink: #20241f;
  --ink-2: #475047;
  --muted: #7d8379;
  --faint: #a8aa9f;
  --line: #ded4c2;
  --line-strong: #cbbda6;
  --accent: #a63a2b;
  --accent-2: #c15a40;
  --accent-soft: rgba(166, 58, 43, .09);
  --gold: #9c7b48;
  --teal: #2f6f63;
  --green: #4d7c45;
  --shadow-sm: 0 1px 2px rgba(61, 47, 28, .06);
  --shadow: 0 12px 34px rgba(61, 47, 28, .09);
  --shadow-lg: 0 28px 70px rgba(40, 30, 16, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 252px;

  --st-unplanned: #9aa197;
  --st-outlined: #4f74c8;
  --st-draft: #b9761f;
  --st-revised: #2f7d6d;
  --st-finalized: #4d7a3f;

  --st-unplanned-bg: rgba(154, 161, 151, .10);
  --st-outlined-bg: rgba(79, 116, 200, .11);
  --st-draft-bg: rgba(185, 118, 31, .12);
  --st-revised-bg: rgba(47, 125, 109, .12);
  --st-finalized-bg: rgba(77, 122, 63, .13);
}

html[data-theme="dark"] {
  --bg: #111513;
  --bg-2: #0d100e;
  --panel: #181e1a;
  --panel-2: #1c231e;
  --panel-3: #222b25;
  --ink: #e9e3d5;
  --ink-2: #bcc3b8;
  --muted: #8c9489;
  --faint: #687166;
  --line: #2a342e;
  --line-strong: #3b463f;
  --accent: #d0664d;
  --accent-2: #e08368;
  --accent-soft: rgba(208, 102, 77, .13);
  --gold: #c6a46a;
  --teal: #63b3a2;
  --green: #7fae72;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 14px 38px rgba(0, 0, 0, .42);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, .6);

  --st-unplanned: #727b70;
  --st-outlined: #7f9fe0;
  --st-draft: #d9a253;
  --st-revised: #63b3a2;
  --st-finalized: #8fba7f;

  --st-unplanned-bg: rgba(114, 123, 112, .12);
  --st-outlined-bg: rgba(127, 159, 224, .13);
  --st-draft-bg: rgba(217, 162, 83, .13);
  --st-revised-bg: rgba(99, 179, 162, .13);
  --st-finalized-bg: rgba(143, 186, 127, .14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(166, 58, 43, .22); }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  background:
    radial-gradient(1100px 520px at 88% -8%, rgba(166, 58, 43, .06), transparent 62%),
    radial-gradient(900px 500px at 8% 108%, rgba(156, 123, 72, .08), transparent 60%),
    var(--bg);
}
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- sidebar ---------- */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px 14px 16px;
  color: #e8e2d5;
  background:
    radial-gradient(500px 260px at 0% 0%, rgba(166, 58, 43, .22), transparent 70%),
    linear-gradient(180deg, #1e2521 0%, #171d19 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
  overflow-y: auto;
  z-index: 2000;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; }
.brand-mark {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #b84633, #8f2b1e);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 18px rgba(0, 0, 0, .25);
  font-family: var(--font-serif); font-size: 23px; font-weight: 700; color: #f6ead5;
}
.brand-title { font-family: var(--font-serif); font-size: 18px; font-weight: 700; letter-spacing: .06em; }
.brand-sub { margin-top: 2px; font-size: 10px; letter-spacing: .22em; color: #98a197; text-transform: uppercase; }

.side-book { margin: 0 8px 16px; padding: 12px 12px 13px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 12px; background: rgba(255, 255, 255, .035); }
.side-book-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.side-book-top span:first-child { font-size: 11px; color: #98a197; letter-spacing: .08em; }
.side-book-top span:last-child { font-family: var(--font-serif); font-size: 16px; color: #f0e7d5; }
.side-meter { margin-top: 9px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.side-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #b84633, #d99a5c); }
.side-book-foot { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10.5px; color: #8c958b; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; padding: 0 12px;
  border-radius: 10px;
  color: #b9c1b6;
  font-size: 13.5px;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { flex: 0 0 auto; opacity: .78; }
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #f2ebdd; }
.nav-item.active { background: rgba(255, 255, 255, .085); color: #fff6e7; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #d06a4f, #a63a2b);
}
.nav-item.active svg { opacity: 1; color: #e3a184; }
.nav-count { margin-left: auto; font-size: 10.5px; color: #7f8a80; letter-spacing: .03em; }
.nav-item.active .nav-count { color: #cfb9a1; }
.side-foot { margin-top: auto; padding: 16px 8px 2px; font-size: 10.5px; color: #7f8a80; line-height: 1.7; }
.side-foot .dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #6c9c78; box-shadow: 0 0 0 3px rgba(108, 156, 120, .12); }

/* ---------- topbar ---------- */
.topbar {
  height: 64px; flex: 0 0 64px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  position: relative; z-index: 10;
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.crumbs b { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.search-trigger {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--muted); font-size: 12.5px;
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--ink-2); }
.search-trigger kbd { padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); font-size: 10px; font-family: var(--font-mono); color: var(--muted); }
.save-indicator { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; padding: 0 2px; white-space: nowrap; }
.save-indicator[data-state="dirty"] { color: var(--st-draft); }
.save-indicator[data-state="saving"] { color: var(--st-outlined); }
.save-indicator[data-state="error"] { color: var(--accent); }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); color: var(--ink-2);
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.mobile-menu { display: none; }

/* ---------- view / page ---------- */
.view { flex: 1; min-height: 0; overflow-y: auto; position: relative; }
.view-editor { overflow: hidden; }
.page { max-width: 1440px; margin: 0 auto; padding: 28px 34px 78px; }
.page-editor { height: 100%; padding: 18px 22px 22px; display: flex; flex-direction: column; min-height: 0; }
.boot-screen { height: 70vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.boot-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: var(--accent); color: #fff4e2; font-family: var(--font-serif); font-size: 28px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: translateY(-4px); opacity: .75; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-family: var(--font-serif); font-size: 27px; letter-spacing: .03em; font-weight: 700; }
.page-head .sub { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 760px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--gold);  }

/* ---------- generic ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card.pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 14px; letter-spacing: .05em; font-weight: 600; }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 10.5px; letter-spacing: .04em; }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.8; }
.empty b { display: block; margin-bottom: 5px; color: var(--ink-2); font-weight: 600; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px;
  border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink-2);
  font-size: 12.5px; font-weight: 500; letter-spacing: .02em;
  transition: all .15s ease;
}
.btn:hover { background: var(--panel-2); color: var(--ink); }
.btn.primary { border-color: transparent; background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #fff6ea; box-shadow: 0 6px 16px rgba(166, 58, 43, .18); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.small { height: 30px; padding: 0 10px; font-size: 11.5px; border-radius: 7px; }
.btn.danger { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }
.btn.danger:hover { background: var(--accent-soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { color: var(--accent); font-size: 12.5px; }
.link:hover { text-decoration: underline; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10.5px; white-space: nowrap;
}
.tag.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: var(--accent-soft); }
.tag.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 30%, var(--line)); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.tag.red { color: var(--accent); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; letter-spacing: .03em; white-space: nowrap; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-unplanned { color: var(--st-unplanned); }
.st-outlined { color: var(--st-outlined); }
.st-draft { color: var(--st-draft); }
.st-revised { color: var(--st-revised); }
.st-finalized { color: var(--st-finalized); }

.kbd { display: inline-block; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel-2); font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

/* ---------- dashboard ---------- */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .9fr); gap: 30px;
  padding: 32px 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(700px 300px at 100% 0%, rgba(166, 58, 43, .10), transparent 60%),
    linear-gradient(145deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
}
.hero::after {
  content: "剑"; position: absolute; right: 28%; bottom: -46px;
  font-family: var(--font-serif); font-size: 190px; line-height: 1;
  color: color-mix(in srgb, var(--ink) 4%, transparent);
  pointer-events: none;
}
.hero-main { position: relative; z-index: 1; }
.hero h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(34px, 3.6vw, 48px); letter-spacing: .06em; line-height: 1.15; }
.hero .subtitle { margin: 8px 0 0; font-family: var(--font-serif); color: var(--gold); font-size: 15px; letter-spacing: .12em; }
.hero .pitch { margin: 18px 0 0; max-width: 640px; color: var(--ink-2); font-size: 13.5px; line-height: 1.9; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.stage-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); font-size: 11.5px; font-weight: 600; }
.stage-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent); }
.hero-actions { display: flex; gap: 9px; margin-top: 24px; flex-wrap: wrap; }
.hero-rings { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: center; }
.ring-card { display: grid; justify-items: center; gap: 10px; padding: 18px 10px 16px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 78%, transparent); backdrop-filter: blur(2px); }
.ring {
  width: 108px; height: 108px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ring-color, var(--accent)) var(--pct, 0deg), var(--line) 0);
  position: relative;
}
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel); }
.ring-value { position: relative; z-index: 1; text-align: center; }
.ring-value b { display: block; font-family: var(--font-serif); font-size: 22px; line-height: 1; }
.ring-value span { display: block; margin-top: 4px; font-size: 9.5px; color: var(--muted); letter-spacing: .08em; }
.ring-label { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.6; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.stat-card { position: relative; padding: 17px 18px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); overflow: hidden; }
.stat-card::after { content: ""; position: absolute; right: -22px; top: -22px; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); }
.stat-label { font-size: 10.5px; letter-spacing: .1em; color: var(--muted); }
.stat-value { margin-top: 7px; font-family: var(--font-serif); font-size: 27px; line-height: 1; letter-spacing: .02em; }
.stat-value small { margin-left: 3px; font-family: var(--font-ui); font-size: 11px; color: var(--muted); }
.stat-sub { margin-top: 8px; font-size: 10.5px; color: var(--muted); }
.stat-sub b { color: var(--ink-2); font-weight: 600; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: 18px; margin-top: 18px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { margin: 0; font-family: var(--font-serif); font-size: 18px; letter-spacing: .05em; }
.section-title span { font-size: 11px; color: var(--muted); }
.volume-progress { display: flex; flex-direction: column; gap: 13px; }
.volume-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; }
.volume-line-top { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.volume-line-top b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.volume-line-top span { font-size: 10px; color: var(--muted); white-space: nowrap; }
.volume-line .num { font-family: var(--font-serif); font-size: 12px; color: var(--muted); }
.bar { height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; grid-column: 1 / -1; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--vol-color, var(--accent)); transition: width .5s ease; }
.bar.subtle i { opacity: .45; }

.diagnosis { display: flex; flex-direction: column; gap: 9px; }
.diag-item { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-size: 12px; line-height: 1.65; }
.diag-item .lvl { flex: 0 0 auto; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; padding: 2px 5px; border-radius: 4px; height: 17px; }
.diag-item .lvl.p0 { color: #fff; background: var(--accent); }
.diag-item .lvl.p1 { color: #fff; background: var(--st-draft); }
.diag-item .lvl.p2 { color: #fff; background: var(--muted); }
.diag-item b { display: block; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.diag-item span { color: var(--muted); }

.activity { display: flex; flex-direction: column; }
.act-item { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.act-item:last-child { border-bottom: 0; }
.act-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 12%, transparent); }
.act-item b { display: block; font-size: 12.5px; font-weight: 600; }
.act-item span { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.act-item .when { font-size: 10px; color: var(--faint); letter-spacing: .04em; }

/* ---------- structure ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.volume-card { margin-bottom: 16px; overflow: hidden; }
.volume-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, color-mix(in srgb, var(--vol-color) 7%, transparent), transparent 55%); }
.vol-mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff7ea; font-family: var(--font-serif); font-size: 15px; background: var(--vol-color); box-shadow: 0 6px 14px color-mix(in srgb, var(--vol-color) 24%, transparent); }
.volume-head h3 { margin: 0; font-family: var(--font-serif); font-size: 17px; letter-spacing: .03em; }
.volume-head .meta { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.volume-stats { margin-left: auto; display: flex; gap: 18px; text-align: right; }
.volume-stats b { display: block; font-family: var(--font-serif); font-size: 16px; }
.volume-stats span { font-size: 9.5px; color: var(--muted); letter-spacing: .06em; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; padding: 14px 20px 18px; }
.chapter-chip {
  position: relative; min-height: 82px; padding: 9px 10px 8px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  text-align: left; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.chapter-chip:hover { transform: translateY(-1px); border-color: var(--line-strong); background: var(--panel-2); }
.chapter-chip.st-unplanned { border-style: dashed; background: transparent; }
.chapter-chip.st-unplanned .chip-title { color: var(--faint); }
.chapter-chip .chip-no { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); letter-spacing: .06em; }
.chapter-chip .chip-title { font-family: var(--font-serif); font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chapter-chip .chip-words { margin-top: auto; font-size: 9.5px; color: var(--muted); }
.chapter-chip .chip-dot { position: absolute; right: 8px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--st-color, var(--st-unplanned)); }
.chapter-chip .legacy-dot { position: absolute; right: 8px; bottom: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); opacity: .8; }
.chapter-chip.st-outlined { border-color: color-mix(in srgb, var(--st-outlined) 38%, var(--line)); background: var(--st-outlined-bg); }
.chapter-chip.st-draft { border-color: color-mix(in srgb, var(--st-draft) 40%, var(--line)); background: var(--st-draft-bg); }
.chapter-chip.st-revised { border-color: color-mix(in srgb, var(--st-revised) 40%, var(--line)); background: var(--st-revised-bg); }
.chapter-chip.st-finalized { border-color: color-mix(in srgb, var(--st-finalized) 44%, var(--line)); background: var(--st-finalized-bg); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.legacy-block { margin-top: 20px; }
.legacy-block summary { list-style: none; }
.legacy-block summary::-webkit-details-marker { display: none; }
.legacy-block summary::after { content: "＋"; margin-left: 4px; color: var(--muted); font-size: 12px; }
.legacy-block details[open] summary::after { content: "－"; }
.legacy-block details[open] summary { border-bottom: 1px solid var(--line); }
.legacy-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.legacy-table th { text-align: left; font-weight: 500; font-size: 10px; letter-spacing: .08em; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); }
.legacy-table td { padding: 9px 10px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.legacy-table tr:hover td { background: var(--panel-2); }
.legacy-table .t { font-family: var(--font-serif); }

/* ---------- chapter workspace ---------- */
.editor-shell { display: grid; grid-template-columns: 246px minmax(0, 1fr) 272px; gap: 14px; flex: 1; min-height: 0; }
.chapter-list-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 12.5px; letter-spacing: .06em; }
.panel-head .sub { margin-top: 3px; font-size: 10px; color: var(--muted); }
.filter-row { display: flex; gap: 6px; margin-top: 9px; }
.filter-row select { flex: 1; min-width: 0; }
.chapter-list { flex: 1; overflow-y: auto; padding: 6px; }
.chapter-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 7px; align-items: center; width: 100%; padding: 8px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; background: transparent; text-align: left; }
.chapter-row:hover { background: var(--panel-2); }
.chapter-row.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }
.chapter-row .no { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.chapter-row .t { min-width: 0; }
.chapter-row .t b { display: block; font-family: var(--font-serif); font-size: 12px; font-weight: 500; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-row .t span { display: block; margin-top: 1px; font-size: 9.5px; color: var(--muted); }
.chapter-row .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--st-color); }
.list-group { padding: 9px 10px 4px; font-size: 9.5px; letter-spacing: .12em; color: var(--faint); }

.editor-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.editor-head { padding: 15px 22px 13px; border-bottom: 1px solid var(--line); }
.editor-head-top { display: flex; align-items: center; gap: 10px; }
.chapter-kicker { font-size: 10px; letter-spacing: .12em; color: var(--gold); }
.editor-head h2 { margin: 5px 0 0; min-width: 0; }
.title-input {
  width: 100%; padding: 3px 0; border: 0; background: transparent;
  font-family: var(--font-serif); font-size: 24px; font-weight: 700; letter-spacing: .02em;
  outline: none; color: var(--ink);
}
.title-input:focus { border-bottom: 1px solid var(--accent); }
.editor-head-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.status-select { height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); font-size: 11px; }
.head-spacer { flex: 1; }
.editor-tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.tab-btn {
  position: relative; height: 41px; padding: 0 13px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 12px; letter-spacing: .03em;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); font-weight: 600; }
.tab-btn.active::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.tab-count { margin-left: 4px; font-size: 9px; color: var(--muted); }
.editor-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.prose-editor {
  flex: 1; width: 100%; min-height: 420px;
  padding: 26px 38px 40px; border: 0; outline: none; resize: none;
  background: transparent; color: var(--ink);
  font-family: var(--font-serif); font-size: 17.5px; line-height: 2.05; letter-spacing: .015em;
}
.prose-editor::placeholder { color: var(--faint); }
.editor-foot { display: flex; align-items: center; gap: 14px; padding: 9px 22px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); background: var(--panel-2); }
.editor-foot .spacer { flex: 1; }
.save-trail { color: var(--faint); }
.bp-form { padding: 22px 26px 36px; display: flex; flex-direction: column; gap: 16px; }
.bp-form .form-grid { grid-template-columns: 1fr 1fr; }
.field label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 10.5px; letter-spacing: .08em; color: var(--muted); }
.field label em { font-style: normal; color: var(--faint); font-size: 9.5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); font-size: 12.5px; outline: none;
  transition: border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.field textarea { line-height: 1.8; resize: vertical; min-height: 84px; }
.field textarea.tall { min-height: 150px; }
.field .hint { margin-top: 5px; font-size: 10px; color: var(--faint); line-height: 1.5; }
.legacy-banner { margin: 16px 22px 0; padding: 12px 14px; border: 1px dashed color-mix(in srgb, var(--gold) 45%, var(--line)); border-radius: 10px; background: color-mix(in srgb, var(--gold) 6%, transparent); font-size: 11.5px; line-height: 1.7; }
.legacy-banner b { font-family: var(--font-serif); }
.legacy-banner .row { margin-top: 8px; }

.editor-rail { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-right: 2px; }
.rail-card { padding: 15px 16px; }
.rail-title { font-size: 10px; letter-spacing: .12em; color: var(--muted); margin-bottom: 10px; }
.word-ring { width: 118px; height: 118px; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) var(--pct, 0deg), var(--line) 0); position: relative; }
.word-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--panel); }
.word-ring .inner { position: relative; z-index: 1; text-align: center; }
.word-ring .inner b { display: block; font-family: var(--font-serif); font-size: 22px; line-height: 1; }
.word-ring .inner span { display: block; margin-top: 4px; font-size: 9.5px; color: var(--muted); }
.rail-meta { display: flex; flex-direction: column; gap: 9px; font-size: 11px; }
.rail-meta .row-between { align-items: flex-start; }
.rail-meta span:first-child { color: var(--muted); }
.rail-meta b { font-weight: 500; text-align: right; }
.rail-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.rail-hook { font-family: var(--font-serif); font-size: 12px; line-height: 1.75; color: var(--ink-2); }
.rail-actions { display: flex; flex-direction: column; gap: 7px; }
.rail-actions .btn { width: 100%; }

/* focus mode */
body.focus-mode .sidebar,
body.focus-mode .topbar,
body.focus-mode .chapter-list-panel,
body.focus-mode .editor-rail { display: none; }
body.focus-mode .app { grid-template-columns: 1fr; }
body.focus-mode .editor-shell { grid-template-columns: minmax(0, 1fr); }
body.focus-mode .editor-panel { border-radius: 0; border: 0; }
body.focus-mode .page-editor { padding: 0; }
body.focus-mode .prose-editor { padding: 56px max(40px, 12vw); font-size: 18.5px; }
.focus-exit { display: none; }
body.focus-mode .focus-exit { display: inline-flex; position: fixed; right: 22px; bottom: 20px; z-index: 30; }

/* ---------- characters ---------- */
.char-groups { display: flex; flex-direction: column; gap: 24px; }
.char-faction-group { min-width: 0; }
.char-group-head { display: flex; align-items: center; gap: 10px; padding: 0 2px 11px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.char-group-head .fg-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--fac-color, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fac-color, var(--accent)) 12%, transparent); }
.char-group-head h3 { margin: 0; font-family: var(--font-serif); font-size: 18px; letter-spacing: .03em; }
.char-group-head .fg-type { font-size: 10.5px; color: var(--muted); }
.char-group-head .group-count { color: var(--muted); }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 14px; }
.char-card { position: relative; padding: 18px; cursor: pointer; transition: transform .14s ease, border-color .14s ease; }
.char-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.char-top { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(145deg, var(--panel-3), var(--panel-2)); border: 1px solid var(--line); color: var(--gold); font-family: var(--font-serif); font-size: 20px; }
.char-name { font-family: var(--font-serif); font-size: 17px; font-weight: 700; }
.char-sub { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.char-card .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.char-line { margin-top: 12px; font-size: 11.5px; line-height: 1.8; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.char-conflict { margin-top: 11px; padding: 7px 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; line-height: 1.6; }
.char-source { margin-top: 10px; font-size: 9.5px; color: var(--faint); }

/* ---------- settings ---------- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 22px; align-items: start; min-width: 0; }
.settings-toc { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 2px; padding: 10px; }
.settings-toc a { padding: 9px 10px; border-radius: 8px; font-size: 12px; color: var(--muted); }
.settings-toc a:hover { background: var(--panel-2); color: var(--ink); }
.settings-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.setting-block { overflow: hidden; min-width: 0; }
.setting-block .card-head { padding: 15px 20px; }
.setting-block .card-body { padding: 18px 20px 20px; min-width: 0; }
.setting-block h3 { font-family: var(--font-serif); font-size: 16px; letter-spacing: .03em; }
.setting-block .desc { margin: 4px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.setting-block textarea { display: block; width: 100%; max-width: 100%; box-sizing: border-box; min-height: 120px; height: auto; resize: vertical; overflow-y: hidden; font-family: var(--font-serif); font-size: 13.5px; line-height: 1.95; }
.setting-block textarea.short { min-height: 84px; font-family: var(--font-ui); font-size: 12.5px; line-height: 1.8; }
.setting-block .tools { display: flex; align-items: center; gap: 8px; }
.setting-block .count { font-size: 10px; color: var(--faint); }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.meta-grid .field { min-width: 0; }
.meta-grid .field.full { grid-column: 1 / -1; }

/* ---------- canon ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs .tab-btn { height: 38px; }
.issue-list { display: flex; flex-direction: column; gap: 9px; }
.issue-row { display: flex; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.issue-row.resolved { opacity: .55; }
.issue-lv { flex: 0 0 auto; width: 30px; height: 20px; display: grid; place-items: center; border-radius: 5px; color: #fff; font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; }
.issue-lv.p0 { background: var(--accent); }
.issue-lv.p1 { background: var(--st-draft); }
.issue-lv.p2 { background: var(--muted); }
.issue-main { min-width: 0; flex: 1; }
.issue-main b { display: block; font-size: 12.5px; }
.issue-main p { margin: 3px 0 0; font-size: 11px; color: var(--muted); line-height: 1.7; }
.issue-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.canon-list { display: flex; flex-direction: column; gap: 9px; }
.canon-item { padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.canon-head { display: flex; align-items: flex-start; gap: 10px; }
.canon-head b { font-family: var(--font-serif); font-size: 14px; font-weight: 700; }
.canon-head .spacer { flex: 1; }
.canon-desc { margin-top: 7px; font-size: 11.5px; color: var(--ink-2); line-height: 1.8; }
.canon-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; font-size: 10px; color: var(--muted); }
.canon-actions { display: flex; gap: 4px; opacity: .5; }
.canon-item:hover .canon-actions { opacity: 1; }
.canon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.summary-card { padding: 16px 18px; }
.summary-card .ch { font-family: var(--font-mono); font-size: 10px; color: var(--gold); letter-spacing: .08em; }
.summary-card h4 { margin: 5px 0 8px; font-family: var(--font-serif); font-size: 15px; }
.summary-card p { margin: 0; font-size: 11.5px; line-height: 1.85; color: var(--ink-2); }

/* ---------- progress ---------- */
.progress-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 16px; }
.chart-card { padding: 20px 22px; }
.chart-card h3 { margin: 0 0 3px; font-family: var(--font-serif); font-size: 16px; }
.chart-card .desc { margin: 0 0 16px; font-size: 10.5px; color: var(--muted); }
.bars-svg { width: 100%; height: auto; display: block; overflow: visible; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 132px; height: 132px; border-radius: 50%; background: conic-gradient(var(--segments)); position: relative; flex: 0 0 132px; }
.donut::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--panel); }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.donut-center b { font-family: var(--font-serif); font-size: 22px; }
.donut-center span { font-size: 9px; color: var(--muted); letter-spacing: .1em; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 11px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.donut-legend b { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; }
.progress-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.progress-table th { position: sticky; top: 0; z-index: 1; text-align: left; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 9.5px; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.progress-table td { padding: 8px 10px; border-bottom: 1px dashed var(--line); }
.progress-table tr:hover td { background: var(--panel-2); }
.progress-table .num { font-family: var(--font-mono); text-align: right; font-size: 10.5px; }
.table-scroll { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }

/* ---------- data page ---------- */
.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.data-card { padding: 18px 20px; }
.data-card .k { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.data-card .v { margin-top: 7px; font-family: var(--font-serif); font-size: 22px; }
.data-card .s { margin-top: 5px; font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.code-path { display: block; margin-top: 8px; padding: 8px 10px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 10px; color: var(--ink-2); word-break: break-all; }
.backup-list { display: flex; flex-direction: column; }
.backup-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 11.5px; }
.backup-row:last-child { border-bottom: 0; }
.backup-row .name { font-family: var(--font-mono); font-size: 10.5px; }
.backup-row .when { color: var(--muted); font-size: 10px; }
.backup-row .size { margin-left: auto; color: var(--muted); font-size: 10px; }

/* ---------- modal / palette / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(18, 20, 17, .48); backdrop-filter: blur(5px); animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(660px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .18s ease; }
.modal.wide { width: min(900px, 100%); }
@keyframes rise { from { transform: translateY(10px); opacity: .6; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 19px 22px 15px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-family: var(--font-serif); font-size: 19px; letter-spacing: .03em; }
.modal-head .sub { margin: 4px 0 0; font-size: 10.5px; color: var(--muted); }
.modal-close { margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); }
.modal-close:hover { color: var(--ink); background: var(--panel-2); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--panel-2); }
.modal-foot .left { margin-right: auto; font-size: 10.5px; color: var(--muted); }
.modal-foot .left .btn { margin-right: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-grid .field textarea { min-height: 78px; }
.form-grid .field textarea.tall { min-height: 130px; }
.preview-box { font-family: var(--font-serif); font-size: 13.5px; line-height: 1.95; color: var(--ink-2); }
.preview-box h1, .preview-box h2, .preview-box h3, .preview-box h4 { font-family: var(--font-serif); color: var(--ink); line-height: 1.35; }
.preview-box h1 { font-size: 24px; margin: 22px 0 10px; }
.preview-box h2 { font-size: 20px; margin: 20px 0 9px; }
.preview-box h3 { font-size: 16px; margin: 16px 0 7px; }
.preview-box p { margin: 0 0 10px; }
.preview-box ul, .preview-box ol { margin: 0 0 12px; padding-left: 22px; }
.preview-box li { margin: 3px 0; }
.preview-box blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--gold); background: var(--panel-2); color: var(--muted); }
.preview-box table { width: 100%; border-collapse: collapse; margin: 12px 0; font-family: var(--font-ui); font-size: 11.5px; }
.preview-box th, .preview-box td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.preview-box th { background: var(--panel-2); }
.preview-box code { padding: 1px 4px; border-radius: 3px; background: var(--panel-3); font-family: var(--font-mono); font-size: 11px; }
.preview-box hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.detail-pre { margin: 0; padding: 14px 16px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-family: var(--font-serif); font-size: 12.5px; line-height: 1.9; white-space: pre-wrap; max-height: 48vh; overflow: auto; }

.palette-overlay { position: fixed; inset: 0; z-index: 3100; display: flex; justify-content: center; align-items: flex-start; padding: 11vh 20px 20px; background: rgba(18, 20, 17, .42); backdrop-filter: blur(4px); }
.palette { width: min(700px, 100%); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 15px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .16s ease; }
.palette-input-wrap { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.palette-input-wrap svg { color: var(--muted); }
.palette-input { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; }
.palette-results { max-height: 56vh; overflow-y: auto; padding: 7px; }
.palette-result { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.palette-result:hover, .palette-result.active { background: var(--panel-2); }
.palette-result .icon { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 7px; display: grid; place-items: center; background: var(--panel-3); color: var(--gold); font-size: 11px; }
.palette-result .body { min-width: 0; flex: 1; }
.palette-result b { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-result span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-result .type { margin-left: auto; font-size: 9.5px; color: var(--faint); }
.palette-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 12px; }
.palette-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--panel-2); font-size: 9.5px; color: var(--faint); }

.toast-root { position: fixed; right: 22px; bottom: 20px; z-index: 4000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { min-width: 180px; max-width: 360px; padding: 11px 15px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 12px; line-height: 1.6; animation: toast-in .18s ease; }
.toast.error { background: var(--accent); color: #fff3e7; }
.toast.ok { background: #2f5d46; color: #eef8ee; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- factions ---------- */
.filter-select { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink-2); font-size: 12px; outline: none; }
.faction-overview { margin-bottom: 2px; }
.camp-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.camp-group { display: grid; grid-template-columns: minmax(70px, auto) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); text-align: left; transition: border-color .15s ease, background .15s ease; }
.camp-group:hover { border-color: var(--line-strong); background: var(--panel); }
.camp-group.active { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.camp-name { font-family: var(--font-serif); font-size: 13px; font-weight: 700; white-space: nowrap; }
.camp-members { display: flex; flex-wrap: wrap; gap: 4px 7px; min-width: 0; }
.camp-members span { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.camp-count { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.axis-list { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.axis-label { font-size: 10px; letter-spacing: .1em; color: var(--muted); margin-right: 4px; }
.axis-item { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); font-size: 10.5px; color: var(--ink-2); }
.axis-item b { font-weight: 600; white-space: nowrap; }
.axis-item i { font-style: normal; color: var(--accent); font-size: 10px; }
.axis-item em { font-style: normal; color: var(--muted); border-left: 1px solid var(--line); padding-left: 6px; margin-left: 2px; }
.faction-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.faction-card { position: relative; padding: 18px 18px 16px 20px; border-left: 3px solid var(--fac-color, var(--line-strong)); cursor: pointer; transition: transform .14s ease, border-color .14s ease; overflow: hidden; }
.faction-card:hover { transform: translateY(-2px); border-color: var(--line-strong); border-left-color: var(--fac-color); }
.faction-top { display: flex; align-items: flex-start; gap: 11px; }
.faction-mark { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--fac-color) 35%, var(--line)); background: color-mix(in srgb, var(--fac-color) 10%, var(--panel)); color: var(--fac-color); font-family: var(--font-serif); font-size: 19px; font-weight: 700; }
.faction-name { font-family: var(--font-serif); font-size: 17px; font-weight: 700; line-height: 1.3; }
.faction-alias { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.faction-meta { margin-top: 11px; font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.faction-summary { margin: 9px 0 0; font-size: 11.5px; line-height: 1.8; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.faction-line { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.faction-line .fl { flex: 0 0 28px; padding-top: 3px; font-size: 9.5px; letter-spacing: .08em; color: var(--faint); }
.faction-line .fl-body { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ch-link { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); color: var(--ink-2); font-size: 10px; line-height: 1.5; }
.ch-link:hover { border-color: var(--accent); color: var(--accent); }
.faction-plan { margin-top: 9px; padding-left: 36px; font-size: 10.5px; line-height: 1.65; color: var(--muted); }
.faction-relations { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line); }
.rel-chip { display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--ink-2); font-size: 10px; line-height: 1.5; }
.rel-chip:hover { border-color: var(--fac-color); }
.rel-chip em { font-style: normal; color: var(--muted); font-size: 9.5px; }
.camp-group:focus-visible, .ch-link:focus-visible, .rel-chip:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .editor-shell { grid-template-columns: 220px minmax(0, 1fr) 246px; }
  .hero { grid-template-columns: minmax(0, 1.25fr) minmax(280px, .9fr); }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 214px; }
  .editor-shell { grid-template-columns: 206px minmax(0, 1fr); }
  .editor-rail { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .progress-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-rings { grid-template-columns: 1fr 1fr; max-width: 360px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .search-trigger span { display: none; }
  .search-trigger kbd { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-grid; }
  .page { padding: 20px 16px 60px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .chapter-grid { grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); }
  .faction-grid { grid-template-columns: 1fr; }
  .camp-groups { grid-template-columns: 1fr; }
  .editor-shell { grid-template-columns: 1fr; }
  .chapter-list-panel { display: none; }
  .page-editor { padding: 12px; height: auto; min-height: 100%; }
  .view-editor { overflow-y: auto; }
  .editor-panel { min-height: 78vh; }
  .prose-editor { padding: 20px 18px 32px; font-size: 16.5px; }
  .title-input { font-size: 19px; }
  .form-grid, .meta-grid, .bp-form .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 32px; }
  .volume-stats { display: none; }
  .topbar { padding: 0 14px; }
  .save-indicator { display: none; }
  .crumbs { font-size: 12px; }
  .search-trigger { width: 34px; padding: 0; justify-content: center; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .hero-rings { grid-template-columns: 1fr; }
  .ring-card { grid-template-columns: 108px 1fr; justify-items: start; }
  .ring-label { text-align: left; }
  .chapter-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .chapter-chip { min-height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 势力分布图 ---------- */
.map-page .page-head { margin-bottom: 14px; }
.map-head-actions { flex-wrap: wrap; gap: 7px; }
.map-shell { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 14px; align-items: stretch; }
.map-side { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 600px; box-shadow: var(--shadow-sm); }
.map-side-head { padding: 13px 13px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), var(--panel-2)); }
.map-side-head input { width: 100%; height: 35px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font-size: 12px; outline: none; }
.map-side-head input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.map-tabs { display: flex; gap: 5px; margin-top: 9px; }
.map-tabs button { flex: 1; border: 1px solid transparent; background: transparent; color: var(--muted); font-family: var(--font-serif); font-size: 12.5px; padding: 7px 8px; border-radius: 8px; cursor: pointer; letter-spacing: .04em; }
.map-tabs button span { font-family: var(--font-sans); font-size: 10px; color: var(--muted); margin-left: 3px; }
.map-tabs button.active { background: var(--panel-3); color: var(--ink); border-color: var(--line); }
.map-list { flex: 1; overflow: auto; padding: 10px 9px 8px; }
.map-list-group { margin-bottom: 13px; }
.map-list-group-title { display: flex; justify-content: space-between; padding: 0 6px 6px; color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.map-list-group-title span { letter-spacing: 0; }
.map-list-item { width: 100%; display: flex; align-items: center; gap: 9px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 8px 7px; color: var(--ink); cursor: pointer; transition: background .14s, border-color .14s; }
.map-list-item:hover { background: var(--panel-2); }
.map-list-item.selected { background: var(--accent-soft); border-color: rgba(166,58,43,.2); }
.map-list-dot { width: 11px; height: 11px; flex: 0 0 11px; border-radius: 50%; background: var(--pin); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 16%, transparent); }
.map-list-glyph { width: 21px; height: 21px; flex: 0 0 21px; display: grid; place-items: center; border-radius: 50%; background: var(--pin); color: #f4ead8; font-family: var(--font-serif); font-size: 11px; }
.map-list-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.map-list-row { display: flex; align-items: center; gap: 3px; }
.map-list-row .map-list-item { flex: 1; min-width: 0; }
.map-list-del { flex: 0 0 24px; width: 24px; height: 24px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--faint); font-size: 15px; line-height: 1; cursor: pointer; }
.map-list-del:hover { color: var(--accent); background: var(--accent-soft); border-color: rgba(166,58,43,.2); }
.map-list-main b { font-family: var(--font-serif); font-size: 13px; font-weight: 600; }
.map-list-main small { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-empty { padding: 24px 10px; text-align: center; color: var(--muted); font-size: 12px; }
.map-detail { border-top: 1px solid var(--line); background: linear-gradient(180deg, var(--panel-2), var(--panel)); padding: 13px 14px 14px; max-height: 44%; overflow: auto; }
.map-detail-empty { color: var(--muted); font-size: 12px; line-height: 1.75; text-align: center; padding: 12px 6px; }
.map-seal { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 50%; font-family: var(--font-serif); color: var(--accent); margin-bottom: 5px; }
.map-detail-head { display: flex; align-items: flex-start; gap: 8px; }
.map-detail-head > div { min-width: 0; flex: 1; }
.map-detail-head h2 { margin: 1px 0 3px; font-family: var(--font-serif); font-size: 21px; letter-spacing: .04em; }
.map-detail-head .sub { margin: 0; font-size: 10.5px; }
.map-detail-close { border: 0; background: transparent; color: var(--muted); font-size: 21px; line-height: 1; cursor: pointer; padding: 0 2px; }
.map-detail-desc { font-size: 12px; line-height: 1.85; color: var(--ink-2); margin: 10px 0; }
.map-detail-chars { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 10px; color: var(--muted); margin: 8px 0; }
.map-detail-chars em { font-style: normal; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); padding: 2px 6px; border-radius: 4px; font-size: 10.5px; }
.map-coord-box { display: flex; align-items: center; gap: 5px; margin: 10px 0; padding: 7px; border: 1px dashed var(--line-strong); border-radius: 8px; background: color-mix(in srgb, var(--panel-2) 65%, transparent); }
.map-coord-box label { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.map-coord-box input { width: 53px; height: 25px; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); font-size: 10.5px; }
.map-coord-box .btn { margin-left: auto; }
.map-detail-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.map-detail-note { margin: 9px 0 0; font-size: 10px; line-height: 1.6; color: var(--muted); }
.map-stage { position: relative; z-index: 0; isolation: isolate; min-width: 0; height: calc(100vh - 220px); min-height: 600px; border: 1px solid var(--line-strong); border-radius: 15px; overflow: hidden; background: #dfd2b8; box-shadow: var(--shadow-sm); }
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-canvas .leaflet-container, .leaflet-container { background: #dfd2b8; font-family: var(--font-sans); }
.ancient-map-image { image-rendering: auto; opacity: .68; }
.map-controls { position: absolute; top: 13px; left: 13px; z-index: 600; display: flex; flex-direction: column; gap: 5px; }
.map-controls button { width: 32px; height: 32px; border: 1px solid #b7a78c; border-radius: 7px; background: rgba(245,236,218,.9); color: #4f4434; font-size: 17px; line-height: 1; cursor: pointer; box-shadow: 0 3px 10px rgba(60,44,25,.13); }
.map-controls button:hover { background: #fff8e9; }
.map-legend { position: absolute; left: 13px; bottom: 13px; z-index: 600; display: flex; flex-wrap: wrap; gap: 3px; max-width: 390px; padding: 7px 9px; border: 1px solid rgba(120,97,67,.35); border-radius: 9px; background: rgba(239,229,208,.9); backdrop-filter: blur(3px); box-shadow: 0 4px 14px rgba(60,44,25,.13); }
.map-legend-title { width: 100%; font-family: var(--font-serif); font-size: 10px; color: #6e5c44; letter-spacing: .16em; margin: 0 0 3px 2px; }
.map-legend-item { display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent; background: transparent; color: #655743; font-size: 10px; padding: 2px 5px; border-radius: 5px; cursor: pointer; opacity: .42; }
.map-legend-item.active { opacity: 1; background: rgba(255,250,237,.5); border-color: rgba(120,97,67,.2); }
.lg-glyph { width: 15px; height: 15px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--pin); color: #f7edd9; font-family: var(--font-serif); font-size: 8px; }
.map-status { position: absolute; right: 13px; bottom: 13px; z-index: 600; max-width: 46%; padding: 5px 9px; border-radius: 6px; background: rgba(239,229,208,.82); color: #6d5b43; font-size: 9.5px; line-height: 1.5; pointer-events: none; }
.map-fallback { display: grid; place-items: center; height: 100%; color: #6d5b43; font-family: var(--font-serif); background: #e6d8ba; }
.map-div-icon { width: 0 !important; height: 0 !important; background: transparent !important; border: 0 !important; }
.map-faction-pin, .map-feature-pin { position: absolute; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; filter: drop-shadow(0 2px 3px rgba(57,41,23,.22)); }
.map-faction-pin .pin-seal { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50% 50% 50% 5px; background: var(--pin); color: #fff3dc; border: 1.5px solid rgba(255,244,220,.75); font-family: var(--font-serif); font-size: 12px; font-weight: 700; }
.map-faction-pin .pin-name, .map-feature-pin .pin-name { font-family: var(--font-serif); font-size: 11px; color: #43382a; background: rgba(246,237,218,.9); border: 1px solid rgba(106,84,56,.3); border-radius: 3px; padding: 1px 4px; letter-spacing: .02em; }
.map-faction-pin.selected .pin-seal { outline: 2px solid #a63a2b; outline-offset: 2px; }
.map-faction-pin.selected .pin-name { color: #7b2d23; border-color: #a63a2b; }
.map-feature-pin { transform: translate(-50%, -50%); }
.map-feature-pin .pin-glyph { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: var(--pin); color: #fff2dc; border: 1px solid rgba(255,244,220,.72); font-family: var(--font-serif); font-size: 9px; }
.map-feature-pin .pin-name { font-size: 9.5px; color: #645139; background: rgba(246,237,218,.72); border-color: rgba(106,84,56,.2); }
.map-feature-pin.major .pin-glyph { width: 23px; height: 23px; font-size: 10px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 16%, transparent); }
.map-feature-pin.selected .pin-glyph { outline: 2px solid #a63a2b; outline-offset: 2px; }
.map-zoom-far .map-feature-pin:not(.major) .pin-name { display: none; }
.map-zoom-far .map-faction-pin .pin-name { font-size: 10px; }
.map-editing .map-faction-pin, .map-editing .map-feature-pin { cursor: grab; }
.map-editing .map-faction-pin:active, .map-editing .map-feature-pin:active { cursor: grabbing; }
.map-tooltip { font-family: var(--font-sans) !important; font-size: 10.5px !important; color: #443829 !important; background: rgba(246,237,218,.96) !important; border: 1px solid #b7a78c !important; border-radius: 5px !important; box-shadow: 0 3px 10px rgba(60,44,25,.14) !important; padding: 3px 7px !important; }
.map-tooltip::before { border-top-color: #b7a78c !important; }
.leaflet-container a { color: inherit; }
.leaflet-control-zoom, .leaflet-control-attribution { display: none; }
.map-modal-hint { margin: 9px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.7; }
#map-edit-btn.active-edit { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
@media (max-width: 1050px) {
  .map-shell { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .map-shell { display: flex; flex-direction: column; }
  .map-side { height: auto; min-height: 0; max-height: 46vh; }
  .map-list { max-height: 210px; }
  .map-stage { height: 62vh; min-height: 420px; }
  .map-legend { max-width: 270px; }
  .map-status { display: none; }
}

/* ---------- 地图编辑模式 ---------- */
.map-editbar { position: absolute; top: 13px; right: 13px; z-index: 700; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px; max-width: calc(100% - 80px); padding: 6px 7px; border: 1px solid rgba(120, 97, 67, .42); border-radius: 9px; background: rgba(239, 229, 208, .94); backdrop-filter: blur(3px); box-shadow: 0 4px 14px rgba(60, 44, 25, .16); }
.map-editbar[hidden] { display: none; }
.map-edit-mode { display: flex; gap: 2px; padding: 2px; border: 1px solid rgba(120,97,67,.25); border-radius: 6px; background: rgba(255,249,236,.38); }
.map-edit-mode button { border: 0; border-radius: 4px; background: transparent; color: #735f45; font-size: 9.5px; padding: 4px 7px; cursor: pointer; }
.map-edit-mode button.active { background: #a63a2b; color: #fff4df; }
.map-hex-tools[hidden], .map-texture-tools[hidden], .map-editbar button[hidden] { display: none; }
.map-editlabel { font-family: var(--font-serif); font-size: 10.5px; color: #6d5138; letter-spacing: .08em; margin: 0 3px 0 2px; }
.map-editbar button { border: 1px solid rgba(120, 97, 67, .32); border-radius: 6px; background: rgba(255, 249, 236, .55); color: #5b4a37; font-size: 10.5px; padding: 5px 7px; cursor: pointer; }
.map-editbar button:hover { background: #fff8e9; }
.map-editbar button.danger { color: #8c3026; border-color: rgba(140, 48, 38, .32); }
.map-edithint { color: #7b664b; font-size: 9.5px; margin-left: 4px; }
.map-editing .map-faction-pin .pin-seal, .map-editing .map-feature-pin .pin-glyph { outline: 2px dashed rgba(166, 58, 43, .72); outline-offset: 3px; }
.map-editing .map-faction-pin:hover .pin-seal, .map-editing .map-feature-pin:hover .pin-glyph { outline-style: solid; }
.map-inline-edit { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin: 8px 0; padding: 7px; border: 1px dashed var(--line-strong); border-radius: 8px; background: color-mix(in srgb, var(--panel-2) 65%, transparent); }
.map-inline-edit label { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.map-inline-edit select, .map-inline-edit input { height: 26px; max-width: 155px; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); font-size: 10.5px; }
@media (max-width: 900px) { .map-edithint { display: none; } .map-editbar { max-width: calc(100% - 90px); flex-wrap: wrap; justify-content: flex-end; } }

/* ---------- 六边形疆域 ---------- */
.hex-layer-image { pointer-events: none; }
.hex-hover, .hex-selected { pointer-events: none; }
.map-hex-tools { display: flex; align-items: center; gap: 5px; padding: 0 4px; border-left: 1px solid rgba(120,97,67,.25); border-right: 1px solid rgba(120,97,67,.25); }
.map-hex-tools label { display: flex; align-items: center; gap: 3px; font-size: 9.5px; color: #735f45; white-space: nowrap; }
.map-hex-tools select { height: 25px; max-width: 118px; border: 1px solid rgba(120,97,67,.32); border-radius: 5px; background: rgba(255,249,236,.65); color: #5b4a37; font-size: 9.5px; padding: 0 3px; }
.map-hex-tools select:disabled { opacity: .42; }
@media (max-width: 900px) { .map-hex-tools { border: 0; padding: 0; width: 100%; order: 3; justify-content: flex-end; } }

/* ---------- 背景纹理 ---------- */
.map-texture-icon { width: 0 !important; height: 0 !important; background: transparent !important; border: 0 !important; }
.map-texture { position: absolute; width: 190px; height: 110px; transform: translate(-50%, -50%) scale(calc(var(--tex-scale, 1) * var(--tex-zoom, 1))) rotate(var(--tex-rot, 0deg)); transform-origin: center; opacity: var(--tex-opacity, .4); pointer-events: none; }
.map-texture svg { display: block; width: 100%; height: 100%; overflow: visible; }
.texture-editing .map-texture { pointer-events: auto; cursor: grab; }
.texture-editing .map-texture:active { cursor: grabbing; }
.map-texture.selected { filter: drop-shadow(0 0 5px rgba(166,58,43,.85)); }
.map-texture-tools { display: flex; align-items: center; gap: 4px; padding: 0 4px; border-left: 1px solid rgba(120,97,67,.25); border-right: 1px solid rgba(120,97,67,.25); }
.map-texture-tools label { display: flex; align-items: center; gap: 3px; font-size: 9.5px; color: #735f45; white-space: nowrap; }
.map-texture-tools select { height: 25px; max-width: 82px; border: 1px solid rgba(120,97,67,.32); border-radius: 5px; background: rgba(255,249,236,.65); color: #5b4a37; font-size: 9.5px; padding: 0 3px; }
.map-texture-tools button { border: 1px solid rgba(120,97,67,.32); border-radius: 6px; background: rgba(255,249,236,.55); color: #5b4a37; font-size: 10.5px; padding: 5px 7px; cursor: pointer; }
.map-texture-tools button:hover { background: #fff8e9; }
@media (max-width: 900px) { .map-texture-tools { border: 0; padding: 0; width: 100%; order: 3; justify-content: flex-end; } }
