/* 入卷 · 墨与光设计系统
   墨黑底 + 纸白字 + 烫金强调 + 朱红行动色。标签用手工朱印（糙边滤镜 #roughen，
   页面里需带同名 SVG filter），章节题眉用古籍鱼尾，主 CTA 用暖金胶囊。
   世界光色：西幻熔金 / 怪谈磷绿 / 武侠霜青 / 星海电紫。 */

:root {
  --ink0: #080709; --ink1: #0e0d0f; --ink2: #141216;
  --paper: #ece7db; --paper-dim: #b9b3a6; --paper-faint: rgba(236,231,219,.55);
  --gilt: #c9a961; --gilt-soft: #e6cf96; --gilt-faint: rgba(201,169,97,.25);
  --red: #a03325; --red-deep: #8e2a1c;
  --w-fantasy: #e8b34a; --w-horror: #5fae8c; --w-wuxia: #7fb0c9; --w-scifi: #b58fd6;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", serif;
  --disp: "Cinzel", serif; --mono: "SF Mono", "Menlo", "JetBrains Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--serif);
  background: #191419;
  /* 墨要有光：暖金光池从上方漫下来，避免整页死黑 */
  background-image:
    radial-gradient(ellipse 75% 42% at 18% -6%, rgba(232,179,74,.16), transparent 58%),
    radial-gradient(ellipse 65% 38% at 86% 2%, rgba(201,169,97,.11), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 110%, rgba(0,0,0,.5), transparent 70%),
    linear-gradient(180deg, #1e181d, #161216 46%, #141014);
  background-attachment: fixed;
  color: var(--paper);
  min-height: 100vh;
  line-height: 1.7;
}
::selection { background: rgba(201,169,97,.35); }

/* 纸纹噪点（页面加 <div class="grain"></div>） */
.grain { position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- 朱印 ---------- */
.chop { position: relative; display: inline-block; font-weight: 700; color: #f4e4d0;
  background: radial-gradient(130% 150% at 32% 26%, #b8402c, #952f1f 56%, #7c2517);
  filter: url(#roughen); transform: rotate(var(--rot, -2deg)); }
.chop::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5' numOctaves='2' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .38 0'/%3E%3C/filter%3E%3Crect width='80' height='80' filter='url(%23s)'/%3E%3C/svg%3E"); }
.chop.hollow { background: none; color: rgba(236,231,219,.62); box-shadow: inset 0 0 0 1.5px rgba(201,169,97,.55); }
.chop.hollow::after { opacity: .25; }

/* ---------- 章节题眉：鱼尾 + 题字 + 引线 ---------- */
.kicker { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.kicker::before { content: ''; width: 19px; height: 12px; flex: none; background: var(--gilt); opacity: .85;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14'%3E%3Cpath d='M0 0h24v3.5L12 13 0 3.5z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14'%3E%3Cpath d='M0 0h24v3.5L12 13 0 3.5z'/%3E%3C/svg%3E") center/contain no-repeat; }
.kicker .zh { font-family: var(--kai); font-size: 16px; letter-spacing: .28em; color: var(--gilt); }
.kicker .en { font-family: var(--disp); font-size: 10px; letter-spacing: .46em; color: rgba(201,169,97,.42); padding-top: 2px; }
.kicker::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gilt-faint), transparent); }

/* ---------- 按钮 ---------- */
.btn {
  font-family: var(--serif); font-size: 14.5px; letter-spacing: .12em;
  padding: 8px 22px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(201,169,97,.45);
  background: rgba(201,169,97,.08); color: var(--gilt-soft);
  transition: all .2s;
}
.btn:hover { background: rgba(201,169,97,.18); border-color: rgba(201,169,97,.8); box-shadow: 0 0 16px rgba(201,169,97,.18); }
.btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.btn.primary {
  border: none; color: #1d1509; font-weight: 700;
  background: linear-gradient(180deg, #e9d2a2, #d6ba7f);
  box-shadow: inset 0 1px 0 rgba(255,245,218,.6), 0 0 0 1px rgba(201,169,97,.28), 0 6px 26px rgba(232,179,74,.18);
}
.btn.primary:hover, .btn.primary:active { transform: translateY(-1px);
  background: linear-gradient(180deg, #efdab0, #dcc189); color: #1d1509;
  box-shadow: inset 0 1px 0 rgba(255,245,218,.6), 0 0 0 1px rgba(201,169,97,.55), 0 8px 34px rgba(232,179,74,.35); }
.btn.ghost { border-color: rgba(236,231,219,.3); background: transparent; color: var(--paper-faint); }
.btn.ghost:hover { color: var(--paper); border-color: rgba(236,231,219,.5); box-shadow: none; }
.text-button { border: 0; background: none; color: var(--paper-faint); cursor: pointer;
  font-family: var(--serif); font-size: 13.5px; letter-spacing: .08em; }
.text-button:hover { color: var(--gilt-soft); }

/* ---------- 表单 ---------- */
input, select, textarea {
  font-family: var(--serif); font-size: 15px; padding: 9px 13px;
  border-radius: 6px; border: 1px solid rgba(201,169,97,.3);
  background: rgba(20,18,22,.8); color: var(--paper); outline: none; width: 100%;
}
input::placeholder, textarea::placeholder { color: rgba(236,231,219,.32); }
input:focus, textarea:focus, select:focus { border-color: rgba(201,169,97,.7); box-shadow: 0 0 0 2px rgba(201,169,97,.16); }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 26px;
  padding: 13px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid rgba(201,169,97,.16);
  background: rgba(8,7,9,.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 900;
  letter-spacing: .14em; color: var(--paper); text-decoration: none; white-space: nowrap; cursor: pointer; }
.topbar .brand .mini-seal { font-size: 9.5px; letter-spacing: .12em; padding: 3px 6px; --rot: -3deg; }
.topbar nav { display: flex; gap: 24px; }
.topbar nav a { font-size: 14px; letter-spacing: .14em; color: rgba(236,231,219,.66); text-decoration: none; transition: color .2s; }
.topbar nav a:hover { color: var(--gilt-soft); }
.topbar nav a.active { color: var(--gilt-soft); }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 13.5px; color: var(--paper-faint); letter-spacing: .08em; white-space: nowrap; }

/* ---------- 卡片与区块 ---------- */
.panel {
  border: 1px solid rgba(201,169,97,.26); border-radius: 10px;
  background: linear-gradient(170deg, rgba(52,44,46,.62), rgba(34,29,33,.55));
  box-shadow: inset 0 1px 0 rgba(236,231,219,.05);
}
.panel:hover { border-color: rgba(201,169,97,.42); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--paper-faint); }
.empty-state h3 { font-size: 17px; letter-spacing: .1em; color: rgba(236,231,219,.75); margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; margin-bottom: 16px; }

/* 状态小签 */
.state-pill { font-size: 11px; letter-spacing: .18em; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.state-pill.waiting { color: #aecf92; border: 1px solid rgba(140,180,105,.6); background: rgba(122,160,90,.12); }
.state-pill.building { color: #a9c8dc; border: 1px solid rgba(127,176,201,.55); background: rgba(127,176,201,.1); }
.state-pill.playing { color: #ecd29a; border: 1px solid rgba(224,181,111,.6); background: rgba(224,181,111,.1); }
.state-pill.ended { color: rgba(236,231,219,.64); border: 1px solid rgba(201,169,97,.3); background: rgba(201,169,97,.06); }

/* 在线点 */
.online-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #8fae68; box-shadow: 0 0 7px rgba(143,174,104,.6); }
.online-dot.off { background: rgba(236,231,219,.22); box-shadow: none; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5,4,6,.76);
  display: none; align-items: center; justify-content: center; z-index: 50;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.modal-mask.open { display: flex; }
.modal {
  position: relative;
  background: linear-gradient(170deg, #17151a, #100e12); color: var(--paper);
  border-radius: 10px; padding: 30px 34px; width: min(560px, 92vw);
  max-height: 86vh; overflow-y: auto;
  border: 1px solid rgba(201,169,97,.32);
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
.modal .eyebrow { font-family: var(--kai); font-size: 12.5px; letter-spacing: .3em; color: var(--gilt); margin-bottom: 6px; }
.modal h3 { font-size: 20px; letter-spacing: .12em; margin-bottom: 14px; }
.modal .modal-lede { font-size: 13.5px; color: var(--paper-faint); line-height: 1.9; margin-bottom: 6px; }
.modal label { display: block; font-size: 12.5px; color: var(--paper-dim); margin: 14px 0 6px; letter-spacing: .12em; }
.modal .row { display: flex; gap: 12px; }
.modal .row > * { flex: 1; }
.modal .actions { margin-top: 26px; display: flex; justify-content: flex-end; gap: 12px; }
.modal-x { position: absolute; right: 14px; top: 12px; border: 0; background: none; color: var(--paper-faint);
  font-size: 20px; cursor: pointer; line-height: 1; }
.modal-x:hover { color: var(--paper); }
.json-input { font-family: var(--mono); font-size: 12.5px; min-height: 160px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  background: rgba(20,18,22,.96); border: 1px solid rgba(201,169,97,.5);
  color: var(--gilt-soft); padding: 10px 26px; border-radius: 999px;
  font-size: 14px; letter-spacing: .08em; z-index: 99;
  box-shadow: 0 10px 34px rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }
.toast.err { border-color: rgba(192,68,47,.7); color: #e8a08c; }

/* ---------- 图标（mask 上色，配 icons.js 的 svg 亦可裸用） ---------- */
.ic { vertical-align: -2px; }
.gi { display: inline-block; width: 22px; height: 22px; flex: none;
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; background: currentColor; }

/* ---------- 页面容器 ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 44px); }
.page-title { font-size: clamp(24px, 3vw, 34px); font-weight: 900; letter-spacing: .1em; line-height: 1.5; }
.page-title em { font-style: normal; color: var(--gilt-soft); }
.page-lede { margin-top: 8px; font-size: 14.5px; line-height: 2; color: rgba(236,231,219,.75); max-width: 640px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 40px 0 16px; }
.section-head h2 { font-size: 19px; letter-spacing: .12em; }
.section-head p { font-size: 12.5px; color: rgba(236,231,219,.62); margin-top: 3px; }
.section-link { font-size: 13px; letter-spacing: .1em; color: rgba(236,231,219,.55); text-decoration: none;
  border-bottom: 1px solid rgba(236,231,219,.22); padding-bottom: 2px; }
.section-link:hover { color: var(--gilt-soft); }

@media (max-width: 860px) {
  .topbar { gap: 14px; }
  .topbar nav { gap: 14px; }
}
