/* ============================================================
   骰桌 DiceTable · 站点样式
   暗色墨台 / 纸色角色卡，两个世界放在一屏里
   ============================================================ */

@import url("./tokens.css");

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 78% -8%, rgba(201, 151, 63, 0.11), transparent 62%),
    radial-gradient(900px 520px at 8% 4%, rgba(120, 96, 70, 0.12), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(201, 151, 63, 0.32); }

a { color: inherit; text-decoration: none; }

h1, h2, h3, p, dl, dd, dt { margin: 0; }

button { font: inherit; color: inherit; }

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  transition: top 0.18s ease;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

/* ---------- 顶栏 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(18, 16, 14, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 34px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(160deg, #2b241c, #1b1713);
  border: 1px solid #3d3329;
  color: var(--accent-soft);
}
.brand-mark svg { width: 19px; height: 19px; }

.brand-text { display: flex; align-items: baseline; gap: 7px; }
.brand-text strong {
  font-family: var(--font-serif);
  font-size: 19px;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.brand-text em {
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-dim);
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { color: var(--ink); background: rgba(255, 255, 255, 0.045); }
.nav-link.is-active { color: var(--ink); background: rgba(201, 151, 63, 0.13); }
.nav-link.is-active::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.nav-tag {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 6px;
  line-height: 1.4;
}

.header-actions { margin-left: auto; display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(180deg, #d9a750, #c08a33);
  color: var(--accent-ink);
  border-color: #e0b365;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 10px 24px -14px rgba(201, 151, 63, 0.9);
  font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(180deg, #e7b661, #cc9439); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); border-color: #4a3f34; }

.btn-quiet {
  background: transparent;
  color: var(--ink-dim);
  padding: 0 12px;
}
.btn-quiet:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }

.btn-danger { background: transparent; border-color: #4a2d28; color: #e09b8c; }
.btn-danger:hover { background: rgba(205, 111, 94, 0.12); }

.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.icon-btn.is-danger:hover { background: rgba(205, 111, 94, 0.14); color: #e8a294; }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- 页面骨架 ---------- */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 28px;
}
.page-head h1 {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.page-head .sub { color: var(--ink-dim); font-size: 14px; margin-top: 6px; }
.page-actions { display: flex; gap: 10px; flex-shrink: 0; }

.eyebrow {
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

/* ---------- 首页 ---------- */

.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 76px 28px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(38px, 4.6vw, 62px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 680;
}
.hero h1 .dim { color: rgba(240, 231, 219, 0.56); }

.lede {
  margin-top: 20px;
  max-width: 34em;
  color: var(--ink-dim);
  font-size: 15.5px;
  line-height: 1.75;
}
.lede strong { color: var(--ink); font-weight: 550; }

.hero-actions { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }

.public-link { font-size: 12.5px; color: var(--ink-dim); margin-top: 14px; }
.public-link .link-btn {
  font: inherit; font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em;
  color: var(--accent-soft); background: rgba(201, 151, 63, .1); cursor: pointer;
  border: 1px solid rgba(201, 151, 63, .34); border-radius: 6px; padding: 3px 8px; margin-right: 6px;
}
.public-link .link-btn:hover { background: rgba(201, 151, 63, .18); color: #f4e3c2; }

.hero-facts {
  display: flex;
  gap: 26px;
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.hero-fact dt { font-size: 11.5px; letter-spacing: 0.1em; color: var(--ink-faint); text-transform: uppercase; }
.hero-fact dd { margin-top: 5px; font-size: 15px; color: var(--ink); }
.hero-fact dd .muted { color: var(--ink-faint); font-size: 12.5px; }

.hero-art { position: relative; min-height: 400px; display: grid; place-items: center; }
.hero-art .glow {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 151, 63, 0.2), transparent 66%);
  filter: blur(6px);
}

/* 首页那张斜放的纸卡：比一个骰子更像产品 */
.hero-paper {
  position: relative;
  width: 308px;
  padding: 20px 20px 14px;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 8px;
  border: 1px solid #f7f0e4;
  transform: rotate(-2.2deg);
  box-shadow: 0 44px 80px -34px rgba(0, 0, 0, 0.98), 0 2px 0 rgba(255, 255, 255, 0.55) inset;
  font-family: var(--font-serif);
}
.hero-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  background-image: radial-gradient(rgba(90, 70, 45, 0.05) 1px, transparent 1px);
  background-size: 4px 4px;
}
.hp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--paper-ink);
}
.hp-name { font-size: 20px; font-weight: 600; }
.hp-badge {
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--paper-dim);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  padding: 1px 7px;
}
.hp-sub {
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--paper-dim);
}
.hp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 14px; }
.hp-cell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--paper-line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.32);
}
.hp-cell span { font-family: var(--font-sans); font-size: 11px; color: var(--paper-dim); }
.hp-cell b { font-size: 14px; font-weight: 600; }
.hp-lines { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.hp-line { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.hp-line span { font-family: var(--font-sans); font-size: 11px; color: var(--paper-dim); }
.hp-line i { flex: 1; border-bottom: 1px dotted rgba(120, 100, 74, 0.45); transform: translateY(-2px); }
.hp-line b { font-weight: 600; }
.hp-foot {
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px solid var(--paper-line);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--paper-dim);
  text-transform: uppercase;
}
.hero-seal {
  position: absolute;
  right: -16px;
  bottom: -16px;
  width: 42px;
  height: 42px;
  padding: 6px;
  border-radius: 50%;
  color: #f6efe3;
  background: var(--accent);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.9);
  transform: rotate(-6deg);
}
.hero-seal svg { width: 100%; height: 100%; display: block; }

.hero-chip {
  position: absolute;
  left: -2%;
  bottom: 9%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(28, 25, 22, 0.94);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-dim);
  box-shadow: var(--shadow);
}
.hero-chip b { color: var(--accent-soft); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 入口卡 */

.entries {
  max-width: 1240px;
  margin: 44px auto 0;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.entry {
  position: relative;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0));
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
  display: block;
}
a.entry:hover, button.entry:hover {
  border-color: #5a4a35;
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(201, 151, 63, 0.07), rgba(255, 255, 255, 0));
}
button.entry {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
}
.entry.is-locked { opacity: 0.62; }
.entry-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.entry-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(201, 151, 63, 0.1);
  border: 1px solid rgba(201, 151, 63, 0.22);
  color: var(--accent-soft);
}
.entry-icon svg { width: 19px; height: 19px; }
.entry h3 { margin-top: 16px; font-size: 16.5px; font-weight: 600; }
.entry p { margin-top: 7px; font-size: 13.5px; color: var(--ink-dim); line-height: 1.6; }

.pill {
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
}
.pill--live { color: var(--ok); border-color: rgba(127, 174, 122, 0.35); background: rgba(127, 174, 122, 0.08); }

/* 说明块 */

.notes {
  max-width: 1240px;
  margin: 42px auto 0;
  padding: 0 28px;
}
.note-box {
  border: 1px dashed #3a3026;
  border-radius: var(--radius);
  padding: 22px 24px;
  background: rgba(23, 20, 17, 0.7);
}
.note-box h3 { font-size: 14px; letter-spacing: 0.02em; color: var(--ink); }
.note-box ul { margin: 12px 0 0; padding-left: 18px; color: var(--ink-dim); font-size: 13.5px; line-height: 1.9; }
.note-box code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--accent-soft);
}

/* ---------- 角色卡列表 ---------- */

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.sheet-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0));
  transition: border-color 0.16s ease, background 0.16s ease;
}
.sheet-card:hover { border-color: #52432f; background: rgba(255, 255, 255, 0.035); }

.sheet-mono {
  width: 46px; height: 54px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 7px;
  background: linear-gradient(160deg, var(--paper-2), var(--paper));
  color: var(--paper-dim);
  font-family: var(--font-serif);
  font-size: 21px;
  border: 1px solid #f6efe2;
  box-shadow: 0 8px 18px -12px #000;
}
.sheet-card-main { flex: 1; min-width: 0; display: block; }
.sheet-card-main h3 {
  font-size: 15.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-card-main p { margin-top: 4px; font-size: 12.5px; color: var(--ink-faint); }
.sheet-card-actions { display: flex; gap: 2px; }

/* 编号行式列表：跟侧栏菜单同一个节奏，一行一件事，读起来更清楚 */
.sheet-rows { border-top: 1px solid var(--line); }
.sheet-row {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 6px 15px 2px;
  border-bottom: 1px solid var(--line);
  transition: background 0.16s ease;
}
.sheet-row:hover { background: rgba(240, 231, 219, 0.035); }
.sr-no {
  width: 26px; flex: none;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sr-main strong {
  font-family: var(--font-serif); font-size: 17px; font-weight: 600; letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-main em { font-style: normal; font-size: 12px; color: var(--ink-faint); }
.sr-actions { display: flex; gap: 2px; opacity: 0.45; transition: opacity 0.16s ease; }
.sheet-row:hover .sr-actions,
.sheet-row:focus-within .sr-actions { opacity: 1; }
@media (max-width: 620px) {
  .sr-actions { opacity: 1; }
  .sr-main strong { font-size: 15.5px; }
}

.empty {
  border: 1px dashed #3a3026;
  border-radius: var(--radius);
  padding: 54px 28px;
  text-align: center;
  background: rgba(23, 20, 17, 0.55);
}
.empty h3 { font-size: 16px; }
.empty p { margin-top: 8px; color: var(--ink-dim); font-size: 13.5px; }
.empty .btn { margin-top: 20px; }

/* ---------- 编辑器 ---------- */

.editor-toolbar {
  position: sticky;
  top: 64px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: rgba(18, 16, 14, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.editor-toolbar .spacer { flex: 1; }

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.save-state .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(127, 174, 122, 0.14);
}
.save-state.is-dirty .dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(201, 151, 63, 0.16); }

.editor {
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 28px 90px;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr) 396px;
  gap: 28px;
  align-items: start;
}

.editor-nav {
  position: sticky;
  top: 130px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.editor-nav a {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 9px 10px 9px 8px;
  border-radius: 0;
  font-size: 13.5px;
  color: var(--ink-faint);
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(53, 45, 38, 0.55);
  transition: color 0.15s ease, background 0.15s ease;
}
.en-no {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #6f6153;
  font-variant-numeric: tabular-nums;
}
.editor-nav a.is-active .en-no { color: var(--accent); }
.editor-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }
.editor-nav a.is-active { color: var(--ink); border-left-color: var(--accent); background: rgba(201, 151, 63, 0.08); }

.editor-form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.panel-hint { font-size: 12.5px; color: var(--ink-faint); }
.panel-body { padding: 18px 20px 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.field--wide { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label {
  font-size: 12.5px;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.field-label .req { color: var(--accent); font-size: 11px; }
.field-label .slot {
  font-size: 10px;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  line-height: 1.5;
}

.input, .textarea {
  width: 100%;
  background: #14110f;
  border: 1px solid #332c25;
  border-radius: 8px;
  color: var(--ink);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder, .textarea::placeholder { color: #6b6055; }
.input:hover, .textarea:hover { border-color: #42382e; }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #171310;
  box-shadow: 0 0 0 3px rgba(201, 151, 63, 0.14);
}
.textarea { resize: vertical; min-height: 76px; line-height: 1.65; }
.input--num { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.attr-grid .input { text-align: left; }

/* 可重复行 */

.repeat-head, .repeat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 34px;
  gap: 10px;
  align-items: center;
}
.repeat-head {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  padding: 0 2px 7px;
}
.repeat-row { margin-bottom: 8px; }
.repeat-row .icon-btn { width: 30px; height: 30px; }
.repeat-empty {
  padding: 14px 2px 6px;
  font-size: 13px;
  color: var(--ink-faint);
}
.repeat-add { margin-top: 6px; }

/* ---------- 纸上角色卡（预览） ---------- */

.editor-preview { position: sticky; top: 130px; }

.sheet-paper {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 120px),
    var(--paper);
  color: var(--paper-ink);
  border-radius: 10px;
  padding: 26px 24px 20px;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.4) inset, 0 30px 60px -34px #000;
  border: 1px solid #f7f0e4;
  font-family: var(--font-serif);
  min-height: 540px;
  position: relative;
  overflow: hidden;
}
.sheet-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(90, 70, 45, 0.045) 1px, transparent 1px);
  background-size: 4px 4px;
}

.paper-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--paper-ink);
}
.paper-name {
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  font-weight: 600;
  word-break: break-word;
}
.paper-sub { margin-top: 5px; font-size: 11.5px; color: var(--paper-dim); letter-spacing: 0.06em; font-family: var(--font-sans); }
.paper-mono {
  width: 54px; height: 54px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border: 1.5px solid rgba(43, 34, 24, 0.5);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px rgba(43, 34, 24, 0.22);
  font-family: var(--font-serif);
  font-size: 21px;
  color: var(--paper-ink);
  transform: rotate(-6deg);
}

.paper-section { margin-top: 18px; }
.paper-section h3 {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-dim);
  font-family: var(--font-sans);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--paper-line);
  margin-bottom: 10px;
}

.paper-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; }
.paper-pairs > div { min-width: 0; }
.paper-pairs dt { font-size: 10.5px; letter-spacing: 0.08em; color: var(--paper-dim); font-family: var(--font-sans); }
.paper-pairs dd { font-size: 14.5px; margin-top: 2px; word-break: break-word; }
.paper-pairs dd.is-empty { color: #a3907a; }

.paper-attrs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; }
.paper-attr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px;
  border: 1px solid var(--paper-line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.32);
}
.paper-attr span { font-size: 12.5px; color: var(--paper-dim); font-family: var(--font-sans); }
.paper-attr b { font-size: 16px; font-variant-numeric: tabular-nums; font-weight: 600; }

.paper-skills { display: flex; flex-direction: column; gap: 3px; }
.paper-skill {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
  padding: 2px 0;
  border-bottom: 1px dotted rgba(120, 100, 74, 0.28);
}
.paper-skill span { flex: 1; min-width: 0; }
.paper-skill i {
  flex: 1;
  border-bottom: 1px dotted rgba(120, 100, 74, 0.4);
  transform: translateY(-3px);
  min-width: 20px;
}
.paper-skill b { font-variant-numeric: tabular-nums; font-weight: 600; }

.paper-prose { font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.paper-prose.is-empty { color: rgba(109, 92, 70, 0.55); }
.paper-prose-label {
  font-family: var(--font-sans);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--paper-dim);
  margin-top: 12px;
}

.paper-foot {
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid var(--paper-line);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--paper-dim);
  font-family: var(--font-sans);
  text-transform: uppercase;
}

.preview-fab { display: none; }

/* ---------- 占位页 ---------- */

.placeholder {
  max-width: 720px;
  margin: 0 auto;
  padding: 76px 28px 100px;
  text-align: center;
}
.placeholder .mark {
  width: 56px; height: 56px;
  margin: 0 auto 22px;
  display: grid; place-items: center;
  border-radius: 16px;
  border: 1px dashed #4a3c2c;
  color: var(--ink-faint);
}
.placeholder .mark svg { width: 24px; height: 24px; }
.placeholder h1 { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; }
.placeholder p { margin-top: 12px; color: var(--ink-dim); line-height: 1.8; }
.placeholder .plan {
  margin: 28px auto 0;
  max-width: 460px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px 20px;
}
.placeholder .plan li { font-size: 13.5px; color: var(--ink-dim); margin-left: 16px; line-height: 1.9; }
.placeholder .btn { margin-top: 26px; }

/* ---------- 对话框 ---------- */

.dialog {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 16px;
  padding: 0;
  width: min(520px, calc(100vw - 40px));
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(8, 6, 5, 0.66); backdrop-filter: blur(3px); }
.dialog-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line-soft); }
.dialog-head h2 { font-size: 17px; font-weight: 600; }
.dialog-head p { margin-top: 5px; font-size: 13px; color: var(--ink-faint); }
.dialog-body { padding: 16px 22px 8px; display: flex; flex-direction: column; gap: 10px; }
.dialog-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

.template-option {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.template-option:hover:not(:disabled) { border-color: #5a4a35; background: rgba(201, 151, 63, 0.07); }
.template-option:disabled { opacity: 0.5; cursor: not-allowed; }
.template-option .t-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--accent-soft);
}
.template-option .t-icon svg { width: 17px; height: 17px; }
.template-option h3 { font-size: 14px; font-weight: 600; }
.template-option p { margin-top: 3px; font-size: 12.5px; color: var(--ink-faint); line-height: 1.55; }

/* ---------- 提示条 ---------- */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 999px;
  background: #2a241d;
  border: 1px solid #42382c;
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  .editor { grid-template-columns: 150px minmax(0, 1fr) 340px; gap: 20px; }
  .hero { gap: 32px; }
}

@media (max-width: 1020px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor-nav { display: none; }
  .editor-preview {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    padding: 20px;
    background: rgba(10, 8, 6, 0.86);
    overflow: auto;
    place-items: start center;
  }
  body.preview-open .editor-preview { display: grid; }
  .editor-preview .sheet-paper { max-width: 460px; width: 100%; }
  .preview-fab {
    display: inline-flex;
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 55;
    height: 42px;
    padding: 0 18px;
    border-radius: 999px;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.8);
    cursor: pointer;
  }
  .preview-fab svg { width: 15px; height: 15px; }
}

@media (max-width: 860px) {
  .site-header { position: static; }
  .header-inner {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 12px 18px 0;
    height: auto;
  }
  .header-actions { margin-left: auto; }
  .nav {
    order: 3;
    width: 100%;
    gap: 2px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { padding: 6px 10px; font-size: 13px; }
  .nav-tag { display: none; }
  .brand-text em { display: none; }
  .hero { grid-template-columns: 1fr; padding: 40px 18px 8px; gap: 18px; }
  .hero-art { order: -1; min-height: 330px; }
  .hero-paper { width: 268px; padding: 16px 16px 12px; }
  .hp-name { font-size: 18px; }
  .hero-chip { display: none; }
  .entries { grid-template-columns: 1fr; padding: 0 18px; margin-top: 32px; }
  .notes { padding: 0 18px; }
  .page { padding: 26px 18px 70px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .editor { padding: 18px 18px 90px; }
  /* 手机上工具栏分两行：返回 + 保存状态一行，操作按钮右对齐一行 */
  .editor-toolbar {
    top: 0;
    padding: 10px 14px;
    gap: 8px 10px;
    flex-wrap: wrap;
  }
  .editor-toolbar .spacer { display: none; }
  .editor-toolbar [data-action="back"] { order: 1; }
  .editor-toolbar .save-state { order: 2; margin-left: auto; font-size: 11.5px; }
  .editor-toolbar [data-action="export"],
  .editor-toolbar [data-action="print"],
  .editor-toolbar [data-action="delete"] { order: 3; }
  .editor-toolbar [data-action="export"] { margin-left: auto; }
  .editor-toolbar [data-action="print"] { margin-left: auto; }
  .editor-toolbar .btn-sm { padding: 7px 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .paper-pairs { grid-template-columns: 1fr 1fr; }
}

/* ---------- 打印 ---------- */

@media print {
  @page { margin: 14mm; }
  body {
    background: #fff !important;
    color: #000;
  }
  .site-header, .editor-nav, .editor-form, .editor-toolbar,
  .preview-fab, .toast-stack, .page, .hero, .entries, .notes, .placeholder { display: none !important; }
  body.printing .editor {
    display: block !important;
    padding: 0;
    margin: 0;
    max-width: none;
  }
  body.printing .editor-preview { position: static; display: block !important; padding: 0; background: none; }
  body.printing .sheet-paper {
    box-shadow: none;
    border: 1px solid #bbb;
    border-radius: 0;
    min-height: 0;
    page-break-inside: avoid;
  }
}

/* ── 我的房间 ─────────────────────────── */
.mine-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.mine-grid .empty { grid-column: 1 / -1; }
.sheet-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.mine-card {
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
  padding: 14px 16px; border-radius: 12px;
}
.mine-card h3 { margin: 7px 0 3px; font-size: 15.5px; }
.mine-card .sheet-card-main p { margin: 0; font-size: 12.5px; color: var(--ink-dim); }
.mine-card .sheet-mono {
  width: auto; height: auto; padding: 3px 9px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  background: rgba(201, 151, 63, 0.13); color: #e6cf9e;
  border: 1px solid rgba(201, 151, 63, 0.34); box-shadow: none;
}
.mine-card.is-gone { opacity: .55; }
.sheet-card-side { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sheet-card-side .btn-sm { flex: none; }
.pill.is-hot { color: #f2e3c4; background: rgba(201, 151, 63, 0.18); border-color: rgba(201, 151, 63, 0.45); }
.empty h2 { font-size: 16px; }
@media (max-width: 620px) {
  .mine-grid { grid-template-columns: 1fr; }
  .mine-card { padding: 12px 13px; }
}


/* ── xlsx 导入对话框 ─────────────────── */
.dialog.xlsx { width: min(1120px, calc(100vw - 40px)); max-width: 1120px; }
.dialog.xlsx .dialog-body.xlsx-body {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px;
  align-items: start; max-height: min(62vh, 560px); overflow: hidden;
}
.xlsx-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.xlsx-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.xlsx-tab {
  font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer;
  padding: 5px 9px; border-radius: 7px; color: var(--ink-dim);
  background: rgba(240, 231, 219, .04); border: 1px solid var(--line);
}
.xlsx-tab span { margin-left: 6px; color: var(--ink-faint); font-size: 11px; }
.xlsx-tab.on { color: #f2e3c4; background: rgba(201, 151, 63, .16); border-color: rgba(201, 151, 63, .42); }
.xlsx-grid-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 9px; }
.xlsx-grid { border-collapse: collapse; font-size: 11.5px; }
.xlsx-grid th, .xlsx-grid td {
  border-right: 1px solid rgba(240, 231, 219, .07); border-bottom: 1px solid rgba(240, 231, 219, .07);
  padding: 3px 7px; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-dim);
}
.xlsx-grid th { background: rgba(240, 231, 219, .05); color: var(--ink-faint); font-weight: 500; position: sticky; top: 0; }
.xlsx-grid .rowh { position: sticky; left: 0; background: var(--panel); text-align: right; color: var(--ink-faint); }
.xlsx-grid td.is-num { color: #e6cf9e; }
.xlsx-hint { font-size: 11.5px; color: var(--ink-faint); line-height: 1.7; margin: 0; }
.xlsx-right { display: flex; flex-direction: column; gap: 9px; min-width: 0; max-height: min(62vh, 560px); }
.xlsx-sum { font-size: 12px; color: var(--ink-dim); }
.xlsx-secs { overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.xlsx-sec { border: 1px solid var(--line); border-radius: 9px; padding: 8px 9px; background: rgba(240, 231, 219, .02); }
.xlsx-sec-head { display: flex; gap: 7px; align-items: center; margin-bottom: 6px; }
.xlsx-sec-name { height: 28px; font-size: 12.5px; padding: 0 8px; }
.btn-xs { font-size: 11.5px; padding: 4px 8px; }
.xlsx-fields { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px 8px; }
.xlsx-fields label { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 0; cursor: pointer; }
.xlsx-fields input[type="checkbox"] { accent-color: var(--accent); flex: none; }
.xlsx-label { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xlsx-value { margin-left: auto; color: #e6cf9e; font-variant-numeric: tabular-nums; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 860px) {
  .dialog.xlsx .dialog-body.xlsx-body { grid-template-columns: 1fr; max-height: 68vh; overflow: auto; }
  .xlsx-right { max-height: none; }
  .xlsx-fields { grid-template-columns: 1fr; }
}
/* ── 随机生成对话框 ─────────────────── */
.dialog.gen { width: min(1000px, 94vw); max-height: 92vh; display: flex; flex-direction: column; }
.dialog.gen .dialog-body { overflow: auto; }
.dialog.gen .dialog-foot { flex: none; }
.gen-tabs { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.gen-tab {
  appearance: none; font: inherit; font-size: 13px; padding: 7px 14px; cursor: pointer;
  color: var(--ink-dim); background: rgba(240, 231, 219, .04);
  border: 1px solid var(--line); border-radius: 999px;
}
.gen-tab:hover { color: var(--ink); border-color: rgba(201, 151, 63, .4); }
.gen-tab.on { color: #f2e3c4; background: rgba(201, 151, 63, .16); border-color: rgba(201, 151, 63, .55); }
.gen-tab.sm { font-size: 12px; padding: 4px 11px; }
.gen-era { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; color: var(--ink-faint); }
.gen-era[hidden] { display: none; }
.gen-hint { font-size: 12px; color: var(--ink-faint); margin: 0 0 12px; line-height: 1.7; }
.gen-count { margin-right: auto; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.gen-card {
  background: var(--paper); color: var(--paper-ink); border-radius: 10px; padding: 26px 28px 22px;
  max-height: 56vh; overflow: auto; box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .7);
}
.gs-head { border-bottom: 1px solid rgba(43, 34, 24, .3); padding-bottom: 12px; }
.gs-sys { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #8a7460; }
.gs-head h3 { font-family: var(--font-serif); font-size: 26px; margin: 6px 0 4px; letter-spacing: .02em; }
.gs-sub { font-size: 12.5px; color: #6b5b48; line-height: 1.6; }
.gs-note {
  font-size: 12px; color: #6b5b48; line-height: 1.75; margin: 12px 0 0;
  padding-left: 10px; border-left: 2px solid rgba(201, 151, 63, .45);
}
.gs-body {
  margin-top: 16px; display: grid; gap: 16px 30px;
  grid-template-columns: repeat(auto-fit, minmax(266px, 1fr)); align-items: start;
}
.gen-card[hidden], .gen-manual[hidden] { display: none; }
.gen-manual { display: flex; flex-direction: column; gap: 12px; }
.gen-manual-tip { margin: 0; font-size: 12px; line-height: 1.8; color: var(--ink-faint); }
.gen-manual-tip code {
  font-family: var(--font-mono); font-size: 11.5px; padding: 1px 5px; border-radius: 4px;
  background: rgba(240, 231, 219, .07); color: var(--accent-soft);
}
.gen-manual textarea {
  width: 100%; min-height: 44vh; resize: vertical;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.9;
  color: var(--ink); background: rgba(0, 0, 0, .34);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 14px 16px; tab-size: 2;
}
.gen-manual textarea:focus { outline: none; border-color: rgba(201, 151, 63, .5); }
.gen-manual-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gen-manual-note { font-size: 12px; color: var(--accent-soft); }
.gs-sec h4 {
  font-family: var(--font-serif); font-size: 13px; font-weight: 600; margin: 0 0 6px;
  padding-bottom: 5px; border-bottom: 1px solid rgba(43, 34, 24, .22); color: #4a3b2c;
}
.gs-desc { font-size: 11.5px; color: #7a6650; margin: 0 0 6px; line-height: 1.7; }
.gs-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 3px 0; border-bottom: 1px dotted rgba(43, 34, 24, .14); font-size: 12.5px;
}
.gs-row:last-child { border-bottom: 0; }
.gs-row .k { color: #6b5b48; flex: 1; min-width: 0; }
.gs-row .v { color: #2b2218; text-align: right; font-variant-numeric: tabular-nums; white-space: pre-wrap; }
@media (max-width: 640px) {
  .gen-card { padding: 18px 16px; max-height: 62vh; }
  .gs-head h3 { font-size: 21px; }
  .gs-body { grid-template-columns: 1fr; }
}

.xlsx-map { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-faint); margin-bottom: 8px; }
.xlsx-pick { width: auto; min-width: 76px; padding: 4px 6px; font-size: 12px; }

.xlsx-f-label { width: 108px; padding: 3px 7px; font-size: 12px; flex: none; }
.xlsx-f-value { width: 72px; padding: 3px 7px; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; border-color: rgba(201,151,63,.28); flex: none; }
.xlsx-fields label { gap: 6px; }
.xlsx-fields li { display: flex; }
