/* 陨仙录
   两套主题：夜（墨色底，默认跟随系统）和昼（宣纸底）。颜色都在下面的变量里，规则里不写死颜色。
   宗门祖师堂：水墨远山，楷体标题，朱红印章，魂灯和命牌。
   颜色只有墨、金、朱、青四种用途；不用发光和渐变光效。
   楷体用系统自带的（Windows 楷体、苹果 楷体-简），国内打开不用额外下载字体。 */

:root {
  color-scheme: dark;
  --bg: #131210;
  --surface: #1a1916;
  --surface-2: #211f1b;
  --line: #2c2a25;
  --line-strong: #3d3a33;

  --text: #e9e3d6;
  --muted: #9b9486;
  --faint: #69645a;

  --accent: #c9963f;     /* 按钮 */
  --accent-ink: #1c1405;
  --gold: #ecca7c;       /* 飞升 */
  --cinnabar: #a8342b;   /* 朱印 */
  --relit: #86c2cf;      /* 你 / 还活着的数字 */
  --danger: #e07a66;
  --accent-hover: #d8a64f;

  --hero-bg: #171613;
  --mt-1: #1c1b19;       /* 远山 */
  --mt-2: #181715;
  --mt-3: #141311;       /* 近山，接近底色 */
  --you-bg: rgba(134, 194, 207, 0.07);
  --ascend-line: #5c4d2c;
  --ascend-bg: #1b1813;
  --tablet-hover: #57513f;
  --pending: #d9a441;
  --gone-bg: #171613;    /* 陨落的命牌 */
  --gone-name: #8e8778;
  --gone-title: #9a9384;
  --asc-border: #6b5a33; /* 飞升的命牌 */
  --asc-bg: #1f1b14;
  --asc-inner: #4b3f24;
  --crack-gap: #0c0b0a;
  --crack-edge: #4a443b;
  --backdrop: rgba(0, 0, 0, 0.7);
  --err-bg: #3a1a14;
  --err-text: #ffd6cc;
  --smoke: #6d6760;      /* 灭灯的余烟 */
  --bolt: #efe8ff;       /* 渡劫的紫雷 */
  --bolt-glow: #8f6bff;
  --storm: rgba(110, 92, 170, 0.42);
  --flash: rgba(170, 150, 255, 0.14);
  --pillar: rgba(255, 214, 120, 0.45);   /* 飞升光柱 */
  --sheen: rgba(255, 236, 190, 0.16);
  --ember: #ff5b2e;     /* 裂缝里的余烬 */
  --scorch: rgba(0, 0, 0, 0.6);
  --ash: #9a9284;
  --strike: #c8372a;    /* 朱笔 */
  --redflash: rgba(200, 40, 30, 0.35);
  --qi: #bfe6ff;        /* 炼气吸进来的灵气 */
  --star: #ece6ff;      /* 炼虚被吸进漩涡的星点 */
  --void: rgba(0, 0, 0, 0.85);
  --crane: #f4ead2;     /* 飞升的仙鹤 */
  --soul: #ffe7a8;      /* 元婴出窍的虚影 */

  /* 九个境界的颜色：从暗灰到金 */
  --r0: #5f5a52; --r1: #6d665b; --r2: #7e735f; --r3: #917f62; --r4: #a58c64;
  --r5: #b89a67; --r6: #caa96b; --r7: #dbb970; --r8: #ecca7c;

  --kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "BiauKai", "AR PL UKai CN", "Songti SC", serif;
  --sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 6px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

/* 昼：宣纸底，墨字，赭金按钮；境界颜色反过来，从浅灰到深金 */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3eee3;
  --surface: #faf7f0;
  --surface-2: #ece5d6;
  --line: #ddd4c2;
  --line-strong: #c7bba3;

  --text: #29241d;
  --muted: #6b6356;
  --faint: #978e7f;

  --accent: #9c6a22;
  --accent-ink: #fffaf0;
  --accent-hover: #87591a;
  --gold: #a0701a;
  --cinnabar: #b03a2e;
  --relit: #2d7a8c;
  --danger: #b4442f;

  --hero-bg: #ebe5d8;
  --mt-1: #ddd4c3;
  --mt-2: #e4dccd;
  --mt-3: #efe9de;
  --you-bg: rgba(45, 122, 140, 0.08);
  --ascend-line: #d2b77c;
  --ascend-bg: #f6eedb;
  --tablet-hover: #b9ab8f;
  --pending: #a8761c;
  --gone-bg: #ebe6db;
  --gone-name: #8a8274;
  --gone-title: #8a8274;
  --asc-border: #c9a85e;
  --asc-bg: #f7efdc;
  --asc-inner: #e3cf9f;
  --crack-gap: #9a8f7c;
  --crack-edge: #fbf8f1;
  --backdrop: rgba(41, 36, 29, 0.38);
  --err-bg: #f6ddd6;
  --err-text: #7a2414;
  --smoke: #a39a8b;
  --bolt: #5a3fd0;
  --bolt-glow: #a58cff;
  --storm: rgba(60, 50, 100, 0.28);
  --flash: rgba(90, 63, 208, 0.09);
  --pillar: rgba(214, 160, 40, 0.32);
  --sheen: rgba(255, 250, 230, 0.6);
  --ember: #c8321b;
  --scorch: rgba(80, 50, 25, 0.32);
  --ash: #8a8172;
  --strike: #b3261a;
  --redflash: rgba(180, 30, 20, 0.22);
  --qi: #3f86b0;
  --star: #6a5fb0;
  --void: rgba(30, 30, 60, 0.55);
  --crane: #3b352c;
  --soul: #b07a12;

  --r0: #958d7f; --r1: #8b8170; --r2: #837560; --r3: #7d6a50; --r4: #7a6142;
  --r5: #7a5a35; --r6: #835b26; --r7: #8c601d; --r8: #946516;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
h1, h2, h3 { margin: 0; font-family: var(--kai); font-weight: 700; text-wrap: balance; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.n-alive { color: var(--relit) !important; }
.n-gold { color: var(--gold) !important; }
.dao { font-family: var(--kai); font-weight: 700; }

/* ---------- 按钮与表单 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); background: transparent; }
.btn.danger:hover { border-color: var(--danger); }
.btn[disabled] { opacity: 0.55; cursor: progress; }

input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
  min-width: 0;
}
textarea { resize: vertical; width: 100%; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 13px; color: var(--muted); padding: 0; }
.field em { font-style: normal; color: var(--faint); margin-left: 6px; font-size: 12px; }
.field input, .field select, .field textarea { width: 100%; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dao-field input { max-width: 9em; font-family: var(--kai); font-size: 22px; letter-spacing: 0.3em; padding-block: 4px; }
.dao-field input::placeholder { font-size: 16px; letter-spacing: 0.05em; }
.dao-status { min-height: 1.2em; font-size: 12px; color: var(--muted); }
.dao-status.ok { color: var(--relit); }
.dao-status.bad { color: var(--danger); }
.inline-row { display: flex; gap: 8px; }
.inline-row input { flex: 1; }
.form-error { color: var(--danger); margin: 0; font-size: 14px; }
.counter-line { align-self: flex-end; margin: 0 !important; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 13px; cursor: pointer; }
.chips input:checked + span { background: var(--text); border-color: var(--text); color: var(--bg); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips.mode span { padding: 7px 14px; font-size: 14px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.tabs button {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 4px 0;
  font-family: var(--kai);
  font-size: 16px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tabs button small { font-family: var(--sans); font-size: 12px; color: var(--faint); margin-left: 3px; font-variant-numeric: tabular-nums; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--cinnabar); }

/* 境界名：楷体大字 + 小字分期，颜色随境界从暗到金 */
.realm { font-family: var(--kai); font-weight: 700; color: var(--rc, var(--text)); letter-spacing: 0.06em; white-space: nowrap; }
.realm small { font-size: 0.6em; font-weight: 400; margin-left: 0.15em; color: var(--muted); letter-spacing: 0; }
.realm.ascend { color: var(--gold); }

/* 九格修为条 */
.ticks { display: flex; gap: 3px; }
.ticks i { flex: 1; height: 3px; background: var(--line); }
.ticks i.on { background: var(--rc); }

/* ---------- 印章 ---------- */
.seal, .seal-sm, .seal-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cinnabar);
  color: #f6e9d8;
  font-family: var(--kai);
  font-weight: 700;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px var(--cinnabar), inset 0 0 0 3px rgba(246, 233, 216, 0.55);
  line-height: 1.1;
}
.seal-sm { width: 22px; height: 22px; font-size: 14px; margin-right: 8px; }
.seal { width: 54px; height: 54px; font-size: 18px; text-align: center; transform: rotate(-4deg); }

/* ---------- 魂灯 ---------- */
.lamp { display: inline-block; width: 20px; height: 33px; flex: none; }
.lamp.ascend { --fo: #f1dc9e; --fi: #fffaf0; }
.lamp.you { --fo: #7fc4d6; --fi: #eaf8fb; width: 22px; height: 36px; }
/* 宣纸底上浅色火苗看不清，昼里换深一点的 */
:root[data-theme="light"] .lamp.ascend { --fo: #d9a52e; --fi: #fbe7a6; }
:root[data-theme="light"] .lamp.you { --fo: #3b97ad; --fi: #cdeef5; }
.lamp .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 2.8s ease-in-out infinite; }
.lamp:nth-child(3n) .flame { animation-duration: 3.4s; animation-delay: -0.8s; }
.lamp:nth-child(4n + 1) .flame { animation-duration: 2.3s; animation-delay: -1.5s; }
.lamp:nth-child(5n + 2) .flame { animation-delay: -2.1s; }
@keyframes flicker {
  0%, 100% { transform: scale(1, 1); opacity: 1; }
  30% { transform: scale(0.94, 1.06) rotate(-2deg); }
  55% { transform: scale(1.04, 0.95) rotate(1.5deg); opacity: 0.9; }
  80% { transform: scale(0.97, 1.03); }
}

/* ---------- 顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { display: flex; align-items: center; gap: 22px; height: 54px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; font-family: var(--kai); font-weight: 700; font-size: 20px; letter-spacing: 0.08em; }
.nav { display: flex; gap: 18px; font-family: var(--kai); font-size: 16px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover, .nav a.on { color: var(--text); }
.actions { margin-left: auto; display: flex; gap: 8px; }
.theme-btn { width: 36px; padding-inline: 0; font-family: var(--kai); font-size: 16px; }

/* ---------- 开头：水墨远山 + 竖排标题 ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--hero-bg); }
.mountains { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 62%; display: block; }
.hero-inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: start; padding-block: 56px 96px; }
.hero-title { display: flex; align-items: flex-start; gap: 14px; }
.hero-title h1 {
  writing-mode: vertical-rl;
  font-size: clamp(56px, 7vw, 84px);
  line-height: 1;
  letter-spacing: 0.18em;
  color: var(--text);
}
.hero-title .seal { margin-top: calc(clamp(56px, 7vw, 84px) * 2.9); }
.hero-lead { margin: 6px 0 0; font-family: var(--kai); font-size: clamp(22px, 2.8vw, 30px); line-height: 1.6; color: var(--text); }
.hero-sub { margin: 18px 0 0; max-width: 34em; font-size: 15px; color: var(--muted); }
.path { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 26px 0 0; font-family: var(--kai); font-size: 19px; }
.path .step { color: var(--rc); font-weight: 700; }
.path .step.ascend { color: var(--gold); }
.path .dot { color: var(--faint); }

/* ---------- 通用区块 ---------- */
.block { padding-block: 46px 54px; border-bottom: 1px solid var(--line); }
.block-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 24px; margin-bottom: 22px; }
.block-head h2 { font-size: 28px; letter-spacing: 0.08em; }
.block-head h2 small { font-family: var(--sans); font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.summary { margin: 0; font-size: 14px; color: var(--muted); }
.summary b { color: var(--text); font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.empty { padding: 40px 0 10px; color: var(--muted); }
.empty p { margin: 0 0 12px; }
.more { display: flex; justify-content: center; margin-top: 26px; }

/* ---------- 魂灯殿 ---------- */
.hall { list-style: none; margin: 0 0 12px; padding: 0; border-top: 1px solid var(--line); }
.tier {
  display: grid;
  grid-template-columns: 8.5em minmax(0, 1fr) 7.5em;
  align-items: center;
  gap: 18px;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.tier:hover, .tier:focus-visible { background: var(--surface); outline: none; }
.tier.selected { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--rc, var(--gold)); }
.tier-head { display: flex; flex-direction: column; line-height: 1.3; }
.tier-name { font-family: var(--kai); font-weight: 700; font-size: 24px; color: var(--rc); letter-spacing: 0.1em; }
.ascend-tier .tier-name { color: var(--gold); }
.tier-range { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.lamps { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 4px; min-width: 0; }
.lamp-more, .lamp-none { font-size: 12px; color: var(--faint); margin-left: 6px; align-self: center; }
.you-lamp { display: inline-flex; align-items: flex-end; gap: 2px; margin-right: 8px; }
.you-lamp em { font-style: normal; font-size: 12px; color: var(--relit); border: 1px solid var(--relit); border-radius: 3px; padding: 0 4px; line-height: 16px; }
.tier-n { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tier-n b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 天骄榜 ---------- */
.rank-body { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 36px; align-items: start; }
.rank-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rank-row {
  display: grid;
  grid-template-columns: 3.2em 7.5em minmax(0, 1fr) 76px;
  align-items: center;
  gap: 14px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.rank-row:hover, .rank-row:focus-visible { background: var(--surface); outline: none; }
.rank-no { font-family: var(--kai); font-size: 16px; color: var(--faint); text-align: center; }
.seal-rank { width: 30px; height: 30px; font-size: 18px; justify-self: center; color: #f6e9d8; }
.rank-realm { font-size: 21px; }
.rank-who { min-width: 0; }
.rank-who strong { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-who strong .dao { font-size: 17px; }
.rank-who > span { display: block; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { text-align: right; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-val small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.rank-row.living .rank-val { color: var(--relit); }
.rank-row.gone .dao { color: var(--muted); }
.rank-gap { padding: 4px 0; text-align: center; color: var(--faint); border-bottom: 1px solid var(--line); list-style: none; }
.rank-row.you { cursor: default; background: var(--you-bg); box-shadow: inset 3px 0 0 var(--relit); }
.rank-row.you .rank-val, .rank-row.you .dao { color: var(--relit); }
.rank-empty { padding: 24px 8px; color: var(--muted); list-style: none; }
/* 天骄榜里的法器榜：行和其他榜一样，只是点不开 */
.rank-main { min-width: 0; }
.board-sub { gap: 4px 16px; margin: -8px 0 10px; }
.board-sub button { font-size: 14px; }
.gear-row { cursor: default; }
.gear-row:hover { background: none; }
.gear-name { font-size: 19px; overflow: hidden; text-overflow: ellipsis; }
.gear-row.few { opacity: 0.55; }
.gear-base { background: var(--surface); }
.gear-base .gear-name { color: var(--muted); font-weight: 400; }
.gear-base .rank-no { font-size: 13px; }
.board-note { margin: 10px 0 0; }

.my-rank { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.my-rank h3 { font-size: 20px; letter-spacing: 0.06em; }
.my-out { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; }
.my-out p { margin: 0; }
.my-out b { color: var(--relit); font-size: 17px; font-variant-numeric: tabular-nums; }
.my-out .muted { color: var(--muted); font-size: 13px; }
.my-out .btn { margin-top: 8px; }
.my-realm .realm { font-size: 34px; }

/* ---------- 在世道友 ---------- */
.realm-filter-note { margin: -8px 0 16px; font-size: 13px; color: var(--muted); }
.realm-filter-note .linkish { font-size: 13px; }
.ascend-stage { margin-bottom: 28px; padding: 18px; border: 1px solid var(--ascend-line); border-radius: var(--radius); background: var(--ascend-bg); }
.ascend-stage h3 { font-size: 24px; color: var(--gold); letter-spacing: 0.1em; }
.ascend-stage h3 small { font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.ascend-stage > .hint { margin: 2px 0 16px; }

/* ---------- 命牌 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px 16px; }
.tablet {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 16px 12px;
  --t-bg: var(--surface);
  --t-inner: var(--line);
  background: var(--t-bg);
  border: 1px solid var(--line-strong);
  border-radius: 46% 46% 6px 6px / 34px 34px 6px 6px;
  box-shadow: inset 0 0 0 5px var(--t-bg), inset 0 0 0 6px var(--t-inner);
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
}
.tablet:hover { border-color: var(--tablet-hover); }
.tablet.preview { cursor: default; }
.t-lamp { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); line-height: 0; }
.t-lamp .lamp { width: 13px; height: 21px; transform: scale(var(--ls, 1)); transform-origin: 50% 80%; }
.t-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 6px; }
.t-name {
  margin: 0;
  writing-mode: vertical-rl;
  font-family: var(--kai);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0.16em;
  color: var(--rc);
  padding: 6px 8px 6px 0;
  border-right: 1px solid var(--line);
  min-height: 7.2em;
}
.t-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.c-realm { font-size: 26px; line-height: 1.2; }
.c-days { margin: 0; font-size: 14px; color: var(--muted); }
.c-days b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.living .c-days { color: var(--relit); }
.c-dates, .c-cause { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 法器：用这一层的灵光色写，陨落的褪成灰 */
.c-gear { margin: 0; font-size: 13px; color: var(--muted); }
.c-gear b { font-family: var(--kai); font-size: 16px; font-weight: normal; letter-spacing: 0.04em; color: var(--sc, var(--text)); }
.tablet.gone .c-gear b { color: var(--gone-name); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--strike) 70%, transparent); }
.gear-field input { max-width: 14em; }
.c-cause .appeal-pending { color: var(--pending); }
.c-cause .appeal-rejected { color: var(--danger); }
.c-cause .appeal-revived { color: var(--relit); }
.c-note { margin: 4px 0 0; font-family: var(--kai); font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.c-foot { display: flex; justify-content: space-between; gap: 10px; margin: auto 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.c-foot span:last-child { font-family: var(--kai); font-size: 13px; }

.site-foot { padding-block: 28px 44px; color: var(--faint); font-size: 13px; }
.site-foot p { margin: 0 0 6px; max-width: 60em; }

/* ---------- 弹窗 ---------- */
.dlg {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 24px 22px 22px;
  overflow: auto;
  overflow-x: hidden;
}
.dlg.wide { width: min(820px, calc(100vw - 24px)); }
.dlg::backdrop { background: var(--backdrop); }
.dlg h2 { font-size: 24px; margin-bottom: 14px; letter-spacing: 0.06em; }
.dlg-close { position: absolute; right: 8px; top: 6px; margin: 0; z-index: 1; }
.dlg-close button { background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 6px 10px; }
.dlg-close button:hover { color: var(--text); }

.c-top { display: flex; justify-content: space-between; gap: 10px; margin: 0; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ex-detail { display: flex; flex-direction: column; gap: 8px; }
.ex-detail .c-top { padding-right: 32px; }
.ex-dao { display: flex; align-items: flex-end; gap: 10px; margin: 6px 0 0 !important; font-size: 36px !important; letter-spacing: 0.12em; }
.ex-realm { font-size: 30px; line-height: 1.2; }
.ex-facts { margin: 6px 0 0; display: grid; gap: 6px; font-size: 14px; }
.ex-facts > div { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); gap: 10px; }
.ex-facts dt { color: var(--muted); font-family: var(--kai); font-size: 15px; }
.ex-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.ex-note { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--kai); font-size: 18px; line-height: 1.7; overflow-wrap: anywhere; }
.ex-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.reg-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 26px; }
.reg-form { display: flex; flex-direction: column; gap: 16px; }
.reg-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.reg-preview { display: flex; flex-direction: column; gap: 8px; align-self: start; position: sticky; top: 0; }
.ts-box:empty { display: none; }

.code-box { display: flex; align-items: center; gap: 10px; margin: 14px 0; padding: 12px 14px; border: 1px dashed var(--accent); border-radius: var(--radius); }
.code-box span { color: var(--muted); font-size: 13px; }
.code-box code { font-family: var(--mono); font-size: 19px; letter-spacing: 0.06em; color: var(--accent); flex: 1; user-select: all; overflow-wrap: anywhere; }

/* 登录 / 登记：一个入口 */
.hub h2 { padding-right: 32px; }
#hub-lead { margin-bottom: 14px; }
.hub-opts { display: flex; flex-direction: column; gap: 10px; }
.hub-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; }
.hub-opt:hover, .hub-opt:focus-visible { border-color: var(--accent); }
.hub-opt:hover b { color: var(--accent); }
.hub-opt.off { opacity: 0.45; cursor: not-allowed; }
.hub-opt.off:hover { border-color: var(--line-strong); }
.hub-opt.off:hover b { color: inherit; }
.hub-ico { flex: none; display: grid; place-items: center; width: 26px; height: 26px; color: var(--muted); }
.hub-ico svg { width: 24px; height: 24px; }
.hub-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hub-txt b { font-family: var(--kai); font-size: 18px; font-weight: normal; letter-spacing: 0.06em; }
.hub-txt small { font-size: 12px; color: var(--muted); }
.hub-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.hub-foot > .linkish { align-self: flex-start; font-size: 13px; }
#local-list:empty { display: none; }
.find-form { display: flex; flex-direction: column; gap: 12px; }
.hub-back { display: block; margin-bottom: 16px; font-size: 13px; }
.hub-new { width: 100%; margin: 14px 0 8px; }
.btn.signed { background: transparent; color: var(--text); border-color: var(--line-strong); font-weight: normal; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 邮箱登录 */
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form .linkish { align-self: flex-start; }
#login-error { margin-top: 10px; }

/* 登记弹窗里的“密码 / 账号” */
.owner-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.owner-tip { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.owner-tip b { color: var(--text); }
.owner-tip .linkish { font-size: 13px; color: var(--accent); }

/* 我的命牌 */
.me-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.me-bar b { color: var(--text); }
.me-bar .linkish { font-size: 13px; }

/* 详情里“我是它的主人” */
.unlock { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.owned-note { margin: 0; }
#dlg-code form { margin-top: 18px; }

.mine-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mine-item > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-item > span:last-child { display: flex; gap: 6px; }
.linkish { background: none; border: 0; padding: 0; color: var(--faint); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 50;
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  max-width: calc(100vw - 32px);
}
.toast.err { background: var(--err-bg); color: var(--err-text); }

/* =====================================================================
   修为特效与陨落（等级说明见 app.js 的 levelOf）
   ===================================================================== */

/* ---------- 火的颜色和灵光：凡火橙 → 金白 → 青色灵火 → 紫焰 → 雷紫 → 飞升金焰 ----------
   --fo/--fi 是火苗外焰/内焰，--sc 是这一层的“灵光”颜色（光轮、法阵、流光、灵气都用它） */
.lv-0 { --sc: var(--rc); }
.lv-1 { --sc: #cdb27c; }
.lv-2 { --fo: #f0a43a; --fi: #fff0c8; --sc: #e8b84a; }
:root[data-theme="light"] .lv-1 { --sc: #8a6f3a; }
:root[data-theme="light"] .lv-2 { --sc: #9f7414; }
.lv-3 { --fo: #f2b443; --fi: #fff2c6; --sc: #e9b553; }
.lv-4 { --fo: #f7cd5c; --fi: #fffbe8; --sc: #f4d06e; }
.lv-5 { --fo: #3fc0d8; --fi: #e4fbff; --sc: #56cfe3; }
.lv-6 { --fo: #33b2e6; --fi: #eefcff; --sc: #4ec3f0; }
.lv-7 { --fo: #a072f4; --fi: #f6efff; --sc: #b48fff; }
.lv-8 { --fo: #8b6aff; --fi: #ffffff; --sc: #a88fff; }
.lv-9 { --fo: #ffcc55; --fi: #fffdf0; --sc: #ffd66e; }
:root[data-theme="light"] .lv-3 { --sc: #a87316; }
:root[data-theme="light"] .lv-4 { --sc: #9f7a12; }
:root[data-theme="light"] .lv-5 { --sc: #12869c; }
:root[data-theme="light"] .lv-6 { --sc: #1278a8; }
:root[data-theme="light"] .lv-7 { --sc: #6a3fc4; }
:root[data-theme="light"] .lv-8 { --sc: #5a3fd0; }
:root[data-theme="light"] .lv-9 { --sc: #b07d0a; }
/* 化神起火会发光，越高越亮；渡劫的雷焰跳得特别快 */
.lv-4 .lamp:not(.out) .flame { filter: drop-shadow(0 0 1.5px var(--fo)); }
.lv-5 .lamp:not(.out) .flame, .lv-6 .lamp:not(.out) .flame { filter: drop-shadow(0 0 2px var(--fo)) drop-shadow(0 0 4px var(--fo)); }
.lv-7 .lamp:not(.out) .flame, .lv-8 .lamp:not(.out) .flame, .lv-9 .lamp:not(.out) .flame {
  filter: drop-shadow(0 0 1.5px var(--fi)) drop-shadow(0 0 4px var(--fo)) drop-shadow(0 0 9px var(--fo));
}
.lv-8 .lamp .flame { animation-duration: 0.9s; }

/* ---------- 命牌：内容压在特效上面 ---------- */
.tablet > .t-body, .tablet > .c-foot, .tablet > .t-lamp { position: relative; z-index: 1; }
.tablet > .t-lamp { position: absolute; }
/* 底栏的字垫一层底色，云气、回纹从字缝后面过，不挡字 */
/* 字贴着字形垫一圈底色（不是方块），底下的光效从字缝后面过，闪光时也不会露出色块 */
.tablet.living .t-name, .tablet.living .t-info > *, .tablet.living .c-foot span { text-shadow: 0 0 2px var(--t-bg), 0 0 4px var(--t-bg), 0 0 7px var(--t-bg); }

/* 筑基起边框染色；金丹起内框也染；合体起多一道内框 */
.tablet.tint { border-color: color-mix(in srgb, var(--sc) 45%, var(--line-strong)); }
.tablet.tint:hover { border-color: color-mix(in srgb, var(--sc) 80%, var(--line-strong)); }
.tablet.framed { --t-inner: color-mix(in srgb, var(--sc) 50%, var(--line)); }
.tablet.lv-6, .tablet.lv-7, .tablet.lv-8, .tablet.lv-9 {
  box-shadow: inset 0 0 0 4px var(--t-bg), inset 0 0 0 5px var(--t-inner), inset 0 0 0 7px var(--t-bg), inset 0 0 0 8px color-mix(in srgb, var(--sc) 30%, var(--line));
}

/* 元婴起：底边一条回纹 */
.tablet.banded { padding-bottom: 22px; }
.t-band {
  position: absolute; left: 14px; right: 14px; bottom: 8px; height: 7px; z-index: 0;
  background: var(--sc); opacity: 0.65; pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M0 6.5H12M2.5 6.5V0.5H9.5V4.5H5.5V2.5' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") repeat-x left center / 12px 7px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M0 6.5H12M2.5 6.5V0.5H9.5V4.5H5.5V2.5' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") repeat-x left center / 12px 7px;
}

/* ---------- 光轮（化神起）和八卦符文环（合体起）。灯往下挪，环才不会被拱顶切掉 ---------- */
.t-ring {
  position: absolute; left: 50%; top: var(--fy, calc(16.8px - 9.5px * var(--ls, 1)));
  width: 44px; height: 44px; transform: translate(-50%, -50%); pointer-events: none; overflow: visible;
}
.t-ring.runic { width: 60px; height: 60px; }
.t-ring circle { fill: none; stroke: var(--sc); vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; }
.t-ring .r1 { stroke-width: 1.3; filter: drop-shadow(0 0 3px var(--sc)); animation: breathe 3.6s ease-in-out infinite; }
.t-ring .rune { transform-box: view-box; transform-origin: 20px 20px; animation: wheel 22s linear infinite; }
.t-ring .r2 { stroke-width: 0.8; stroke-dasharray: 1.5 2.5; opacity: 0.8; }
.t-ring text, .t-array text {
  fill: var(--sc); text-anchor: middle; dominant-baseline: central;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", "Noto Sans CJK SC", sans-serif;
}
.t-ring text { font-size: 4.8px; }
.t-ring .r3 { stroke-width: 0.9; opacity: 0.7; stroke-dasharray: 0.8 1.6; animation: wheel 12s linear infinite reverse; }
@keyframes breathe { 0%, 100% { transform: scale(0.92); opacity: 0.45; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes wheel { to { transform: rotate(360deg); } }

/* ---------- 大乘起：牌子背后一座大法阵，两层反着转 ---------- */
.t-array {
  position: absolute; left: 50%; top: 56%; width: 96%; max-width: 330px; aspect-ratio: 1;
  transform: translate(-50%, -50%); z-index: 0; pointer-events: none; opacity: 0.22; overflow: visible;
}
:root[data-theme="light"] .t-array { opacity: 0.18; }
.t-array circle, .t-array rect { fill: none; stroke: var(--sc); stroke-width: 0.5; }
.t-array .dash { stroke-dasharray: 1 2; }
.t-array text { font-size: 7px; }
.t-array .spin { transform-box: view-box; transform-origin: 50px 50px; animation: wheel 60s linear infinite; }
.t-array .spin2 { transform-box: view-box; transform-origin: 50px 50px; animation: wheel 26s linear infinite reverse; }

/* ---------- 合体起：一道流光绕着边框跑 ---------- */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.tablet.flow::after,
.ex-head:is(.lv-6, .lv-7, .lv-8, .lv-9):not(.gone)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; z-index: 3; pointer-events: none;
  background: conic-gradient(from var(--ang), #fff 0deg, var(--sc) 8deg, transparent 40deg 140deg, var(--sc) 172deg, #fff 180deg, var(--sc) 188deg, transparent 220deg 320deg, var(--sc) 352deg, #fff 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 3px var(--sc));
  animation: flow 5s linear infinite;
}
.tablet.lv-9.flow::after, .ex-head.lv-9::after { animation-duration: 3.5s; }
@keyframes flow { to { --ang: 360deg; } }

/* ---------- 炼虚起：底下一缕云气慢慢飘（飞升是金色祥云） ---------- */
.t-cloud { position: absolute; left: 6px; right: 6px; bottom: 20px; height: 16px; overflow: hidden; z-index: 0; opacity: 0.6; pointer-events: none; }
.t-cloud i {
  position: absolute; top: 0; bottom: 0; left: 0; right: -48px;
  background: var(--sc);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cpath d='M0 15C5 15 6 9 11 9C14 9 16 11 16.5 13C17 9 20 6 24 6C28.5 6 31 9.5 31 13C33 11 37 11 38.5 13.5C40.5 11.5 45 12 48 15' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") repeat-x left bottom / 48px 16px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cpath d='M0 15C5 15 6 9 11 9C14 9 16 11 16.5 13C17 9 20 6 24 6C28.5 6 31 9.5 31 13C33 11 37 11 38.5 13.5C40.5 11.5 45 12 48 15' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") repeat-x left bottom / 48px 16px;
  animation: drift 16s linear infinite;
}
@keyframes drift { to { transform: translateX(-48px); } }
.tablet.lv-9 .t-cloud { opacity: 0.9; height: 18px; }

/* ---------- 合体起：灵气往上飘，越高越多越亮 ---------- */
.t-motes { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.t-motes i {
  position: absolute; bottom: 30px; width: var(--s, 3px); height: var(--s, 3px); border-radius: 50%;
  background: var(--sc); box-shadow: 0 0 5px 1px var(--sc); opacity: 0;
  animation: rise var(--t, 6s) ease-out var(--d, 0s) infinite;
}
@keyframes rise {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  15% { opacity: 1; }
  60% { transform: translate(var(--sway, 0px), calc(var(--rise, -200px) * 0.6)) scale(1); }
  100% { transform: translate(calc(var(--sway, 0px) * -0.4), var(--rise, -200px)) scale(0.4); opacity: 0; }
}

/* ---------- 渡劫：两层雷云压顶，两道紫雷轮流劈下，劈中时牌子一震 ---------- */
.t-storm { position: absolute; left: 0; right: 0; top: 0; height: 28px; overflow: hidden; z-index: 0; transform: scaleY(-1); pointer-events: none; }
.t-storm i {
  position: absolute; left: 0; right: -48px; bottom: 0; height: 16px;
  background: var(--storm);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cpath d='M0 16V15C5 15 6 9 11 9C14 9 16 11 16.5 13C17 9 20 6 24 6C28.5 6 31 9.5 31 13C33 11 37 11 38.5 13.5C40.5 11.5 45 12 48 15V16Z' fill='black'/%3E%3C/svg%3E") repeat-x left bottom / 48px 16px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cpath d='M0 16V15C5 15 6 9 11 9C14 9 16 11 16.5 13C17 9 20 6 24 6C28.5 6 31 9.5 31 13C33 11 37 11 38.5 13.5C40.5 11.5 45 12 48 15V16Z' fill='black'/%3E%3C/svg%3E") repeat-x left bottom / 48px 16px;
  animation: drift 7s linear infinite reverse;
}
.t-storm i + i { bottom: 9px; opacity: 0.8; animation-duration: 11s; animation-direction: normal; }
.t-bolt {
  position: absolute; top: 4px; width: 32px; height: 62%; z-index: 2; opacity: 0; pointer-events: none;
  filter: drop-shadow(0 0 3px var(--bolt-glow)) drop-shadow(0 0 7px var(--bolt-glow));
  animation: bolt var(--t, 7s) linear var(--d, 0s) infinite;
}
.t-bolt path { fill: none; stroke: var(--bolt); stroke-width: 2; stroke-linejoin: miter; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.t-bolt .fork { stroke-width: 1.1; }
/* 闪一下的那层盖在最上面，整块牌子一起亮 */
.t-flash { position: absolute; inset: 0; z-index: 2; background: var(--flash); opacity: 0; pointer-events: none; animation: bolt var(--t, 7s) linear var(--d, 0s) infinite; }
@keyframes bolt { 0%, 86%, 100% { opacity: 0; } 87% { opacity: 1; } 88.5% { opacity: 0.15; } 90% { opacity: 1; } 93% { opacity: 0; } }
@keyframes quake-a { 0%, 86.5%, 92%, 100% { translate: 0 0; } 87.2% { translate: -3px 1px; } 88% { translate: 3px -1px; } 89% { translate: -2px 1px; } 90.2% { translate: 1px 0; } }
@keyframes quake-b { 0%, 86.5%, 92%, 100% { rotate: 0deg; } 87.2% { rotate: -0.8deg; } 88% { rotate: 0.7deg; } 89.5% { rotate: -0.3deg; } }

/* ---------- 飞升：金色光柱从天而降，金光一遍遍扫过，雷劫已过 ---------- */
.tablet.ascended { --t-bg: var(--asc-bg); --t-inner: var(--asc-inner); border-color: var(--asc-border); }
.tablet.ascended .t-name { color: var(--gold); }
.t-pillar {
  position: absolute; left: 50%; top: -12px; width: 76px; height: 78%; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom, var(--pillar), transparent);
  filter: blur(8px); transform: translateX(-50%);
  animation: pillar 3.2s ease-in-out infinite;
}
@keyframes pillar { 0%, 100% { opacity: 0.55; transform: translateX(-50%) scaleX(0.8); } 50% { opacity: 1; transform: translateX(-50%) scaleX(1.15); } }
.t-sheen {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, var(--sheen) 48%, transparent 58%) no-repeat;
  background-size: 260% 100%;
  animation: sheen 5.5s ease-in-out infinite;
}
@keyframes sheen { 0% { background-position: 130% 0; } 45%, 100% { background-position: -30% 0; } }

/* =====================================================================
   各境界的招牌特效：canvas 画在命牌底下（见 fx.js），这里只放它的位置和几样 DOM 的
   ===================================================================== */
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* 渡劫：被雷劈中那一下，整块牌子一震 */
.struck { animation: struck 0.42s ease-out; }
@keyframes struck {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  15% { translate: -4px 2px; rotate: -0.9deg; }
  35% { translate: 4px -2px; rotate: 0.8deg; }
  55% { translate: -2px 1px; rotate: -0.3deg; }
  75% { translate: 1px 0; rotate: 0deg; }
}

/* 元婴 · 元婴出窍：道号上隔一会儿飘出一道发光的虚影，往上升、散掉 */
.tablet.living .t-name, .ex-name { position: relative; }
.sig-soul {
  position: absolute; inset: 0; padding: inherit; pointer-events: none; white-space: nowrap;
  color: var(--soul); opacity: 0; text-shadow: 0 0 4px var(--soul), 0 0 12px var(--soul), 0 0 24px var(--soul);
  animation: soul 4.6s ease-in-out infinite;
}
@keyframes soul {
  0%, 30% { opacity: 0; transform: translate(0, 0) scale(1); filter: blur(0); }
  42% { opacity: 1; }
  100% { opacity: 0; transform: translate(-3px, -34px) scale(1.1); filter: blur(3px); }
}

/* 飞升 · 羽化登仙：整块牌子浮起来上下浮动，仙鹤从天上飞过 */
.tablet.lv-9.living, .ex-head.lv-9:not(.gone) { animation: levitate 4.6s ease-in-out infinite; }
.tablet.lv-9.living { filter: drop-shadow(0 10px 12px color-mix(in srgb, var(--gold) 22%, transparent)); }
@keyframes levitate { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
.sig-crane { position: absolute; top: 24%; left: -20%; width: 46px; height: 23px; z-index: 1; pointer-events: none; opacity: 0; animation: crane-fly 11s linear infinite; }
.sig-crane .body { fill: var(--crane); stroke: var(--crane); stroke-width: 0.6; }
.sig-crane path.body + path.body { fill: none; stroke-width: 1; }
.sig-crane .wing { fill: var(--crane); transform-box: fill-box; transform-origin: 50% 100%; animation: flap 0.7s ease-in-out infinite alternate; }
.sig-crane .crest { fill: var(--cinnabar); }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(-0.7); } }
@keyframes crane-fly {
  0% { left: -20%; top: 26%; opacity: 0; }
  4% { opacity: 0.95; }
  30% { top: 16%; }
  55% { left: 110%; top: 22%; opacity: 0.95; }
  56%, 100% { left: 110%; opacity: 0; }
}
.ex-head .sig-crane { top: 12%; }

/* =====================================================================
   陨落：灯灭倒地、牌子焦黑、带着余烬裂开，元婴起断成两半，朱笔勾销道号，灰烬飘落
   ===================================================================== */
.shards { position: relative; display: flex; flex-direction: column; min-width: 0; transform: rotate(var(--tilt, 0deg)); }
.shards > .tablet:first-child { flex: 1; }
.shards > .shard-b { position: absolute; inset: 0; pointer-events: none; transform: var(--split); }

.tablet.gone { --t-bg: var(--gone-bg); --t-inner: var(--line); border-color: var(--line-strong); }
.tablet.gone.framed { --t-inner: var(--line-strong); }
.tablet.gone:hover { border-color: var(--tablet-hover); }
.tablet.gone .t-name { color: var(--gone-name); position: relative; }
.tablet.gone .c-realm { color: color-mix(in srgb, var(--rc) 30%, var(--gone-name)); }
.tablet.gone .ticks i.on { background: color-mix(in srgb, var(--rc) 30%, var(--gone-name)); }
.tablet.gone .t-band { background: var(--gone-name); opacity: 0.35; }
/* 字的周围垫一圈底色（贴着字形，不是方块），裂痕、灰烬从字缝后面过 */
.tablet.gone .t-info > *, .tablet.gone .t-name, .tablet.gone .c-foot span {
  background: none; box-shadow: none;
  text-shadow: 0 0 2px var(--t-bg), 0 0 3px var(--t-bg), 0 0 5px var(--t-bg);
}
/* 灯倒了 */
.tablet.gone .t-lamp .lamp { transform: rotate(-28deg) scale(var(--ls, 1)); transform-origin: 50% 90%; }
/* 边缘烧焦 */
.t-scorch {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 28px 4px var(--scorch);
  background: radial-gradient(ellipse 80% 40% at 50% 112%, var(--scorch), transparent 70%);
}
/* 裂痕：黑缝 + 里面一线没熄的余烬 + 亮边 */
.crack { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.crack path { fill: none; stroke-linejoin: bevel; vector-effect: non-scaling-stroke; }
.crack .gap { stroke: var(--crack-gap); stroke-width: 3.8; }
.crack .ember { stroke: var(--ember); stroke-width: 1.2; filter: drop-shadow(0 0 2px var(--ember)) drop-shadow(0 0 5px var(--ember)); animation: ember 2.4s ease-in-out infinite; }
.crack .edge { stroke: var(--crack-edge); stroke-width: 1; opacity: 0.7; }
@keyframes ember { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
/* 申诉成功：裂痕用金补上，不再冒火 */
.mended .crack .gap { stroke: var(--gold); stroke-width: 2.6; }
.mended .crack .ember, .mended .crack .edge { display: none; }
.mended .t-ash { display: none; }
/* 朱笔勾销 */
.t-strike { position: absolute; left: 50%; top: 3%; width: 30px; height: 94%; transform: translateX(-50%); z-index: 2; pointer-events: none; overflow: visible; }
.t-strike path { fill: var(--strike); opacity: 0.9; }
.t-strike.h { left: -3%; top: 52%; width: 106%; height: 0.7em; transform: translateY(-50%); }
/* 灰烬往下飘 */
.t-ash { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.t-ash i {
  position: absolute; top: 14px; width: var(--s, 3px); height: var(--s, 3px); border-radius: 1px;
  background: var(--ash); opacity: 0;
  animation: ash var(--t, 7s) linear var(--d, 0s) infinite;
}
@keyframes ash {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 0.85; }
  100% { transform: translate(var(--sway, 0px), var(--fall, 280px)) rotate(320deg); opacity: 0; }
}
/* 灭了的灯，余烟慢慢晃 */
.lamp .smoke { transform-box: fill-box; transform-origin: 50% 100%; }
.t-lamp .lamp.out .smoke, .ex-lamp .lamp .smoke { animation: smoke 5s ease-in-out infinite; }
@keyframes smoke { 0%, 100% { transform: translateY(0) skewX(0deg); opacity: 0.85; } 50% { transform: translateY(-2px) skewX(-9deg); opacity: 0.35; } }

/* 第一次滚进屏幕：裂开 → 震一下 → 断开的半块歪出去 → 朱笔划下来 */
@media (prefers-reduced-motion: no-preference) {
  .shards.pre-shatter .crack { clip-path: inset(0 0 100% 0); }
  .shards.shatter .crack { animation: crack-in 0.45s cubic-bezier(0.3, 0.7, 0.4, 1) forwards; }
  .shards.shatter { animation: shake 0.5s 0.15s; }
  .shards.pre-shatter > .shard-b { transform: none; }
  .shards.shatter > .shard-b { animation: split-off 0.55s 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.25) forwards; }
  .shards.pre-shatter .t-strike { clip-path: inset(0 0 100% 0); }
  .shards.shatter .t-strike { animation: crack-in 0.4s 0.8s ease-out forwards; }
}
@keyframes crack-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes split-off { from { transform: none; } to { transform: var(--split); } }
@keyframes shake {
  0%, 100% { transform: rotate(var(--tilt, 0deg)); }
  15% { transform: translate(-4px, 2px) rotate(calc(var(--tilt, 0deg) - 1deg)); }
  35% { transform: translate(4px, -2px) rotate(calc(var(--tilt, 0deg) + 0.8deg)); }
  55% { transform: translate(-3px, 1px) rotate(var(--tilt, 0deg)); }
  75% { transform: translate(2px, 0) rotate(var(--tilt, 0deg)); }
}

/* =====================================================================
   魂灯殿：越高的一层灯越大、火越亮；渡劫那层劈雷，飞升那层飘金色灵气
   ===================================================================== */
.tier { position: relative; overflow: hidden; }
.tier > .tier-head, .tier > .lamps, .tier > .tier-n { position: relative; z-index: 1; }
.tier .lamps .lamp { width: calc(20px * var(--ls, 1)); height: calc(33px * var(--ls, 1)); }
.tier .lamps .lamp.you { width: calc(22px * var(--ls, 1)); height: calc(36px * var(--ls, 1)); }
.tier .t-bolt { top: 0; height: 100%; width: 22px; }
.tier .t-motes i { bottom: 4px; --rise: -60px; }

/* =====================================================================
   详情头：和命牌同一套
   ===================================================================== */
.ex-detail { position: relative; }
.ex-shards { position: relative; }
.ex-shards > .shard-b { position: absolute; inset: 0; pointer-events: none; transform: var(--split); }
.ex-head {
  --t-bg: var(--surface);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 2px; padding: 12px 16px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--t-bg);
}
.ex-head:not(.lv-0):not(.gone) { border-color: color-mix(in srgb, var(--sc) 50%, var(--line-strong)); }
.ex-head.ascended { --t-bg: var(--asc-bg); border-color: var(--asc-border); }
.ex-head.gone { --t-bg: var(--gone-bg); }
.ex-head:has(.t-band) { padding-bottom: 24px; }
.ex-head:has(.t-cloud) { padding-bottom: 42px; } /* 云气放在修为条下面，不压着它 */
.ex-head > h2, .ex-head > .realm, .ex-head > .ticks { position: relative; z-index: 1; }
.ex-head .t-cloud { bottom: 18px; }
.ex-head .t-motes i { bottom: 12px; --rise: -120px; }
.ex-head .t-bolt { height: 90%; }
.ex-head .t-array { left: auto; right: -40px; top: 50%; width: 230px; transform: translateY(-50%); }
.ex-head .t-pillar { left: 44px; top: -20px; height: 140%; }
.ex-head .t-ash i { top: 0; --fall: 180px; }
.ex-lamp { position: relative; display: inline-flex; line-height: 0; }
.ex-lamp .lamp { width: 18px; height: 30px; transform: scale(var(--ls, 1)); transform-origin: 50% 85%; }
.ex-lamp:has(.t-ring) { margin: 0 8px 0 12px; }
.ex-lamp:has(.t-ring.runic) { margin: 0 14px 0 20px; }
.ex-lamp .t-ring { top: 36%; width: 58px; height: 58px; }
.ex-lamp .t-ring.runic { width: 76px; height: 76px; }
.ex-name { position: relative; }
.ex-detail.gone .ex-dao { color: var(--gone-title); }
.ex-head.gone .realm { color: color-mix(in srgb, var(--rc) 30%, var(--gone-title)); }
.ex-head.gone .ticks i.on { background: color-mix(in srgb, var(--rc) 30%, var(--gone-title)); }
.ex-head.gone .lamp.dying .flame { opacity: 0; }
.ex-redflash { position: absolute; inset: -24px -22px -22px; z-index: 5; background: var(--redflash); opacity: 0; pointer-events: none; }

/* 打开陨落的记录：火苗疯狂乱窜后熄灭 → 一道血光、整个弹窗剧震 → 牌子裂开、断成两半 → 朱笔划掉道号 → 灰往下落 */
@media (prefers-reduced-motion: no-preference) {
  .ex-head.gone .lamp.dying .flame { animation: die 1.1s ease-in forwards; }
  .ex-head.gone .lamp.dying .smoke { opacity: 0; animation: smoke-in 0.8s 1.15s forwards, smoke 5s 1.95s ease-in-out infinite; }
  .ex-head.gone .ex-dao { animation: to-grey 0.5s 1s both; }
  .ex-head.gone .realm, .ex-head.gone .ticks { animation: to-ash 0.5s 1s both; }
  .ex-head.gone .crack { clip-path: inset(0 0 100% 0); animation: crack-in 0.35s 1s forwards; }
  .ex-shards.split > .shard-b { transform: none; animation: split-off 0.6s 1.3s cubic-bezier(0.2, 0.9, 0.25, 1.25) forwards; }
  .ex-head.gone .t-strike { clip-path: inset(0 100% 0 0); animation: strike-in 0.45s 1.6s ease-out forwards; }
  .ex-detail.gone { animation: quake-hard 0.6s 1s; }
  .ex-redflash { animation: redflash 0.8s 1s; }
}
@keyframes die {
  0% { transform: scale(1); opacity: 1; }
  10% { transform: scale(1.25, 0.8) skewX(-12deg); }
  20% { transform: scale(0.8, 1.3) skewX(10deg); }
  30% { transform: scale(1.3, 0.7); }
  40% { transform: scale(0.7, 1.4) skewX(-14deg); opacity: 0.8; }
  52% { transform: scale(1.2, 0.9); opacity: 1; }
  62% { transform: scale(0.6, 1.2) skewX(8deg); opacity: 0.7; }
  75% { transform: scale(1.5, 0.5); opacity: 1; }
  85% { transform: scale(0.4, 0.3); opacity: 0.5; }
  100% { transform: scale(0.05, 0.02); opacity: 0; }
}
@keyframes smoke-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 0.85; transform: none; } }
@keyframes to-grey { from { color: var(--rc); } to { color: var(--gone-title); } }
@keyframes to-ash { from { filter: none; } to { filter: grayscale(1); } }
@keyframes strike-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes redflash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
@keyframes quake-hard {
  0%, 100% { transform: none; }
  10% { transform: translate(-8px, 3px) rotate(-0.6deg); }
  25% { transform: translate(8px, -3px) rotate(0.5deg); }
  40% { transform: translate(-6px, 2px); }
  60% { transform: translate(4px, -1px); }
  80% { transform: translate(-2px, 0); }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .nav { display: none; }
  .topbar-inner { gap: 10px; }
  .actions .btn { padding: 6px 10px; font-size: 13px; }
  .hero-inner { grid-template-columns: 1fr; gap: 20px; padding-block: 30px 80px; }
  .hero-title { order: -1; align-items: center; }
  .hero-title h1 { writing-mode: horizontal-tb; font-size: 48px; letter-spacing: 0.12em; }
  .hero-title .seal { margin-top: 0; width: 44px; height: 44px; font-size: 15px; }
  .hero-lead { font-size: 21px; }
  .path { font-size: 16px; }
  .tier { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .tier-head { flex-direction: row; align-items: baseline; gap: 8px; }
  .tier-name { font-size: 20px; }
  .lamps { grid-column: 1 / -1; grid-row: 2; }
  .tier-n { grid-column: 2; grid-row: 1; }
  .rank-body, .reg-grid { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 2.6em 5.4em minmax(0, 1fr) 54px; gap: 8px; }
  .rank-realm { font-size: 17px; }
  .gear-row { grid-template-columns: 2.6em 6.4em minmax(0, 1fr) 44px; }
  .gear-name { font-size: 14px; letter-spacing: 0.02em; }
  .my-rank { position: static; }
  .reg-preview { position: static; order: -1; }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .row2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .lamp .flame, .lamp .smoke, .t-ring *, .t-array g, .t-cloud i, .t-storm i, .crack .ember, .t-pillar,
  .tablet, .tablet::after, .ex-head, .ex-head::after, .shards, .ex-detail { animation: none !important; }
  .t-motes, .t-bolt, .t-flash, .t-ash, .t-sheen, .ex-redflash, .sig-crane, .sig-soul { display: none; }
  .struck { animation: none !important; }
  .lamp.dying .smoke { opacity: 0.85; }
}
