/* ==================================================================
   暗室 — 视觉系统
   ------------------------------------------------------------------
   灰、黑、红。一盏安全灯，一层胶片颗粒，一种仿宋。
   内页安静为主；动效强度统一由 --motion 控制（0 关 / 1 默认 / 2 强）。
   ================================================================== */

:root {
  --bg: #0c0c0d;
  --bg-2: #121213;
  --bg-3: #18181a;
  --ln: #252527;
  --ln2: #1c1c1e;
  --tx: #dcd8d3;
  --dim: #a8a39e;
  --mut: #6f6b67;
  --faint: #4e4b48;
  --red: #c41e1e;
  --red2: #8e1414;
  --red-ink: #1e0e0e;
  --red-tx: #f0d6d2;
  --red-soft: rgba(196, 30, 30, 0.18);

  /* app.js 里以 inline style 引用，名字不可改 */
  --text: var(--tx);
  --ok: #8fa89a;
  --warn: #c9a46a;
  --danger: var(--red);
  --line: var(--ln);
  --line-soft: var(--ln2);

  --serif: "Zhuque Fangsong (technical preview)", "STFangsong", "FangSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --topbar: 64px;
  --tabbar: 64px;
  --gutter: 48px;
  --motion: 1;
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion: 0; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, .selectable { -webkit-user-select: text; user-select: text; }
::selection { background: rgba(196, 30, 30, 0.35); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2c; border: 2px solid var(--bg); }

.hidden { display: none !important; }
[hidden] { display: none !important; }

:focus-visible { outline: 1px solid var(--red); outline-offset: 3px; }

button { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- */
/* 氛围：安全灯 + 颗粒                                              */
/* ---------------------------------------------------------------- */

.safelight {
  position: fixed;
  --lx: 88vw;
  --ly: 4vh;
  left: calc(var(--lx) - 30vw);
  top: calc(var(--ly) - 27vh);
  width: 60vw;
  height: 54vh;
  border-radius: 50%;
  background: rgba(196, 30, 30, 0.13);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: safelight calc(7s / max(var(--motion), 0.01)) ease-in-out infinite;
}
@keyframes safelight { 0%, 100% { opacity: 0.65; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .safelight { animation: none; } }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

#app { position: relative; z-index: 1; }

/* 内页的背景层次：极淡的斜纹暗纹 + 四周压暗（只在解锁后出现，从不移动） */
.weave, .vignette { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 0.8s; }
.weave {
  background-image: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 7px),
                    repeating-linear-gradient(25deg, rgba(255, 255, 255, 0.008) 0 1px, transparent 1px 11px);
}
.vignette { background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55) 100%); }
body.unlocked .weave { opacity: 0.6; }
body.unlocked .vignette { opacity: 1; }

/* 显影：从暗红、模糊里浮出到本来的颜色。to 帧留空 = 元素自己的值；只动颜色、透明度、模糊 */
[data-dev] {
  animation: develop calc(1.1s * var(--motion)) cubic-bezier(.25, .6, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms * var(--motion));
}
@keyframes develop {
  0% { opacity: 0; color: #4a0d0d; filter: blur(7px); }
  35% { opacity: 0.9; color: #7a1616; filter: blur(2px); }
}
/* 自带颜色的子元素跟随同一节奏；延迟用继承下来的 --i，而不是 inherit（中间隔着普通 span 会拿到 0） */
[data-dev] .v, [data-dev] .n, [data-dev] .no, [data-dev] .role, [data-dev] em {
  animation: devColor calc(1.1s * var(--motion)) cubic-bezier(.25, .6, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms * var(--motion));
}
@keyframes devColor { 0% { color: #4a0d0d; text-decoration-color: transparent; } 35% { color: #7a1616; } }

/* 改值获批：旧值散开、新值显影 */
.v { position: relative; }
.v .gone { position: absolute; left: 3px; top: 0; white-space: nowrap; color: var(--mut); pointer-events: none; animation: dissolve calc(1.1s * var(--motion)) ease-out forwards; }
@keyframes dissolve { to { opacity: 0; filter: blur(7px); letter-spacing: 0.5em; transform: translateY(-6px); } }
.v .new { animation: devColor calc(1.4s * var(--motion)) cubic-bezier(.25, .6, .2, 1) both; }

/* 契约页右上角一小片墨：进入时晕开，然后静止（柔、淡，不能像血迹） */
.page-ink { position: absolute; top: -70px; right: -220px; width: 620px; height: 420px; pointer-events: none; z-index: -1; opacity: 0.4; transform-origin: 70% 30%; }
.page-ink.bloom { animation: bloom calc(2.6s * var(--motion)) cubic-bezier(.2, .7, .1, 1) both; }
@keyframes bloom { 0% { opacity: 0; transform: scale(0.3); } 35% { opacity: 0.55; } 100% { opacity: 0.4; transform: scale(1); } }

/* ---------------------------------------------------------------- */
/* 坠墨：开场时满屏，结束后暗下去，留在登录页背后                    */
/* ---------------------------------------------------------------- */

.ink-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.42;
  transition: opacity calc(1.6s * var(--motion)) ease;
}
body.opening .ink-layer { opacity: 1; }
body.unlocked .ink-layer { display: none; }

body.opening .safelight { opacity: 0; }

.auth { transition: opacity calc(0.9s * var(--motion)) ease calc(0.35s * var(--motion)), transform calc(1.1s * var(--motion)) cubic-bezier(.2, .7, .2, 1) calc(0.35s * var(--motion)); }
body.opening .auth { opacity: 0; transform: translateY(14px); pointer-events: none; transition: none; }

.skip-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 2;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.4em;
  color: rgba(220, 216, 211, 0.18);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
}
body.opening .skip-hint { opacity: 1; transition-delay: 2.2s; }

/* ---------------------------------------------------------------- */
/* 字体积木                                                          */
/* ---------------------------------------------------------------- */

.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); letter-spacing: 0.08em; }

.kick {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--mut);
}

.title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 52px;
  line-height: 1.12;
  letter-spacing: 0.1em;
  color: var(--tx);
  margin: 14px 0 30px;
  -webkit-text-stroke: 0.6px currentColor; /* 仿宋只有一个字重，标题略加描边增重 */
}
.title em { font-style: normal; color: var(--red); -webkit-text-stroke: 0; }

.tiny { font-size: 11px; color: var(--mut); }
.err { color: #e05a4e; font-size: 12px; margin: 10px 0 0; }

.role {
  font-style: normal;
  font-size: 0.92em;
  letter-spacing: 0.12em;
  margin-right: 0.5em;
}
.role-top { color: var(--red); }
.role-bottom { color: #cfcac4; }

/* ---------------------------------------------------------------- */
/* 控件                                                              */
/* ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.25em;
  padding: 8px 18px;
  min-height: 36px;
  border: 1px solid var(--ln);
  background: transparent;
  color: var(--tx);
  cursor: pointer;
  border-radius: 0;
  transition: border-color 0.3s, color 0.3s, background 0.3s;
  white-space: nowrap;
}
.btn:hover { border-color: #4a4848; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.red, .btn.primary { border-color: var(--red2); background: var(--red-ink); color: var(--red-tx); }
.btn.red:hover, .btn.primary:hover { border-color: var(--red); }
.btn.danger { color: #e05a4e; }
.btn.danger:hover { border-color: var(--red2); }
.btn.ghost { border-color: transparent; color: var(--mut); }
.btn.ghost:hover { color: var(--tx); }
.btn.sm { min-height: 30px; padding: 5px 14px; font-size: 11px; }
.btn.block { display: flex; width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  background: none;
  color: var(--mut);
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
}
.icon-btn:hover { color: var(--tx); border-color: var(--ln); }

.link { background: none; border: none; padding: 0; color: var(--dim); cursor: pointer; font-size: 12px; letter-spacing: 0.08em; }
.link:hover { color: var(--tx); }

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border: 1px solid var(--red2);
  color: #e05a4e;
  letter-spacing: 0.15em;
}

label { display: block; font-size: 11px; letter-spacing: 0.18em; color: var(--mut); margin: 0 0 16px; }

input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 8px;
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--tx);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ln);
  border-radius: 0;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.3s;
}
input:focus, textarea:focus, select:focus { border-bottom-color: var(--red); }
input::placeholder, textarea::placeholder { color: #444140; }
select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 18px;
  background: linear-gradient(45deg, transparent 50%, var(--mut) 50%) right 6px center / 5px 5px no-repeat,
              linear-gradient(-45deg, transparent 50%, var(--mut) 50%) right 2px center / 5px 5px no-repeat; }
select option { background: var(--bg-3); color: var(--tx); }
textarea { resize: vertical; line-height: 1.9; }

.check { display: flex; gap: 10px; align-items: flex-start; letter-spacing: 0.04em; font-size: 12px; color: var(--dim); cursor: pointer; }
.check input { width: 14px; height: 14px; margin: 3px 0 0; flex: none; accent-color: var(--red); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- */
/* 屏幕                                                              */
/* ---------------------------------------------------------------- */

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
}

.boot { color: var(--mut); font-size: 11px; letter-spacing: 0.3em; }

/* 初始化 / 解锁 */
.auth { width: 100%; max-width: 440px; }
.auth.wide { max-width: 760px; }
.auth-head { margin-bottom: 36px; }
.auth-head .title { font-size: 44px; margin: 12px 0 16px; }
.lede { color: var(--dim); font-size: 13px; line-height: 2; margin: 0; max-width: 36em; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 28px; }
.member-field { border: none; padding: 0; margin: 0; min-width: 0; }
.member-field legend { font-family: var(--serif); font-size: 20px; padding: 0; margin-bottom: 18px; }
.meter { height: 1px; background: var(--ln2); }
.meter i { display: block; height: 100%; width: 0; transition: width 0.3s; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.check + .btn, .grid-2 + .check { margin-top: 8px; }
#reg-submit { margin-top: 28px; }

/* 注册：两个位置 + 选角色 */
.reg-slots { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ln2); margin-bottom: 32px; }
.slot { display: flex; align-items: baseline; gap: 6px; padding: 14px 4px; border-bottom: 1px solid var(--ln2); min-width: 0; }
.slot + .slot { border-left: 1px solid var(--ln2); padding-left: 14px; }
.slot-name { font-family: var(--serif); font-size: 17px; letter-spacing: 0.1em; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.slot-st { margin-left: auto; font-size: 11px; letter-spacing: 0.15em; color: var(--faint); flex: none; }
.slot[data-state="registered"] .slot-st { color: var(--dim); }
.slot[data-state="confirmed"] .slot-st { color: var(--red-tx); }

.role-pick { display: flex; gap: 28px; margin: 0 0 22px; }
.role-opt { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-family: var(--serif); font-size: 18px; letter-spacing: 0.12em; }
.role-opt input { width: 14px; height: 14px; margin: 0; padding: 0; accent-color: var(--red); color-scheme: dark; }
.role-opt.taken { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }

/* 等待对方 / 确认码 */
.wait-status { border-top: 1px solid var(--ln2); margin-bottom: 32px; }
.wait-row { display: flex; align-items: baseline; gap: 10px; padding: 16px 4px; border-bottom: 1px solid var(--ln2); }
.wait-row .who { font-family: var(--serif); font-size: 19px; letter-spacing: 0.1em; color: var(--tx); min-width: 0; overflow-wrap: anywhere; }
.wait-row .st { margin-left: auto; font-size: 11px; letter-spacing: 0.15em; color: var(--mut); flex: none; }
.wait-code-box { margin-bottom: 8px; }
.wait-code { font-family: var(--mono); font-size: 26px; letter-spacing: 0.18em; line-height: 1.6; color: var(--red-tx);
  border: 1px solid var(--red2); padding: 18px 20px; margin: 10px 0 0; word-spacing: 0.3em; }
.wait-actions { margin-top: 22px; }
.hint { font-size: 11px; color: var(--mut); line-height: 1.9; margin: 18px 0 0; }
.hint strong { color: var(--dim); font-weight: 500; }

.setup-progress { margin-top: 18px; font-size: 11px; color: var(--mut); letter-spacing: 0.15em; }
.setup-progress i { display: block; height: 1px; margin-bottom: 10px; background: linear-gradient(90deg, transparent, var(--red), transparent); background-size: 200% 100%; animation: sweep 1.2s linear infinite; }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.member-picker { display: grid; border-top: 1px solid var(--ln2); }
.member-choice {
  display: flex;
  align-items: baseline;
  gap: 4px;
  width: 100%;
  padding: 20px 4px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--ln2);
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: padding 0.35s;
}
.member-choice .name { font-family: var(--serif); font-size: 22px; letter-spacing: 0.12em; color: var(--tx); }
.member-choice .hint-r { margin-left: auto; font-size: 11px; color: var(--faint); letter-spacing: 0.15em; transition: color 0.3s; }
.member-choice::before { content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 0; background: var(--red); transition: width 0.5s; }
.member-choice:hover { padding-left: 12px; }
.member-choice:hover::before { width: 100%; }
.member-choice:hover .hint-r { color: var(--dim); }

.login-form { margin-top: 8px; }
.login-form .row { margin-top: 24px; }
.auth-foot { margin-top: 40px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.auth-foot .sep { color: var(--faint); }

/* ---------------------------------------------------------------- */
/* 内页框架                                                          */
/* ---------------------------------------------------------------- */

#screen-vault { display: block; padding: 0; align-items: stretch; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--ln2);
  background: rgba(12, 12, 13, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar .logo { font-family: var(--serif); font-size: 20px; letter-spacing: 0.5em; color: var(--tx); }
.nav { margin: 0 auto; display: flex; gap: 40px; position: relative; }
.nav button {
  position: relative;
  background: none;
  border: none;
  padding: 6px 0;
  font-size: 13px;
  letter-spacing: 0.4em;
  color: var(--mut);
  cursor: pointer;
  transition: color 0.3s;
}
.nav button:hover { color: var(--tx); }
.nav button.active { color: var(--tx); }
.nav-ink {
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 4px;
  border-radius: 4px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  pointer-events: none;
  transition: transform calc(0.55s * var(--motion)) cubic-bezier(.6, 0, .2, 1);
}
.nav-ink.flow { animation: inkflow calc(0.55s * var(--motion)) cubic-bezier(.6, 0, .2, 1); }
@keyframes inkflow { 45% { width: 26px; margin-left: -11px; filter: blur(0.6px); } }
.nav .badge { position: absolute; top: -2px; right: -2px; font: 500 9px/1 var(--mono); color: var(--red); letter-spacing: 0; }
.topbar .me { display: flex; align-items: center; gap: 2px; font-size: 12px; color: var(--mut); letter-spacing: 0.1em; white-space: nowrap; }
.topbar .me #who-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; margin-right: 10px; }

.content { position: relative; min-height: calc(100dvh - var(--topbar)); }

/* 杂志式版心：左目录 + 右正文（各视图复用） */
.page { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100dvh - var(--topbar)); }
.page.solo { grid-template-columns: minmax(0, 1fr); }
.index { border-right: 1px solid var(--ln2); padding: 48px 40px; }
.sheet { position: relative; padding: 52px 80px 96px; min-width: 0; overflow-wrap: anywhere; overflow-x: clip; }
.sheet .actions { position: absolute; right: 80px; top: 48px; display: flex; gap: 10px; }

.chips { display: none; }
.fab { display: none; }

/* 左目录 / 手机标签 */
.idx-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: baseline;
  width: 100%;
  padding: 14px 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--ln2);
  text-align: left;
  color: var(--mut);
  cursor: pointer;
  transition: color 0.3s;
}
.idx-item:hover { color: var(--dim); }
.idx-item i { font-style: normal; font-family: var(--serif); font-size: 20px; color: #3a3836; transition: color 0.3s; }
.idx-item span { font-size: 14px; letter-spacing: 0.06em; overflow: hidden; text-overflow: ellipsis; }
.idx-item small { display: block; font-size: 10px; color: var(--faint); margin-top: 2px; }
.idx-item b { font: 400 11px/1 var(--mono); color: var(--red); margin-left: 8px; }
.idx-item.on, .idx-item.on span { color: var(--tx); }
.idx-item.on i { color: var(--red); }
.idx-new { margin-top: 18px; background: none; border: none; padding: 6px 0; color: var(--mut); font-size: 12px; letter-spacing: 0.2em; cursor: pointer; }
.idx-new:hover { color: var(--tx); }

.chip {
  flex: none;
  background: none;
  border: 1px solid var(--ln);
  color: var(--mut);
  font-size: 12px;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  cursor: pointer;
}
.chip i { font-style: normal; font-family: var(--serif); margin-right: 6px; color: var(--faint); }
.chip b { font-weight: 400; color: var(--red); margin-left: 4px; font-size: 10px; }
.chip.on { color: var(--tx); border-color: var(--red2); }
.chip.on i { color: var(--red); }

/* 契约 */
.byline { font-size: 11px; color: var(--mut); letter-spacing: 0.08em; margin: -14px 0 30px; }
.sheet .req-note { margin: 0 0 28px; }
.req-note b { color: var(--red-tx); font-weight: 400; }

/* 结构化文书：章 → 概要 → 条款，可变项嵌在句子里 */
.contract-page { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 56px; }
.clause-doc { min-width: 0; position: relative; }
.clause-doc .actions { position: absolute; right: 0; top: -6px; }
.clause-doc .chap { position: relative; margin: 64px 0 0; }
.clause-doc .chap:first-of-type { margin-top: 40px; }
.chap .big { position: absolute; right: 0; top: -54px; font-family: var(--serif); font-size: 180px; line-height: 1; color: #fff; opacity: 0.028; pointer-events: none; user-select: none; z-index: -1; }
.chap .no { font-family: var(--mono); font-size: 11px; letter-spacing: 0.45em; color: var(--red); }
.chap h2 { font-family: var(--serif); font-weight: 400; font-size: 27px; letter-spacing: 0.1em; color: var(--tx); margin: 6px 0 10px; -webkit-text-stroke: 0.3px currentColor; }
.chap .sum { color: var(--dim); font-size: 14px; line-height: 2; margin: 0 0 24px; padding-left: 16px; border-left: 1px solid var(--red2); max-width: 34em; }
.cl { display: grid; grid-template-columns: 44px minmax(0, 1fr); font-family: var(--serif); font-size: 17px; line-height: 2.15; color: var(--tx); margin: 0 0 12px; }
.cl .n { color: var(--red); font-family: var(--mono); font-size: 12px; padding-top: 6px; letter-spacing: 0.05em; }
.cl .tx { min-width: 0; overflow-wrap: anywhere; }
.v { color: var(--red-tx); padding: 0 3px; text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 7px; transition: text-decoration-color 0.4s, text-shadow 0.4s; }
.v[data-var] { cursor: pointer; }
.v[data-var]:hover, .v[data-var]:focus-visible { text-decoration-color: #e8453f; text-shadow: 0 0 14px rgba(196, 30, 30, 0.55); outline: none; }
.v.empty { color: var(--mut); text-decoration-style: dashed; }

.margin { position: sticky; top: calc(var(--topbar) + 48px); align-self: start; font-size: 12px; color: var(--mut); line-height: 2; padding-top: 96px; }
.margin .item { border-top: 1px solid var(--ln2); padding: 12px 0; }
.margin b { display: block; color: var(--dim); font-weight: 400; letter-spacing: 0.15em; font-size: 11px; }
.margin .link { display: block; font-size: 12px; color: var(--mut); text-align: left; line-height: 2; }
.margin .link:hover { color: var(--tx); }

.seal-row { display: flex; align-items: center; gap: 22px; margin: 72px 0 0; padding-top: 24px; border-top: 1px solid var(--ln2); color: var(--mut); font-size: 13px; line-height: 2; }
.seal { flex: none; width: 280px; }
.seal canvas { display: block; width: 100%; height: auto; }
.version-doc { max-height: 64vh; overflow: auto; padding-right: 8px; }
.version-doc .chap:first-child { margin-top: 12px; }
.version-doc .chap .big { display: none; }

.v.pending { text-decoration-style: dashed; }
.v .old { color: var(--mut); margin-right: 4px; text-decoration-color: var(--mut); }
.v sup { color: var(--red); font-size: 10px; margin-left: 3px; font-family: var(--mono); letter-spacing: 0.1em; }

/* 就地改值的小面板（手机上是底部弹层） */
.var-pop { position: absolute; z-index: 80; width: 300px; max-width: calc(100vw - 24px); background: #111113; border: 1px solid var(--red2); padding: 16px 18px; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6); }
.var-pop.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; border-left: none; border-right: none; border-bottom: none; padding: 22px 22px calc(18px + env(safe-area-inset-bottom)); max-height: 70dvh; overflow: auto; }
.vp-head { font-size: 12px; letter-spacing: 0.15em; color: var(--dim); margin-bottom: 12px; }
.vp-head .mono { color: var(--red); }
.vp-opts { display: grid; gap: 8px; margin-bottom: 8px; }
.vp-opts .check { font-size: 14px; color: var(--tx); letter-spacing: 0.04em; }
.vp-opts input { color-scheme: dark; accent-color: var(--red); }
.var-pop input#vp-text { font-family: var(--serif); font-size: 16px; color: var(--red-tx); margin-bottom: 8px; }
.vp-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.var-pop.sheet .vp-foot .btn { flex: 1; min-height: 44px; }

/* 编辑结构 */
.structure { max-width: 760px; }
.structure .hint { margin: 4px 0 8px; }
.ed-title { font-family: var(--serif); font-size: 34px; letter-spacing: 0.08em; padding: 6px 0 8px; margin: 14px 0 6px; }
.ed-chap { border: 1px solid var(--ln2); background: rgba(255, 255, 255, 0.012); padding: 18px 20px 16px; margin: 26px 0 0; }
.ed-head { display: flex; align-items: center; gap: 12px; }
.ed-head .no { font-family: var(--mono); font-size: 11px; letter-spacing: 0.4em; color: var(--red); }
.ed-head .n { font-family: var(--mono); font-size: 12px; color: var(--red); }
.ed-tools { margin-left: auto; display: flex; gap: 14px; }
.ed-tools .link, .ed-var-row .link { font-size: 11px; letter-spacing: 0.15em; }
.link.danger { color: #b0574f; }
.ed-ch-title { font-family: var(--serif); font-size: 22px; letter-spacing: 0.08em; margin: 6px 0 8px; }
.ed-ch-sum { font-size: 13px; color: var(--dim); line-height: 1.9; min-height: 0; }
.ed-cl { border-top: 1px dashed var(--ln); padding: 14px 0 8px; margin-top: 14px; }
.ed-cl-text { font-family: var(--serif); font-size: 16px; line-height: 2; min-height: 0; margin: 6px 0 4px; }
.ed-err { color: #e05a4e; font-size: 12px; margin: 4px 0 8px; }
.ed-vars { display: grid; gap: 8px; margin: 6px 0 10px; }
.ed-var { border-left: 2px solid var(--red2); padding: 4px 0 4px 12px; }
.ed-var-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ed-var-name { width: 12em; max-width: 100%; color: var(--red-tx); font-size: 14px; margin: 0; }
.ed-var-type { width: auto; font-size: 12px; margin: 0; }
.ed-opts-label { margin: 8px 0 0; }
.ed-var-opts { font-size: 14px; letter-spacing: 0; color: var(--tx); margin-top: 4px; }
.ed-add { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-new { margin-top: 14px; }
.ed-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 28px 0 0; padding-top: 18px; border-top: 1px solid var(--ln2); font-size: 11px; color: var(--mut); }

/* 审批：结构化变更摘要 */
.changes { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; font-size: 14px; color: var(--dim); line-height: 1.9; }
.changes li { padding-left: 14px; border-left: 1px solid var(--ln); }
.changes ins { text-decoration: none; color: var(--red-tx); background: rgba(196, 30, 30, 0.14); padding: 0 2px; }
.changes del { color: var(--mut); }
.changes .diff { margin-top: 6px; font-size: 13px; }

@media (max-width: 1180px) {
  .contract-page { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .margin { position: static; padding-top: 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); column-gap: 24px; }
}


/* 影像 */
.seg { display: flex; gap: 24px; margin: -6px 0 26px; }
.seg button { background: none; border: none; border-bottom: 1px solid transparent; padding: 0 0 6px; font-size: 12px; letter-spacing: 0.2em; color: var(--mut); cursor: pointer; transition: color 0.3s, border-color 0.3s; }
.seg button:hover { color: var(--dim); }
.seg button.on { color: var(--tx); border-bottom-color: var(--red); }
.seg b { color: var(--red); font-weight: 400; font-size: 10px; margin-left: 3px; letter-spacing: 0; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--bg-3); cursor: pointer; -webkit-touch-callout: none; }
/* 两格 4:5 加一道间隙，约 8:5；格子里全是绝对定位，必须自带尺寸，否则整行只有影片时高度为 0 */
.tile.video { grid-column: span 2; aspect-ratio: 8 / 5; }
.tile .ph { position: absolute; inset: 0; background: radial-gradient(70% 60% at 40% 40%, #2a1a1a, #121213 75%); }
.tile img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(14px) saturate(0.6); transform: scale(1.12);
  transition: filter calc(0.5s * var(--motion)), transform calc(0.5s * var(--motion));
}
.tile.revealed img { filter: none; transform: scale(1.02); }
@media (hover: hover) { .tile:hover img { filter: none; transform: scale(1.02); } }
.tile .cap { position: absolute; left: 10px; right: 10px; bottom: 8px; display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: #d0cac4; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.tile .cap .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .mark { position: absolute; right: 10px; top: 8px; font-size: 10px; color: #e05a4e; }
.tile.is-pending { outline: 1px dashed var(--red2); outline-offset: -1px; }
.tile .play { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 50%; }
.tile .play::after { content: ""; position: absolute; left: 17px; top: 13px; border: 9px solid transparent; border-left: 13px solid rgba(255, 255, 255, 0.8); border-right: 0; }
.dropzone.drag .sheet { outline: 1px dashed var(--red2); outline-offset: -12px; }

/* 审批 */
.idx-item b.quiet { color: var(--mut); }
.chip b.quiet { color: var(--mut); }
.req {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 28px;
  padding: 26px 0;
  border-top: 1px solid var(--ln2);
  align-items: start;
}
.req:last-child { border-bottom: 1px solid var(--ln2); }
.req .what { font-size: 11px; color: var(--mut); letter-spacing: 0.2em; }
.req .what strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 20px; color: var(--tx); letter-spacing: 0.08em; margin-top: 4px; overflow-wrap: anywhere; }
.req .body { min-width: 0; }
.req .diff, .req .req-preview { font-family: var(--serif); font-size: 15px; line-height: 2; color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 340px; overflow: auto; }
.req del { color: #7a5c57; text-decoration-color: var(--red); }
.req ins { text-decoration: none; color: var(--red-tx); background: var(--red-soft); padding: 0 2px; }
.req .gap { color: var(--faint); padding: 0 4px; }
.req .by { font-size: 10px; color: var(--mut); margin-top: 10px; }
.req .decided { font-size: 12px; color: var(--dim); margin-top: 6px; }
.req .decided q { font-family: var(--serif); color: var(--tx); }
.req .ops { display: flex; flex-direction: column; gap: 8px; min-width: 96px; }
.req-thumb { width: 96px; aspect-ratio: 4 / 5; background: var(--bg-3); overflow: hidden; position: relative; }
.req-thumb img { width: 100%; height: 100%; object-fit: cover; filter: blur(10px) saturate(0.6); transform: scale(1.12); transition: filter 0.4s; }
.req-thumb.revealed img { filter: none; transform: none; }
@media (hover: hover) { .req-thumb:hover img { filter: none; transform: none; } }

/* 日志 */
.logbook .day { margin: 34px 0 6px; color: var(--red); opacity: 0.85; }
.logbook .title + .day { margin-top: 0; }
.log { display: grid; grid-template-columns: 64px 160px minmax(0, 1fr); gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--ln2); align-items: baseline; max-width: 980px; }
.log time { font-size: 11px; color: var(--mut); }
.log .who { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log .act { min-width: 0; font-size: 12px; color: var(--mut); overflow-wrap: anywhere; }
.log .act b { font-family: var(--serif); font-weight: 400; font-size: 15px; color: var(--tx); letter-spacing: 0.06em; margin-right: 10px; }
.log .act small { font-size: 11px; }

/* 设置 */
.settings .setting-block { max-width: 720px; padding: 8px 0 40px; scroll-margin-top: calc(var(--topbar) + 24px); }
.setting-block h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: 0.1em; margin: 0 0 4px; }
.facts { list-style: none; padding: 0; margin: 0; }
.facts li { padding: 9px 0; border-bottom: 1px solid var(--ln2); font-size: 12px; color: var(--dim); letter-spacing: 0.04em; }
.facts li.warn { color: var(--warn); }

/* 灯箱 */
.lb-title { font-family: var(--serif); font-weight: 400; font-size: 18px; letter-spacing: 0.1em; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lb-gate { text-align: center; }
.lb-gate h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0 0 8px; }
.lb-gate p { color: var(--mut); font-size: 12px; margin: 0 0 18px; }

/* ---------------------------------------------------------------- */
/* 旧视图（逐个被新版替换，期间保持可用）                            */
/* ---------------------------------------------------------------- */

#view-root:not(:has(.page)) { padding: 48px var(--gutter) 96px; max-width: 1200px; margin: 0 auto; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.view-head h2 { font-family: var(--serif); font-weight: 400; font-size: 40px; letter-spacing: 0.12em; margin: 0; }
.view-head h3 { font-family: var(--serif); font-weight: 400; margin: 0; }
.view-head p { color: var(--mut); font-size: 12px; margin: 6px 0 0; }
.card { border-top: 1px solid var(--ln2); padding: 18px 0; }
.empty { padding: 48px 0; color: var(--mut); text-align: left; }
.empty h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--tx); margin: 0 0 8px; }
.split { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 40px; }
.doc-list { display: grid; align-content: start; }
.doc-item { background: none; border: none; border-bottom: 1px solid var(--ln2); text-align: left; padding: 12px 0; cursor: pointer; color: var(--mut); }
.doc-item strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 16px; color: var(--dim); }
.doc-item.active strong { color: var(--tx); }
.doc-item span { font-size: 11px; }
.pending-tag { font-style: normal; color: var(--red); }
.doc-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; }
.doc-meta { font-size: 11px; color: var(--mut); }
.req-note { font-size: 12px; color: var(--dim); border-left: 1px solid var(--red2); padding-left: 12px; }
.req-list { display: grid; }
.req-card { border-top: 1px solid var(--ln2); padding: 20px 0; }
.req-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--mut); margin-bottom: 10px; }
.req-head strong { font-family: var(--serif); font-weight: 400; font-size: 17px; color: var(--tx); }
.req-body { margin-bottom: 12px; }
.req-preview { font-family: var(--serif); white-space: pre-wrap; font-size: 14px; line-height: 1.95; color: var(--dim); max-height: 280px; overflow: auto; overflow-wrap: anywhere; }
.req-thumb { width: 120px; aspect-ratio: 4 / 5; background: var(--bg-3); display: grid; place-items: center; overflow: hidden; font-size: 11px; color: var(--mut); }
.req-thumb img { width: 100%; height: 100%; object-fit: cover; }
.req-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.req-actions input { flex: 1; min-width: 160px; margin: 0; }
.kv { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--mut); margin-bottom: 10px; }
.kv b { color: var(--dim); font-weight: 400; }
.tag { font-size: 10px; letter-spacing: 0.15em; color: var(--mut); border: 1px solid var(--ln); padding: 1px 8px; }
.tag.pending { color: var(--warn); }
.tag.approved { color: var(--ok); }
.tag.rejected { color: #e05a4e; }
.tag.expired { color: var(--mut); border-style: dashed; }
.req .ops .btn:disabled { opacity: 0.35; cursor: not-allowed; }
.setting-block h3 { font-family: var(--serif); font-weight: 400; font-size: 20px; margin: 0 0 4px; }
.setting-block > p { color: var(--mut); font-size: 12px; margin: 0 0 14px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--ln2); }
.setting-row .label { font-size: 13px; letter-spacing: 0.06em; color: var(--dim); margin: 0; }
.setting-row .label small { display: block; font-size: 11px; color: var(--mut); letter-spacing: 0.02em; }
.setting-row select { width: auto; flex: none; margin: 0; }

/* ---------------------------------------------------------------- */
/* 关键时刻动效层：永远不接收点击                                    */
/* ---------------------------------------------------------------- */

.motion-layer { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.motion-layer .blot { position: absolute; border-radius: 50%; pointer-events: none; will-change: transform, opacity; }
.motion-layer .motion-cover { position: absolute; inset: 0; background: var(--bg); pointer-events: none; }

/* ---------------------------------------------------------------- */
/* 弹窗 / 灯箱 / 提示                                                */
/* ---------------------------------------------------------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(5, 5, 6, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--ln);
  padding: 32px 32px 26px;
}
.modal h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: 0.1em; margin: 0 0 12px; }
.modal p { color: var(--dim); font-size: 13px; line-height: 1.9; margin: 0 0 16px; }
.modal textarea { border: 1px solid var(--ln); padding: 10px 12px; }
.modal textarea:focus { border-color: var(--red2); }
.modal textarea:focus-visible { outline: none; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.code-box { font-family: var(--mono); font-size: 15px; letter-spacing: 0.12em; color: var(--red-tx); border: 1px solid var(--red2); padding: 16px; margin: 0 0 14px; word-break: break-all; }

.lightbox { position: fixed; inset: 0; z-index: 95; background: #050505; display: grid; grid-template-rows: auto 1fr auto; }
.lightbox-head { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--ln2); }
.lightbox-stage { display: grid; place-items: center; overflow: hidden; padding: 16px; }
.lightbox-stage img, .lightbox-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-foot { padding: 10px 20px; font-size: 11px; color: var(--mut); border-top: 1px solid var(--ln2); }

.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 130; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--bg-3); border: 1px solid var(--ln); color: var(--tx); font-size: 12px; letter-spacing: 0.06em; padding: 10px 16px; }
.toast.ok { border-color: #3a3433; }
.toast.err { border-color: var(--red2); color: var(--red-tx); }

/* ---------------------------------------------------------------- */
/* 防泄露层                                                          */
/* ---------------------------------------------------------------- */

.concealer {
  position: fixed; inset: 0; z-index: 200;
  background: #070707;
  display: none;
  align-items: center; justify-content: center;
  color: var(--mut);
  font-size: 11px;
  letter-spacing: 0.3em;
}
html.concealed .concealer { display: flex; }
html.concealed #app, html.concealed .watermark { visibility: hidden; }
html.concealed-devtools #app, html.concealed-devtools #watermark { filter: blur(20px); }

.shield {
  position: fixed; inset: 0; z-index: 210;
  background: #050505;
  display: grid; place-items: center;
  text-align: center;
}
.shield[hidden] { display: none; }
.shield-inner { display: grid; gap: 12px; justify-items: center; }
.shield-inner p { font-family: var(--serif); font-size: 20px; color: var(--tx); margin: 0; letter-spacing: 0.2em; }
.shield-inner span { font-size: 11px; color: var(--red); letter-spacing: 0.2em; }

.watermark {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.4s;
  background-repeat: repeat;
  mix-blend-mode: overlay;
}
body.unlocked .watermark { opacity: 0.05; }

.print-block { display: none; }
@media print {
  body { display: none !important; }
  .print-block { display: block !important; color: #000; font-family: sans-serif; padding: 40px; }
}

/* ---------------------------------------------------------------- */
/* 手机                                                              */
/* ---------------------------------------------------------------- */

@media (max-width: 760px) {
  :root { --gutter: 22px; --topbar: 56px; }

  .screen { padding: calc(40px + env(safe-area-inset-top)) 22px calc(40px + env(safe-area-inset-bottom)); align-items: flex-start; }
  .auth-head .title { font-size: 34px; }
  .pair, .grid-2 { grid-template-columns: 1fr; gap: 28px; }
  .wait-code { font-size: 21px; letter-spacing: 0.12em; padding: 14px 16px; }
  .wait-actions .btn { flex: 1 1 100%; }

  .title { font-size: 32px; margin: 10px 0 20px; }

  /* backdrop-filter 会让 .topbar 成为 fixed 子元素的包含块，底部导航会被拽到顶上 */
  .topbar { padding: env(safe-area-inset-top) var(--gutter) 0; height: calc(var(--topbar) + env(safe-area-inset-top));
    backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(12, 12, 13, 0.97); }
  .topbar .logo { font-size: 18px; letter-spacing: 0.45em; }
  .topbar .me { margin-left: auto; font-size: 11px; }

  .nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    margin: 0;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom));
    padding: 0 6px env(safe-area-inset-bottom);
    gap: 0;
    justify-content: space-around;
    align-items: center;
    background: linear-gradient(to top, rgba(12, 12, 13, 1) 60%, rgba(12, 12, 13, 0.88));
    border-top: 1px solid var(--ln2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .nav button { flex: 1; padding: 14px 0; font-size: 13px; letter-spacing: 0.25em; }
  .nav .badge { top: 8px; right: 50%; margin-right: -2.2em; }

  .content { min-height: auto; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px); }
  #view-root:not(:has(.page)) { padding: 24px var(--gutter) calc(var(--tabbar) + 40px); }

  .page { display: block; min-height: 0; }
  .index { display: none; }
  .chips {
    display: flex;
    gap: 8px;
    padding: 14px var(--gutter);
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid var(--ln2);
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .sheet { padding: 22px var(--gutter) 40px; }
  .sheet .actions { position: static; margin: 12px 0 4px; }
  .sheet .actions .btn { min-height: 28px; padding: 4px 12px; }
  .desk { display: none !important; }
  .log { grid-template-columns: 48px minmax(0, 1fr); gap: 4px 12px; }
  .log .act { grid-column: 2; }
  .lightbox-head { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; flex-wrap: wrap; }
  .lightbox-head .btn { min-height: 30px; padding: 4px 10px; letter-spacing: 0.15em; }
  .lightbox-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .req { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 20px 0; }
  .req .what strong { font-size: 19px; }
  .req .ops { flex-direction: row; display: grid; grid-template-columns: 1fr 1fr; }
  .req .ops .btn { min-height: 44px; letter-spacing: 0.3em; }
  .req .ops .tiny, .req .ops .tag { grid-column: 1 / -1; justify-self: start; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile.video { aspect-ratio: 16 / 9; }
  .seg { gap: 20px; margin: 0 0 18px; }
  .byline { margin: -8px 0 22px; }
  .fab {
    display: inline-flex;
    position: fixed;
    right: var(--gutter);
    bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 18px);
    z-index: 45;
  }

  .view-head { flex-direction: column; align-items: flex-start; }
  .view-head h2 { font-size: 30px; }
  .split { grid-template-columns: 1fr; }

  .chap .big { font-size: 120px; top: -36px; }
  .chap h2 { font-size: 23px; }
  .cl { grid-template-columns: 36px minmax(0, 1fr); font-size: 16px; }
  .seal-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .seal { width: 230px; }

  .ed-chap { padding: 14px 14px 12px; }
  .ed-title { font-size: 26px; }
  .ed-foot .btn { flex: 1; }
  .ed-foot > span:first-child { flex-basis: 100%; }

  .modal-mask { place-items: end stretch; padding: 0; }
  .modal { max-width: none; border-left: none; border-right: none; border-bottom: none; padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); max-height: 88dvh; }
  .modal-foot .btn { flex: 1; }
  .toasts { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); }
}
