/* ===== Base ===== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #15101a;            /* 暗酒红黑，温柔但有重量 */
  color: #e6dccd;                  /* 米白暖黄，长文友好 */
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 20px 24px;
  background:
    radial-gradient(ellipse at top, rgba(180, 130, 90, 0.12), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(80, 60, 100, 0.10), transparent 60%),
    #15101a;
}

/* ===== Screens ===== */
.screen {
  display: none;
  width: 100%;
  max-width: 480px;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Gate (Password Page) ===== */
.card {
  background: rgba(40, 28, 36, 0.55);
  border: 1px solid rgba(220, 190, 140, 0.10);
  border-radius: 16px;
  padding: 36px 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 212, 154, 0.12);
  color: #f0d49a;
  border: 1px solid rgba(240, 212, 154, 0.25);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

h1 {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: 0.5px;
  color: #f0d49a;
}

.subtitle {
  font-size: 14px;
  color: #a89878;
  margin: 0 0 24px;
}

#pwd-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 假密码框容器：相对定位，input 和 dots 重叠 */
.pwd-wrap {
  position: relative;
  width: 100%;
}

/* 显示 ••• 的层（被 input 覆盖） */
.pwd-dots {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  font-size: 16px;
  letter-spacing: 0.2em;
  color: #f0d49a;
  pointer-events: none;
  white-space: pre;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.5;
}

#pwd {
  width: 100%;
  padding: 14px 16px;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(220, 190, 140, 0.18);
  border-radius: 12px;
  color: #f0d49a;
  caret-color: #fff;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  letter-spacing: 0.5em;
  font-family: "Helvetica Neue", Arial, sans-serif;
  -webkit-text-security: disc;     /* Safari/微信内置：把字符显示为圆点 */
  text-security: disc;              /* 标准 */
  position: relative;
  z-index: 1;
  /* 让光标位置和圆点宽度对齐 */
  text-indent: 2px;
}

#pwd:focus {
  border-color: #f0d49a;
  background: rgba(0, 0, 0, 0.5);
}

#pwd::placeholder {
  color: #6b5d4a;
  letter-spacing: 0;
  text-indent: 0;
  -webkit-text-security: none;
  text-security: none;
  font-size: 14px;
}

#pwd:focus {
  border-color: #f0d49a;
  background: rgba(0, 0, 0, 0.5);
}

#pwd::placeholder {
  color: #6b5d4a;
  letter-spacing: 0;
  text-indent: 0;
}

#submit-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #b8865a, #d4a574);
  color: #1f1620;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  letter-spacing: 2px;
}

#submit-btn:active {
  transform: scale(0.98);
}

#submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.hint {
  margin: 16px 0 0;
  font-size: 13px;
  color: #f87171;
  min-height: 18px;
  text-align: center;
}

.hint.locked {
  font-size: 14px;
  line-height: 1.9;
  color: #f0d49a;
  letter-spacing: 0.5px;
}

.hint .plus {
  display: inline-block;
  font-size: 22px;
  font-weight: 700;
  color: #f0d49a;
  margin: 0 2px;
  vertical-align: -2px;
}

.footer {
  margin: 28px 0 0;
  text-align: center;
  font-size: 12px;
  color: #6b5d4a;
  letter-spacing: 1px;
}

/* ===== Loading ===== */
#loading {
  text-align: center;
  color: #a89878;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(240, 212, 154, 0.15);
  border-top-color: #f0d49a;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Content (Message Page) ===== */
.message {
  background: rgba(40, 28, 36, 0.55);
  border: 1px solid rgba(220, 190, 140, 0.10);
  border-radius: 16px;
  padding: 36px 30px;
  font-size: 16px;
  line-height: 1.85;
  color: #e6dccd;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
  letter-spacing: 0.3px;
  margin-top: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  max-width: 540px;
}

/* 普通段落 */
.message p {
  margin: 0 0 0.9em;
  text-indent: 2em;
  color: #e6dccd;
}

/* 第一段：称呼（如"小宝儿："）—— 暖金色，左对齐 */
.message .p-greet {
  text-indent: 0;
  font-weight: 600;
  font-size: 18px;
  color: #f0d49a;
  margin-bottom: 0.4em;
  letter-spacing: 0.5px;
  position: relative;
  text-align: left;
}

/* 末段容器：告别区 —— 更深一点，前置分割线 */
.message .farewell {
  margin-top: 1.8em;
  padding-top: 1.4em;
  border-top: 1px solid rgba(220, 190, 140, 0.18);
  position: relative;
}

.message .farewell::before {
  content: "· · ·";
  display: block;
  text-align: center;
  color: rgba(240, 212, 154, 0.5);
  font-size: 14px;
  letter-spacing: 8px;
  margin-top: -2.1em;
  background: #1f1620;
  width: 80px;
  margin-left: auto;
  margin-right: auto;
}

/* 末段正文：不缩进，字距稍宽 */
.message .p-final {
  text-indent: 0;
  text-align: center;
  color: #f0e6d0;
  font-size: 16px;
  margin: 0 0 0.8em;
  letter-spacing: 0.5px;
  line-height: 1.95;
}

/* 署名：靠右、灰一点 */
.message .p-sig {
  text-indent: 0;
  text-align: right;
  color: #a89878;
  font-size: 14px;
  margin: 1.2em 0 0;
  letter-spacing: 1px;
}

.meta {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #6b5d4a;
  letter-spacing: 0.5px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 100;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 微信内置浏览器适配 ===== */
@supports (-webkit-touch-callout: none) {
  body {
    /* 适配 iOS 底部安全区 */
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}
