:root {
  --paper: #f4ede0;
  --card: #fbf7ef;
  --ink: #231f1a;
  --muted: #7a6f60;
  --line: #d8ccb6;
  --red: #a8322a;
  --red-soft: #f3dcd6;
  --gold: #b08528;
  --green: #3d6b45;
  --blue: #2f5878;
  --shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 2px 8px rgba(60, 40, 20, .06);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.5 var(--sans); }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 6px; padding: 6px 12px; }
button:hover:not(:disabled) { border-color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover:not(:disabled) { background: #8c2820; }
button.chip { padding: 3px 10px; border-radius: 999px; font-size: 13px; }
button.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
h1, h2, h3 { font-family: var(--serif); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ── 首页 / 大厅 ── */
.home { max-width: 460px; margin: 10vh auto; padding: 0 16px; }
.home h1 { font-size: 44px; letter-spacing: .15em; }
.home .sub { color: var(--muted); margin: 4px 0 28px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: var(--shadow); }
.home .panel + .panel { margin-top: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; }
.lobby-players { list-style: none; padding: 0; margin: 12px 0; }
.lobby-players li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.share { font-family: ui-monospace, Menlo, monospace; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; word-break: break-all; flex: 1; }
.rules { margin-top: 14px; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules ol { padding-left: 20px; margin: 8px 0 0; }

/* ── 游戏主界面 ── */
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.top h1 { font-size: 20px; letter-spacing: .1em; }
.sky { background: var(--ink); color: var(--paper); border-radius: 6px; padding: 4px 10px; }
.sky b { font-family: var(--serif); margin-right: 6px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; padding: 16px; max-width: 1400px; margin: 0 auto; }
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.section-title { font-family: var(--serif); font-size: 15px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; }

.nations { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.nation { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; position: relative; box-shadow: var(--shadow); }
.nation.picked { outline: 2px solid var(--red); }
.nation.dead { opacity: .45; filter: grayscale(1); }
.nation .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.seal { width: 34px; height: 34px; border-radius: 6px; background: var(--red); color: #fff; font: 700 20px/34px var(--serif); text-align: center; flex: none; }
.seal.sm { width: 22px; height: 22px; font-size: 13px; line-height: 22px; border-radius: 4px; display: inline-block; }
.nation .heg { color: var(--gold); font-weight: 600; }
.stat { display: grid; grid-template-columns: 30px 1fr 16px; align-items: center; gap: 6px; font-size: 12px; }
.pips { display: flex; gap: 2px; }
.pip { flex: 1; height: 7px; border-radius: 2px; background: #e8dfcf; }
.pip.on.econ { background: var(--gold); }
.pip.on.gov { background: var(--blue); }
.pip.on.mil { background: var(--red); }
.stat b { text-align: right; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #ffe8a8; } to { background: transparent; } }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid currentColor; }
.badge.zhou { color: var(--gold); }
.badge.dead { color: var(--red); }
.adj { font-size: 11px; color: var(--muted); margin-top: 4px; }

.action { border: 2px solid var(--red); }
.action.idle { border-color: var(--line); }
.action h2 { font-size: 17px; margin-bottom: 6px; }
.action .hint { color: var(--muted); margin-bottom: 10px; }
.editor { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 10px 0; }
.editor .row { margin: 6px 0; }
.editor .lbl { width: 56px; color: var(--muted); font-size: 12px; }
.plan { list-style: none; padding: 0; margin: 8px 0; }
.plan li { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; background: var(--red-soft); border-radius: 6px; margin-bottom: 4px; }
.versus { display: flex; align-items: center; justify-content: center; gap: 16px; font-family: var(--serif); font-size: 20px; margin: 6px 0 12px; }
.versus .dice { font-family: var(--sans); font-size: 13px; color: var(--muted); display: block; text-align: center; }

.cards { display: flex; gap: 8px; flex-wrap: wrap; }
.card { width: 132px; min-height: 104px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; box-shadow: var(--shadow); text-align: left; display: flex; flex-direction: column; gap: 4px; }
.card .name { font-family: var(--serif); font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.card .speed { font: 700 12px/20px var(--sans); width: 20px; height: 20px; text-align: center; border-radius: 50%; background: var(--ink); color: var(--paper); }
.card .text { font-size: 12px; color: var(--muted); }
.card.reaction { background: #eef2f4; }
.card.war { border-color: #d6aaa4; }
.card.selectable:hover { border-color: var(--ink); transform: translateY(-2px); }
.card.selected { outline: 2px solid var(--red); }
.card.used { opacity: .35; }

.hero { width: 180px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow); }
.hero .name { font-family: var(--serif); font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; }
.hero .score { color: var(--red); }
.hero .cond { font-size: 12px; margin: 4px 0; }
.hero .state { font-size: 12px; }
.hero.revealed { border-color: var(--gold); background: #fbf3dc; }
.hero.failed { opacity: .5; }
.hero.pick { cursor: pointer; }
.hero.pick:hover { border-color: var(--ink); }

.players { list-style: none; padding: 0; margin: 0; }
.players li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.players li:last-child { border-bottom: 0; }
.players .who { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.players .name { font-weight: 600; }
.players .meta { font-size: 12px; color: var(--muted); }
.players .heroes { font-size: 12px; margin-top: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b9ae9b; margin-left: 4px; }
.dot.on { background: var(--green); }
.tag { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--ink); color: var(--paper); margin-left: 4px; }
.tag.wait { background: var(--gold); }
.diku { color: var(--green); letter-spacing: 1px; }

.queue { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.queue li { padding: 3px 0; display: flex; gap: 6px; }
.queue li.done { color: var(--muted); }
.queue .sp { font-weight: 700; width: 18px; text-align: center; }

.die { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); text-align: center; font-size: 11px; line-height: 16px; margin: 1px; background: #fff; }
.die.hit { background: var(--red); color: #fff; border-color: var(--red); }

.log { max-height: 340px; overflow: auto; font-size: 12.5px; }
.log p { margin: 0 0 5px; }
.log p.private { color: var(--blue); }
.log p.big { font-weight: 600; }

.scores { width: 100%; border-collapse: collapse; }
.scores td, .scores th { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; z-index: 20; max-width: 90vw; }

/* ── 地图 ── */
.mapwrap { overflow-x: auto; }
.map { position: relative; min-width: 660px; aspect-ratio: 16 / 9.5; background: radial-gradient(ellipse at 60% 40%, #efe5d1 0%, #e6d8bd 100%); border: 1px solid var(--line); border-radius: 12px; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.edge { fill: none; stroke: #a8977a; stroke-width: 3; stroke-dasharray: 2 5; stroke-linecap: round; }
.edge.dead { stroke: #cbbfa9; }
.edge.focus { stroke: var(--ink); stroke-dasharray: none; stroke-width: 3; }
.edge.war { stroke: var(--red); stroke-dasharray: none; stroke-width: 5; }
.mnation { position: absolute; transform: translate(-50%, -50%); width: 150px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; box-shadow: var(--shadow); }
.mnation.dead { opacity: .5; filter: grayscale(1); }
.mnation.picked { outline: 3px solid var(--red); }
.mnation.atwar { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft), var(--shadow); }
.mnation.pickable { cursor: pointer; }
.mnation.pickable:hover { border-color: var(--ink); }
.mhead { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.mhead .seal { width: 28px; height: 28px; font-size: 17px; line-height: 28px; }
.mhead .heg { color: var(--gold); font-weight: 600; flex: 1; font-size: 13px; }
.mstat { display: grid; grid-template-columns: 14px 1fr 12px; gap: 5px; align-items: center; font-size: 11px; }
.mstat b { text-align: right; }
.legend { position: absolute; left: 10px; bottom: 8px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.legend .pip { width: 14px; flex: none; }
/* 宽屏用地图，窄屏用卡片网格 */
.nations { display: none; }
@media (max-width: 700px) {
  .mapwrap { display: none; }
  .nations { display: grid; }
}

.hero.keeping { outline: 3px solid var(--green); background: #eef5ec; }
.hero.discarding { outline: 3px solid var(--red); background: var(--red-soft); text-decoration: line-through; }
.logpanel .log { max-height: 190px; }
.logpanel .log p.old { color: var(--muted); font-weight: 400; }
.edge.ally { stroke: var(--green); stroke-dasharray: none; stroke-width: 4; }
.badge.ally { color: var(--green); }
.card.pair { border-color: #a9c2a6; }
.edge.merged { stroke: #8a7a5e; stroke-dasharray: 6 4; stroke-width: 2; }
.card.swapping { outline: 2px dashed var(--red); opacity: .6; }
.card .fresh { font: 600 11px/1 var(--sans); background: var(--gold); color: #fff; border-radius: 4px; padding: 2px 4px; margin-right: 4px; }
.tip { position: relative; border-bottom: 1px dotted var(--muted); cursor: help; }
.tip:hover::after, .tip:focus::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 10;
  width: max-content; max-width: 240px; white-space: normal; background: var(--ink); color: var(--paper);
  padding: 6px 9px; border-radius: 6px; font-size: 12px; line-height: 1.5; box-shadow: var(--shadow);
}

/* ── 第三版界面：步骤条、指引横幅、底部手牌栏、弹窗 ── */
#toast { bottom: auto; top: calc(64px + env(safe-area-inset-top, 0px)); box-shadow: 0 6px 24px rgba(0,0,0,.25); font-weight: 500; }
.steps { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.step { padding: 2px 9px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line); }
.step.on { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.steps .arrow { color: var(--line); }

.layout.dock-open { padding-bottom: 300px; }
.layout { padding-bottom: 70px; }

.banner { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); }
.banner.act { border: 2px solid var(--red); box-shadow: 0 0 0 4px var(--red-soft), var(--shadow); }
.banner.war { border-left: 6px solid var(--red); }
.banner .btitle { font-family: var(--serif); font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.banner .hint { color: var(--muted); margin: 4px 0; }
.banner .row { margin: 8px 0; }
.banner .lbl { font-weight: 600; min-width: 56px; }
.waiting { color: var(--gold); font-weight: 600; margin-top: 6px; }
.guide { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0; padding-left: 20px; }
.guide li { padding-left: 2px; }

.news { background: #fffaf0; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.news p { margin: 2px 0; color: var(--muted); }
.news p.latest { color: var(--ink); font-weight: 600; }
.news p.private { color: var(--blue); }

.mapwrap.picking .map { box-shadow: 0 0 0 3px var(--red-soft); }
.mnation.pickable { box-shadow: 0 0 0 2px var(--red-soft), var(--shadow); }
.mnation.pickable:hover { border-color: var(--red); transform: translate(-50%, -50%) scale(1.04); }
.nation.pickable { cursor: pointer; box-shadow: 0 0 0 2px var(--red-soft); }
.mapprompt { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.map { width: min(100%, calc((100vh - 120px) * 1.6)); margin: 0 auto; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; background: rgba(251, 247, 239, .97); backdrop-filter: blur(6px); border-top: 2px solid var(--line); box-shadow: 0 -6px 20px rgba(60, 40, 20, .12); padding: 6px 16px calc(8px + env(safe-area-inset-bottom, 0px)); max-height: 46vh; overflow-y: auto; }
.dock.closed { padding-top: 6px; }
.docktoggle { position: absolute; right: 16px; top: 6px; font-size: 12px; padding: 2px 10px; }
.dock.closed .docktoggle { position: static; }
.dockbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 110px 6px 0; min-height: 40px; }
.dockbar.act { }
.dockbar .dlabel { font-weight: 600; }
.dockbar .spacer { flex: 1; }
.dockbar .planitem { background: var(--red-soft); border-radius: 6px; padding: 3px 4px 3px 8px; }
.dockbar.editing { background: #fff; border: 1px solid var(--red); border-radius: 8px; padding: 8px 10px; margin-right: 100px; }
.editrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.editrow .lbl { color: var(--muted); font-size: 12px; margin-left: 6px; }
.dockbody { display: flex; gap: 16px; align-items: flex-start; }
.dhead { font-family: var(--serif); font-weight: 600; margin: 2px 0 6px; }
.dockheroes { flex: 0 0 230px; display: flex; flex-direction: column; gap: 6px; }
.dockhand { flex: 1; min-width: 0; }
.dockhand .cards { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.dock .card { width: 124px; min-height: 92px; flex: none; position: relative; }
.card.selectable { cursor: pointer; border-color: var(--ink); }
.card .speed.react { background: var(--blue); font-size: 11px; }
.swaptag { position: absolute; right: 6px; bottom: 6px; font-size: 11px; color: #fff; background: var(--red); border-radius: 4px; padding: 1px 5px; }
.hmini { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12px; }
.hmini .hname { font-family: var(--serif); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.hmini .score { margin-left: auto; color: var(--red); }
.hmini.revealed { background: #fbf3dc; border-color: var(--gold); }
.hmini.failed { opacity: .5; }
.hmini .ok { color: var(--gold); }
.hmini .bad { color: var(--red); }
@media (max-width: 700px) {
  .dockbody { flex-direction: column; }
  .dockheroes { flex: none; width: 100%; flex-direction: row; overflow-x: auto; }
  .hmini { flex: 0 0 170px; }
  .dockbar, .dockbar.editing { padding-right: 0; margin-right: 0; padding-top: 30px; }
}

.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(35, 31, 26, .45); display: flex; align-items: flex-start; justify-content: center; padding: calc(40px + env(safe-area-inset-top, 0px)) 16px 16px; overflow-y: auto; }
.modal { background: var(--paper); border-radius: 12px; padding: 18px 20px; max-width: 860px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal h2 { font-size: 20px; margin-bottom: 4px; }
.modal h3 { font-family: var(--serif); margin: 14px 0 6px; }
.dock .card:disabled { opacity: 1; cursor: default; }
.dock .card.used { opacity: .35; }
.guide { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0; padding: 0; }
.guide b { color: var(--red); }
.card { align-items: stretch; }
.card .name { width: 100%; }
.dockheroes { flex: 0 0 260px; gap: 4px; }
.hmini { padding: 4px 8px; }
.hmini .hname { font-size: 13px; }
.hmini .score { margin-left: 4px; }
.hmini .hstate { margin-left: auto; font: 400 11px var(--sans); }
.hmini .cond { margin: 0; color: var(--ink); line-height: 1.35; }
/* 地图收紧：国家卡片大小不变，整体缩到 720px 宽 */
.map { width: min(100%, 720px); min-width: 700px; margin: 0 auto; }

/* ── 第四版：一屏布局（顶栏 / 战报+地图+侧栏 / 底部操作栏+手牌） ── */
body.in-game { overflow: hidden; }
.game { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.game .top { position: static; padding: 8px 16px; gap: 12px; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; padding: 10px 16px 8px; min-height: 0; max-width: 1440px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.stage .main { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.stage .side { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.centerlog { flex: none; padding: 8px 12px; border-left: 4px solid var(--gold); }
.centerlog .section-title { margin-bottom: 4px; }
.centerlog .log { height: 104px; max-height: none; overflow-y: auto; font-size: 13px; }
.centerlog .log p { margin: 0 0 3px; }
.mapslot { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: flex-start; }
.mapslot .mapwrap { overflow: visible; flex: none; }
.mapslot .map { width: 720px; min-width: 0; margin: 0; transform-origin: top left; }
.warnow { border: 2px solid var(--red); }
.warnow .versus { margin: 6px 0; font-size: 18px; }

.game .dock { position: static; max-height: 44vh; padding: 0 16px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -4px 16px rgba(60, 40, 20, .10); }
.actionbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; margin: 8px 0 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.actionbar.act { border: 2px solid var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.actionbar .atext { flex: 1 1 320px; min-width: 0; }
.actionbar .atitle { font-family: var(--serif); font-size: 16px; font-weight: 700; }
.actionbar .ahint { color: var(--muted); font-size: 13px; }
.actionbar .ahint .guide b { color: var(--red); margin-left: 6px; }
.actionbar .aplan { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actionbar .acontrols { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actionbar .lbl { font-weight: 600; color: var(--muted); font-size: 12px; }
.actionbar.editing .editrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 2 1 420px; }
.dockhand .dhead { display: flex; align-items: center; gap: 8px; }
.dockhand .docktoggle, .game .docktoggle { position: static; margin-left: auto; }
.game .dock.closed .docktoggle { margin: 0 0 6px; }

@media (max-width: 900px) {
  body.in-game { overflow: auto; }
  .game { height: auto; display: block; }
  .stage { grid-template-columns: 1fr; }
  .stage .side { overflow: visible; }
  .game .dock { position: sticky; bottom: 0; }
}
/* 地图字号放大：卡片加宽到 168px，地图加宽到 800px（高度不变） */
.mapslot .map { width: 800px; aspect-ratio: 800 / 430; }
.map svg { overflow: visible; }
.mnation { width: 168px; padding: 7px 10px; }
.mhead .seal { width: 30px; height: 30px; font-size: 19px; line-height: 30px; }
.mhead .heg { font-size: 15px; }
.mhead .badge { font-size: 12px; }
.mstat { grid-template-columns: 16px 1fr 16px; font-size: 13px; gap: 6px; line-height: 18px; }
.mstat b { font-size: 14px; }
.mstat .pip { height: 8px; }
.legend { font-size: 13px; }
.lengths { margin: 12px 0 4px; }
.lenbtn { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px; }
.lenbtn b { font-family: var(--serif); font-size: 16px; }
.lenbtn span { font-size: 12px; color: var(--muted); }
.lenbtn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lenbtn.on span { color: #d8ccb6; }
.lenbtn:disabled { opacity: 1; cursor: default; }
/* 把高度让给地图：战报、操作栏、手牌都收紧一些 */
.centerlog { padding: 6px 12px; }
.centerlog .log { height: 72px; }
.actionbar { padding: 6px 12px; margin: 6px 0 4px; }
.dock .card { min-height: 78px; padding: 6px 8px; gap: 2px; }
.dock .card .text { font-size: 11.5px; line-height: 1.35; }
.dockheroes { max-height: 112px; overflow-y: auto; }
.dhead { margin: 0 0 4px; }
.game .top { padding: 6px 16px; }
.stage { padding-top: 8px; }
/* 我的英杰放在地图左边 */
.mainrow { flex: 1; min-height: 0; display: flex; gap: 10px; }
.herocol { flex: 0 0 230px; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.herocol .section-title { margin-bottom: 2px; }
.mainrow .mapslot { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .mainrow { flex-direction: column; }
  .herocol { flex: none; max-height: none; }
}

/* ── 新手指引 ── */
.tutbtn { width: 100%; margin: -10px 0 16px; background: #fffaf0; border: 1px dashed var(--gold); color: var(--ink); padding: 9px; }
.tut-overlay { z-index: 50; align-items: center; }
.tut-modal { max-width: 640px; padding: 18px 22px 16px; }
.tut-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tut-modal h2 { font-size: 22px; margin-bottom: 10px; }
.tut-body { min-height: 250px; font-size: 14.5px; line-height: 1.65; }
.tut-body p { margin: 8px 0; }
.tut-lead { font-size: 16px; }
.tut-goal { background: var(--red-soft); border-radius: 8px; padding: 10px 12px; margin: 12px 0 4px; }
.tut-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; margin: 4px 0 8px; }
.tut-row .card { width: 150px; min-height: 92px; }
.tut-row .hero { width: 200px; }
.tut-nation { width: 220px; flex: none; }
.tut-list { margin: 6px 0; padding-left: 20px; flex: 1; min-width: 220px; }
.tut-list li { margin: 4px 0; }
.tut-steps { list-style: none; padding: 0; margin: 6px 0; }
.tut-steps li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.tut-steps .step { flex: none; min-width: 44px; text-align: center; }
.tut-steps.big { list-style: decimal; padding-left: 22px; }
.tut-steps.big li { display: list-item; font-size: 15px; }
.c-econ { color: var(--gold); } .c-gov { color: var(--blue); } .c-mil { color: var(--red); } .c-heg { color: var(--gold); }
.tut-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 10px; flex-wrap: wrap; }
.tut-dots { display: flex; gap: 6px; }
.tut-dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; background: var(--line); border: 0; }
.tut-dot.on { background: var(--red); width: 22px; border-radius: 5px; }

/* ── 英杰明置卡 ── */
.reveal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(35, 31, 26, .35); padding: 16px; cursor: pointer; animation: reveal-fade .25s ease-out; }
.reveal-card { width: min(320px, 100%); background: linear-gradient(160deg, #fffaf0 0%, #f6ecd6 100%); border: 3px solid var(--gold); outline: 1px solid #e6d3a5; outline-offset: -9px; border-radius: 16px; padding: 18px 20px 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); text-align: center; position: relative; animation: reveal-flip .6s cubic-bezier(.2, .9, .3, 1.2); }
.reveal-who { font-size: 13px; color: var(--gold); font-weight: 700; letter-spacing: .05em; }
.reveal-top { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 4px; }
.reveal-seal { width: 44px; height: 44px; border-radius: 8px; background: var(--red); color: #fff; font: 700 26px/44px var(--serif); }
.reveal-seal.neutral { background: var(--ink); }
.reveal-score { font: 700 34px/1 var(--serif); color: var(--red); }
.reveal-score small { font-size: 14px; margin-left: 2px; }
.reveal-name { font: 700 38px/1.2 var(--serif); letter-spacing: .12em; margin: 6px 0 8px; }
.reveal-cond { display: inline-block; font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.reveal-quote { margin: 16px 4px 8px; font: 17px/1.7 var(--serif); color: var(--ink); text-align: left; }
.reveal-quote cite { display: block; text-align: right; font-size: 13px; color: var(--muted); font-style: normal; margin-top: 6px; }
.reveal-hint { font-size: 11px; color: var(--muted); }
.reveal-bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.reveal-bar span { display: block; height: 100%; background: var(--gold); animation: reveal-timer linear forwards; }
@keyframes reveal-fade { from { opacity: 0; } }
@keyframes reveal-flip { from { transform: perspective(800px) rotateY(80deg) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes reveal-timer { from { width: 100%; } to { width: 0; } }

/* ── 可拖动弹窗（战争、获取新英杰） ── */
.overlay.soft { background: rgba(35, 31, 26, .12); pointer-events: none; align-items: center; flex-direction: column; gap: 12px; }
.overlay.soft .modal { pointer-events: auto; box-shadow: 0 16px 48px rgba(0, 0, 0, .32); }
.dragbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -18px -20px 12px; padding: 10px 16px; background: var(--ink); color: var(--paper); border-radius: 12px 12px 0 0; font: 700 16px var(--serif); cursor: grab; user-select: none; touch-action: none; }
.dragbar:active { cursor: grabbing; }
.draghint { font: 400 12px var(--sans); color: #cfc3ad; }
.recruitmodal { max-width: 760px; }
.warmodal { max-width: 520px; border: 2px solid var(--red); }
.warmodal .dragbar { background: var(--red); }
.warmodal.mine { box-shadow: 0 0 0 5px var(--red-soft), 0 16px 48px rgba(0, 0, 0, .32); }
.warmodal .versus { font-size: 24px; margin: 4px 0 10px; }
.warturn { font-weight: 700; color: var(--red); margin: 10px 0 4px; }
.reactlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reacted { font-size: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }

/* ════════════ 古风主题：宣纸、朱砂、墨、青铜、金 ════════════ */
:root {
  --paper: #ebdfc4;
  --card: #f7efdc;
  --ink: #2a211b;
  --muted: #7a6650;
  --line: #ccb68a;
  --red: #a3271f;
  --red-soft: #f0d5c8;
  --gold: #a47a26;
  --green: #3c6a56;
  --blue: #2e4e68;
  --bronze: #6d5a3a;
  --lacquer: #2b1a14;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", serif;
  --brush: "Ma Shan Zheng", "STKaiti", "KaiTi", "Noto Serif SC", serif;
  --sans: "Noto Serif SC", "Songti SC", "PingFang SC", "Microsoft YaHei", serif;
  --paper-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .32 0 0 0 0 .18 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='120' viewBox='0 0 160 120'%3E%3Cg fill='none' stroke='%23a48a5c' stroke-opacity='.07' stroke-width='1.6'%3E%3Cpath d='M20 70c0-10 12-14 18-6 2-12 20-12 22 0 8-6 18 2 12 10H24c-4 0-4-4-4-4z'/%3E%3Cpath d='M38 64c2-5 8-5 10 0M58 62c3-5 9-4 10 1'/%3E%3Cpath d='M100 30c0-8 10-11 15-5 2-9 16-9 17 0 6-4 14 2 9 8h-37c-3 0-4-3-4-3z'/%3E%3C/g%3E%3C/svg%3E");
  --huiwen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 11h10V3H4v5h3V6' fill='none' stroke='%23b8913f' stroke-width='1.2'/%3E%3Cpath d='M12 1h10v8h-6V4h3v2' fill='none' stroke='%23b8913f' stroke-width='1.2'/%3E%3C/svg%3E");
  --mountains: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='220' viewBox='0 0 1200 220' preserveAspectRatio='none'%3E%3Cpath d='M0 220V150c60-30 110-70 170-40s90-50 160-60 120 70 190 40 100-80 180-70 120 90 200 60 120-50 170-30 90 40 130 30v140z' fill='%232a211b' fill-opacity='.07'/%3E%3Cpath d='M0 220V180c80-20 150-60 230-30s130-40 210-30 160 60 250 40 150-50 230-30 180 40 280 20v70z' fill='%232a211b' fill-opacity='.08'/%3E%3C/svg%3E");
}

body { background-color: var(--paper); background-image: var(--paper-tex), var(--cloud); font-family: var(--sans); color: var(--ink); }
body:not(.in-game) { background-image: var(--mountains), var(--paper-tex), var(--cloud); background-repeat: no-repeat, repeat, repeat; background-position: bottom center, 0 0, 0 0; background-size: 100% 220px, auto, auto; min-height: 100vh; }
h1, h2, h3, .section-title, .dhead, .btitle, .atitle { font-family: var(--serif); }

/* 标题：毛笔字 + 印章 */
.logo { font-family: var(--brush) !important; font-weight: 400; letter-spacing: .08em; }
.home h1.logo { font-size: 72px; line-height: 1.1; display: flex; align-items: center; gap: 14px; }
.logoseal { font-family: var(--brush); font-size: 20px; line-height: 1; writing-mode: vertical-rl; background: var(--red); color: #fbeee0; padding: 6px 5px; border-radius: 4px; box-shadow: inset 0 0 0 2px #fbeee0, 0 0 0 1px var(--red); transform: rotate(4deg); letter-spacing: .1em; }
.home .sub { font-size: 15px; }

/* 顶栏：漆器色 + 回纹 */
.top, .game .top { background: linear-gradient(180deg, #3a2419, var(--lacquer)); color: #efe1c2; border-bottom: 0; box-shadow: 0 2px 0 #8e6a2c, 0 6px 0 -2px transparent; position: relative; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: var(--huiwen) repeat-x; background-size: 24px 8px; opacity: .85; pointer-events: none; }
.top h1.logo { font-size: 26px; color: #e7c77e; }
.top .muted, .top .small { color: #c9b48d; }
.top b { color: #f5e5c0; }
.top .sky { background: #f2e3c2; color: var(--ink); border: 1px solid #8e6a2c; }
.top .chip { background: transparent; color: #efe1c2; border-color: #8e6a2c; }
.step { border-color: #8e6a2c; color: #c9b48d; background: transparent; font-family: var(--serif); }
.step.on { background: var(--red); border-color: #e7c77e; color: #fff4dc; box-shadow: inset 0 0 0 1px #fff4dc55; }
.steps .arrow { color: #8e6a2c; }

/* 面板：绢底双线框 */
.panel, .banner, .actionbar, .news { background: var(--card); border: 1px solid var(--line); box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px #e2d0a6, 0 2px 6px rgba(60, 40, 20, .08); border-radius: 6px; }
.centerlog { border-left: 4px solid var(--red); }
.section-title { color: var(--ink); font-weight: 700; letter-spacing: .04em; }
.actionbar.act { border: 2px solid var(--red); box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px #ecc9b8, 0 0 0 3px var(--red-soft); }

/* 按钮 */
button { font-family: var(--serif); border-color: var(--line); background: #fbf4e3; }
button.primary { background: linear-gradient(180deg, #b13226, var(--red)); border: 1px solid #7a1c16; color: #fff4dc; box-shadow: inset 0 0 0 1px #e9b26b88; letter-spacing: .05em; }
button.chip.on { background: var(--ink); color: #f5e5c0; }
input { font-family: var(--serif); background: #fffaf0; border-color: var(--line); }
.tutbtn { background: #fbf2dc; border-color: var(--gold); }

/* 地图：旧绢地图 + 水墨山河 */
.map { background: radial-gradient(ellipse at 50% 45%, #f1e5c8 0%, #e3d2ab 70%, #d6c08f 100%); border: 2px solid #9c7c45; box-shadow: inset 0 0 0 4px #efe2c2, inset 0 0 0 5px #b89a5e, inset 0 0 40px rgba(90, 60, 20, .25); border-radius: 6px; }
.deco .river { fill: none; stroke: #6f8d97; stroke-opacity: .45; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.deco .river.wash { stroke: #8fb0b6; stroke-opacity: .25; stroke-width: 14; stroke-linecap: round; }
.deco .hill { fill: none; stroke: #4a3b2c; stroke-opacity: .28; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.edge { stroke: #7a6446; }
.edge.focus { stroke: var(--ink); }
.legend { color: #6b5a42; }

/* 国家：印章 + 绢牌 */
.seal { font-family: var(--brush); font-weight: 400; background: var(--red); color: #fbeee0; border-radius: 4px; box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 3px #fbeee0aa; transform: rotate(-3deg); }
.mnation, .nation { background: linear-gradient(180deg, #faf3e2, #f1e5c9); border: 1px solid #b89a5e; box-shadow: 0 2px 6px rgba(60, 40, 20, .18), inset 0 0 0 2px #faf3e2, inset 0 0 0 3px #e2cfa4; }
.mhead .heg { font-family: var(--serif); }
.pip { background: #e3d5b6; }
.pip.on.econ { background: #b08a2e; }
.pip.on.gov { background: #2e4e68; }
.pip.on.mil { background: #a3271f; }

/* 手牌：竹简 */
.card { background: repeating-linear-gradient(90deg, #efdcae 0 20px, #e6cf98 20px 21px), #efdcae; border: 1px solid #a8864a; box-shadow: 0 2px 4px rgba(60, 40, 20, .2), inset 0 1px 0 #fff3cf; border-radius: 4px; }
.card .name { font-family: var(--serif); font-weight: 900; }
.card .text { color: #5b4a33; }
.card.reaction { background: repeating-linear-gradient(90deg, #dfe3d6 0 20px, #d2d8c6 20px 21px), #dfe3d6; }
.card.war { border-color: #9c3a2a; }
.card.pair, .card.coalition { border-color: #4f7a63; }
.card .speed { background: radial-gradient(circle, #5b4a2e 40%, #3a2c18 100%); color: #f3d98e; box-shadow: 0 0 0 1.5px #c9a24e; font-family: var(--serif); }
.card .speed.react { background: radial-gradient(circle, #3c5a6a, #22394a); }
.card.selectable { border-color: var(--ink); }

/* 英杰：金框 */
.hero, .hmini { background: linear-gradient(180deg, #fbf4e3, #f2e6c8); border: 1px solid #b89a5e; }
.hero .name, .hmini .hname { font-family: var(--serif); font-weight: 900; }
.hero.revealed, .hmini.revealed { background: linear-gradient(180deg, #fbefcc, #f1dca2); border-color: var(--gold); }

/* 弹窗：卷轴 */
.modal { background: var(--card) var(--paper-tex); border-top: 10px solid #5a3a22; border-bottom: 10px solid #5a3a22; border-left: 1px solid #b89a5e; border-right: 1px solid #b89a5e; border-radius: 6px; }
.dragbar { background: linear-gradient(180deg, #3a2419, var(--lacquer)); color: #efd9a8; font-family: var(--serif); margin-top: -18px; border-radius: 0; }
.warmodal .dragbar { background: linear-gradient(180deg, #b13226, #8a1f18); }
.tut-modal { border-top-width: 10px; }
.tut-modal h2 { font-family: var(--brush); font-weight: 400; font-size: 30px; }
.reveal-card { font-family: var(--serif); }
.reveal-name { font-family: var(--brush); font-weight: 400; font-size: 52px; }
.reveal-quote { font-family: var(--serif); }
.reveal-seal { font-family: var(--brush); font-weight: 400; transform: rotate(-4deg); box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 3px #fbeee0aa; }

/* 底部操作区 */
.game .dock { background: linear-gradient(180deg, #efe2c4f2, #e8d8b4f2); border-top: 2px solid #9c7c45; }
#toast { background: var(--lacquer); color: #f3e2bd; border: 1px solid #8e6a2c; font-family: var(--serif); }
.die { background: #fbf4e3; border-color: #b89a5e; }
.die.hit { background: var(--red); border-color: #7a1c16; }

/* ── 出牌效果逐张展示 ── */
.fxpop { position: fixed; top: calc(70px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 45; display: flex; gap: 12px; align-items: center; width: min(560px, calc(100vw - 32px)); padding: 10px 14px 12px; background: var(--card) var(--paper-tex); border: 2px solid var(--gold); border-radius: 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, .3); cursor: pointer; animation: fx-in .35s cubic-bezier(.2, .9, .3, 1.2); }
.fxpop.war { border-color: var(--red); }
.fxpop.fizzled { opacity: .85; filter: grayscale(.5); }
.fxcard { flex: none; width: 84px; height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: repeating-linear-gradient(90deg, #efdcae 0 14px, #e6cf98 14px 15px); border: 1px solid #a8864a; border-radius: 4px; box-shadow: 0 2px 6px rgba(60, 40, 20, .25); }
.fxpop.war .fxcard { border-color: var(--red); }
.fxname { font: 900 17px var(--serif); writing-mode: vertical-rl; letter-spacing: .1em; }
.fxcard .speed { width: 22px; height: 22px; border-radius: 50%; text-align: center; font: 700 12px/22px var(--serif); background: radial-gradient(circle, #5b4a2e 40%, #3a2c18 100%); color: #f3d98e; }
.fxbody { flex: 1; min-width: 0; }
.fxwho { font-size: 12px; color: var(--gold); font-weight: 700; display: flex; justify-content: space-between; }
.fxleft { color: var(--muted); font-weight: 400; }
.fxtext { font: 600 15px/1.5 var(--serif); margin: 2px 0 6px; }
.fxchips { display: flex; flex-wrap: wrap; gap: 5px; }
.fxchip { font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.fxchip.up { background: #dcebd8; color: #2f6a3c; }
.fxchip.down { background: #f3d4cc; color: #9b2a1f; }
.fxchip.dead { background: var(--ink); color: #f5e5c0; }
.fxskip { position: absolute; right: 10px; bottom: 10px; font-size: 11px; padding: 1px 8px; }
.fxbar { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; overflow: hidden; }
.fxbar span { display: block; height: 100%; background: var(--gold); animation: reveal-timer linear forwards; }
@keyframes fx-in { from { transform: translate(-50%, -16px); opacity: 0; } }

/* 地图上的变化高亮 */
.mnation.fxhit { box-shadow: 0 0 0 3px #e7c77e, 0 0 18px 4px rgba(231, 199, 126, .8); z-index: 3; animation: fx-pulse 1.1s ease-in-out infinite alternate; }
.mstat.hl { border-radius: 4px; position: relative; }
.mstat.hl.up { background: #d9ecd2; }
.mstat.hl.down { background: #f6d3c9; }
.fxd { position: absolute; right: -30px; font: 900 15px var(--serif); font-style: normal; padding: 0 5px; border-radius: 6px; animation: fx-pop .5s cubic-bezier(.2, .9, .3, 1.4); }
.fxd.up { color: #fff; background: #3f8a4c; }
.fxd.down { color: #fff; background: #b3332a; }
.mhead .heg { position: relative; }
.mhead .heg .fxd { right: auto; left: 100%; margin-left: 4px; top: -2px; }
@keyframes fx-pulse { to { box-shadow: 0 0 0 3px #e7c77e, 0 0 26px 8px rgba(231, 199, 126, .55); } }
@keyframes fx-pop { from { transform: scale(.3); opacity: 0; } }
.reacted.auto { opacity: .65; font-style: italic; }
.mstat { position: relative; }
.top .sky b { color: var(--red); }
.swapmodal { max-width: 720px; }
.swapinfo { margin: 0 0 8px; padding-left: 18px; line-height: 1.7; }
.swapcards .card { width: 124px; min-height: 92px; position: relative; }

/* ── 终局之战：顶栏、预告卷轴 ── */
.top.final { background: linear-gradient(180deg, #6a1a14, #3a0f0b); }
.finaltag { font-family: var(--brush); font-size: 22px; color: #ffd98a; background: #8a1f18; border: 1px solid #e7c77e; padding: 0 12px; border-radius: 4px; letter-spacing: .15em; animation: final-glow 1.6s ease-in-out infinite alternate; }
@keyframes final-glow { to { box-shadow: 0 0 14px 2px rgba(255, 190, 90, .7); } }
.game.finalround .stage { background: radial-gradient(ellipse at 50% 120%, rgba(163, 39, 31, .16), transparent 60%); }
.finalhint { color: var(--red); }
.finaloverlay { z-index: 40; align-items: center; background: rgba(40, 10, 8, .55); }
.finalnotice { max-width: 640px; text-align: center; border-top-color: #7a1c16; border-bottom-color: #7a1c16; }
.finalnotice.enter { animation: reveal-flip .7s cubic-bezier(.2, .9, .3, 1.2); }
.final-sub { color: var(--red); font-weight: 700; letter-spacing: .2em; }
.finalnotice h2 { font-family: var(--brush); font-weight: 400; font-size: 40px; margin: 6px 0 10px; color: #7a1c16; }
.final-sky { background: var(--red-soft); border-radius: 8px; padding: 8px 12px; text-align: left; font-size: 14px; }
.final-cols { display: flex; gap: 16px; text-align: left; margin: 12px 0 6px; flex-wrap: wrap; }
.final-cols ul { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 220px; }
.final-cols li { padding: 4px 0; border-bottom: 1px dashed var(--line); display: flex; align-items: center; gap: 8px; font-size: 14px; }
.final-cols li.fallen { opacity: .55; }
.final-nations .seal { width: 24px; height: 24px; font-size: 15px; line-height: 24px; flex: none; }
.warnc { color: var(--red); font-weight: 700; }
.finalnotice .row { justify-content: center; }
.finalnotice .primary { font-size: 17px; padding: 8px 28px; }

/* ── 史官评说 ── */
.cer-overlay { z-index: 35; background: rgba(35, 25, 15, .5); }
.cer-modal { max-width: 760px; }
.cer-head { display: flex; align-items: baseline; gap: 12px; }
.cer-head h2 { font-family: var(--brush); font-weight: 400; font-size: 36px; }
.cer-modal h3 { font-family: var(--serif); color: var(--red); margin: 14px 0 6px; letter-spacing: .1em; }
.cer-lines { list-style: none; padding: 0; margin: 0; }
.cer-line { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); animation: fx-in .4s ease-out; }
.cer-line .seal { width: 28px; height: 28px; font-size: 17px; line-height: 28px; flex: none; }
.cer-line.fallen .seal { background: #555; }
.cer-text { flex: 1; font: 16px/1.5 var(--serif); }
.cer-stats { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cer-player { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.cer-name { width: 96px; flex: none; font-weight: 700; }
.cer-cards { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; }
.cer-hero { font-size: 13px; padding: 2px 8px; border-radius: 4px; border: 1px solid; animation: reveal-flip .45s ease-out; }
.cer-hero b { margin-left: 4px; }
.cer-hero.won { background: #f6e3a8; border-color: var(--gold); }
.cer-hero.lost { background: #e4ded2; border-color: #b9ae9b; color: #6d6458; }
.cer-total { width: 48px; text-align: right; font: 900 22px var(--serif); color: var(--red); }
.cer-rank { list-style: none; padding: 0; margin: 0; }
.cer-rank li { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px dashed var(--line); animation: fx-in .4s ease-out; }
.cer-rank li.champ { background: linear-gradient(90deg, #f6e3a8, transparent); border-radius: 6px; }
.cer-pos { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #f5e5c0; text-align: center; font: 700 16px/34px var(--serif); flex: none; }
.champ .cer-pos { background: var(--red); font-family: var(--brush); font-size: 20px; }
.cer-pname { width: 110px; font-weight: 700; }
.cer-title { flex: 1; display: flex; flex-direction: column; }
.cer-title b { font-family: var(--brush); font-weight: 400; font-size: 22px; color: var(--red); }
.cer-title small { color: var(--muted); }
.cer-score { font: 900 20px var(--serif); }
.cer-foot { margin-top: 14px; justify-content: flex-end; }
.final-players li { display: block; }
/* 史官评说：只有新揭开的一项有入场动画 */
.cer-line, .cer-rank li, .cer-hero { animation: none; }
.cer-line.new, .cer-rank li.new { animation: cer-in .5s ease-out; }
.cer-hero.new { animation: cer-flip .45s ease-out; }
@keyframes cer-in { from { transform: translateY(-8px); opacity: 0; } }
@keyframes cer-flip { from { transform: rotateY(90deg); opacity: 0; } }
.final-call { font-family: var(--brush); font-size: 30px; color: #fff4dc; background: linear-gradient(90deg, transparent, var(--red) 20%, var(--red) 80%, transparent); padding: 4px 0; margin: 4px -20px 10px; letter-spacing: .1em; }
.final-points { text-align: left; margin: 0 auto 8px; padding-left: 22px; font-size: 15px; line-height: 1.8; max-width: 540px; }
.final-points b { color: var(--red); }
.finalnotice .primary:disabled { opacity: .7; }

/* ════════════ 青绿主题（参考《千里江山图》）：石青、石绿、黛蓝、金 ════════════ */
:root {
  --paper: #e8e3d0;
  --card: #f6f2e4;
  --ink: #1c2a30;
  --muted: #687068;
  --line: #bfc2a8;
  --red: #1f566b;            /* 原「朱砂」主色改为深石青 */
  --red-soft: #d6e5e3;
  --gold: #a8843a;
  --green: #2f6b57;
  --blue: #24577a;
  --lacquer: #0f2430;
  --jade: #2f6b57;
  --rust: #9a5a3c;           /* 只用于「减少 / 灭亡」这类损失提示 */
  --mountains: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='240' viewBox='0 0 1200 240' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%233f7f73'/%3E%3Cstop offset='1' stop-color='%23e8e3d0' stop-opacity='0'/%3E%3C/linearGradient%3E%3ClinearGradient id='h' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%231f566b'/%3E%3Cstop offset='1' stop-color='%23e8e3d0' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 240V140c50-40 90-90 150-60s80-60 150-70 110 80 180 50 90-100 170-90 110 100 190 70 110-60 160-40 100 50 200 30v210z' fill='url(%23h)' fill-opacity='.35'/%3E%3Cpath d='M0 240V185c80-30 140-80 220-40s120-50 200-40 150 70 240 40 140-60 220-40 170 50 320 25v110z' fill='url(%23g)' fill-opacity='.45'/%3E%3C/svg%3E");
}
body { background-color: var(--paper); }

/* 顶栏：黛蓝 + 金 */
.top, .game .top { background: linear-gradient(180deg, #1a3644, var(--lacquer)); box-shadow: 0 2px 0 #8a7a45; }
.top h1.logo { color: #e3c98a; }
.top .sky { background: #eef0e2; border-color: #8a7a45; }
.top .sky b { color: var(--red); }
.step { border-color: #6f7b62; color: #b7c2b0; }
.step.on { background: linear-gradient(180deg, #2d7a6e, #1f566b); border-color: #e3c98a; color: #f6efd8; }
.steps .arrow { color: #6f7b62; }
.top.final { background: linear-gradient(180deg, #17423c, #0b2523); }
.finaltag { background: #1f5a52; border-color: #e3c98a; color: #f1d996; }

/* 印章：青铜印 */
.seal, .reveal-seal { background: linear-gradient(160deg, #2c5f63, #1a3e46); color: #ecd59a; box-shadow: inset 0 0 0 2px #1a3e46, inset 0 0 0 3px #d9bf7f99; }
.reveal-seal.neutral { background: linear-gradient(160deg, #3a3f3a, #1d2421); }
.cer-line.fallen .seal, .final-cols li.fallen .seal { background: #8a8f86; color: #f1efe6; }
.logoseal { background: linear-gradient(160deg, #2c5f63, #1a3e46); color: #ecd59a; box-shadow: inset 0 0 0 2px #ecd59a, 0 0 0 1px #1a3e46; }

/* 按钮 */
button.primary { background: linear-gradient(180deg, #2f7280, #1f566b); border-color: #143c4b; color: #f6efd8; box-shadow: inset 0 0 0 1px #d9bf7f66; }
button.primary:hover:not(:disabled) { background: linear-gradient(180deg, #2a6878, #194a5d); }
.tutbtn { background: #eef1e4; border-color: var(--jade); }

/* 面板、操作栏 */
.centerlog { border-left-color: var(--jade); }
.actionbar.act { border-color: var(--red); box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px #c9dcd6, 0 0 0 3px var(--red-soft); }
.game .dock { background: linear-gradient(180deg, #eeeadbf2, #e5e0cbf2); border-top-color: #7f8a6c; }
#toast { background: var(--lacquer); border-color: #8a7a45; color: #eee3c3; }

/* 地图：青绿山水 */
.map { background: radial-gradient(ellipse at 50% 40%, #eef0e0 0%, #dfe4cf 60%, #cfd6bd 100%); border-color: #6f8070; box-shadow: inset 0 0 0 4px #eef0e0, inset 0 0 0 5px #9aa98d, inset 0 0 40px rgba(40, 80, 80, .22); }
.deco .peak { opacity: .55; }
.deco .peak.far { opacity: .35; }
.deco .river { stroke: #2f6f8a; stroke-opacity: .55; }
.deco .river.wash { stroke: #7fb3bf; stroke-opacity: .28; }
.deco .hill { stroke: #2f5d5a; stroke-opacity: .35; }
.edge { stroke: #556a62; }
.edge.war { stroke: #9a5a3c; }
.mnation, .nation { background: linear-gradient(180deg, #f9f7ec, #ecebd8); border-color: #8f9c84; box-shadow: 0 2px 6px rgba(30, 50, 50, .18), inset 0 0 0 2px #f9f7ec, inset 0 0 0 3px #d5dcc6; }
.mnation.atwar { border-color: #9a5a3c; box-shadow: 0 0 0 3px #e9d2c4, var(--shadow); }
.mnation.picked { outline-color: var(--red); }
.pip.on.mil { background: #9a5a3c; }
.pip.on.gov { background: #24577a; }
.pip.on.econ { background: #b08a3a; }

/* 手牌：竹简（偏青） */
.card { background: repeating-linear-gradient(90deg, #ede5c4 0 20px, #e2d8b0 20px 21px), #ede5c4; border-color: #8f8a5c; }
.card.war { border-color: #9a5a3c; }
.card.pair, .card.coalition { border-color: #3f7f73; }
.card .speed { background: radial-gradient(circle, #2f5450 40%, #1a3532 100%); color: #ecd59a; box-shadow: 0 0 0 1.5px #b9a05a; }
.card.reaction { background: repeating-linear-gradient(90deg, #dde7e3 0 20px, #cfdcd7 20px 21px), #dde7e3; }

/* 弹窗：卷轴（深木改为黛蓝轴） */
.modal { border-top-color: #1d3b48; border-bottom-color: #1d3b48; border-left-color: #8f9c84; border-right-color: #8f9c84; }
.dragbar { background: linear-gradient(180deg, #1a3644, var(--lacquer)); color: #ecd9a8; }
.warmodal { border-color: #2f5d74; }
.warmodal .dragbar { background: linear-gradient(180deg, #2a4f63, #173546); }
.warmodal.mine { box-shadow: 0 0 0 5px #cfe0e0, 0 16px 48px rgba(0, 0, 0, .32); }
.warturn { color: var(--red); }
.finalnotice { border-top-color: #17423c; border-bottom-color: #17423c; }
.finalnotice h2 { color: #17423c; }
.final-sub { color: var(--jade); }
.final-points b { color: var(--red); }
.finaloverlay { background: rgba(10, 30, 32, .55); }

/* 效果卡、英杰卡、史官评说 */
.fxpop { border-color: #8a7a45; }
.fxpop.war { border-color: #2f5d74; }
.fxcard { background: repeating-linear-gradient(90deg, #ede5c4 0 14px, #e2d8b0 14px 15px); border-color: #8f8a5c; }
.fxchip.down { background: #efdcd0; color: #8a4a30; }
.fxchip.up { background: #d6e8dd; color: #2a6048; }
.fxd.down { background: #9a5a3c; }
.fxd.up { background: #2f7a5a; }
.mstat.hl.down { background: #f0ddd2; }
.mstat.hl.up { background: #d6eadf; }
.reveal-card { background: linear-gradient(160deg, #fbf8ee 0%, #ece9d6 100%); }
.reveal-score { color: var(--red); }
.cer-modal h3 { color: var(--jade); }
.cer-title b { color: var(--red); }
.champ .cer-pos { background: var(--jade); }
.cer-hero.lost { color: #6a6a5e; }
.warnc { color: #8a4a30; }
.badge.dead { color: #8a4a30; }
.die.hit { background: #1f566b; border-color: #143c4b; }

/* 战争弹窗：发动者 */
.warby { text-align: center; font: 600 16px var(--serif); margin: 2px 0 4px; }
.warby b { color: var(--red); }

/* 周天子棋子 */
.mnation.zhouguard { box-shadow: 0 0 0 3px #e7c76f, 0 0 16px 4px rgba(231, 199, 111, .55), var(--shadow); }
.zhoupiece { position: absolute; top: -26px; right: -14px; width: 40px; height: 48px; z-index: 4; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .35)); pointer-events: auto; }
.zhoupiece svg { width: 100%; height: 100%; display: block; }
.zhoupiece.drop { animation: zhou-drop .7s cubic-bezier(.3, 1.4, .5, 1); }
.zhoutip { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); white-space: nowrap; font: 700 11px var(--serif); color: #5a4313; background: #f6e3a3; border: 1px solid #b08a3a; border-radius: 4px; padding: 0 4px; margin-top: -4px; }
@keyframes zhou-drop { 0% { transform: translateY(-60px) scale(1.3); opacity: 0; } 70% { transform: translateY(4px) scale(.95); opacity: 1; } 100% { transform: none; } }
.zhoupiece { width: 50px; height: 60px; top: -34px; right: -18px; }

/* ── 大屏适配：地图在 JS 里按剩余空间放大；其余界面（顶栏、英杰、侧栏、战报、手牌、弹窗）整体按屏幕放大 ── */
:root { --ui-zoom: 1; }
@media (min-width: 1680px) and (min-height: 900px) { :root { --ui-zoom: 1.12; } }
@media (min-width: 2000px) and (min-height: 1100px) { :root { --ui-zoom: 1.25; } }
@media (min-width: 2400px) and (min-height: 1300px) { :root { --ui-zoom: 1.4; } }
@media (min-width: 3000px) and (min-height: 1600px) { :root { --ui-zoom: 1.7; } }
@media (min-width: 3600px) and (min-height: 2000px) { :root { --ui-zoom: 2; } }
.stage { max-width: none; grid-template-columns: minmax(0, 1fr) calc(300px * var(--ui-zoom)); }
.game .top, .stage .side, .herocol, .centerlog, .game .dock > *, .overlay > .modal, .reveal-overlay > *, .fxpop, #toast { zoom: var(--ui-zoom); }
.herocol { flex-basis: 230px; }
@media (min-width: 1680px) { .centerlog .log { height: calc(72px + 4vh); } }

/* ── 终局准备：挑新牌 + 押注 ── */
.prepmodal { max-width: 780px; }
.prepmodal h3 { margin: 12px 0 6px; font-size: 15px; }
.card.keeping { outline: 3px solid var(--green); background: #eef5ec; }
.card.keeping .swaptag { background: var(--green); }
.betrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.betlbl { font-family: var(--serif); font-weight: 700; width: 3em; }
.betrow .chip { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2; padding: 4px 10px; }
.betrow .chip small { font-size: 10.5px; color: var(--muted); }
.betrow .chip.on small { color: inherit; opacity: .85; }
.cer-hero.bet { border-style: dashed; }

/* ── 竖屏 / 接近正方形的窗口（比如大屏的半边）：战报在上，地图占满宽度，英杰和侧栏并排放在地图下面 ── */
@media (min-width: 901px) and (max-aspect-ratio: 5/4) {
  :root { --ui-zoom: 1; }
  .stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 2.2fr) minmax(160px, 1fr);
    grid-template-areas: "log log" "map map" "hero side"; gap: 10px; }
  .stage .main, .mainrow { display: contents; }
  .centerlog { grid-area: log; }
  .mainrow .mapslot { grid-area: map; min-height: 0; }
  .herocol { grid-area: hero; min-height: 0; }
  .stage .side { grid-area: side; }
}
@media (min-width: 1500px) and (max-aspect-ratio: 5/4) { :root { --ui-zoom: 1.25; } }
@media (min-width: 1850px) and (max-aspect-ratio: 5/4) { :root { --ui-zoom: 1.45; } }

/* ── v2：奇策、补牌 ── */
.card.qice { background: linear-gradient(180deg, #f3ecf7, #e9def0); border-color: #7a5a8c; }
.card.qice .speed { background: #6b4a7d; }
.qsep { align-self: center; writing-mode: vertical-rl; font-family: var(--serif); font-size: 12px; color: #6b4a7d; padding: 0 2px; border-left: 2px dotted #b9a3c6; margin: 0 2px; }
.planitem.qplan { border-color: #7a5a8c; }
.fxpop.qice { border-color: #6b4a7d; }
.drawmodal { max-width: 820px; }
.drawmodal h3 { margin: 12px 0 6px; font-size: 15px; }
.drawbtns { margin-top: 8px; align-items: center; flex-wrap: wrap; gap: 8px; }

/* 已完成的英杰：深青绿底、金边、浅色字，和未完成的米色牌一眼区分 */
.hero.revealed, .hmini.revealed { background: linear-gradient(180deg, #2f6f5e, #22574a); border: 2px solid #d9b45a; color: #f4ecd6; box-shadow: 0 0 0 1px #8a6d2c inset; }
.hmini.revealed .hname, .hmini.revealed .cond, .hero.revealed .name, .hero.revealed .cond { color: #f4ecd6; }
.hmini.revealed .score, .hero.revealed .score { color: #ffd979; }
.hmini.revealed .ok, .hero.revealed .state span { color: #ffd979 !important; font-weight: 700; }
.hmini.revealed .seal, .hero.revealed .seal { background: #d9b45a; color: #22574a; }
.hmini.revealed .muted, .hero.revealed .muted { color: #cfe0d6; }
.hmini.failed, .hero.failed { opacity: .45; filter: grayscale(.8); }
