#portfolioPanel[hidden] { display: none; }
#portfolioPanel { align-self: start; max-height: 100%; overflow-y: auto; padding: 5px 7px; font-size: 12px; }
.pf-heading { display: flex; align-items: center; gap: 4px; margin-bottom: 5px; color: #ffd35c; }
.pf-heading small { display: none; }
.pf-heading { cursor: pointer; min-height: 24px; list-style: none; }
.pf-heading::-webkit-details-marker { display: none; }
.pf-heading::before { content: "+"; width: 1em; flex: none; text-align: center; }
details[open] > .pf-heading::before { content: "-"; }
.pf-heading:focus-visible { outline: 2px solid #ffd35c; outline-offset: 2px; }
#portfolioPanel details:not([open]) .pf-heading { margin-bottom: 0; }
.pf-colors { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.pf-color { min-width: 0; border-top: 2px solid var(--tc); }
.pf-color-title { display: flex; align-items: center; justify-content: space-between; gap: 4px; white-space: nowrap; }
.pf-color-title small { font-size: .85em; }
.pf-color ol { display: grid; grid-template-columns: repeat(var(--players), minmax(0, 1fr)); gap: 3px; list-style: none; padding: 2px 0 0; margin: 0; }
.pf-color li { min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.pf-player { position: relative; display: block; }
#portfolioPanel .avatar { display: block; width: clamp(30px, 2.4vw, 40px); height: auto; }
.pf-name { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 11px; }
.pf-count { position: absolute; right: -2px; bottom: 0; min-width: 16px; padding: 0 2px; border-radius: 6px; background: #1a110b; color: #fff1c4; text-align: center; box-shadow: 0 0 0 1px #b98b34; }
.pf-award { height: 15px; color: #ffd35c; font-size: 11px; font-weight: bold; white-space: nowrap; text-align: center; }
#app { --pf-w: clamp(160px, 12vw, 210px); }
#app.has-portfolio #mainRow { grid-template-columns: var(--pop-w) var(--pf-w) minmax(0, 1fr); }
#app.has-portfolio:has(#portfolioPanel details:not([open])) { --pf-w: 40px; }
#portfolioPanel:has(details:not([open])) .pf-heading { writing-mode: vertical-rl; padding: 4px 0; }

/* M5：对齐效果图的布局层（在 style.css 之后加载，覆盖其布局规则；规则引擎/AI 不受影响）。
   设计目标：根节点 position:fixed; inset:0 —— 页面永远恰好等于可视视口，不产生横向/纵向滚动；
   所有尺寸由视口高度推导（--cell-w / --card-h 等），高度不足时整体按比例缩小而不是裁切。 */
:root {
  --top-h: clamp(64px, 9.5vh, 112px);
  --bot-h: clamp(230px, 38vh, 660px);
  --th: clamp(30px, 3.4vh, 42px);
  --pp: calc(var(--bot-h) * .06);
  --cap-h: clamp(22px, 2.6vh, 30px);
  --pm-w: clamp(300px, 28vw, 860px);
  --act-w: clamp(190px, 13.5vw, 300px);
  --pop-w: clamp(118px, 10vw, 210px);
  --log-w: clamp(170px, 14vw, 280px);
  --main-h: calc(100vh - var(--top-h) - var(--bot-h) - 64px);
  --cell-w: clamp(44px, calc((var(--main-h) - 110px) / 3.8), 172px);
  --pb: clamp(12px, 2vh, 22px);
  --hgap: clamp(4px, .5vw, 10px);
  --pm-h: min(calc(var(--card-h) * .86), calc((var(--pm-w) - 2 * var(--pb) - 52px) / 4 / .714));
  --card-h: min(calc(var(--bot-h) - 8px - 2 * var(--pb) - var(--th) - 2 * var(--pp) - var(--cap-h)), calc((100vw - var(--act-w) - 4 * var(--pb) - 4 * var(--hgap) - 110px) / 8 / .7146));
  --card-w: calc(var(--card-h) * .7146);
  --fs: clamp(11px, 1.5vh, 17px);
  --parch-ink: #3a2610;
}
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
#app {
  position: fixed; inset: 0; height: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px; overflow: hidden;
}
#app > * { min-width: 0; }
#handArea, #publicMarket, #actionPanel, #popPanel, #market, #logPanel, #scorePanel, #banner { grid-area: auto; }

/* ---- 顶栏：Logo / 玩家牌 / 牌库+Market / 按钮 ---- */
#top { flex: 0 0 var(--top-h); height: var(--top-h); display: flex; align-items: stretch; gap: 10px; min-height: 0; }
#logo { flex: 0 0 auto; width: clamp(100px, 10vw, 210px); display: flex; align-items: center; }
.logo-img { width: 100%; height: 100%; max-height: var(--top-h); }
#scorePanel { flex: 1 1 0; min-width: 0; display: flex; gap: 8px; align-items: stretch; }
#deckInfo { flex: 0 0 auto; display: flex; align-items: center; gap: clamp(8px, 1.2vw, 20px); padding: 0 clamp(8px, 1vw, 18px); white-space: nowrap; }
#deckInfo .dk { display: flex; align-items: center; gap: 6px; }
#deckInfo .dk b { font-size: calc(var(--top-h) * .36); line-height: 1; }
#deckInfo, #deckInfo .dk, #deckInfo .dk b, #deckInfo .dk span { color: var(--parch-ink); }
#deckInfo .dk b { font-weight: 800; }
#deckInfo .dk small { opacity: .7; }
#deckInfo .ico-deck { width: calc(var(--top-h) * .42); height: calc(var(--top-h) * .42); margin: 0; }
#btnNew { align-self: center; flex: 0 0 auto; white-space: nowrap; }

#scorePanel .score-row {
  flex: 1 1 0; min-width: 0; margin: 0; height: 100%; display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 4px;
  border-radius: calc(var(--top-h) * .3); background: linear-gradient(#3b2919ee, #170f0bee); border: 2px solid #8a6a2f; color: #f5ead0; position: relative; overflow: hidden;
}
#scorePanel .score-row.cur { border-color: #7fd0ff; box-shadow: 0 0 0 2px #7fd0ff77, 0 0 18px 4px #3d9bffaa; }
#scorePanel .avatar { width: auto; height: calc(var(--top-h) - 12px); aspect-ratio: 1; flex: 0 0 auto; }
#scorePanel .pbody { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; align-content: center; align-items: center; gap: 1px 8px; }
#scorePanel .l1 { flex: 1 0 100%; display: flex; align-items: baseline; gap: 8px; min-width: 0; font-weight: 700; }
#scorePanel .l1 .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1em; }
#scorePanel .rank { color: #cfd8dc; font-size: 1em; font-weight: 800; white-space: nowrap; }
#scorePanel .rank.first { color: #ffd35c; }
#scorePanel .hc { display: inline-flex; align-items: center; font-size: .95em; color: #e8dcc0; }
#scorePanel .hc-mobile { display: none; position: absolute; left: 22px; bottom: 1px; z-index: 2; padding: 0 2px; border-radius: 8px; background: #1a110bf2; font-size: 9px; line-height: 1; }
#scorePanel .hc .ico-hand { width: 1.3em; height: 1.3em; margin-right: 2px; }
#scorePanel .hc-mobile .ico-hand { width: .9em; height: .9em; margin-right: 1px; }
#scorePanel .tot { flex: 0 0 auto; font-size: calc(var(--top-h) * .46); font-weight: 800; color: #ffd35c; line-height: 1; text-shadow: 0 2px 3px #000a; }
#scorePanel .l2 { display: none; }
#scorePanel .coll-row { position: static; display: flex; flex-wrap: nowrap; gap: 3px; margin: 0; max-width: 100%; overflow: hidden; font-size: 0; }
#scorePanel .coll-row .cthumb { font-size: .72rem; flex: none; padding: 0 3px 0 0; }
#scorePanel .coll-row .cthumb img { display: block; height: calc(var(--top-h) * .24); width: auto; aspect-ratio: 5 / 7; }

/* ---- 状态栏 ---- */
#statusRow { flex: 0 0 auto; display: flex; gap: 10px; align-items: stretch; }
#banner { flex: 1 1 0; min-width: 0; }
#turnInfo { flex: 0 1 auto; max-width: 44%; display: flex; align-items: center; padding: 0 10px; border-radius: 6px; background: #0e1816cc; border: 1px solid var(--line); color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- 中部：Popularity | Market | 日志 ---- */
#mainRow { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: var(--pop-w) minmax(0, 1fr) var(--log-w); gap: 6px; }
#mainRow > * { min-width: 0; min-height: 0; }
#botRow { flex: 0 0 var(--bot-h); height: var(--bot-h); min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--pm-w) var(--act-w); gap: 6px; }
#botRow > * { min-width: 0; min-height: 0; overflow: hidden; }

/* 深色小面板 / 米色羊皮纸面板（panel_parchment 素材到位后自动替换，见 theme.js SKIN.names） */
.panel.dark { background: linear-gradient(#2b1d13f2, #150e09f2); border: 2px solid #8a6a2f; border-radius: 10px; box-shadow: inset 0 0 0 1px #000a, inset 0 0 14px #000a, 0 3px 8px #000a; color: #f5ead0; }
.panel.parch { background: radial-gradient(ellipse at 50% 35%, #f4e6c1, #dec58c 88%); border: 3px solid #b98b34; border-radius: 10px; box-shadow: inset 0 0 0 2px #7a5420, inset 0 0 24px #8a5f1a66, 0 3px 8px #000a; color: var(--parch-ink); }
.has-panel_parchment .panel.parch { background: none; border: var(--pb) solid transparent; border-image: var(--asset-panel_parchment) 72 fill / var(--pb) / 0 stretch; border-radius: 0; box-shadow: none; }
.has-panel_parchment #deckInfo.panel.parch { border-width: calc(var(--pb) * .7); border-image: var(--asset-panel_parchment_small, var(--asset-panel_parchment)) 36 fill / calc(var(--pb) * .7) / 0 stretch; }
.has-table_bg_rich body { background: var(--asset-table_bg_rich) center / cover no-repeat #1a120c; }
.parch .panel-title { color: #5a3a10; text-shadow: none; }
.parch .panel-title small { color: #7a5a30; }
.panel.dark .panel-title { color: #ffd35c; }

#popPanel { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; overflow: hidden; }
#popPanel .panel-title { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-list { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.pop-row { flex: 1 1 0; min-height: 0; margin: 0; display: flex; align-items: center; gap: 8px; }
.pop-row .pic { align-self: stretch; max-height: 76px; aspect-ratio: 1; flex: 0 1 auto; border-radius: 50%; background: var(--tc) center / contain no-repeat; box-shadow: 0 2px 5px #000a; }
.pop-row .pl { font-weight: 700; color: #e8dcc0; }
.pop-row .pop-num { margin-left: auto; width: auto; font-size: clamp(1.4em, 4.2vh, 3em); font-weight: 800; color: #fff; text-shadow: 0 2px 3px #000; line-height: 1; }
.theme-E .pic { background-image: var(--asset-icon_cui, none); } .theme-G .pic { background-image: var(--asset-icon_shuang, none); }
.theme-R .pic { background-image: var(--asset-icon_fu, none); } .theme-T .pic { background-image: var(--asset-icon_sha, none); }
.has-icon_cui .pop-row.theme-E .pic, .has-icon_shuang .pop-row.theme-G .pic, .has-icon_fu .pop-row.theme-R .pic, .has-icon_sha .pop-row.theme-T .pic { background-color: transparent; box-shadow: none; filter: drop-shadow(0 2px 3px #000a); }
#popPanel .hint { margin: 0; font-size: .72em; opacity: .7; }
@media (max-height: 700px) { #popPanel .hint { display: none; } }

/* 主题色变量（外框 / 标签） */
.theme-E { --tc: #2f9e6e; --ti: #fff; } .theme-G { --tc: #5ab0e8; --ti: #06293f; } .theme-R { --tc: var(--theme-fu); --ti: var(--theme-fu-ink); } .theme-T { --tc: #d9ad4f; --ti: #3a2a05; }

/* ---- Market 轨道：宣传牌正面朝上悬挂在其占用的格子上方 ---- */
#market { display: flex; flex-direction: column; padding: 6px 8px; overflow: hidden; }
#market .panel-title { margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#trackScroll { flex: 1 1 0; min-height: 0; display: flex; align-items: center; overflow-x: auto; overflow-y: hidden; padding: 0 0 2px; }
#trackWrap { position: relative; width: max-content; flex: 0 0 auto; padding: 0 calc(var(--cell-w) * .5) 0 0; margin: 0; }
#track { display: flex; align-items: flex-end; }
.start { flex: 0 0 auto; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: var(--cell-w); }
.start .lab { height: auto; padding: 0 0 4px; font-weight: 700; color: #f3e2b4; text-shadow: 0 1px 3px #000; }
.start .tiles { width: 100%; }
.promo { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; position: relative; }
.promo .tiles { display: flex; }
.pc { position: relative; flex: 0 0 auto; width: calc(var(--cell-w) * 1.7); height: calc(var(--cell-w) * 2.38); border: max(2px, calc(var(--cell-w) * .035)) solid var(--tc); border-radius: 8px; overflow: hidden; background: #111; box-shadow: 0 0 0 1px #000a, 0 6px 12px #000b; }
.pc img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pcap { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 2px; text-align: center; font-weight: 800; font-size: max(9px, calc(var(--cell-w) * .13)); background: var(--tc); color: var(--ti); white-space: nowrap; overflow: hidden; }
.link { position: relative; flex: 0 0 auto; width: 100%; height: calc(var(--cell-w) * .3); }
.link::before { content: ""; position: absolute; left: calc(var(--cell-w) * .06); right: calc(var(--cell-w) * .06); top: 46%; bottom: 0; border: 3px solid var(--tc); border-bottom: 0; border-radius: 7px 7px 0 0; filter: drop-shadow(0 1px 1px #000a); }
.link::after { content: ""; position: absolute; left: 50%; top: 0; height: 46%; width: 3px; margin-left: -1.5px; background: var(--tc); }
.promo.behind .pc { filter: saturate(.55) brightness(.8); }
.promo.collectable { outline: 0; animation: none; }
.promo.collectable .pc, .promo.collectable .tiles { outline: 3px solid var(--accent); outline-offset: 1px; animation: pulse 1s infinite alternate; }
.promo.hl { outline: 0; animation: none; }
.promo.hl .pc { outline: 3px solid #fff; outline-offset: 1px; animation: pulse .6s infinite alternate; }
.promo.ghost { opacity: .92; margin-left: calc(var(--cov, 0) * var(--cell-w) * -1); }
.promo.ghost .pc { border-style: dashed; }
.promo.ghost.bad .pc { border-color: #ff6b5e; }
.promo.ghost.draggable .pc, .promo.ghost.draggable .tiles { cursor: grab; }
.tile { width: var(--cell-w); height: var(--cell-w); }

/* ---- 手牌 / Public Market（羊皮纸） ---- */
#handArea { padding: 6px 12px; display: flex; flex-direction: column; }
#handWrap { flex: 1 1 auto; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
#handWrap .panel-title { margin: 0 0 2px; flex: 0 0 auto; }
#hand { flex: 1 1 auto; min-height: 0; gap: clamp(6px, 1vw, 16px); justify-content: center; align-items: center; padding: 14px 6px 6px; overflow-x: auto; overflow-y: visible; }
.hcard { width: var(--card-w); border: max(3px, calc(var(--card-w) * .02)) solid var(--tc); border-radius: 9px; }
.hcard img { height: var(--card-h); }
.hcard .cap, .pm-card .cap { background: var(--tc); color: var(--ti); }
.hcard .cap { font-size: max(11px, calc(var(--card-w) * .095)); }
.pm-card { border: 3px solid var(--tc); }
.empty-slot { border-color: #8a6a2f; color: #7a5a30; }
.deck .cap { color: var(--parch-ink); }

#publicMarket { padding: 6px 10px; display: flex; flex-direction: column; }
#publicMarket .panel-title { margin: 0 0 4px; flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#publicMarket .pm-row { flex: 1 1 auto; min-height: 0; align-content: center; align-items: start; max-width: none; margin: 0; gap: clamp(4px, .5vw, 10px); }
#publicMarket .pm-card img { height: auto; }

/* ---- Choose an Action ---- */
#actionPanel { display: flex; flex-direction: column; padding: 8px 10px; overflow: hidden; }
#actionPanel .panel-title { margin: 0 0 4px; flex: 0 0 auto; text-align: center; letter-spacing: .04em; }
#actions { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 5px; overflow: hidden; }
.btn.act { flex-direction: column; justify-content: center; align-items: center; gap: 1px; padding: 0 3% 0 30%; text-align: center; }
.btn.act .tt { font-size: 11cqw; font-weight: 800; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.btn.act .sub { font-size: 9.6cqw; font-weight: 400; color: #f4e6c4; opacity: .95; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000c; }
.btn.act:disabled .sub { color: #a9a9a9; }
@container (max-width: 100px) { .btn.act .sub { display: none; } .btn.act .tt { font-size: 14cqw; } }
#actions .btn-row.acts { flex: 0 0 auto; }
#preview { flex: 1 1 auto; min-height: 0; overflow: hidden; }

/* ---- 小屏收紧 ---- */
@media (max-height: 700px) {
  #app { gap: 4px; padding: 4px; }
  :root { --bot-h: clamp(190px, 34vh, 520px); --ui-scale: .72; }
  #scorePanel .score-row { padding: 2px 6px 2px 3px; }
  #scorePanel .coll-row .cthumb img { display: none; }
  .hcard .cap, .pm-card .cap { font-size: .62em !important; }
}
@media (max-width: 1100px) {
  :root { --pm-w: clamp(300px, 35vw, 520px); --act-w: clamp(220px, 23vw, 380px); --log-w: 150px; --pop-w: 112px; }
  #deckInfo .dk small { display: none; }
  #popPanel .panel-title { font-size: .82em; }
  #scorePanel .rank { display: none; }
}

/* 修复：棋子层级必须高于所有 Promotion（.promo 的 z-index 随张数递增，会盖住后段格子的棋子） */
#pawns { z-index: 1000; }
#pawns.snap .pawn { transition: none !important; }  /* 视口 / 日志宽度变化重算格宽时棋子直接落位（app.js refitTrack） */
/* ---- M6 ---- */
#trackScroll { justify-content: safe center; }
#trackWrap { margin: 0 auto; }
#publicMarket .pm-row { justify-content: center; align-items: center; }
#publicMarket .pm-card .cap { font-size: max(10px, calc(var(--card-w) * .09)); padding: 1px 0; }
@media (max-width: 1100px) {
  #scorePanel .avatar { transform: scale(.82); transform-origin: left center; margin-right: -10px; }
  #scorePanel .l1 .nm { font-size: .88em; }
  :root { --log-w: 128px; }
  #logPanel { font-size: .85em; }
}
#trackScroll > #trackWrap { margin: 0 auto; }

/* ===== M6b：贴合内容的小框，露出桌面背景 ===== */
/* 1) Market：不要大面板，轨道直接放桌面上 */
.has-panel_large #market.panel.large, #market.panel.large { background: none; border: 0; border-image: none; padding: 0; box-shadow: none; }
#market .panel-title { position: absolute; left: 10px; top: 4px; margin: 0; font-size: .8em; opacity: .8; text-shadow: 0 1px 3px #000; }
#market .panel-title small { display: none; }
#market { position: relative; }
#trackScroll { align-items: center; }
/* 2) 顶栏：紧凑名牌 */
#top { justify-content: flex-start; }
#scorePanel { flex: 0 1 auto; gap: 10px; }
#scorePanel .score-row { flex: 0 1 auto; width: clamp(170px, 15.5vw, 330px); }
#deckInfo { margin-left: auto; }
#popPanel { align-self: flex-start; height: auto; padding: 6px 8px; }
.pop-list { flex: none; }
.pop-row { flex: none; height: clamp(40px, 7.4vh, 84px); }
.pop-row .pic { height: 100%; align-self: auto; }
#popPanel .hint { display: none; }
/* 3) 日志：右侧悬浮抽屉，默认只显示最近 2 条 */
#mainRow { grid-template-columns: var(--pop-w) minmax(0, 1fr); position: relative; }
#logPanel { position: absolute; right: 0; top: 0; width: var(--log-w); height: auto; z-index: 20; background: #1a110bd9; border: 2px solid #8a6a2f; border-image: none; border-radius: 8px; padding: 6px 8px; box-shadow: 0 4px 12px #000a; cursor: default; }
.has-panel_small #logPanel.panel.small { background: #1a110bd9; border: 2px solid #8a6a2f; border-image: none; }
#logPanel .panel-title { cursor: pointer; margin: 0 0 3px; font-size: .85em; }
#logPanel .log-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#logPanel .log-title-text { flex: 1 1 auto; min-width: 0; }
#logPanel .log-toggle { display: inline-grid; flex: none; place-items: center; width: 24px; height: 24px; padding: 2px; border: 1px solid #8a6a2f; border-radius: 5px; background: #1d140c; color: #e6d3a3; cursor: pointer; }
#logPanel .log-toggle:hover { background: #463018; color: #ffe8ad; }
#logPanel .log-toggle:focus-visible { outline: 2px solid #ffe193; outline-offset: 2px; }
#logPanel .log-toggle svg { width: 16px; height: 16px; }
#logPanel .log-toggle .log-icon-collapse, #logPanel.open .log-toggle .log-icon-expand { display: none; }
#logPanel.open .log-toggle .log-icon-collapse { display: block; }
#logPanel #log { position: static; max-height: 3.6em; overflow: hidden; font-size: .8em; }
#logPanel.open #log { max-height: min(46vh, 420px); overflow-y: auto; }
#logPanel.open { width: calc(var(--log-w) * 1.5); }
/* 4) 底部：框贴合内容 */
#botRow { display: flex; align-items: flex-end; justify-content: flex-start; gap: 14px; height: var(--bot-h); }
#botRow > * { flex: 0 0 auto; overflow: visible; }
#handArea { max-width: 58%; }
#hand { flex: 0 0 auto; }
#handWrap { flex: 0 0 auto; }
#publicMarket { margin-left: auto; width: auto; max-width: 42%; }
#publicMarket .pm-row { flex: 0 0 auto; }
#actionPanel { width: var(--act-w); height: auto; max-height: 100%; }
/* 5) 棋子：直立、脚下接触阴影 + 外层柔影、待机浮动、当前玩家光环 */
.pawn { overflow: visible; }
.pawn::before { content: ""; position: absolute; left: 4%; right: -6%; bottom: -6%; height: 16%; border-radius: 50%; background: radial-gradient(ellipse at 45% 50%, #000d 0, #0008 45%, #0000 72%); transform: translate(6%, 22%); z-index: -1; pointer-events: none; transition: transform .3s, opacity .3s; }
.pawn::after { content: ""; position: absolute; left: -12%; right: -12%; bottom: -10%; height: 22%; border-radius: 50%; background: radial-gradient(ellipse, #0000 40%, #0003 70%, #0000 80%); filter: blur(3px); z-index: -2; pointer-events: none; }
.pawn.moving::before { transform: translate(6%, 60%) scale(.7); opacity: .5; }
/* 这里原来有个 bob 常驻上下浮动（PR-B 4b90eb2），已删除：
   棋子是实体桌游棋子，不该飘；而且影子是 .pawn 的伪元素、会跟着一起升，
   等于把接触关系拆掉——影子跟着物体走，正是「贴图」最明显的特征。
   需要动的两处都已经有了：当前行动者本身的高光（.pawn.cur），
   以及真正移动时的抬起 + 影子缩淡（.pawn.moving / .moving::before / .moving::after）。 */
/* 6) 格子加厚度、轨道投影；悬挂牌投影 */
#track .tile { box-shadow: inset 0 2px 0 #fff5, inset 2px 0 0 #fff2, inset 0 -3px 0 #0006, 0 calc(var(--cell-w) * .08) 0 #1b0f08, 0 calc(var(--cell-w) * .11) 0 #0008, 1px 0 0 #0006; margin-right: 1px; }
#track .promo .tiles { filter: drop-shadow(0 calc(var(--cell-w) * .14) calc(var(--cell-w) * .08) #000b); }
.pc { box-shadow: 0 0 0 1px #000a, 0 calc(var(--cell-w) * .1) calc(var(--cell-w) * .12) #000c, 0 calc(var(--cell-w) * .02) 0 #0008; }
/* 手牌/Public Market：悬停阴影随抬起变大变淡 */
.hcard, .pm-card { will-change: transform; }
/* 降动效守卫不用在这里重复：style.css 那条已经覆盖 .pawn 的 animation 和 transition */

/* M6c：牌库牌背与 Public Market/手牌同规格（636:890），无灰盒占位底 */
.pm-card img, .hcard img, .deck .back { aspect-ratio: 636 / 890; }
.btn.act .tt, .btn.act .sub { min-width: 0; }
@container (max-width: 190px) { .btn.act .sub { font-size: 8.4cqw; } .btn.act .tt { font-size: 10cqw; } }
.hcard img { height: auto; aspect-ratio: 636 / 890; }

/* M6d：Choose an Action 重排——左右等距、2×2 等宽等高、文字落在图标与右侧装饰点之间 */
#actionPanel { padding: 8px 12px 10px; box-sizing: border-box; }
#actionPanel #actions { gap: 6px; width: 100%; }
#actionPanel .panel-title { margin: 0 0 6px; }
#actionPanel .btn-row.acts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%; margin: 0 auto; justify-items: stretch; }
#actionPanel .btn.act { width: 100%; min-width: 0; box-sizing: border-box; padding: 0 9% 0 28%; overflow: hidden; }
#actionPanel .btn-row:not(.acts):empty { display: none; }
#actionPanel .reasons { margin: 0; padding: 0 2px; }
#actionPanel #preview { margin: 0; min-height: 0; padding: 4px 8px; line-height: 1.3; }
#actionPanel #preview:empty { display: none; }
/* M6e：Public Market 牌宽与手牌同规格（共用 --card-w），牌库同列宽 */
#publicMarket .pm-row { grid-template-columns: repeat(4, calc(var(--card-w) * 1.04)); max-width: none; }
#publicMarket .pm-card { width: 100%; }

/* M6f：棋子缩小偏下、日志折叠显示 2 条完整文字、Market 标题居中 */
#market .panel-title { left: 50%; transform: translateX(-50%); top: 3px; font-size: .95em; opacity: 1; color: #f3dfae; white-space: nowrap; }
#market .panel-title small { display: inline; font-weight: 400; opacity: .85; }
#logPanel #log { max-height: none; overflow: visible; }
#logPanel:not(.open) #log > div:nth-child(n+3) { display: none; }
#logPanel:not(.open) #log > div + div { margin-top: 3px; }
#logPanel.open #log { max-height: min(60vh, 560px); overflow-y: auto; }
#logPanel.open { width: calc(var(--log-w) * 2); }

/* PR-D：得分飘字（scale .6→1.5，上浮，淡出，约 1.5s） */
#floatLayer { position: fixed; inset: 0; pointer-events: none; z-index: 5000; }
.float-score { position: fixed; transform: translate(-50%, 0) scale(.6); font: 800 clamp(16px, 1.8vw, 30px)/1 system-ui, sans-serif; color: var(--c, #ffd35c); -webkit-text-stroke: 2px #000c; paint-order: stroke fill; text-shadow: 0 0 10px #000, 0 3px 6px #000c; white-space: nowrap; opacity: 0; animation: floatUp var(--dur, 2200ms) ease-out forwards; }
.float-score.neg { color: #d9c9c0; font-size: clamp(13px, 1.45vw, 24px); }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  65% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, var(--dy, -90px)) scale(1.1); }
}

/* PR-C 返工：独立圆角木块（3–4px 间隙 + 厚度 + 斜面高光 + 落影）、木质轨道槽、起点/终点牌、悬挂牌与格宽成比例
   几何不变：每格仍占 --cell-w，棋子/覆盖落点按 pos*cell-w 定位；块的间隙与厚度由 ::before/::after 绘制，不改布局。
   轨道不做 rotateX（保护拖拽命中与悬挂牌连线对齐）。 */
#trackWrap { width: 100%; min-width: max-content; padding: 0 calc(var(--cell-w) * .15); box-sizing: border-box; }
#track { position: relative; z-index: 0; isolation: isolate; align-items: flex-end; }
#track::before { content: ""; position: absolute; z-index: -1; left: calc(var(--cell-w) * -.1); right: calc(var(--cell-w) * -.1); bottom: calc(var(--cell-w) * -.2); height: calc(var(--cell-w) * 1.34); border-radius: calc(var(--cell-w) * .16); background: linear-gradient(#1a0f08, #2e1b0d 60%, #3a2412); box-shadow: inset 0 6px 14px #000d, inset 0 -2px 0 #ffffff14, 0 0 0 2px #0009, 0 calc(var(--cell-w) * .3) calc(var(--cell-w) * .5) calc(var(--cell-w) * -.05) #000c, 0 calc(var(--cell-w) * .6) calc(var(--cell-w) * 1.2) calc(var(--cell-w) * -.2) #0009; }
#track .tile, #track .endcap { background: none !important; border: 0 !important; box-shadow: none !important; margin: 0 !important; filter: none; position: relative; width: var(--cell-w); height: var(--cell-w); flex: 0 0 auto; overflow: visible; }
.theme-E .tile { --face: var(--asset-tile_cui, none); --fc: var(--theme-cui); }
.theme-G .tile { --face: var(--asset-tile_shuang, none); --fc: var(--theme-shuang); }
.theme-R .tile { --face: var(--asset-tile_fu, none); --fc: var(--theme-fu); }
.theme-T .tile { --face: var(--asset-tile_sha, none); --fc: var(--theme-sha); }
.start .tile, .endcap { --face: none; --fc: #3b2a1c; }
#track .tile::before, #track .endcap::before { content: ""; position: absolute; z-index: 0; left: calc(var(--cell-w) * .02); right: calc(var(--cell-w) * .02); top: calc(var(--cell-w) * .1); bottom: 0; border-radius: calc(var(--cell-w) * .08); background: linear-gradient(#4a2e17, #1d1008); box-shadow: 0 calc(var(--cell-w) * .05) calc(var(--cell-w) * .07) #000c, inset 1px 0 0 #ffffff22; }
#track .tile::after, #track .endcap::after { content: ""; position: absolute; z-index: 0; left: calc(var(--cell-w) * .02); right: calc(var(--cell-w) * .02); top: 0; bottom: calc(var(--cell-w) * .12); border-radius: calc(var(--cell-w) * .08); background: var(--face) center / 100% 100% no-repeat, var(--fc); box-shadow: inset 2px 2px 0 #fff7, inset -2px -3px 0 #0007, inset 0 0 0 1px #000a; }
#track .tile .num, #track .tile .lbl { z-index: 2; }
#track .promo .tiles { filter: none; }
.start .tile::after { background: repeating-linear-gradient(45deg, #2a3f39, #2a3f39 5px, #22352f 5px, #22352f 10px); }
#track .endcap { margin-left: auto !important; display: flex; align-items: center; justify-content: center; color: #f3dfae; font-weight: 800; }
#track .endcap span { position: relative; z-index: 2; font-size: calc(var(--cell-w) * .42); line-height: 1; margin-top: calc(var(--cell-w) * -.14); text-shadow: 0 2px 3px #000; }
#track .endcap em { position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(var(--cell-w) * .2); text-align: center; font-style: normal; font-size: max(9px, calc(var(--cell-w) * .14)); }
.promo { width: calc(var(--n, 1) * var(--cell-w)); }
.pc { width: min(calc(var(--cell-w) * 2), max(calc(var(--pcn, var(--n, 1)) * var(--cell-w) * .94), var(--cell-w))); height: auto; aspect-ratio: 636 / 890; box-shadow: 0 0 0 1px #000a, 0 calc(var(--cell-w) * .12) calc(var(--cell-w) * .14) #000d, 0 calc(var(--cell-w) * .3) calc(var(--cell-w) * .3) calc(var(--cell-w) * -.1) #0008; }
.link { width: calc(var(--span, var(--n, 1)) * var(--cell-w) - var(--cell-w) * .04); align-self: flex-start; margin-left: calc(var(--cell-w) * .02); }
.link::before { left: 0; right: 0; }
.link::after { left: calc(var(--n, 1) * var(--cell-w) / 2 - var(--cell-w) * .02); margin-left: -1.5px; }
.promo .pc.ph, .promo .link.ph { visibility: hidden; }
.promo.cont .link.ph { width: 1px; }
#track .promo.pcpre > .pc, #track .promo.pcpre > .link { visibility: hidden; }
.gsp { flex: 0 0 auto; height: 1px; }
#track .tile.ut-E { --face: var(--asset-tile_cui, none); --fc: var(--theme-cui); }
#track .tile.ut-G { --face: var(--asset-tile_shuang, none); --fc: var(--theme-shuang); }
#track .tile.ut-R { --face: var(--asset-tile_fu, none); --fc: var(--theme-fu); }
#track .tile.ut-T { --face: var(--asset-tile_sha, none); --fc: var(--theme-sha); }
#dragPv.emb .tiles { opacity: .78; }

/* PR-F：棋子 2.5D——脚底锚点、直立不旋转、同一组件套用四色；当前行动者脚下细金环 */
/* --disc 用百分比而不是 JS 写死的 px：精灵盒是正方形，所以宽高百分比同值。
   这样格子里人数变化时，棋子和它的两层影子会跟着 width/height 一起过渡，
   不会「啪」地换个大小（px 自定义属性没法过渡，除非注册 @property）。 */
.pawn { --disc: calc(100% * var(--pawn-disc-frac, .52)); transform: translate(-50%, -100%); transform-origin: 50% 100%;
  /* 一步的位移要在下一步开始前走完，中间留一点停顿，才像一格一格踩过去；
     走满整个 --pawn-t 会连成一条滑行。宽高同步过渡，同格人数变化时平滑缩放。 */
  transition: left calc(var(--pawn-t, 300ms) * .62) ease-in-out, top calc(var(--pawn-t, 300ms) * .62) ease-in-out,
              width calc(var(--pawn-t, 300ms) * .8) ease-out, height calc(var(--pawn-t, 300ms) * .8) ease-out; }
.has-pawn_red .pawn { background-size: contain; background-position: center bottom; filter: drop-shadow(1px 3px 2px rgba(0,0,0,.35)); }
/* 每走一格抬一下脚再落下，而不是整段路程一直悬着（原来 .moving 持续 650ms，
   走 6 格就是一路飘过去再落地）。动画每一步由 app.js 强制重启。 */
/* transform 必须重申一遍：style.css 有一条 .pawn.moving{transform:translateY(-10px) scale(1.25)}
   （灰盒时代的"抬起放大"），它会整条替换掉 .pawn 的 translate(-50%,-100%)。
   脚底锚点一丢，棋子走起来就从格子里掉出去、还放大一圈。跳跃交给 animation，不要动 transform。 */
.pawn.moving { transform: translate(-50%, -100%); animation: pawnStep var(--pawn-t, 300ms) ease-in-out; }
@keyframes pawnStep { 0%, 100% { translate: 0 0; } 48% { translate: 0 calc(var(--cell-w) * -.055); } }
@keyframes pawnStepShadow { 0%, 100% { opacity: 1; } 48% { opacity: .5; } }
/* 两层落影。宽度锚在底座宽（--disc，由 app.js 按格宽写入 px），不是精灵宽——
   精灵四周有道具留白，拿精灵宽算影子会偏大一圈，棋子就浮起来了。
   ::after 接触影：紧、深、略偏右下（光来自左上）；::before 扩散影：宽、软、再往右下铺一点。
   两者都必须**比底座宽**并且压在接触线上（translate 的 Y 为正，往下挪半个身位），
   否则整个被底座盖住，只剩一两像素露在外面 —— 看上去就是棋子浮在格子上没落实。 */
.pawn::after { content: ""; display: block; position: absolute; left: 50%; bottom: 0; right: auto; width: calc(var(--disc, 62%) * 1.36); height: calc(var(--disc, 62%) * .40); border-radius: 50%; transform: translate(-50%, 30%); background: radial-gradient(50% 50% at 50% 46%, rgba(0,0,0,.80) 0, rgba(0,0,0,.66) 42%, rgba(0,0,0,.28) 70%, rgba(0,0,0,0) 100%); filter: blur(1.5px); z-index: -1; pointer-events: none; }
.pawn::before { left: 50%; right: auto; width: calc(var(--disc, 62%) * 1.90); height: calc(var(--disc, 62%) * .60); bottom: 0; transform: translate(-48%, 44%); background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.34) 0, rgba(0,0,0,.16) 52%, rgba(0,0,0,0) 76%); filter: blur(6px); z-index: -2; }
.pawn.moving::before { animation: pawnStepShadow var(--pawn-t, 300ms) ease-in-out; }
.pawn.moving::after { animation: pawnStepShadow var(--pawn-t, 300ms) ease-in-out; }
/* 当前行动者：金环叠在接触影上，影子本身保留 */
/* 当前行动者脚下不再画金环：它和接触影叠在一起，读成「棋子站在一个带金边的黑洞里」。
   回合指示交给棋子本身的 accent 高光（style.css 的 .has-pawn_red .pawn.cur）和记分面板高亮行。
   .cur 的两层影和其他棋子完全一致，不做任何特殊化。 */
.pawn.cur { filter: drop-shadow(1px 3px 2px rgba(0,0,0,.35)); }
/* ghost 不要实体棋子的两层落影（它并没有真的站在那里），
   但要一个落点环，告诉你「这张牌会把你送到这一格」。 */
.pawn.ghost::before { display: none; }
.pawn.ghost::after { display: block; opacity: .95; filter: none; width: calc(var(--disc) * 1.3); height: calc(var(--disc) * .4);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,0) 52%, var(--c, #f2c94c) 60%, var(--c, #f2c94c) 74%, rgba(0,0,0,0) 82%); }
@media (prefers-reduced-motion: reduce) { .pawn { transition: none; } }

/* PR-I：版面收紧——底部三块向中间靠拢并放大，轨道格宽上限放宽 */
#botRow { justify-content: center; gap: clamp(10px, 1.2vw, 28px); align-items: flex-end; }
#publicMarket { margin-left: 0; max-width: none; }
#handArea { max-width: none; }

/* ---- PR-K：3D 立体轨道素材（tile3d_* / track_start / track_end / track_base）----
   格图已按统一包围盒裁切（宽高比 1.15）：顶面在上、前厚面在下；棋子脚底锚点 = 顶面中心略偏下（见 app.js renderPawns） */
.theme-E .tile { --face: var(--asset-tile3d_cui, none); }
.theme-G .tile { --face: var(--asset-tile3d_shuang, none); }
.theme-R .tile { --face: var(--asset-tile3d_fu, none); }
.theme-T .tile { --face: var(--asset-tile3d_sha, none); }
.start .tile { --face: var(--asset-track_start, none); }
#track .endcap { --face: var(--asset-track_end, none); }
#track .tile, #track .endcap { height: var(--tile-h); background: var(--face) center / calc(100% - 4px) 100% no-repeat !important; }
#track .tile::before, #track .tile::after, #track .endcap::before, #track .endcap::after { display: none; }
#track .tile .lbl, #track .endcap span { display: none; }
#track .tile .num { left: 0; right: 0; top: auto; bottom: calc(var(--tile-h) * .06); text-align: center; font-size: max(9px, calc(var(--cell-w) * .12)); color: #ffe9b0; z-index: 3; }
.start .tile .num { display: none; }
.start .lab { position: absolute; left: 0; right: 0; bottom: calc(var(--tile-h) * .05); padding: 0; text-align: center; z-index: 3; font-size: max(9px, calc(var(--cell-w) * .14)); color: #ffe9b0; }
.start { position: relative; }
#track .endcap em { bottom: calc(var(--tile-h) * .05); color: #ffe9b0; z-index: 3; }
#track::before { left: calc(var(--cell-w) * -.15); right: calc(var(--cell-w) * -.15); bottom: calc(var(--cell-w) * -.1); height: calc(var(--cell-w) * .4); border-radius: 0; background: none; box-shadow: none; border: solid transparent; border-width: 0 calc(var(--cell-w) * .16); border-image: var(--asset-track_base) 0 40 0 40 fill / 0 calc(var(--cell-w) * .16) / 0 stretch; filter: drop-shadow(0 calc(var(--cell-w) * .12) calc(var(--cell-w) * .12) #000a); }
.start .tile { font-size: 0; }

/* ---- PR-L：版面/文案/终局整理 ---- */
#handArea, #publicMarket { height: calc(var(--card-h) + 2 * var(--pb) + 60px); flex: 0 0 auto; }
#hand { min-height: calc(var(--card-h) + 24px); }
.hint.empty-hand { padding: 10px; color: #3b2a14; font-weight: 700; font-size: .95em; text-align: center; align-self: center; }
.promo.behind .pc { filter: saturate(.8) brightness(.92); opacity: 1; }
.link { margin-bottom: calc(var(--cell-w) * -.05); }
/* 悬挂牌与轨道之间多留一段（--pc-gap），棋子静止 / 跳到最高点（pawnStep）时帽尖都碰不到悬挂牌底边的步数条。
   声明在 #market（--cell-w 的写入处），随长路收格宽一起缩；fitCell 的高度预算（app.js PC_GAP_K / PC_GAP_PX）同步加了这一段。
   几何（单位格宽 cw）：棋子框顶 = 格顶上方 0.25cw，跳跃再抬 0.055cw；悬挂牌底 = 格顶上方 (0.25cw + --pc-gap)。 */
#market { --pc-gap: calc(var(--cell-w) * .06 + 4px); }
.link { height: calc(var(--cell-w) * .3 + var(--pc-gap, 0px)); }
#logPanel { top: 12px; right: 8px; opacity: .94; }
#logPanel.open { width: calc(var(--log-w) * 2); }
#modal.endgame { background: #0000004d; }
.dialog.endgame, #modal.endgame .dialog { box-shadow: 0 8px 40px #000c; }
.dialog th, .dialog td { white-space: nowrap; }
.final-pop { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.over-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 10px 4px; }
.over-box .btn { min-width: 70%; }

/* 悬挂牌与格子成比例：宽 ≈ 覆盖格宽总和×0.9，夹在 1.2–1.6 格 */
.pc { width: calc(var(--cell-w) * clamp(1.2, var(--n, 2) * .9, 1.6)); height: calc(var(--cell-w) * clamp(1.2, var(--n, 2) * .9, 1.6) * 1.399); }
.pcap { font-size: max(9px, calc(var(--cell-w) * .11)); }

/* PR-N: 起点文字移到牌下缘外侧，避免被棋子遮挡 */
.start .lab { bottom: calc(var(--tile-h) * -.2); z-index: 1; }

/* PR-O: 手牌面板固定为 5 张宽度（手牌数变化不再移动其它面板），收紧内边距 */
:root { --hgap: clamp(4px, .5vw, 10px); }
#handArea { width: calc(5 * var(--card-w) + 4 * var(--hgap) + 2 * var(--pb) + 12px); box-sizing: border-box; padding-left: 4px; padding-right: 4px; }
#hand { gap: var(--hgap); }

/* ---- 轨道返工：薄瓷砖 + 上下细砖栏（标准见 docs/track-pawn-spec.md，数字由 refs/ 设计稿实测）----
   1) 格子回到平面瓷砖 tile_*，宽高比 1.07:1。tile3d_* 那套是「厚木块 + 上窄下宽梯形」，和设计稿不是一回事。
   2) 格子没有可见厚度面；立体感来自上下两条细砖栏，以及格子投在下栏上的影（见 style.css #railBottom）。
   3) 背景铺满整格：原来按 calc(100% - 4px) 画，左右各留 2px 透明，一排格子中间就露出木纹，看着是「散开的」。
      设计稿里相邻格是紧贴的，缝只有格宽的 2%，而且是瓷砖自己的暗边，不是透出背景。 */
/* 注意：--tile-h 必须声明在 #market（--cell-w 的写入处），不能放 :root，否则 #trackWrap 下的 #dragPv/#places 拿不到。自定义属性在「声明处」求值，
   而 --cell-w 的真实值是 fitCell() 运行时写到 #track 上的；放 :root 会拿 :root 自己那个
   clamp 公式算，结果格高偏小一大截（PR-K 原来就是这样，格子被压成了 1.5:1）。 */
#market { --tile-h: calc(var(--cell-w) / 1.07); }
.theme-E .tile { --face: var(--asset-tile_cui, none); }
.theme-G .tile { --face: var(--asset-tile_shuang, none); }
.theme-R .tile { --face: var(--asset-tile_fu, none); }
.theme-T .tile { --face: var(--asset-tile_sha, none); }
#track .tile, #track .endcap { height: var(--tile-h); background: var(--face) center / 100% 100% no-repeat !important; }
/* 上下细砖栏接管轨道边界，原来的木槽底座（track_base）收掉，否则两套边框叠在一起 */
.has-rail_top.has-rail_bottom #track::before { display: none; }

/* PR-P: 底栏牌放大填满面板 */
#botRow { gap: clamp(6px, .8vw, 16px); }
#handArea, #publicMarket { height: calc(var(--card-h) + 2 * var(--pb) + 52px + max(0px, (100vw - 1500px) * .04)); }

/* PR-Q: 牌按真实比例 636:890 放大；牌库移到顶栏；底栏 = 手牌 / 公共市场(3) / 窄行动栏 */
#publicMarket .pm-row { grid-template-columns: repeat(3, var(--card-w)); gap: var(--hgap); }
#publicMarket { width: calc(3 * var(--card-w) + 2 * var(--hgap) + 2 * var(--pb) + 12px); box-sizing: border-box; padding-left: 4px; padding-right: 4px; }
#handArea .hcard .cap, #publicMarket .pm-card .cap { font-size: max(12px, calc(var(--card-w) * .095)) !important; font-weight: 700; white-space: nowrap; letter-spacing: 0 !important; }
#deckInfo { gap: clamp(8px, 1vw, 16px); }
#deckInfo .deck { position: relative; flex: 0 0 auto; width: calc(var(--top-h) * .66 * .7146); }
#deckInfo .deck .back { width: 100%; height: auto; }
#deckInfo .deck.selectable button { cursor: pointer; }
#deckInfo .deck.selectable .back { outline: 3px solid #ffd35c; animation: pulse .6s infinite alternate; }
#deckInfo .deck.picked .back { outline: 3px solid #fff; }
#deckInfo .deck .dx { position: absolute; right: -6px; top: -6px; background: #ffd35c; color: #111; font-weight: 800; border-radius: 9px; padding: 0 5px; font-size: 12px; }

/* 行动区：窄栏、4 个按钮竖排等宽，提示文字压成一行小字 */
#actionPanel { padding: 6px 8px 8px; }
#actionPanel .btn-row.acts { grid-template-columns: 1fr; gap: 5px; }
#actionPanel .btn.act { height: clamp(34px, 5.9vh, 62px); line-height: 1.15; padding: 0 6% 0 24%; }
#actionPanel .reasons { font-size: max(9px, .72em); line-height: 1.2; }
#actionPanel #preview { font-size: max(9px, .72em); }

/* 顶栏名牌：名字不截断，名次在剩余空间内缩小 */
#scorePanel .l1 { gap: 5px; }
#scorePanel .l1 .nm { flex: 0 0 auto; overflow: visible; text-overflow: clip; }
#scorePanel .rank { font-size: .84em; min-width: 0; overflow: hidden; text-overflow: clip; }
#scorePanel .score-row { width: clamp(170px, 16.5vw, 340px); }
/* 窄行动栏：小屏下文字缩小、避免标题副标题叠在一起 */
@media (max-height: 700px) {
  #actionPanel .btn.act { height: 27px; padding-left: 26%; }
  #actionPanel { padding: 4px 6px 5px; }
  #actionPanel .btn-row.acts { gap: 3px; }
  #actionPanel #preview, #actionPanel .reasons { font-size: 9px; line-height: 1.15; padding: 2px 4px; }
  #actionPanel .btn.act .tt { font-size: 11px; line-height: 1.1; }
  #actionPanel .btn.act .sub { display: none; }
  #actionPanel .panel-title { margin-bottom: 3px; }
}
#actionPanel .btn.act .tt { font-size: max(11px, calc(var(--act-w) * .075)); }
#actionPanel .btn.act .sub { font-size: max(8.5px, calc(var(--act-w) * .052)); white-space: nowrap; }
#actionPanel .reasons, #actionPanel #preview { max-height: 3.6em; overflow: hidden; }

/* PR-R: 底栏面板统一结构：固定标题行 + 垂直居中的牌区，上下等距留白 */
#handArea, #publicMarket { height: calc(var(--bot-h) - 8px); padding-top: 0; padding-bottom: 0; justify-content: flex-start; }
#handWrap { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
#handArea .panel-title, #publicMarket .panel-title { flex: 0 0 var(--th); height: var(--th); margin: 0; display: flex; align-items: center; font-size: clamp(15px, 1.9vh, 22px); font-weight: 800; white-space: nowrap; overflow: visible; }
#handArea .panel-title small, #publicMarket .panel-title small { display: inline; font-size: 1em; font-weight: 800; margin-left: .4em; opacity: 1; }
#hand, #publicMarket .pm-row { flex: 1 1 auto; min-height: 0; padding: var(--pp) 0; margin: 0; display: flex; justify-content: center; align-items: center; gap: var(--hgap); overflow: visible; }
#publicMarket .pm-row { grid-template-columns: none; }
#publicMarket .pm-card { width: var(--card-w); flex: 0 0 auto; }
#hand { min-height: 0; }
#handArea .hcard .cap, #publicMarket .pm-card .cap { font-size: max(14px, calc(var(--card-w) * .1)) !important; line-height: 1.3; padding: 2px 0; height: var(--cap-h); box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
/* 行动栏：只留主文字 + 图标 */
#actionPanel .btn.act .sub { display: none !important; }
#actionPanel .btn.act { height: clamp(40px, 6.6vh, 72px); }
#actionPanel .btn.act .tt { font-size: clamp(14px, 2vh, 22px); }
#actionPanel .panel-title { font-size: clamp(15px, 1.9vh, 22px); }
#actionPanel .reasons, #actionPanel #preview { font-size: clamp(11px, 1.25vh, 14px); line-height: 1.25; max-height: none; }
/* 字号下限 */
#banner, #turnInfo { font-size: clamp(14px, 1.45vh, 17px); }
#scorePanel .rank { font-size: max(12px, .84em); }
#popPanel .panel-title, #logPanel .panel-title, #logPanel #log { font-size: max(13px, 1.25vh); }
@media (max-height: 700px) {
  #actionPanel .btn.act { height: 29px; }
  #actionPanel .btn.act .tt { font-size: 13px; }
  #actionPanel .panel-title { font-size: 13px; }
  #actionPanel .reasons, #actionPanel #preview { font-size: 10.5px; }
  #handArea .panel-title, #publicMarket .panel-title { font-size: 14px; }
  #banner, #turnInfo { font-size: 13px; }
}

/* PR-R 行动区重做：标题居中大字；4 按钮等宽等高，只有图标+主文字；提示 ≥13px；四周内边距一致 */
#actionPanel { padding: 12px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-start; }
#actionPanel .panel-title { font-size: clamp(16px, 2vh, 22px); font-weight: 800; text-align: center; margin: 0 0 8px; }
#actionPanel .btn-row.acts { gap: 8px; }
#actionPanel .btn.act { height: clamp(44px, 6.4vh, 72px); padding: 0 6% 0 26%; flex-direction: row; justify-content: center; }
#actionPanel .btn.act .tt { font-size: clamp(16px, 2.1vh, 24px); font-weight: 800; line-height: 1; letter-spacing: .06em; }
#actionPanel .btn.act:disabled { color: #d6cfbf; }
#actionPanel .btn.act:disabled .tt { text-shadow: 0 1px 2px #000, 0 0 4px #000; }
#actionPanel .reasons, #actionPanel #preview { font-size: clamp(13px, 1.4vh, 15px); line-height: 1.4; padding: 6px 2px 0; }
#actionPanel .reasons summary { cursor: pointer; }
@media (max-height: 700px) {
  #actionPanel { padding: 6px 8px; }
  #actionPanel .panel-title { font-size: 14px; margin-bottom: 4px; }
  #actionPanel .btn-row.acts { gap: 4px; }
  #actionPanel .btn.act { height: 32px; }
  #actionPanel .btn.act .tt { font-size: 14px; }
  #actionPanel .reasons { display: none; }
  #actionPanel #preview { font-size: 12px; line-height: 1.25; padding-top: 3px; }
}
/* PR-R: 行动区竖排窄栏（让牌更大），无副文字，摸牌绿色高亮 */
:root { --act-w: clamp(190px, 13.5vw, 270px); }
#actionPanel .btn-row.acts { grid-template-columns: 1fr; }
#actionPanel .btn.act { padding: 0 4px 0 34%; }
#actionPanel .btn.act .tt { font-size: clamp(16px, 2.1vh, 24px); white-space: nowrap; }
#actionPanel .btn.act.btn-draw:not(:disabled) { background: linear-gradient(#4fae4f, #2f7a35); color: #fff; border-color: #9be39b; }
@media (max-height: 700px) {
  :root { --act-w: clamp(170px, 18vw, 230px); }
  #actionPanel .btn.act { height: 30px; padding: 0 2px 0 34%; }
  #actionPanel .btn.act .tt { font-size: 14px; }
}
#actionPanel #preview { display: none; }
#actionPanel .btn.act.btn-draw:not(:disabled) { background: transparent var(--asset-btn_draw_default) center/100% 100% no-repeat; }

/* PR-S: 对齐效果图比例——面板高≈32vh、下沿距视口底≈5vh、牌高≈24vh；行动栏同高同基线 */
:root {
  --bot-gap: 5vh;
  --pnl-h: 32vh;
  --bot-h: calc(var(--pnl-h) + 8px);
  --pb: clamp(8px, 1vh, 12px);
  --pp: calc(var(--pnl-h) * .025);
  --th: clamp(28px, 3.4vh, 40px);
  --cap-h: clamp(22px, 2.6vh, 30px);
  --act-w: clamp(150px, 11.5vw, 260px);
  --main-h: calc(100vh - var(--top-h) - var(--bot-h) - var(--bot-gap) - 64px);
  --card-h: min(calc(var(--pnl-h) - 2 * var(--pb) - var(--th) - 2 * var(--pp) - var(--cap-h)), calc((100vw - var(--act-w) - 4 * var(--pb) - 4 * var(--hgap) - 110px) / 8 / .7146));
}
#app { padding-bottom: var(--bot-gap); }
#botRow { align-items: stretch; height: var(--pnl-h); flex: 0 0 var(--pnl-h); }
#handArea, #publicMarket, #actionPanel { height: var(--pnl-h); max-height: var(--pnl-h); box-sizing: border-box; }
#actionPanel { padding: var(--pb); }
#actionPanel .panel-title { font-size: clamp(14px, 1.7vh, 19px); }
#actionPanel .btn-row.acts { flex: 1 1 auto; align-content: space-evenly; gap: 0; }
#actionPanel .btn.act { height: clamp(34px, 4.1vh, 46px); padding: 0 4px 0 36%; }
#actionPanel .btn.act .tt { font-size: clamp(13px, 1.6vh, 18px); }
@media (max-height: 700px) {
  :root { --pnl-h: 32vh; --act-w: clamp(130px, 14vw, 180px); --th: 24px; --cap-h: 20px; }
  #actionPanel { padding: 5px; }
  #actionPanel .panel-title { font-size: 12px; margin-bottom: 2px; }
  #actionPanel .btn.act { height: 26px; }
  #actionPanel .btn.act .tt { font-size: 12px; }
}
#botRow { display: grid; grid-template-columns: minmax(0, 1fr) auto var(--act-w); gap: .9vw; padding: 0 1.2vw; justify-content: stretch; }
#botRow > * { flex: none; }
#handArea .hcard .cap, #publicMarket .pm-card .cap { font-size: max(13px, calc(var(--card-w) * .082)) !important; white-space: nowrap; gap: 0; }
@media (max-height: 700px) {
  :root { --cap-h: 30px; }
  #handArea .hcard .cap, #publicMarket .pm-card .cap { flex-direction: column; line-height: 1.1; font-size: 12px !important; }
  #handArea .hcard .cap .sep, #publicMarket .pm-card .cap .sep { display: none; }
}
#botRow { grid-template-columns: auto auto var(--act-w); justify-content: space-between; }
.pcap { white-space: normal; line-height: 1.15; overflow: visible; padding: 2px 3px; }
/* 扩散影用 CSS 渐变，不用交付的 pawn_shadow.png：那张图的暗核本身是偏的，
   铺上去会在棋子左下方糊出一块歪的暗斑，看着像另一个物体的影子。
   素材留在 assets/ui 里备用，但不接。 */

/* ===== PR-T：对照效果图（1920×1080 基准，其余分辨率按 vw/vh 等比） ===== */
:root { --act-w: 11.8vw; --pop-w: 11.3vw; --log-w: 14.3vw; }
/* B 状态条：平时视觉隐藏（读屏仍可读），仅在有提示/高亮消息时作为浮条出现 */
#statusRow { position: fixed; left: 50%; top: 13vh; transform: translateX(-50%); z-index: 400; max-width: 60vw; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#statusRow.msg { width: auto; height: auto; overflow: visible; clip-path: none; }
#turnInfo { display: none; }
#statusRow #banner .last { display: none; }
#market > .panel-title { display: none; }
/* A 轨道：整排连在一起并水平居中；砖栏/底衬只覆盖实际格子 */
#trackScroll { justify-content: safe center; }
#trackWrap { width: max-content; min-width: 0; padding: 0; margin: 0 auto; }
#track { width: max-content; }
#track .endcap { margin-left: 0 !important; }
.pc { width: calc(var(--cell-w) * clamp(1, var(--n, 2) * .8, 1.33)); height: auto; aspect-ratio: 636 / 890; }
/* 嵌在中间：被切开的牌按整张的跨度（第一到最后一个可见格，--span）定大小，不按悬挂处那一段；没切开时 --span = --n，尺寸不变 */
#track .promo:not(.ghost) > .pc { width: calc(var(--cell-w) * clamp(1, var(--span, var(--n, 2)) * .8, 1.33)); }
.pcap { white-space: nowrap; overflow: hidden; padding: 0; height: max(18px, calc(var(--cell-w) * .17)); display: flex; align-items: center; justify-content: center; font-size: max(11px, calc(var(--cell-w) * .095)); line-height: 1; color: #fff; text-shadow: 0 1px 2px #000a; }
/* C 底栏：深色半透明面板，宽度/间距对齐效果图 */
#botRow { grid-template-columns: 57.1vw 27.3vw var(--act-w); justify-content: start; gap: .9vw; padding: 0 0 0 1.2vw; }
#handArea, #publicMarket, #actionPanel, .has-panel_large #handArea, .has-panel_large #publicMarket { width: auto; background: rgba(22, 14, 8, .88) !important; background-image: none !important; border: 2px solid #b8924a !important; border-image: none !important; border-radius: 10px; color: #f0e2bd; box-shadow: inset 0 0 0 1px #0008, 0 4px 14px #000a; }
#handArea .panel-title, #publicMarket .panel-title, #handArea .panel-title small, #publicMarket .panel-title small { color: #f3dfae; font-size: clamp(15px, 2.1vh, 24px); font-weight: 800; }
#hand { justify-content: flex-start; padding-left: 14px; padding-right: 14px; }
#publicMarket .pm-row { justify-content: flex-start; padding-left: 14px; padding-right: 14px; }
#publicMarket .pm-card { width: min(var(--card-w), calc((27.3vw - 28px - 4px - 2 * var(--hgap)) / 3)); }
#handArea .hcard .cap, #publicMarket .pm-card .cap { color: #fff !important; font-size: max(14px, 1.4vh) !important; font-weight: 800; text-shadow: 0 1px 2px #0009; }
/* D 行动栏 */
#actionPanel .btn-row.acts { display: flex; flex-direction: column; justify-content: space-evenly; flex: 1 1 auto; gap: 0; }
#actionPanel .btn.act { height: clamp(28px, 5.4vh, 64px); width: 100%; }
#actionPanel .btn.act:not(:disabled) { filter: brightness(1.3) saturate(1.35); }
#actionPanel .btn.act .tt { font-size: clamp(13px, 1.6vh, 19px); }
/* E 侧栏 */
#popPanel .pop-row.theme-R .pic { filter: grayscale(1) brightness(1.2) drop-shadow(0 2px 3px #000a); }
.theme-R .ticon, .tu-ticon.theme-R { filter: grayscale(1) brightness(1.2); }
.theme-R .tile, .tile.theme-R, #track .theme-R .tile, #track .tile.ut-R, .tu-tile.theme-R { filter: grayscale(1) brightness(1.65); }
#logPanel { width: var(--log-w); top: 12px; right: 8px; max-height: max(17vh, 130px); overflow: hidden; }
#logPanel #log, #logPanel .panel-title { font-size: max(14px, 1.4vh); }
#logPanel:not(.open) #log > div:nth-child(n+3) { display: block; }
#logPanel:not(.open) #log > div:nth-child(n+6) { display: none; }
@media (max-height: 700px) {
  #actionPanel .btn.act { height: 27px; }
}

/* PR-U：行动按钮加高并裁掉贴图透明边，视觉高度约 58px@1080 */
#actionPanel .btn.act { height: clamp(34px, 5.8vh, 68px); background-size: 100% 132%; background-position: center; }
@media (max-height: 700px) { #actionPanel .btn.act { height: 30px; } }

/* PR-选牌：hover / 选中 共用同一组 --ty/--sc，选中态优先级高于 hover，鼠标移入移出都不变 */

/* 摸牌飞行 */
.hcard.fly-hide { visibility: hidden; }
.fly-card { position: fixed; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 24px #000b; will-change: transform; }
.fly-card img { width: 100%; height: 100%; object-fit: fill; display: block; }
.fly-card .back { width: 100%; height: 100%; background: #3b2a6b linear-gradient(135deg, #5a3fa0, #2a1c4d); border: 2px solid #d9b45a; border-radius: 8px; box-sizing: border-box; }

/* PR-3：推广新格逐格出现（间隔 120ms、单格 220ms，随动画速度 --am 缩放；格宽生长使砖栏/终点平滑右移） */
@keyframes tin { from { width: 0; opacity: 0; transform: translateY(-14px); } to { width: var(--cell-w); opacity: 1; transform: none; } }
@keyframes tout { from { width: var(--cell-w); opacity: 1; } to { width: 0; opacity: 0; transform: translateY(-10px); } }
@keyframes pcin { from { opacity: 0; } to { opacity: 1; } }
#track .tile.tin { animation: tin calc(220ms * var(--am, 1)) ease-out both; }
#track .promo.newp > .pc { animation: pcin calc(260ms * var(--am, 1)) ease-out both; }
#track .promo.leaving { pointer-events: none; }
#track .promo.leaving .tile { animation: tout calc(160ms * var(--am, 1)) ease-in forwards; overflow: hidden; }
#track .promo.leaving > .pc { opacity: 0; transition: opacity .15s; }
#track .tile.tin:nth-child(2) { animation-delay: calc(120ms * var(--am, 1)); }
#track .tile.tin:nth-child(3) { animation-delay: calc(240ms * var(--am, 1)); }
#track .tile.tin:nth-child(4) { animation-delay: calc(360ms * var(--am, 1)); }
#track .tile.tin:nth-child(5) { animation-delay: calc(480ms * var(--am, 1)); }
#track .tile.tin:nth-child(6) { animation-delay: calc(600ms * var(--am, 1)); }
#track .promo.leaving .tile:nth-last-child(2) { animation-delay: 40ms; }
#track .promo.leaving .tile:nth-last-child(3) { animation-delay: 80ms; }
#track .promo.leaving .tile:nth-last-child(4) { animation-delay: 120ms; }

.score-row .tot.tot-pop { animation: totPop calc(520ms * var(--am, 1)) ease-out; }
@keyframes totPop { 0% { transform: scale(1.5); filter: brightness(2); } 100% { transform: none; filter: none; } }

/* 推广确认后逐格出现：仅淡入，不滑动、不改宽度，新格紧贴前一格 */
@keyframes tfade { from { opacity: 0; } to { opacity: 1; } }
#track .tile.pre, #track .promo.pre { display: none !important; }
#track .tile.tfade { animation: tfade calc(220ms * var(--am, 1)) ease-out both; }
#track .promo.pcfade > .pc { animation: pcin calc(260ms * var(--am, 1)) ease-out both; }

/* 放置模式：只画轻量虚线槽位 + 标签，不画完整格子/悬挂牌 */
#track .promo.ghost { opacity: 1; }
#track .promo.ghost > .pc, #track .promo.ghost > .link { display: none; }
#track .promo.ghost .tile { background: rgba(255, 255, 255, .06) !important; border: 2px dashed rgba(255, 233, 176, .85) !important; border-radius: 10px; box-sizing: border-box; height: var(--tile-h); }
#track .promo.ghost .tile > * { display: none; }
#track .promo.ghost.bad .tile { border-color: #ff6b5e !important; }
#track .promo.ghost .gtag { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); padding: 2px 10px; border-radius: 999px; background: #2a1c10; color: #ffe9b0; border: 1px solid #c9a24d; font: 700 14px/1.3 system-ui, sans-serif; white-space: nowrap; z-index: 80; }
#track .promo.ghost { position: absolute; margin-left: 0; }
/* 放置模式行动栏 */
#actions .placehint { display: block; text-align: center; color: #ffe9b0; font: 700 14px/1.3 system-ui, sans-serif; margin-bottom: 6px; }
#actions .placebar { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
#actions .placebar .stepper { justify-content: center; font: 700 16px/1 system-ui, sans-serif; color: #f3dfae; gap: 10px; }
#actions .placebar .stepper button { width: 2.2em; min-height: 32px; }
#actions .placebar #btnConfirmPromote { min-height: 40px; font-size: 16px; font-weight: 800; }
#actions .placebar #btnCancelPromote { min-height: 34px; font-size: 14px; }
#actions .placewhy { font-size: 12px; line-height: 1.35; color: #ffb4a8; padding: 4px 6px; max-height: none; overflow: visible; white-space: normal; }

/* PR-7：手牌拖拽 + 覆盖层预览 */
.hcard { touch-action: none; }
.hcard.dragging { opacity: .35; }
#dragCard { position: fixed; left: 0; top: 0; z-index: 999; pointer-events: none; filter: drop-shadow(0 8px 12px #000a); transform-origin: center; }
#dragCard img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
#dragCard.over { opacity: .55; }
#dragPv { position: absolute; z-index: 40; pointer-events: none; display: flex; }
#dragPv .tiles { display: flex; opacity: .6; }
#dragPv .tile { width: var(--cell-w); height: var(--tile-h); flex: 0 0 auto; position: relative; background: var(--face) center / 100% 100% no-repeat; outline: 2px solid var(--fc); outline-offset: -2px; box-sizing: border-box; border-radius: 8px; }
#dragPv .tile .num { position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; font-size: max(9px, calc(var(--cell-w) * .12)); color: #ffe9b0; }
#dragPv .dim { position: absolute; top: 0; background: rgba(0, 0, 0, .55); border-radius: 8px; z-index: -1; }
#dragPv.bad .tiles { filter: sepia(1) saturate(6) hue-rotate(-40deg); outline: 2px dashed #ff6b5e; }
#dragPv .dtag { position: absolute; left: 0; bottom: calc(100% + 8px); padding: 3px 10px; border-radius: 999px; background: #2a1c10; color: #ffe9b0; border: 1px solid #c9a24d; font: 700 14px/1.3 system-ui, sans-serif; white-space: nowrap; }
#dragPv.bad .dtag { background: #4a1510; color: #ffd0ca; border-color: #ff6b5e; }
@keyframes tflip { from { opacity: .2; transform: perspective(300px) rotateY(90deg); } to { opacity: 1; transform: none; } }
#track .tile.tflip { animation: tflip calc(250ms * var(--am, 1)) ease-out both; }
/* 放置模式：行动栏不再重复槽位按钮；提示字号 ≥13px */
#places .place { font-size: 0 !important; color: transparent !important; background: transparent !important; border: 2px dashed transparent; }
#places .place.sel { border-color: rgba(255,233,176,.0); }
#places .place:not(.off):hover { background: rgba(255,233,176,.15) !important; }
#actionPanel .stepper { display: none !important; }
.placewhy, #actions .placewhy, .placebar .bad { font-size: 13px !important; }

/* copy-polish：左栏只留图标+数字；日志/牌底标签缩小；行动按钮文字区统一 */
:root { --pop-w: clamp(84px, 6.4vw, 130px); }
#popPanel .pop-row { gap: 6px; justify-content: space-between; padding: 0 2px; }
#popPanel .pop-row .pic { height: clamp(30px, 2.08vw, 44px); width: clamp(30px, 2.08vw, 44px); flex: none; align-self: center; max-height: none; }
#popPanel .pop-row .pop-num { margin: 0 4px 0 auto; font-size: 22px; line-height: 1; display: flex; align-items: center; }
#popPanel .pop-row { height: clamp(40px, 7.4vh, 84px); align-items: center; }
#popPanel .panel-title { font-size: 14px; }
#logPanel #log { font-size: 12px; line-height: 1.35; }
#logPanel .panel-title { font-size: 13px; }
.pcap, #track .pcap, #hand .pcap, #publicMarket .pcap { font-size: 12px; font-weight: 600; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; height: max(18px, calc(var(--cell-w) * .15)); }
@media (max-width: 1500px) { #popPanel .pop-row .pop-num { font-size: 18px; } #logPanel #log { font-size: 11px; } .pcap, #track .pcap, #hand .pcap, #publicMarket .pcap { font-size: 11px; } }
@media (max-width: 1100px) { #popPanel .pop-row .pop-num { font-size: 14px; } #logPanel #log { font-size: 10px; } .pcap, #track .pcap, #hand .pcap, #publicMarket .pcap { font-size: 10px; } }
#handArea .hcard .cap, #publicMarket .pm-card .cap { font-size: 12px !important; font-weight: 600 !important; line-height: 1 !important; display: flex !important; align-items: center; justify-content: center; letter-spacing: 0; }
@media (max-width: 1500px) { #handArea .hcard .cap, #publicMarket .pm-card .cap { font-size: 11px !important; } }
@media (max-width: 1100px) { #handArea .hcard .cap, #publicMarket .pm-card .cap { font-size: 10px !important; } }

/* 底栏三块面板统一内边距与标题基线：标题距左/上边框 ≈20px@1920，标题与牌顶 ≈12px */
:root { --ppx: clamp(12px, 1.04vw, 22px); --ppy: clamp(12px, 1.85vh, 22px); --ptg: clamp(8px, 1.1vh, 14px); --pfs: clamp(15px, 2.1vh, 24px); }
#handArea, #publicMarket, #actionPanel { padding: var(--ppy) var(--ppx) 0 !important; display: flex; flex-direction: column; align-items: stretch; }
#handWrap { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: 0 !important; margin: 0 !important; }
#handArea .panel-title, #publicMarket .panel-title, #actionPanel .panel-title { margin: 0 0 var(--ptg) !important; padding: 0 !important; text-align: left !important; font-size: var(--pfs) !important; line-height: 1.2 !important; height: calc(var(--pfs) * 1.2); display: flex; align-items: center; gap: 6px; font-weight: 800; color: #f3dfae; }
#handArea .panel-title small, #publicMarket .panel-title small { font-size: inherit !important; }
#hand, #publicMarket .pm-row { padding: 0 !important; margin: 0 !important; justify-content: flex-start !important; align-items: flex-start !important; }
#actionPanel #actions { margin-top: 0; }
#logPanel:not(.open) #log > div:nth-child(n+5) { display: none !important; }
#handArea .panel-title .ico-hand { width: 1.3em; height: 1.3em; margin: 0 2px 0 0; flex: none; }
#actionPanel #actions { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-bottom: calc(var(--ppy) * .5); }
#actionPanel #actions .btn-row.acts { flex: 1 1 auto; min-height: 0; }
#actionPanel #actions .btn.act { height: clamp(34px, 5.2vh, 58px); }
#handArea .panel-title, #publicMarket .panel-title, #actionPanel .panel-title { height: 1.2em !important; min-height: 0 !important; flex: none !important; }
#actionPanel #actions .btn-row.acts { justify-content: space-between !important; }

/* ===== 底栏响应式：所有尺寸以牌宽 --cw 为基准，--cw 由视口与手牌数推出 ===== */
:root {
  --u: min(calc(100vw / 1920), calc(100vh / 1080));
  --edge: calc(12 * var(--u));
  --cw: min(calc(172 * var(--u)), calc((100vw - 2 * var(--edge) - 12px) / 11.37));
  --bp: calc(var(--cw) * .116);
  --bg: calc(var(--cw) * .06);
  --pg: calc(var(--cw) * .093);
  --btfs: max(13px, calc(var(--cw) * .13));
  --card-w: var(--cw);
  --card-h: calc(var(--cw) / .7146);
  --cap-h: calc(var(--cw) * .15);
  --ppx: var(--bp); --ppy: var(--bp); --ptg: calc(var(--cw) * .07); --pfs: var(--btfs);
  --pnl-h: calc(var(--cw) * 2.01 + 4px);
  --bot-h: calc(var(--pnl-h) + 8px);
}
#botRow { display: flex !important; grid-template-columns: none !important; justify-content: center !important; align-items: stretch !important; gap: var(--pg) !important; padding: 0 var(--edge) !important; height: var(--pnl-h) !important; flex: 0 0 var(--pnl-h) !important; --n: 3; }
#botRow > * { flex: 0 0 auto !important; min-width: 0; }
#handArea { width: calc(2 * var(--bp) + var(--n) * var(--cw) + (var(--n) - 1) * var(--bg) + 4px) !important; }
#publicMarket { width: calc(2 * var(--bp) + 4 * var(--cw) + 3 * var(--bg) + 4px) !important; }
#actionPanel { width: calc(var(--cw) * 1.3) !important; }
#botRow:not(.instant) > #handArea { transition: width .25s ease; }
#handArea, #publicMarket, #actionPanel { padding: var(--bp) var(--bp) 0 !important; }
#hand, #publicMarket .pm-row { gap: var(--bg) !important; flex-wrap: nowrap !important; width: auto !important; }
#hand { padding: 0 !important; }
#hand .hcard, #publicMarket .pm-card, #publicMarket .pm-row > .pm-card, #publicMarket .pm-row > .empty-slot { flex: 0 0 var(--cw) !important; width: var(--cw) !important; }
#btnNew { margin-left: auto; }
#logPanel { top: 2px !important; max-height: none !important; }
#actionPanel .btn.act, #actionPanel .btn-row.acts .btn { height: max(34px, calc(var(--cw) * .32)) !important; min-height: 0 !important; }
@media (max-width: 1100px) {
  #actions .placebar .stepper button { min-height: 26px; }
  #actions .placebar #btnConfirmPromote { min-height: 32px; }
  #actions .placebar #btnCancelPromote { min-height: 28px; }
}

/* 顶栏名牌按内容收紧：高 ≈56px@1080，四张等宽（取内容最多者），靠左 */
:root { --top-h: clamp(46px, 5.2vh, 70px); }
#scorePanel { display: grid !important; grid-auto-flow: column; grid-auto-columns: 1fr; justify-content: start !important; flex: 0 1 auto !important; gap: calc(var(--top-h) * .18) !important; }
#scorePanel .score-row { width: auto !important; min-width: 0; padding: 0 calc(var(--top-h) * .3) 0 calc(var(--top-h) * .08) !important; gap: calc(var(--top-h) * .18); border-radius: calc(var(--top-h) * .3); }
#scorePanel .avatar { height: calc(var(--top-h) * .8) !important; width: calc(var(--top-h) * .8) !important; transform: none !important; margin: 0 !important; }
#scorePanel .pbody { flex: 0 0 auto !important; flex-wrap: nowrap; flex-direction: column; align-items: flex-start; gap: 0; }
#scorePanel .l1 { flex: 0 0 auto !important; gap: .4em; font-size: clamp(12px, calc(var(--top-h) * .27), 18px); }
#scorePanel .l1 .nm { font-size: 1em; }
#scorePanel .rank { display: inline !important; font-size: .8em; }
#scorePanel .hc { font-size: clamp(11px, calc(var(--top-h) * .24), 16px); }
#scorePanel .coll-row { display: none; }
#scorePanel .tot { font-size: calc(var(--top-h) * .46); margin-left: calc(var(--top-h) * .12); }
@media (max-width: 1100px) { :root { --pnl-h: max(calc(var(--cw) * 2.01 + 4px), 196px); } }

/* 铺路点选：闪烁箭头 / 锁 / 悬停预览（不画格子） */
#places { top: 0; bottom: auto; height: 0; overflow: visible; }
#places .place { position: absolute; bottom: auto; padding: 0; background: transparent !important; border: 0; font-size: 0 !important; cursor: pointer; pointer-events: auto; }
#places .place .arw { position: absolute; left: 0; right: 0; top: 2%; text-align: center; font: 900 calc(var(--cell-w) * .34)/1 system-ui, sans-serif; font-style: normal; color: var(--tc, #ffd35c); text-shadow: 0 0 6px #000, 0 0 10px currentColor; animation: arwPulse 1s ease-in-out infinite; pointer-events: none; }
#places.theme-E { --tc: #5fd37a; } #places.theme-G { --tc: #7fd4ff; } #places.theme-T { --tc: #f0c060; } #places.theme-R { --tc: #d3dce2; }
#places .place:hover { background: rgba(255, 233, 176, .12) !important; }
#places .place.lock { cursor: not-allowed; border: 2px solid rgba(255, 107, 94, .75); border-radius: 6px; box-sizing: border-box; }
#places .place .lk { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: calc(var(--cell-w) * .3); opacity: .85; pointer-events: none; }
@keyframes arwPulse { 0%, 100% { opacity: .35; transform: translateY(-4px); } 50% { opacity: 1; transform: translateY(2px); } }
#actions .placewhy { font-size: max(13px, calc(var(--u, 1) * 14px)); }
#actions .placewhy { display: block; overflow: visible; line-height: 1.25; }
body.placing-mode #logPanel { opacity: .3; pointer-events: none; z-index: 0; }
/* 箭头/锁在任意格色上都清晰 */
#places { z-index: 60; }
#places .place .arw { color: #fff; -webkit-text-stroke: calc(var(--cell-w) * .02) var(--tc, #ffd35c); text-shadow: 0 0 3px #1a0c06, 0 2px 4px #000, 0 0 8px #000; filter: drop-shadow(0 0 2px #1a0c06) drop-shadow(0 2px 3px #000); }
#places .place.lock { background: rgba(40, 8, 4, .35) !important; }
#places .place .lk { width: max(24px, calc(var(--cell-w) * .3)); height: max(24px, calc(var(--cell-w) * .3)); inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; filter: drop-shadow(0 1px 3px #000); }
#dragPv.hov .dtag { bottom: auto; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; }

/* i18n：英文标题更长，窄屏下缩小人气面板标题并收紧内边距，避免截断 */
@media (max-width: 1100px) { #popPanel .panel-title { font-size: 12px; letter-spacing: 0; } #popPanel { padding-left: 6px; padding-right: 6px; } }

/* i18n：英文按钮/标题更长——加宽行动栏、收紧按钮图标留白、标题单行 */
html[lang="en"] #actionPanel { width: calc(var(--cw) * 1.62) !important; }
html[lang="en"] #actionPanel .btn.act { padding: 0 4px 0 30%; }
html[lang="en"] #actionPanel .btn.act .tt { font-size: clamp(12px, 1.45vh, 17px); white-space: nowrap; }
html[lang="en"] #actionPanel .panel-title { white-space: nowrap; font-size: calc(var(--pfs) * .85) !important; }

/* #36 修复：手牌上抬限制在标题间距内；窄屏日志不遮挡轨道 */
@media (max-width: 1100px) {
  #logPanel { max-height: 56px !important; overflow-y: auto !important; z-index: 0; }
  #logPanel.open { max-height: 140px !important; z-index: 20; }
  #logPanel:not(.open) #log > div:nth-child(n+3) { display: none !important; }
}

/* 牌底标签：跑步小人 + “+N”（内联 SVG，无需翻译） */
.cap .runner, .pcap .runner, .pcap .cell-icon { height: 1.5em; width: 1.5em; flex: none; margin-right: .15em; filter: drop-shadow(0 1px 1px #0008); }
.cap .cn, .pcap .cn { font-weight: 900; font-size: 1.05em; letter-spacing: 0; text-shadow: 0 1px 2px #000a; }
#handArea .hcard .cap, #publicMarket .pm-card .cap, .pcap { display: flex; align-items: center; justify-content: center; font-size: max(12px, calc(var(--card-w, var(--cell-w)) * .082)) !important; }
#handArea .hcard .cap, #publicMarket .pm-card .cap, .pcap { flex-direction: row !important; flex-wrap: nowrap; white-space: nowrap; gap: .2em; font-size: max(10px, calc(var(--card-w, var(--cell-w)) * .082)) !important; }
.cap .runner, .pcap .runner, .pcap .cell-icon { margin-right: 0; }
/* 玩家详情弹窗的收藏 / 作品集牌：与手牌同款主题外框 + 底部步数色条（--tc / --ti 来自 .theme-X，同 .hcard），只作用于弹窗 .mini */
.dialog .mini { gap: 6px; }
.dialog .mini .ccard { display: inline-flex; flex-direction: column; border: 3px solid var(--tc); border-radius: var(--cs-r, 9px); overflow: hidden; background: var(--tc); box-shadow: 0 2px 6px #0009; }
.dialog .mini .ccard img { display: block; border-radius: 0; }
.dialog .mini .ccard .cap { display: flex; align-items: center; justify-content: center; gap: .2em; height: 20px; padding: 0; background: var(--tc); color: #fff; font-size: 12px; font-weight: 800; line-height: 1; white-space: nowrap; text-shadow: 0 1px 2px #0009; }

/* 牌库牌：与公共市场牌同尺寸（边框、圆角、底部色带），牌背 100% 填满 */
#publicMarket .pm-card.deck { --tc: #6b4a1f; padding: 0; cursor: default; display: block; position: relative; overflow: hidden; background: #2b2118; }
#publicMarket .pm-card.deck::before { content: ''; display: block; aspect-ratio: 636 / 890; }
#publicMarket .pm-card.deck::after { content: ''; display: block; height: var(--cap-h, 1.6em); }
#publicMarket .pm-card.deck .back { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; background: var(--asset-card_back, #2b2118) center / cover no-repeat; }
#publicMarket .pm-card.deck .dkn { position: absolute; right: 4%; top: 3%; z-index: 2; min-width: clamp(18px, calc(var(--card-w) * .2), 30px); height: clamp(18px, calc(var(--card-w) * .2), 30px); box-sizing: border-box; padding: 0 5px; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: rgba(24, 16, 8, .88); border: 1.5px solid #d4a73a; color: #f6e7b4; font-weight: 800; font-size: clamp(11px, calc(var(--card-w) * .12), 17px); line-height: 1; box-shadow: 0 1px 3px #000a; }
#publicMarket .pm-card.deck.selectable { cursor: pointer; }
#publicMarket .pm-card.deck.empty { filter: grayscale(1) brightness(.6); cursor: not-allowed; }
#publicMarket .pm-card.deck .dx { position: absolute; right: 4px; top: 4px; background: #ffd35c; color: #111; font-weight: 800; border-radius: 9px; padding: 0 5px; font-size: 12px; z-index: 2; }

/* 卡牌交互状态（手牌 / 公共市场牌 / 牌库牌共用）：可选=细金边；悬停=细金边+上浮；选中=粗金边+贴边柔光+同样上浮；不可用=褪色无边 */
:root { --cs-ty: -2px; --cs-sc: 1.03; --cs-ring: 2px; --cs-ring-sel: 3px; --cs-gold: #e0b64a; --cs-gold-hi: #ffd35c; --cs-glow: 9px; --cs-r: 9px; }
.hcard, .pm-card { border-radius: var(--cs-r); overflow: hidden; background: var(--tc); --ty: 0px; --sc: 1; transform: translateY(var(--ty)) scale(var(--sc)); transition: transform .18s ease-out, box-shadow .18s; }
.hcard img, .pm-card img, .pm-card .back { border-radius: 0; box-shadow: none; display: block; }
.hcard:not(.dis), .pm-card.selectable { box-shadow: 0 0 0 var(--cs-ring) var(--cs-gold), 0 4px 8px #0006; }
.hcard:not(.dis):hover, .pm-card.selectable:hover { --ty: var(--cs-ty); --sc: var(--cs-sc); z-index: 5; }
.hcard.sel, .pm-card.picked, .hcard.sel:hover, .pm-card.picked:hover { --ty: var(--cs-ty); --sc: var(--cs-sc); z-index: 6; box-shadow: 0 0 0 var(--cs-ring-sel) var(--cs-gold-hi), 0 0 var(--cs-glow) calc(var(--cs-glow) * .3) #ffc83a99, 0 4px 8px #0006; }
.hcard.dis, .pm-card:not(.selectable):not(.picked) { box-shadow: 0 2px 4px #0005; }
.hcard.dis { filter: saturate(.55) brightness(.85); }
/* 前进逐张打：拖到路上时路面虚线框；结束前进按钮 */
/* 前进高亮依标题与手牌间距限幅上移；有标记时额外留出徽标空间。 */
#app #hand .hcard.playable { --ty: calc(0px - min(8px, max(1px, var(--ptg) - 1px))); --sc: 1; z-index: 5; cursor: pointer; box-shadow: 0 4px 8px #0006; outline: 3px solid #ffe14d; outline-offset: -3px; animation: hc-glow 1.4s ease-in-out infinite; }
#app #hand .hcard.playable:focus-visible { outline: 3px dashed #fff; animation: none; }
#handArea .panel-title { position: relative; z-index: 8; text-shadow: 0 1px 2px #000, 0 0 6px #000c; }
#handWrap:has(#peekTokens:not([hidden])) .panel-title { margin-bottom: calc(var(--ptg) + 4px) !important; }
@keyframes hc-glow { 50% { outline-color: #fff3a6; } }
@media (prefers-reduced-motion: reduce) { #app #hand .hcard.playable { animation: none; } }
#trackScroll.dev-drop { outline: 2px dashed #ffd76acc; outline-offset: -4px; border-radius: 10px; }
#actions .devbar { display: flex; justify-content: center; gap: 8px; width: 100%; }
#actions .devbar .btn { min-height: 40px; flex: 1 1 0; max-width: 220px; }

.score-row .sub { min-width: 0; }
.score-row .est { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; opacity: .8; }
.score-row .est { margin-left: 5px; }

/* 终局结算面板：按视口放大（字号由 vw / vh 推导，不用 transform 缩放，点击与滚动不受影响）。
   面板内只有表格区可滚动，按钮行始终可见；只作用于 #modal.endgame，不影响其他弹窗。 */
#modal.endgame .dialog { --ef: clamp(15px, min(1.45vw, 2.6vh), 24px); font-size: var(--ef); line-height: 1.3; box-sizing: border-box;
  width: clamp(min(560px, calc(100vw - 16px)), 68vw, 1180px); max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px);
  display: flex; flex-direction: column; overflow: hidden; padding: .7em 1.1em .8em; }
#modal.endgame .dialog h2 { flex: none; font-size: 1.45em; line-height: 1.2; margin: 0 0 .45em; }
#modal.endgame .end-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
#modal.endgame .dialog table { font-size: 1em; }
#modal.endgame .dialog th { font-size: .85em; padding: .35em .7em; }
#modal.endgame .dialog td { padding: .4em .7em; line-height: 1.25; vertical-align: middle; }
#modal.endgame .dialog td small { font-size: .72em; opacity: .85; }
#modal.endgame .dialog td b { font-size: 1.45em; color: #ffe08a; }
#modal.endgame .end-pl { display: inline-flex; align-items: center; gap: .45em; text-align: left; }
#modal.endgame .end-pl .avatar { width: max(36px, 2.3em); height: auto; }
#modal.endgame .final-pop { flex: none; gap: .3em 1em; margin: .55em 0 0; }
#modal.endgame .final-pop .chip { font-size: .95em; padding: .1em .5em; }
#modal.endgame .end-btns { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .6em; margin: .65em 0 0; }
#modal.endgame .end-btns .btn { min-height: max(44px, 2.4em); font-size: 1em; padding: 0 1.1em; margin: 0; }
#modal.endgame .end-btns .hint { font-size: .85em; }
/* 手机横屏（高 ≤ 500px）：行距 / 头像收紧，4 人局整表放得下、不用在面板里滚 */
@media (orientation: landscape) and (max-height: 500px) {
  #modal.endgame .dialog { padding: .5em .9em .6em; }
  #modal.endgame .dialog h2 { font-size: 1.3em; margin-bottom: .25em; }
  #modal.endgame .dialog th { padding: .2em .6em; }
  #modal.endgame .dialog td { padding: .2em .6em; line-height: 1.15; }
  #modal.endgame .end-pl .avatar { width: calc(var(--top-h) - 8px); }   /* 与手机名牌头像同大（responsive.css #scorePanel .avatar） */
  #modal.endgame .final-pop { margin-top: .35em; }
  #modal.endgame .end-btns { margin-top: .45em; }
}
