/* ============================================================
   节气灵犀 · 灵犀抽奖
   深墨底 / 米纸金线 / 朱印
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #14110E;
  color: #F2E8D4;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  overscroll-behavior: none;
}

body::before {
  content: ""; position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(62, 52, 38, .55) 0%, rgba(20, 17, 14, 0) 62%),
    radial-gradient(90% 60% at 50% 100%, rgba(44, 36, 26, .45) 0%, rgba(20, 17, 14, 0) 70%),
    #14110E;
  z-index: 0;
}

body::after {
  content: ""; position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background-image: radial-gradient(rgba(240, 228, 205, .045) 1px, transparent 1px);
  background-size: 5px 5px;
  opacity: .28; pointer-events: none; z-index: 1;
}

.app {
  position: relative; z-index: 2;
  width: 100%; max-width: 520px; height: 100%;
  margin: 0 auto; overflow: hidden;
}

.screen {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  display: none; flex-direction: column; align-items: center;
}
.screen.on { display: flex; }

/* ---------------- 一 · 输入 ---------------- */

#s-in { padding: 8vh 26px calc(30px + env(safe-area-inset-bottom)); justify-content: center; }

.in-frame {
  position: absolute; top: 14px; right: 14px; bottom: 14px; left: 14px;
  border: 1px solid rgba(215, 181, 113, .17);
  pointer-events: none;
}
.in-frame::before, .in-frame::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 1px solid rgba(215, 181, 113, .50);
}
.in-frame::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.in-frame::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }

.in-seal {
  position: absolute; left: 30px; top: 32px;
  width: 42px; height: 42px; padding: 5px 0;
  border: 1.5px solid rgba(165, 52, 42, .72);
  border-radius: 3px;
  color: #C4553F; font-size: 12px; line-height: 1.12; letter-spacing: 1px;
  text-align: center;
  background: rgba(165, 52, 42, .05);
}

.in-head { text-align: center; }

.in-kicker {
  font-size: 10px; letter-spacing: .62em; text-indent: .62em;
  color: rgba(215, 181, 113, .62);
}

.in-title {
  margin: 16px 0 0; font-size: 34px; font-weight: 600;
  letter-spacing: .30em; text-indent: .30em;
  background: linear-gradient(180deg, #FFF6E2 0%, #EBD1A1 46%, #C79F63 76%, #8E6B33 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}

.in-rule {
  width: 96px; height: 1px; margin: 18px auto 0;
  background: linear-gradient(90deg, rgba(215, 181, 113, 0), rgba(215, 181, 113, .70), rgba(215, 181, 113, 0));
}

.in-sub {
  margin: 16px 0 0; font-size: 12.5px; letter-spacing: .18em;
  color: rgba(232, 218, 195, .62);
}

.pin-wrap { margin: 40px 0 0; }

.pin-box { display: flex; gap: 12px; justify-content: center; }

.pin-cell {
  width: 58px; height: 76px; padding: 0;
  border: 1px solid rgba(215, 181, 113, .34);
  border-radius: 3px;
  background: rgba(247, 242, 231, .045);
  color: #FBF1D9;
  font-family: inherit; font-size: 34px; text-align: center;
  caret-color: #D7B571;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.pin-cell:focus {
  outline: none;
  border-color: rgba(215, 181, 113, .88);
  background: rgba(247, 242, 231, .09);
  box-shadow: 0 0 0 1px rgba(215, 181, 113, .18), 0 0 26px rgba(215, 181, 113, .16);
}
.pin-cell.filled { border-color: rgba(215, 181, 113, .58); }

.pin-tip {
  margin-top: 16px; text-align: center;
  font-size: 11px; letter-spacing: .12em;
  color: rgba(224, 210, 186, .46);
  transition: color .2s;
}
.pin-tip.warn { color: #D08663; }

.btn-main {
  position: relative;
  margin: 34px auto 0; display: block;
  min-width: 216px; padding: 15px 30px;
  border: 1px solid rgba(165, 52, 42, .90); border-radius: 3px;
  background: linear-gradient(180deg, #B23C2E 0%, #9A2F23 100%);
  color: #FDF3E2; font-family: inherit;
  font-size: 15px; letter-spacing: .30em; text-indent: .30em;
  box-shadow: 0 8px 26px rgba(150, 46, 35, .30);
  transition: transform .12s, opacity .2s, box-shadow .2s;
}
.btn-main:active { transform: translateY(1px) scale(.985); }
.btn-ghost[hidden] { display: none !important; }

.btn-main:disabled {
  background: rgba(247, 242, 231, .07);
  border-color: rgba(215, 181, 113, .22);
  color: rgba(232, 218, 195, .34);
  box-shadow: none;
}

.btn-ghost {
  margin: 14px auto 0; display: block;
  padding: 11px 24px; border: 1px solid rgba(215, 181, 113, .34);
  border-radius: 3px; background: transparent;
  color: rgba(240, 226, 203, .80);
  font-family: inherit; font-size: 13px; letter-spacing: .22em; text-indent: .22em;
}

.in-foot {
  position: absolute; left: 0; right: 0; bottom: calc(30px + env(safe-area-inset-bottom));
  text-align: center; font-size: 10px; letter-spacing: .22em;
  color: rgba(215, 181, 113, .40);
}

/* ---------------- 二 · 转盘 ---------------- */

#s-draw { padding: 0; }

#stage {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: block;
}

.draw-top {
  position: absolute; left: 0; right: 0; top: calc(46px + env(safe-area-inset-top));
  text-align: center; pointer-events: none;
}
.draw-kicker {
  font-size: 10px; letter-spacing: .66em; text-indent: .66em;
  color: rgba(238, 212, 164, .88);
}
.draw-kicker::before, .draw-kicker::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: 26px; height: 1px; margin: 0 10px;
  background: linear-gradient(90deg, rgba(215, 181, 113, 0), rgba(215, 181, 113, .70));
}
.draw-kicker::after { background: linear-gradient(90deg, rgba(215, 181, 113, .70), rgba(215, 181, 113, 0)); }
.draw-pos {
  margin-top: 12px; font-size: 9.5px; letter-spacing: .44em; text-indent: .44em;
  color: rgba(215, 181, 113, .58);
}

.draw-hub {
  position: absolute; left: 50%; top: 50%;
  width: 116px; height: 116px; margin: -58px 0 0 -58px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, #211C16 0%, #14110E 92%);
  border: 1px solid rgba(215, 181, 113, .42);
  box-shadow: 0 0 0 6px rgba(215, 181, 113, .05), 0 0 40px rgba(0, 0, 0, .70);
  pointer-events: none;
}
.hub-no {
  font-size: 25px; letter-spacing: .10em; color: #F7E9CB;
  font-variant-numeric: tabular-nums;
}
.hub-beast {
  margin-top: 3px; font-size: 10px; letter-spacing: .26em; text-indent: .26em;
  color: rgba(215, 181, 113, .70);
}

.draw-tip {
  position: absolute; left: 0; right: 0; bottom: calc(54px + env(safe-area-inset-bottom));
  text-align: center; font-size: 11.5px; letter-spacing: .26em; text-indent: .26em;
  color: rgba(238, 226, 204, .68);
  transition: opacity .3s;
}
.draw-tip.hit { color: #F0CE93; }

.draw-skip {
  position: absolute; right: 20px; bottom: calc(18px + env(safe-area-inset-bottom));
  padding: 6px 10px; font-size: 10.5px; letter-spacing: .22em;
  color: rgba(226, 212, 189, .38);
}

/* ---------------- 三 · 结果 ---------------- */

#s-res { padding: 4vh 22px calc(28px + env(safe-area-inset-bottom)); justify-content: center; }

.res-wrap {
  position: relative; width: 100%; max-width: 356px;
  padding: 34px 26px 26px;
  text-align: center;
  border: 1px solid rgba(215, 181, 113, .26);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(60, 50, 36, .55) 0%, rgba(24, 20, 16, .92) 60%),
    #1A1510;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  animation: resIn .62s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes resIn {
  0% { opacity: 0; transform: translateY(18px) scale(.97); }
  100% { opacity: 1; transform: none; }
}
.res-wrap::before {
  content: ""; position: absolute; top: 7px; right: 7px; bottom: 7px; left: 7px;
  border: 1px solid rgba(215, 181, 113, .12);
  pointer-events: none;
}

.res-kicker { font-size: 9.5px; letter-spacing: .58em; text-indent: .58em; color: rgba(215, 181, 113, .58); }

.res-seal {
  width: 70px; height: 70px; margin: 20px auto 0; padding-top: 20px;
  border: 2px solid rgba(178, 60, 46, .82);
  border-radius: 4px;
  color: #D0684F; font-size: 23px; letter-spacing: 2px; box-shadow: inset 0 0 0 1px rgba(178,60,46,.28);
  background: rgba(178, 60, 46, .06);
  transform: rotate(-4deg);
  animation: sealIn .6s .18s cubic-bezier(.2, .9, .2, 1.3) both;
}
@keyframes sealIn {
  0% { opacity: 0; transform: rotate(-14deg) scale(1.5); }
  100% { opacity: 1; transform: rotate(-4deg) scale(1); }
}

.res-name {
  margin: 22px 0 0; font-size: 29px; font-weight: 600; letter-spacing: .12em;
  color: #FBF1D9;
  text-shadow: 0 2px 24px rgba(215, 181, 113, .22);
}
.res-sub { margin-top: 9px; font-size: 11px; letter-spacing: .24em; color: rgba(215, 181, 113, .66); }

.res-line {
  width: 78px; height: 1px; margin: 20px auto 0;
  background: linear-gradient(90deg, rgba(215, 181, 113, 0), rgba(215, 181, 113, .55), rgba(215, 181, 113, 0));
}

.res-desc {
  margin: 18px 0 0; font-size: 12.5px; line-height: 2.0; letter-spacing: .06em;
  color: rgba(232, 220, 199, .74);
}

.res-meta {
  margin-top: 20px; display: flex; justify-content: center; gap: 18px;
  font-size: 10.5px; letter-spacing: .18em; color: rgba(215, 181, 113, .70);
}

.res-wrap .btn-main { margin-top: 26px; min-width: 200px; padding: 13px 24px; font-size: 13.5px; }

.res-foot {
  margin-top: 18px; font-size: 8.5px; letter-spacing: .06em; line-height: 1.9;
  color: rgba(226, 212, 189, .30);
}

/* ---------------- 通用 ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 10vh; transform: translate(-50%, 16px);
  padding: 10px 20px; border-radius: 3px;
  background: rgba(20, 17, 14, .94);
  border: 1px solid rgba(215, 181, 113, .28);
  color: #EFE3CA; font-size: 12.5px; letter-spacing: .10em;
  opacity: 0; pointer-events: none;
  transition: opacity .26s, transform .26s;
  z-index: 60; max-width: 78vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.imgview {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(8, 7, 6, .94); z-index: 90;
}
.imgview.on { display: flex; flex-direction: column; }
.imgview img { max-width: 88vw; max-height: 76vh; border: 1px solid rgba(215, 181, 113, .30); }
.imgview-tip { margin-top: 16px; font-size: 11.5px; letter-spacing: .18em; color: rgba(232, 220, 199, .60); }

@media (min-height: 780px) {
  .in-title { font-size: 38px; }
  .pin-cell { width: 64px; height: 84px; font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .res-wrap, .res-seal { animation: none; }
}

/* 侧边巨型节气水印 */
.draw-ghost {
  position: absolute; right: 6px; top: 50%; z-index: 0;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-size: clamp(88px, 26vw, 120px);
  line-height: 1; letter-spacing: .04em;
  color: rgba(215, 181, 113, .06);
  pointer-events: none; user-select: none;
  text-shadow: 0 0 40px rgba(215, 181, 113, .05);
}