:root {
  --red-deep: #8f1f1f;
  --red: #c03327;
  --red-bright: #e05038;
  --gold: #d9a441;
  --gold-pale: #f2d9a6;
  --ink: #2b2320;
  --paper: #f7efe2;
  --paper-dark: #efe2c8;
  --night: #1d2438;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", serif;
  --font-song: "Songti SC", "STSong", "SimSun", serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-song);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* H5 整体禁止选中与点击高亮(输入框除外),避免拖动长卷时图片/文字被选成蓝色 */
* { -webkit-tap-highlight-color: transparent; }
body {
  -webkit-user-select: none;
  user-select: none;
}
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}
img {
  -webkit-user-drag: none;
  user-drag: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* 纸纹理背景(细微噪点感的重复渐变) */
.paper-bg {
  background:
    repeating-linear-gradient(0deg, rgba(43, 35, 32, 0.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(43, 35, 32, 0.02) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 30% 20%, rgba(217, 164, 65, 0.08), transparent 60%),
    var(--paper);
}

/* 场景切换 */
.scene {
  position: fixed;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease, visibility .6s;
  overflow: hidden;
}
.scene--active { opacity: 1; visibility: visible; z-index: 1; }

/* 按钮基类 */
.btn {
  display: inline-block;
  padding: 12px 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  border: 2px solid var(--gold);
  color: var(--gold-pale);
  font-family: var(--font-kai);
  font-size: 18px;
  letter-spacing: 2px;
  box-shadow: 0 4px 14px rgba(143, 31, 31, 0.4);
  transition: transform .12s ease, box-shadow .12s ease;
  user-select: none;
}
.btn:active { transform: scale(.94); box-shadow: 0 2px 6px rgba(143, 31, 31, 0.4); }
.btn--ghost {
  background: none;
  border: 1px solid var(--gold);
  color: var(--gold);
  box-shadow: none;
  font-size: 14px;
  padding: 8px 20px;
}

/* 弹层与卡片基类 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 36, 56, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s;
}
.overlay--open { opacity: 1; visibility: visible; }
.card {
  position: relative;
  width: min(92vw, 620px);
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 2px solid var(--gold);
  background:
    repeating-linear-gradient(0deg, rgba(43, 35, 32, 0.02) 0 1px, transparent 1px 3px),
    var(--paper);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  padding: 22px 20px;
}
.card__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 18px;
  line-height: 1;
  background: var(--paper);
  z-index: 2;
}

/* 全局控件 */
#music-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: rgba(143, 31, 31, 0.85);
  color: var(--gold-pale);
  font-size: 18px;
}
#music-toggle.music-off { opacity: .55; }
#music-toggle.music-off::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 19px;
  width: 24px;
  height: 2px;
  background: var(--gold-pale);
  transform: rotate(-40deg);
}

#orient-hint {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  color: var(--gold-pale);
  background: rgba(29, 36, 56, 0.9);
}

/* AI 图片素材通用规则(替代同位置的内联 SVG);pointer-events 穿透到父级按钮/容器 */
.art { display: block; width: 100%; height: auto; pointer-events: none; }

[hidden] { display: none !important; }
