/* ==========================================================
   红线 — site-specific styles + Chinese folk-horror effects.
   Loaded after style.css / horror.css (shared with Somnia).
   ========================================================== */
:root {
  --song: "Songti SC", "STSong", "SimSun", "Noto Serif SC", "Source Han Serif SC", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", "Songti SC", serif;
  --shadow: 0 1px 2px rgba(60,10,20,.05), 0 12px 32px -12px rgba(170,20,40,.2);
}
.logo-mark.knot { width: 20px; height: 20px; border-radius: 5px; background: var(--accent); transform: rotate(45deg); margin: 0 4px; }
.logo-mark.knot::after { width: 8px; height: 8px; top: 4px; right: 4px; border-radius: 2px; background: transparent; border: 2px solid #fff; }

/* ---------- hero illustration ---------- */
.h-bg { fill: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.h-heart { fill: var(--accent); opacity: .8; animation: floaty 5s ease-in-out infinite; }
.hh2 { animation-delay: -2s; } .hh3 { animation-delay: -3.5s; opacity: .5; }
.h-pants { fill: #3a3f55; } .h-shirt { fill: #46608c; }
.h-arm { fill: none; stroke: #46608c; stroke-width: 18; stroke-linecap: round; }
.h-arm2 { fill: none; stroke: color-mix(in srgb, var(--accent) 70%, #fff); stroke-width: 16; stroke-linecap: round; }
.h-skin { fill: #F2C6A8; } .h-hair { fill: #2a1d1d; } .h-eye { fill: #2a1d1d; }
.h-smile { fill: none; stroke: #7a3d3d; stroke-width: 2.4; stroke-linecap: round; }
.h-dress { fill: color-mix(in srgb, var(--accent) 70%, #fff); }
.h-blush { fill: #ff8fa0; opacity: .55; }
.h-thread { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 6 4; animation: dash 2s linear infinite; }
.h-knot { fill: var(--accent); }
@keyframes dash { to { stroke-dashoffset: -20; } }
.h-woman, .h-bride { transition: opacity 2s; }
.h-bride { opacity: 0; }
.h-robe { fill: #a8001a; } .h-sleeve { fill: #8a0015; } .h-veil { fill: #b3001b; }
.h-robe-trim, .h-veil-trim { fill: none; stroke: #d4a23a; stroke-width: 3; }
.h-hand { fill: #e9e2da; } .h-nail { stroke: #c8102e; stroke-width: 2; stroke-linecap: round; }
.after .h-woman { opacity: 0; } .after .h-bride { opacity: 1; }
.after .h-man .h-eye { fill: #000; } .after .h-smile { opacity: 0; }
.after .h-thread { stroke: #8a0013; animation: none; stroke-dasharray: none; }
.match-card { left: -10px; top: 10%; display: flex; gap: 10px; align-items: center; }
.match-card small { display: block; color: var(--muted); font-size: 12px; }
.mc-ava { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.almanac { right: 0; bottom: 8%; animation-delay: -3s; display: grid; gap: 2px; min-width: 170px; }
.almanac small { color: var(--muted); font-size: 12px; }
.almanac b { color: var(--accent); font-family: var(--song); }
.almanac .ji { font-size: 13px; color: var(--muted); font-family: var(--song); }
.feat-ico { font: 700 22px var(--song); color: var(--accent); }

/* ---------- bazi ---------- */
.bz-form { display: grid; grid-template-columns: 1.4fr 1fr .8fr .8fr 1fr auto; gap: 12px; align-items: end; background: var(--surface); padding: 22px; border-radius: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.bz-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.bz-form input, .bz-form select { font: 15px var(--font); padding: 11px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-width: 0; }
.bz-out { margin-top: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); display: none; }
.bz-out.show { display: block; animation: pop .4s ease-out; }
.bz-pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; text-align: center; margin-bottom: 18px; }
.bz-pillars div { border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px; }
.bz-pillars small { display: block; color: var(--muted); font-size: 12px; }
.bz-pillars b { font: 700 30px/1.3 var(--song); letter-spacing: .1em; color: var(--accent); }
.bz-wx { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0; font-size: 13px; text-align: center; }
.bz-wx i { display: block; height: 6px; border-radius: 3px; margin-top: 6px; background: var(--accent2); }
.bz-ming { font: 600 18px var(--song); margin: 14px 0 8px; }
.bz-hit { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.bz-hit .pphoto { width: 56px; height: 70px; border-radius: 8px; flex-shrink: 0; }
.fine { font-size: 12px; color: var(--muted); margin-top: 14px; text-align: center; }
.fine2 { opacity: .04; transition: opacity 3s; }
.s2 .fine2 { opacity: 1; color: var(--accent); }

/* ---------- profile cards / avatars ---------- */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); display: grid; gap: 2px; padding-bottom: 16px; }
.pcard > b, .pcard > small, .pcard > .ptags, .pcard > em { padding: 0 18px; }
.pcard > b { font-size: 18px; margin-top: 12px; } .pcard b i { font-style: normal; color: var(--muted); font-weight: 400; margin-left: 4px; }
.pcard small { color: var(--muted); } .ptags { font-size: 13px; color: var(--accent); }
.pcard em { font-style: normal; font-size: 13px; color: var(--muted); } .pcard em.on { color: #18A957; } .pcard em.red { color: #d0021b; }
.pphoto { position: relative; aspect-ratio: 4 / 4.2; overflow: hidden; background: var(--line); }
.pphoto svg, .cava svg { width: 100%; height: 100%; display: block; }
.ptip { position: absolute; left: 18px; right: 18px; top: 16px; background: rgba(0,0,0,.82); color: #f3e6d0; font: 15px var(--kai); padding: 10px 12px; border-radius: 10px; opacity: 0; transition: opacity .4s; }
#xiaocui:hover .ptip { opacity: 1; }
.cava { width: 74px; height: 50px; }
.yz svg { filter: grayscale(1) contrast(1.15) brightness(.92); }
.yz::after { content: ""; position: absolute; top: 12%; right: -18%; width: 70%; height: 11%; background: #0b0b0b; transform: rotate(45deg); box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.cava.yz { position: relative; overflow: hidden; border-radius: 8px; }

/* ---------- customs / contract ---------- */
.custom p { font-size: 19px; line-height: 1.95; }
.custom h2 { margin-bottom: 28px; }
.hunshu {
  position: relative; max-width: 880px; margin: 0 auto; min-height: 520px; padding: 46px 56px; display: flex; flex-direction: row-reverse; gap: 34px;
  background: #b3001b radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.08), transparent 60%); color: #f6d77a;
  border: 3px double #e3b74a; outline: 8px solid #b3001b; box-shadow: 0 30px 60px -20px rgba(120,0,10,.5); transition: background 3s, color 3s;
}
.hs-title { writing-mode: vertical-rl; font: 700 54px var(--kai); letter-spacing: .3em; border-left: 2px solid currentColor; padding-left: 26px; }
.hs-body { writing-mode: vertical-rl; font: 23px/2.05 var(--kai); letter-spacing: .12em; flex: 1; }
.hs-body p { margin: 0 0 0 16px; }
.hs-body b { color: #fff3c4; border-bottom: 1px solid; }
.hs-vow { font-size: 26px; }
.hs-date { opacity: .9; font-size: 18px; }
.hs-seal { position: absolute; left: 60px; bottom: 50px; width: 86px; height: 86px; display: grid; place-items: center; text-align: center; font: 700 22px/1.15 var(--kai); color: #b3001b; background: #f2cf6a; border-radius: 6px; transform: rotate(-8deg); }
.hs-press { position: absolute; left: 170px; bottom: 62px; font: 600 15px var(--kai); color: #f6d77a; background: transparent; border: 1.5px dashed #f6d77a; padding: 10px 16px; border-radius: 10px; cursor: pointer; }
.hs-print { position: absolute; left: 186px; bottom: 34px; width: 74px; opacity: 0; transition: opacity 1.5s; pointer-events: none; }
.hs-print.on { opacity: .95; }
.s5 .hunshu { background: #ebe6dc; color: #1c1c1c; border-color: #1c1c1c; outline-color: #ebe6dc; }
.s5 .hs-body b { color: #000; }
.s5 .hs-seal { background: #1c1c1c; color: #ebe6dc; }

/* ---------- qr ---------- */
.qr-wrap { width: 216px; height: 216px; margin: 34px auto 0; padding: 18px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); }
#qr { width: 180px; height: 180px; image-rendering: pixelated; display: block; }
.qr-cap { margin-top: 14px; color: var(--muted); }

/* ---------- livestream ---------- */
.live-frame { position: relative; }
#stage { width: 100%; height: 100%; display: block; }
.lv-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.lv-host, .lv-view { display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,.45); color: #fff; font-size: 13px; padding: 5px 11px; border-radius: 999px; }
.lv-host i { width: 7px; height: 7px; border-radius: 50%; background: #ff2d55; animation: blink 1.2s steps(1) infinite; }
.danmaku { position: absolute; inset: 44px 0 30% 0; overflow: hidden; pointer-events: none; }
.dm { position: absolute; left: 100%; white-space: nowrap; color: #fff; font-size: clamp(12px, 1.7vw, 19px); text-shadow: 0 0 3px #000, 1px 1px 2px #000; will-change: transform; }
.dm.red { color: #ff4d5e; } .dm.gold { color: #f6d77a; }
.lv-buffer { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none; gap: 10px; align-items: center; background: rgba(0,0,0,.6); color: #ddd; font-size: 14px; padding: 10px 16px; border-radius: 10px; }
.lv-buffer.on { display: flex; }
.lv-buffer i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #777; border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lv-lift { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); font: 700 clamp(16px, 2.2vw, 24px) var(--kai); letter-spacing: .3em; color: #f6d77a; background: #8a0013; border: 2px solid #e3b74a; padding: 12px 26px 12px 34px; border-radius: 12px; cursor: pointer; display: none; animation: liftglow 1.6s ease-in-out infinite; box-shadow: 0 0 40px rgba(200,0,30,.6); }
@keyframes liftglow { 50% { box-shadow: 0 0 80px rgba(255,0,40,.95); } }
.lv-lift.on { display: block; }
.lv-end { position: absolute; left: 0; right: 0; bottom: 0; height: 26%; background: linear-gradient(transparent, rgba(0,0,0,.88)); color: #b8a68f; display: none; place-items: center; font: 600 clamp(16px, 2vw, 22px) var(--song); letter-spacing: .3em; }
.lv-end.on { display: grid; }

/* ---------- atmosphere layers ---------- */
#paper { z-index: 59; width: 100vw; height: 100vh; }
#candle { z-index: 61; opacity: 0; mix-blend-mode: screen; transition: opacity 2s;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,140,50,.16), transparent 62%), radial-gradient(ellipse at 50% 0%, rgba(255,90,40,.06), transparent 50%); }
.s3 #candle { opacity: 1; animation: candle 2.6s infinite; }
@keyframes candle { 0%,100% { filter: brightness(1); } 13% { filter: brightness(.7); } 17% { filter: brightness(1.15); } 44% { filter: brightness(.85); } 61% { filter: brightness(1.05); } 79% { filter: brightness(.75); } }
#thread { z-index: 64; width: 100vw; height: 100vh; opacity: 0; transition: opacity 2s; }
#thread path { fill: none; stroke: #c8102e; stroke-width: 1.6; filter: drop-shadow(0 0 2px rgba(200,16,46,.6)); }
#thread.on { opacity: .9; }
#fu { z-index: 63; overflow: hidden; }
.fu { position: absolute; width: 70px; height: 210px; display: grid; place-items: center; writing-mode: vertical-rl; font: 700 24px var(--kai); letter-spacing: 6px; color: #b3001b;
  background: #e9c84a linear-gradient(180deg, rgba(255,255,255,.15), rgba(120,80,0,.12)); box-shadow: 0 6px 16px rgba(0,0,0,.5); opacity: 0; transition: opacity .25s; }
.fu::before { content: ""; position: absolute; inset: 6px; border: 2px solid rgba(179,0,27,.55); }
.fu.on { opacity: .93; }
.in-demo .fu.on { opacity: .1; }
#shoes { position: fixed; left: 50%; bottom: 6px; z-index: 65; width: 120px; pointer-events: none; opacity: 0; transform: translateX(-50%) scale(var(--sc, .6)); transform-origin: bottom center; transition: opacity 1.2s, transform .15s; }
#shoes svg path { fill: #b3001b; } #shoes svg .em { fill: none; stroke: #e3b74a; stroke-width: 2; }
#shoes.on { opacity: .95; }
.lantern { position: fixed; top: 64px; z-index: 58; width: 66px; height: 82px; border-radius: 46%; display: grid; place-items: center; font: 700 28px var(--kai); color: #f6d77a;
  background: radial-gradient(circle at 50% 45%, #ff6a3c, #b3001b 70%); box-shadow: 0 0 46px rgba(255,80,40,.45); opacity: 0; transition: opacity 2s, background 2s, color 2s;
  animation: swing 4.5s ease-in-out infinite alternate; transform-origin: 50% -40px; pointer-events: none; }
.lantern::after { content: ""; position: absolute; bottom: -26px; left: 50%; width: 3px; height: 26px; background: #d4a23a; }
.lantern.l { left: 14px; } .lantern.r { right: 14px; animation-delay: -2s; }
.s3 .lantern { opacity: .92; }
.s5 .lantern { background: radial-gradient(circle at 50% 45%, #fff, #cfc8bb 70%); color: #111; box-shadow: 0 0 40px rgba(255,255,255,.2); }
@keyframes swing { from { rotate: -4deg; } to { rotate: 4deg; } }
.call { position: fixed; z-index: 91; left: 50%; top: 32%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 40px)); background: #0c0606; color: #e8d6c0; border: 1px solid #5a1a1a; border-radius: 14px; padding: 26px; text-align: center; display: none; box-shadow: 0 30px 80px #000; }
.call.on { display: block; animation: pop .3s ease-out; }
.call p { font: 22px/1.6 var(--kai); margin: 0 0 20px; }
.call div { display: flex; gap: 12px; justify-content: center; }

/* ---------- stage typography: modern → song → brush ---------- */
.s2 h2, .s2 .lead { font-family: var(--song); }
.s3 body { font-family: var(--song); }
.s4 h1, .s4 h2, .s4 summary, .fin-line { font-family: var(--kai); }
.s4 h2 { text-shadow: 0 0 18px rgba(200,0,20,.35); }
.s3 .custom .pull { writing-mode: vertical-rl; margin: 40px auto 0; height: 9.6em; line-height: 1.8; border-left: 0; border-right: 3px solid var(--accent); padding: 0 18px 0 0; }
.s3 .pcard.wrong { box-shadow: 0 0 50px -10px rgba(200,0,30,.6); border-color: #6a0010; }
.s4 .ptags { color: #d0021b; }
.finale .fin-line b { color: #d0021b; }
.after .stats-grid { box-shadow: 0 0 0 1px #3a0006; }

@media (max-width: 960px) {
  .bz-form { grid-template-columns: 1fr 1fr 1fr; }
  .pgrid { grid-template-columns: 1fr 1fr; }
  .hunshu { padding: 34px 24px; gap: 18px; }
  .hs-body { font-size: 19px; }
}
@media (max-width: 640px) {
  .bz-form { grid-template-columns: 1fr 1fr; }
  .pgrid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .bz-pillars b { font-size: 22px; }
  .hunshu { min-height: 460px; overflow-x: auto; }
  .hs-title { font-size: 36px; padding-left: 12px; }
  .hs-body { font-size: 16px; }
  .hs-seal { left: 18px; bottom: 18px; width: 64px; height: 64px; font-size: 16px; }
  .hs-press { left: 96px; bottom: 26px; }
  .hs-print { left: 100px; }
  .lantern { width: 46px; height: 58px; font-size: 20px; }
  .dm { font-size: 12px; }
}
