/* 东方棋局 · 宣传画风视觉系统 */
:root {
  --paper: #e9ddc2;
  --paper-dark: #d9c69c;
  --ink: #2b2016;
  --ink-soft: #4a3b2a;
  --red: #a31f24;
  --red-deep: #7a1216;
  --gold: #c9a227;
  --gold-soft: #dcbf6a;
  --good: #3d6b3d;
  --bad: #9c2020;
  --shadow: rgba(30, 18, 8, .45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  background: #17110b;
  color: var(--ink);
  overflow: hidden;
  user-select: none;
}

#app { position: fixed; inset: 0; }

/* ---------- 胶片颗粒 & 暗角 ---------- */
#grain {
  position: fixed; inset: -100px; pointer-events: none; z-index: 200; opacity: .10;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  animation: grainShift .45s steps(3) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); } 33% { transform: translate(-30px, 18px); }
  66% { transform: translate(22px, -25px); } 100% { transform: translate(0, 0); }
}
.vignette::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 150;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(15, 8, 3, .55) 100%);
}

/* ---------- 屏幕切换 ---------- */
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: flex; }
.screen.fade-in { animation: screenIn .8s ease both; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* 红幕转场 */
#curtain {
  position: fixed; inset: 0; z-index: 300; pointer-events: none;
  display: flex;
}
#curtain .half {
  flex: 1; background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.12) 0 8px, transparent 8px 26px),
    linear-gradient(180deg, var(--red-deep), var(--red) 40%, var(--red-deep));
  transform: scaleX(0); transition: transform .55s cubic-bezier(.7, 0, .3, 1);
  box-shadow: 0 0 60px rgba(0,0,0,.6) inset;
}
#curtain .half.left { transform-origin: left; }
#curtain .half.right { transform-origin: right; }
#curtain.closed .half { transform: scaleX(1); }

/* ---------- 标题屏 ---------- */
#scr-title.active { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#scr-title {
  flex-direction: column; align-items: center; justify-content: flex-start;
  background: radial-gradient(ellipse at 50% 30%, #3a1210 0%, #1c0908 60%, #120605 100%);
  overflow: hidden;
}
#title-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: .5; filter: sepia(.4) contrast(1.05);
  animation: kenburns 40s ease-in-out infinite alternate;
}
@keyframes kenburns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.15) translate(-2%, -3%); } }
#scr-title::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,8,6,.2), rgba(18,6,5,.85) 85%);
}
.title-rays {
  position: absolute; left: 50%; top: 38%; width: 1600px; height: 1600px; margin: -800px;
  background: repeating-conic-gradient(from 0deg, rgba(201,162,39,.14) 0deg 6deg, transparent 6deg 14deg);
  border-radius: 50%; animation: raysSpin 90s linear infinite; pointer-events: none;
}
@keyframes raysSpin { to { transform: rotate(360deg); } }
#title-main { position: relative; text-align: center; z-index: 2; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 20px 14px calc(28px + env(safe-area-inset-bottom)); }
#title-main .kicker {
  color: var(--gold-soft); letter-spacing: .9em; font-size: 15px; margin-bottom: 18px; text-indent: .9em;
  animation: riseIn 1s .2s ease both;
}
#title-main h1 {
  font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
  font-size: clamp(64px, 11vw, 128px); color: #f3e6c8; letter-spacing: .08em;
  text-shadow: 0 4px 0 var(--red-deep), 0 8px 30px rgba(0,0,0,.8);
}
#title-main h1 span { display: inline-block; animation: charDrop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes charDrop {
  from { opacity: 0; transform: translateY(-70px) rotate(-8deg) scale(1.6); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
#title-main .years {
  color: var(--gold); font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 26px;
  letter-spacing: .5em; margin-top: 10px; text-indent: .5em; animation: riseIn 1s .9s ease both;
}
#title-main .tagline { color: #cbb894; margin-top: 22px; font-size: 15px; letter-spacing: .25em; animation: riseIn 1s 1.2s ease both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
.title-buttons { margin-top: 46px; display: flex; gap: 26px; justify-content: center; animation: riseIn 1s 1.5s ease both; }

.btn {
  font-family: inherit; cursor: pointer; border: none; position: relative;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  color: #f6e8c8; font-size: 19px; letter-spacing: .35em; text-indent: .35em;
  padding: 15px 44px; border: 2px solid rgba(246, 232, 200, .35);
  box-shadow: 0 6px 0 #4b0b0e, 0 10px 24px rgba(0,0,0,.55);
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.btn:hover { transform: translateY(-3px); filter: brightness(1.12); box-shadow: 0 9px 0 #4b0b0e, 0 16px 30px rgba(0,0,0,.6); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #4b0b0e; }
.btn.gold { background: linear-gradient(180deg, var(--gold), #937317); box-shadow: 0 6px 0 #5c470e, 0 10px 24px rgba(0,0,0,.55); color: #2b2016; }
.btn.gold:hover { box-shadow: 0 9px 0 #5c470e, 0 16px 30px rgba(0,0,0,.6); }
.btn.ghost { background: transparent; box-shadow: none; border: 1px solid rgba(246,232,200,.4); font-size: 15px; padding: 10px 26px; }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; }

/* ---------- 幕间屏 ---------- */
#scr-act { background: #14100a; text-align: center; }
#scr-act.active {
  display: block; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
#act-poster {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; filter: sepia(.5) contrast(1.06) brightness(.75);
  animation: posterIn 2.2s .1s ease both;
}
@keyframes posterIn { from { opacity: 0; transform: scale(1.12); } to { opacity: .55; transform: scale(1); } }
#scr-act::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,10,6,.5), rgba(14,9,5,.88)); z-index: 1; }
#act-content {
  position: relative; z-index: 2; max-width: 780px; margin: 0 auto;
  min-height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: 26px 30px calc(34px + env(safe-area-inset-bottom));
}
#act-num {
  font-family: 'ZCOOL QingKe HuangYou', serif; color: var(--gold); font-size: 20px; letter-spacing: .6em; text-indent: .6em;
  animation: riseIn .8s .5s ease both;
}
#act-title {
  font-family: 'Ma Shan Zheng', serif; font-size: clamp(52px, 8vw, 92px); color: #f3e6c8;
  margin: 8px 0 4px; text-shadow: 0 4px 0 var(--red-deep), 0 8px 30px rgba(0,0,0,.8);
  animation: actTitleIn 1s .7s cubic-bezier(.2, 1.3, .4, 1) both;
}
@keyframes actTitleIn { from { opacity: 0; transform: scale(2.4); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
#act-years { color: var(--gold-soft); font-size: 20px; letter-spacing: .4em; text-indent: .4em; animation: riseIn .8s 1s ease both; }
#act-intro {
  margin: 30px auto 0; color: #ddcda8; font-size: 17px; line-height: 2; text-align: justify; min-height: 100px;
}
#tz-area { margin-top: 26px; min-height: 200px; }
.tz-name { color: var(--gold); font-size: 18px; letter-spacing: .3em; margin-bottom: 6px; }
.tz-desc { color: #bfae8a; font-size: 14px; margin-bottom: 18px; }

/* 骰子 */
.dice-wrap { perspective: 700px; display: inline-block; margin: 8px 0 14px; }
.die {
  width: 84px; height: 84px; position: relative; transform-style: preserve-3d;
  animation: dieTumble 1.1s cubic-bezier(.3, .7, .3, 1) both;
}
@keyframes dieTumble {
  0% { transform: rotateX(0) rotateY(0) translateY(-220px) scale(.6); }
  60% { transform: rotateX(720deg) rotateY(540deg) translateY(0) scale(1.05); }
  80% { transform: rotateX(700deg) rotateY(560deg) scale(.97); }
  100% { transform: rotateX(720deg) rotateY(540deg) scale(1); }
}
.die .face {
  position: absolute; inset: 0; background: linear-gradient(145deg, #f6ecd2, #dcc9a0);
  border: 2px solid #8a713d; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 44px; color: var(--red-deep);
  backface-visibility: hidden; box-shadow: inset 0 0 18px rgba(138, 113, 61, .35);
}
.tz-outcome {
  display: inline-block; margin-top: 4px; padding: 14px 26px; max-width: 560px;
  background: rgba(233, 221, 194, .95); color: var(--ink); font-size: 16px; line-height: 1.8;
  border: 1px solid #8a713d; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: stampIn .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
.tz-mod { color: var(--red); font-size: 13px; margin-top: 6px; }
@keyframes stampIn { from { opacity: 0; transform: scale(1.7) rotate(4deg); } to { opacity: 1; transform: none; } }

/* ---------- 主板面 ---------- */
#scr-board {
  flex-direction: column;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(201, 162, 39, .07), transparent 50%),
    radial-gradient(ellipse at 85% 100%, rgba(163, 31, 36, .08), transparent 55%),
    linear-gradient(160deg, #221a10, #191209 55%, #14100a);
}

/* 顶栏 */
#board-header {
  display: flex; align-items: center; gap: 18px; padding: 10px 20px;
  background: linear-gradient(180deg, rgba(163,31,36,.92), rgba(122,18,22,.92));
  border-bottom: 3px solid var(--gold); box-shadow: 0 4px 20px rgba(0,0,0,.5); z-index: 5;
}
#board-header .logo { font-family: 'Ma Shan Zheng', serif; font-size: 25px; color: #f3e6c8; letter-spacing: .1em; }
#turn-label { color: var(--gold-soft); font-size: 15px; letter-spacing: .15em; }
#plays-stars { display: flex; gap: 6px; margin-left: auto; }
.play-star { width: 22px; height: 22px; color: var(--gold); transition: all .4s; filter: drop-shadow(0 0 6px rgba(201,162,39,.6)); }
.play-star.used { color: rgba(0,0,0,.35); filter: none; transform: scale(.8); }
#ap-chip {
  color: #f3e6c8; background: rgba(0,0,0,.25); border: 1px solid var(--gold-soft);
  padding: 4px 14px; font-size: 15px; letter-spacing: .1em;
}
#ap-chip b { color: var(--gold); font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 20px; }
#ap-chip.bump { animation: chipBump .4s ease; }
@keyframes chipBump { 50% { transform: scale(1.25); background: rgba(201,162,39,.4); } }

/* 主区 */
#board-main { flex: 1; display: grid; grid-template-columns: 390px 1fr 235px; gap: 14px; padding: 14px 18px 6px; min-height: 0; }

.panel-title {
  font-size: 13px; color: var(--gold-soft); letter-spacing: .45em; text-indent: .45em; text-align: center;
  padding: 6px 0; border-bottom: 1px solid rgba(201,162,39,.35); margin-bottom: 8px;
}

/* 关系面板 */
#rel-panel { overflow: visible; }
.rel-row {
  display: grid; grid-template-columns: 64px 1fr 30px; align-items: center; gap: 8px;
  padding: 7px 9px; margin-bottom: 6px;
  background: linear-gradient(180deg, rgba(233,221,194,.12), rgba(233,221,194,.05));
  border: 1px solid rgba(201,162,39,.22); border-left: 4px solid transparent;
  transition: border-color .3s, background .3s;
}
.rel-row.flash-up { animation: relUp .9s ease; }
.rel-row.flash-down { animation: relDown .9s ease; }
@keyframes relUp { 0%, 100% { background: rgba(233,221,194,.08); } 30% { background: rgba(61,107,61,.5); } }
@keyframes relDown {
  0%, 100% { background: rgba(233,221,194,.08); transform: none; }
  20% { background: rgba(156,32,32,.55); transform: translateX(-4px); }
  40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}
.rel-name { color: #e6d7b4; font-size: 15px; letter-spacing: .12em; white-space: nowrap; }
.rel-track { position: relative; height: 14px; background: linear-gradient(90deg, rgba(156,32,32,.5), rgba(90,80,55,.4) 50%, rgba(201,162,39,.45)); border: 1px solid rgba(0,0,0,.4); }
.rel-track::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(243,230,200,.5); }
.rel-marker {
  position: absolute; top: 50%; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
  background: radial-gradient(circle at 35% 35%, #ffe9a8, var(--gold) 60%, #7a5c10);
  border: 1px solid #3a2c08; border-radius: 50%;
  transition: left .8s cubic-bezier(.3, 1.3, .4, 1); box-shadow: 0 0 8px rgba(201,162,39,.7);
}
.rel-val { font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 17px; text-align: right; }
.rel-val.pos { color: var(--gold); } .rel-val.neg { color: #e07777; } .rel-val.zero { color: #b8a888; }

/* 资源面板 */
#res-panel { display: flex; flex-direction: column; gap: 10px; }
.res-box {
  flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 10px 14px;
  background: linear-gradient(180deg, rgba(233,221,194,.14), rgba(233,221,194,.05));
  border: 1px solid rgba(201,162,39,.25); position: relative; overflow: hidden;
}
.res-box.flash-up { animation: relUp .9s ease; }
.res-box.flash-down { animation: relDown .9s ease; }
.res-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.res-name { color: #e6d7b4; font-size: 15px; letter-spacing: .3em; }
.res-num { font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 30px; color: var(--gold); transition: color .3s; }
.res-num.danger { color: #ff6b5e; animation: dangerPulse 1s infinite; }
@keyframes dangerPulse { 50% { opacity: .45; } }
.res-bar { height: 10px; background: rgba(0,0,0,.45); border: 1px solid rgba(0,0,0,.5); }
.res-fill {
  height: 100%; background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width .9s cubic-bezier(.3, 1, .4, 1); box-shadow: 0 0 10px rgba(201,162,39,.4);
}

/* 中央舞台 */
#stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#event-log {
  flex: 1; overflow-y: auto; padding: 12px 16px; font-size: 14px; line-height: 1.9; color: #cdbd99;
  background: rgba(20, 14, 8, .55); border: 1px solid rgba(201,162,39,.2);
  scrollbar-width: thin;
}
#event-log .entry { animation: logIn .5s ease both; border-bottom: 1px dashed rgba(201,162,39,.13); padding: 3px 0; }
#event-log .entry.head { color: var(--gold-soft); letter-spacing: .2em; text-align: center; border-bottom: 1px solid rgba(201,162,39,.3); }
@keyframes logIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
#stage-actions { display: flex; gap: 10px; padding: 10px 0 0; }
#stage-actions .btn { font-size: 15px; padding: 10px 22px; }

/* ---------- 手牌 ---------- */
#hand-zone { height: 235px; position: relative; display: flex; justify-content: center; align-items: flex-end; padding-bottom: 8px; z-index: 4; }
.card {
  width: 150px; height: 212px; position: absolute; bottom: 12px; cursor: pointer;
  transform-origin: 50% 120%;
  transition: transform .35s cubic-bezier(.3, 1.2, .4, 1), filter .3s;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.55));
}
.card:hover { z-index: 50 !important; }
.card-inner {
  width: 100%; height: 100%; border-radius: 7px; overflow: hidden; position: relative;
  background: linear-gradient(160deg, #f2e7cb, #dcc9a0);
  border: 2px solid #6d5326; display: flex; flex-direction: column;
}
.card.drawn { animation: cardDraw .6s cubic-bezier(.25, 1.1, .4, 1) both; }
@keyframes cardDraw {
  from { transform: translate(60vw, -30vh) rotateY(180deg) scale(.5); opacity: 0; }
  to { opacity: 1; }
}
.card-head { display: flex; align-items: center; gap: 5px; padding: 5px 7px; background: linear-gradient(180deg, var(--red), var(--red-deep)); }
.card.type-boon .card-head { background: linear-gradient(180deg, var(--gold), #937317); }
.card-head .cname { color: #f6e8c8; font-size: 13px; font-weight: 700; letter-spacing: .02em; line-height: 1.2; flex: 1; }
.card.type-boon .card-head .cname { color: #2b2016; }
.card-ap {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3cf, var(--gold) 65%, #7a5c10);
  border: 1px solid #3a2c08; color: #2b2016; font-family: 'ZCOOL QingKe HuangYou', serif;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.card-img { height: 84px; background-size: cover; background-position: center; border-bottom: 1px solid #6d5326; position: relative; filter: sepia(.35) contrast(1.02); }
.card-img .ctag {
  position: absolute; left: 0; bottom: 0; background: rgba(43, 32, 22, .85); color: var(--gold-soft);
  font-size: 10px; padding: 2px 7px; letter-spacing: .2em;
}
.card-img .cyear { position: absolute; right: 4px; top: 3px; font-family: 'ZCOOL QingKe HuangYou', serif; color: #f6e8c8; font-size: 13px; text-shadow: 0 1px 3px #000; }
.card-body { flex: 1; padding: 6px 8px; font-size: 11px; line-height: 1.55; color: var(--ink-soft); overflow: hidden; }
.card-secret {
  position: absolute; right: -8px; top: 34px; transform: rotate(12deg);
  border: 2px solid var(--red); color: var(--red); font-size: 12px; letter-spacing: .3em; text-indent: .3em;
  padding: 2px 6px; border-radius: 3px; opacity: .85; font-weight: 700; background: rgba(246, 232, 200, .7);
}
.card.type-crisis .card-inner { border-color: var(--red-deep); box-shadow: 0 0 0 1px rgba(163,31,36,.6) inset; }
.card.type-crisis { animation: crisisPulse 2.2s ease-in-out infinite; }
@keyframes crisisPulse {
  0%, 100% { filter: drop-shadow(0 8px 14px rgba(0,0,0,.55)); }
  50% { filter: drop-shadow(0 8px 20px rgba(200, 30, 30, .8)); }
}
.card.locked-event .card-inner::after {
  content: '仅可作行动'; position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  background: rgba(43,32,22,.8); color: #cbb894; font-size: 10px; padding: 2px 0; letter-spacing: .2em;
}

/* ---------- 通用弹层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: rgba(12, 7, 4, .78); animation: screenIn .3s ease both; padding: 20px;
}
.dossier {
  width: min(680px, 94vw); max-height: 92vh; overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(163,31,36,.06), transparent 120px),
    linear-gradient(160deg, #f2e7cb, #ddca9f);
  border: 2px solid #6d5326; box-shadow: 0 30px 80px rgba(0,0,0,.7);
  padding: 26px 30px 24px; position: relative;
  animation: dossierIn .45s cubic-bezier(.25, 1.2, .4, 1) both;
}
@keyframes dossierIn { from { opacity: 0; transform: translateY(60px) scale(.92) rotate(-1deg); } to { opacity: 1; transform: none; } }
.dossier .d-kicker { color: var(--red); font-size: 12px; letter-spacing: .4em; margin-bottom: 6px; }
.dossier h2 { font-family: 'Ma Shan Zheng', serif; font-size: 34px; color: var(--ink); line-height: 1.2; }
.dossier .d-year { font-family: 'ZCOOL QingKe HuangYou', serif; color: var(--red); font-size: 18px; margin-left: 10px; }
.dossier .d-img {
  margin: 14px 0; height: 200px; background-size: cover; background-position: center;
  border: 1px solid #6d5326; filter: sepia(.4) contrast(1.03);
}
.dossier .d-flavor { font-size: 14px; color: var(--ink-soft); font-style: normal; border-left: 3px solid var(--gold); padding-left: 12px; margin-bottom: 12px; line-height: 1.8; }
.dossier .d-desc { font-size: 15px; line-height: 1.9; margin-bottom: 14px; }
.dossier .d-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.choice-btn {
  display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  background: linear-gradient(180deg, rgba(163,31,36,.09), rgba(163,31,36,.03));
  border: 1px solid #8a713d; padding: 12px 16px; margin-bottom: 10px;
  transition: all .2s;
}
.choice-btn:hover:not(:disabled) { background: rgba(163,31,36,.16); transform: translateX(6px); border-color: var(--red); }
.choice-btn:disabled { opacity: .45; cursor: not-allowed; }
.choice-btn .ch-label { font-size: 17px; font-weight: 700; color: var(--red-deep); letter-spacing: .1em; }
.choice-btn .ch-desc { font-size: 13px; color: var(--ink-soft); margin-top: 3px; line-height: 1.6; }
.choice-btn .ch-lock { font-size: 12px; color: var(--bad); margin-top: 3px; }

/* 掷骰结果面板 */
.roll-panel { text-align: center; padding: 10px 0; }
.roll-panel .need { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; letter-spacing: .1em; }
.seal {
  display: inline-block; margin: 12px auto 4px; width: 92px; height: 92px; border-radius: 50%;
  border: 4px solid var(--red); color: var(--red); font-family: 'Ma Shan Zheng', serif; font-size: 44px;
  line-height: 84px; transform: rotate(-14deg);
  animation: sealStamp .4s cubic-bezier(.2, 2, .4, 1) both; box-shadow: 0 0 0 2px rgba(163,31,36,.3) inset;
}
.seal.fail { border-color: #58504a; color: #58504a; }
@keyframes sealStamp { from { opacity: 0; transform: scale(2.6) rotate(-14deg); } to { opacity: .92; transform: scale(1) rotate(-14deg); } }
.result-texts { font-size: 15px; line-height: 1.9; margin-top: 10px; }

/* delta 徽标 */
.delta-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.delta-chip {
  padding: 4px 12px; font-size: 14px; border: 1px solid; letter-spacing: .06em;
  animation: chipPop .4s cubic-bezier(.2, 1.6, .4, 1) both;
}
.delta-chip.up { color: var(--good); border-color: var(--good); background: rgba(61,107,61,.1); }
.delta-chip.down { color: var(--bad); border-color: var(--bad); background: rgba(156,32,32,.08); }
.delta-chip.flag { color: #7a5c10; border-color: var(--gold); background: rgba(201,162,39,.12); }
@keyframes chipPop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }

/* 浮动数字 */
.float-num {
  position: fixed; z-index: 250; pointer-events: none; font-family: 'ZCOOL QingKe HuangYou', serif;
  font-size: 22px; text-shadow: 0 2px 6px rgba(0,0,0,.8);
  animation: floatUp 1.4s ease-out both;
}
.float-num.up { color: #8fd48f; } .float-num.down { color: #ff8a7a; }
@keyframes floatUp { from { opacity: 0; transform: translateY(6px) scale(.7); } 25% { opacity: 1; transform: translateY(-8px) scale(1.1); } to { opacity: 0; transform: translateY(-60px) scale(1); } }

/* 屏幕震动 & 警报 */
.shake { animation: bigShake .55s ease; }
@keyframes bigShake {
  0%, 100% { transform: none; } 15% { transform: translate(-14px, 4px) rotate(-.6deg); }
  35% { transform: translate(11px, -5px) rotate(.5deg); } 55% { transform: translate(-8px, 3px); }
  75% { transform: translate(6px, -2px); }
}
#alert-flash { position: fixed; inset: 0; z-index: 190; pointer-events: none; background: radial-gradient(ellipse, transparent 40%, rgba(163,31,36,.55)); opacity: 0; }
#alert-flash.on { animation: alertFlash .8s ease; }
@keyframes alertFlash { 0%, 100% { opacity: 0; } 30% { opacity: 1; } }

/* AP 行动面板 */
.ap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-item {
  cursor: pointer; font-family: inherit; text-align: left; padding: 12px 14px;
  background: rgba(163,31,36,.06); border: 1px solid #8a713d; transition: all .2s;
}
.ap-item:hover:not(:disabled) { background: rgba(163,31,36,.15); transform: translateY(-2px); }
.ap-item:disabled { opacity: .4; cursor: not-allowed; }
.ap-item b { color: var(--red-deep); font-size: 16px; letter-spacing: .1em; }
.ap-item .cost { float: right; font-family: 'ZCOOL QingKe HuangYou', serif; color: var(--gold); background: #2b2016; padding: 0 8px; border-radius: 3px; }
.ap-item p { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.country-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.country-grid .ap-item { text-align: center; }

/* ---------- 幕末屏 ---------- */
#scr-finale { background: #0d0a06; }
#scr-finale.active { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.letterbox { pointer-events: none; }
#finale-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .4; filter: sepia(.5) brightness(.7); animation: kenburns 30s ease-in-out infinite alternate; }
.letterbox { position: absolute; left: 0; right: 0; height: 90px; background: #000; z-index: 3; }
.letterbox.top { top: 0; transform: translateY(-100%); animation: boxDown 1s .2s ease both; }
.letterbox.bottom { bottom: 0; transform: translateY(100%); animation: boxUp 1s .2s ease both; }
@keyframes boxDown { to { transform: none; } }
@keyframes boxUp { to { transform: none; } }
#finale-content {
  position: relative; z-index: 2; margin: 0 auto; max-width: 760px;
  min-height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: 100px 30px calc(60px + env(safe-area-inset-bottom)); text-align: center;
}
#finale-content .f-kicker { color: var(--red); letter-spacing: .5em; font-size: 14px; margin-bottom: 12px; }
#finale-content h2 { font-family: 'Ma Shan Zheng', serif; font-size: 54px; color: #f3e6c8; text-shadow: 0 4px 0 var(--red-deep); margin-bottom: 20px; }
#finale-desc { color: #d5c5a0; font-size: 16px; line-height: 2.1; text-align: justify; margin-bottom: 26px; min-height: 120px; }
#finale-choices { text-align: left; }
#finale-choices .choice-btn { background: linear-gradient(160deg, rgba(242,231,203,.96), rgba(220,201,160,.96)); box-shadow: 0 8px 24px rgba(0,0,0,.5); }
#finale-choices .choice-btn:hover:not(:disabled) { background: #f6ecd2; }

/* ---------- 结局屏 ---------- */
#scr-ending { flex-direction: column; align-items: center; background: #0b0805; overflow-y: auto; }
#ending-img {
  width: 100%; height: 44vh; background-size: cover; background-position: center;
  filter: sepia(.5) contrast(1.05) brightness(.8);
  mask-image: linear-gradient(180deg, #000 65%, transparent); -webkit-mask-image: linear-gradient(180deg, #000 65%, transparent);
  animation: posterIn 2.5s ease both;
}
#ending-body { max-width: 720px; padding: 0 30px 60px; text-align: center; margin-top: -50px; position: relative; z-index: 2; }
#ending-kind { color: var(--red); letter-spacing: .6em; text-indent: .6em; font-size: 14px; animation: riseIn 1s .6s ease both; }
#ending-title {
  font-family: 'Ma Shan Zheng', serif; font-size: clamp(56px, 9vw, 96px); color: #f3e6c8;
  text-shadow: 0 5px 0 var(--red-deep), 0 10px 40px rgba(0,0,0,.9); margin: 6px 0 10px;
  animation: actTitleIn 1.2s .9s cubic-bezier(.2, 1.3, .4, 1) both;
}
#ending-poem { color: var(--gold-soft); font-size: 17px; letter-spacing: .2em; margin-bottom: 24px; animation: riseIn 1s 1.4s ease both; }
#ending-text { color: #d5c5a0; font-size: 16px; line-height: 2.15; text-align: justify; animation: riseIn 1s 1.8s ease both; }
.addendum { margin-top: 20px; padding: 14px 18px; border: 1px solid rgba(201,162,39,.4); background: rgba(201,162,39,.06); text-align: justify; color: #d5c5a0; font-size: 14px; line-height: 2; animation: riseIn 1s 2.2s ease both; }
.addendum b { color: var(--gold); letter-spacing: .2em; }
#ending-stats { display: flex; justify-content: center; gap: 26px; margin: 30px 0 10px; flex-wrap: wrap; animation: riseIn 1s 2.4s ease both; }
.stat-tile { text-align: center; }
.stat-tile .v { font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 34px; color: var(--gold); }
.stat-tile .k { font-size: 12px; color: #b8a888; letter-spacing: .3em; }
#ending-score { font-size: 15px; color: #cbb894; margin-bottom: 26px; animation: riseIn 1s 2.6s ease both; }
#ending-score b { font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 40px; color: var(--gold); }

/* 提示条 */
#toast {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 260;
  background: rgba(43, 32, 22, .95); color: var(--gold-soft); border: 1px solid var(--gold);
  padding: 10px 26px; font-size: 15px; letter-spacing: .1em; opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
#toast.on { opacity: 1; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.3); }
::-webkit-scrollbar-thumb { background: rgba(201,162,39,.4); }

/* 静音按钮 */
#mute-btn {
  position: fixed; right: 14px; bottom: 14px; z-index: 260; cursor: pointer;
  background: rgba(43,32,22,.8); color: var(--gold-soft); border: 1px solid rgba(201,162,39,.4);
  width: 40px; height: 40px; border-radius: 50%; font-size: 17px;
}

/* 响应式 */
/* 平铺手牌（窄屏横向滑动） */
#hand-zone.flat {
  display: flex; justify-content: flex-start; align-items: center; gap: 12px;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  scroll-snap-type: x proximity;
}
#hand-zone.flat::after { content: ''; flex: none; width: 4px; }
.card.flat {
  position: static; flex: none; transform: none !important; transform-origin: center;
  scroll-snap-align: center; bottom: auto;
}
.card.flat:active { transform: scale(.96) !important; }

@media (max-width: 900px) {
  button, .card { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  #board-main { grid-template-columns: 1fr; overflow-y: auto; gap: 8px; padding: 8px 10px 4px; }
  /* 国力：一条纤薄状态带 */
  #res-panel { order: -1; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; }
  #res-panel .panel-title { display: none; }
  .res-box { padding: 5px 8px 6px; min-width: 0; }
  .res-top { margin-bottom: 2px; display: block; text-align: center; }
  .res-name { font-size: 10px; letter-spacing: .05em; white-space: nowrap; display: block; opacity: .8; }
  .res-num { font-size: 19px; display: block; line-height: 1.15; }
  .res-bar { height: 4px; }
  /* 邦交地图：通栏出血成为主角 */
  #rel-panel { margin: 0 -10px; overflow: visible; }
  #rel-panel .panel-title { font-size: 11px; padding: 3px 0 5px; }
  #rel-map { border-left: none; border-right: none; }
  .map-badge { min-width: 48px; padding: 4px 7px 3px; border-radius: 7px; }
  .mb-name { font-size: 12.5px; }
  .mb-val { font-size: 16px; }
  .map-hint { display: block; }
  #event-log { min-height: 0; max-height: 108px; font-size: 12.5px; }
  #hand-zone { height: 224px; }
  .card { width: 140px; height: 200px; }
  .letterbox { height: 34px; }
  #board-header { flex-wrap: wrap; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; gap: 6px 10px; }
  #board-header .logo { font-size: 17px; }
  #turn-label { font-size: 11px; order: 6; width: 100%; letter-spacing: .08em; }
  #board-header .btn { padding: 9px 14px; font-size: 13px; letter-spacing: .12em; }
  #ap-chip { font-size: 13px; padding: 3px 9px; }
  #plays-stars { margin-left: auto; }
  .play-star { width: 18px; height: 18px; }
  /* 弹层接近全屏，选项按钮加大 */
  .overlay { padding: 10px; align-items: flex-end; }
  .dossier { width: 100%; max-height: 88vh; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .dossier h2 { font-size: 26px; }
  .dossier .d-img { height: 130px; }
  .dossier .d-actions .btn { flex: 1; padding: 13px 10px; font-size: 15px; letter-spacing: .15em; text-indent: .15em; }
  .choice-btn { padding: 14px 14px; }
  .choice-btn .ch-label { font-size: 16px; }
  .ap-grid { grid-template-columns: 1fr 1fr; }
  .ap-item { padding: 13px 12px; }
  .country-grid { grid-template-columns: repeat(3, 1fr); }
  /* 标题/结局屏留出安全区 */
  #title-main { padding: 0 18px; width: 100%; }
  #title-main .kicker { letter-spacing: .3em; text-indent: .3em; font-size: 12px; }
  #title-main .years { font-size: 17px; letter-spacing: .28em; text-indent: .28em; }
  #title-main .tagline { font-size: 13px; letter-spacing: .1em; }
  #title-main h1 { font-size: clamp(52px, 15vw, 90px); }
  .title-buttons { flex-direction: column; gap: 14px; align-items: stretch; padding: 0 10px; }
  #finale-content { padding: 60px 18px; }
  #finale-content h2 { font-size: 38px; }
  #ending-title { font-size: clamp(46px, 13vw, 72px); }
  #ending-body { padding: 0 18px calc(40px + env(safe-area-inset-bottom)); }
  #mute-btn { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* ==================== 回合末电报（内部参考） ==================== */
.wire-overlay { align-items: center; }
.wire-sheet {
  width: min(700px, 94vw); max-height: 86vh; display: flex; flex-direction: column;
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(122,92,40,.10) 27px 28px),
    linear-gradient(165deg, #f4ecd6, #e2d3ae);
  border: 2px solid #6d5326; box-shadow: 0 30px 80px rgba(0,0,0,.75);
  animation: wireIn .5s cubic-bezier(.2,1.2,.35,1) both; position: relative;
}
.wire-sheet::before, .wire-sheet::after {
  content: ''; position: absolute; left: 0; right: 0; height: 12px;
  background: repeating-linear-gradient(90deg, #6d5326 0 5px, transparent 5px 13px);
  opacity: .45;
}
.wire-sheet::before { top: -1px; } .wire-sheet::after { bottom: -1px; }
@keyframes wireIn { from { opacity: 0; transform: translateY(-70px) scaleY(.7); } to { opacity: 1; transform: none; } }
.wire-head {
  padding: 14px 20px 10px; text-align: center; color: var(--red-deep);
  font-size: 15px; letter-spacing: .5em; text-indent: .5em; font-weight: 700;
  border-bottom: 2px double #8a713d;
}
.wire-machine { color: #8a713d; letter-spacing: 0; font-size: 12px; }
.wire-body { flex: 1; overflow-y: auto; padding: 14px 22px 10px; }
.wire-foot { padding: 12px 20px 16px; text-align: center; border-top: 1px dashed #8a713d; }
.wire-item {
  padding: 11px 0 12px; border-bottom: 1px dashed rgba(122,92,40,.4);
  animation: wireItemIn .4s ease both;
}
@keyframes wireItemIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
.wire-src { font-size: 11px; color: #8a713d; letter-spacing: .22em; margin-bottom: 3px; }
.wire-time { float: right; letter-spacing: .1em; }
.wire-title { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 5px; letter-spacing: .05em; }
.wire-text { font-size: 14.5px; line-height: 1.85; color: var(--ink-soft); min-height: 1.6em; }
.wire-item .delta-row { justify-content: flex-start; margin-top: 9px; }
.wire-item.kind-threshold, .wire-item.kind-burst {
  background: rgba(163,31,36,.09); margin: 0 -22px; padding: 12px 22px 13px;
  border-left: 5px solid var(--red);
}
.wire-item.kind-threshold .wire-title, .wire-item.kind-burst .wire-title { color: var(--red-deep); }
.wire-item.kind-friendly { border-left: 5px solid var(--good); margin: 0 -22px; padding: 11px 22px 12px; background: rgba(61,107,61,.07); }
.wire-item.kind-hint { background: rgba(43,32,22,.06); margin: 0 -22px; padding: 11px 22px 12px; border-left: 5px solid #8a713d; }
.wire-item.kind-hint .wire-title { color: #6d5326; font-style: italic; }
.wire-item.kind-agenda { border-left: 5px solid var(--gold); margin: 0 -22px; padding: 11px 22px 12px; background: rgba(201,162,39,.09); }
.wire-item.kind-bloc { border-left: 5px solid #7a5c10; margin: 0 -22px; padding: 11px 22px 12px; }

/* 议程徽标 */
#agenda-chip { display: flex; gap: 6px; cursor: pointer; }
.ag-tag {
  font-size: 11px; padding: 3px 9px; border: 1px solid; letter-spacing: .06em;
  background: rgba(0,0,0,.22); white-space: nowrap;
}
.ag-tag.unknown { color: var(--gold-soft); border-color: rgba(220,191,106,.5); animation: agPulse 2.4s ease-in-out infinite; }
@keyframes agPulse { 50% { opacity: .5; } }
.ag-tag.ok { color: #9fd89f; border-color: #5f9a5f; }
.ag-tag.bad { color: #ff9c8f; border-color: #b34a3f; }

/* 议程结算块 */
.agenda-result {
  margin: 12px 0; padding: 13px 16px; border: 1px solid #8a713d; border-left-width: 5px;
  background: rgba(163,31,36,.06);
}
.agenda-result.foiled { border-left-color: var(--good); background: rgba(61,107,61,.09); }
.agenda-result.succeeded { border-left-color: var(--red); background: rgba(163,31,36,.09); }
.ag-power { font-size: 11px; letter-spacing: .35em; color: #8a713d; }
.ag-name { font-size: 20px; font-weight: 700; color: var(--ink); margin: 2px 0 6px; }
.ag-verdict { font-size: 12px; padding: 2px 9px; border: 1px solid currentColor; letter-spacing: .15em; vertical-align: middle; }
.agenda-result.foiled .ag-verdict { color: var(--good); }
.agenda-result.succeeded .ag-verdict { color: var(--red); }
.ag-cond { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }
.ag-verdict-big { font-size: 16px; font-weight: 700; margin-top: 4px; }
.agenda-result.foiled .ag-verdict-big { color: var(--good); }
.agenda-result.succeeded .ag-verdict-big { color: var(--red); }
.ag-text { font-size: 14px; line-height: 1.85; }
.ap-item.spy { border-color: var(--red); background: rgba(163,31,36,.12); }
.ap-item.spy b { color: var(--red); }

/* ==================== 宣传画浓度 & 纪录片质感 ==================== */
#board-header {
  background:
    repeating-linear-gradient(115deg, rgba(0,0,0,.07) 0 3px, transparent 3px 11px),
    linear-gradient(180deg, rgba(163,31,36,.96), rgba(122,18,22,.96));
}
#board-header .logo::before { content: '★ '; color: var(--gold); font-size: 17px; }
#board-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px;
  background: repeating-linear-gradient(90deg, var(--gold) 0 22px, var(--red-deep) 22px 30px);
}
#board-header { position: relative; }

.act-banner {
  display: inline-block; margin: 18px auto 4px; padding: 9px 40px; position: relative;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  color: #f6e8c8; font-size: 19px; letter-spacing: .4em; text-indent: .4em;
  font-family: 'ZCOOL QingKe HuangYou', serif;
  box-shadow: 0 6px 22px rgba(0,0,0,.6); border-top: 2px solid var(--gold-soft); border-bottom: 2px solid var(--gold-soft);
  animation: bannerIn .8s 1.15s cubic-bezier(.2,1.3,.4,1) both;
}
.act-banner::before, .act-banner::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 16px;
  background: linear-gradient(180deg, #6b0f12, #4b0b0e);
}
.act-banner::before { left: -16px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.act-banner::after { right: -16px; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
@keyframes bannerIn { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: none; } }

#filmcard {
  position: fixed; inset: 0; z-index: 305; background: #060504; display: none;
  align-items: center; justify-content: center; text-align: center;
}
#filmcard.on { display: flex; animation: filmFlicker .3s steps(3) both; }
@keyframes filmFlicker { 0% { opacity: 0; } 40% { opacity: .85; } 70% { opacity: .6; } 100% { opacity: 1; } }
#filmcard .fc-inner { animation: fcIn .7s ease both; }
@keyframes fcIn { from { opacity: 0; letter-spacing: 1.2em; } to { opacity: 1; letter-spacing: .45em; } }
#filmcard .fc-year {
  font-family: 'ZCOOL QingKe HuangYou', serif; color: #d8cdb2; font-size: 68px;
  letter-spacing: .18em; text-indent: .18em; text-shadow: 0 0 30px rgba(216,205,178,.35);
}
#filmcard .fc-text { color: #a99a7c; font-size: 17px; letter-spacing: .45em; text-indent: .45em; margin-top: 12px; }
#filmcard::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(90deg, transparent 0 2px, rgba(255,255,255,.045) 2px 3px);
  animation: filmScratch .18s steps(2) infinite;
}
@keyframes filmScratch { 0% { transform: translateX(0); } 100% { transform: translateX(3px); } }
#filmcard .sprocket { position: absolute; top: 0; bottom: 0; width: 34px; opacity: .5;
  background: repeating-linear-gradient(180deg, transparent 0 16px, #1c1712 16px 34px); }
#filmcard .sprocket.l { left: 0; } #filmcard .sprocket.r { right: 0; }

/* 真实历史照片的做旧处理 */
.card-img.has-photo { filter: sepia(.52) contrast(1.12) brightness(.94) saturate(.7); }
.card-img.has-photo::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(233,221,194,.14), transparent 40%, rgba(60,40,20,.3));
  mix-blend-mode: multiply;
}
.d-img.has-photo { filter: sepia(.45) contrast(1.1) brightness(.96) saturate(.75); }

.credits-link { margin-top: 14px; animation: riseIn 1s 1.7s ease both; }
.credits-link a { color: rgba(203,184,148,.65); font-size: 12px; letter-spacing: .2em; text-decoration: none; border-bottom: 1px dotted rgba(203,184,148,.4); }
.credits-link a:hover { color: var(--gold); }

/* ==================== iOS 动态视口修正（底部按钮被工具栏遮挡） ==================== */
@supports (height: 100dvh) {
  #app { top: 0; left: 0; right: 0; bottom: auto; height: 100dvh; }
  .screen { height: 100dvh; }
  .overlay { height: 100dvh; inset: auto 0 auto 0; top: 0; }
  #filmcard, #curtain, #grain, #alert-flash { height: 100dvh; bottom: auto; }
}
.dossier { max-height: calc(100dvh - 32px); }
.wire-sheet { max-height: calc(100dvh - 40px); }

@media (max-width: 900px) {
  .wire-sheet { width: 100%; max-height: calc(100dvh - 16px); }
  .wire-body { padding: 12px 16px 8px; }
  .wire-item.kind-threshold, .wire-item.kind-burst, .wire-item.kind-friendly,
  .wire-item.kind-hint, .wire-item.kind-agenda, .wire-item.kind-bloc { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  #agenda-chip { order: 7; width: 100%; }
  .ag-tag { font-size: 10px; padding: 2px 7px; }
  .act-banner { font-size: 15px; padding: 7px 26px; letter-spacing: .25em; text-indent: .25em; }
  #filmcard .fc-year { font-size: 42px; }
  #filmcard .fc-text { font-size: 13px; letter-spacing: .3em; text-indent: .3em; }
  /* 弹层不再贴底，避免被浏览器工具栏盖住按钮 */
  .overlay { align-items: center; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .dossier { max-height: calc(100dvh - 20px); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  /* 关键操作按钮吸底常显 */
  .dossier .d-actions {
    position: sticky; bottom: calc(-1 * (14px + env(safe-area-inset-bottom)));
    background: linear-gradient(180deg, rgba(229,213,176,0), #e5d5b0 32%);
    margin: 14px -16px 0; padding: 14px 16px calc(10px + env(safe-area-inset-bottom));
  }
  .wire-foot {
    position: sticky; bottom: 0; background: #eee0bf;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* ==================== 邦交地图面板 ==================== */
#rel-map {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  background-size: cover; background-position: center;
  border: 1px solid rgba(201,162,39,.35); box-shadow: inset 0 0 40px rgba(20,12,6,.5);
  filter: sepia(.15);
}
.map-china {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  color: var(--red); font-size: 26px; text-shadow: 0 0 12px rgba(163,31,36,.9);
  animation: chinaStar 2.6s ease-in-out infinite;
}
@keyframes chinaStar { 50% { text-shadow: 0 0 22px rgba(230,60,50,1); transform: translate(-50%,-50%) scale(1.15); } }
.map-badge {
  position: absolute; transform: translate(-50%, -50%); cursor: pointer;
  min-width: 44px; padding: 3px 6px 2px; text-align: center;
  background: rgba(24, 16, 9, .82); border: 2px solid #b8a888; border-radius: 6px;
  transition: border-color .5s, box-shadow .5s, transform .2s;
  z-index: 2;
}
.map-badge:hover { transform: translate(-50%, -50%) scale(1.12); z-index: 5; }
.mb-name { color: #e6d7b4; font-size: 12px; letter-spacing: .06em; white-space: nowrap; }
.mb-val { font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 15px; line-height: 1.1; }
.map-badge.enemy .mb-name { color: #ffb3a8; }
.map-badge.ally .mb-name { color: #ffe9a8; }
.map-badge.flash-up { animation: relUp .9s ease; }
.map-badge.flash-down { animation: relDown .9s ease; }

/* ==================== 历史王牌 ==================== */
#btn-trump.has-ready { border-color: var(--gold); color: var(--gold-soft); animation: agPulse 2.4s infinite; }
.trump-n { background: var(--gold); color: #2b2016; border-radius: 50%; padding: 0 6px; font-size: 12px; }
.trump-hot { background: var(--red); color: #f6e8c8; padding: 0 6px; font-size: 11px; border-radius: 3px; }
.trump-row { display: flex; gap: 12px; align-items: stretch; }
.trump-card {
  flex: 1; min-width: 0; border: 2px solid #6d5326; background: linear-gradient(170deg, #f4ecd6, #ddc99f);
  padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 5px; position: relative;
}
.trump-card .tc-img { aspect-ratio: 3/4; max-height: 150px; background-size: cover; background-position: center; border: 1px solid #6d5326; filter: sepia(.2); }
.trump-card .tc-name { font-family: 'Ma Shan Zheng', serif; font-size: 21px; color: var(--red-deep); line-height: 1.1; }
.trump-card .tc-sub { font-size: 12px; letter-spacing: .3em; color: #8a713d; }
.trump-card .tc-era { font-size: 11px; color: var(--ink-soft); line-height: 1.5; border-left: 2px solid var(--gold); padding-left: 6px; }
.trump-card .tc-gain { font-size: 12px; color: var(--good); line-height: 1.55; }
.trump-card .tc-cost { font-size: 12px; color: var(--bad); line-height: 1.55; }
.trump-card .tc-state { font-size: 11.5px; color: #8a713d; margin-top: auto; }
.trump-card .btn { font-size: 14px; padding: 9px 10px; letter-spacing: .3em; text-indent: .3em; margin-top: 6px; }
.trump-card.st-locked { filter: grayscale(.75) brightness(.85); }
.trump-card.st-dead { filter: grayscale(1) brightness(.75); }
.trump-card.st-dead::after {
  content: '作 废'; position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%) rotate(-16deg);
  border: 3px solid var(--red); color: var(--red); font-size: 26px; letter-spacing: .3em; text-indent: .3em;
  padding: 4px 12px; border-radius: 5px; opacity: .85; background: rgba(246,232,200,.6);
}
.trump-card.st-usedAct { opacity: .75; }

@media (max-width: 900px) {
  
  .map-badge { min-width: 40px; padding: 2px 5px 1px; }
  .mb-name { font-size: 11px; }
  .mb-val { font-size: 13px; }
  .trump-row { flex-direction: column; }
  .trump-card .tc-img { max-height: 110px; aspect-ratio: 16/7; }
  #btn-trump { order: 4; }
}


/* ==================== 全屏地图弹层 ==================== */
.map-hint {
  display: none; position: absolute; right: 6px; bottom: 6px; z-index: 3;
  background: rgba(24,16,9,.75); color: var(--gold-soft); font-size: 10px;
  padding: 2px 8px; border: 1px solid rgba(201,162,39,.4); border-radius: 3px; pointer-events: none;
}
#map-modal {
  position: fixed; inset: 0; z-index: 280; background: rgba(10,6,3,.95);
  display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 0 calc(10px + env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
#map-modal .mm-title { text-align: center; color: var(--gold-soft); letter-spacing: .4em; text-indent: .4em; font-size: 15px; padding: 4px 0 10px; }
#map-modal .mm-map {
  position: relative; width: 100%; aspect-ratio: 4/3; background-size: cover; background-position: center;
  border-top: 1px solid rgba(201,162,39,.4); border-bottom: 1px solid rgba(201,162,39,.4);
  filter: sepia(.12);
}
#map-modal .map-badge { min-width: 56px; padding: 5px 9px 4px; }
#map-modal .mb-name { font-size: 14px; }
#map-modal .mb-val { font-size: 19px; }
#map-modal .map-china { font-size: 34px; }
#map-modal .mm-list { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 12px 12px 6px; }
#map-modal .mm-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(233,221,194,.08); border: 1px solid rgba(201,162,39,.25); padding: 7px 10px;
  color: #e6d7b4; font-size: 13px;
}
#map-modal .mm-item b { font-family: 'ZCOOL QingKe HuangYou', serif; font-size: 17px; font-weight: 400; }
#map-modal .mm-close { margin: 12px auto 0; }
@media (max-width: 900px) { #map-modal .mm-list { grid-template-columns: 1fr 1fr; } }

/* 史册定评 */
.ending-grade { margin-bottom: 10px; font-size: 16px; letter-spacing: .15em; color: #d5c5a0; }
.ending-grade b { font-family: 'Ma Shan Zheng', serif; font-size: 30px; color: var(--gold); letter-spacing: .2em; margin-left: 6px; }
.ending-grade .eg-desc { font-size: 13px; color: #b8a888; letter-spacing: .05em; margin-top: 4px; }

/* ==================== 标签图鉴 ==================== */
.flag-item { margin: 8px 0; padding: 9px 13px; border: 1px solid #8a713d; border-left: 4px solid var(--gold); background: rgba(201,162,39,.07); }
.fi-name { font-size: 15px; font-weight: 700; color: var(--red-deep); margin-bottom: 3px; }
.fi-uses { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; }

/* ==================== 国史勋卡 ==================== */
.ach-head { text-align: center; color: var(--gold-soft); letter-spacing: .4em; text-indent: .4em; font-size: 15px; margin: 30px 0 14px; animation: riseIn 1s .8s ease both; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.ach-card {
  cursor: pointer; background: linear-gradient(170deg, #f2e7cb, #dcc9a0);
  border: 2px solid #6d5326; padding: 5px 5px 7px; text-align: center;
  animation: achIn .6s cubic-bezier(.2,1.4,.4,1) both;
  transition: transform .2s;
}
.ach-card:hover { transform: translateY(-4px) scale(1.05); z-index: 3; }
@keyframes achIn { from { opacity: 0; transform: rotateY(90deg) scale(.6); } to { opacity: 1; transform: none; } }
.ac-img { aspect-ratio: 3/4; background-size: cover; background-position: center; border: 1px solid #8a713d; filter: sepia(.15); }
.ac-name { font-size: 13px; font-weight: 700; color: var(--red-deep); margin-top: 5px; line-height: 1.2; }
.ac-cat { font-size: 10px; color: #8a713d; letter-spacing: .3em; text-indent: .3em; margin-top: 1px; }

/* 小作文 */
.essay { margin: 26px auto 0; max-width: 640px; padding: 18px 22px; background: rgba(233,221,194,.07);
  border: 1px solid rgba(201,162,39,.3); text-align: justify; animation: riseIn 1s 1.4s ease both; }
.essay-head { text-align: center; color: var(--gold); letter-spacing: .3em; font-size: 14px; margin-bottom: 12px; }
.essay p { color: #d5c5a0; font-size: 15px; line-height: 2.1; margin: 0 0 10px; }
.eg-stamp { width: 84px; height: 112px; margin: 0 auto 10px; background-size: cover; background-position: center;
  border: 2px solid var(--gold); transform: rotate(-4deg); box-shadow: 0 6px 20px rgba(0,0,0,.5); }
@media (max-width: 900px) {
  .ach-grid { grid-template-columns: repeat(3, 1fr); }
  #btn-flags { order: 5; }
}
.addendum.gap { border-color: rgba(163,31,36,.5); background: rgba(163,31,36,.08); }
.addendum.gap b { color: #ff9c8f; }
