/*
 * Tim · material and interaction refinement for the three standalone pages.
 * Existing layout, typography, DOM and behavior remain owned by each page.
 * Each family is isolated by an existing page-specific marker.
 */

/* Makeup: opal surfaces, precise selected states, warm light on the copy action. */
body:has(#module-skin) {
  --bg: #f2f6f9;
  --surface: #fdfeff;
  --surface-2: #f0f5f8;
  --ink: #25333d;
  --ink-soft: #596176;
  --ink-faint: #687187;
  --line: #dfe3ef;
  --line-strong: #bcc5dc;
  --accent: #2f7fc4;
  --accent-soft: #edf3f9;
  --accent-ink: #507399;
  --ok: #33715d;
  --ok-soft: #e6f2eb;
  --warn: #8a612d;
  --warn-soft: #f7efdf;
  --shadow: inset 0 1px 0 #fff, 0 2px 5px rgba(45,68,86,.025), 0 15px 36px -23px rgba(62,88,110,.23);
  background:
    radial-gradient(ellipse at 8% 1%, rgba(184,209,231,.21), transparent 40rem),
    radial-gradient(ellipse at 95% 9%, rgba(207,219,235,.18), transparent 32rem),
    var(--bg);
}

body:has(#module-skin) ::selection {
  color: #243640;
  background: #d8ebf5;
}

body:has(#module-skin) .masthead {
  border-bottom-color: #d9deed;
}

body:has(#module-skin) :is(.panel, .preview-box, .card, .table-wrap) {
  background: linear-gradient(145deg, rgba(255, 255, 255, .97), rgba(249,253,255,.92));
  border-color: #dce1ed;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

body:has(#module-skin) .preview-box {
  border-color: #cfd6e9;
  box-shadow: inset 0 1px 0 #fff, 0 3px 10px rgba(62,88,110,.025), 0 22px 46px -28px rgba(88,117,147,.3);
}

body:has(#module-skin) .conclusion {
  color: #4d5c6c;
  background: linear-gradient(110deg, #ebf3f8, #f2f6f7);
  border-left-color: #83a0c2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

body:has(#module-skin) nav.modules button {
  background: linear-gradient(180deg, #fff, #f3f7fa);
  border-color: #d4dbea;
  color: #576078;
  box-shadow: inset 0 1px 0 #fff, 0 2px 5px rgba(52,78,97,.035);
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

body:has(#module-skin) nav.modules button:hover {
  color: #466483;
  border-color: #afc3d5;
  box-shadow: inset 0 1px 0 #fff, 0 3px 12px rgba(94,124,157,.09);
}

body:has(#module-skin) nav.modules button.active {
  color: #fff;
  border-color: #566b7d;
  background: linear-gradient(125deg, #364a59, #56697d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 5px 15px -7px rgba(70,97,127,.42);
}

body:has(#module-skin) .opt {
  background: linear-gradient(120deg, #fff, #fbfdfe);
  border-color: #e0e4ee;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 #fff;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

body:has(#module-skin) .opt:hover {
  border-color: #b7bfd8;
  background: #f8fcff;
}

body:has(#module-skin) .opt.checked {
  border-color: #a8bcd2;
  background: linear-gradient(115deg, #edf3f9, #f6f9fd);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 14px rgba(173,208,226,.055);
}

body:has(#module-skin) .opt:focus-within {
  border-color: #7a96b6;
  box-shadow: 0 0 0 3px rgba(130,160,194,.14), inset 0 1px 0 #fff;
}

body:has(#module-skin) .copy-btn {
  color: #fff;
  border-color: #64717f;
  border-radius: 8px;
  background: radial-gradient(ellipse at 100% 0, rgba(239, 184, 152, .4), transparent 75%), linear-gradient(120deg, #3e5262, #5c6e79);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 9px -4px rgba(78,108,123,.42);
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

body:has(#module-skin) .copy-btn:hover {
  border-color: #98a1ae;
  background: radial-gradient(ellipse at 100% 0, rgba(250, 190, 151, .58), transparent 75%), linear-gradient(120deg, #415564, #62737f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 17px -6px rgba(195, 137, 114, .48);
}

body:has(#module-skin) .copy-btn:active {
  box-shadow: inset 0 2px 4px rgba(25,37,47,.25);
}

body:has(#module-skin) .copy-btn.done {
  background: linear-gradient(135deg, #34725d, #43816b);
  border-color: #34725d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 3px 10px -5px rgba(51, 113, 93, .3);
}

body:has(#module-skin) pre.preview {
  color: #41495e;
  background: linear-gradient(145deg, #f0f2f9, #f5f9fb);
  border-color: #dce1ed;
  border-radius: 9px;
  box-shadow: inset 0 1px 3px rgba(66,91,111,.035);
  scrollbar-color: #c4c9dd transparent;
}

body:has(#module-skin) th {
  background: linear-gradient(180deg, #f4f8fb, #edeff7);
}

body:has(#module-skin) .module :is(button, input):focus-visible,
body:has(#module-skin) nav.modules button:focus-visible {
  outline: 2px solid #7893b4;
  outline-offset: 3px;
}

/* Shanhai: neutral image stages retain the artwork and the category colors. */
body:has(#c-vol) {
  --paper: #f2f4fa;
  --card: #fcfdff;
  --ink: #2c3943;
  --sub: #646d80;
  --line: #dce1ed;
  --accent: #56718f;
  --gold: #688394;
  background:
    radial-gradient(ellipse at 6% 0%, rgba(198,223,239,.25), transparent 42rem),
    radial-gradient(ellipse at 96% 10%, rgba(215,224,238,.23), transparent 35rem),
    var(--paper);
}

body:has(#c-vol) ::selection {
  background: #d8ebf5;
  color: #243640;
}

body:has(#c-vol) .seal {
  background: linear-gradient(145deg, #485e70, #657a8b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 14px -7px rgba(71,106,126,.4);
  border-radius: 5px;
}

body:has(#c-vol) .stats b {
  color: #586e86;
  text-shadow: 0 1px 0 #fff;
}

body:has(#c-vol) .toolbar {
  background: linear-gradient(180deg, rgba(242, 244, 250, .96) 72%, rgba(242, 244, 250, .82));
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  backdrop-filter: blur(18px) saturate(125%);
}

body:has(#c-vol) #q {
  color: var(--ink);
  background: linear-gradient(145deg, #fff, #fafbff);
  border-color: #d1d8e8;
  box-shadow: inset 0 1px 2px rgba(62,89,110,.035), 0 2px 5px rgba(62,89,110,.025);
}

body:has(#c-vol) #q::placeholder {
  color: #768095;
}

body:has(#c-vol) #q:focus {
  border-color: #94aac3;
  box-shadow: 0 0 0 3px rgba(139,165,195,.15), inset 0 1px 0 #fff;
}

body:has(#c-vol) .tab {
  color: #5d657b;
  border-color: #d3dbea;
  background: linear-gradient(180deg, #fff, #f4f8fb);
  box-shadow: inset 0 1px 0 #fff, 0 2px 5px rgba(51,76,96,.025);
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

body:has(#c-vol) .tab:hover {
  border-color: #a7b8cb;
  color: #475f7b;
  box-shadow: inset 0 1px 0 #fff, 0 3px 12px -6px rgba(94,124,157,.3);
}

body:has(#c-vol) .tab.on {
  color: #fff;
  background: linear-gradient(125deg, #445a6b, #627a8c);
  border-color: #5b7684;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 12px -7px rgba(76,112,136,.4);
}

body:has(#c-vol) .vol-head {
  border-bottom-color: #d5dceb;
}

body:has(#c-vol) .vol-head .grp {
  color: #607380;
  border-color: #c9d8e2;
  background: rgba(255, 255, 255, .55);
  border-radius: 5px;
}

body:has(#c-vol) .item {
  background: linear-gradient(145deg, #fff, #f9fdff);
  border-color: #dce2ef;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 5px rgba(44,69,88,.025), 0 13px 25px -24px rgba(72,101,129,.33);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

body:has(#c-vol) .item:hover {
  border-color: #a8bed4;
  box-shadow: inset 0 1px 0 #fff, 0 7px 20px -10px rgba(89,118,145,.25), 0 0 0 1px rgba(172,195,219,.1);
}

body:has(#c-vol) .item .thumb,
body:has(#c-vol) .dlg .fig {
  background: linear-gradient(140deg, #f1f5f7, #eceef5);
}

body:has(#c-vol) .item .thumb {
  box-shadow: inset 0 0 0 1px rgba(139, 148, 175, .09);
}

body:has(#c-vol) .item .thumb.thumb-none {
  color: #767f93;
  border-color: #cbd2e3;
}

body:has(#c-vol) .tag {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65), 0 1px 5px rgba(45,63,77,.08);
}

body:has(#c-vol) .mask {
  background: rgba(25,37,47,.48);
  -webkit-backdrop-filter: blur(8px) saturate(85%);
  backdrop-filter: blur(8px) saturate(85%);
}

body:has(#c-vol) .dlg {
  background: linear-gradient(145deg, #fff, #f7fbfe);
  border-color: rgba(218, 222, 240, .95);
  box-shadow: inset 0 1px 0 #fff, 0 35px 90px rgba(23,39,52,.3), 0 0 0 1px rgba(255, 255, 255, .2);
  scrollbar-color: #bdc5db transparent;
}

body:has(#c-vol) .dlg .close {
  background: rgba(255, 255, 255, .9);
  color: #59637b;
  border-color: #d8deed;
  box-shadow: inset 0 1px 0 #fff, 0 2px 7px rgba(43,65,82,.05);
}

body:has(#c-vol) .dlg .close:hover {
  background: #eaf1f8;
  color: #47607d;
  border-color: #b5ccd9;
}

body:has(#c-vol) .dlg .fig img {
  box-shadow: 0 5px 20px rgba(45,63,78,.12);
}

body:has(#c-vol) .dlg .fig .noimg,
body:has(#c-vol) .dlg .src {
  color: #747d91;
}

body:has(#c-vol) .dlg .fig .noimg i {
  border-color: #c2cadd;
}

body:has(#c-vol) .dlg .meta span {
  color: #617381;
  background: #edf0f8;
  box-shadow: inset 0 0 0 1px rgba(203, 211, 231, .5);
}

body:has(#c-vol) .dlg .meta span.k {
  color: #506e8b;
  background: #e8eff7;
}

body:has(#c-vol) .dlg p.intro,
body:has(#c-vol) .dlg .pr code {
  color: #41495e;
}

body:has(#c-vol) .dlg .pr {
  background: linear-gradient(135deg, #f0f2f9, #f4f8fb);
  border-color: #dce1ef;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9);
}

body:has(#c-vol) .dlg .pr .cp {
  color: #526e7e;
  background: radial-gradient(ellipse at 100% 0, #f4ded4, transparent 80%), linear-gradient(120deg, #fff, #f0f6f7);
  border-color: #c2cbd7;
  box-shadow: inset 0 1px 0 #fff, 0 2px 4px rgba(61,81,100,.035);
}

body:has(#c-vol) .dlg .pr .cp:hover {
  color: #384b58;
  border-color: #a7b0c3;
  background: radial-gradient(ellipse at 100% 0, #f1d1c2, transparent 85%), linear-gradient(120deg, #f7fbff, #edf4f6);
  box-shadow: inset 0 1px 0 #fff, 0 3px 12px -5px rgba(190, 135, 118, .32);
}

body:has(#c-vol) .dlg .pr .cp.done {
  color: #fff;
  background: #36745e;
  border-color: #36745e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}

body:has(#c-vol) .toTop {
  background: linear-gradient(135deg, #455c6e, #657b8c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 5px 20px -6px rgba(67,93,123,.36);
}

body:has(#c-vol) :is(.tab, #q, .item, .dlg .close, .dlg .cp, .toTop):focus-visible {
  outline: 2px solid #789fb5;
  outline-offset: 3px;
}

/* Cases: retain the dramatic dark reading surface; light is concentrated at its edges. */
body:has(.hero-deco) {
  --ink: #11191e;
  --ink2: #1a232a;
  --ink3: #243038;
  --verm: #c78079;
  --verm2: #e4a294;
  --paper: #e8edf1;
  --paper-dim: #b2bec7;
  --gold: #c9b49a;
  --line: rgba(188, 197, 228, .15);
  background: radial-gradient(ellipse at 88% 2%, rgba(90,126,150,.13), transparent 46rem), var(--ink);
}

body:has(.hero-deco)::before {
  opacity: .18;
}

body:has(.hero-deco) ::selection {
  background: #6d8ca3;
  color: #fff;
}

body:has(.hero-deco) .topbar {
  background: rgba(21,30,36,.86);
  border-bottom-color: rgba(189,209,220,.18);
  box-shadow: inset 0 1px 0 rgba(226,243,253,.05), 0 8px 26px rgba(5,13,19,.12);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  backdrop-filter: blur(18px) saturate(125%);
}

body:has(.hero-deco) .toc a {
  color: #b9bed1;
}

body:has(.hero-deco) .toc a:hover {
  color: #f1c6b9;
  text-shadow: 0 0 14px rgba(226, 158, 146, .2);
}

body:has(.hero-deco) .toc a:focus-visible {
  outline: 2px solid #a5c5dc;
  outline-offset: 5px;
  border-radius: 3px;
}

body:has(.hero-deco) .hero {
  background: radial-gradient(ellipse at 15% 0%, rgba(126,161,190,.09), transparent 62%), radial-gradient(ellipse at 88% 90%, rgba(193, 121, 102, .065), transparent 50%);
}

body:has(.hero-deco) .hero-title {
  color: #e7b4a6;
  text-shadow: 0 1px 0 rgba(255, 232, 226, .18), 0 0 62px rgba(205, 131, 122, .14);
}

body:has(.hero-deco) .hero-hook em {
  border-bottom-color: rgba(207, 147, 137, .5);
}

body:has(.hero-deco) .hero-deco {
  opacity: .18;
  filter: saturate(.45) brightness(1.55);
}

body:has(.hero-deco) .tag {
  border-color: rgba(180, 189, 218, .22);
  background: linear-gradient(135deg, rgba(64,79,91,.25), rgba(28,38,45,.65));
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(226, 231, 255, .035);
}

body:has(.hero-deco) .tag.hot {
  color: #e6b1a2;
  border-color: rgba(216, 156, 142, .35);
  background: linear-gradient(135deg, rgba(142, 94, 93, .18), rgba(36,40,48,.65));
}

body:has(.hero-deco) .meta-bar {
  background: linear-gradient(115deg, #1b202d, #202b33);
  box-shadow: inset 0 1px 0 rgba(234,246,254,.025);
}

body:has(.hero-deco) :is(.factlist, .tri .box, .profile, .relmap, .act, .line-card, .cf, .trick, .formula-strip, .template) {
  background: linear-gradient(145deg, rgba(35, 41, 58, .8), rgba(25,35,42,.94));
  border-color: rgba(180, 191, 226, .17);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(236,246,254,.045), 0 10px 28px -20px rgba(2,9,14,.4);
}

body:has(.hero-deco) .profile.hl {
  border-color: rgba(212, 156, 151, .34);
}

body:has(.hero-deco) .profile-head {
  background: linear-gradient(105deg, rgba(155,192,211,.04), transparent 65%);
}

body:has(.hero-deco) .stamp {
  border-color: #ba8685;
  background: rgba(134,151,172,.035);
  box-shadow: inset 0 1px 0 rgba(236,240,254,.12);
}

body:has(.hero-deco) .profile.hl .stamp {
  color: #fff5f0;
  background: linear-gradient(135deg, #627b8e, #b37e77);
  box-shadow: inset 0 1px 0 rgba(255, 232, 223, .27), 0 5px 18px -7px rgba(197, 127, 118, .28);
}

body:has(.hero-deco) .rm-node.center {
  background: linear-gradient(145deg, rgba(117,136,160,.12), rgba(118,153,180,.055));
}

body:has(.hero-deco) .rm-node .single {
  box-shadow: inset 0 1px 0 rgba(231,243,254,.06);
}

body:has(.hero-deco) .tl-row.key .tl-dot {
  box-shadow: 0 0 0 4px rgba(142,174,201,.12), 0 0 16px rgba(218, 160, 147, .18);
}

body:has(.hero-deco) .tl-func {
  border-color: rgba(201, 180, 154, .28);
  background: rgba(201, 180, 154, .035);
  border-radius: 5px;
}

body:has(.hero-deco) .line-card.tycoon {
  border-left-color: #c9b49a;
}

body:has(.hero-deco) .line-card.shiyu {
  border-left-color: #c78079;
}

body:has(.hero-deco) .line-card.zhiya {
  border-left-color: #e4a294;
}

body:has(.hero-deco) .skin-table {
  background: linear-gradient(145deg, #1d2332, #19232a);
  box-shadow: inset 0 1px 0 rgba(236,246,254,.04);
}

body:has(.hero-deco) .skin-table th {
  background: linear-gradient(145deg, #293640, #252b3b);
}

body:has(.hero-deco) .tpl-key {
  background: rgba(8, 13, 26, .2);
}

body:has(.hero-deco) .tpl-val .blank {
  border-bottom-color: rgba(219, 157, 149, .4);
}

body:has(.hero-deco) footer {
  background: linear-gradient(145deg, #1a1f2c, #172027);
}

/* Only response to the user's actions is animated; OS motion preferences win. */
@media (prefers-reduced-motion: reduce) {
  html:has(#module-skin),
  html:has(#c-vol),
  html:has(.hero-deco) {
    scroll-behavior: auto;
  }

  body:has(#module-skin) :is(.module, .opt, .copy-btn, nav.modules button),
  body:has(#c-vol) :is(.item, .tab, #q, .toTop, .dlg .close, .dlg .cp),
  body:has(.hero-deco) .toc a {
    animation: none;
    transition: none;
  }
  body:has(#c-vol) .item:hover {
    transform: none;
  }
}
