/* ============ 共用基底 ============ */
:root {
  --bg: #08070b;
  --bg-soft: #100e15;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.055);
  --ink: #efe7d8;
  --ink-2: #b8ad9d;
  --ink-3: #7d7469;
  --gold: #d9b978;
  --gold-hi: #f4e4b8;
  --gold-line: rgba(217, 185, 120, 0.18);
  --gold-line-2: rgba(217, 185, 120, 0.34);
  --blood: #b8404c;
  --blood-hi: #e26873;
  --parch: #f2e6cc;
  --ink-dark: #241b12;
  --ok: #7fc8a9;
  --radius: 16px;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.no-select { -webkit-user-select: none; user-select: none; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: rgba(217, 185, 120, 0.26); }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(217, 185, 120, 0.18); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* 背景：灯光 + 颗粒 */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 720px at 50% -14%, rgba(217, 185, 120, 0.13), transparent 62%),
    radial-gradient(900px 640px at 4% 108%, rgba(122, 42, 58, 0.20), transparent 66%),
    radial-gradient(760px 560px at 100% 104%, rgba(44, 54, 100, 0.16), transparent 62%),
    #08070b;
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ 通用小件 ============ */
.kicker {
  font-size: 10.5px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.86;
}
.mono { font-family: var(--font-mono); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--gold-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.02em;
  transition: background 0.18s, border-color 0.18s, transform 0.12s, color 0.18s;
}
.btn:hover { background: rgba(217, 185, 120, 0.10); border-color: var(--gold-line-2); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(180deg, #efd9a6, #cfa863);
  border-color: rgba(255, 236, 190, 0.5);
  color: #2a1e12;
  font-weight: 600;
}
.btn.primary:hover { background: linear-gradient(180deg, #f7e6bd, #d9b371); }
.btn.ghost { border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.btn.danger { border-color: rgba(184, 64, 76, 0.4); color: #e08d95; }
.btn.danger:hover { background: rgba(184, 64, 76, 0.14); }
.btn.sm { padding: 7px 13px; font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(22, 19, 28, 0.96);
  border: 1px solid var(--gold-line-2);
  color: var(--ink);
  font-size: 14px;
  box-shadow: 0 18px 40px -16px #000;
  transition: opacity 0.22s, transform 0.22s;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 4, 8, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal.show { display: flex; }
.modal-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, #17141d, #0e0c12);
  border: 1px solid var(--gold-line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 40px 80px -30px #000;
}
.modal-card h3 { font-family: var(--font-display); font-size: 21px; letter-spacing: 0.06em; margin-bottom: 6px; }
.modal-card p { color: var(--ink-2); font-size: 13.5px; line-height: 1.7; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ============ 魔典底表（手机） ============ */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(4, 3, 7, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 121;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #191521 0%, #0d0b12 100%);
  border-top: 1px solid var(--gold-line-2);
  border-radius: 22px 22px 0 0;
  transform: translateY(102%);
  transition: transform 0.26s cubic-bezier(0.22, 0.9, 0.25, 1);
  box-shadow: 0 -30px 70px -30px #000;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.show { transform: translateY(0); }
.sheet::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 38px;
  height: 4px;
  margin-left: -19px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
}
