/* ==========================================================================
   浪潮电影社 · 十周年纪念卡
   ========================================================================== */

:root {
  --ink: #f4f1e9;
  --ink-soft: rgba(244, 241, 233, 0.66);
  --ink-dim: rgba(244, 241, 233, 0.38);
  --gold: #d9bb84;
  --gold-deep: #a8853f;
  --bg: #07070a;
  --line: rgba(244, 241, 233, 0.13);
  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "STZhongsong", "SimSun", Georgia, "Times New Roman", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ------------------------------- 背景氛围 -------------------------------- */

.ambient {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 90vh;
  pointer-events: none;
  background:
    radial-gradient(58% 46% at 50% 0%, rgba(168, 133, 63, 0.20), transparent 70%),
    radial-gradient(40% 32% at 82% 12%, rgba(97, 74, 40, 0.16), transparent 72%),
    radial-gradient(46% 40% at 12% 6%, rgba(60, 66, 92, 0.16), transparent 74%);
  filter: blur(6px);
  animation: breathe 14s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { opacity: 0.72; transform: translateY(-1.5%) scale(1); }
  to   { opacity: 1;    transform: translateY(1%) scale(1.04); }
}

/* 胶片颗粒 */
.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 9;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.9s steps(3) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-1.4%, 0.8%); }
  66%  { transform: translate(0.9%, -1.2%); }
  100% { transform: translate(0, 0); }
}

/* --------------------------------- 舞台 ---------------------------------- */

.stage {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vh, 72px) clamp(20px, 6vw, 40px);
}

.view--form {
  width: min(100%, 460px);
  padding-bottom: 3vh;
}

/* --------------------------------- 文案 ---------------------------------- */

.eyebrow {
  margin: 0 0 22px;
  font-size: 10px;
  letter-spacing: 0.42em;
  color: var(--gold-deep);
  text-transform: uppercase;
}

.lede__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.45;
  letter-spacing: 0.02em;
}

.lede__line {
  font-size: clamp(23px, 5.8vw, 31px);
  color: rgba(244, 241, 233, 0.92);
}

.lede__big {
  font-size: clamp(34px, 8.6vw, 52px);
  letter-spacing: 0.22em;
  color: var(--gold);
  position: relative;
  width: fit-content;
}

.lede__big::after {
  content: "";
  position: absolute;
  left: -4px;
  right: calc(-4px + 0.22em);
  bottom: 0.04em;
  height: 0.4em;
  background: linear-gradient(90deg, transparent, rgba(217, 187, 132, 0.18), transparent);
  z-index: -1;
}

.lede__title .dot {
  display: inline-block;
  margin: 0 0.26em;
  color: rgba(217, 187, 132, 0.55);
  font-size: 0.72em;
  vertical-align: 0.12em;
}

.lede__ask {
  margin: 20px 0 0;
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}

/* --------------------------------- 表单 ---------------------------------- */

.entry {
  margin-top: clamp(40px, 8vh, 64px);
}

.field {
  position: relative;
  padding: 16px 0 11px;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.45s ease;
}

.field + .field { margin-top: 6px; }

.field:focus-within { border-color: rgba(217, 187, 132, 0.42); }

.field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.6s var(--ease);
}

.field:focus-within::after { transform: scaleX(1); }

.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  margin-bottom: 9px;
  transition: color 0.4s ease;
}

.field:focus-within label { color: var(--gold); }

.field input,
.field textarea {
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  resize: none;
  overflow: hidden;
}

.field textarea { height: 1.6em; }

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(244, 241, 233, 0.2);
  letter-spacing: 0.02em;
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  transition: background-color 9999s ease-out;
}

.field__count {
  position: absolute;
  right: 0;
  bottom: 14px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.field:focus-within .field__count { opacity: 1; }

/* 按钮 */
.submit {
  position: relative;
  width: 100%;
  height: 56px;
  margin-top: clamp(34px, 6vh, 46px);
  border-radius: 999px;
  border: 1px solid rgba(217, 187, 132, 0.34);
  background: linear-gradient(180deg, rgba(217, 187, 132, 0.14), rgba(217, 187, 132, 0.03));
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.16em;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.5s ease, border-color 0.5s ease, background 0.5s ease, transform 0.3s var(--ease), box-shadow 0.5s ease;
}

.submit__label { position: relative; z-index: 2; }

.submit__arrow {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin-left: 10px;
  transition: transform 0.45s var(--ease);
}

.submit::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 240, 214, 0.16), transparent);
  transform: skewX(-18deg);
  transition: left 0.85s var(--ease);
}

.submit:disabled {
  opacity: 0.32;
  cursor: default;
  border-color: var(--line);
  background: rgba(244, 241, 233, 0.03);
}

.submit:not(:disabled) {
  border-color: rgba(217, 187, 132, 0.62);
  background: linear-gradient(180deg, rgba(217, 187, 132, 0.22), rgba(217, 187, 132, 0.06));
  box-shadow: 0 10px 40px -18px rgba(217, 187, 132, 0.7);
}

.submit:not(:disabled):hover { transform: translateY(-1px); }
.submit:not(:disabled):hover::before { left: 120%; }
.submit:not(:disabled):hover .submit__arrow { transform: translateX(4px); }
.submit:not(:disabled):active { transform: scale(0.99); }

.submit.is-busy { pointer-events: none; }
.submit.is-busy .submit__label { opacity: 0.5; }

.footnote {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
}

/* ------------------------------- 入场动画 -------------------------------- */

.lede > *,
.entry > * {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.95s var(--ease) forwards;
}

.eyebrow          { animation-delay: 0.08s; }
.lede__title      { animation-delay: 0.18s; }
.lede__ask        { animation-delay: 0.30s; }
.field:nth-of-type(1) { animation-delay: 0.40s; }
.field:nth-of-type(2) { animation-delay: 0.48s; }
.field:nth-of-type(3) { animation-delay: 0.56s; }
.submit           { animation-delay: 0.66s; }
.footnote         { animation-delay: 0.74s; }

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.view--form.is-leaving {
  animation: formOut 0.55s var(--ease) forwards;
}

@keyframes formOut {
  to { opacity: 0; transform: translateY(-22px) scale(0.985); filter: blur(6px); }
}

.view--form.is-reenter {
  animation: formIn 0.7s var(--ease) both;
}

@keyframes formIn {
  from { opacity: 0; transform: translateY(18px) scale(0.99); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}

/* ============================== 纪念卡 ================================== */

.view--result {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 28px);
  background: #000;
  overflow: hidden;
}

.backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(70% 50% at 30% 22%, rgba(120, 96, 56, 0.55), transparent 70%),
    radial-gradient(60% 50% at 78% 74%, rgba(52, 60, 84, 0.5), transparent 72%),
    #0b0b0f;
}

.backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  opacity: 0;
  transform: scale(1.16);
  filter: blur(18px) brightness(0.78) saturate(0.85);
  transition:
    opacity 1.6s ease,
    transform 2.8s var(--ease),
    filter 1.9s ease;
  will-change: transform, opacity, filter;
}

.view--result.is-in .backdrop img {
  opacity: 1;
  transform: scale(1.03);
  filter: blur(0) brightness(0.82) saturate(0.95);
}

.view--result.is-in .backdrop img.is-settled {
  animation: kenburns 26s ease-in-out 2.6s infinite alternate;
}

@keyframes kenburns {
  from { transform: scale(1.03); }
  to   { transform: scale(1.1); }
}

.backdrop__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to top,
    #07070a 0%,
    rgba(7, 7, 10, 0.94) 16%,
    rgba(7, 7, 10, 0.6) 42%,
    rgba(7, 7, 10, 0.12) 68%,
    rgba(7, 7, 10, 0.34) 100%
  );
}

.scrim--top {
  background: linear-gradient(to bottom, rgba(7, 7, 10, 0.62), transparent 26%);
}

/* 卡片文案 */
.card {
  position: relative;
  z-index: 3;
  padding: 0 clamp(24px, 7vw, 68px);
  margin-bottom: clamp(26px, 5vh, 46px);
  max-width: 940px;
}

.card__stamp {
  margin: 0 0 clamp(18px, 3.4vh, 30px);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--gold);
  opacity: 0;
  transform: translateY(14px);
}

.card__quote {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(24px, 5.6vw, 44px);
  line-height: 1.62;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(20px);
  text-wrap: pretty;
}

.card__quote::before { content: "「"; color: rgba(217, 187, 132, 0.72); }
.card__quote::after  { content: "」"; color: rgba(217, 187, 132, 0.72); }

.card__ordinal {
  margin: -0.6em 0 clamp(14px, 2.6vh, 22px);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(217, 187, 132, 0.7);
  opacity: 0;
  transform: translateY(10px);
}

.card__origin {
  margin: clamp(16px, 2.6vh, 24px) 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  opacity: 0;
  transform: translateY(16px);
}

.card__film {
  color: rgba(244, 241, 233, 0.82);
}

.card__film::before {
  content: "— 《";
  color: rgba(217, 187, 132, 0.5);
}

.card__film::after {
  content: "》";
  color: rgba(217, 187, 132, 0.5);
}

/* 署名：大号金色昵称 */
.card__sign {
  display: flex;
  align-items: center;
  margin-top: clamp(14px, 2.6vh, 22px);
  opacity: 0;
  transform: translateY(18px);
}

.card__sign-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.card__sign-to {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.42em;
  color: rgba(217, 187, 132, 0.6);
  transform: translateX(0.1em);
}

.card__sign-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(27px, 6.6vw, 42px);
  line-height: 1.22;
  letter-spacing: 0.08em;
  padding-right: 0.08em;
  background: linear-gradient(100deg, #f8f0dc 0%, #d9bb84 42%, #b8955a 74%, #ecdbb8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 22px rgba(217, 187, 132, 0.28));
  text-wrap: balance;
}

/* 触发显示 */
.view--result.is-in .card__stamp   { animation: rise 1.1s var(--ease) 0.55s forwards; }
.view--result.is-in .card__ordinal { animation: rise 1s var(--ease) 0.68s forwards; }
.view--result.is-in .card__quote   { animation: rise 1.2s var(--ease) 0.78s forwards; }
.view--result.is-in .card__origin  { animation: rise 1.1s var(--ease) 1.02s forwards; }
.view--result.is-in .card__sign    { animation: rise 1.1s var(--ease) 1.16s forwards; }

/* 操作按钮 */
.actions {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 clamp(24px, 7vw, 68px);
  opacity: 0;
  transform: translateY(12px);
}

.view--result.is-in .actions {
  animation: rise 1s var(--ease) 1.35s forwards;
}

.actions button {
  flex: 0 1 230px;
  height: 48px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.14em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.3s var(--ease), background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.actions button:active { transform: scale(0.98); }

.ghost {
  border: 1px solid rgba(244, 241, 233, 0.2);
  background: rgba(244, 241, 233, 0.04);
  color: var(--ink-soft);
  backdrop-filter: blur(10px);
}

.ghost:hover { border-color: rgba(244, 241, 233, 0.38); color: var(--ink); }

.solid {
  border: 1px solid rgba(217, 187, 132, 0.55);
  background: rgba(217, 187, 132, 0.14);
  color: var(--gold);
  backdrop-filter: blur(10px);
}

.solid:hover { background: rgba(217, 187, 132, 0.24); }

/* ------------------------------ 第 N 位 ------------------------------ */

.view--count {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: clamp(4px, 1.2vh, 10px);
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(ellipse 78% 52% at 50% 44%, rgba(88, 66, 32, 0.5), transparent 70%),
    radial-gradient(ellipse at 50% 100%, rgba(30, 24, 14, 0.9), transparent 60%),
    #07070a;
  opacity: 0;
  transition: opacity 0.55s var(--ease);
}

.view--count.is-in { opacity: 1; }

.count__kicker {
  margin: 0 0 clamp(10px, 3vh, 26px);
  font-size: 10px;
  letter-spacing: 0.42em;
  color: rgba(217, 187, 132, 0.62);
  transform: translateY(8px);
  opacity: 0;
}

.count__lead {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(15px, 3.8vw, 19px);
  letter-spacing: 0.42em;
  color: rgba(244, 241, 233, 0.66);
  transform: translateY(10px);
  opacity: 0;
}

.count__num {
  margin: clamp(2px, 0.6vh, 8px) 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(92px, 27vw, 196px);
  line-height: 1.02;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  background: linear-gradient(178deg, #fbf4e4 4%, #e6cd9c 38%, #d9bb84 62%, #a8853f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 46px rgba(217, 187, 132, 0.34));
  transform: scale(0.92);
  opacity: 0;
}

.count__tail {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(15px, 3.8vw, 20px);
  letter-spacing: 0.16em;
  color: rgba(244, 241, 233, 0.86);
  transform: translateY(10px);
  opacity: 0;
}

.count__sub {
  margin: clamp(16px, 4vh, 34px) 0 0;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(244, 241, 233, 0.3);
  opacity: 0;
}

/* 入场：错开浮现 */
.view--count.is-in .count__kicker { animation: countUp 0.9s var(--ease) 0.1s forwards; }
.view--count.is-in .count__lead   { animation: countUp 0.9s var(--ease) 0.22s forwards; }
.view--count.is-in .count__num    { animation: numIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.34s forwards; }
.view--count.is-in .count__tail   { animation: countUp 0.9s var(--ease) 0.46s forwards; }
.view--count.is-in .count__sub    { animation: countUp 0.9s var(--ease) 0.62s forwards; }

@keyframes countUp {
  to { transform: translateY(0); opacity: 1; }
}

@keyframes numIn {
  0% { transform: scale(0.86); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.count__num.is-done {
  opacity: 1;
  animation: numBeat 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes numBeat {
  0% { transform: scale(1); }
  38% { transform: scale(1.075); }
  100% { transform: scale(1); }
}

/* -------------------------------- 加载态 --------------------------------- */

.loading {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  background: rgba(7, 7, 10, 0.88);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.loading__track {
  width: 168px;
  height: 1px;
  background: rgba(244, 241, 233, 0.14);
  overflow: hidden;
}

.loading__track i {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: sweep 1.25s ease-in-out infinite;
}

@keyframes sweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(340%); }
}

.loading__text {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  max-width: 78vw;
  text-align: center;
  line-height: 1.9;
}

/* ------------------------------- 小屏适配 -------------------------------- */

@media (max-height: 700px) and (max-width: 520px) {
  .stage { padding-top: 34px; padding-bottom: 34px; }
  .entry { margin-top: 34px; }
  .field { padding: 12px 0 9px; }
  .card__quote { font-size: 22px; }
}

@media (min-width: 900px) {
  .view--result { justify-content: flex-end; }
  .card { padding-bottom: 8px; }
}

/* 尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .view--result .card__stamp,
  .view--result .card__quote,
  .view--result .card__origin,
  .view--result .actions { opacity: 1; transform: none; }
  .view--result .backdrop img { opacity: 1; transform: none; filter: brightness(0.82); }
}
