/* ===== 全局样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  /* 注释掉 position:fixed 和 overflow:hidden，允许页面滚动 */
  /* position: fixed; */
  width: 100%;
  height: var(--vh-lock, 100vh);
  /* overflow: hidden; */
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
  background: #f6f6f6;
  color: #333;
  -webkit-font-smoothing: antialiased;
}

button {
  border: none;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

input, textarea {
  font-family: inherit;
  outline: none;
}

/* ===== 页面容器 ===== */
.page {
  display: none;
  width: 100%;
  height: var(--vh-lock, 100vh);
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* ===== 背景图 ===== */
.bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.bg-image.loaded {
  opacity: 1;
}

/* ===== 加载遮罩 ===== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(245, 245, 220, 0.95);
  z-index: 10;
  opacity: 1;
  transition: opacity 0.8s ease-in-out;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== 八卦旋转动画 ===== */
.bagua-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.bagua-circle {
  width: 80px;
  height: 80px;
  border: 4px solid #2C5530;
  border-radius: 50%;
  position: relative;
  animation: bagua-rotate 3s linear infinite;
}

.bagua-yin {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: #2C5530;
  border-radius: 40px 40px 0 0;
}

.bagua-yang {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: #F5F5DC;
  border-radius: 0 0 40px 40px;
}

.bagua-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #2C5530;
}

.yin-dot {
  background: #F5F5DC;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.yang-dot {
  background: #2C5530;
  bottom: 25%;
  left: 50%;
  transform: translate(-50%, 50%);
}

@keyframes bagua-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 16px;
  color: #2C5530;
  font-family: serif;
  letter-spacing: 2px;
}

/* ===== 首页 ===== */
/* 首页内容层 */
.home-content {
  position: relative;
  z-index: 2;
  padding: 40px 20px 30px;
  min-height: var(--vh-lock, 100vh);
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px) translateZ(0);
  transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

.home-content.visible {
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

/* Logo */
.logo {
  text-align: center;
  margin-bottom: 30px;
}

.app-name {
  display: block;
  font-size: 36px;
  font-weight: bold;
  color: #2C5530;
  margin-bottom: 8px;
}

.app-subtitle {
  display: block;
  font-size: 14px;
  color: #666;
}

/* 输入区 */
.input-section {
  margin: 30px auto;
  max-width: 400px;
  width: 100%;
}

.question-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  border: 1px solid rgba(44, 85, 48, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  color: #333;
  -webkit-text-fill-color: #333;
  transform: translateZ(0);
  will-change: transform;
  transition: border-color 0.3s;
}
.question-input::placeholder {
  color: #aaa;
  -webkit-text-fill-color: #aaa;
  opacity: 1;
}

.question-input:focus {
  border-color: #2C5530;
}

/* 开始按钮 */
.start-btn {
  background: linear-gradient(135deg, #2C5530, #4A7C59);
  color: white;
  border-radius: 30px;
  padding: 14px 24px;
  font-size: 18px;
  border: none;
  box-shadow: 0 4px 12px rgba(44, 85, 48, 0.3);
  margin: 0 auto 20px;
  display: block;
  width: 200px;
  transform: translateZ(0);
  will-change: transform;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(44, 85, 48, 0.35);
}

.start-btn:active {
  transform: scale(0.98);
}

.start-btn:disabled {
  background: #ccc !important;
  color: #888 !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
}

/* 限制信息 */
.limit-info {
  text-align: center;
  margin-bottom: 10px;
}

.limit-info-text {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

/* 底部免责声明 */
.footer-disclaimer {
  text-align: center;
  padding: 15px 20px;
  margin-top: auto;
}

/* 备案号 */
.footer-icp {
  text-align: center;
  padding: 0 20px 20px;
}
.footer-icp a {
  font-size: 11px;
  color: #999;
  text-decoration: none;
}

.disclaimer-text {
  font-size: 11px;
  line-height: 1.5;
  color: #999;
  display: inline-block;
  background-color: rgba(245, 245, 220, 0.7);
  border-radius: 5px;
  padding: 10px 15px;
}

/* ===== 浮动按钮 ===== */
.floating-btn {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  font-size: 20px;
  color: white;
  border: none;
  transform: translateZ(0);
  transition: transform 0.2s;
}

.floating-btn:hover { transform: scale(1.1) translateZ(0); }
.floating-btn:active { transform: scale(0.95) translateZ(0); }

.profile-btn {
  top: 72px;
  left: 20px;
  background: rgba(44, 85, 48, 0.9);
}

.donate-btn {
  top: 122px;
  left: 20px;
  background: rgba(44, 85, 48, 0.9);
}

.daily-badge {
  position: fixed;
  top: 72px;
  right: 20px;
  background: rgba(44, 85, 48, 0.9);
  color: white;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateZ(0);
}

/* ===== 占卜页 ===== */
.divination-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: var(--vh-lock, 100vh);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.divination-content.visible {
  opacity: 1;
}

/* 卦象记录区 - 本卦/变卦 */
.hexagram-records {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 30px 20px 20px;
  height: 140px;
}

.hexagram-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hexagram-title {
  font-size: 18px;
  color: #D4AF37;
  margin-bottom: 15px;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.7);
}

.yao-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.yao-slot {
  width: 90px;
  height: 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yao-slot.empty {
  opacity: 0.3;
}

.yao {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
}

/* 阳爻 */
.yang-line {
  width: 80px;
  height: 6px;
  background: #D4AF37;
  border-radius: 3px;
  box-shadow: 0 0 10px #D4AF37, 0 0 15px rgba(212, 175, 55, 0.5);
  animation: glow 2s ease-in-out infinite alternate;
}

/* 阴爻 */
.yin-line-container {
  display: flex;
  justify-content: space-between;
  width: 80px;
}

.yin-line {
  width: 35px;
  height: 6px;
  background: #D4AF37;
  border-radius: 3px;
  box-shadow: 0 0 10px #D4AF37, 0 0 15px rgba(212, 175, 55, 0.5);
  animation: glow 2s ease-in-out infinite alternate;
}

/* 变爻标记 - 老阳圆点 */
.changing-mark {
  position: absolute;
  right: -15px;
  top: 50%;
  transform: translateY(-50%);
  animation: glow 2s ease-in-out infinite alternate;
}

.changing-mark.circle {
  width: 12px;
  height: 12px;
  border: 2px solid #D4AF37;
  border-radius: 50%;
  background: transparent;
}

.changing-mark.cross {
  color: #D4AF37;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 0 8px #D4AF37;
}

@keyframes glow {
  from { filter: brightness(1); }
  to { filter: brightness(1.3); }
}

/* 龟甲容器 */
.tortoise-shell-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 200px;
}

.tortoise-shell-img {
  width: 200px;
  height: 250px;
  z-index: 3;
  transition: transform 0.3s ease-in-out;
  object-fit: contain;
}

.tortoise-shell-img.shaking {
  animation: shell-shake 0.8s ease-in-out infinite;
}

@keyframes shell-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  50% { transform: rotate(5deg); }
  75% { transform: rotate(-3deg); }
}

/* 铜钱容器 */
.coins-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

/* 铜钱 - 初始在龟甲上方居中 */
.coin-img {
  position: absolute;
  width: 50px;
  height: 50px;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  display: none;
}

.coin-img.visible {
  display: block;
  opacity: 1;
}

/* 铜钱初始水平分布 */
.coin-1 { margin-left: -60px; }
.coin-2 { margin-left: 0; }
.coin-3 { margin-left: 60px; }

/* 摇动时的随机变换（JS 动态设置） */
.coin-img.shaking {
  animation: coin-shake 0.8s ease-in-out infinite;
}

@keyframes coin-shake {
  0%, 100% { transform: translate(-50%, -50%) translateX(0) translateY(0) rotate(0deg); }
  25% { transform: translate(-50%, -50%) translateX(-12px) translateY(-16px) rotate(-10deg); }
  50% { transform: translate(-50%, -50%) translateX(12px) translateY(-18px) rotate(10deg); }
  75% { transform: translate(-50%, -50%) translateX(-6px) translateY(-12px) rotate(-5deg); }
}

/* 投掷后：取消摇晃动画，落入龟甲下方 */
.coin-img.thrown {
  animation: none;
  transition: top 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  top: 85% !important;
  transform: translate(-50%, -50%) rotate(0deg) !important;
}

.coin-1.thrown { left: 25% !important; margin-left: 0 !important; }
.coin-2.thrown { left: 50% !important; margin-left: 0 !important; }
.coin-3.thrown { left: 75% !important; margin-left: 0 !important; }

/* 控制面板 */
.control-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
  box-sizing: border-box;
}

.throw-count {
  font-size: 18px;
  color: #2C5530;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  text-align: center;
}

.count-number {
  color: #D4AF37;
  font-size: 22px;
  text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

.throw-status {
  font-size: 14px;
  color: #666;
  margin-left: 10px;
  font-weight: normal;
}

.throw-btn, .result-btn {
  border-radius: 25px;
  padding: 12px 36px;
  font-size: 16px;
  border: none;
  min-width: 140px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  font-family: inherit;
}

.throw-btn {
  background: linear-gradient(135deg, #2C5530, #4A7C59);
  color: white;
  box-shadow: 0 4px 12px rgba(44, 85, 48, 0.3);
}

.throw-btn.disabled {
  background: #ccc;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

.throw-btn:not(.disabled):hover {
  transform: translateY(-1px);
}

.throw-btn:not(.disabled):active {
  transform: scale(0.98);
}

.result-btn {
  background: linear-gradient(135deg, #D4AF37, #FFD700);
  color: #2C5530;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.result-btn:hover {
  transform: translateY(-1px);
}

.result-btn:active {
  transform: scale(0.98);
}

/* 进度条 */
.progress-container {
  width: 80%;
  max-width: 300px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(44, 85, 48, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2C5530, #4A7C59);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ===== 结果页 ===== */
.result-container {
  padding: 12px 16px;
  min-height: var(--vh-lock, 100vh);
  background: linear-gradient(135deg, #f8f5f2 0%, #e8e0d5 100%);
  color: #333;
  position: relative;
}

.result-container.hidden {
  display: none;
}

/* 问题卡片 */
.question-card {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.question-label {
  font-size: 16px;
  font-weight: bold;
  color: #8B4513;
  border-left: 4px solid #D2B48C;
  padding-left: 10px;
  margin-bottom: 10px;
}

.question-text {
  font-size: 16px;
  line-height: 1.6;
  color: #555;
}

/* 卦象卡片 */
.hexagram-card {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 吉凶卡片 */
.luck-card {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 解析卡片 */
.analysis-card {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 结果页中的本地背景图（如果不需要全屏背景，可以不展示） */
/* 结果页中的图片主要用于展示，不撑满全屏 */

/* ===== 历史弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
  visibility: visible;
  opacity: 1;
}

.modal-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  border-radius: 16px 16px 0 0;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 16px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.modal-stats {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.clear-btn {
  background: transparent;
  color: #E74C3C;
  border: none;
  font-size: 14px;
  padding: 6px 12px;
  cursor: pointer;
}

.modal-list {
  flex: 1;
  padding: 12px 16px;
  overflow-y: auto;
  max-height: 60vh;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 0;
  color: #999;
  text-align: center;
}

.empty-icon {
  font-size: 50px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-tip {
  font-size: 13px;
  color: #bbb;
}

/* 历史记录项 */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: #f8f8f8;
  border-radius: 10px;
  border-left: 4px solid #D2B48C;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 70px;
}

.history-item:hover {
  background: #f0f0f0;
}

.history-item-main {
  flex: 1;
}

.history-time {
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
}

.history-question {
  font-size: 15px;
  color: #333;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hexagram-name-sm {
  font-size: 13px;
  color: #8B4513;
  font-weight: bold;
  margin-top: 8px;
}

.history-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
  margin-top: 6px;
}

.history-status.analyzed {
  background: rgba(39, 174, 96, 0.1);
  color: #27AE60;
}

.history-status.pending {
  background: rgba(243, 156, 18, 0.1);
  color: #F39C12;
}

/* 左滑删除 */
.swipe-item {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.swipe-content {
  display: flex;
  transition: transform 0.3s ease;
}

.swipe-content.open {
  transform: translateX(-80px);
}

.delete-zone {
  width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-btn {
  width: 60px;
  height: 60px;
  background: #E74C3C;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

/* ===== 赞赏弹窗 ===== */
.donate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.donate-card {
  background: white;
  width: 85%;
  max-width: 360px;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
}

.donate-header {
  font-size: 18px;
  font-weight: bold;
  color: #2C5530;
  margin-bottom: 16px;
}

.qrcode-img {
  width: 70%;
  max-width: 220px;
  height: auto;
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  margin: 0 auto 16px;
}

.donate-steps {
  text-align: left;
  background: #f8f8f8;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.donate-steps .step {
  display: block;
  font-size: 14px;
  color: #555;
  line-height: 1.8;
  margin-bottom: 4px;
}

.donate-close {
  background: #f0f0f0;
  color: #333;
  border-radius: 20px;
  padding: 8px 24px;
  font-size: 14px;
  border: none;
  cursor: pointer;
}

/* ===== 次数限制弹窗 ===== */
.limit-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3000;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.limit-overlay.show {
  visibility: visible;
  opacity: 1;
}

.limit-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}

.limit-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 85%;
  max-width: 340px;
  background: white;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: transform 0.3s ease;
}

.limit-overlay.show .limit-card {
  transform: translate(-50%, -50%) scale(1);
}

.limit-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 16px;
}

.limit-icon {
  display: block;
  font-size: 40px;
  margin-bottom: 12px;
}

.limit-message {
  display: block;
  font-size: 16px;
  color: #333;
  margin-bottom: 8px;
}

.limit-tip {
  display: block;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 20px;
}

.limit-actions {
  display: flex;
  gap: 10px;
}

.limit-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  border: none;
  cursor: pointer;
}

.limit-btn.secondary {
  background: #f0f0f0;
  color: #333;
}

.limit-btn.primary {
  background: linear-gradient(135deg, #2C5530, #4A7C59);
  color: white;
}

/* ===== 结果页组件 ===== */
.section-title {
  font-size: 16px;
  font-weight: bold;
  color: #8B4513;
  border-left: 4px solid #D2B48C;
  padding-left: 10px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hexagram-display {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
}

.hexagram-display.single {
  justify-content: center;
}

.hexagram-block {
  text-align: center;
  padding: 10px;
  min-width: 120px;
}

.hexagram-block .title {
  font-size: 14px;
  color: #8B4513;
  margin-bottom: 6px;
}

.hexagram-block .name {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 16px;
  color: #333;
}

.hexagram-lines {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
}

.yao-line {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100px;
  height: 16px;
}

.changing-dot {
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  color: #D4AF37;
  font-size: 16px;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.luck-display {
  font-size: 26px;
  font-weight: bold;
  text-align: center;
  padding: 20px 0;
  border-radius: 8px;
  position: relative;
}

.luck-display.very-good {
  color: #E74C3C;
  background: rgba(231, 76, 60, 0.08);
}

.luck-display.good {
  color: #27AE60;
  background: rgba(39, 174, 96, 0.08);
}

.luck-display.bad {
  color: #E74C3C;
  background: rgba(231, 76, 60, 0.08);
}

.luck-display.neutral {
  color: #F39C12;
  background: rgba(243, 156, 18, 0.08);
}

.loading-dots {
  display: inline-flex;
  margin-left: 4px;
}

.loading-dots span {
  animation: dotPulse 1.5s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.analysis-text {
  font-size: 15px;
  line-height: 1.6;
  color: #555;
  text-align: justify;
  min-height: 60px;
}

.analysis-text strong {
  color: #4a3728;
  font-weight: 700;
}

.analysis-text em {
  color: #8B6914;
  font-style: italic;
}

.analysis-h3 {
  font-size: 17px;
  font-weight: 700;
  color: #4a3728;
  margin: 14px 0 6px;
  padding-left: 8px;
  border-left: 3px solid #D2B48C;
  line-height: 1.4;
}

.analysis-h4 {
  font-size: 16px;
  font-weight: 600;
  color: #6b5a4e;
  margin: 10px 0 4px;
  line-height: 1.4;
}

.analysis-h5 {
  font-size: 15px;
  font-weight: 600;
  color: #8B6914;
  margin: 8px 0 4px;
  line-height: 1.4;
}

.analysis-ul {
  margin: 4px 0;
  padding-left: 20px;
  list-style: none;
}

.analysis-li {
  position: relative;
  padding-left: 12px;
  margin-bottom: 3px;
  line-height: 1.6;
}

.analysis-li::before {
  content: '◆';
  position: absolute;
  left: -6px;
  color: #D2B48C;
  font-size: 10px;
}

.analysis-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #D2B48C;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 操作按钮区 */
.action-buttons {
  display: flex;
  justify-content: center;
  padding: 10px 0 30px;
  gap: 16px;
}

.btn-primary, .btn-secondary {
  flex: 1;
  max-width: 200px;
  border-radius: 30px;
  font-size: 16px;
  padding: 12px 0;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #2C5530, #4A7C59);
  color: white;
  box-shadow: 0 4px 12px rgba(44, 85, 48, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #D2B48C, #F5DEB3);
  color: #333;
  box-shadow: 0 4px 12px rgba(210, 180, 140, 0.3);
}

.btn-primary:hover, .btn-secondary:hover {
  transform: translateY(-1px);
}

.btn-primary:active, .btn-secondary:active {
  transform: scale(0.98);
}

.reanalyze-btn {
  background: #D2B48C;
  color: #333;
  border: none;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.history-source-tag {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

/* 结果页浮动赞赏 */
.donate-fab {
  position: fixed;
  bottom: 100px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2C5530, #4A7C59);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  box-shadow: 0 4px 16px rgba(44, 85, 48, 0.4);
  color: white;
  font-size: 24px;
  cursor: pointer;
  border: none;
  transition: transform 0.2s;
}

.donate-fab:hover { transform: scale(1.1); }
.donate-fab:active { transform: scale(0.95); }

/* ===== 响应式 ===== */
/* 移动端导航栏高度 48px，浮动按钮相应上移对齐 */
@media (max-width: 520px) {
  .profile-btn { top: 68px; }
  .donate-btn { top: 118px; }
  .daily-badge { top: 68px; }
}

@media (min-width: 768px) {
  .home-content {
    max-width: 500px;
    margin: 0 auto;
  }

  .hexagram-records {
    height: 160px;
  }

  .tortoise-shell-img {
    width: 220px;
    height: 280px;
  }

  .result-container {
    max-width: 600px;
    margin: 0 auto;
  }
}

/* ===== 横屏（电脑/平板）占卜页布局 ===== */
@media (min-width: 768px) and (orientation: landscape) {
  .divination-content {
    position: relative;
  }

  /* 龟甲区域向下移动 1/3 屏幕 */
  .tortoise-shell-area {
    margin-top: 33vh;
  }

  /* 控制面板定位到右侧纵向居中 */
  .control-panel {
    position: fixed;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    width: auto;
    min-width: 220px;
    max-width: 260px;
    padding: 24px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(8px);
    z-index: 10;
    gap: 14px;
  }

  .throw-btn, .result-btn {
    width: 100%;
    min-width: 0;
    font-size: 16px;
    padding: 12px 20px;
  }

  /* 卦象记录放大 */
  .hexagram-records {
    height: 210px;
  }

  .yao-record {
    padding: 9px 14px;
  }

  .yao-slot {
    width: 150px;
    height: 18px;
  }

  .hexagram-title {
    font-size: 22px;
  }

  .hexagram-subtitle {
    font-size: 14px;
  }

  /* 硬币落地后位置（回退到展开前的版本） */
  .coin-img.thrown {
    top: 82% !important;
  }
  .coin-1.thrown { left: 42% !important; }
  .coin-2.thrown { left: 50% !important; }
  .coin-3.thrown { left: 58% !important; }
}

/* ===== 横屏（电脑/平板）结果页布局 ===== */
@media (min-width: 768px) and (orientation: landscape) {
  .result-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 60px;
  }

  /* 卦象展示整体放大 */
  .hexagram-display {
    gap: 80px;
    justify-content: center;
  }

  .hexagram-block {
    min-width: 180px;
    padding: 16px;
  }

  .hexagram-block .title {
    font-size: 16px;
  }

  .hexagram-block .name {
    font-size: 28px;
    margin-bottom: 20px;
  }

  .hexagram-lines {
    gap: 10px;
  }

  .yao-line {
    width: 140px;
    height: 20px;
  }

  .changing-dot {
    font-size: 20px;
    right: -20px;
  }

  /* 吉凶/解析双列布局 */
  .result-container > .question-card,
  .result-container > .hexagram-card {
    max-width: 100%;
  }

  .luck-card,
  .analysis-card {
    display: block;
    width: auto;
    margin-bottom: 16px;
    margin-right: 0;
    box-sizing: border-box;
    font-size: 15px;
    padding: 20px 28px;
  }

  /* 桌面端赞赏按钮保持右下角悬浮（与移动端一致） */
  .donate-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    margin: 0;
  }

  .action-buttons {
    margin-top: 12px;
  }

  .luck-display {
    font-size: 32px;
    padding: 28px 0;
  }

  .question-card,
  .hexagram-card {
    font-size: 15px;
    padding: 20px 28px;
  }
}

/* ==================== 登录/注册弹窗 ==================== */
.auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.auth-overlay.active {
  display: flex;
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  width: 340px;
  max-width: 90vw;
  padding: 28px 24px 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid #eee;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  cursor: pointer;
  font-size: 16px;
  color: #999;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}
.auth-tab.active {
  color: #4a3728;
  border-bottom-color: #D2B48C;
  font-weight: 600;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form.hidden {
  display: none;
}
.auth-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e0d5c7;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  background: #fdfaf5;
  color: #333;
  -webkit-text-fill-color: #333;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.auth-input::placeholder {
  color: #b5a58e;
  -webkit-text-fill-color: #b5a58e;
  opacity: 1;
}
.auth-input:focus {
  border-color: #D2B48C;
}
.auth-error {
  color: #c0392b;
  font-size: 13px;
  padding: 4px 0;
}
.auth-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #4a3728, #6b5a4e);
  color: #fff;
  transition: opacity 0.2s;
}
.auth-btn:active {
  opacity: 0.85;
}
/* 我的页面：弹窗顶部用户信息栏 */
.profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  color: #333;
  font-size: 15px;
}
.profile-info-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-name {
  font-weight: 600;
}
.logout-link-profile {
  color: #888;
  cursor: pointer;
  font-size: 13px;
  padding: 5px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  transition: color 0.2s, opacity 0.2s;
}
.logout-link-profile:hover {
  color: #e74c3c;
  border-color: #e74c3c;
  background: #fdf2f2;
}
