/* =========================================================
 * 神人流派生成器 · 黑夜金 视觉 v2
 * 红月 + 卢恩环 + 石碑卷轴 + 仪典卡
 * ========================================================= */
:root {
  --night-0: #05060a;
  --night-1: #0b0e18;
  --ink: #d8d3c2;
  --ink-dim: #8d887a;
  --gold: #c9a227;
  --gold-hi: #e9cf7a;
  --gold-deep: #8a6d1c;
  --line: rgba(201, 162, 39, .35);
  --blood: #a02c2c;
  --card-bg: rgba(10, 13, 22, .92);
  --serif: Georgia, "Times New Roman", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
}

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

html { background: var(--night-0); }

body {
  min-height: 100vh;
  font-family: var(--serif);
  color: var(--ink);
  background:
    radial-gradient(1400px 800px at 50% -12%, #1c2447 0%, transparent 62%),
    radial-gradient(1000px 560px at 88% 108%, #1a1226 0%, transparent 65%),
    linear-gradient(180deg, var(--night-1) 0%, #04050a 100%);
  overflow-x: hidden;
}

/* ---------- 氛围层 ---------- */
.moon {
  position: fixed; z-index: 0;
  top: -140px; right: -120px;
  width: 420px; height: 420px; border-radius: 50%;
  background:
    radial-gradient(circle at 38% 34%, rgba(190, 70, 50, .28) 0%, rgba(120, 30, 25, .18) 42%, transparent 62%),
    radial-gradient(circle at 62% 62%, rgba(60, 30, 60, .25), transparent 55%);
  filter: blur(6px);
  box-shadow: 0 0 180px 60px rgba(150, 45, 35, .12);
  animation: moonpulse 14s ease-in-out infinite;
  pointer-events: none;
}
@keyframes moonpulse { 50% { opacity: .75; transform: scale(1.04); } }

.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(233, 207, 122, .85) 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 15%, rgba(216, 211, 194, .6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 40% 70%, rgba(233, 207, 122, .5) 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 60%, rgba(216, 211, 194, .5) 50%, transparent 51%),
    radial-gradient(1px 1px at 10% 85%, rgba(233, 207, 122, .45) 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 42%, rgba(255, 255, 255, .35) 50%, transparent 51%);
  background-size: 550px 550px, 400px 400px, 650px 650px, 500px 500px, 450px 450px, 700px 700px;
  animation: drift 120s linear infinite;
}
@keyframes drift { to { background-position: -550px 550px, 400px -400px, -650px -650px, 500px 500px, -450px 450px, 700px -700px; } }

.grain {
  position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: .05;
  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='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

/* ---------- 页头 ---------- */
.site-head {
  position: relative; z-index: 1;
  text-align: center; padding: 72px 16px 6px;
}
.aura {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  width: 460px; height: 460px; border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, .12);
  box-shadow: 0 0 0 26px rgba(201, 162, 39, .03), 0 0 120px rgba(201, 162, 39, .07) inset;
  pointer-events: none;
  animation: spinslow 90s linear infinite;
}
.aura::before {
  content: ""; position: absolute; inset: -14px; border-radius: 50%;
  border: 1px dashed rgba(201, 162, 39, .14);
}
@keyframes spinslow { to { transform: translateX(-50%) rotate(360deg); } }

.pre-title {
  letter-spacing: .5em; font-size: 11px; color: var(--gold);
  text-transform: uppercase; margin-bottom: 12px;
}
.site-head h1 {
  position: relative; z-index: 1;
  font-size: clamp(32px, 6.4vw, 56px); font-weight: 600; letter-spacing: .14em;
  color: transparent;
  background: linear-gradient(180deg, #f6e8b8 0%, var(--gold-hi) 46%, #97731a 100%);
  -webkit-background-clip: text; background-clip: text;
  text-shadow: 0 0 46px rgba(201, 162, 39, .28);
}
.ornament { display: flex; align-items: center; gap: 14px; width: min(420px, 72vw); margin: 18px auto 14px; }
.ornament i { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.ornament b { color: var(--gold); font-size: 9px; }
.tagline { margin-top: 2px; font-size: 13px; line-height: 2; color: var(--ink-dim); font-style: italic; }

/* ---------- 主舞台 ---------- */
.stage {
  position: relative; z-index: 1;
  max-width: 780px; margin: 40px auto 0; padding: 0 20px 72px;
}

/* ---------- 石碑卷轴 ---------- */
.reels {
  display: flex; align-items: stretch; justify-content: center; gap: 12px;
  margin-bottom: 26px; flex-wrap: wrap;
}
.reel {
  position: relative; flex: 1 1 200px; max-width: 240px; min-height: 104px;
  background:
    linear-gradient(180deg, rgba(30, 38, 66, .92), rgba(9, 12, 21, .95));
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 calc(100% - 14px), 0 14px, 14px 0);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 14px 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
}
/* clip-path 下的描边用内层双线模拟 */
.reel::before {
  content: ""; position: absolute; inset: 1px;
  background: linear-gradient(180deg, rgba(28, 36, 64, .9), rgba(8, 11, 20, .96));
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 calc(100% - 14px), 0 14px, 14px 0);
  z-index: -1;
}
.reel::after {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(233, 207, 122, .55), transparent);
}
.reel-key { font-size: 10px; letter-spacing: .38em; color: var(--gold); }
.reel-value {
  font-size: 22px; letter-spacing: .08em; color: var(--ink); text-align: center;
  min-height: 28px;
}
.reel-value.rolling {
  color: var(--gold-hi); text-shadow: 0 0 14px rgba(233, 207, 122, .65);
  animation: flicker .1s steps(2) infinite;
}
.reel-value.locked { animation: thud .22s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes thud { from { transform: scale(1.25); color: #fff; } }
@keyframes flicker { 50% { opacity: .5; } }
.reel-x { align-self: center; color: var(--gold-deep); font-size: 18px; }

/* ---------- 按钮 ---------- */
.controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.btn {
  position: relative; overflow: hidden;
  font-family: var(--serif); cursor: pointer;
  border: 1px solid var(--line); color: var(--ink);
  background: rgba(15, 19, 33, .85);
  padding: 12px 26px; font-size: 15px; letter-spacing: .1em; border-radius: 999px;
  transition: color .18s, border-color .18s, box-shadow .18s, transform .06s;
}
.btn:not(:disabled):hover { border-color: var(--gold); color: var(--gold-hi); box-shadow: 0 0 22px rgba(201, 162, 39, .22); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: default; }
.btn-primary {
  border-color: rgba(201, 162, 39, .8);
  background: linear-gradient(180deg, rgba(96, 72, 15, .6), rgba(38, 29, 7, .9));
  color: var(--gold-hi); font-size: 17px;
  box-shadow: 0 0 28px rgba(201, 162, 39, .2), 0 12px 30px rgba(0, 0, 0, .45);
}
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 240, 190, .28), transparent);
  transform: skewX(-20deg);
  animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine { 0%, 62% { left: -70%; } 88%, 100% { left: 130%; } }
.btn-primary em {
  font-style: normal; font-size: 10px; color: var(--ink-dim);
  margin-left: 10px; padding: 2px 7px; border: 1px solid rgba(141, 136, 122, .35); border-radius: 3px;
}

/* ---------- 空状态 ---------- */
.empty-hint {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  color: var(--ink-dim); font-size: 15px; letter-spacing: .12em;
  text-align: center; padding: 26px 0 10px;
}
.empty-hint em { font-style: normal; font-size: 13px; opacity: .75; }
.empty-ring {
  width: 74px; height: 74px; border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, .35);
  box-shadow: 0 0 26px rgba(201, 162, 39, .1) inset;
  position: relative; animation: spinslow 16s linear infinite;
}
.empty-ring::before {
  content: "✦"; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  color: var(--gold); font-size: 12px;
}
.empty-hint.hidden { display: none; }

/* ---------- 仪典结果卡 ---------- */
.card {
  position: relative;
  background:
    radial-gradient(600px 260px at 50% -40px, rgba(201, 162, 39, .07), transparent 70%),
    var(--card-bg);
  border: 1px solid var(--line);
  outline: 1px solid rgba(201, 162, 39, .14);
  outline-offset: -6px;
  border-radius: 6px;
  padding: 30px 30px 24px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .6);
}
.card.hidden { display: none; }

/* 四角卢恩饰角 */
.card::before, .card::after {
  content: ""; position: absolute; width: 26px; height: 26px; pointer-events: none;
}
.card::before { top: 10px; left: 10px; border-top: 2px solid var(--gold-deep); border-left: 2px solid var(--gold-deep); }
.card::after { bottom: 10px; right: 10px; border-bottom: 2px solid var(--gold-deep); border-right: 2px solid var(--gold-deep); }

.card.reveal { animation: rise .55s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes rise { from { opacity: 0; transform: translateY(26px) scale(.985); } }
.card.reveal .trio, .card.reveal .score-row, .card.reveal .stats,
.card.reveal .roast, .card.reveal .teammate, .card.reveal .foot { animation: fadein .6s .18s backwards; }
.card.reveal .score-row { animation-delay: .28s; }
.card.reveal .stats { animation-delay: .38s; }
.card.reveal .roast { animation-delay: .48s; }
.card.reveal .teammate { animation-delay: .56s; }
.card.reveal .foot { animation-delay: .64s; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }

.card-top { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.grade-badge {
  font-size: 13px; letter-spacing: .22em; padding: 5px 14px; border-radius: 2px;
  border: 1px solid currentColor;
}
.pill { font-size: 11px; letter-spacing: .15em; padding: 3px 10px; border-radius: 10px; border: 1px solid; }
.pill-meme { color: #ff9d5c; border-color: rgba(255, 157, 92, .5); background: rgba(255, 120, 50, .06); }
.pill-main { color: #7fb2ff; border-color: rgba(127, 178, 255, .45); background: rgba(90, 140, 255, .06); }

.card[data-grade="n"] .grade-badge { color: #9aa0a6; }
.card[data-grade="r"] .grade-badge { color: #7fb2ff; }
.card[data-grade="sr"] .grade-badge { color: #c78bff; }
.card[data-grade="ssr"] .grade-badge { color: var(--gold-hi); }
.card[data-grade="god"] {
  border-color: rgba(201, 42, 42, .6);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .6), 0 0 46px rgba(160, 44, 44, .3);
}
.card[data-grade="god"]::before, .card[data-grade="god"]::after { border-color: var(--blood); }
.card[data-grade="god"] .grade-badge {
  color: #ffb15c; border-color: #ffb15c; background: rgba(160, 44, 44, .12);
  text-shadow: 0 0 12px rgba(255, 177, 92, .9);
  animation: pulse 1.6s ease-in-out infinite;
}
/* 神档：右上巨型水印字 */
.card[data-grade="god"] .build-name::after {
  content: "神"; position: absolute; right: -6px; top: -34px;
  font-size: 120px; line-height: 1; color: rgba(160, 44, 44, .14);
  text-shadow: 0 0 40px rgba(160, 44, 44, .35);
  pointer-events: none;
}
@keyframes pulse { 50% { box-shadow: 0 0 24px rgba(255, 177, 92, .6); } }

.build-name {
  position: relative;
  font-size: clamp(24px, 5vw, 34px); letter-spacing: .07em; font-weight: 600;
  color: transparent;
  background: linear-gradient(180deg, #f3e3ac, var(--gold) 80%);
  -webkit-background-clip: text; background-clip: text;
  margin-bottom: 20px; line-height: 1.4;
}

/* 三要素 */
.trio { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-bottom: 20px; }
.trio-cell {
  flex: 1 1 160px; border: 1px solid rgba(201, 162, 39, .22);
  background: linear-gradient(180deg, rgba(22, 28, 48, .75), rgba(10, 13, 24, .75));
  border-radius: 4px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.trio-cell .k { font-size: 10px; letter-spacing: .32em; color: var(--gold); }
.trio-cell .v { font-size: 19px; color: var(--ink); }
.trio-cell .sub { font-size: 11px; color: var(--ink-dim); line-height: 1.6; }
.trio-x { align-self: center; color: var(--gold-deep); font-size: 16px; }

/* 神人度 */
.score-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.score-label { font-size: 12px; letter-spacing: .28em; color: var(--gold); flex: none; }
.score-bar {
  flex: 1; height: 12px; border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(201, 162, 39, .35); background: rgba(0, 0, 0, .55);
  position: relative;
}
.score-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #46568a, var(--gold) 62%, #ff8d4c);
  box-shadow: 0 0 12px rgba(201, 162, 39, .5);
  transition: width 1s cubic-bezier(.2, .8, .3, 1);
}
.card[data-grade="god"] .score-bar i { background: linear-gradient(90deg, var(--blood), #ff8d4c 70%, #ffd15c); }
/* 刻度 */
.score-bar::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 19px, rgba(0, 0, 0, .5) 19px 20px);
}
.score-num { font-size: 26px; color: var(--gold-hi); flex: none; min-width: 58px; text-align: right; }
.score-num em { font-style: normal; font-size: 12px; color: var(--ink-dim); }

/* 四维 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.stat {
  border: 1px solid rgba(201, 162, 39, .18); border-radius: 4px; padding: 10px 6px;
  text-align: center; background: rgba(14, 18, 32, .65);
  transition: border-color .18s, box-shadow .18s;
}
.stat:hover { border-color: rgba(201, 162, 39, .5); box-shadow: 0 0 14px rgba(201, 162, 39, .12); }
.stat span { display: block; font-size: 11px; color: var(--ink-dim); letter-spacing: .24em; margin-bottom: 5px; }
.stat b { font-size: 22px; color: var(--gold-hi); font-weight: 600; }

/* 文案 */
.roast {
  border-left: 3px solid var(--gold); padding: 8px 0 8px 16px; margin-bottom: 10px;
  font-size: 17px; line-height: 1.9; color: var(--ink);
}
.teammate { font-size: 13px; color: var(--ink-dim); margin-bottom: 20px; padding-left: 19px; }

.foot { border-top: 1px dashed rgba(201, 162, 39, .25); padding-top: 16px; display: grid; gap: 9px; }
.foot p { font-size: 13px; line-height: 1.8; color: var(--ink-dim); }
.foot b {
  display: inline-block; font-weight: normal; font-size: 11px; letter-spacing: .15em;
  color: var(--gold); border: 1px solid rgba(201, 162, 39, .4); border-radius: 2px;
  padding: 1px 7px; margin-right: 8px;
}

/* 卡内再抽 + 局统计 */
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.reroll {
  font-family: var(--serif); cursor: pointer;
  border: 1px solid rgba(201, 162, 39, .55); border-radius: 999px;
  background: rgba(60, 46, 12, .35); color: var(--gold-hi);
  padding: 8px 20px; font-size: 14px; letter-spacing: .08em;
  transition: all .18s;
}
.reroll:hover { box-shadow: 0 0 16px rgba(201, 162, 39, .28); }
.session { font-size: 11px; color: rgba(141, 136, 122, .8); letter-spacing: .1em; }
.session b { color: var(--gold); font-weight: 600; }

/* ---------- 页脚 ---------- */
.site-foot {
  position: relative; z-index: 1;
  text-align: center; padding: 30px 16px 46px; font-size: 11px;
  color: rgba(141, 136, 122, .78); line-height: 2;
}
.site-foot .binding {
  color: rgba(201, 162, 39, .55); letter-spacing: .06em;
  margin-bottom: 6px;
}

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .reel { min-height: 92px; }
  .card { padding: 22px 16px 18px; }
  .build-name { font-size: 21px; }
  .card[data-grade="god"] .build-name::after { display: none; }
  .moon { width: 260px; height: 260px; top: -90px; right: -80px; }
}
