:root {
  --ink: #3a2a16;
  --ink-soft: #5c4428;
  --gold: #9a7a2f;
  --gold-soft: #c9a654;
  --blood: #8a2f22;
  --green: #2f6b3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Palatino Linotype", Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", "SimSun", serif;
  color: var(--ink);
  background-color: #d9c292;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255, 245, 210, .55), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(120, 80, 30, .35), transparent 60%),
    repeating-linear-gradient(100deg, rgba(120, 90, 40, .045) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(12deg, rgba(255, 250, 230, .05) 0 3px, transparent 3px 9px),
    linear-gradient(160deg, #caae72, #b6904f);
  background-attachment: fixed;
  min-height: 100%;
  overflow-x: hidden;
  line-height: 1.55;
}

.page-wrap { max-width: 860px; margin: 0 auto; padding: 22px 14px 40px; }
.hidden { display: none !important; }

/* ---------- 顶部标题 ---------- */
.masthead { text-align: center; margin-bottom: 16px; }
.title {
  font-size: 38px; letter-spacing: .32em; text-indent: .32em;
  font-weight: 700; color: var(--ink);
  text-shadow: 1px 1px 0 rgba(255, 246, 214, .6), -1px -1px 0 rgba(90, 60, 20, .18);
  position: relative; display: inline-block;
}
.title::before, .title::after {
  content: "❦"; position: absolute; top: 50%; transform: translateY(-55%);
  color: var(--gold); font-size: 19px;
}
.title::before { left: -34px; }
.title::after  { right: -34px; }
.subtitle { margin-top: 2px; letter-spacing: .6em; text-indent: .6em; font-size: 14px; color: var(--gold); font-weight: 700; }

/* ---------- 面板 ---------- */
.panel {
  position: relative;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 252, 238, .5), transparent 55%),
    linear-gradient(170deg, #f2e6c0, #e7d6a6 45%, #dfc992);
  border: 3px double var(--gold);
  border-radius: 14px;
  padding: 22px 20px 24px;
  box-shadow:
    inset 0 0 0 1px rgba(90, 62, 20, .35),
    inset 0 0 42px rgba(120, 85, 30, .16),
    0 10px 28px rgba(70, 45, 10, .35);
}
.panel::before, .panel::after {
  content: ""; position: absolute; width: 24px; height: 24px;
}
.panel::before { top: 8px; left: 8px; border-top: 3px solid var(--gold); border-left: 3px solid var(--gold); border-top-left-radius: 8px; }
.panel::after  { bottom: 8px; right: 8px; border-bottom: 3px solid var(--gold); border-right: 3px solid var(--gold); border-bottom-right-radius: 8px; }

/* ---------- 开局 ---------- */
.stage-line { text-align: center; font-size: 13px; letter-spacing: .3em; color: var(--gold); margin-bottom: 8px; }
.vs-board { display: flex; align-items: stretch; justify-content: center; gap: 12px; margin: 6px auto 14px; }
.end-card {
  flex: 1 1 0; max-width: 300px;
  text-align: center; padding: 14px 10px 12px;
  border: 1px solid rgba(154, 122, 47, .55);
  border-radius: 10px;
  background: rgba(255, 250, 232, .42);
  cursor: default;
}
.medallion {
  width: 92px; height: 92px; margin: 0 auto 8px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; color: #f8ecd0;
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,.35), transparent 45%),
    linear-gradient(150deg, #6b4d23, #3d2a10);
  border: 3px solid var(--gold-soft);
  box-shadow: 0 4px 10px rgba(60, 40, 10, .4), inset 0 0 0 3px rgba(201, 166, 84, .5);
  text-shadow: 1px 2px 2px rgba(0,0,0,.5);
}
.medallion.gold {
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,.4), transparent 45%),
    linear-gradient(150deg, #a17a2e, #5c4317);
  border-color: #d6b462;
}
.end-name { font-size: 23px; font-weight: 700; letter-spacing: .06em; }
.end-brief, .status-sub { color: var(--ink-soft); font-size: 12px; letter-spacing: .08em; margin-top: 1px; }
.end-bio { margin-top: 6px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }

.vs-ornament { align-self: center; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; }
.orn-script {
  writing-mode: vertical-rl; letter-spacing: .2em; font-size: 14px; color: var(--gold);
  border-left: 2px solid var(--gold-soft); border-right: 2px solid var(--gold-soft);
  padding: 6px 4px; font-weight: 700;
}

.quest-hint { text-align: center; font-size: 15px; margin: 4px 4px 16px; color: var(--ink); }
.quest-hint b { color: #7c2c1a; }
.start-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.foot-note { text-align: center; margin-top: 13px; font-size: 13px; color: var(--ink-soft); letter-spacing: .08em; }

/* ---------- 按钮 ---------- */
.btn {
  font-family: inherit; font-size: 16px; letter-spacing: .12em;
  padding: 10px 28px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--gold);
  background: linear-gradient(180deg, #f0e2ba, #ddc790);
  color: var(--ink);
  box-shadow: 0 3px 8px rgba(70, 45, 10, .3), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(70,45,10,.35); }
.btn:active { transform: translateY(0); }
.btn.primary { border-color: #7c2c1a; color: #fff6e0; background: linear-gradient(180deg, #9c3a26, #74281a); }
.btn.ghost { background: transparent; }

/* ---------- 游戏主界面 ---------- */
.game-screen { padding-top: 18px; }
.status-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 2px solid rgba(154, 122, 47, .5);
  padding-bottom: 10px;
}
.status-item { flex: 1 1 0; }
.status-item.center { text-align: center; }
.status-item.right { text-align: right; }
.status-key { display: block; font-size: 11px; color: var(--gold); letter-spacing: .2em; }
.status-key i { font-style: normal; font-size: 18px; color: var(--blood); font-weight: 700; }
.now-name, .goal-name { display: inline-block; cursor: default; font-size: 20px; }
.now-name { color: var(--ink); border-bottom: 1px dashed rgba(154,122,47,.6); }
.goal-name { color: #7c2c1a; border-bottom: 1px dashed rgba(140,47,34,.5); }

/* ---------- 关系链日志 ---------- */
.journey { margin-top: 12px; }
.journey-label { font-size: 12px; letter-spacing: .25em; color: var(--gold); margin-bottom: 4px; }
.journey-list {
  list-style: none;
  max-height: 170px;
  overflow-y: auto;
  padding: 6px 2px 4px 18px;
  border-left: 2px solid rgba(201, 166, 84, .6);
  scrollbar-width: thin;
}
.journey-list li {
  position: relative;
  padding: 3px 0 3px 10px;
  font-size: 13.5px;
  line-height: 1.45;
}
.journey-list li::before {
  content: ""; position: absolute; left: -22px; top: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-soft); border: 2px solid #f6ecd0;
}
.journey-list .jn-start { color: var(--ink-soft); }
.journey-list .jn-from { font-weight: 700; color: var(--ink); }
.journey-list .jn-arrow { color: var(--gold); margin: 0 3px; }
.journey-list .jn-to { font-weight: 700; color: #7c2c1a; }
.journey-list .jn-note { display: block; color: var(--ink-soft); font-size: 12px; }

.ask-line { text-align: center; font-size: 17px; margin: 14px 0 12px; }
.ask-line b { color: var(--blood); }

/* ---------- 选项卡片 ---------- */
.options-wrap {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  max-width: 660px; margin: 0 auto;
}
.opt-card {
  position: relative; cursor: pointer;
  border: 2px solid var(--gold); border-radius: 12px;
  padding: 16px 10px 13px; text-align: center;
  background: linear-gradient(180deg, #f7eed2, #ead7a6);
  box-shadow: 0 4px 10px rgba(70, 45, 10, .28), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .14s ease, box-shadow .14s ease;
  user-select: none;
}
.opt-card .med-mini {
  width: 58px; height: 58px; margin: 0 auto 8px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #f6ecd2;
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.3), transparent 45%), linear-gradient(150deg, #77602f, #45300f);
  border: 2px solid var(--gold-soft);
  box-shadow: 0 3px 7px rgba(60, 40, 10, .35);
}
.opt-name { font-size: 19px; font-weight: 700; letter-spacing: .04em; }
.opt-brief { font-size: 12px; color: var(--ink-soft); margin-top: 2px; letter-spacing: .05em; }
.opt-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 10px 18px rgba(70,45,10,.35); border-color: var(--gold-soft); }

.opt-card.disabled { cursor: default; pointer-events: none; opacity: .8; }
.opt-card.correct {
  border-color: var(--green);
  background: linear-gradient(180deg, #e7f3df, #cfe7c4);
  box-shadow: 0 0 0 2px rgba(47, 107, 60, .5);
}
.opt-card.correct .med-mini { background: linear-gradient(150deg, #3c7a4a, #245232); }
.opt-card.correct .opt-name::after { content: " ✓"; color: var(--green); }
.opt-card.wrong {
  border-color: var(--blood);
  background: linear-gradient(180deg, #f3ded6, #e6c0b2);
  animation: shake .45s ease;
}
.opt-card.wrong .opt-name::after { content: " ✗"; color: var(--blood); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
}
@keyframes pop-in {
  0% { transform: scale(.6); opacity: 0; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
.opt-card.enter { animation: pop-in .4s ease both; }

/* ---------- 历史小贴士 ---------- */
.tip-card {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 85; max-width: min(600px, 92vw);
  padding: 10px 16px;
  background: linear-gradient(170deg, #f7eed2, #e2cf9e);
  border: 2px solid var(--green);
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(30, 20, 4, .45);
  animation: tip-slide .28s cubic-bezier(.2,.8,.3,1.1) both;
}
.tip-card-title { font-size: 12px; letter-spacing: .2em; color: var(--green); font-weight: 700; }
.tip-card-body { font-size: 14px; color: var(--ink); line-height: 1.5; }
@keyframes tip-slide {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

/* ---------- 结局遮罩 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(40, 26, 8, .55), rgba(24, 14, 4, .8));
  padding: 18px;
  animation: fade-in .3s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.overlay-card {
  max-width: 470px; width: 100%; text-align: center;
  background:
    radial-gradient(circle at 30% 15%, rgba(255,252,236,.6), transparent 60%),
    linear-gradient(170deg, #f2e6c0, #e2cf9e);
  border: 3px double var(--gold); border-radius: 16px;
  padding: 24px 22px 20px;
  box-shadow: 0 18px 46px rgba(0,0,0,.5);
  animation: rise .4s cubic-bezier(.2,.8,.3,1.2) both;
}
@keyframes rise { from { transform: translateY(26px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.ov-emblem { font-size: 42px; line-height: 1; margin-bottom: 6px; }
.ov-title { font-size: 27px; letter-spacing: .16em; color: var(--blood); margin-bottom: 6px; }
.ov-desc { font-size: 15px; color: var(--ink); }
.ov-extra {
  margin-top: 10px; font-size: 13px; color: var(--ink-soft);
  text-align: left; background: rgba(255,250,232,.55);
  border-left: 3px solid var(--gold-soft);
  padding: 8px 10px; border-radius: 0 6px 6px 0;
  max-height: 150px; overflow-y: auto;
}
.ov-line { margin: 2px 0; line-height: 1.55; }
.ov-line b { color: var(--blood); }
.ov-sec { margin: 8px 0 2px; font-weight: 700; color: var(--ink); }
.ov-line.rel { font-size: 12.5px; color: var(--ink-soft); }
.overlay-actions { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- 人物浮窗 ---------- */
.tip {
  position: fixed; z-index: 90;
  max-width: 250px; padding: 9px 12px;
  background: linear-gradient(170deg, #f7eed2, #e6d3a2);
  border: 2px solid var(--gold); border-radius: 8px;
  box-shadow: 0 8px 18px rgba(50, 32, 8, .4);
  pointer-events: none;
  animation: fade-in .12s ease;
}
.tip-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.tip-name { font-size: 15px; font-weight: 700; color: #7c2c1a; }
.tip-brief { font-size: 11px; color: var(--gold); letter-spacing: .06em; }
.tip-bio { font-size: 13px; color: var(--ink); line-height: 1.5; }
.tip::after {
  content: ""; position: absolute; top: -7px; left: 50%; margin-left: -7px;
  width: 12px; height: 12px; background: #e6d3a2;
  border-left: 2px solid var(--gold); border-top: 2px solid var(--gold);
  transform: rotate(45deg);
}
.tip.below::after { top: auto; bottom: -7px; transform: rotate(-135deg); }

/* ---------- 彩带 ---------- */
.confetti-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 70; }
.conf { position: absolute; top: -24px; width: 9px; height: 15px; opacity: .95; }
@keyframes conf-fall {
  0%   { transform: translate3d(0, -4vh, 0) rotateZ(0) rotateX(0); }
  100% { transform: translate3d(var(--drift), 108vh, 0) rotateZ(720deg) rotateX(540deg); }
}

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .page-wrap { padding: 14px 8px 26px; }
  .title { font-size: 28px; }
  .medallion { width: 72px; height: 72px; font-size: 30px; }
  .end-name { font-size: 19px; }
  .vs-board { gap: 6px; }
  .orn-script { font-size: 12px; }
  .options-wrap { grid-template-columns: 1fr; max-width: 420px; }
  .opt-card { display: flex; align-items: center; text-align: left; gap: 12px; padding: 10px 14px; }
  .opt-card .med-mini { margin: 0; width: 44px; height: 44px; font-size: 20px; flex: 0 0 auto; }
  .opt-card .opt-txt { flex: 1; }
  .journey-list { max-height: 210px; }
  .status-item .status-sub { display: none; }
  .tip { max-width: 200px; }
}
