:root {
  --ink: #241418;
  --cinnabar: #a61f32;
  --lacquer: #6d1522;
  --gold: #e4c78a;
  --gold-deep: #a07c3e;
  --paper: #f7f1e4;
  --paper-edge: #e7d7b8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  background: #07060c;
}

h1, h2, button, .seal, .mark {
  font-family: "KaiTi", "STKaiti", "KaiTi_GB2312", "Songti SC", "SimSun", serif;
}

.night {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120, 70, 110, 0.28), transparent 42%),
    radial-gradient(circle at 50% 16%, #3c244c 0%, #1a1028 38%, #09070f 72%);
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.2px 1.2px at 8% 18%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 18% 42%, #fff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 28% 12%, #f8e7c4 50%, transparent 52%),
    radial-gradient(1px 1px at 42% 28%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 63% 16%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 74% 34%, #f3d9a4 50%, transparent 52%),
    radial-gradient(1px 1px at 86% 14%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 92% 46%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 12% 72%, rgba(255,255,255,.7) 50%, transparent 52%),
    radial-gradient(1px 1px at 80% 68%, rgba(255,255,255,.65) 50%, transparent 52%);
  opacity: 0.85;
}

.moon-ring {
  position: absolute;
  left: 50%;
  top: 7%;
  width: 320px;
  height: 320px;
  margin-left: -160px;
  border-radius: 50%;
  border: 1px solid rgba(244, 224, 176, 0.16);
  box-shadow: 0 0 40px rgba(244, 214, 150, 0.08), inset 0 0 30px rgba(244, 214, 150, 0.05);
}

.moon {
  position: absolute;
  left: 50%;
  top: 11%;
  width: 196px;
  height: 196px;
  margin-left: -98px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.95), transparent 16%),
    radial-gradient(circle at 64% 46%, rgba(168, 140, 96, 0.28) 0 7%, transparent 8%),
    radial-gradient(circle at 42% 64%, rgba(150, 120, 80, 0.22) 0 11%, transparent 12%),
    radial-gradient(circle at 50% 45%, #fff8ea 0%, #f3e0b4 46%, #e4c78a 78%, #c6a15e 100%);
  box-shadow:
    0 0 30px 8px rgba(247, 224, 170, 0.38),
    0 0 90px 28px rgba(232, 186, 120, 0.16);
}

.sakura i {
  position: absolute;
  top: -12vh;
  width: 11px;
  height: 11px;
  background: linear-gradient(135deg, #fff 0%, #f7c3cf 45%, #e07a92 100%);
  border-radius: 70% 0 70% 0;
  opacity: 0.9;
  animation: drift linear infinite;
  box-shadow: 0 0 8px rgba(255, 190, 200, 0.35);
}

.sakura i:nth-child(odd) {
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #fff, #f3d2a4);
}

.sakura i:nth-child(1) { left: 6%; animation-duration: 15s; animation-delay: -2s; }
.sakura i:nth-child(2) { left: 14%; animation-duration: 18s; animation-delay: -8s; }
.sakura i:nth-child(3) { left: 24%; animation-duration: 13s; animation-delay: -4s; }
.sakura i:nth-child(4) { left: 33%; animation-duration: 17s; animation-delay: -11s; }
.sakura i:nth-child(5) { left: 46%; animation-duration: 16s; animation-delay: -6s; }
.sakura i:nth-child(6) { left: 55%; animation-duration: 19s; animation-delay: -1s; }
.sakura i:nth-child(7) { left: 64%; animation-duration: 14s; animation-delay: -9s; }
.sakura i:nth-child(8) { left: 72%; animation-duration: 18s; animation-delay: -3s; }
.sakura i:nth-child(9) { left: 80%; animation-duration: 15s; animation-delay: -12s; }
.sakura i:nth-child(10) { left: 88%; animation-duration: 17s; animation-delay: -5s; }
.sakura i:nth-child(11) { left: 94%; animation-duration: 13s; animation-delay: -7s; }
.sakura i:nth-child(12) { left: 40%; animation-duration: 20s; animation-delay: -14s; }

@keyframes drift {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 0.9; }
  100% { transform: translate3d(40px, 115vh, 0) rotate(320deg); opacity: 0.25; }
}

.lantern {
  position: absolute;
  top: 14%;
  width: 26px;
  height: 38px;
  border-radius: 42% 42% 46% 46%;
  background:
    linear-gradient(#4a1018, #4a1018) top / 100% 4px no-repeat,
    linear-gradient(#4a1018, #4a1018) bottom / 100% 5px no-repeat,
    radial-gradient(circle at 50% 42%, #ffe0a0, #e2582c 58%, #8d1c24 100%);
  box-shadow: 0 0 18px rgba(255, 150, 60, 0.55), inset 0 0 8px rgba(255, 230, 170, 0.5);
  transform-origin: top center;
  animation: sway 4.6s ease-in-out infinite;
}

.lantern::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  width: 1px;
  height: 18px;
  background: rgba(180, 60, 70, 0.8);
}

.lantern.l1 { left: 18%; }
.lantern.l2 { right: 18%; animation-delay: -2.1s; }

@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

.ofuda {
  position: absolute;
  top: 9%;
  width: 46px;
  padding: 16px 0 18px;
  text-align: center;
  color: #7a1c24;
  background:
    linear-gradient(#fffdf8, #f3e6cc);
  border: 1px solid #d7b56a;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35), inset 0 0 0 4px rgba(166, 31, 50, 0.06);
}

.ofuda span {
  display: inline-block;
  letter-spacing: 0.35em;
  writing-mode: vertical-rl;
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  font-size: 18px;
}

.ofuda::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  width: 2px;
  height: 14px;
  background: #6d1522;
  transform: translateX(-50%);
}

.ofuda::after {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 12px auto 0;
  border: 1.5px solid var(--cinnabar);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(166, 31, 50, 0.2);
}

.ofuda.left { left: 8%; animation: sway 7s ease-in-out infinite; transform-origin: top center; }
.ofuda.right { right: 8%; animation: sway 6.4s ease-in-out infinite reverse; transform-origin: top center; }

.mist {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30vh;
  background: linear-gradient(transparent, rgba(12, 8, 18, 0.15) 20%, rgba(18, 8, 16, 0.72));
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
}

.card {
  position: relative;
  width: min(440px, 100%);
  padding: 38px 34px 30px;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    linear-gradient(var(--gold-deep), var(--gold-deep)),
    radial-gradient(rgba(120, 72, 40, 0.045) 0.6px, transparent 0.7px),
    linear-gradient(180deg, rgba(255, 252, 246, 0.55), rgba(236, 222, 196, 0.35));
  background-size:
    22px 2px, 2px 22px,
    22px 2px, 2px 22px,
    22px 2px, 2px 22px,
    22px 2px, 2px 22px,
    3px 3px, 100% 100%;
  background-position:
    left 10px top 10px, left 10px top 10px,
    right 10px top 10px, right 10px top 10px,
    left 10px bottom 10px, left 10px bottom 10px,
    right 10px bottom 10px, right 10px bottom 10px,
    0 0, 0 0;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  border: 1px solid var(--gold);
  box-shadow:
    0 0 0 5px rgba(109, 21, 34, 0.08),
    0 0 0 6px rgba(212, 176, 106, 0.45),
    0 28px 64px rgba(0, 0, 0, 0.48);
  animation: rise 0.55s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.brand { text-align: center; margin-bottom: 8px; }

.seal {
  width: 70px;
  height: 70px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  color: #fff6ea;
  font-size: 34px;
  background:
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(244, 220, 170, 0.95) 59% 63%, transparent 64%),
    radial-gradient(circle at 32% 28%, #d45050, #8a1822 62%, #5c1018 100%);
  border: 2px solid var(--gold);
  border-radius: 4px;
  box-shadow:
    0 10px 18px rgba(80, 10, 16, 0.28),
    inset 0 0 0 3px rgba(255, 230, 190, 0.25);
  transform: rotate(-10deg);
}

.mark {
  margin: 0;
  letter-spacing: 0.48em;
  text-indent: 0.48em;
  color: #8d6234;
  font-size: 13px;
}

h1 {
  margin: 8px 0 0;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  font-size: 30px;
  color: #3a1816;
}

.line {
  position: relative;
  display: block;
  width: 168px;
  height: 10px;
  margin: 12px auto 4px;
  background:
    linear-gradient(90deg, transparent, var(--gold-deep) 18%, var(--gold-deep) 42%, transparent 42%),
    linear-gradient(90deg, transparent 58%, var(--gold-deep) 58%, var(--gold-deep) 82%, transparent);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: center;
}

.line::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  background: var(--cinnabar);
  transform: translate(-50%, -50%) rotate(45deg);
}

label {
  display: block;
  margin: 13px 0;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: #7a3e32;
}

input {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid var(--paper-edge);
  border-bottom: 2px solid var(--gold-deep);
  border-radius: 2px;
  background: rgba(255, 252, 246, 0.92);
  color: #2a1416;
  font: inherit;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 2px rgba(90, 40, 20, 0.05);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: #c45a4a;
  border-bottom-color: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(166, 31, 50, 0.12);
}

::placeholder { color: #b7a48c; }

.cap-row { display: flex; gap: 10px; align-items: center; }
.cap-row input { flex: 1; margin-top: 6px; }

.cap-row img {
  width: 122px;
  height: 42px;
  margin-top: 6px;
  cursor: pointer;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--paper-edge);
  box-shadow: 0 2px 0 rgba(160, 124, 62, 0.25);
}

.cap-row img:hover { border-color: var(--cinnabar); }

button {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  border: 1px solid #f0d7a4;
  cursor: pointer;
  color: #fff8ea;
  letter-spacing: 0.46em;
  text-indent: 0.46em;
  background: linear-gradient(180deg, #c4474a 0%, #8e1d28 58%, #64141c 100%);
  font-size: 17px;
  box-shadow:
    0 8px 18px rgba(90, 16, 24, 0.32),
    inset 0 1px 0 rgba(255, 220, 180, 0.4);
  transition: filter 0.15s, transform 0.15s;
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }

.err {
  margin: 4px 0 0;
  color: var(--cinnabar);
  min-height: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.err:not([hidden]) {
  padding: 8px 10px;
  background: rgba(166, 31, 50, 0.07);
  border-left: 3px solid var(--cinnabar);
}

.ok { text-align: center; padding: 28px 8px 10px; }

.ok h2 {
  margin: 0 0 10px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  font-weight: 500;
  color: var(--lacquer);
}

.ok p {
  margin: 0;
  color: #6d5346;
  letter-spacing: 0.08em;
}

@media (max-width: 820px) {
  .ofuda, .lantern { display: none; }
  .moon { width: 140px; height: 140px; margin-left: -70px; top: 6%; }
  .moon-ring { width: 210px; height: 210px; margin-left: -105px; }
  .card { padding: 28px 20px 22px; }
  h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .sakura i, .lantern, .ofuda, .card { animation: none; }
}
