:root {
  --cream: #fff6e7;
  --cream-dim: rgba(255, 246, 231, 0.72);
  --gold: #ffd27a;
  --gold-deep: #e6a84f;
  --rose: #ff9fb2;
  --ink: #24172b;
  --glass: rgba(28, 19, 35, 0.62);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: #140e1b;
  color: var(--cream);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

.sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #1a1120;
}

.sky-image {
  position: absolute;
  inset: -4%;
  background: url('/gate/cover.jpg') center 58% / cover no-repeat;
  filter: saturate(1.12) brightness(0.78);
  transform: scale(1.045);
  animation: skyDrift 18s ease-in-out infinite alternate;
}

.sky-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 32%, rgba(255, 224, 175, 0.22) 0%, rgba(28, 16, 30, 0.16) 42%, rgba(15, 10, 22, 0.72) 100%),
    linear-gradient(180deg, rgba(20, 12, 27, 0.18) 0%, rgba(20, 12, 27, 0.52) 100%);
}

.stars {
  position: absolute;
  inset: 0;
  opacity: 0.75;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(255, 244, 206, 0.9) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 28% 38%, rgba(255, 231, 187, 0.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 43% 16%, rgba(255, 255, 255, 0.8) 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 61% 28%, rgba(255, 228, 172, 0.85) 50%, transparent 51%),
    radial-gradient(1px 1px at 76% 15%, rgba(255, 255, 255, 0.65) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 88% 37%, rgba(255, 236, 192, 0.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 18% 72%, rgba(255, 255, 255, 0.5) 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 71% 76%, rgba(255, 226, 170, 0.55) 50%, transparent 51%);
  animation: twinkle 4.8s ease-in-out infinite alternate;
  pointer-events: none;
}

.clouds { position: absolute; inset: 0; pointer-events: none; }

.cloud {
  position: absolute;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.5;
  background: radial-gradient(ellipse at center, rgba(255, 226, 208, 0.8), rgba(255, 196, 204, 0.18) 58%, transparent 72%);
  animation: cloudFloat 24s ease-in-out infinite alternate;
}

.c1 { width: 55vw; height: 16vh; left: -16vw; bottom: 11vh; animation-duration: 26s; }
.c2 { width: 46vw; height: 14vh; right: -14vw; bottom: 4vh; animation-duration: 31s; animation-delay: -9s; }
.c3 { width: 38vw; height: 12vh; left: 25vw; bottom: -5vh; opacity: 0.35; animation-duration: 22s; animation-delay: -4s; }

.gate {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 18px max(20px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.gate-glow {
  position: absolute;
  width: min(78vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 205, 146, 0.22) 0%, rgba(255, 156, 186, 0.1) 38%, transparent 68%);
  filter: blur(20px);
  pointer-events: none;
}

.ticket {
  position: relative;
  width: min(430px, calc(100vw - 36px));
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 26px 28px 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 230, 188, 0.34);
  background:
    linear-gradient(145deg, rgba(62, 42, 66, 0.72) 0%, rgba(30, 20, 38, 0.86) 52%, rgba(24, 16, 32, 0.9) 100%);
  box-shadow:
    0 30px 90px rgba(4, 3, 10, 0.55),
    inset 0 1px 0 rgba(255, 244, 214, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  overflow: hidden;
  animation: ticketIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ticket::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 236, 200, 0.1), transparent 28%),
    radial-gradient(ellipse at 85% 0%, rgba(255, 198, 151, 0.16), transparent 55%);
  pointer-events: none;
}

.ticket-notch {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #140e1b;
  box-shadow: inset 0 0 0 1px rgba(255, 227, 182, 0.2);
  transform: translateY(-50%);
}
.ticket-notch.left { left: -11px; }
.ticket-notch.right { right: -11px; }

.ticket-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 222, 172, 0.82);
  font-size: 10px;
  letter-spacing: 0.2em;
}

.ticket-mark { color: var(--gold); font-size: 15px; text-shadow: 0 0 12px rgba(255, 205, 120, 0.8); }

h1 {
  position: relative;
  margin: 14px 0 0;
  font-size: clamp(23px, 6.2vw, 30px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, #fff8ea 8%, #ffd9a0 55%, #ffc0b1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 24px rgba(255, 196, 148, 0.14);
}

.sub {
  position: relative;
  margin: 8px 0 0;
  color: var(--cream-dim);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}

.countdown {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 224, 178, 0.18);
  background: rgba(255, 220, 170, 0.07);
  color: rgba(255, 235, 205, 0.66);
  font-size: 10.5px;
  letter-spacing: 0.06em;
}
.countdown[hidden] { display: none !important; }
.countdown b {
  color: var(--gold);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(255, 205, 120, 0.35);
}
.countdown.show { animation: countdownIn 0.55s ease both; }
@keyframes countdownIn {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

.route {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 22px 0 20px;
}

.route-end { display: flex; flex-direction: column; gap: 3px; min-width: 44px; }
.route-end.right { text-align: right; align-items: flex-end; }
.route-end b { font-size: 17px; font-weight: 600; color: #fff3dc; letter-spacing: 0.06em; }
.route-end span { font-size: 8.5px; letter-spacing: 0.2em; color: rgba(255, 225, 180, 0.52); }

.route-line {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
}
.route-line i {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 211, 145, 0.5), transparent);
}
.route-line i:first-child { background: linear-gradient(90deg, transparent, rgba(255, 211, 145, 0.28)); }
.route-line em { font-style: normal; font-size: 15px; transform: translateY(-1px); filter: drop-shadow(0 0 8px rgba(255, 205, 120, 0.55)); }

.gate-form { position: relative; }

.field > span {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 235, 205, 0.62);
  font-size: 10.5px;
  letter-spacing: 0.16em;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 226, 178, 0.24);
  background: rgba(12, 8, 18, 0.4);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.26);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.input-wrap:focus-within {
  border-color: rgba(255, 210, 140, 0.66);
  box-shadow: 0 0 0 4px rgba(255, 198, 123, 0.1), inset 0 2px 10px rgba(0, 0, 0, 0.26);
}

#gatePassword {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff6e7;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 11px 0;
}
#gatePassword::placeholder { color: rgba(255, 236, 209, 0.32); letter-spacing: 0.02em; }

.peek {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 226, 183, 0.6);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s ease, color 0.2s ease;
}
.peek:hover { background: rgba(255, 224, 176, 0.1); color: var(--gold); }

.board {
  width: 100%;
  margin-top: 13px;
  padding: 13px 18px;
  border: 0;
  border-radius: 14px;
  color: #2d1a2a;
  background: linear-gradient(120deg, #ffe3ad 0%, #ffc98d 45%, #ffb5a9 100%);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(255, 172, 121, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.board:hover { transform: translateY(-1px); filter: brightness(1.04); box-shadow: 0 14px 32px rgba(255, 172, 121, 0.3); }
.board:active { transform: translateY(0) scale(0.99); }
.board:disabled { cursor: wait; filter: grayscale(0.2) brightness(0.86); transform: none; }

.error {
  min-height: 18px;
  margin: 10px 2px 0;
  color: #ffc1c9;
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}
.error.show { animation: errorIn 0.32s ease both; }
.ticket.shake { animation: shake 0.42s ease; }

.hint {
  margin: 2px 2px 0;
  color: rgba(255, 232, 197, 0.4);
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 20px;
  padding-top: 13px;
  border-top: 1px dashed rgba(255, 224, 176, 0.18);
  color: rgba(255, 232, 201, 0.45);
  font-size: 9px;
  letter-spacing: 0.1em;
  white-space: normal;
}
.meta b { color: rgba(255, 226, 182, 0.78); font-weight: 600; letter-spacing: 0.08em; }

.foot {
  position: relative;
  margin: 0;
  color: rgba(255, 240, 219, 0.46);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 26px;
  border: 2px solid rgba(255, 215, 145, 0.9);
  border-radius: 12px;
  color: #ffe1a8;
  transform: translate(-50%, -50%) rotate(-9deg) scale(0.6);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 40px rgba(255, 200, 120, 0.2), inset 0 0 24px rgba(255, 197, 110, 0.08);
  text-align: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.3s ease, transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.stamp b { font-size: 26px; letter-spacing: 0.14em; text-shadow: 0 0 18px rgba(255, 205, 120, 0.4); }
.stamp span { font-size: 10px; letter-spacing: 0.08em; color: rgba(255, 238, 207, 0.75); }
.stamp.show { opacity: 1; transform: translate(-50%, -50%) rotate(-9deg) scale(1); }

.gate.unlocking .ticket { animation: ticketAway 0.95s cubic-bezier(0.6, 0, 0.8, 0.2) 0.55s forwards; }
.gate.unlocking .gate-glow { animation: glowBurst 1.1s ease-out both; }
.gate.unlocking .foot { opacity: 0; transition: opacity 0.4s ease; }
.gate.gone { opacity: 0; transition: opacity 0.7s ease; }

@keyframes skyDrift {
  0% { transform: scale(1.045) translate3d(0, 0, 0); }
  100% { transform: scale(1.075) translate3d(0.6%, -0.4%, 0); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.95; }
}
@keyframes cloudFloat {
  0% { transform: translate3d(-1.5%, 0, 0) scale(1); }
  100% { transform: translate3d(2.5%, -1.2%, 0) scale(1.04); }
}
@keyframes ticketIn {
  0% { opacity: 0; transform: translateY(22px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes errorIn {
  0% { opacity: 0; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes ticketAway {
  0% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-14px) scale(1.035); filter: blur(6px); }
}
@keyframes glowBurst {
  0% { opacity: 0.5; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.65); }
}

@media (max-width: 430px) {
  .gate { padding: 18px 14px max(16px, env(safe-area-inset-bottom)); }
  .ticket { padding: 22px 20px 19px; border-radius: 20px; }
  .ticket-notch { display: none; }
  .meta { font-size: 8px; letter-spacing: 0.06em; }
  .route { margin: 18px 0 17px; }
  .stamp b { font-size: 23px; }
  #gatePassword { font-size: 16px; }
}

@media (max-height: 700px) {
  body { overflow-y: auto; }
  .gate { justify-content: flex-start; padding-top: 24px; }
  .ticket { padding-top: 20px; padding-bottom: 18px; }
  h1 { margin-top: 10px; }
  .route { margin: 15px 0 14px; }
  .meta { margin-top: 14px; padding-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
