/* ============================================================
   灵签 · 抽签算卦 —— 古风样式
   暗色底 + 金 / 朱红，手机优先，竖屏布局
   ============================================================ */

:root {
  /* 配色 */
  --bg: #16110c;
  --bg-soft: #211a13;
  --panel: #2a2118;
  --panel-2: #33271c;
  --ink: #f0e6d2;        /* 米白正文 */
  --ink-dim: #b9a888;
  --gold: #d4a95c;       /* 金 */
  --gold-bright: #f0c978;
  --gold-dim: #8f7434;
  --vermilion: #c1440e;  /* 朱红 */
  --vermilion-bright: #e0562a;
  --line: rgba(212, 169, 92, 0.28);
  --line-strong: rgba(212, 169, 92, 0.55);

  /* 吉凶色 */
  --grade-1: #f0c978;   /* 上上 */
  --grade-2: #cddc7a;   /* 上吉 */
  --grade-3: #8fc7a2;   /* 中吉 */
  --grade-4: #cbb98f;   /* 中平 */
  --grade-5: #b28a6a;   /* 中下 */
  --grade-6: #c84f4f;   /* 下 */

  /* 排版 */
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 50% -10%, rgba(212, 169, 92, 0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(193, 68, 14, 0.06), transparent 55%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 8px);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* 安全区：顶部避刘海/状态栏，底部避 Home 指示条，左右避横屏刘海 */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: calc(env(safe-area-inset-left, 0px) + 18px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 18px);
}

/* ---------- 头部 ---------- */
.site-header {
  padding: 18px 18px 14px;
  text-align: center;
}

.title {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(212, 169, 92, 0.35);
  font-weight: 700;
}

.subtitle {
  margin-top: 8px;
  color: var(--ink-dim);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
}

/* 语言切换：右上角独立工具栏行（不遮挡标题）+ 古风胶囊下拉 */
.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
}
.lang-select {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--gold-bright);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 34px 8px 16px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23d4a95c' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lang-select:hover { border-color: var(--gold); }
.lang-select:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(212, 169, 92, 0.18);
}
.lang-select option {
  color: var(--ink);
  background: var(--panel);
}

/* ---------- 抽签区 ---------- */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.draw-panel {
  text-align: center;
  padding: 18px 0 30px;
}

.shaker {
  width: 86px;
  height: 86px;
  margin: 0 auto 26px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.shaker-stick {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--vermilion-bright);
  writing-mode: vertical-rl;
}

/* 摇签动画 */
.shaker.shaking { animation: shake 0.7s ease; }
@keyframes shake {
  0%   { transform: rotate(0deg); }
  20%  { transform: rotate(-14deg); }
  40%  { transform: rotate(12deg); }
  60%  { transform: rotate(-9deg); }
  80%  { transform: rotate(6deg); }
  100% { transform: rotate(0deg); }
}

.draw-btn {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: #1a1410;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: none;
  border-radius: 999px;
  padding: 16px 54px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(212,169,92,0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.draw-btn:active { transform: translateY(2px); }
.draw-btn:disabled { opacity: 0.6; cursor: default; }

.draw-hint {
  margin-top: 18px;
  color: var(--ink-dim);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

/* ---------- 结果卡片 ---------- */
.result-panel { padding-bottom: 12px; }

.result-card {
  position: relative;
  background: linear-gradient(165deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 22px 30px;
  box-shadow: 0 18px 44px rgba(0,0,0,0.45);
  animation: fadeUp 0.5s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sign-no {
  color: var(--ink-dim);
  font-size: 0.9rem;
}
.sign-no .num { color: var(--gold-bright); font-size: 1.05rem; }

.grade-badge {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(0,0,0,0.25);
}

/* 吉凶颜色 */
.grade-1 { color: var(--grade-1); border-color: var(--grade-1); }
.grade-2 { color: var(--grade-2); border-color: var(--grade-2); }
.grade-3 { color: var(--grade-3); border-color: var(--grade-3); }
.grade-4 { color: var(--grade-4); border-color: var(--grade-4); }
.grade-5 { color: var(--grade-5); border-color: var(--grade-5); }
.grade-6 { color: var(--grade-6); border-color: var(--grade-6); }

.sign-title {
  margin-top: 20px;
  font-family: var(--font-serif);
  font-size: 1.7rem;
  text-align: center;
  color: var(--gold-bright);
  letter-spacing: 0.14em;
}

.sign-poem {
  margin-top: 14px;
  text-align: center;
}

.poem-line {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 2;
  color: var(--ink);
  letter-spacing: 0.08em;
}

.divider {
  margin: 24px auto 18px;
  width: 70%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.section-label {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.sign-meaning,
.sign-shengyi {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.85;
}

/* ---------- 预留付费位（第一期锁定） ---------- */
.paid-block {
  margin-top: 24px;
  padding: 18px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(0,0,0,0.2);
  text-align: center;
}
.paid-lock { font-size: 1.4rem; }
.paid-placeholder {
  margin-top: 6px;
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.unlock-btn {
  margin-top: 14px;
  font-family: var(--font-serif);
  color: #1a1410;
  background: linear-gradient(180deg, var(--vermilion-bright), var(--vermilion));
  border: none;
  border-radius: 999px;
  padding: 12px 30px;
  font-size: 1rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(193,68,14,0.35);
}
.unlock-btn:active { transform: translateY(2px); }

/* ---------- 再抽 ---------- */
.again-btn {
  margin-top: 26px;
  width: 100%;
  padding: 14px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: var(--gold-bright);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.again-btn:active { background: rgba(212,169,92,0.12); }

/* ---------- 页脚 ---------- */
.site-footer {
  padding: 22px 4px 28px;
  text-align: center;
}
.disclaimer {
  color: var(--ink-dim);
  font-size: 0.78rem;
  line-height: 1.7;
}
.copyright {
  margin-top: 10px;
  color: rgba(240,230,210,0.4);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

/* ---------- 工具类 ---------- */
.hidden { display: none !important; }
