:root {
  --palace-red: #8B1A1A;
  --palace-red-dark: #6E1212;
  --beige: #F5E6CA;
  --gold: #C9A86A;
  --gold-soft: #d8be86;
  --ink: #2B2B2B;
  --paper: #FAF6EC;
  --jade: #b8ccba;
  --shadow: 0 6px 24px rgba(43, 27, 15, 0.12);
  --serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--beige);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 18px,
      rgba(201, 168, 106, 0.04) 18px 19px
    );
  pointer-events: none;
  z-index: 0;
}

/* —— 顶部 banner —— */
.banner {
  background: var(--palace-red);
  color: var(--gold);
  padding: 24px 0 0;
  position: relative;
  z-index: 1;
}

.banner-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.banner-title { display: flex; align-items: center; gap: 12px; }
.banner-title h1 {
  margin: 0;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 2px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.banner-quota {
  font-size: 13px;
  border: 1px solid var(--gold);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}
.banner-quota.quota-member {
  background: rgba(201, 168, 106, 0.18);
  color: #fff8e3;
  border-color: var(--gold-soft);
}

.banner-auth { display: flex; align-items: center; gap: 8px; }

.user-chip {
  font-size: 13px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--gold);
  border-radius: 4px;
  color: var(--gold-soft);
  letter-spacing: 1px;
}

button.ghost-light {
  font-family: var(--serif);
  font-size: 13px;
  padding: 5px 12px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.15s, color 0.15s;
}
button.ghost-light:hover {
  background: var(--gold);
  color: var(--palace-red);
}

.cloud-divider {
  height: 14px;
  margin-top: 22px;
  background:
    radial-gradient(circle at 10px 14px, var(--gold) 4px, transparent 5px) 0 0/20px 14px repeat-x,
    var(--palace-red-dark);
  opacity: 0.85;
}

/* —— 主区 —— */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.paper-card {
  background: var(--paper);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 24px 24px 28px;
  position: relative;
  box-shadow: var(--shadow);
}

.paper-card::before,
.paper-card::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--gold);
}
.paper-card::before { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.paper-card::after  { bottom: 6px; right: 6px; border-left: none; border-top: none; }

.paper-card.small { padding: 18px 24px; }

.card-title {
  margin: 0 0 12px;
  color: var(--palace-red);
  font-size: 20px;
  letter-spacing: 1px;
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--palace-red);
  font-weight: 600;
  font-size: 14px;
}
.field-label:first-child { margin-top: 0; }

textarea, input[type=text], input[type=password], input[type=email] {
  width: 100%;
  font-family: var(--serif);
  font-size: 15px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 10px 12px;
  background: #fffdf6;
  color: var(--ink);
  resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--palace-red); }

.actions { margin-top: 14px; display: flex; gap: 12px; flex-wrap: wrap; }

button {
  font-family: var(--serif);
  font-size: 15px;
  padding: 10px 22px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  border: 1px solid transparent;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s;
}

button.primary {
  background: var(--palace-red);
  color: var(--gold);
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(201, 168, 106, 0.4) inset;
}
button.primary:hover { background: var(--palace-red-dark); box-shadow: 0 4px 12px rgba(139, 26, 26, 0.35); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

button.ghost {
  background: transparent;
  color: var(--palace-red);
  border: 1px solid var(--palace-red);
}
button.ghost:hover { background: rgba(139, 26, 26, 0.06); }

.hint { font-size: 13px; color: #6B5A3A; margin-top: 10px; }

/* —— 下载状态 —— */
.status {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #fffdf6;
  border: 1px dashed var(--gold);
  border-radius: 4px;
}
.status.hidden { display: none; }
.error { margin-top: 14px; color: var(--palace-red); font-weight: 600; }
.error.hidden { display: none; }
.hidden { display: none !important; }

.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--beige);
  border-top-color: var(--palace-red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-text { display: flex; flex-direction: column; gap: 2px; }
.status-eta { font-size: 13px; color: #6B5A3A; }

.foot {
  text-align: center;
  font-size: 13px;
  color: #6B5A3A;
}

/* —— 会员卡片状态条 —— */
.member-status { margin: 8px 0 14px; }
.member-status-active {
  padding: 10px 12px;
  background: rgba(184, 204, 186, 0.25);
  border: 1px dashed #6f8b75;
  border-radius: 4px;
  font-size: 14px;
  color: #3a5040;
}
.member-status-inactive {
  padding: 10px 12px;
  background: #fffdf6;
  border: 1px dashed var(--gold);
  border-radius: 4px;
  font-size: 14px;
  color: #6B5A3A;
}

/* —— 弹窗 —— */
.modal {
  position: fixed; inset: 0;
  background: rgba(43, 18, 18, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 24px;
}
.modal-box {
  width: min(420px, 100%);
  position: relative;
  background: var(--paper);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.modal-close {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  border: none; background: transparent;
  font-size: 22px; color: var(--palace-red);
  cursor: pointer;
  z-index: 1;
}

/* —— 登录 / 注册 tabs —— */
.tabs {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gold);
  gap: 4px;
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  padding: 10px 4px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--palace-red); }
.tab.active {
  color: var(--palace-red);
  border-bottom-color: var(--palace-red);
  font-weight: 600;
}
.tab-pane { display: block; }
.tab-pane.hidden { display: none; }
.tab-pane button.primary { width: 100%; margin-top: 16px; }

/* —— 二维码 —— */
.qrcode {
  margin: 16px auto;
  width: 220px; min-height: 220px;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--gold);
  padding: 10px;
}
.pay-info { font-size: 14px; color: var(--ink); text-align: center; }

/* —— 恢复码展示 —— */
.recovery-show {
  margin: 18px 0;
  padding: 14px 12px;
  background: #fffdf6;
  border: 1px dashed var(--palace-red);
  border-radius: 4px;
  text-align: center;
}
.recovery-show code {
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--palace-red);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 700;
}
#modal-recovery .modal-box button { width: 100%; margin-top: 8px; }

@media (max-width: 480px) {
  .banner-title h1 { font-size: 18px; }
  .brand-logo { width: 32px; height: 32px; }
  .banner-inner { gap: 10px; }
  .banner-actions { width: 100%; justify-content: space-between; }
  .paper-card { padding: 18px 16px; }
}
