/* 装甲风暴 TANK BATTLE · 网页版界面样式
   配色照着实体包装走：橄榄绿底 + 卡其金描边 */

:root {
  --olive-dark: #1b2119;
  --olive: #262e22;
  --olive-light: #333d2c;
  --khaki: #c8b273;
  --khaki-dim: #8e7d51;
  --cream: #e8e2d2;
  --red: #c8443c;
  --blue: #3f6fc8;
  --green: #6ee7a0;
  --panel-w: 236px;          /* 左侧出场面板宽度；画布和底部提示都按它让开 */
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--olive-dark);
  color: var(--cream);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 画布给左侧面板让出位置 —— ⚠️ 拾取用的是 canvas 自己的 rect，
   所以往右让开不影响点格子；但 onResize 必须改成读 canvas 的尺寸（见 view3d.js）。
   ⚠️ 宽高一定要**显式**写：canvas 是"替换元素"，只给 top/right/bottom/left + auto
   的话，浏览器可能按它自己的固有尺寸（就是 width/height 属性）算，会跟渲染尺寸打架。 */
#gl {
  position: fixed;
  top: 0;
  left: var(--panel-w);
  width: calc(100% - var(--panel-w));
  height: 100%;
  display: block;
}

/* ---------- 左侧：坦克出场面板 ---------- */
#roster {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--panel-w);
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 8px;
  background: linear-gradient(90deg, rgba(18,22,16,.97) 0%, rgba(18,22,16,.90) 100%);
  border-right: 1px solid rgba(200,178,115,.22);
}

#roster .roster-head { display: flex; flex-direction: column; gap: 5px; }
#roster .roster-head-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#roster .roster-head b { font-size: 14px; letter-spacing: 2px; color: var(--khaki); }
#roster .roster-hint { font-size: 11.5px; line-height: 1.35; color: #cfc8b4; }
#roster .roster-hint.on { color: #ffd76a; font-weight: 700; }

#btn-random {
  font-size: 11.5px;
  letter-spacing: 0;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

#roster-list {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 2px;
}
#roster-list::-webkit-scrollbar { width: 6px; }
#roster-list::-webkit-scrollbar-thumb { background: rgba(200,178,115,.3); border-radius: 3px; }

.tank-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid rgba(200,178,115,.16);
  background: rgba(255,255,255,.035);
  transition: background .12s, border-color .12s;
}
/* ⚠️ 悬停把说明展开成全文时，卡片必须盖住后面的卡（不然文字会压在别人底下）；
   只加 z-index 没用，得同时给它一个不透明的底 */
.tank-card:hover {
  z-index: 3;
  background: #232a1d;
  border-color: rgba(200,178,115,.42);
}
.tank-card:hover .card-desc {
  -webkit-line-clamp: unset;
  color: #d6d0bf;
}
.tank-card:hover .card-state { border-color: rgba(200,178,115,.55); color: #d8cfb2; }
.tank-card .card-icon {
  flex: 0 0 auto;
  width: 54px; height: 36px;
  border-radius: 5px;
  background-color: #0d0f0c;
  background-repeat: no-repeat;
  background-size: 200% 200%;       /* 图集是 2×2，只显示"北"那一格 */
  background-position: 0% 0%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #6b6a60;
}
.tank-card .card-body { flex: 1 1 auto; min-width: 0; }
.tank-card .card-name {
  font-size: 12.5px; font-weight: 700; color: var(--cream);
  display: flex; align-items: baseline; gap: 6px;
}
.tank-card .card-name i {
  font-style: normal; font-size: 10.5px; font-weight: 400; color: var(--khaki);
}
.tank-card .card-desc {
  font-size: 10.5px; line-height: 1.3; color: #a9a496;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.tank-card .card-state {
  flex: 0 0 auto; font-size: 10.5px; padding: 1px 5px; border-radius: 20px;
  border: 1px solid rgba(200,178,115,.3); color: #b6ae95; white-space: nowrap;
}
.card-actions { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.tank-card .card-deploy-hint {
  font-size: 10.5px; line-height: 1.4; white-space: nowrap; color: #f2aaa4;
  font-weight: 600; user-select: none;
}
.tank-card .card-deploy-hint[hidden] { display: none; }
.tank-card.pickable {
  cursor: pointer;
  border-color: var(--khaki);
  background: rgba(200,178,115,.13);
  box-shadow: 0 0 0 1px rgba(200,178,115,.28) inset;
}
.tank-card.pickable:hover { background: rgba(200,178,115,.26); transform: translateX(2px); }
.tank-card.field { border-color: rgba(110,231,160,.55); background: rgba(110,231,160,.08); }
.tank-card.dead { opacity: .4; }
.tank-card.dead .card-icon { filter: grayscale(1); }

#roster .roster-foot {
  font-size: 11px; line-height: 1.4; color: #9a9484;
  border-top: 1px solid rgba(200,178,115,.18);
  padding-top: 6px;
}
#roster .roster-foot b.r { color: #ff8a7a; }
#roster .roster-foot b.b { color: #8ab0ff; }

/* ---------- 右下角：地形效果图鉴 ---------- */
#codex {
  position: fixed;
  right: 14px; bottom: 44px;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
#codex .hidden { display: none; }
#codex-panel, #building-codex-panel {
  width: min(330px, calc(100vw - var(--panel-w) - 40px));
  max-height: min(62vh, 560px);
  overflow-y: auto;
  padding: 10px 11px 8px;
  border-radius: 10px;
  border: 1px solid rgba(200,178,115,.34);
  background: rgba(17,21,15,.95);
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
#codex-panel::-webkit-scrollbar, #building-codex-panel::-webkit-scrollbar { width: 6px; }
#codex-panel::-webkit-scrollbar-thumb, #building-codex-panel::-webkit-scrollbar-thumb { background: rgba(200,178,115,.3); border-radius: 3px; }
.codex-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700; letter-spacing: 2px; color: var(--khaki);
  padding-bottom: 7px; margin-bottom: 7px;
  border-bottom: 1px solid rgba(200,178,115,.2);
}
#codex-close, #building-codex-close {
  padding: 0 7px; font-size: 15px; line-height: 1.3; border-radius: 4px;
}
.codex-item {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 6px 2px;
  border-bottom: 1px dotted rgba(200,178,115,.14);
}
.codex-item:last-child { border-bottom: none; }
.codex-swatch {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 5px;
  border: 1px solid rgba(0,0,0,.5);
  background-size: cover;
  background-position: center;
}
.codex-body { flex: 1 1 auto; min-width: 0; }
.codex-name {
  font-size: 13px; font-weight: 700; color: var(--cream);
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
}
.codex-name i {
  font-style: normal; font-size: 10.5px; padding: 1px 6px; border-radius: 20px;
  border: 1px solid rgba(200,178,115,.3); color: #b6ae95;
}
.codex-name i.no  { border-color: rgba(255,138,122,.5); color: #ff9d90; }
.codex-name i.todo { border-color: rgba(255,215,106,.5); color: #ffd76a; }
.codex-desc { font-size: 11.5px; line-height: 1.4; color: #b7b1a1; margin-top: 2px; }
.codex-foot {
  font-size: 10.5px; line-height: 1.4; color: #8f8a7c;
  padding-top: 6px; margin-top: 4px;
  border-top: 1px solid rgba(200,178,115,.18);
}
#btn-codex { font-size: 12.5px; }

/* ---------- 顶部 HUD ---------- */
#hud {
  position: fixed;
  top: 0; right: 0;
  /* ⚠️ 左边跟着面板让开，否则品牌名 / "行动顺序 红1→红2→蓝1→蓝2" 会被左侧面板压住 */
  left: var(--panel-w);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(20,25,18,.94) 0%, rgba(20,25,18,.72) 70%, rgba(20,25,18,0) 100%);
  pointer-events: none;
  flex-wrap: wrap;
  z-index: 10;
}

.hud-block { pointer-events: auto; }

.brand {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--khaki);
}
.brand span {
  font-size: 11px;
  letter-spacing: 2px;
  margin-left: 8px;
  color: var(--khaki-dim);
  font-weight: 400;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 1px;
  color: #7d8a72;
  margin-top: 2px;
}

.stats { display: flex; gap: 18px; }
.stat { text-align: center; min-width: 58px; }
.stat label {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  color: #7d8a72;
  margin-bottom: 1px;
}
.stat b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--cream);
}
.stat b.red   { color: var(--red); }
.stat b.blue  { color: #6f9ce8; }

/* 剩余步数：行动期间放大变绿，一眼能看到 */
.stat.big { min-width: 72px; }
.stat.big b {
  font-size: 22px;
  color: #7d8a72;
  transition: color .12s;
}
.stat.big b.steps-on {
  color: var(--green);
  font-size: 26px;
  text-shadow: 0 0 10px rgba(110,231,160,.45);
}

.actions { display: flex; align-items: center; gap: 7px; }

/* 按钮下方的小提示：放得下就一行，放不下自动折成「四个字一行」 */
.action-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}
.btn-hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 10px;
  line-height: 1.3;
  color: #7d8a72;
  letter-spacing: 0;
  pointer-events: none;
  user-select: none;
}
.btn-hint i {
  font-style: normal;
  white-space: nowrap;   /* 每个四字词组不许从中间断开 */
}

.sep {
  width: 1px;
  height: 22px;
  background: rgba(200,178,115,.25);
  margin: 0 3px;
}
.face-label {
  font-size: 11px;
  color: #7d8a72;
  letter-spacing: 1px;
}

button {
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 7px 14px;
  border-radius: 3px;
  border: 1px solid var(--khaki-dim);
  background: linear-gradient(180deg, #4a5a3c 0%, #35422c 100%);
  color: var(--cream);
  cursor: pointer;
  transition: filter .12s, opacity .12s;
}
button:hover:not(:disabled) { filter: brightness(1.22); }
button:active:not(:disabled) { filter: brightness(.9); }
button:disabled {
  opacity: .32;
  cursor: not-allowed;
  filter: grayscale(.6);
}
button.ghost {
  background: transparent;
  border-color: rgba(200,178,115,.35);
  color: #b8c2ac;
}
/* 转向防守：排成真实键盘的倒 T（↑ 在上居中，← ↓ → 在下排），做成键帽样子 */
.face-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}
.face-pad {
  display: grid;
  grid-template-columns: repeat(3, 33px);
  grid-template-rows: repeat(2, 25px);
  gap: 3px;
  grid-template-areas:
    ".    up    ."
    "left down right";
}
.face-pad .k-up    { grid-area: up; }
.face-pad .k-left  { grid-area: left; }
.face-pad .k-down  { grid-area: down; }
.face-pad .k-right { grid-area: right; }

button.dir {
  padding: 0;
  width: 100%;
  height: 100%;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
  background: linear-gradient(180deg, #59654a 0%, #303a26 100%);
  box-shadow: 0 2px 0 rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.16);
  transition: transform .06s, box-shadow .06s, filter .12s;
}
/* 按下去像真键帽一样沉一点 */
button.dir:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.10);
}
button.dir.active {
  border-color: var(--khaki);
  box-shadow: 0 0 0 1px rgba(200,178,115,.5);
}

/* ---------- 底部提示 ---------- */
#tip {
  position: fixed;
  left: var(--panel-w);
  right: 0;
  bottom: 0;
  padding: 5px 12px;
  border-radius: 0;
  background: rgba(20,25,18,.88);
  border: 1px solid rgba(200,178,115,.3);
  font-size: 13.5px;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  line-height: 1.5;
  z-index: 10;
  pointer-events: none;
}
.tip-line { display: inline-block; white-space: nowrap; }

/* 「击杀 蓝1」这种可点标签。提示条整体不吃鼠标事件（会挡住点格子），
   所以只有标签自己打开 pointer-events。 */
.tip-kill {
  display: inline-block;
  margin-left: .5em;
  padding: .1em .6em;
  border-radius: 3px;
  border: 1px solid var(--khaki-dim);
  background: linear-gradient(180deg, #5c3a33 0%, #3d2521 100%);
  color: #ffd8c6;
  font-size: inherit;
  letter-spacing: 0;
  cursor: pointer;
  pointer-events: auto;
  transition: filter .12s;
}
.tip-kill:hover { filter: brightness(1.28); }

/* ---------- 结算 / 错误面板 ---------- */
#result, #fatal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,14,9,.8);
  z-index: 30;
}
#result.hidden, #fatal.hidden { display: none; }

.panel {
  min-width: 320px;
  max-width: min(520px, 90vw);
  padding: 30px 34px;
  text-align: center;
  background: linear-gradient(180deg, var(--olive-light) 0%, var(--olive) 100%);
  border: 1px solid var(--khaki-dim);
  border-radius: 5px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 26px;
  letter-spacing: 4px;
  color: var(--khaki);
}
.panel p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.65;
  color: #cdd4c4;
}
.panel p.hint {
  font-size: 12.5px;
  color: #8e9a83;
}
.panel button { margin-top: 16px; }

/* ⚠️ 断点要按"画布宽度"想，不是窗口宽度：左侧面板占掉 --panel-w 之后，
   窗口 1400px 时画布只有 1164px，顶栏会折行 → HUD 变高 → 留给棋盘的纵向空间变小。
   所以 1500px 就开始收 HUD（隐藏副标题 + 按钮下方小提示），别等 900px。 */
@media (max-width: 1500px) {
  .brand-sub { display: none; }
  .btn-hint { display: none; }
}
@media (max-width: 1180px) {
  .face-label { display: none; }
  .hud-block.stats { gap: 10px; }
  .stat { min-width: 44px; }
}
@media (max-width: 900px) {
  :root { --panel-w: 178px; }
  .tank-card .card-desc { -webkit-line-clamp: 1; }
  .tank-card .card-icon { width: 30px; height: 24px; }
}

.codex-buttons { display: flex; gap: 8px; }
#btn-building-codex { font-size: 12.5px; }
.codex-swatch.building-symbol { display: grid; place-items: center; font-size: 24px; color: #e1d397; text-shadow: 0 2px 3px #000; }

/* 右侧共用一列：日志与图鉴自动分配高度，不互相盖住。 */
#right-panels { position:fixed; top:112px; right:14px; bottom:44px; width:clamp(185px,17vw,310px); z-index:14; display:flex; flex-direction:column; gap:12px; pointer-events:none; }
#right-panels #codex { position:static; width:100%; flex:0 0 auto; margin-top:auto; pointer-events:auto; }
#right-panels #codex-panel, #right-panels #building-codex-panel { width:100%; max-height:min(55vh,calc(100dvh - 245px)); }
#game-log { display:flex; flex-direction:column; flex:1 1 0; min-height:86px; border:1px solid #bfa66b33; border-radius:9px; background:#11160fbd; pointer-events:auto; overflow:hidden; }
#game-log.collapsed { flex:0 0 auto; min-height:0; }
.game-log-head { display:flex; align-items:center; justify-content:space-between; flex:0 0 auto; gap:8px; padding:10px 11px; color:var(--khaki); border-bottom:1px solid #bfa66b22; }
.game-log-head b { font-size:14px; letter-spacing:2px; }
.game-log-head button { font-size:11px; padding:3px 6px; }
#game-log-list { list-style:none; margin:0; padding:2px 10px 10px; overflow-y:auto; min-height:0; flex:1 1 auto; scrollbar-width:thin; scrollbar-color:#81754e55 transparent; overscroll-behavior:contain; }
#game-log-list[hidden], #game-log-latest[hidden] { display:none; }
.log-entry { display:flex; align-items:baseline; gap:7px; padding:8px 0; border-bottom:1px solid #bfa66b15; font-size:11px; line-height:1.6; overflow-wrap:anywhere; }
.log-round { flex:0 0 auto; font-size:10px; color:#8e997e; }
.log-text { color:#c9cdbd; }
.log-entry.red .log-text { color:#e8a59a; }
.log-entry.blue .log-text { color:#9ab9e6; }
.log-entry.log-turn .log-text, .log-entry.log-result .log-text { color:#e3c87d; }
.log-entry.log-result { font-weight:bold; }
#game-log-latest { flex:0 0 auto; font-size:11px; padding:6px; margin:6px 9px; }
.codex-swatch.building-model { width:58px; height:58px; flex:0 0 58px; background:#0b100b; border-color:#ad9a6244; }
.building-model img { display:block; width:100%; height:100%; object-fit:contain; }
@media(max-width:1050px){#right-panels{top:110px;width:180px;right:8px;gap:8px;}.game-log-head{padding:7px 9px;}}

/* 地形操作常驻右侧；日志按原可用高度缩短30%。 */
#game-log { flex:0 1 auto; height:calc((100dvh - 210px) * .7); }
#game-log.collapsed { height:auto; }
#terrain-controls { flex:0 0 auto; margin-top:auto; padding:10px; border:1px solid #bfa66b33; border-radius:8px; background:#11160fe8; pointer-events:auto; }
#terrain-controls>b { color:var(--khaki); font-size:13px; letter-spacing:2px; }
.terrain-buttons { display:flex; gap:6px; margin-top:8px; }
.terrain-buttons button { flex:1; padding:8px 3px; font-size:12px; min-width:0; transition:background .15s,box-shadow .15s; }
.terrain-buttons button:disabled { opacity:.3; box-shadow:none; }
.terrain-buttons button:not(:disabled) { border-color:#dec17b; color:#fff1c2; background:#504b2f; box-shadow:0 0 9px #edcb6633; }
#terrain-action-hint { display:block; font-size:10px; color:#aab497; line-height:1.5; margin-top:7px; }
#right-panels #codex { margin-top:0; }
#right-panels #codex-panel, #right-panels #building-codex-panel { display:flex; flex-direction:column; overflow:hidden; max-height:min(48vh,calc(100dvh - 430px)); }
#right-panels #codex .hidden { display:none; }
.codex-head,.codex-foot { flex:0 0 auto; }
#codex-list,#building-codex-list { min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#81754e55 transparent; }
#terrain-notice { position:fixed; z-index:25; bottom:82px; left:calc(var(--panel-w) + (100vw - var(--panel-w)) / 2); transform:translateX(-50%); max-width:calc(100vw - var(--panel-w) - 30px); width:max-content; white-space:nowrap; pointer-events:none; padding:12px 18px; border:1px solid #efd58a; border-radius:8px; color:#fff0bc; background:#262c1df5; box-shadow:0 5px 25px #0008; font-size:clamp(10px,1.2vw,17px); }
#terrain-notice[hidden]{display:none;}
#audio-controls { position:fixed; right:15px; top:83px; z-index:20; display:flex; align-items:center; gap:7px; color:#afb79d; font-size:10px; background:#13180fe8; border-radius:6px; padding:3px 7px; }
#audio-controls button { padding:2px 5px; font-size:11px; }
#audio-controls input { width:76px; accent-color:#c8b273; cursor:pointer; }
#audio-volume-value { width:29px; font-variant-numeric:tabular-nums; }
#right-panels { top:122px; }
@media(max-height:650px){#right-panels{gap:6px;}#terrain-controls{padding:6px;}#game-log{min-height:70px;}.codex-foot{display:none;}}

/* 用户追加：地形框宽度再收30%，日志在70%基础再收5%。 */
#terrain-controls { width:70%; align-self:flex-end; padding:8px; }
.terrain-buttons { gap:5px; align-items:stretch; }
.terrain-buttons>div { flex:1 1 0; min-width:0; display:flex; flex-direction:column; }
.terrain-buttons button { width:100%; flex:0 0 auto; font-size:11px; padding:7px 1px; }
.terrain-buttons small { display:block; color:#aab497; font-size:9px; line-height:1.5; text-align:center; margin-top:5px; }
#terrain-action-hint[hidden] { display:none; }
#game-log { height:calc((100dvh - 210px) * .665); }
#game-log.collapsed { height:auto; }
/* ImageGen原创插画作为真正的游戏结算背景，文字与统计是可访问的HTML。 */
#result { z-index:60; padding:3vh 3vw; background:#080c09e8; backdrop-filter:blur(8px); }
.victory-scene { position:relative; isolation:isolate; width:min(1280px,94vw); height:min(740px,90dvh); min-height:450px; overflow:hidden; border:1px solid #d6b96c77; border-radius:12px; box-shadow:0 28px 100px #000c,inset 0 0 0 5px #0003; color:#eadfbf; }
.victory-art { position:absolute; inset:0; z-index:-3; background:url('../assets/victory-battlefield.webp') center center/cover no-repeat; animation:victory-arrive 1.2s ease-out both; }
.victory-shade { position:absolute; inset:0; z-index:-2; background:linear-gradient(90deg,#080e0de8 0%,#0c1513d9 24%,#1016108c 43%,transparent 72%),linear-gradient(0deg,#070c0bba,transparent 30%,transparent 82%,#060a08b3); }
.victory-topline { display:flex; justify-content:space-between; position:absolute; top:25px; left:34px; right:34px; font-size:12px; letter-spacing:2px; color:#d3ba7b; }
.victory-topline i { font:normal 9px sans-serif; letter-spacing:3px; opacity:.65; margin-left:9px; }
.victory-topline>span:last-child { font-size:10px; opacity:.7; }
.victory-content { position:absolute; top:50%; left:5.5%; transform:translateY(-46%); width:42%; max-width:475px; }
.victory-emblem { width:94px; height:76px; color:#dfc276; filter:drop-shadow(0 0 14px #efcc622e); }
.victory-kicker { color:#d5b66c; font-size:11px; letter-spacing:8px; margin:10px 0 13px; }
#result-title { margin:0; font-size:clamp(36px,4.3vw,68px); line-height:1.15; letter-spacing:5px; color:#fff1c3; font-weight:750; text-shadow:0 3px 25px #0007; }
#result[data-winner="blue"] #result-title { color:#bedcff; }
#result-desc { font-size:13px; line-height:1.85; color:#c4c8b8; margin:20px 0 25px; max-width:330px; }
.victory-stats { display:flex; gap:24px; border-top:1px solid #d4b86a40; padding-top:18px; margin-bottom:25px; }
.victory-stats div { display:flex; flex-direction:column; gap:6px; }
.victory-stats strong { font:500 29px Georgia,serif; color:#efdeb1; }
.victory-stats span { font-size:10px; color:#a3ad9e; letter-spacing:1px; }
.victory-actions { display:flex; gap:12px; align-items:center; }
#btn-again { display:flex; justify-content:space-between; gap:36px; padding:12px 19px; border:1px solid #f4d987; color:#171c12; background:linear-gradient(120deg,#e6d198,#b59a57); border-radius:3px; font-weight:650; font-size:14px; box-shadow:0 3px 20px #d0b36520; }
#btn-again:hover { filter:brightness(1.12); }
#btn-result-log { font-size:11px; padding:10px; color:#c4c6b3; border-color:#9b956750; }
.victory-footer { display:block; font-size:10px; color:#8a9685; margin-top:19px; letter-spacing:1px; }
.victory-bottomline { position:absolute; bottom:20px; left:34px; right:34px; font-size:8px; letter-spacing:4px; color:#c9b36c70; display:flex; justify-content:space-between; }
#btn-result-reopen { position:fixed; bottom:45px; left:calc(var(--panel-w) + 15px); z-index:25; background:#242b1f; color:#e4cc83; font-size:12px; }
#btn-result-reopen[hidden] { display:none; }
@keyframes victory-arrive { from{transform:scale(1.045);filter:brightness(.6)}to{transform:scale(1);filter:brightness(1)} }
@media(max-height:650px){.victory-scene{min-height:0;}.victory-emblem{width:60px;height:48px;}.victory-kicker{margin:5px 0 8px;}#result-desc{margin:10px 0;font-size:11px;}.victory-stats{padding-top:10px;margin-bottom:12px;}.victory-footer{margin-top:9px;}.victory-topline{top:14px;}.victory-bottomline{bottom:10px;}}
@media(max-width:750px){.victory-content{width:82%;left:8%;}.victory-shade{background:linear-gradient(90deg,#08100cee,#0b130d80);}.victory-topline>span:last-child{display:none;}.victory-topline{left:8%;}.victory-scene{height:90dvh;}.victory-art{background-position:62% center;}}
@media(prefers-reduced-motion:reduce){.victory-art{animation:none;}}

.remaining-tanks { min-width:58px; }
.remaining-tanks b { font-size:23px; }
@media(max-width:1500px){.hud-block.stats{gap:9px}.remaining-tanks{min-width:49px}.remaining-tanks label{font-size:10px;}}

/* 顶栏固定为原来的单行高度；音量并入右端工具区，不再占第二行。 */
#hud { height:76px; box-sizing:border-box; display:grid; grid-template-columns:minmax(140px,1fr) auto auto 142px; gap:12px; padding:6px 14px; align-items:center; }
.hud-brand { min-width:0; overflow:hidden; }
#hud .brand { font-size:18px; letter-spacing:2px; white-space:nowrap; }
#hud .brand span { font-size:9px; letter-spacing:1px; margin-left:6px; }
#hud .brand-sub { display:block; font-size:9px; letter-spacing:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#hud .stats { gap:8px; }
#hud .stat { min-width:43px; }
#hud .stat label { font-size:9px; letter-spacing:0; margin-bottom:3px; }
#hud .stat b { font-size:19px; line-height:1.15; }
#hud .stat.big b { font-size:24px; }
#hud .remaining-tanks { margin-left:3px; }
#hud .actions { gap:5px; }
#hud .action-item { gap:3px; }
#hud .action-item button { font-size:12px; padding:6px 9px; white-space:nowrap; letter-spacing:0; }
#hud .btn-hint { display:block; white-space:nowrap; text-align:center; font-size:9px; line-height:1; }
#hud .sep { margin:0 3px; }
#hud .face-wrap { flex-direction:column; gap:2px; }
#hud .face-label { display:block; font-size:8px; letter-spacing:0; }
#hud .face-pad { grid-template-columns:repeat(3,25px); grid-template-rows:repeat(2,21px); gap:2px; }
#hud button.dir { width:25px; height:21px; padding:0; font-size:15px; line-height:18px; }
.hud-utility { display:flex; flex-direction:column; align-items:flex-end; gap:5px; }
#hud .hud-navigation { display:flex; justify-content:flex-end; gap:5px; width:100%; }
#hud .hud-navigation button { font-size:11px; padding:3px 10px; letter-spacing:0; white-space:nowrap; }
#hud #audio-controls { position:static; padding:0; gap:4px; width:100%; justify-content:flex-end; background:none; font-size:9px; }
#hud #audio-controls button { padding:1px 3px; font-size:9px; letter-spacing:0; white-space:nowrap; }
#hud #audio-controls input { width:54px; min-width:0; margin:0; }
#audio-volume-value { min-width:24px; font-variant-numeric:tabular-nums; }
#right-panels { top:88px; }
@media(max-width:1500px){
  #hud { grid-template-columns:minmax(115px,1fr) auto auto 118px; gap:8px; padding:6px 10px; }
  #hud .brand { font-size:16px; letter-spacing:1px; }
  #hud .brand span { display:none; }
  #hud .brand-sub { font-size:8px; }
  #hud .stats { gap:4px; }
  #hud .stat { min-width:38px; }
  #hud .stat label { font-size:8px; }
  #hud .remaining-tanks { margin-left:0; }
  #hud .action-item button { padding:6px 7px; font-size:11px; }
  #hud #audio-controls input { width:38px; }
  #hud .hud-navigation { gap:4px; }
  #hud .hud-navigation button { font-size:10px; padding:3px 4px; }
}
@media(max-width:1200px){
  #hud { grid-template-columns:minmax(95px,1fr) auto auto 108px; gap:5px; padding:6px; }
  #hud .stat { min-width:32px; }
  #hud .stats { gap:3px; }
  #hud .stat b { font-size:17px; }
  #hud .actions { gap:3px; }
  #hud .sep { display:none; }
  #hud .action-item button { padding:6px 4px; font-size:10px; }
  #hud button.dir { width:20px; }
  #hud .face-pad { grid-template-columns:repeat(3,20px); }
  #hud .brand-sub { display:none; }
  #hud .brand { font-size:14px; }
}
@media(max-width:800px){#hud{grid-template-columns:auto auto 108px;}#hud .hud-brand{display:none;}}

/* 道具计数与骰子嵌在原顶栏内，不增加高度。 */
#hud .hud-brand { position:relative; }
#inventory { display:flex; align-items:center; gap:9px; font-size:10px; color:#a9b39b; line-height:18px; }
#inventory>span:not(:first-child) { display:inline-flex; align-items:center; gap:4px; }
#inventory i { font-style:normal; font-size:17px; color:#d9c489; }
#inventory .armor-icon { color:#a8d9ed; }
#inventory b { color:#f0e4c7; font-size:12px; font-variant-numeric:tabular-nums; }
#hud .brand-sub { font-size:8px; }
#hud #btn-roll { display:flex; align-items:center; gap:4px; }
.die-face { display:inline-block; color:#f4e9cb; text-shadow:0 2px 3px #0008; line-height:1; }
#action-die { font-size:24px; }
#stat-dice { font-size:12px; min-width:8px; }
.die-face.rolling { animation:die-tumble .28s linear infinite; }
@keyframes die-tumble { 0%{transform:rotate(-15deg) translateY(0)}25%{transform:rotate(60deg) translateY(-4px)}75%{transform:rotate(230deg) translateY(2px)}100%{transform:rotate(345deg) translateY(0)} }
#mine-dialog { position:fixed; inset:0; z-index:80; background:#080d09ad; display:grid; place-items:center; backdrop-filter:blur(3px); }
#mine-dialog[hidden] { display:none; }
#mine-dialog section { width:min(380px,90vw); text-align:center; padding:30px 20px; background:radial-gradient(ellipse at top,#414831,#172018 75%); border:1px solid #dac27a; border-radius:14px; box-shadow:0 18px 90px #000a; }
.mine-kicker { color:#d5bd7a; letter-spacing:6px; font-size:12px; }
#mine-title { font-size:23px; margin:13px 0 20px; }
#mine-die { font-size:96px; margin:15px; }
#mine-result { font-size:17px; min-height:26px; color:#f6dd9b; }
#mine-dialog small { font-size:11px; color:#a9b39b; }
.mine-pickup { position:fixed; z-index:85; pointer-events:none; color:#ffe394; font-size:50px; text-shadow:0 0 14px #fff0a6; }
.item-received { animation:item-glow .4s ease-out; }
@keyframes item-glow { 50%{filter:brightness(2);transform:scale(1.3)} }
@media(min-width:1700px){#inventory{position:absolute;right:8px;top:5px;}#hud .hud-brand{padding-right:142px;}}
@media(max-width:1200px){#inventory{gap:5px;font-size:8px;}#inventory i{font-size:14px;}#inventory b{font-size:11px;}}
@media(max-width:800px){#hud .hud-brand{display:block;position:fixed;left:8px;top:6px;width:158px;}#hud .hud-brand .brand,#hud .hud-brand .brand-sub{display:none;}}
@media(prefers-reduced-motion:reduce){.die-face.rolling{animation:none;}}

/* 摩天大亨同款骰子语言：奶油骰面、深绿点数，结果在按钮右侧跳出。 */
#inventory .item-icon { width:28px;height:28px;object-fit:contain;filter:drop-shadow(0 2px 2px #0009); }
#inventory { line-height:22px; }
#hud .roll-action { position:relative;padding-right:29px; }
#hud #btn-roll { position:relative;border:1px solid #ae9253;border-radius:7px; }
#action-die { width:25px;height:25px;transform:rotate(-7deg);filter:drop-shadow(0 2px 1px #0005); }
.die-face svg { display:block;width:100%;height:100%; }
#stat-dice { position:absolute;right:0;top:calc((100% - 12px) / 2);transform:translateY(-50%);width:24px;height:26px;display:grid;place-items:center;border-radius:5px;border:1px solid #a07c3f;background:linear-gradient(#fffdf1,#efc768);color:#714b28;font-size:16px;box-shadow:0 2px 0 #614d2e; }
#stat-dice.dice-ready { animation:dice-result-pop .3s ease-out; }
#stat-dice.dice-rolling { opacity:.5; }
.die-face.rolling { animation:dock-die-tumble .65s ease-in-out infinite; }
#mine-die { width:96px;height:96px;filter:drop-shadow(0 5px 5px #0006); }
.mine-pickup { width:62px;height:62px;object-fit:contain;filter:drop-shadow(0 0 12px #f5d67b); }
@keyframes dock-die-tumble { 0%,100%{transform:rotate(-7deg)}25%{transform:rotate(20deg) translateY(-4px)}75%{transform:rotate(-20deg) translateY(1px)} }
@keyframes dice-result-pop { 0%{opacity:.2;transform:translateY(-50%) scale(.42)}65%{opacity:1;transform:translateY(-50%) scale(1.2)}100%{transform:translateY(-50%) scale(1)} }
#battle-report { position:fixed;inset:0;z-index:100;display:grid;place-items:center;background:#080e0cee;backdrop-filter:blur(5px); }
#battle-report[hidden] { display:none; }
.report-panel { width:min(880px,94vw);max-height:92dvh;overflow:auto;background:linear-gradient(150deg,#242d24,#121910);border:1px solid #b59a57;border-radius:12px;padding:22px;box-sizing:border-box; }
.report-panel header { display:flex;align-items:center;justify-content:space-between;gap:12px; }
.report-panel h2 { margin:4px 0 8px;font-size:26px;color:#ead39c; }
.report-panel small { font-size:9px;letter-spacing:3px;color:#a99b73; }
#battle-report-summary { font-size:12px;color:#d0c6a6;padding-bottom:12px;border-bottom:1px solid #65705866; }
#battle-report-body { display:grid;grid-template-columns:1fr 1fr;gap:24px; }
#battle-report-body h3 { font-size:16px;margin:8px 0; }
#battle-report-body table { width:100%;border-collapse:collapse;font-size:12px; }
#battle-report-body th,#battle-report-body td { padding:7px 5px;text-align:right;border-bottom:1px solid #64715340;font-variant-numeric:tabular-nums; }
#battle-report-body th { color:#a7b291;font-size:10px; }
#battle-report-body th:first-child,#battle-report-body td:first-child { text-align:left; }
#battle-report-body td:nth-child(2) { color:#a9b39b;font-size:10px; }
.report-panel footer { color:#929d85;font-size:10px;line-height:1.7;margin-top:16px; }
@media(max-width:650px){#battle-report-body{grid-template-columns:1fr;}.report-panel{padding:14px;}}
@media(prefers-reduced-motion:reduce){.die-face.rolling,#stat-dice.dice-ready{animation:none;}}

/* 结算页：左侧本局战绩，右侧线下桌游邀请；购买地址留在 config.js。 */
.victory-shade { background:linear-gradient(90deg,#080e0df0,#0c1513d6 45%,#10161088),linear-gradient(0deg,#070c0bbd,transparent 50%); }
.victory-content { width:37%; }
.tabletop-invitation { position:absolute;top:76px;bottom:58px;right:4%;width:46%;display:flex;flex-direction:column;background:#161f17f5;border:1px solid #d8ba6c75;border-radius:10px;overflow:hidden;box-shadow:0 12px 38px #0007; }
.tabletop-picture { position:relative;flex:1 1 auto;min-height:100px;overflow:hidden;background:#302e1c; }
.tabletop-picture img { display:block;width:100%;height:100%;object-fit:cover;object-position:center 53%; }
.tabletop-picture:after { content:'';position:absolute;inset:0;box-shadow:inset 0 -32px 35px -24px #161f17;pointer-events:none; }
.tabletop-picture>span { position:absolute;right:10px;bottom:8px;z-index:1;font-size:9px;color:#e0dccb;background:#10181088;padding:3px 5px;border-radius:3px; }
.tabletop-copy { flex:0 0 auto;padding:20px 24px 15px; }
.tabletop-eyebrow { color:#c8ad65;font-size:10px;letter-spacing:3px; }
.tabletop-copy h3 { font-size:clamp(20px,2vw,28px);color:#f6e8bf;margin:8px 0 10px;line-height:1.3; }
.tabletop-copy p { font-size:13px;line-height:1.8;color:#c5cebb;margin:0 0 16px; }
.physical-game-cta { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border:1px solid #f6dc91;border-radius:5px;background:linear-gradient(120deg,#f3dfac,#ceaf63);box-shadow:0 3px 0 #776033,0 4px 20px #d5b76c1c;color:#26301e;text-decoration:none;font-size:17px;font-weight:700;letter-spacing:.5px;cursor:pointer;transition:filter .2s,transform .2s; }
.physical-game-cta small { display:block;font-size:10px;font-weight:400;margin-top:3px;color:#575b39;letter-spacing:1px; }
.physical-game-cta>b { font-size:27px;font-weight:400; }
.physical-game-cta[href]:hover { filter:brightness(1.1);transform:translateY(-1px); }
.physical-game-cta:focus-visible { outline:2px solid white;outline-offset:4px; }
.physical-game-cta[aria-disabled="true"] { cursor:default; }
#physical-game-note { display:block;text-align:center;font-size:9px;color:#9ca588;margin-top:10px; }
@media(max-height:740px){.tabletop-invitation{top:60px;bottom:40px;}.tabletop-copy{padding:12px 17px 10px;}.tabletop-copy h3{font-size:21px;margin:6px 0;}.tabletop-copy p{font-size:12px;line-height:1.65;margin-bottom:10px;}.physical-game-cta{padding:9px 13px;font-size:15px;}#physical-game-note{margin-top:7px;}.victory-emblem{width:65px;height:53px;}}
@media(max-width:750px){.victory-scene{height:94dvh;overflow-y:auto;min-height:0;}.victory-topline{position:relative;top:auto;left:auto;right:auto;margin:20px 6%;}.victory-content{position:relative;top:auto;left:auto;transform:none;width:auto;max-width:none;margin:18px 6%;}.victory-emblem,.victory-kicker,.victory-footer,.victory-bottomline{display:none;}#result-title{font-size:32px;}#result-desc{margin:8px 0 12px;max-width:none;}.victory-stats{margin-bottom:14px;padding-top:10px;}.victory-stats strong{font-size:22px;}.tabletop-invitation{position:relative;inset:auto;width:auto;margin:20px 6%;}.tabletop-picture{height:155px;flex:none;}.tabletop-copy{padding:15px;}.tabletop-copy h3{font-size:22px;}}

/* 点数留在掷骰按钮内，只保留金色数字；翻滚与结果分开显示。 */
#hud .roll-action { padding-right:0; }
.roll-controls { display:flex;align-items:stretch;gap:4px; }
#hud #btn-auto-roll { padding:4px 6px;font-size:11px; }
#btn-auto-roll[aria-pressed="true"] { color:#ffe49b;border-color:#d8bd73;background:#60512c;box-shadow:inset 0 0 0 1px #ddbd5544; }
#stat-dice { position:static;transform:none;width:auto;min-width:13px;height:auto;display:inline-block;border:0;border-radius:0;background:none;box-shadow:none;color:#efca6b;font-size:18px;font-weight:750;line-height:1;margin-left:3px; }
#stat-dice.dice-ready,#stat-dice.dice-rolling { animation:none;opacity:1; }
#hud #btn-roll:disabled { opacity:1;color:#72786a;background:#25291f;border-color:#615f45; }
#hud #btn-roll:disabled #action-die:not(.rolling) { opacity:.5; }
#hud .stat label { display:flex;align-items:center;justify-content:center;gap:4px; }
.hud-stat-icon { width:16px;height:16px;flex:none;color:#cbb570;overflow:visible; }
.hud-stat-icon.red { color:#e77060; }
.hud-stat-icon.blue { color:#7eaff1; }
@media(max-width:1200px){.hud-stat-icon{width:12px;height:12px;}#hud .stat label{gap:2px;}}

/* 品牌区不再吞掉整段空白，宽屏五项战况平均分配剩余空间。 */
#inventory { position:static;gap:9px; }
#hud .hud-brand { padding-right:0; }
@media(min-width:1501px){
  #hud { grid-template-columns:minmax(230px,300px) minmax(290px,1fr) auto 142px;gap:clamp(10px,1vw,22px); }
  #hud .stats { display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:clamp(8px,1.2vw,26px); }
  #hud .stat { min-width:0;text-align:center; }
  #hud .actions { gap:clamp(5px,.55vw,13px); }
}
#hud #stat-side.red { color:#e84f43; }
#hud #stat-side.blue { color:#79a9ee; }

/* 被困时标出可以立即执行的操作；减少动态偏好保留静态金边。 */
@property --blocked-angle{syntax:'<angle>';initial-value:0deg;inherits:false}
button.blocked-ready:not(:disabled){position:relative;border-color:#ebce74!important;box-shadow:0 0 10px #d4ac3544}
button.blocked-ready:not(:disabled)::after{content:'';position:absolute;inset:-2px;border-radius:inherit;padding:2px;pointer-events:none;background:conic-gradient(from var(--blocked-angle),#80672033 0deg,#ffe59b 70deg,#80672033 120deg,#ffe59b 250deg,#80672033 300deg);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask-composite:exclude;animation:blocked-border-lap 1.6s linear infinite}
@keyframes blocked-border-lap{to{--blocked-angle:360deg}}
@media(prefers-reduced-motion:reduce){button.blocked-ready::after{animation:none!important}}
#kill-announcement{position:fixed;z-index:90;left:50%;top:16%;width:min(430px,65vw);transform:translateX(-50%);pointer-events:none;text-align:center;filter:drop-shadow(0 7px 16px #0009)}
#kill-announcement img{width:100%;height:auto;display:block}#kill-caption{display:inline-block;margin-top:-3px;background:#142319e8;border:1px solid #a6965555;border-radius:4px;padding:4px 14px;font-size:12px;letter-spacing:1px;color:#f7ddb1}
body.versus-active>#kill-announcement{display:block!important}#kill-announcement[hidden],body.versus-active>#kill-announcement[hidden]{display:none!important}
