:root {
  --bg-deep: #090d1f;
  --bg-mid: #151b38;
  --bg-plum: #251934;
  --rose-gold: #e87a90;
  --rose-glow: rgba(232, 122, 144, 0.35);
  --scarf-gold: #f4c95d;
  --fox-amber: #eb9468;
  --cream: #fffaf2;
  --cream-muted: rgba(255, 250, 242, 0.72);
  --glass-bg: rgba(22, 27, 56, 0.68);
  --glass-border: rgba(244, 201, 93, 0.26);
}

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

html, body {
  min-height: 100%;
  height: 100%;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Serif SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(ellipse at 50% 18%, #222954 0%, var(--bg-mid) 42%, var(--bg-deep) 100%);
  color: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  position: relative;
}

/* Velvet Starfield Layers */
.cosmos-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.42;
}

.nebula-rose {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(232, 122, 144, 0.42), transparent 70%);
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  animation: pulseNebula 9s ease-in-out infinite alternate;
}

.nebula-gold {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(244, 201, 93, 0.22), transparent 72%);
  bottom: 10%;
  right: 12%;
  animation: pulseNebula 12s ease-in-out infinite alternate-reverse;
}

@keyframes pulseNebula {
  0% { opacity: 0.28; transform: translateX(-50%) scale(0.95); }
  100% { opacity: 0.5; transform: translateX(-50%) scale(1.08); }
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #fffdf7;
  box-shadow: 0 0 6px rgba(255, 250, 242, 0.8);
  animation: twinkle var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.75); }
  50% { opacity: 0.95; transform: scale(1.2); }
}

.shooting-star {
  position: absolute;
  top: 14%;
  right: 12%;
  width: 110px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255, 250, 242, 0.92), rgba(244, 201, 93, 0.4), transparent);
  transform: rotate(-32deg);
  opacity: 0;
  animation: meteorGlide 8.5s ease-in-out infinite 2.2s;
}

@keyframes meteorGlide {
  0% { opacity: 0; transform: translate(40px, -25px) rotate(-32deg) scaleX(0.4); }
  8% { opacity: 0.95; }
  20% { opacity: 0; transform: translate(-220px, 138px) rotate(-32deg) scaleX(1.1); }
  100% { opacity: 0; transform: translate(-220px, 138px) rotate(-32deg) scaleX(1.1); }
}

/* Gate Card */
.gate-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
}

.gate-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 36px 28px 32px;
  box-shadow:
    0 24px 60px rgba(4, 6, 18, 0.65),
    inset 0 1px 0 rgba(255, 250, 242, 0.16);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.gate-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 201, 93, 0.72), transparent);
}

/* Original B612 Planet & Rose Silhouette Stage */
.planet-stage {
  width: 168px;
  height: 168px;
  margin: 0 auto 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.b612-emblem {
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: floatPlanet 6s ease-in-out infinite;
}

@keyframes floatPlanet {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1.2deg); }
}

.orbit-ring {
  transform-origin: 100px 118px;
  animation: spinOrbit 26s linear infinite;
}

@keyframes spinOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rose-silhouette {
  transform-origin: 100px 92px;
  animation: swayRose 4.8s ease-in-out infinite;
}

@keyframes swayRose {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2.2deg); }
}

.dome-gleam {
  animation: shimmerDome 4s ease-in-out infinite alternate;
}

@keyframes shimmerDome {
  0% { opacity: 0.32; }
  100% { opacity: 0.72; }
}

/* Titles */
.gate-title {
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cream);
  margin-bottom: 8px;
  text-shadow: 0 2px 14px rgba(244, 201, 93, 0.22);
}

.gate-subtitle {
  font-size: 0.92rem;
  color: var(--cream-muted);
  letter-spacing: 0.08em;
  margin-bottom: 26px;
}

/* Form */
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.passcode-input {
  width: 100%;
  height: 50px;
  padding: 0 46px 0 18px;
  border-radius: 16px;
  border: 1.5px solid rgba(255, 250, 242, 0.18);
  background: rgba(11, 15, 35, 0.72);
  color: var(--cream);
  font-size: 1rem;
  letter-spacing: 0.12em;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.passcode-input::placeholder {
  color: rgba(255, 250, 242, 0.36);
  letter-spacing: 0.04em;
  font-size: 0.92rem;
}

.passcode-input:focus {
  border-color: var(--scarf-gold);
  background: rgba(14, 19, 44, 0.9);
  box-shadow: 0 0 0 3px rgba(244, 201, 93, 0.16), 0 0 18px rgba(232, 122, 144, 0.18);
}

.toggle-visibility {
  position: absolute;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: rgba(255, 250, 242, 0.56);
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

.toggle-visibility:hover {
  color: var(--scarf-gold);
  background: rgba(255, 250, 242, 0.08);
}

.enter-btn {
  height: 50px;
  border-radius: 16px;
  border: 1px solid rgba(255, 250, 242, 0.24);
  background: linear-gradient(135deg, #e87a90 0%, #d96581 48%, #eb9468 100%);
  color: #fffaf2;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(232, 122, 144, 0.32);
  transition: transform 0.18s ease, box-shadow 0.22s ease, opacity 0.2s ease;
}

.enter-btn:hover:not(:disabled) {
  transform: translateY(-1.5px);
  box-shadow: 0 14px 28px rgba(232, 122, 144, 0.44);
}

.enter-btn:active:not(:disabled) {
  transform: translateY(0.5px) scale(0.99);
}

.enter-btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.gate-feedback {
  min-height: 22px;
  font-size: 0.86rem;
  color: #ffb4c2;
  line-height: 1.45;
  margin-top: 4px;
  transition: opacity 0.2s ease;
}

.gate-card.shake {
  animation: gentleShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes gentleShake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

@media (max-width: 420px) {
  .gate-card {
    padding: 30px 22px 26px;
    border-radius: 24px;
  }
  .planet-stage {
    width: 150px;
    height: 150px;
  }
  .gate-title {
    font-size: 1.28rem;
  }
}
