/* Reset */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Ma Shan Zheng', 'Long Cang', cursive;
  background: #f5efe4;
  color: #2d211b;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 登录页背景图 */
body.login-bg {
  background: url('../assets/login-bg.jpg') top center/cover no-repeat;
  position: relative;
  overflow: hidden;
}

body.login-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(38, 23, 12, 0.18) 0%, rgba(31, 19, 12, 0.02) 44%, rgba(16, 24, 26, 0.5) 100%),
    linear-gradient(90deg, rgba(28, 18, 10, 0.1), transparent 48%, rgba(24, 15, 10, 0.04));
  z-index: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home-back {
  position: fixed;
  z-index: 400;
  top: 24px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 17px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(32, 22, 15, 0.18);
  border: 1px solid rgba(255, 250, 240, 0.42);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(28, 18, 10, 0.12);
  font-family: 'ZCOOL KuaiLe', sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.home-back:hover,
.home-back:focus-visible {
  color: #6f291e;
  background: rgba(255, 250, 240, 0.92);
  border-color: rgba(255, 250, 240, 0.78);
  transform: translateX(-3px);
}

body.main-stage .home-back {
  color: rgba(255, 245, 226, 0.92);
  background: rgba(38, 13, 8, 0.28);
  border-color: rgba(255, 215, 158, 0.28);
}

/* ===== 登录区 ===== */
.login-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  justify-content: space-between;
  padding: clamp(70px, 9vh, 110px) 24px clamp(56px, 8vh, 88px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), filter 0.65s ease;
}

.login-section.hidden {
  opacity: 0;
  transform: scale(1.03);
  filter: blur(8px);
  pointer-events: none;
  position: absolute;
}

.login-section h1 {
  font-family: 'Long Cang', 'Ma Shan Zheng', cursive;
  font-size: clamp(3.75rem, 6.5vw, 6.6rem);
  font-weight: 400;
  color: white;
  line-height: 1;
  text-shadow: 0 3px 22px rgba(38, 21, 10, 0.42);
  letter-spacing: 0.12em;
  animation: title-arrive 1.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.login-bg .login-section,
body.login-bg .main-section {
  position: relative;
  z-index: 1;
}

body.login-bg .login-section h1 {
  color: white;
  text-shadow: 0 3px 22px rgba(38, 21, 10, 0.42);
}

.login-panel {
  width: min(92vw, 430px);
  padding: 13px;
  color: rgba(255, 249, 238, 0.92);
  background: rgba(31, 27, 23, 0.28);
  border: 1px solid rgba(255, 248, 233, 0.34);
  border-radius: 20px;
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  box-shadow: 0 18px 60px rgba(20, 16, 12, 0.22), inset 0 1px rgba(255, 255, 255, 0.12);
  animation: panel-arrive 1s 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-eyebrow {
  padding: 3px 7px 11px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.63rem;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

.login-input-group {
  display: flex;
  gap: 10px;
}

.login-input {
  min-width: 0;
  flex: 1;
  height: 52px;
  padding: 0 18px;
  border: 1px solid rgba(255, 250, 241, 0.48);
  border-radius: 13px;
  background: rgba(255, 252, 246, 0.91);
  color: #33241d;
  font: 0.95rem Georgia, 'Times New Roman', serif;
  letter-spacing: 0.04em;
  outline: none;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.login-input::placeholder {
  color: #7c6c62;
  letter-spacing: 0.08em;
}

.login-input:focus {
  background: #fffdf9;
  border-color: rgba(144, 68, 45, 0.7);
  box-shadow: 0 0 0 4px rgba(255, 244, 224, 0.18);
}

.login-input.shake {
  animation: shake 0.4s ease;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 105px;
  height: 52px;
  padding: 0 17px;
  background: #7f3025;
  color: #fff8ed;
  border: 1px solid rgba(255, 232, 205, 0.18);
  border-radius: 13px;
  font: 1rem 'ZCOOL KuaiLe', cursive;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(63, 20, 15, 0.2);
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.login-btn:hover {
  background: #67241c;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(63, 20, 15, 0.28);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.login-arrow {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  transition: transform 0.25s ease;
}

.login-btn:hover .login-arrow {
  transform: translate(2px, -2px);
}

.login-error {
  min-height: 1.35em;
  padding: 7px 7px 0;
  color: #ffe1d7;
  font: 0.78rem Georgia, 'Times New Roman', serif;
  letter-spacing: 0.04em;
}

/* ===== 欢迎文字 ===== */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 150;
}

.welcome-text {
  font-family: 'ZCOOL KuaiLe', 'Long Cang', cursive;
  font-size: clamp(5rem, 11vw, 11rem);
  font-weight: 400;
  color: #7c3aed;
  opacity: 0;
  transform: translateY(24px);
  filter: blur(9px);
  transition: opacity 0.8s ease, transform 1s cubic-bezier(0.22, 1, 0.36, 1), filter 0.9s ease;
  white-space: nowrap;
  letter-spacing: 0.05em;
  text-shadow: 0 8px 32px rgba(124, 58, 237, 0.25);
}

.welcome-text.show {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* ===== 子站背景遮罩（从中心向两侧卷轴展开，盖在文字上方） ===== */
.main-bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../assets/main-bg-1.jpg') top center/cover no-repeat;
  pointer-events: none;
  z-index: 200;
  clip-path: inset(0 50% 0 50%);
  filter: brightness(0.82) saturate(0.8);
  transition: clip-path 1.8s cubic-bezier(0.77, 0, 0.18, 1), filter 1.8s ease;
}

.main-bg-overlay.show {
  clip-path: inset(0 0 0 0);
  filter: brightness(1) saturate(1);
}

/* 登录成功后：body 变白 */
body.transition-bg {
  background: #ffffff !important;
  transition: background 0.8s ease;
}

body.transition-bg::before {
  opacity: 0;
  transition: opacity 0.8s ease;
}

/* 主舞台：背景图固定 */
body.main-stage {
  background: url('../assets/main-bg-1.jpg') top center/cover no-repeat;
  background-attachment: fixed;
  overflow: hidden;
}

body.main-stage::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(18, 4, 2, 0.36) 0%, transparent 42%, transparent 100%);
}

/* ===== 主内容区（只放按钮） ===== */
.main-section {
  display: none;
  position: relative;
  z-index: 300;
  opacity: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.8s ease;
}

.main-section.visible {
  display: flex;
  opacity: 1;
}

/* ===== 功能按钮 ===== */
.buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  max-width: 390px;
}

.btn-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 82px;
  padding: 14px 18px;
  background: rgba(29, 8, 5, 0.46);
  border-radius: 3px;
  text-decoration: none;
  color: #fff2db;
  border: 1px solid rgba(255, 213, 157, 0.3);
  backdrop-filter: blur(15px) saturate(120%);
  -webkit-backdrop-filter: blur(15px) saturate(120%);
  box-shadow: 0 14px 45px rgba(15, 3, 2, 0.22), inset 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(22px);
  animation: card-arrive 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: background 0.35s ease, border-color 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.btn-card:nth-child(1) { animation-delay: 0.12s; }
.btn-card:nth-child(2) { animation-delay: 0.24s; }

.card-index {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-right: 17px;
  border-right: 1px solid rgba(255, 222, 178, 0.25);
  color: rgba(255, 225, 184, 0.68);
  font: italic 0.74rem Georgia, 'Times New Roman', serif;
  letter-spacing: 0.08em;
}

.card-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-family: 'Ma Shan Zheng', cursive;
  font-size: 1.65rem;
  letter-spacing: 0.12em;
}

.card-arrow {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 220, 176, 0.28);
  border-radius: 50%;
  font: 1rem Georgia, serif;
  transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.btn-card:hover {
  background: rgba(51, 11, 7, 0.66);
  border-color: rgba(255, 218, 166, 0.52);
  transform: translateX(7px);
  box-shadow: 0 18px 52px rgba(15, 3, 2, 0.3), inset 0 1px rgba(255, 255, 255, 0.1);
}

.btn-card:hover .card-arrow {
  color: #5f2018;
  background: #ffe4bd;
  transform: rotate(45deg);
}

/* ===== 动画 ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes title-arrive {
  from { opacity: 0; transform: translateY(-18px); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes panel-arrive {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-arrive {
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  body.login-bg {
    background-position: 68% top;
  }

  .home-back {
    top: 16px;
    left: 16px;
    min-height: 34px;
    padding: 6px 13px;
    font-size: 0.8rem;
  }

  .login-section {
    padding: 82px 16px max(38px, env(safe-area-inset-bottom));
  }

  .login-section h1 {
    font-size: clamp(2.7rem, 12.5vw, 3.5rem);
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  .login-panel {
    padding: 10px;
    border-radius: 17px;
  }

  .login-eyebrow {
    padding-bottom: 9px;
  }

  .login-input-group {
    gap: 7px;
  }

  .login-btn {
    min-width: 88px;
    padding: 0 13px;
  }

  .main-section {
    padding: 72px 16px 24px;
  }

  .buttons {
    max-width: 100%;
  }

  .btn-card {
    min-height: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
