/* Colours the 战略地图 changes with the season (body[data-season], below); registered so they can ease as the month turns. */
@property --panel { syntax: "<color>"; inherits: true; initial-value: rgba(22, 15, 10, .9); }
@property --lacquer { syntax: "<color>"; inherits: true; initial-value: #1a120c; }
@property --lacquer2 { syntax: "<color>"; inherits: true; initial-value: #24180f; }
@property --gold2 { syntax: "<color>"; inherits: true; initial-value: #8a6a34; }
@property --rule { syntax: "<color>"; inherits: true; initial-value: #5a4428; }
@property --btn-a { syntax: "<color>"; inherits: true; initial-value: #3a2a1a; }
@property --btn-b { syntax: "<color>"; inherits: true; initial-value: #24180f; }
@property --btn-hi-a { syntax: "<color>"; inherits: true; initial-value: #4c3820; }
@property --btn-hi-b { syntax: "<color>"; inherits: true; initial-value: #2c1e12; }
@property --btn-on { syntax: "<color>"; inherits: true; initial-value: #5a3a1c; }
@property --tag-bg { syntax: "<color>"; inherits: true; initial-value: #120c08b8; }
@property --th-bg { syntax: "<color>"; inherits: true; initial-value: #1e150d; }
@property --menu-bg { syntax: "<color>"; inherits: true; initial-value: rgba(14, 10, 8, .92); }
:root {
  /* As their @property values above, for browsers without @property (Safari before 16.4, Firefox before 128). The seasons' rules on body win by inheritance. tests/seasonui.test.mjs keeps the two the same. */
  --panel: rgba(22, 15, 10, .9); --lacquer: #1a120c; --lacquer2: #24180f; --gold2: #8a6a34; --rule: #5a4428; --btn-a: #3a2a1a; --btn-b: #24180f; --btn-hi-a: #4c3820; --btn-hi-b: #2c1e12; --btn-on: #5a3a1c; --tag-bg: #120c08b8; --th-bg: #1e150d; --menu-bg: rgba(14, 10, 8, .92);
  --ink: #f3e9d2; --dim: #b9aa8c; --gold: #d8b46a; --red: #c8402f; --atk: #5fa8ff; --def: #ff7a62; --good: #8fd46a; --bad: #ff8a70;
  --serif: "Noto Serif SC", "Songti SC", serif; --brush: "Ma Shan Zheng", "Noto Serif SC", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0c0907; color: var(--ink); font: 16px/1.55 var(--serif); }
#stage canvas { display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
body[data-screen=title] .labels, body[data-screen=setup] .labels { display: none; }
#ui, #ui-top { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > *, #ui-top > * { pointer-events: auto; }
#ui-top { z-index: 11; }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .45s; z-index: 50; } #fade.on { opacity: 1; }
button { font: inherit; color: var(--ink); cursor: pointer; }
.btn { background: linear-gradient(var(--btn-a), var(--btn-b)); border: 1px solid var(--gold2); box-shadow: inset 0 0 0 1px #00000080, 0 0 0 1px #0008; padding: 6px 14px; border-radius: 3px; letter-spacing: 1px; transition: .12s; }
.btn:hover:not(:disabled) { border-color: var(--gold); background: linear-gradient(var(--btn-hi-a), var(--btn-hi-b)); color: #fff4d8; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(#8a2c1e, #5a1a10); border-color: #e0a060; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(#a8382a, #6a2014); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .level:focus-visible, .ruler:focus-visible, .off:focus-visible { outline: 2px solid #ffd890; outline-offset: 2px; }
.panel.modal:focus { outline: none; } /* it holds the focus only so Tab starts inside it (ui.js modal) */
.btn kbd { margin-left: 6px; padding: 0 4px; border: 1px solid #ffffff30; border-radius: 2px; font: 13px/1.4 var(--serif); color: var(--dim); vertical-align: 1px; }
.btn.primary kbd { color: #ffd8b8; border-color: #ffd8b860; }
.btn.icon { min-width: 34px; padding: 6px 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Panels: lacquer with a double gold rule */
.panel { position: absolute; background: var(--panel); border: 1px solid var(--gold2); border-radius: 4px;
  box-shadow: inset 0 0 0 3px var(--lacquer), inset 0 0 0 4px var(--rule), 0 6px 24px #000a; backdrop-filter: blur(3px); }
.panel h2, .panel h3 { margin: 0; font-weight: 900; }

/* ---------- The 战略地图's UI through the year: 春 willow, 夏 dark jade, 秋 russet, 冬 frost. Still dark lacquer under
   the same ink and gold text, so only the hue moves; the months as the 季节 chip counts them (app.js seasonUi). The war
   and every other screen keep the lacquer of :root. ---------- */
body[data-screen=strategy][data-season=s0] { --th-bg: #222c16; --panel: rgba(24, 30, 16, .9); --lacquer: #1a2212; --lacquer2: #242e18; --gold2: #8f9a4e; --rule: #5a6838; --btn-a: #364422; --btn-b: #242e18; --btn-hi-a: #485a2c; --btn-hi-b: #2c381c; --btn-on: #586e30; --tag-bg: #141a0cb8; --menu-bg: rgba(16, 20, 10, .92); }
body[data-screen=strategy][data-season=s1] { --th-bg: #122a2c; --panel: rgba(12, 28, 30, .9); --lacquer: #0e2024; --lacquer2: #142c30; --gold2: #4f8a80; --rule: #386058; --btn-a: #1e3e40; --btn-b: #142c30; --btn-hi-a: #2a5052; --btn-hi-b: #183438; --btn-on: #33706e; --tag-bg: #0a181ab8; --menu-bg: rgba(8, 18, 20, .92); }
body[data-screen=strategy][data-season=s2] { --th-bg: #2a1a0a; --panel: rgba(34, 20, 8, .9); --lacquer: #241508; --lacquer2: #301c0a; --gold2: #a87830; --rule: #6a4a20; --btn-a: #4a2e12; --btn-b: #301c0a; --btn-hi-a: #5e3c18; --btn-hi-b: #38220e; --btn-on: #80521f; --tag-bg: #1a0e04b8; --menu-bg: rgba(22, 13, 5, .92); }
body[data-screen=strategy][data-season=s3] { --th-bg: #1a222c; --panel: rgba(20, 26, 34, .9); --lacquer: #141a22; --lacquer2: #1c2430; --gold2: #7f93a8; --rule: #4e5e70; --btn-a: #2e3a4a; --btn-b: #1c2430; --btn-hi-a: #3e4c60; --btn-hi-b: #222c3a; --btn-on: #465a74; --tag-bg: #0e131ab8; --menu-bg: rgba(13, 17, 23, .92); }
/* Over the map's own 2.5 s turn of the month (strategy.js setSeason); on the body, because the HUD is rebuilt on every change. */
body.season-turning { transition: --panel 2.5s, --lacquer 2.5s, --lacquer2 2.5s, --gold2 2.5s, --rule 2.5s, --btn-a 2.5s, --btn-b 2.5s, --btn-hi-a 2.5s, --btn-hi-b 2.5s, --btn-on 2.5s, --tag-bg 2.5s, --th-bg 2.5s, --menu-bg 2.5s; }

/* ---------- Title ---------- */
.title-wrap { position: absolute; inset: 0; z-index: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, transparent 30%, #000c 90%); }
.title-wrap > * { pointer-events: auto; }
.logo { font: 120px/1 var(--brush); color: #fff3d6; letter-spacing: 6px; text-shadow: 0 0 2px #000, 0 6px 0 #4a1408, 0 0 40px #f6a03c88, 0 0 120px #f6a03c44; }
.logo-sub { margin-top: 14px; padding: 4px 22px; font: 600 18px var(--serif); letter-spacing: 12px; color: #ffe2a0; text-shadow: 0 2px 6px #000; background: linear-gradient(90deg, transparent, #000a 20%, #000a 80%, transparent); }
.title-wrap .logo, .title-wrap .logo-sub { transition: opacity .4s; } .fonts-pending .logo, .fonts-pending .logo-sub { opacity: 0; }
.title-art { position: absolute; inset: 0; background-size: cover; background-position: center; pointer-events: none; animation: kenburns 40s ease-in-out infinite alternate; }
.title-wrap .title-art { z-index: -1; }
.title-wrap::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 38%, #0000 20%, #0006 60%, #000c 100%), linear-gradient(#0008, #0000 30%, #0000 70%, #000a); pointer-events: none; }
@keyframes kenburns { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.12) translate(-2%, -1%); } }
.menu { margin-top: 56px; display: flex; flex-direction: column; gap: 12px; min-width: 260px; }
.menu .btn { font-size: 20px; padding: 10px 26px; letter-spacing: 8px; background: linear-gradient(#2a1d12e8, #160f09e8); }
.menu .btn small { display: block; font-size: 14px; letter-spacing: 2px; color: var(--dim); margin-top: 2px; }
.menu .btn:hover:not(:disabled), .menu .btn:focus-visible { box-shadow: inset 0 0 0 1px #00000080, 0 0 24px #f6a03c55; }
.footnote { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--dim); font-size: 14px; text-shadow: 0 1px 2px #000; }

/* Title after the FC opening (src/titlescreen.js): lettering on black, the band between two blue rules. */
.tt { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #1a1410 0%, #060504 70%, #000 100%); }
.tt-stage { position: absolute; inset: 0; }
.tt-canvas { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; filter: drop-shadow(0 6px 10px #000c); transition: filter 1.2s; }
.tt.struck .tt-canvas { filter: drop-shadow(0 6px 10px #000c) drop-shadow(0 0 22px #f6a03c40); }
.tt-flash { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 22%, #fff 0%, #fff4dc 45%, #ffcf9a 100%); opacity: 0; pointer-events: none; z-index: 5; mix-blend-mode: screen; }
.tt-sub { position: absolute; z-index: 3; font-weight: 900; font-family: var(--serif); letter-spacing: .18em; color: #fff; line-height: 1;
  text-shadow: 0 0 1px #000, 2px 2px 0 #1a0402, -1px -1px 0 #1a0402, 1px -1px 0 #1a0402, -1px 1px 0 #1a0402, 0 4px 12px #000;
  clip-path: inset(0 100% 0 0); transition: clip-path .7s cubic-bezier(.3,.6,.3,1); }
.tt.sub-on .tt-sub { clip-path: inset(0 0 0 0); }
/* The band opens from its centre line once the two blue rules have run out to the edges. */
.tt-band { position: absolute; left: 0; right: 0; top: var(--band-top); height: var(--band-h); z-index: 1; }
.tt-band::before, .tt-band::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #0000, #46b4ff 12%, #9ad8ff 50%, #46b4ff 88%, #0000); box-shadow: 0 0 10px #46b4ff88;
  transform: scaleX(0); transition: transform .45s cubic-bezier(.2,.7,.2,1), top .6s cubic-bezier(.3,.6,.2,1) .4s, bottom .6s cubic-bezier(.3,.6,.2,1) .4s; z-index: 2; }
.tt-band::before { top: 50%; } .tt-band::after { bottom: 50%; }
.tt.band-on .tt-band::before { transform: none; top: -6px; } .tt.band-on .tt-band::after { transform: none; bottom: -6px; }
.tt-band-img, .tt-sun, .tt-motes { position: absolute; inset: 0; clip-path: inset(50% 0 50% 0); transition: clip-path .6s cubic-bezier(.3,.6,.2,1) .4s; }
.tt.band-on :is(.tt-band-img, .tt-sun, .tt-motes) { clip-path: inset(0 0 0 0); }
.tt-band-img { background: url(../assets/ai/title-band.webp) center 58% / cover; animation: tt-pan 38s ease-in-out infinite alternate; }
.tt-sun { background: radial-gradient(ellipse 30% 70% at 4% 30%, #ffe2a070, #0000 70%), linear-gradient(#0000 60%, #1a0a0440); mix-blend-mode: screen; animation: tt-sun 7s ease-in-out infinite alternate; pointer-events: none; }
.tt-motes { background-image: radial-gradient(1.5px 1.5px at 20% 70%, #ffe0a0c0, #0000), radial-gradient(1px 1px at 63% 40%, #ffe0a0a0, #0000), radial-gradient(1.5px 1.5px at 82% 76%, #ffe0a0b0, #0000), radial-gradient(1px 1px at 41% 58%, #ffe0a090, #0000);
  background-size: 260px 140px; animation: tt-drift 16s linear infinite; pointer-events: none; }
@keyframes tt-pan { from { background-position: 30% 58%; } to { background-position: 70% 58%; } }
@keyframes tt-sun { from { opacity: .7; } to { opacity: 1; } }
@keyframes tt-drift { to { background-position: 260px -140px; } }
.tt-press { position: absolute; left: 0; right: 0; z-index: 3; text-align: center; font: 600 18px var(--serif); letter-spacing: 6px; color: #ffe2a0; text-shadow: 0 2px 4px #000; opacity: 0; pointer-events: none; }
.tt-press.on { animation: blink 1.6s ease-in-out infinite; opacity: 1; }
/* The boot splash (src/bootsplash.js) covers everything, the fade included, until the title takes over. */
.boot { position: fixed; inset: 0; z-index: 60; background: #000; cursor: pointer; }
.boot canvas { display: block; width: 100%; height: 100%; }
.boot-press { position: absolute; left: 0; right: 0; top: 50%; text-align: center; font: 600 18px var(--serif); letter-spacing: 6px; color: #ffe2a0; text-shadow: 0 2px 4px #000; opacity: 0; pointer-events: none; }
.boot-press.on { animation: blink 1.6s ease-in-out infinite; opacity: 1; }
.tt-menu { position: absolute; left: 50%; transform: translate(-50%, 10px); z-index: 3; display: flex; flex-direction: column; gap: 10px; min-width: 260px; opacity: 0; pointer-events: none; transition: opacity .6s, transform .6s; }
.tt.menu-on .tt-menu { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.tt-menu .btn { font-size: 20px; padding: 9px 26px; letter-spacing: 8px; background: linear-gradient(#2a1d12e8, #160f09e8); }
.tt-menu .btn small { display: block; font-size: 14px; letter-spacing: 2px; color: var(--dim); margin-top: 2px; }
/* With saves in several slots: 继续记录 across the top, 读取记录 and 新的征程 side by side, so the menu stays as tall as two rows. */
.tt-menu:has(> :nth-child(3)) { display: grid; grid-template-columns: 1fr 1fr; min-width: min(440px, calc(100vw - 32px)); }
.tt-menu:has(> :nth-child(3)) > :first-child { grid-column: 1 / -1; }
/* A suspended battle plus several records: two continue buttons above load / new, still only two rows. */
.tt-menu:has(> :nth-child(4)) > :first-child { grid-column: auto; }
.tt-menu:has(> :nth-child(3)) > :not(:first-child) { letter-spacing: 6px; }
.tt-menu .btn:hover:not(:disabled), .tt-menu .btn:focus-visible { box-shadow: inset 0 0 0 1px #00000080, 0 0 24px #f6a03c55; }
.tt-foot { position: absolute; bottom: 12px; left: 16px; right: 16px; text-align: center; color: var(--dim); text-shadow: 0 1px 2px #000; opacity: 0; transition: opacity .8s; z-index: 3; pointer-events: none; }
.tt-foot p { margin: 4px 0 0; font-size: 12px; line-height: 1.45; }
.tt-foot .free { font-size: 15px; letter-spacing: .12em; color: #f0d9a8; }
.tt-foot .free span { display: inline-block; }
.tt-foot .maker { font-size: 14px; letter-spacing: .06em; color: var(--ink); }
.tt-foot small { font-size: .85em; color: var(--dim); }
.tt.menu-on .tt-foot { opacity: 1; }
.tt .sysbtns { opacity: 0; transition: opacity .8s; } .tt.menu-on .sysbtns { opacity: 1; }
.tt.instant *, .tt.instant *::before, .tt.instant *::after { transition: none !important; }

/* ---------- Setup ---------- */
.setup { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 56px 16px 0; overflow-y: auto; overscroll-behavior: contain; background: radial-gradient(ellipse at center, #000a, #000e); }
/* Centre when it fits, scroll from the top when it does not (auto margins never push content off-screen). */
.setup > :first-child { margin-top: auto; }
.setup-foot { position: sticky; bottom: 0; margin-bottom: auto; display: flex; gap: 10px; justify-content: center; width: 100%; padding: 14px 0 18px; background: linear-gradient(transparent, #000c 40%); }
.setup h2 { font: 44px var(--brush); letter-spacing: 6px; color: #fff3d6; text-shadow: 0 4px 0 #4a1408; margin: 0; }
.levels { display: flex; gap: 14px; }
.level { position: relative; width: 214px; padding: 14px 12px; text-align: center; cursor: pointer; }
.level b { font-size: 15px; display: block; color: var(--gold); letter-spacing: 3px; }
.level .lv-name { display: block; font: 28px/1.2 var(--brush); color: #fff3d6; letter-spacing: 6px; margin: 2px 0 4px; }
.level small { color: var(--dim); font-size: 14px; }
.level:hover:not(.on) { border-color: var(--gold); }
.cheat { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 6px; border: 1px dashed #8a6a3480; border-radius: 3px; background: #0006; color: var(--dim); font: 14px var(--serif); letter-spacing: 1px; cursor: pointer; }
.cheat i { width: 10px; height: 10px; border: 1px solid var(--gold2); border-radius: 2px; }
.cheat:hover { color: var(--ink); border-color: var(--gold); }
.cheat.on { color: #ffe2a0; border-style: solid; border-color: #ffd890; background: #3a2208c0; box-shadow: 0 0 12px #ffb34a55; }
.level .cheat { width: 100%; margin-top: 8px; }
.setup .opt { padding: 7px 18px; font-size: 15px; letter-spacing: 2px; margin-top: -8px; }
/* Five options on one row from 1280 wide (a second row pushes the ruler cards under 返回/开始 at 1280×800). */
.setup-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.setup-opts .opt { padding: 7px 11px; font-size: 14px; letter-spacing: 1px; }
.cheat.on i { background: #ffd890; box-shadow: inset 0 0 0 2px #3a2208; }
.level.on, .ruler.on { border-color: #ffd890; box-shadow: inset 0 0 0 3px var(--lacquer), inset 0 0 0 4px #ffd890, 0 0 26px #ffb34a66; }
.rulers { display: grid; grid-template-columns: repeat(7, minmax(0, 150px)); justify-content: center; width: min(100%, 1122px); gap: 12px; }
.ruler { position: relative; height: 300px; overflow: hidden; cursor: pointer; transition: transform .18s cubic-bezier(.2,.9,.3,1.2), box-shadow .18s, filter .18s; }
.rulers:has(.ruler.on) .ruler:not(.on):not(:hover) { filter: brightness(.62) saturate(.7); }
.ruler:hover, .ruler.on { transform: translateY(-6px); }
.ruler::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c); z-index: 1; }
.ruler img { width: 100%; height: 230px; object-fit: cover; object-position: 50% 10%; display: block; transition: transform .4s ease; }
.ruler:hover img, .ruler.on img { transform: scale(1.04); }
.ruler .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 10px 8px; background: linear-gradient(transparent, #000d 34%); }
.ruler b { font: 26px/1.1 var(--brush); letter-spacing: 3px; color: #fff3d6; text-shadow: 0 2px 6px #000; }
.ruler small { display: block; color: var(--dim); font-size: 14px; line-height: 1.45; }
.ruler small.towns { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }
.ruler .rstat { display: flex; gap: 8px; font-size: 14px; color: var(--dim); margin: 2px 0 1px; } .ruler .rstat em { font-style: normal; color: var(--ink); font-weight: 600; margin-left: 2px; }
.ruler .chip { position: absolute; top: 10px; left: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #0008, 0 0 10px var(--c); }
.ruler.on::after { content: '✓'; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 900 15px/1 var(--serif); color: #1a1009; background: #ffd890; box-shadow: 0 0 0 2px #1a120c, 0 0 14px #ffb34a; }

/* ---------- Strategy HUD ---------- */
.topbar { top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 6px 18px; white-space: nowrap; }
.topbar .date { font: 22px var(--brush); color: #fff3d6; }
.topbar .who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.topbar .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px #0008; }
.books { display: flex; gap: 3px; } .books i { width: 9px; height: 14px; background: linear-gradient(#f2d48c, #a8803c); border-radius: 1px; box-shadow: 0 0 0 1px #0008; }
.books i.used { background: #3a2c1e; }
.res { display: flex; gap: 12px; color: var(--dim); font-size: 15px; } .res b { color: var(--ink); font-weight: 600; }
.citypanel { top: var(--hud-top, 70px); left: 12px; width: 340px; max-height: calc(100% - 160px); display: flex; flex-direction: column; overflow-y: auto; }
.citypanel header { padding: 12px 14px 8px; display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid color-mix(in srgb, var(--rule) 50.2%, transparent); }
.citypanel header h2 { font: 30px var(--brush); letter-spacing: 3px; }
.citypanel header .owner { font-size: 15px; padding: 1px 8px; border-radius: 2px; color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 10px; padding: 8px 14px; font-size: 15px; }
.stats div { display: flex; justify-content: space-between; } .stats span { color: var(--dim); }
.facs { padding: 0 14px 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.facs i { font-style: normal; font-size: 14px; padding: 1px 6px; border: 1px solid var(--gold2); border-radius: 2px; color: var(--gold); }
.searchnote { margin: 0; padding: 0 14px 8px; }
.talentnote { margin: 0 8px 8px; padding: 5px 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; line-height: 1.5; border: 1px solid color-mix(in srgb, var(--rule) 40%, transparent); border-radius: 3px; background: #ffffff06; cursor: pointer; transition: background .12s, border-color .12s; }
.talentnote:hover, .talentnote:focus-visible { background: #ffffff10; border-color: var(--gold2); outline: none; }
.talentnote .k { color: var(--gold); font-weight: 600; } .talentnote b { color: var(--ink); font-weight: 600; } .talentnote .bad { color: var(--bad); }
.talentnote { flex-wrap: nowrap; } .talentnote .parts { flex: 1; display: flex; flex-wrap: wrap; gap: 0 1em; } .talentnote .parts > span { white-space: nowrap; }
.talentnote .go { color: var(--gold); font-size: 13px; white-space: nowrap; }
.topbar .wikibtn, .topbar .roadsbtn, .topbar .terrbtn { padding: 2px 12px; font-size: 15px; }
.topbar .tbtns { display: flex; column-gap: inherit; } /* the view buttons wrap together */
.topbar .roadsbtn.on, .topbar .terrbtn.on { color: #2a1606; background: linear-gradient(#ffe6a0, #e0b860); border-color: #ffe6a0; box-shadow: 0 0 10px #ffd87877; }
/* 人物志: the whole cast in one sortable table with search and filters. */
.modal:has(> .wiki) { max-width: min(1060px, 96vw); width: min(1060px, 96vw); }
.wikibar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.wikistates .btn { min-width: 0; font-size: 16px; padding: 3px 12px; } .wikistates .btn small { margin-left: 5px; font-size: 12px; color: var(--dim); }
.wikibar select, .wikibar input { font: inherit; font-size: 15px; background: #0006; color: inherit; border: 1px solid var(--rule); border-radius: 3px; padding: 4px 6px; }
.wikibar input { width: 9em; } .wikibar input:focus, .wikibar select:focus { outline: none; border-color: var(--gold); }
.wiki .otable-wrap { height: min(60vh, 620px); max-height: none; } /* fixed, so filtering never resizes the dialog */
.wikitable th.tx, .wikitable td.tx { text-align: left; }
.wikitable td.nm em { margin-left: 6px; }
.wikitable .fac { display: inline-flex; align-items: center; gap: 6px; } .wikitable .fac .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px #0008; }
.wikitable .dim { color: var(--dim); }
.wikitable td.src { color: #d8ccb4; } .wikitable td.src em { font-style: normal; font-size: 13px; margin-left: 8px; padding: 0 5px; border-radius: 2px; color: var(--dim); border: 1px solid #ffffff1c; }
.wikitable td.src em.go { color: #1a1009; background: var(--good); border-color: transparent; } .wikitable td.src em.bad { color: var(--bad); border-color: #ff8a7055; }
.wikitable td.src small { margin-left: 8px; font-size: 13px; color: var(--gold); }
.wikitable tr.dead td { color: #8a806c; } .wikitable tr.dead img { filter: grayscale(1) brightness(.7); }
.wikitable tr.yet img { filter: brightness(.75) saturate(.6); }
.wikitable tr.none td { text-align: center; color: var(--dim); padding: 18px; cursor: default; }
.wiki .foot .count { color: var(--dim); }
.roster-tip { display: none; margin: 4px 14px 0; font-size: 13px; } body[data-input=pad] .roster-tip { display: block; }
.roster { overflow-y: auto; padding: 4px 8px 10px; flex: 1; min-height: 116px; } /* two rows at least: a short window scrolls the whole panel (.citypanel) instead */
.off { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 3px; cursor: pointer; }
.off:hover, .off.on { background: #ffffff10; }
.off img { width: 40px; height: 48px; object-fit: cover; object-position: 50% 12%; border: 1px solid var(--rule); border-radius: 2px; background: #000; }
.off .nm { font-weight: 600; } .off .nm em { font-style: normal; font-size: 14px; color: var(--gold); margin-left: 4px; }
.off .sub { display: grid; grid-template-columns: repeat(4, max-content); gap: 0 7px; font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.off .sub b { font-weight: 500; color: #d8ccb4; margin-left: 1px; }
.off .tr { text-align: right; font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; } .off .tr b { color: var(--ink); font-size: 16px; }
.hint.count b { color: var(--gold); }
/* placeStrategyHud (app.js) moves `left` out of the city panel's way; max-content so a left past the middle never squeezes the buttons onto two rows */
.dock { bottom: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px); padding: 8px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 6px; }
.tabs .btn { min-width: 64px; font-size: 18px; } .tabs .btn.on { border-color: #ffd890; color: #fff4d8; background: linear-gradient(var(--btn-on), var(--btn-hi-b)); }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 720px; }
.acts .btn { min-width: 64px; } .acts .btn small.free { margin-left: 4px; font-size: 14px; color: var(--good); letter-spacing: 0; }
.tabs .btn.dim:not(.on) { opacity: .55; }
/* The command list of the open group (app.js commandDock): above the dock, its notch on the group's button. placeFly
   sets --fly-x (from the dock's left edge) and --fly-caret. --cmd-h and the side it opens on are all a touch layout changes. */
.dock .acts { position: absolute; bottom: calc(100% + 12px); left: var(--fly-x, 0px); width: 330px; max-width: none; padding: 6px; display: grid; gap: 2px; justify-content: stretch; }
.dock .acts[hidden] { display: none; }
.dock .acts::after { content: ''; position: absolute; bottom: -7px; left: calc(var(--fly-caret, 40px) - 6px); width: 12px; height: 12px; background: var(--lacquer); border: solid var(--gold2); border-width: 0 1px 1px 0; transform: rotate(45deg); }
.cmd { display: grid; grid-template-columns: 4.2em 1fr auto; align-items: center; gap: 10px; height: var(--cmd-h, 38px); padding: 0 12px; border: 0; border-radius: 3px; background: none; color: var(--ink); font: inherit; font-size: 18px; letter-spacing: 1px; text-align: left; cursor: pointer; transition: background .12s; }
.cmd + .cmd { border-top: 1px solid #ffffff0d; }
.cmd b { font-weight: 500; white-space: nowrap; }
.cmd small { font-size: 14px; letter-spacing: 0; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd em.free { font-style: normal; font-size: 14px; letter-spacing: 0; color: var(--good); }
.cmd:disabled { cursor: default; } .cmd:disabled b { opacity: .45; } .cmd:disabled small { color: var(--bad); opacity: .85; }
.cmd:hover:not(:disabled), .cmd:focus-visible { background: #ffd8901c; box-shadow: inset 3px 0 0 #ffd890; color: #fff4d8; outline: none; }
/* The still of a command's 命令演出, beside the command list while the command is pointed at; native
   320×213 so the pixel art stays crisp. Never takes clicks, so it cannot cover what the cursor moves to. */
.cmd-preview { position: absolute; bottom: 0; right: calc(100% + 12px); transform: translateX(6px); opacity: 0; pointer-events: none; transition: opacity .14s, transform .14s; filter: drop-shadow(0 8px 18px #000a); }
.cmd-preview.on { opacity: 1; transform: none; }
/* placeFly (app.js): on the list's right where its left has no room, and left out where neither side has */
.cmd-preview.flip { right: auto; left: calc(100% + 12px); transform: translateX(-6px); } .cmd-preview.flip.on { transform: none; }
.cmd-preview.none { display: none; }
.cmd-preview canvas { display: block; width: 320px; height: 213px; } /* half the 640-wide frame: a pixelated reduction would drop strokes */
@media (max-height: 640px) { .cmd-preview { display: none; } }
body:has(.vig-dim) .cmd-preview { display: none; } /* a show is up (from the book's blink on): its picture is not shown twice */
.hint { font-size: 14px; color: var(--dim); }
.logbox { top: 70px; right: 12px; width: 300px; max-height: 42vh; overflow-y: auto; padding: 8px 12px; font-size: 14px; }
.logbox p { margin: 3px 0; border-bottom: 1px dashed #ffffff10; padding-bottom: 3px; } .logbox em { color: var(--bad); font-style: normal; } .logbox strong { color: var(--good); font-weight: 600; }
.rightcol { position: fixed; top: var(--hud-top, 70px); right: 12px; width: 300px; max-height: calc(100% - 140px); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.rightcol > * { pointer-events: auto; }
.rightcol > .panel { position: relative; top: auto; right: auto; width: auto; }
.rightcol > .logbox { max-height: 42vh; flex: 0 1 auto; }
.endturn { position: fixed; bottom: 12px; right: 12px; }
body.handoff .dock, body.handoff .endturn { pointer-events: none; opacity: .45; filter: saturate(.4); transition: opacity .3s, filter .3s; }
.ctag { position: relative; pointer-events: auto; cursor: pointer; transform: translateY(var(--dy, 0px)) scale(var(--s, 1)); opacity: var(--o, 1); transition: box-shadow .15s, background .15s, opacity .3s; font: 600 13px/1.2 var(--serif); text-align: center; text-shadow: 0 1px 2px #000; padding: 1px 5px 1px; border-radius: 3px; background: var(--tag-bg); box-shadow: inset 0 -2px 0 var(--c), 0 2px 6px #0006; }
.ctag.far small { display: none; }
/* A tag stepped up out of a neighbour's way hangs on a thin leader down to its city (strategy.js update, T14). */
.ctag::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1px; height: var(--lead, 0px); background: linear-gradient(var(--c), #0000); opacity: .85; pointer-events: none; }
/* The city under the pointer, from its model or its tag: the one a click takes. */
.ctag.hov { opacity: 1; background: #4a3214f0; color: #fff4d0; box-shadow: inset 0 -2px 0 var(--c), 0 0 0 2px #ffe890, 0 0 18px #ffe06099; }
.ctag.hov small { display: block; }
.ctag small { display: block; font-size: 12px; font-weight: 400; color: var(--c); filter: brightness(1.45) saturate(.8); }
.ctag.mine { font-weight: 900; color: #fff3d6; box-shadow: inset 0 -2px 0 var(--c), 0 0 0 1px #ffd89070, 0 2px 6px #0006; }
.ctag.news { box-shadow: inset 0 -2px 0 var(--c), 0 0 0 2px var(--news), 0 0 20px var(--news); animation: newsBlink .45s ease-in-out 4 alternate; }
.ctag.news::before { content: attr(data-news); position: absolute; left: 50%; bottom: calc(100% + 4px); z-index: 1; pointer-events: none; transform: translateX(-50%); padding: 1px 8px; border-radius: 3px; white-space: nowrap; font: 17px var(--brush); letter-spacing: 2px; color: #fff4dc; background: #120c08e8; box-shadow: inset 0 -2px 0 var(--news), 0 2px 8px #000a; }
@keyframes newsBlink { from { filter: brightness(1); } to { filter: brightness(1.7); } }
.ctag.hl { background: #3a2610e0; box-shadow: inset 0 -2px 0 var(--c), 0 0 0 2px #ffe060, 0 0 18px #ffe06088; }
/* Map picking: candidate cities glow, the others step back. */
.ctag.cand { opacity: 1; background: #3a2610f0; color: #fff4d0; box-shadow: inset 0 -2px 0 var(--c), 0 0 0 2px #ffd860, 0 0 16px #ffd04a90; animation: candGlow 1.2s ease-in-out infinite alternate; }
.ctag.cand.hl { background: #6a4618f4; box-shadow: inset 0 -2px 0 var(--c), 0 0 0 3px #fff0a0, 0 0 24px #ffe060; }
.ctag.dim { opacity: .28; filter: grayscale(.7); }
@keyframes candGlow { to { box-shadow: inset 0 -2px 0 var(--c), 0 0 0 2px #ffe890, 0 0 26px #ffd04ac0; } }
.mappick { position: fixed; top: 62px; left: 50%; transform: translateX(-50%); z-index: 15; width: max-content; max-width: min(760px, 94vw); padding: 10px 14px 12px; animation: modalIn .22s cubic-bezier(.2,.9,.3,1.1); }
.mappick .mp-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.mappick h4 { font: 22px var(--brush); letter-spacing: 2px; color: #fff3d6; margin: 0; }
.mappick .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mappick .chips .btn small { margin-left: 6px; color: var(--dim); letter-spacing: 0; }
/* While a city is picked on the map the rest of the HUD waits (endTurn() also refuses). */
body.picking #ui > :is(.endturn, .dock, .sysbtns, .citypanel) { opacity: .45; filter: grayscale(.5); }
.btn.ghost { background: transparent; border-color: #8a6a3470; color: var(--dim); }
/* Officer lists: the original's one-line table, numbers in aligned columns. */
.otable-wrap { max-height: min(62vh, 640px); overflow: auto; }
/* Keep both scouting choices in view even when a city has ten officers in a short window. */
.scout-roster { max-height: min(40vh, max(80px, calc(88vh - 280px))); }
.otable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
.otable th { position: sticky; top: 0; z-index: 1; background: var(--th-bg); color: var(--dim); font-weight: 500; text-align: right; padding: 4px 9px; border-bottom: 1px solid #8a6a3466; cursor: pointer; user-select: none; white-space: nowrap; }
.otable th.nm { text-align: left; cursor: default; } .otable th.ck { width: 30px; cursor: default; }
.otable th.on { color: #ffe2a0; } .otable th.on::after { content: '▼'; font-size: 10px; margin-left: 2px; }
.otable td { text-align: right; padding: 2px 9px; border-bottom: 1px solid #ffffff0a; white-space: nowrap; }
.otable td.nm { text-align: left; font-weight: 600; }
.otable td:has(> .gearcell) { text-align: left; font-size: 14px; } .otable .gearcell .eqi { width: 22px; height: 22px; vertical-align: -6px; margin-right: 4px; object-fit: contain; filter: drop-shadow(0 1px 1px #000a); }
.otable td.nm em { font-style: normal; font-weight: 400; font-size: 14px; color: var(--gold); margin-left: 6px; }
.otable td.nm em.why { color: var(--dim); }
.otable td.low { color: var(--bad); }
.otable td.ck { text-align: center; color: #ffd890; font-weight: 900; width: 30px; }
.otable img { width: 26px; height: 30px; object-fit: cover; object-position: 50% 12%; border: 1px solid var(--rule); border-radius: 2px; vertical-align: middle; background: #000; }
.otable td.nm img { margin-right: 8px; }
.otable tbody tr { cursor: pointer; transition: background .1s; }
.otable tbody tr:hover, .otable tbody tr:focus-visible { background: #ffffff12; outline: none; }
.otable tbody tr.on { background: #ffd8901c; box-shadow: inset 3px 0 0 #ffd890; }
.otable tbody tr.off-dis { cursor: default; opacity: .45; }
.otable tbody tr.off-dis:hover { background: none; }
/* 诱纳 / 离间 tree: faction → city → officers. */
.otree { max-height: min(64vh, 680px); overflow: auto; padding-right: 4px; }
.otree details { margin: 2px 0; } .otree summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 3px; }
.otree summary::-webkit-details-marker { display: none; }
.otree summary::before { content: '▸'; color: var(--gold); width: 10px; transition: transform .15s; }
.otree details[open] > summary::before { transform: rotate(90deg); }
.otree summary:hover { background: #ffffff0e; }
.otree summary small { color: var(--dim); margin-left: auto; }
.otree summary em { font-style: normal; font-size: 14px; color: #1a1009; background: #ffd890; padding: 0 5px; border-radius: 2px; }
.otree .tf > summary { font: 600 17px var(--serif); border-bottom: 1px solid #8a6a3455; }
.otree .tf .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px #0008; }
.otree .tc { margin-left: 16px; } .otree .tc > summary { font-weight: 600; color: #f0e2c4; }
.otree .tc .otable { margin: 2px 0 8px 18px; width: calc(100% - 18px); }
/* Season chip beside the date. */
.topbar .season { display: inline-flex; align-items: baseline; gap: 3px; margin-left: 8px; padding: 0 7px; border-radius: 3px; font: 600 16px var(--serif); vertical-align: 3px; color: #1a1009; }
.topbar .season small { font-size: 12px; font-weight: 600; opacity: .75; }
.topbar .season.s0 { background: #f4b4c4; } .topbar .season.s1 { background: #9ad46a; } .topbar .season.s2 { background: #f0a848; } .topbar .season.s3 { background: #dce8f4; }

/* ---------- Modal / dialogs ---------- */
.shade { position: fixed; inset: 0; background: #0008; display: flex; align-items: center; justify-content: center; z-index: 20; animation: shadeIn .18s ease; }
.shade.light { background: #0003; }
.shade > .modal { animation: modalIn .22s cubic-bezier(.2,.9,.3,1.1); }
@keyframes shadeIn { from { opacity: 0; } } @keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal { position: relative; min-width: 360px; max-width: min(760px, 94vw); max-height: 88vh; overflow: auto; padding: 18px 20px; }
.modal h3 { font: 26px var(--brush); letter-spacing: 3px; margin-bottom: 10px; color: #fff3d6; }
.modal .row { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.slots { display: flex; flex-direction: column; gap: 6px; min-width: min(460px, 86vw); }
/* Keep 取消 visible when the ninth (quick) record makes the list taller than a small window. */
.modal:has(> .slots) { display: flex; flex-direction: column; overflow: hidden; }
.modal:has(> .slots) > h3, .modal:has(> .slots) > .foot { flex-shrink: 0; }
.modal:has(> .slots) > .slots { min-height: 0; overflow-y: auto; }
.slots .slot { display: grid; flex: 0 0 auto; grid-template-columns: 4.5em 1fr auto; align-items: baseline; gap: 12px; text-align: left; padding: 8px 14px; }
.slots .slot b { color: var(--gold); letter-spacing: 2px; } .slots .slot small { color: var(--dim); font-size: 13px; }
.slots .slot.empty span { color: var(--dim); } .slots .slot.on { box-shadow: inset 0 0 0 1px var(--gold); }
@media (max-width: 560px) { .slots .slot { grid-template-columns: 4.5em 1fr; row-gap: 2px; } .slots .slot small { grid-column: 2; } }
.modal label { color: var(--dim); min-width: 56px; }
.modal input[type=range] { width: 240px; accent-color: #d8a050; }
.modal .val { min-width: 48px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.modal .amount { width: 4.6em; font: inherit; font-weight: 600; color: var(--ink); background: #0006; border: 1px solid var(--rule); border-radius: 3px; padding: 3px 7px; outline: none; transition: border-color .12s; }
.modal .amount:hover:not(:disabled) { border-color: var(--gold2); } .modal .amount:focus { border-color: var(--gold); box-shadow: 0 0 0 1px #d8b46a50; }
.modal .amount.bad { border-color: var(--bad); color: var(--bad); } .modal .amount:disabled { opacity: .5; }
.btn.mini { padding: 2px 8px; font-size: 14px; letter-spacing: 0; }
.modal .live { margin: 10px 0 0; padding: 8px 10px; border-left: 2px solid var(--gold2); background: #ffffff08; font-size: 15px; }
.live b.good { color: var(--good); } .live b.warn { color: #ffd070; } .live b.bad { color: var(--bad); }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 8px 8px 4px 2px; }
.pick .off { position: relative; border: 1px solid color-mix(in srgb, var(--rule) 37.6%, transparent); transition: background .12s, border-color .12s; }
.pick .off.on { border-color: #ffd890; background: linear-gradient(90deg, #ffd89030, #ffd89010); box-shadow: inset 0 0 0 1px #ffd89060; }
.pick .off.on::after { content: '✓'; position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 900 13px/1 var(--serif); color: #1a1009; background: #ffd890; box-shadow: 0 0 0 2px #1a120c; }
.modal .foot { align-items: center; } .modal .foot .count { font-size: 15px; color: var(--gold); }
.cities { display: flex; gap: 6px; flex-wrap: wrap; }
.cities .btn.on { border-color: #ffd890; color: #fff4d8; }
.msg { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); width: min(820px, 94vw); display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 18px; z-index: 30; cursor: pointer; animation: rise .25s ease; }
.msg.noimg { grid-template-columns: 1fr; }
.msg img { width: 120px; height: 160px; object-fit: cover; object-position: 50% 12%; border: 1px solid var(--gold2); border-radius: 2px; }
.msg h4 { margin: 0 0 6px; font: 24px var(--brush); letter-spacing: 2px; color: var(--gold); }
.msg p { margin: 0; font-size: 17px; line-height: 1.8; } .msg .more { position: absolute; right: 14px; bottom: 8px; color: var(--dim); font-size: 14px; animation: blink 1s infinite; }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }
@keyframes blink { 50% { opacity: .3; } }
/* A status line: clicks go through it to whatever it happens to cover. */
.toast { pointer-events: none; position: fixed; top: 64px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 7px 18px 7px 12px; z-index: 25; animation: rise .2s ease; font-size: 16px; transition: opacity .25s, transform .25s; }
.toast .ic { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 900 13px/1 var(--serif); color: #1a1009; background: var(--gold); }
.toast.good .ic { background: var(--good); } .toast.bad .ic { background: var(--bad); }
.toast strong { color: var(--good); font-weight: 600; } .toast em { color: var(--bad); font-style: normal; }
.toast.out { opacity: 0; transform: translate(-50%, -8px); }
/* Command results: changed numbers flash and float a +/− badge. */
.delta { position: relative; display: inline-block; margin-left: 4px; font: 700 13px/1 var(--serif); font-style: normal; pointer-events: none; animation: deltaUp 2.2s ease forwards; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
@keyframes deltaUp { 0% { opacity: 0; translate: 0 6px; } 12% { opacity: 1; translate: 0 0; } 75% { opacity: 1; } 100% { opacity: 0; translate: 0 -6px; } }
.stats [data-k] b, .topbar [data-k] b { position: relative; }
.topbar .delta { position: absolute; margin: 0; white-space: nowrap; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.topbar .delta { left: 50%; top: 100%; transform: translateX(-50%); }
.stats .flash b, .topbar .flash b { animation: numFlash 1s ease; }
.flash.up b { --fc: var(--good); } .flash.down b { --fc: var(--bad); }
@keyframes numFlash { 0%, 60% { color: var(--fc); text-shadow: 0 0 8px var(--fc); } }
.off.flash { animation: rowFlash 1.4s ease; } .off.flash.up { --fc: #8fd46a33; } .off.flash.down { --fc: #ff8a7033; }
@keyframes rowFlash { 0%, 30% { background: var(--fc); } }
.books i.burn { animation: burn .7s ease; }
@keyframes burn { 0% { background: #fff4c0; box-shadow: 0 0 10px #ffd070; transform: scale(1.4); } 100% { transform: none; } }
.banner { position: fixed; top: 38%; left: 0; right: 0; text-align: center; z-index: 24; pointer-events: none; animation: band 1.4s ease forwards; }
.banner span { display: inline-block; max-width: 100vw; white-space: nowrap; padding: 10px clamp(24px, 6vw, 60px); font: clamp(22px, 4.6vw, 40px) var(--brush); letter-spacing: clamp(3px, .8vw, 8px); color: #fff4d8; background: linear-gradient(90deg, transparent, #000c 20%, #000c 80%, transparent); text-shadow: 0 0 20px var(--c, #f6a03c); }
@keyframes band { 0% { opacity: 0; transform: scaleX(.6); } 20% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
.result { text-align: center; }
.result h2 { font: 64px var(--brush); letter-spacing: 12px; color: #ffe08a; text-shadow: 0 4px 0 #4a1408, 0 0 30px #f6a03c88; margin: 0 0 8px; }

/* ---------- War HUD ---------- */
.warbar { top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 18px; align-items: center; padding: 6px 18px; white-space: nowrap; }
.warbar .day { font: 22px var(--brush); }
.warbar .side { display: flex; gap: 8px; align-items: baseline; } .warbar .side b { color: #ffe08a; font-size: 18px; }
.warbar .me { color: var(--atk); } .warbar .foe { color: var(--def); }
.warbar .turn { padding: 1px 8px; border-radius: 2px; font-size: 14px; } .warbar .turn.mine { background: #2f5fb8; } .warbar .turn.theirs { background: #8a2c1e; } .warbar .turn.deploy { background: #3f7a2a; }
/* 平面战场 (feedback F02): the reason this battle has no 3D board, a click from its explanation */
.warbar .viewmode { padding: 1px 8px; font-size: 13px; color: #e8dcc0; background: rgba(120, 96, 52, .55); border-color: rgba(232, 200, 120, .45); }
/* The general cards sit in one row above the screen's bottom edge (.warcards, app.js cardBox): ours on the left,
   the foe's beside it while one of ours is selected and he is hovered or asked about. The dock keeps the right
   corner; narrower than 1200px the foe's card stacks above ours instead. */
.warcards { position: fixed; left: 12px; right: 436px; bottom: 12px; display: flex; gap: 12px; align-items: flex-end; }
#ui > .warcards { pointer-events: none; } /* only the cards take clicks, not the row between them */
.unitpanel { position: relative; flex: 0 1 500px; min-width: 0; padding: 12px 14px; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 14px; align-items: center; pointer-events: auto; }
.unitpanel.compare { pointer-events: none; animation: cardIn .14s ease-out both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } }
.unitpanel > img { width: 96px; height: 128px; object-fit: cover; object-position: 50% 12%; border: 1px solid var(--gold2); }
.unitpanel .info { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; container-type: inline-size; } /* one track no wider than the card, so the bars and figures stay inside it */
.unitpanel .head { display: flex; align-items: center; gap: 12px; }
.unitpanel h3 { font: 26px var(--brush); white-space: nowrap; } .unitpanel h3.mine { color: var(--atk); } .unitpanel h3.foe { color: var(--def); }
.unitpanel .bars { flex: 1; min-width: 0; display: grid; gap: 3px; }
.unitpanel .bar { display: grid; grid-template-columns: 1.1em minmax(0, 1fr) 4.6em; gap: 6px; align-items: center; font-size: 13px; line-height: 1; }
.unitpanel .bar span { color: var(--dim); } .unitpanel .bar b { font-weight: 400; text-align: right; }
.unitpanel .bar .track { height: 6px; background: #000a; border: 1px solid var(--rule); } .unitpanel .bar i { display: block; height: 100%; background: linear-gradient(#e8c870, #b08a3a); }
.unitpanel .bar.hp i { background: linear-gradient(#a6e07e, #5f9f3e); }
.unitpanel dt { white-space: nowrap; }
.unitpanel dl { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 1px 6px; margin: 2px 0; font-size: 14px; } .unitpanel dt { color: var(--dim); } .unitpanel dd { margin: 0; white-space: nowrap; }
@container (max-width: 268px) { body:not(.flat2d) .unitpanel dl { font-size: 12.5px; column-gap: 3px; } } /* the foe's card squeezed beside ours just over 1200 px */
.unitpanel .gear { display: flex; flex-wrap: wrap; gap: 0 16px; font-size: 14px; border-top: 1px solid color-mix(in srgb, var(--rule) 53.3%, transparent); padding-top: 3px; }
.unitpanel .gear.flash { animation: gearFlash .6s ease-out; }
@keyframes gearFlash { 0% { background: #ffe08a66; box-shadow: 0 0 12px #ffe08a; } 100% { background: transparent; box-shadow: none; } }
.unitpanel .gear .eqi { width: 28px; height: 28px; vertical-align: -9px; margin-right: 4px; object-fit: contain; }
.unitpanel .chips { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.unitpanel .chip { font-style: normal; font-size: 13px; line-height: 1.4; padding: 0 7px; border-radius: 2px; background: #4a1a12; border: 1px solid #b0503c; color: #ffd0c4; }
.unitpanel .hint { font-size: 14px; } .unitpanel .hint.bad { color: var(--bad); }
/* Folded while the action panel is up on a short window (app.js warUnit): name, bars, gear and the how-to line. */
.unitpanel.brief { grid-template-columns: minmax(0, 1fr); padding-block: 6px; } .unitpanel.brief > img, .unitpanel.brief dl, .unitpanel.brief .chips { display: none; }
.unitpanel.brief h3 { font-size: 22px; line-height: 1; }
.unitpanel .acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; } .unitpanel .acts:empty { display: none; }
.unitpanel .acts .btn { font-size: 16px; padding: 7px 18px; min-width: 5.5em; }
/* Too narrow for two cards side by side: the foe's stacks above ours. */
@media (max-width: 1200px) { .warcards { flex-direction: column-reverse; align-items: flex-start; } .unitpanel { flex: none; width: 100%; max-width: 500px; }
  /* the foe's card shrinks to a strip: name, bars, gear, chips; no portrait, no grid, so it covers little */
  html body .unitpanel.compare { grid-template-columns: minmax(0, 1fr); padding: 6px 12px; }
  html body .unitpanel.compare > img, html body .unitpanel.compare dl, html body .unitpanel.compare .hint:not(.bad) { display: none; }
  html body .unitpanel.compare .info { grid-template-columns: auto minmax(0, 1fr); gap: 2px 14px; align-items: center; }
  html body .unitpanel.compare .head { grid-column: 1 / -1; } html body .unitpanel.compare h3 { font-size: 20px; line-height: 1; }
  html body .unitpanel.compare .gear { border: 0; padding: 0; font-size: 13px; } html body .unitpanel.compare .gear .eqi { width: 16px; height: 16px; vertical-align: -3px; } html body .unitpanel.compare .chips { justify-content: flex-end; } }
.wardock { bottom: 12px; right: 12px; padding: 8px; display: flex; gap: 6px; }
/* War-map tag: a small name plate over one troops bar in the side's colour, edged in that colour. The 体 bar
   and the numbers show only for the selected or hovered general, or while Alt is held, so the tags stay
   lighter than the figures they name and neighbours' tags do not stack into each other (N09, A2). */
.tag { text-align: center; font-size: 13px; text-shadow: 0 1px 2px #000; min-width: 44px; padding: 0 5px 2px; border-radius: 3px; background: #120c08a8;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--atk) 55%, transparent); }
.tag { position: relative; transition: opacity .15s; }
/* The 3D war map's minimap and the markers for generals outside the picture (src/warnav.js). On <body>, under the dialogs. */
.warmini { position: fixed; right: 12px; bottom: 122px; z-index: 10; padding: 4px; border: 1px solid #6b5630; border-radius: 4px; background: rgba(20, 14, 8, .82); box-shadow: 0 2px 8px #0008; }
.warmini canvas { display: block; cursor: pointer; border-radius: 2px; }
.warmini-head { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 3px; }
.warmini-toggle, .warmini-edge { padding: 0 4px; border: 0; background: none; color: #d8c79a; font: 12px/1.5 "Noto Serif SC", serif; cursor: pointer; white-space: nowrap; }
.warmini-edge[aria-pressed="true"] { color: #ffd75a; }
.warmini.shut canvas, .warmini.shut .warmini-edge { display: none; } .warmini.shut .warmini-head { margin: 0; }
.waredges { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.waredge { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid #f4efe2; color: #fff; font: 700 15px/26px "Noto Serif SC", serif; text-align: center; text-shadow: 0 1px 2px #000; cursor: pointer; pointer-events: auto; box-shadow: 0 1px 6px #000a; }
.waredge.ours { background: #2f5cc4; } .waredge.theirs { background: #b8322c; }
.waredge i { position: absolute; left: 50%; top: 50%; width: 0; height: 0; border: 6px solid transparent; border-left-color: #f4efe2; transform: translate(-50%, -50%) rotate(var(--a)) translateX(21px); pointer-events: none; }
.waredge[hidden] { display: none; } .warmini[hidden] { display: none; }
body.cine .warmini, body.cine .waredges, body.scenic .warmini, body.scenic .waredges, body:not([data-screen="war"]) .warmini, body:not([data-screen="war"]) .waredges { display: none; }
/* What the hovered route costs, over the cell it ends on (src/war/overlay.js). */
.route-cost { padding: 0 7px 1px; border: 1px solid #c8a45a; border-radius: 3px; background: rgba(24, 16, 8, .88); color: #ffd75a; font: 15px/1.3 "Noto Serif SC", serif; white-space: nowrap; pointer-events: none; text-shadow: 0 1px 2px #000; }
.route-cost b { font-weight: 700; }
.tag.defender { box-shadow: 0 0 0 1px color-mix(in srgb, var(--def) 55%, transparent); }
.tag b { display: block; font-size: 13px; line-height: 1.2; white-space: nowrap; }
.tag i, .tag u { display: block; height: 3px; margin: 1px 0 0; border-radius: 2px; box-shadow: 0 0 0 1px #000; background: linear-gradient(90deg, var(--atk) var(--w), rgba(0,0,0,.6) var(--w)); }
.tag.defender i { background: linear-gradient(90deg, var(--def) var(--w), rgba(0,0,0,.6) var(--w)); }
.tag em.st { display: block; font-style: normal; font-size: 11px; line-height: 1.25; white-space: nowrap; }
.tag em.qimen { color: #d9a8ff; }
.tag em.hold { color: #ffc870; }
.lossnum { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); font-size: 20px; font-weight: bold; line-height: 1.1; color: #ff6a5a; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 8px #6a1810; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; animation: lossrise .9s ease-out forwards; }
.lossnum.gain { color: #ffd860; font-size: 18px; letter-spacing: .04em; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 10px #a86a10; } /* 升级: the new level rising in gold (src/warview.js tellLevelUps) */
@keyframes lossrise { from { margin-top: 22px; opacity: 1; } 55% { opacity: 1; } to { margin-top: 2px; opacity: 0; } }
.tag u { display: none; background: linear-gradient(90deg, #f6a03c var(--w), rgba(0,0,0,.6) var(--w)); }
.tag span { display: none; font-size: 13px; opacity: .9; font-variant-numeric: tabular-nums; white-space: nowrap; }
.alt-held .tag span, .tag.full u, .alt-held .tag u { display: block; } /* the floating tag of the selected or hovered general keeps its name and bars; the numbers are on his card (Alt shows them) */ .tag.full { position: relative; z-index: 1; padding: 1px 6px 3px; background: #120c08e0; }
.tag.full b { font-size: 14px; } .tag.full i, .tag.full u { height: 4px; margin-top: 2px; }
/* Crowded tags (src/warview.js declutter): one that stepped aside has a 1px leader in its side's colour running back to the
   general's head; a crowd with no room left folds the others into a dot at the head, which unfolds when hovered (.full).
   The folded tag keeps its box (so its size is known to unfold into), draws only the dot, and still carries a loss number. */
.tag s { display: none; position: absolute; left: calc(50% - .5px); top: 100%; width: 1px; transform-origin: 50% 0; background: var(--atk); box-shadow: 0 0 0 1px #000c; pointer-events: none; }
.tag.defender s { background: var(--def); }
.tag.thin { opacity: .5; } /* an exempt tag with no clear spot lets the figure under it show */
.tag.dot { background: none; box-shadow: none; text-shadow: none; z-index: 2; } /* over any tag that stands on it */
.tag.dot > :not(.lossnum) { visibility: hidden; }
.tag.dot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--atk); box-shadow: 0 0 0 1px #000c; }
.tag.dot.defender::after { background: var(--def); }
/* The ground view (T, src/warview.js setTerrainView): a small plaque on each cell a general stands on and the two behind it, edged in the terrain's colour. */
.gtag { padding: 1px 7px 2px; font-size: 13px; font-weight: 600; letter-spacing: 1px; color: #f8eed6; text-shadow: 0 1px 2px #000; background: #0c0905d6; border: 2px solid #c4a060; border-radius: 3px; white-space: nowrap; pointer-events: none; }
.gcost { padding: 0 5px 1px; font-size: 12px; font-weight: 600; color: #f8eed6; text-shadow: 0 1px 2px #000; background: #0c0905c8; border: 1px solid #c4a060; border-radius: 3px; opacity: .92; } /* what stepping onto a cell of the reach costs (T, src/war/pick.js) */
.wardock .threatbtn { padding: 5px 9px; font-weight: 700; } .wardock .threatbtn[aria-pressed="true"] { color: #ffb0a0; border-color: #ff6a4c; }
.gtag[data-terrain="林"] { border-color: #5fae4a; } .gtag[data-terrain="沙地"] { border-color: #d8b46a; } .gtag[data-terrain="平地"] { border-color: #b8d878; }
.gtag[data-terrain="河"] { border-color: #5aa8e8; } .gtag[data-terrain="山"] { border-color: #b08860; } .gtag[data-terrain="城"] { border-color: #b8b0c0; }
.gtag[data-terrain^="村落"] { border-color: #e8a040; }
/* The villages' signs: a small wooden plaque with nail heads and a post, hung over the roof (war-3d Task 9). */
.vtag { position: relative; box-sizing: border-box; min-width: 26px; padding: 1px 5px 2px; text-align: center; font-size: 16px; font-weight: 700; line-height: 1.15; color: #f6e2b0; text-shadow: 0 1px 1px #2a1606;
  background: repeating-linear-gradient(176deg, #0000 0 3px, #2a16062e 3px 4px), linear-gradient(180deg, #8c6234, #6a4521 60%, #5a3a1a);
  border: 1px solid #2e1c0a; border-radius: 3px; box-shadow: inset 0 1px 0 #c79a5c80, inset 0 -1px 0 #2a160680, 0 2px 3px #0008; transition: opacity .15s; pointer-events: none; }
.vtag::before { content: ''; position: absolute; left: 2px; top: 2px; width: 2px; height: 2px; border-radius: 50%; background: #d9b878; box-shadow: 20px 0 0 #d9b878; }
.vtag::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 2px; height: 6px; margin-left: -1px; background: #4a2e14; }

/* ---------- Cut-in ---------- */
#cine { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 15; }
#cine .bar { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height .35s ease; }
#cine .bar.top { top: 0; } #cine .bar.bot { bottom: 0; }
#cine.enter .bar { height: 9vh; }
#cine .side { position: absolute; top: 9vh; display: flex; align-items: flex-end; gap: 10px; transition: transform .45s cubic-bezier(.2,.9,.3,1.2), opacity .3s; opacity: 0; }
#cine .side.L { left: 0; transform: translateX(-110%); } #cine .side.R { right: 0; flex-direction: row-reverse; transform: translateX(110%); text-align: right; }
#cine.enter .side { opacity: 1; transform: none; }
#cine .side img { width: min(24vw, 260px); aspect-ratio: 2 / 3; object-fit: cover; object-position: 50% 15%; display: block;
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); mask-image: linear-gradient(to bottom, #000 70%, transparent); transition: width .45s ease; }
#cine .nm { background: var(--panel); border: 1px solid var(--gold2); padding: 6px 12px; margin-bottom: 18px; min-width: 150px; }
#cine .nm b { font: 26px var(--brush); display: block; letter-spacing: 2px; } #cine .attacker b { color: var(--atk); } #cine .defender b { color: var(--def); }
#cine .nm small { opacity: .8; font-size: 14px; } #cine .nm span { font-size: 15px; } #cine .nm em { font-style: normal; color: #ffe080; }
#cine .hp { height: 6px; border: 1px solid #000; background: #0008; margin: 4px 0; } #cine .hp i { display: block; height: 100%; background: var(--atk); transition: width .8s ease; }
#cine .defender .hp i { background: var(--def); }
#cine .vsmark { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(3); opacity: 0; font: 900 72px/1 var(--brush); color: #fff4d0; text-shadow: 0 0 12px #f80, 0 4px 0 #6a1a00, 0 0 40px #f60; letter-spacing: 8px; }
#cine.enter .vsmark { animation: vs 1.4s ease forwards; }
@keyframes vs { 0% { opacity: 0; transform: translate(-50%, -50%) scale(3); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }
#cine .speed { position: absolute; inset: -20%; opacity: 0; background: repeating-conic-gradient(from 0deg at 50% 50%, #fff0 0deg 4deg, #fff9 4deg 4.6deg, #fff0 4.6deg 9deg);
  -webkit-mask-image: radial-gradient(circle, transparent 28%, #000 62%); mask-image: radial-gradient(circle, transparent 28%, #000 62%); }
#cine.enter .speed { animation: speed .7s ease-out; }
@keyframes speed { 0% { opacity: 0; transform: scale(1.3) rotate(0deg); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1) rotate(6deg); } }
#cine .flash { position: absolute; inset: 0; background: #fff; opacity: 0; } #cine .flash.go { animation: flash .28s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
.dmg { font: 900 26px/1 var(--serif); color: #fff; -webkit-text-stroke: 2px #000; text-shadow: 0 3px 0 #000, 0 0 12px #f40; white-space: nowrap; }
.dmg.attacker { color: #9cc8ff; } .dmg.defender { color: #ffb0a0; }
/* 单挑 feedback tiers: a 牵制 graze is small, a 舍身 blow is big; misses and words carry no hit glow. */
.dmg.light, .dmg.graze { font-size: 19px; text-shadow: 0 2px 0 #000; } .dmg.heavy { font-size: 38px; text-shadow: 0 3px 0 #000, 0 0 18px #f60; }
.dmg.miss, .dmg.word { font: 600 18px/1 var(--serif); letter-spacing: .12em; color: #e8e2d4; -webkit-text-stroke: 0; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
.dmg.self { font-size: 18px; color: #ffcf8a; }
.dmg.allin { font: 900 30px/1 var(--serif); letter-spacing: .3em; color: #ffd27a; -webkit-text-stroke: 1.5px #2a0800; text-shadow: 0 3px 0 #000, 0 0 16px #e22; }
body.cine .msg { bottom: calc(9vh + 16px); } /* above the letterbox */
body.cine .citypanel, body.cine .logbox, body.cine .warcards, body.cine .wardock, body.cine .warbar, body.cine .sysbtns, body.cine .deploybtn { display: none; }
.sysbtns { --sys-top: 12px; position: fixed; top: var(--sys-top); right: 12px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 6; }
.sysbtns .btn { padding: 4px 10px; font-size: 14px; }
.sysmenu-list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px; padding: 6px; border-radius: 6px; background: var(--menu-bg); border: 1px solid rgba(220,180,110,.25); box-shadow: 0 10px 28px rgba(0,0,0,.5);
  /* Under the 系统 button and 12px clear of the window's bottom. Both columns fit from the desktop's 1024x600 up; a smaller browser window stacks them and scrolls. */
  max-width: 100%; max-height: calc(100vh - var(--sys-top) - 50px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--gold2) transparent; }
.sysmenu-list[hidden] { display: none; } .sysmenu-list .btn { text-align: left; }
.sysmenu-col { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; min-width: 144px; } /* wide enough for its longest state, so a click on a row never shifts the column under the pointer */
.sysmenu-col + .sysmenu-col { padding-left: 4px; border-left: 1px solid rgba(220,180,110,.14); }
.sysmenu-group { display: flex; flex-direction: column; gap: 4px; }
.sysmenu-group + .sysmenu-group { padding-top: 6px; border-top: 1px solid rgba(220,180,110,.14); }
.sysmenu-quick { display: flex; gap: 4px; }
.sysmenu-list .sysmenu-quick .btn { flex: 1 0 auto; padding: 4px 5px; font-size: 12px; white-space: nowrap; }
.sysmenu-list .sysrange { display: flex; align-items: center; gap: 8px; cursor: default; }
.sysrange input { width: 96px; accent-color: #d8b46a; } .sysrange small { min-width: 34px; text-align: right; opacity: .8; }
body[data-screen="war"] .sysbtns { --sys-top: 64px; right: auto; left: 12px; align-items: flex-start; }
/* A short window (the desktop's 1024x600): the rules between groups close up and the rows lose 2px top and bottom, so
   the taller column (15 rows in a war since 武将读书) needs no scrolling. */
@media (max-height: 640px) { .sysmenu-col { gap: 4px; } .sysmenu-group + .sysmenu-group { padding-top: 4px; } .sysmenu-list .btn { padding-top: 2px; padding-bottom: 2px; } }

@media (max-width: 1100px) {
  .topbar { left: 12px; transform: none; max-width: calc(100% - 24px); flex-wrap: wrap; gap: 4px 14px; }
  .citypanel { top: var(--hud-top, 96px); } .legend { display: none; } .rightcol { top: calc(var(--hud-top, 96px) + 44px); }
  .endturn { bottom: auto; top: var(--hud-top, 96px); right: 12px; }
  .warbar { left: 12px; transform: none; flex-wrap: wrap; max-width: calc(100% - 24px); white-space: normal; }
}
@media (max-width: 900px) {
  .rulers { grid-template-columns: repeat(4, minmax(0, 130px)); } .ruler { height: 240px; } .ruler img { height: 180px; } .ruler small.towns { display: none; } .ruler b { font-size: 22px; }
  .citypanel { width: min(300px, calc(100% - 24px)); } /* its height makes way for the dock in placeStrategyHud (app.js) */ .logbox { display: none; } .logo { font-size: 72px; }
  .warcards { right: 12px; bottom: 70px; } .unitpanel { grid-template-columns: 72px minmax(0, 1fr); gap: 8px 10px; } .unitpanel > img { width: 72px; height: 96px; } .wardock { left: 12px; right: 12px; flex-wrap: wrap; justify-content: center; }
  .acts { max-width: calc(100vw - 40px); }
}

#tip { position: fixed; z-index: 12; padding: 6px 10px; font-size: 14px; pointer-events: none; line-height: 1.6; white-space: nowrap; }
#tip em { color: var(--bad); font-style: normal; } #tip strong { color: var(--good); }
#tip .ground { color: #d8c8a4; font-size: 13px; }
.legend { padding: 6px 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; flex: none; }
.lg { display: grid; grid-template-columns: 28px 8px 1fr auto auto; gap: 6px; align-items: center; padding: 2px 4px; border-radius: 3px; font-size: 14px; }
.lg img { width: 28px; height: 34px; object-fit: cover; object-position: 50% 10%; border-radius: 2px; border: 1px solid var(--rule); }
.lg i { width: 8px; height: 8px; border-radius: 50%; } .lg b { font-size: 16px; } .lg em { font-style: normal; font-size: 14px; color: var(--good); }
.lg.me { background: #ffffff12; } .lg.now { box-shadow: inset 0 0 0 1px #ffd890; }
.logbox:empty { display: none; }
.help h4 { margin: 12px 0 4px; font: 20px var(--brush); color: var(--gold); letter-spacing: 2px; } .help p { margin: 4px 0; line-height: 1.8; color: #e8dcc0; }
.deploybtn { position: fixed; bottom: 76px; right: 12px; padding: 12px 14px; display: flex; gap: 14px; align-items: center; animation: lift .3s ease; }
@keyframes lift { from { opacity: 0; transform: translateY(10px); } }
.deploybtn b { font: 22px var(--brush); color: var(--good); letter-spacing: 4px; } .deploybtn p { margin: 2px 0 0; line-height: 1.6; }
@media (max-width: 1100px) { .legend { display: none; } .deploybtn { bottom: auto; top: 96px; } }

/* ===================== 白兵 tactical console ===================== */
.tq { --tq-gold: #e6c27a; --tq-gold2: #8c6a33; --tq-glass: rgba(18, 12, 8, .72); --tq-line: rgba(230, 194, 122, .35);
  --tq-me: #6ab8ff; --tq-foe: #ff8a70; position: fixed; inset: 0; z-index: 14; pointer-events: none; font-family: var(--serif); color: var(--ink); }
.tq > * { pointer-events: auto; }
.tq[data-side=defender] { --tq-me: #ff8a70; --tq-foe: #6ab8ff; }
.tq-kicker { font: 600 14px var(--serif); letter-spacing: .5em; color: var(--tq-gold); text-transform: uppercase; opacity: .85; }
.tq-sub { color: var(--dim); margin: 4px 0 26px; letter-spacing: .08em; }

/* formation picker: a band at the top (who fights, the title) and one at the bottom (the cards, 部署); the field between them is
   left as it is, neither darkened nor blurred, so the squads and their troop chips can be read (暴力倾向@devblog, 2026-11-13) */
.tq-formation { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; pointer-events: none;
  background: linear-gradient(rgba(5,3,2,.82), rgba(5,3,2,.5) 96px, transparent 190px), linear-gradient(0deg, rgba(5,3,2,.9), rgba(5,3,2,.62) 190px, transparent 330px); animation: tqFade .4s ease both; }
.tq-form-head { padding-top: 14px; } .tq-form-foot { pointer-events: auto; display: flex; flex-direction: column; align-items: center; padding-bottom: 18px; }
.tq-vs-side { position: absolute; top: 14px; display: grid; grid-template-columns: 64px auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; padding: 8px 16px 8px 8px; border-radius: 14px;
  background: var(--tq-glass); border: 1px solid var(--tq-line); box-shadow: 0 12px 28px rgba(0,0,0,.4); animation: tqSideIn .7s cubic-bezier(.2,.9,.3,1) both; }
.tq-vs-side.l { left: 16px; } .tq-vs-side.r { right: 16px; animation-name: tqSideInR; grid-template-columns: auto 64px; text-align: right; padding: 8px 8px 8px 16px; }
.tq-vs-side img { grid-row: 1 / 3; width: 64px; height: 80px; object-fit: cover; object-position: 50% 12%; border-radius: 10px; box-shadow: 0 0 0 1px var(--tq-gold2), 0 0 0 3px rgba(0,0,0,.6); }
.tq-vs-side.r img { grid-column: 2; }
.tq-vs-side b { align-self: end; font: 30px/1 var(--brush); letter-spacing: .1em; text-shadow: 0 3px 10px #000; }
.tq-vs-side.attacker b { color: #a8d0ff; } .tq-vs-side.defender b { color: #ffb8a8; }
.tq-vs-side span { align-self: start; font-size: 14px; color: var(--dim); letter-spacing: .08em; white-space: nowrap; }
.tq-vs-side.r b, .tq-vs-side.r span { grid-column: 1; } .tq-vs-side.r b { grid-row: 1; } .tq-vs-side.r span { grid-row: 2; }
@keyframes tqSideIn { from { opacity: 0; transform: translateX(-40px); } } @keyframes tqSideInR { from { opacity: 0; transform: translateX(40px); } }
@media (max-width: 1100px) { .tq-vs-side { display: none; } }
.tq-formation.out { animation: tqFadeOut .26s ease both; }
.tq-formation h2 { font: 46px/1 var(--brush); margin: 6px 0 0; color: #fff3d6; letter-spacing: .12em; text-shadow: 0 4px 0 #3a1008, 0 0 40px rgba(246,160,60,.35); }
.tq-formation .tq-sub { margin: 6px 0 0; text-shadow: 0 1px 4px #000; }
.tq-kinds { display: flex; gap: 8px; margin-bottom: 10px; } .tq-kinds span { display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px 2px 8px; border-radius: 999px; font-size: 15px; letter-spacing: .06em; color: #f3e6c8; background: rgba(12,8,5,.72); border: 1px solid var(--tq-line); }
.tq-kinds i { display: block; width: 14px; height: 14px; } .tq-kinds svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tq-forms { display: grid; grid-template-columns: repeat(4, minmax(150px, 250px)); gap: 14px; }
.tq-form { position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; column-gap: 10px; text-align: left; padding: 10px 14px 10px 10px; border-radius: 14px; border: 1px solid var(--tq-line); cursor: pointer; color: var(--ink);
  background: linear-gradient(160deg, rgba(60,40,22,.74), rgba(20,13,8,.8)); backdrop-filter: blur(6px); box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,230,180,.12);
  transition: transform .25s cubic-bezier(.2,.9,.3,1.3), border-color .2s, box-shadow .25s; animation: tqRise .5s cubic-bezier(.2,.9,.3,1) both; }
.tq-form:nth-child(2) { animation-delay: .06s; } .tq-form:nth-child(3) { animation-delay: .12s; } .tq-form:nth-child(4) { animation-delay: .18s; }
.tq-form:hover, .tq-form:focus-visible { transform: translateY(-5px); border-color: var(--tq-gold); box-shadow: 0 26px 50px rgba(0,0,0,.55), 0 0 0 1px var(--tq-gold), 0 0 34px rgba(246,180,90,.25); outline: none; }
.tq-form .tq-picked { position: absolute; top: -10px; right: 12px; line-height: 18px; box-shadow: 0 2px 6px rgba(0,0,0,.5); font-style: normal; font-size: 12px; letter-spacing: .1em; padding: 1px 8px; border-radius: 999px; background: var(--tq-gold); color: #2a1606; opacity: 0; }
/* Picked: gold and tagged 已选; pointed at but not picked: a dashed edge, so the preview on the field is never taken for the choice. */
.tq-form.on { border-color: var(--tq-gold); box-shadow: 0 18px 40px rgba(0,0,0,.45), 0 0 0 2px var(--tq-gold), 0 0 30px rgba(246,180,90,.3); } .tq-form.on .tq-picked { opacity: 1; }
.tq-form.peek { border-style: dashed; }
/* Under the cards, in the middle: well below where 开始交战 comes up next (.tq-start), so a burst of clicks on one never lands on the other. */
.tq-deploybar { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 14px; }
.tq-peeknote { margin: 0; color: #d9cdb2; font-size: 15px; letter-spacing: .06em; text-shadow: 0 1px 4px #000; }
.tq-formation .tq-deploy { padding: 10px 40px; font: 24px/1.1 var(--brush); letter-spacing: .14em; }
/* 开始交战 is held off for a moment after it comes up (src/commitguard.js GUARD): it fills in as it becomes pressable. */
.tq-btn.arming { opacity: .55; animation: apArm .3s linear forwards; }
.tq-form-svg { grid-row: 1 / 3; } .tq-form b { align-self: end; display: block; font: 28px/1.1 var(--brush); letter-spacing: .1em; color: #fff1d0; }
.tq-form small { align-self: start; display: block; color: #cfc3a8; font-size: 13.5px; line-height: 1.45; margin-top: 4px; }
.tq-form-svg svg { display: block; width: 100%; height: 88px; }
/* troop marks, in the cards' pictures and the legend: 步 a blue disc, 弓 a green triangle, 骑 an amber diamond; a place with no squad a faint ring */
.tq-formation .gn { fill: var(--tq-gold); filter: drop-shadow(0 0 4px rgba(246,190,90,.8)); } .tq-formation .k-inf { fill: #7cc2ff; } .tq-formation .k-arc { fill: #8fe07c; } .tq-formation .k-cav { fill: #ffab52; }
.tq-formation .none { fill: none; stroke: rgba(255,240,210,.28); stroke-width: 1; }

/* top: commander cards + round medallion */
.tq-top { position: fixed; top: 14px; left: 16px; right: 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 16px; pointer-events: none; animation: tqDrop .5s cubic-bezier(.2,.9,.3,1) both; }
/* both cards take the same width (the right one used to shrink to its text, 255 px against the left's 420) */
.tq-card { pointer-events: auto; display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px 14px 10px 10px; width: 100%; max-width: 420px; border-radius: 14px;
  background: linear-gradient(120deg, var(--tq-glass), rgba(18,12,8,.5)); border: 1px solid var(--tq-line); backdrop-filter: blur(8px) saturate(1.2);
  box-shadow: 0 14px 34px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,230,180,.08); }
.tq-card.r { justify-self: end; grid-template-columns: 1fr 84px; padding: 10px 10px 10px 14px; text-align: right; }
.tq-card.r .tq-face { order: 2; } .tq-card.r .tq-info { order: 1; }
.tq-face { width: 84px; height: 104px; border-radius: 10px; overflow: hidden; position: relative; box-shadow: 0 0 0 1px var(--tq-gold2), 0 0 0 3px rgba(0,0,0,.6); }
button.tq-face { padding: 0; border: 0; background: none; cursor: pointer; display: block; transition: box-shadow .15s, transform .15s; }
button.tq-face:hover, button.tq-face:focus-visible { outline: none; transform: translateY(-1px); box-shadow: 0 0 0 2px var(--tq-gold), 0 0 16px color-mix(in srgb, var(--tq-gold) 45%, transparent); }
/* A dialog opened over the 白兵 / 单挑 (资料) stands above its HUD. */
body:has(.tq) #ui-top:has(> .shade) { z-index: 15; }
.tq-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; }
.tq-card.me .tq-face { box-shadow: 0 0 0 1px var(--tq-me), 0 0 18px color-mix(in srgb, var(--tq-me) 40%, transparent); }
.tq-name { font: 26px/1.1 var(--brush); letter-spacing: .08em; color: #fff3d6; }
.tq-card.me .tq-name { color: color-mix(in srgb, var(--tq-me) 45%, #fff); } .tq-card.foe .tq-name { color: color-mix(in srgb, var(--tq-foe) 45%, #fff); }
.tq-name small { font: 14px var(--serif); color: var(--dim); margin-left: 8px; letter-spacing: .05em; }
.tq-bar { position: relative; height: 16px; font-size: 13px; line-height: 16px; margin-top: 6px; border-radius: 8px; background: rgba(0,0,0,.45); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.tq-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 8px; transition: width .6s cubic-bezier(.2,.9,.3,1); }
.tq-card.r .tq-bar i { inset: 0 0 0 auto; }
.tq-bar.hp i { background: linear-gradient(90deg, #c8402f, #f6a03c); }
/* the capture gate: notches on the bar's top and bottom edges, clear of the text */
.tq-bar .gate { position: absolute; top: 0; bottom: 0; left: var(--gate); width: 2px; background: linear-gradient(#ffe08a 0 3px, transparent 3px calc(100% - 3px), #ffe08a calc(100% - 3px)); filter: drop-shadow(0 0 2px #ffd060); }
.tq-card.r .tq-bar .gate { left: auto; right: var(--gate); }
.tq-bar span em { font-style: normal; color: #ffe08a; }
.tq-bar.hp.low i { background: linear-gradient(90deg, #a8780a, #ffd34d); animation: tq-low .9s ease-in-out infinite alternate; }
.tq-card.r .tq-bar.hp.low i { background: linear-gradient(270deg, #a8780a, #ffd34d); }
@keyframes tq-low { to { filter: brightness(1.35); } } .tq-bar.tr i { background: linear-gradient(90deg, color-mix(in srgb, var(--tq-me) 70%, #000), var(--tq-me)); }
.tq-card.foe .tq-bar.tr i { background: linear-gradient(90deg, color-mix(in srgb, var(--tq-foe) 70%, #000), var(--tq-foe)); }
.tq-card.r .tq-bar.tr i { background: linear-gradient(270deg, color-mix(in srgb, var(--tq-me) 70%, #000), var(--tq-me)); }
.tq-card.r.foe .tq-bar.tr i { background: linear-gradient(270deg, color-mix(in srgb, var(--tq-foe) 70%, #000), var(--tq-foe)); }
.tq-bar span { position: relative; z-index: 1; display: block; white-space: nowrap; font: 600 13px/16px var(--serif); padding: 0 8px; letter-spacing: .06em; text-shadow: 0 1px 2px #000; }
.tq-tp { display: flex; gap: 3px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.tq-card.r .tq-tp { justify-content: flex-end; }
.tq-tp i { width: 7px; height: 7px; transform: rotate(45deg); background: var(--tq-gold); box-shadow: 0 0 6px rgba(246,190,90,.7); }
.tq-tp em { font-style: normal; font-size: 14px; color: var(--dim); margin-left: 6px; }
.tq-fx { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; } .tq-card.r .tq-fx { justify-content: flex-end; }
/* Tactic badges (暴力倾向@devblog, 2026-11-13): one colour an effect, the same on the cards, the field's tags, the tactic buttons and the cast's ring. */
.fx-bind { --fx: #c070ff; } .fx-xbow { --fx: #7ad0ff; } .fx-fire { --fx: #ff8a30; } .fx-morale { --fx: #ffe070; }
.tq-fx span { --fx: #c070ff; display: inline-flex; align-items: center; gap: 5px; font-size: 14px; line-height: 20px; padding: 1px 8px 1px 2px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--fx) 20%, rgba(12,10,8,.6)); border: 1px solid color-mix(in srgb, var(--fx) 60%, transparent); color: color-mix(in srgb, var(--fx) 30%, #fff); }
.tq-fx span b, .tq-dfx b { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font: 700 12px/1 var(--serif); color: #14100a; background: var(--fx); box-shadow: 0 0 8px color-mix(in srgb, var(--fx) 60%, transparent); }
.tq-fx span.bad { animation: tqFxBad 1.2s ease-in-out infinite alternate; } @keyframes tqFxBad { to { box-shadow: 0 0 10px color-mix(in srgb, var(--fx) 70%, transparent); } }
.tq-round { pointer-events: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; align-content: center; text-align: center;
  background: radial-gradient(circle at 50% 35%, #4a3218, #1a1009 70%); box-shadow: 0 0 0 2px var(--tq-gold2), 0 0 0 5px rgba(0,0,0,.6), 0 0 0 6px var(--tq-line), 0 12px 30px rgba(0,0,0,.5); }
.tq-round small { font-size: 14px; letter-spacing: .4em; color: var(--tq-gold); padding-left: .4em; }
.tq-round b { font: 40px/1 var(--brush); color: #fff3d6; }
.tq-round em { font-style: normal; font-size: 14px; color: var(--dim); letter-spacing: .2em; }

/* bottom console */
.tq-console { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); display: grid; grid-template-columns: auto; gap: 6px; padding: 8px 14px 9px;
  border-radius: 18px; background: var(--tq-glass); border: 1px solid var(--tq-line); backdrop-filter: blur(10px) saturate(1.25);
  box-shadow: 0 20px 50px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,230,180,.1); animation: tqRise .5s .1s cubic-bezier(.2,.9,.3,1) both; }
/* Two low rows: 将令 (one segment per troop type side by side), then 战术 and the controls; each row opens
   with its title set vertically, so the console is ~100px tall and the field keeps the screen (N09). */
.tq-orders, .tq-side { display: flex; align-items: center; gap: 12px; }
.tq-label { font: 600 13px/1 var(--serif); letter-spacing: .3em; color: var(--tq-gold); writing-mode: vertical-rl; padding-right: 8px; border-right: 1px solid var(--tq-line); }
.tq-row { display: flex; gap: 6px; align-items: center; transition: opacity .2s; }
.tq-row.none { opacity: .35; }
/* 全军待机 / 全军包围 close the 将令 row, set off from the four troop types by a hairline. */
.tq-all { padding-left: 12px; border-left: 1px solid var(--tq-line); } .tq-all .tq-kind { font-size: 18px; }
.tq-kind { font: 21px/1 var(--brush); color: #fff1d0; white-space: nowrap; } .tq-kind small { font: 13px var(--serif); color: var(--dim); margin-left: 2px; }
.tq-seg { display: inline-grid; grid-auto-flow: column; padding: 3px; gap: 3px; border-radius: 10px; background: rgba(0,0,0,.42); box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.tq-cmd { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 8px; border: 0; background: transparent; color: var(--dim); font: 16px var(--serif); letter-spacing: .1em; cursor: pointer; transition: background .18s, color .18s, transform .12s; }
.tq-cmd i { font-style: normal; font-size: 12px; opacity: .7; }
.tq-cmd:hover:not(:disabled) { color: #fff3d6; background: rgba(255,255,255,.06); }
.tq-cmd:active:not(:disabled) { transform: scale(.96); }
.tq-cmd.on { color: #1a1009; background: linear-gradient(180deg, #f6dc9c, #d8a650); box-shadow: 0 2px 10px rgba(246,180,90,.35); }
.tq-cmd.on i { opacity: 1; }
.tq-cmd:disabled { cursor: default; opacity: .5; }
.tq-cmd:focus-visible, .tq-tac:focus-visible, .tq-btn:focus-visible { outline: 2px solid var(--tq-gold); outline-offset: 2px; }
.tq-tactics { display: grid; grid-template-columns: repeat(6, auto); gap: 5px; }
.tq-tac b { font-weight: 400; white-space: nowrap; }
.tq-tac { display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 5px 7px 5px 10px; border-radius: 10px; cursor: pointer; color: #fff1d0;
  border: 1px solid rgba(192,112,255,.35); background: linear-gradient(160deg, rgba(90,50,140,.35), rgba(30,16,50,.5)); font: 15px var(--serif); letter-spacing: .04em; transition: transform .15s, box-shadow .2s, border-color .2s; }
.tq-tac span { font: 600 14px var(--serif); min-width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.45); color: var(--tq-gold); box-shadow: inset 0 0 0 1px var(--tq-gold2); }
.tq-tac:hover:not(:disabled) { transform: translateY(-2px); border-color: #c890ff; box-shadow: 0 8px 22px rgba(140,80,220,.35); }
.tq-tac:disabled { opacity: .32; cursor: default; filter: saturate(.4); }
/* ours running: lit in the effect's colour though it cannot be cast again, the rounds left on its corner */
.tq-tac { position: relative; }
.tq-tac.live:disabled { opacity: 1; filter: none; border-color: var(--fx); box-shadow: 0 0 0 1px var(--fx), 0 0 14px color-mix(in srgb, var(--fx) 45%, transparent); }
.tq-tac.live b { color: color-mix(in srgb, var(--fx) 45%, #fff); } .tq-tac.live span { opacity: .45; }
.tq-tac-live { position: absolute; top: -9px; right: -6px; padding: 0 6px; border-radius: 999px; text-decoration: none; white-space: nowrap; font: 700 12px/16px var(--serif); color: #14100a; background: var(--fx); box-shadow: 0 2px 6px rgba(0,0,0,.6); }
.tq-ctrl { display: flex; gap: 6px; align-items: center; margin-left: 6px; }
.tq-speed { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: rgba(0,0,0,.4); }
.tq-btn { white-space: nowrap; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--tq-line); background: rgba(40,28,16,.8); color: var(--ink); font: 15px var(--serif); letter-spacing: .08em; cursor: pointer; transition: all .15s; }
.tq-speed .tq-btn { border: 0; background: transparent; padding: 5px 9px; }
.tq-btn:hover:not(:disabled) { border-color: var(--tq-gold); color: #fff3d6; }
.tq-btn.on { background: linear-gradient(180deg, #f6dc9c, #d8a650); color: #1a1009; border-color: transparent; }
.tq-btn.primary { background: linear-gradient(180deg, #b8402c, #7a1f12); border-color: #e8905c; color: #fff4e0; box-shadow: 0 6px 16px rgba(160,40,20,.35); }
.tq-btn.warn { border-color: rgba(255,120,90,.5); color: #ffb8a4; }
.tq-btn:disabled { opacity: .4; cursor: default; }

/* feed, duel, ask, result */
/* War feed sits in the bottom-left corner beside the console, off the 16×10 field. */
/* above the console's left end, since the two-row console now spans most of the width */
.tq-feed { position: fixed; left: 16px; bottom: 124px; width: 240px; display: flex; flex-direction: column-reverse; pointer-events: none; font-size: 14px; }
.tq-feed p { margin: 6px 0 0; padding: 6px 10px; border-radius: 8px; background: rgba(12,8,5,.55); border-left: 2px solid var(--tq-gold); backdrop-filter: blur(4px); animation: tqSlide .35s ease both; }
.tq-feed p:nth-child(n+4) { opacity: .55; } .tq-feed em { color: var(--bad); font-style: normal; } .tq-feed b { color: #e8d4ff; }
.tq-ask { position: fixed; left: 50%; bottom: 230px; transform: translateX(-50%); padding: 14px 18px; border-radius: 16px; text-align: center;
  background: var(--tq-glass); border: 1px solid var(--tq-gold2); backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(0,0,0,.55), 0 0 40px rgba(246,160,60,.15); animation: tqRise .3s ease both; z-index: 2; }
.tq-duel { position: fixed; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 45%, rgba(8,4,2,.35) 85%); animation: tqFade .4s ease both; }
.tq-duel > * { pointer-events: auto; }
.tq.dueling .tq-console, .tq.dueling .tq-feed { opacity: 0; transform: translate(-50%, 30px); pointer-events: none; transition: opacity .3s, transform .3s; }
.tq.dueling .tq-feed { transform: translateX(-30px); }
.tq-dcard { position: absolute; top: calc(9vh + 14px); display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 12px; width: min(32vw, 360px); padding: 10px 16px 10px 10px; border-radius: 14px;
  background: var(--tq-glass); border: 1px solid var(--tq-gold2); backdrop-filter: blur(8px); box-shadow: 0 14px 36px rgba(0,0,0,.5); transition: box-shadow .3s; animation: tqPlateIn .6s cubic-bezier(.2,.9,.3,1) both; }
.tq-dcard.l { left: 3vw; } .tq-dcard.r { right: 3vw; text-align: right; animation-name: tqPlateInR; grid-template-columns: 1fr 64px; padding: 10px 10px 10px 16px; }
.tq-dcard.r .tq-dface { order: 2; }
.tq-dface { width: 64px; height: 80px; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--tq-gold2), 0 0 0 3px rgba(0,0,0,.6); }
.tq-dface img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; }
.tq-dinfo { display: grid; gap: 4px; min-width: 0; } .tq-dinfo small { font-size: 14px; color: var(--dim); letter-spacing: .1em; }
.tq-dbar { position: relative; } .tq-dbar u { position: absolute; inset: 0 auto 0 0; width: 100%; background: #fff3d6; opacity: .75; transition: width .6s ease; }
.tq-dbar i { position: relative; }
.tq-dcard.r .tq-dbar { transform: scaleX(-1); }
.tq-dlog { display: grid; gap: 3px; margin-bottom: 8px; min-height: 0; font-size: 15px; text-align: left; }
.tq-dlog:empty { display: none; }
.tq-dlog p { margin: 0; padding: 3px 10px; border-radius: 6px; background: rgba(0,0,0,.3); animation: tqSlide .3s ease both; } .tq-dlog p:nth-child(n+2) { opacity: .55; }
.tq-dlog p.me { border-left: 2px solid var(--tq-me); } .tq-dlog p.foe { border-left: 2px solid var(--tq-foe); }
.tq-dlog em { font-style: normal; color: #ffb08a; font-weight: 600; }
.tq-btn.dcmd { display: grid; gap: 1px; min-width: 84px; padding: 6px 12px 5px; }
.tq-btn.dcmd span { font-size: 17px; } .tq-btn.dcmd small { font-size: 14px; opacity: .75; letter-spacing: 0; white-space: nowrap; }
/* 骂倒 changing the 攻击 numbers: the lowered hit chance and the raised damage stand out from the usual grey line. */
.tq-btn.dcmd small:has(em) { opacity: 1; } .tq-btn.dcmd small em { font-style: normal; font-weight: 700; } .tq-btn.dcmd small em.down { color: #ffb08a; } .tq-btn.dcmd small em.up { display: block; color: #bfe6a0; } /* its own line: the two together do not fit a button */
.tq-btn kbd { margin-left: 5px; font: 11px var(--serif); opacity: .55; }
@keyframes tqPlateIn { from { opacity: 0; transform: translateX(-40px); } } @keyframes tqPlateInR { from { opacity: 0; transform: translateX(40px); } }
.tq-dcard.turn { box-shadow: 0 14px 36px rgba(0,0,0,.5), 0 0 0 2px var(--tq-gold), 0 0 30px rgba(246,190,90,.4); }
.tq-dcard.hit { animation: tqHit .45s ease; } .tq-dcard.hit .tq-dbar i, .tq-dcard.hit .tq-dbar u { animation: tqBar .32s steps(8) 1; } /* the bar itself jolts as it drops (not the .tq-dbar: the right card mirrors it with a transform) */
.tq-dcard b { font: 30px/1 var(--brush); letter-spacing: .12em; text-shadow: 0 3px 10px #000; }
.tq-dcard.attacker b { color: #a8d0ff; } .tq-dcard.defender b { color: #ffb8a8; }
.tq-dbar { width: 100%; height: 8px; border-radius: 99px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,230,180,.25); overflow: hidden; }
.tq-dbar i { display: block; height: 100%; border-radius: inherit; transition: width .5s cubic-bezier(.3,.8,.3,1); }
.tq-dcard.attacker .tq-dbar i { background: linear-gradient(90deg, #2f7fe0, #8ec8ff); } .tq-dcard.defender .tq-dbar i { background: linear-gradient(90deg, #e0482f, #ffb08a); }
.tq-dfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; } .tq-dcard.r .tq-dfoot { flex-direction: row-reverse; }
.tq-dfx { --fx: #ff6a50; display: inline-flex; align-items: center; gap: 5px; font-size: 14px; line-height: 20px; white-space: nowrap; color: #ffd0c4; }
.tq-dcard .tq-dfx b { font: 700 12px/1 var(--serif); letter-spacing: 0; text-shadow: none; color: #14100a; }
.tq-dfx:not(:empty) { padding: 0 8px 0 2px; border-radius: 999px; background: rgba(120,30,20,.55); border: 1px solid rgba(255,106,80,.6); }
.tq-dcard em { font: 600 15px var(--serif); font-style: normal; letter-spacing: .18em; color: #f3e6c8; text-shadow: 0 2px 6px #000; }
.tq-duel-vs { position: absolute; left: 50%; top: calc(9vh + 18px); transform: translateX(-50%); font: 64px/1 var(--brush); letter-spacing: .3em; color: #ffd27a;
  text-shadow: 0 4px 0 #3a1008, 0 0 40px rgba(255,170,60,.5); animation: tqVs .5s cubic-bezier(.2,.9,.3,1.3) both; pointer-events: none; }
@keyframes tqVs { from { opacity: 0; transform: translateX(-50%) scale(1.7); } }
.tq-duel-mid { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); padding: 14px 18px; border-radius: 16px; text-align: center;
  background: var(--tq-glass); border: 1px solid var(--tq-gold2); backdrop-filter: blur(10px); box-shadow: 0 20px 50px rgba(0,0,0,.55), 0 0 40px rgba(246,160,60,.15); }
.tq-duel-mid { min-width: min(760px, calc(100vw - 32px)); }
.tq-duel-mid:has(.tq-hint:empty):has(.tq-dlog:empty) { display: none; }
@keyframes tqBar { 0%, 100% { transform: none; } 25% { transform: translateY(-2px); } 50% { transform: translateY(2px); } 75% { transform: translateY(-1px); } }
@keyframes tqHit { 0%, 100% { transform: none; } 20% { transform: translateX(-10px); filter: brightness(2.2) saturate(.3); } 45% { transform: translateX(8px); } 70% { transform: translateX(-4px); } }
@keyframes tqFade { from { opacity: 0; } }
.tq-duel-acts { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.tq-hint { margin-top: 8px; color: var(--dim); font-size: 14px; letter-spacing: .1em; }
/* 自动 / 亲自指挥 switch of the 单挑, a tab on the panel's top edge so it never shifts the command row (T09). */
.tq-dauto { position: absolute; top: 0; right: 18px; transform: translateY(-55%); padding: 3px 12px; font-size: 13px; border-radius: 999px; }
.tq-dauto kbd { margin-left: 6px; font-size: 11px; opacity: .7; }
.tq-ask p { margin: 0 0 10px; font-size: 18px; } .tq-ask div { display: flex; gap: 8px; justify-content: center; }
.tq-ask small { font-size: 14px; color: var(--dim); letter-spacing: .04em; }
.tq-start { bottom: auto; top: 36%; }
.tq-start .tq-btn.primary { padding: 8px 22px; font-size: 18px; } .tq-start kbd { margin-left: 8px; font-size: 12px; opacity: .75; }
.tq-result { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: min(560px, 92vw); padding: 26px 30px; text-align: center; border-radius: 20px; z-index: 3;
  background: linear-gradient(160deg, rgba(40,26,14,.94), rgba(12,8,5,.96)); border: 1px solid var(--tq-gold2); box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 60px rgba(246,160,60,.12); animation: tqPop .45s cubic-bezier(.2,.9,.3,1.2) both; }
.tq-result h2 { font: 54px/1.1 var(--brush); margin: 6px 0 18px; color: #ffe08a; letter-spacing: .14em; text-shadow: 0 4px 0 #3a1008; }
.tq-res-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.tq-res { display: grid; align-content: start; gap: 4px; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.06); }
.tq-res b { font: 24px var(--brush); } .tq-res.attacker b { color: #9cc8ff; } .tq-res.defender b { color: #ffb0a0; }
.tq-res span { font-size: 15px; color: var(--dim); } .tq-res .tq-res-note { color: #ffcf8a; } .tq-res em { font-style: normal; color: var(--bad); font-weight: 600; }

/* battlefield labels */
.tk { pointer-events: none; text-align: center; transform: translateY(-2px); }
.tk .sb { position: relative; display: block; width: 44px; height: 6px; margin: 0 auto; transform: translateY(17px); border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.8), 0 1px 3px rgba(0,0,0,.6); }
/* The bar is the squad's strength out of 100, in ten segments of ten men (N09). */
.tk.attacker .sb { background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.5) calc(10% - 1px) 10%), linear-gradient(90deg, #7cc2ff var(--w), rgba(0,0,0,.6) var(--w)); }
.tk.defender .sb { background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.5) calc(10% - 1px) 10%), linear-gradient(90deg, #ff8a70 var(--w), rgba(0,0,0,.6) var(--w)); }
/* troop type at the left end of the squad bar, the bar itself stays centred */
.tk .sb::before { position: absolute; right: calc(100% + 3px); top: 50%; transform: translateY(-50%); width: 17px; height: 17px; border-radius: 4px;
  font: 700 13px/17px var(--serif); text-align: center; color: #fff3d6; background: rgba(12,10,8,.85); box-shadow: 0 0 0 1.5px var(--kc), 0 1px 3px rgba(0,0,0,.7); text-shadow: none; }
.tk.attacker { --kc: #6ab8ff; } .tk.defender { --kc: #ff8a70; }
.tk.inf .sb::before { content: '步'; } .tk.arc .sb::before { content: '弓'; } .tk.cav .sb::before { content: '骑'; }
/* tactic badges over the troop chip (tacticalview.js badges()): a corner mark in the effect's colour; a hindrance carries the rounds left */
.tk .fxs { position: absolute; right: calc(100% + 3px); bottom: calc(50% + 10px); width: 17px; display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; }
.tk .fxs b { position: relative; display: block; width: 15px; height: 15px; border-radius: 50%; font: 700 11px/15px var(--serif); text-align: center; color: #14100a; background: var(--fx); box-shadow: 0 0 0 1px rgba(0,0,0,.75), 0 0 6px var(--fx); text-shadow: none; }
.tk .fxs b.bad { width: 17px; height: 17px; line-height: 17px; font-size: 12px; animation: tq-low .9s ease-in-out infinite alternate; }
.tk .fxs b.bad::after { content: attr(data-n); position: absolute; left: -5px; top: -6px; min-width: 11px; height: 11px; padding: 0 1px; border-radius: 6px; font: 700 10px/11px var(--serif); color: #fff; background: #1a0f22; box-shadow: 0 0 0 1px var(--fx); }
/* exact strength at the right end while paused or Alt is held */
.tq-detail .tk .sb::after, .alt-held .tk .sb::after { content: attr(data-n); position: absolute; left: calc(100% + 3px); top: 50%; transform: translateY(-50%); padding: 0 3px; border-radius: 3px;
  font: 700 12px/15px var(--serif); color: #fff3d6; background: rgba(12,10,8,.8); text-shadow: none; }
/* the general keeps the squads' form, chip left and bar right, but stands apart: a gold 将 chip of the squads' size (a bigger one covered his horse's hooves), one unbroken orange bar of 体力, its number always shown, the capture gate on the bar */
.tk.gen { z-index: 9999 !important; } /* over the squads' tags, and opaque so none shows through: CSS2DRenderer writes z-index inline each frame, by distance */
.tk.gen .sb { width: 56px; background: linear-gradient(90deg, #f6a03c var(--w), #17120c var(--w)); }
.tk.gen .sb::before { content: '将'; color: #ffe08a; background: #0c0a08; box-shadow: inset 0 0 0 1px #e9c46a, 0 0 0 1.5px var(--kc), 0 1px 3px rgba(0,0,0,.7); }
.tk.gen .sb u { position: absolute; top: -2px; bottom: -2px; left: var(--gate); width: 2px; background: #ffe08a; box-shadow: 0 0 3px #ffd060; }
.tk.gen .sb::after { content: attr(data-n); position: absolute; left: calc(100% + 4px); top: 50%; transform: translateY(-50%); padding: 0 3px; border-radius: 3px; white-space: nowrap; font: 700 12px/15px var(--serif); color: #fff3d6; background: #0c0a08; text-shadow: none; }
.tk.gen .sb.low { background: linear-gradient(90deg, #ffd34d var(--w), #17120c var(--w)); animation: tq-low .9s ease-in-out infinite alternate; }
.tk.gen .sb.low::after { font-size: 14px; line-height: 17px; color: #ffe08a; box-shadow: 0 0 0 1px #e9c46a; }

@keyframes tqFade { from { opacity: 0; } } @keyframes tqFadeOut { to { opacity: 0; transform: scale(1.02); } }
@keyframes tqRise { from { opacity: 0; transform: translate(-50%, 24px); } }
.tq-form { animation-name: tqRiseCard; } @keyframes tqRiseCard { from { opacity: 0; transform: translateY(30px); } }
@keyframes tqDrop { from { opacity: 0; transform: translateY(-20px); } }
@keyframes tqSlide { from { opacity: 0; transform: translateX(20px); } }
@keyframes tqPop { from { opacity: 0; transform: translate(-50%, -46%) scale(.94); } }
@keyframes tqPulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .tq * { animation: none !important; transition: none !important; } }
@media (max-width: 1300px) { .tq-feed { display: none; } }
@media (max-width: 1100px) {
  .tq-console { grid-template-columns: 1fr; left: 12px; right: 12px; transform: none; bottom: 12px; padding: 12px; animation-name: tqFade; }
  /* Four abreast still (the portraits are gone at this width): two rows put 部署 below a short window's edge. */
  .tq-forms { grid-template-columns: repeat(4, minmax(0, 236px)); gap: 8px; width: 96vw; justify-content: center; }
  .tq-card { grid-template-columns: 56px 1fr; } .tq-card.r { grid-template-columns: 1fr 56px; } .tq-face { width: 56px; height: 70px; }
  .tq-round { width: 70px; height: 70px; } .tq-round b { font-size: 30px; }
  .tq-ask { bottom: auto; top: 140px; } .tq-duel-acts { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tq-dcard { width: 44vw; padding: 8px 10px; grid-template-columns: 44px 1fr; gap: 8px; } .tq-dcard.r { grid-template-columns: 1fr 44px; } .tq-dface { width: 44px; height: 56px; } .tq-dcard b { font-size: 20px; } .tq-btn.dcmd { min-width: 0; padding: 5px 8px; } .tq-btn kbd { display: none; } .tq-duel-vs { font-size: 28px; top: calc(9vh + 104px); } .tq-duel-mid { bottom: 16px; width: calc(100vw - 32px); }
}
/* A short window (1024×600): the picker keeps its title, the four cards and 部署 on the screen. */
@media (max-height: 760px) {
  .tq-form-head { padding-top: 8px; } .tq-form-foot { padding-bottom: 10px; } .tq-formation .tq-kicker { display: none; }
  .tq-formation h2 { font-size: 34px; margin-top: 0; } .tq-formation .tq-sub { margin-top: 2px; font-size: 14px; } .tq-kinds { margin-bottom: 12px; } .tq-kinds span { font-size: 14px; padding: 0 10px 0 6px; }
  .tq-form { padding: 6px 8px 6px 4px; grid-template-columns: 76px minmax(0, 1fr); column-gap: 6px; } .tq-form-svg svg { height: 68px; } .tq-form b { font-size: 24px; } .tq-form small { font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
  .tq-deploybar { margin-top: 8px; } .tq-formation .tq-deploy { padding: 8px 32px; font-size: 21px; }
  .tq-vs-side { top: 8px; padding: 5px 12px 5px 5px; } .tq-vs-side.r { padding: 5px 5px 5px 12px; } .tq-vs-side img { width: 48px; height: 60px; } .tq-vs-side { grid-template-columns: 48px auto; } .tq-vs-side.r { grid-template-columns: auto 48px; } .tq-vs-side b { font-size: 24px; }
}
}
@media (max-width: 600px) {
  .setup h2 { font-size: 32px; } .levels { flex-wrap: wrap; justify-content: center; } .level { width: min(180px, 44vw); padding: 10px; }
  .rulers { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; } .ruler { height: 200px; } .ruler img { height: 145px; }
}
@media (max-width: 1100px) { body[data-screen="strategy"] .topbar { max-width: calc(100% - 120px); } }
/* Just above that breakpoint the one-row bar, with its three view buttons, would reach the 系统 button: it closes up instead. */
@media (min-width: 1101px) and (max-width: 1200px) {
  body[data-screen="strategy"] .topbar { gap: 11px; padding: 6px 12px; }
  body[data-screen="strategy"] .topbar .wikibtn, body[data-screen="strategy"] .topbar .roadsbtn, body[data-screen="strategy"] .topbar .terrbtn { padding: 2px 8px; }
}
/* Laptop widths: the 将令 row (four troop types and 全军) is drawn tighter so it stays on one line inside the screen. */
@media (max-width: 1440px) { .tq-cmd { padding: 5px 6px; } .tq-orders { gap: 9px; } .tq-all { padding-left: 9px; } }
@media (max-width: 1300px) {
  .tq-console { padding-left: 10px; padding-right: 10px; }
  .tq-cmd { padding: 5px 4px; gap: 3px; font-size: 15px; letter-spacing: .02em; } .tq-seg { padding: 2px; gap: 1px; }
  .tq-orders { gap: 6px; } .tq-row { gap: 4px; } .tq-all { padding-left: 6px; } .tq-kind { font-size: 19px; } .tq-all .tq-kind { font-size: 16px; }
  .tq-console .tq-label { padding-right: 5px; }
}
/* Narrow screens: keep the 白兵 console to roughly a third of the height so the field stays visible. */
@media (max-width: 1100px) {
  .tq-console { gap: 8px; padding: 10px 12px; }
  .tq-console .tq-label { display: none; }
  .tq-orders, .tq-side { flex-wrap: wrap; justify-content: center; gap: 6px 10px; } .tq-ctrl { margin-left: 0; }
  .tq-row { grid-template-columns: 34px 1fr; margin: 2px 0; } .tq-kind { font-size: 18px; } .tq-row.none { display: none; }
  .tq-seg { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; } .tq-all { padding-left: 0; border-left: 0; } .tq-all .tq-seg { grid-template-columns: repeat(2, 1fr); } .tq-cmd { padding: 5px 6px; font-size: 15px; letter-spacing: .04em; justify-content: center; }
  .tq-tactics { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .tq-tac { flex-direction: column; gap: 2px; padding: 5px 2px; font-size: 14px; } .tq-tac span { min-width: 20px; height: 20px; font-size: 13px; }
  .tq-ctrl { margin-top: 6px; }
}
@media (max-width: 1100px) { .tq-row { grid-template-columns: 46px 1fr; } .tq-kind { white-space: nowrap; } .tq-kind small { font-size: 11px; margin-left: 1px; } }
.tq:has(.tq-result) .tq-console, .tq:has(.tq-result) .tq-feed { opacity: 0; pointer-events: none; transition: opacity .3s; }
/* 单挑 scene: the field HUD gives way to the letterbox; commands sit just above the bottom bar. */
.tq.dueling .tq-top { opacity: 0; transition: opacity .3s; }
.tq.dueling .tq-duel-mid { bottom: calc(9vh + 14px); }

/* ---------- Officer sheet ---------- */
.ocard { display: grid; grid-template-columns: 220px minmax(260px, 1fr); gap: 18px; }
.ocard > img { width: 220px; aspect-ratio: 2 / 3; object-fit: cover; object-position: 50% 12%; border: 1px solid var(--gold2); border-radius: 2px; box-shadow: 0 8px 24px #0008; }
.ocard-info { display: flex; flex-direction: column; gap: 7px; }
.ocard-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.ocard-pair .ocard { grid-template-columns: 132px minmax(0, 1fr); gap: 14px; } .ocard-pair .ocard > img { width: 132px; }
.ocard-name { margin: 0; font: 22px var(--brush); color: var(--gold); letter-spacing: 2px; }
@media (max-width: 900px) { .ocard-pair { grid-template-columns: 1fr; gap: 16px; } }
.ocard-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.ocard-tags .owner { font-size: 14px; padding: 1px 8px; border-radius: 2px; color: #fff; background: #555; }
.tagc { font-size: 14px; padding: 0 7px; border: 1px solid var(--gold2); border-radius: 2px; color: var(--gold); }
/* 白兵 / 单挑 资料: whose sheet it is, in the side's own colour on the field (blue ours, red theirs). */
.tagc.ocard-side.me { border-color: #6ab8ff; color: #cfe6ff; background: rgba(60,130,220,.28); } .tagc.ocard-side.foe { border-color: #ff8a70; color: #ffd9cf; background: rgba(210,70,50,.28); }
.meter { display: grid; grid-template-columns: 40px 1fr 52px; gap: 10px; align-items: center; font-size: 15px; }
.meter span { color: var(--dim); } .meter b { text-align: right; font-variant-numeric: tabular-nums; }
.meter .track { height: 8px; border-radius: 4px; background: #0008; box-shadow: inset 0 0 0 1px #ffffff12; overflow: hidden; }
.meter .track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a8803c, #f2d48c); animation: meterIn .6s cubic-bezier(.2,.9,.3,1) both; transform-origin: left; }
.meter.war i { background: linear-gradient(90deg, #8a2c1e, #ff7a62); } .meter.int i { background: linear-gradient(90deg, #2f5fb8, #8ec8ff); }
.meter.vir i { background: linear-gradient(90deg, #3f7a2a, #8fd46a); } .meter.low i { background: linear-gradient(90deg, #6a1a10, #ff5a40); } .meter.low b { color: var(--bad); }
@keyframes meterIn { from { transform: scaleX(0); } }
.ocard-gear { grid-template-columns: 1fr 1fr; padding: 6px 0 0; margin-top: 4px; border-top: 1px solid color-mix(in srgb, var(--rule) 50.2%, transparent); }
.ocard-gear small { color: var(--dim); font-weight: 400; font-size: 14px; }
.ocard-gear span, .ocard-gear b { white-space: nowrap; }
.ocard-pair .ocard-gear { grid-template-columns: 1fr; gap: 4px; } /* two sheets side by side: one item a row, never a label broken over two lines */
.ocard .foot { margin-top: auto; }
@media (max-width: 600px) { .ocard { grid-template-columns: 1fr; } .ocard > img { width: 140px; justify-self: center; } }

/* ---------- War result ledger ---------- */
.result.lose h2 { color: #c8c0b0; text-shadow: 0 4px 0 #2a2420; }
.ledgers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 6px 0 10px; }
.ledger { padding: 8px 10px; border-radius: 4px; background: #0005; border: 1px solid color-mix(in srgb, var(--rule) 37.6%, transparent); }
.ledger.me { border-color: #ffd89055; }
.ledger h4 { margin: 0 0 6px; display: flex; gap: 8px; align-items: center; font: 600 16px var(--serif); }
.ledger h4 small { margin-left: auto; color: var(--dim); font-weight: 400; font-size: 14px; }
.ledger .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lrow { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 8px; align-items: center; padding: 3px 0; font-size: 15px; border-top: 1px dashed #ffffff10; }
.lrow img { width: 28px; height: 34px; object-fit: cover; object-position: 50% 10%; border-radius: 2px; border: 1px solid var(--rule); }
.lrow.settle { grid-template-columns: 28px 1fr auto minmax(120px, auto); }
.lrow.settle select { font: inherit; background: #0006; color: inherit; border: 1px solid var(--rule); border-radius: 3px; padding: 2px 4px; }
.settle-warn { margin: 0 auto 0 0; color: var(--bad); font-size: 14px; }
.settle-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 2px 0; color: var(--dim); font-size: 14px; } .settle-sum .over { color: var(--bad); }
.lrow .tr { font-variant-numeric: tabular-nums; color: var(--dim); } .lrow .tr em { color: var(--bad); font-style: normal; }
.fate { font-size: 14px; padding: 0 6px; border-radius: 2px; background: #ffffff10; white-space: nowrap; }
.fate.good { color: var(--good); } .fate.bad { color: var(--bad); background: #ff8a7018; }
@media (max-width: 700px) { .ledgers { grid-template-columns: 1fr; } }

/* ---------- 命令演出 (command vignette) ---------- */
.vig { position: absolute; left: 0; right: 0; top: 0; z-index: 3; padding: 8px 4px 10px; background: var(--lacquer); border-radius: 4px; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--gold2), inset 0 0 0 3px var(--lacquer), inset 0 0 0 4px var(--rule), 0 10px 30px #000c; clip-path: inset(0 0 100% 0); }
.vig.floating { position: fixed; left: 50%; top: 50%; right: auto; width: min(668px, 94vw); transform: translate(-50%, -50%); z-index: 26; padding: 12px 8px 12px; }
/* The rest of the screen dims while a vignette plays in the middle of it. */
.vig-dim { position: fixed; inset: 0; z-index: 25; background: radial-gradient(ellipse at center, #0006, #000a); opacity: 0; transition: opacity .3s; pointer-events: none; }
.vig-dim.in { opacity: 1; }
.vig.in { animation: vigIn .32s cubic-bezier(.3,.8,.3,1) forwards; }
.vig.out { animation: vigOut .32s cubic-bezier(.6,0,.8,.4) forwards; }
@keyframes vigIn { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes vigOut { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(100% 0 0 0); } }
.vig-frame { position: relative; padding: 6px; border-radius: 2px; background: linear-gradient(135deg, #c8a050, #6a4a20 40%, #e8c878 60%, #6a4a20);
  box-shadow: 0 0 0 1px #000, 0 4px 14px #0008; }
.vig-frame::before, .vig-frame::after { content: '◆'; position: absolute; font-size: 10px; line-height: 1; color: #fff0c0; text-shadow: 0 0 4px #000; }
.vig-frame::before { top: -1px; left: -1px; } .vig-frame::after { bottom: -1px; right: -1px; }
.vig canvas { display: block; width: 100%; max-width: 640px; margin: 0 auto; image-rendering: pixelated; /* 640-wide storyboard frames, shown 1:1 in the middle of the screen */ box-shadow: inset 0 0 0 1px #000; background: #000; }
.vig-cap { min-height: 1.6em; margin-top: 10px; font: 600 20px/1.6 var(--serif); letter-spacing: 2px; color: #fff3d6; text-align: center; }
.books i.blink { animation: pipBlink .133s steps(2) infinite; } /* the original's counter: 4 frames on, 4 off */
.books + b.blink { animation: blink .133s steps(2) infinite; }
/* The spent book, told in the middle where the picture is about to open (D63, 2026-11-14): the top bar's pip alone was easy to miss. */
.vig-book { position: fixed; left: 50%; top: 50%; z-index: 26; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  background: var(--lacquer); border: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); border-radius: 4px; box-shadow: 0 10px 30px #000a; pointer-events: none;
  font: 22px var(--serif); letter-spacing: 2px; color: var(--ink, #f3e6c8); opacity: 0; transition: opacity .15s; }
.vig-book.in { opacity: 1; }
.vig-book i { width: 18px; height: 28px; border-radius: 2px; background: linear-gradient(#f2d48c, #a8803c); box-shadow: 0 0 0 1px #0008; animation: pipBlink .133s steps(2) infinite; }
.vig-book.spent i { animation: none; background: #3a2c1e; }
.vig-book small { font-size: 16px; color: var(--dim); letter-spacing: 1px; }
.vig-book small:empty { display: none; }
.vig-book small b { font-size: 26px; color: #ffd890; margin: 0 2px; }
@media (prefers-reduced-motion: reduce) { .vig-book i { animation: none; } }
.vig-more { position: absolute; right: 18px; bottom: 14px; font-size: 14px; color: #fff3d6; animation: blink .53s steps(2) infinite; }
@keyframes pipBlink { 50% { background: #fff4c0; box-shadow: 0 0 8px #ffd070; } }
@media (prefers-reduced-motion: reduce) { .vig.in, .vig.out { animation-duration: .01ms; } }

/* 武器屋: weapons and armour in aligned tables */
.shop { margin: 8px 0 4px; }
.shop h4 { margin: 4px 0; font: 600 15px var(--serif); color: var(--gold, #e8c878); }
.shop-row { display: grid; grid-template-columns: minmax(7em, 1.6fr) 3em 3.5em 3em 5em minmax(5em, 1fr); gap: 8px; align-items: center; width: 100%; padding: 5px 8px; font: inherit; font-size: 15px; text-align: left; color: inherit; background: #0004; border: 1px solid var(--rule)50; border-radius: 3px; margin: 2px 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.shop-row:not(.head):not(:disabled):hover { background: #ffd89018; border-color: #ffd89060; }
.shop-row:disabled { opacity: .5; cursor: default; }
.shop-row.head { background: none; border-color: transparent; cursor: default; color: var(--dim); font-size: 14px; padding-block: 0; }
.shop-row .nm { display: flex; align-items: center; gap: 6px; }
.shop-row .eqi { width: 38px; height: 38px; flex: none; object-fit: contain; filter: drop-shadow(0 1px 1px #000a); }
.ocard-gear .eqi { width: 28px; height: 28px; margin-right: 6px; vertical-align: -9px; object-fit: contain; filter: drop-shadow(0 1px 1px #000a); }
#tip .eqi { width: 22px; height: 22px; vertical-align: -6px; object-fit: contain; }
.shop-row .up { color: var(--good, #7fd07f); } .shop-row .down { color: var(--bad); } .shop-row small { color: var(--dim); }

/* Lighter picture preset offer (src/quality.js): a corner notice above 结束本月行动, never a blocking dialog. */
.qnotice { position: fixed; right: 12px; bottom: 64px; width: min(300px, calc(100vw - 24px)); padding: 12px 14px; z-index: 24; font-size: 15px; line-height: 1.5; animation: qrise .25s ease; }
@keyframes qrise { from { transform: translateY(12px); opacity: 0; } }
.qnotice p { margin: 0; }
.qnotice .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* The flat painted war map (src/warmap2d.js, ?flat): the map never moves, so the HUD keeps to a strip above it
   (FLAT_INSET.top) and a strip below it (FLAT_INSET.bottom) and never covers a cell. */
.flatwar { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
body:not(.flat2d) .flatwar { display: none; }
/* The flat 战略地图 (src/strategyflat.js): input goes through to the WebGL canvas underneath; only its tags take the pointer. */
.flatstrategy { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.flatstrategy canvas { display: block; }
body:not(.flatmap) .flatstrategy { display: none; }
body.flat2d .labels { display: none; }
body.flat2d .warbar { top: 6px; padding: 3px 14px; gap: 14px; font-size: 14px; }
body.flat2d .warbar .day { font-size: 18px; } body.flat2d .warbar .side b { font-size: 15px; }
body.flat2d[data-screen="war"] .sysbtns { top: 8px; left: 12px; }
@media (max-width: 1100px) { body.flat2d .warbar { left: 96px; max-width: calc(100% - 108px); } } /* clear of 系统 */
body.flat2d .warcards { bottom: 8px; right: 396px; }
/* One width rule for the cards, the log and the 布阵完成 box beside them, so they never meet. */
body.flat2d { --cardw: clamp(432px, 28vw, 520px); }
@media (min-width: 1201px) { body.flat2d .unitpanel { flex-basis: var(--cardw); } }
body.flat2d .unitpanel { padding: 6px 10px; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
body.flat2d .unitpanel > img { width: 56px; height: 76px; }
body.flat2d .unitpanel .info { gap: 2px; }
body.flat2d .unitpanel h3 { font-size: 20px; line-height: 1; }
body.flat2d .unitpanel .bar { font-size: 11px; grid-template-columns: 1em minmax(0, 1fr) 4.4em; } body.flat2d .unitpanel .bar .track { height: 5px; }
body.flat2d .unitpanel dl { gap: 0 6px; margin: 0; font-size: 12.5px; line-height: 1.3; }
body.flat2d .unitpanel .gear { font-size: 12.5px; line-height: 1.3; padding-top: 2px; gap: 0 12px; } body.flat2d .unitpanel .gear .eqi { width: 24px; height: 24px; vertical-align: -8px; margin-right: 3px; }
body.flat2d .unitpanel .chip { font-size: 11.5px; line-height: 1.3; }
body.flat2d .unitpanel .chips ~ .hint { display: none; } /* the strip is short: a state's wording outranks the how-to line */
body.flat2d .unitpanel .hint { font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* His commands (app.js warUnit, D32) take the how-to line's place under the particulars, so the card keeps its size in the short strip. */
body.flat2d .unitpanel:has(> .acts:not(:empty)) { row-gap: 0; padding-block: 4px; } body.flat2d .unitpanel:has(> .acts:not(:empty)) .info > .hint { display: none; }
body.flat2d .unitpanel:has(> .acts:not(:empty)) .gear .eqi { width: 18px; height: 18px; vertical-align: -4px; }
body.flat2d .unitpanel .acts { grid-column: 2; max-width: none; gap: 4px; justify-content: flex-start; } body.flat2d .unitpanel .acts .btn { font-size: 13px; padding: 2px 12px; min-width: 0; white-space: nowrap; }
/* Two cards in a row on a window this size: the particulars close up so they stay inside their cards. */
@media (min-width: 1201px) and (max-width: 1300px) { body.flat2d .unitpanel { padding: 6px 8px; column-gap: 8px; } body.flat2d .unitpanel dl { font-size: 11.5px; column-gap: 3px; } }
body.flat2d .wardock { bottom: 8px; right: 12px; padding: 6px; }
.wardock .turnpair { bottom: calc(100% + 6px); right: 0; padding: 6px; display: flex; gap: 6px; }
.wardock .turnbtn { padding: 5px 7px; }
body.flat2d .wardock .turnpair { display: none; } /* the flat map has no turn */
.wardock .terrainbtn[aria-pressed=true] { border-color: #ffd890; color: #fff4d8; background: linear-gradient(#5a3a1c, #2c1e12); }
/* The 攻击 prompt beside a peeked enemy (app.js besideUnit). */
.unitacts { position: fixed; z-index: 4; display: flex; flex-direction: column; gap: 6px; padding: 6px; animation: actsIn .16s ease-out both; }
.unitacts .btn { font-size: 15px; padding: 6px 16px; min-width: 5.5em; }
.unitacts[data-side=r] { transform-origin: left center; } .unitacts[data-side=l] { transform-origin: right center; }
@keyframes actsIn { from { opacity: 0; transform: scale(.92); } }
body.cine .unitacts, body.cine .actpanel { display: none; }
/* The action panel (app.js actPanel, D32): the 计略, its targets and the confirmation, at the left edge. 3D: a column from under
   系统 to the cards (its height set by placePanel), the foot at its bottom; flat: rising from the strip of cards. */
.actpanel { position: fixed; z-index: 4; left: 12px; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; animation: apIn .14s ease-out both; }
@keyframes apIn { from { opacity: 0; transform: translateX(-8px); } }
.actpanel .ap-head { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 10px; border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); padding-bottom: 4px; }
.actpanel .ap-head > b { font: 22px var(--brush); color: var(--atk); letter-spacing: 2px; white-space: nowrap; }
.actpanel .ap-pool { font-size: 13px; color: var(--dim); white-space: nowrap; } .actpanel .ap-pool b { color: var(--gold); font-size: 17px; font-weight: 600; }
.actpanel .ap-step { grid-column: 1 / -1; display: flex; gap: 6px; font-size: 13px; color: var(--dim); } .actpanel .ap-step i { font-style: normal; opacity: .6; } .actpanel .ap-step span:last-child { color: #d9b3ff; }
.actpanel .ap-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 5px; padding: 2px; }
.actpanel.flat .ap-body { flex: 0 1 auto; }
.actpanel .ap-body.strats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actpanel .ap-body .btn { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; font-size: 15px; padding: 5px 10px; text-align: left; min-width: 0; }
.actpanel .ap-body .btn span { flex: 1; white-space: nowrap; } .actpanel .ap-body .btn small { color: var(--dim); font-size: 12px; }
.actpanel .ap-body.strats .btn em { flex-basis: 100%; font-style: normal; font-size: 11.5px; line-height: 1.3; color: var(--bad); white-space: normal; }
.actpanel .ap-body.targets .btn { flex-wrap: nowrap; border-color: #a070d8; }
.actpanel .ap-body.targets .btn em { font-style: normal; color: var(--gold); min-width: 2.6em; text-align: right; }
.actpanel .ap-body.targets .btn:hover, .actpanel .ap-body.targets .btn:focus-visible, .actpanel .ap-body.targets .btn.hot { background: rgba(160, 112, 216, .28); }
.actpanel .ap-body.targets .btn.on { background: rgba(160, 112, 216, .5); border-color: #e0c0ff; box-shadow: inset 3px 0 0 #e0c0ff; }
/* 攻击's enemies are red, as their cells are. */
.actpanel .ap-body.attacks { min-height: 34px; } /* one whole row at least: it scrolls, never shrinks to a sliver */
.actpanel .ap-body.attacks .btn { border-color: #d86a5a; } .actpanel .ap-body.attacks .btn em { color: var(--dim); }
.actpanel .ap-body.attacks .btn:hover, .actpanel .ap-body.attacks .btn:focus-visible, .actpanel .ap-body.attacks .btn.hot { background: rgba(216, 106, 90, .26); }
.actpanel .ap-body.attacks .btn.on { background: rgba(216, 106, 90, .46); border-color: #ffc0b0; box-shadow: inset 3px 0 0 #ffc0b0; }
.actpanel.attacks .ap-step span:last-child, .actpanel.strike .ap-step span:last-child { color: #ffb0a0; }
.actpanel .ap-body.none .hint { margin: 0; font-size: 13px; line-height: 1.5; }
.actpanel .ap-foot { flex: none; display: grid; gap: 6px; border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); padding-top: 6px; }
.actpanel .ap-info { margin: 0; min-height: 4.6em; font-size: 12.5px; line-height: 1.5; } .actpanel .ap-info b { color: var(--gold); } .actpanel .ap-info em { display: block; color: var(--bad); font-style: normal; }
.actpanel .ap-sum p { margin: 0; font-size: 13.5px; line-height: 1.5; } .actpanel .ap-sum b { color: var(--gold); }
.actpanel .ap-sum .ap-who { font-size: 15px; color: #fff3d6; } .actpanel .ap-sum .ap-who i { font-style: normal; color: var(--dim); margin: 0 5px; }
.actpanel .ap-sum .ap-does { color: var(--dim); font-size: 12.5px; } .actpanel .ap-sum .ap-key { color: #ffd27a; font-size: 12.5px; } .actpanel .ap-sum .ap-warn { color: #ff9a8a; font-size: 12.5px; } .actpanel .ap-sum .hint { font-size: 12.5px; color: #d9b3ff; }
/* 返回 and 定位目标 share a row; 施展, the one that commits, has the full width under them (three in one row ran past 252px). */
.actpanel .ap-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; } .actpanel .ap-btns .btn { font-size: 14px; padding: 5px 8px; white-space: nowrap; justify-content: center; }
.actpanel .ap-btns .ap-go { grid-column: 1 / -1; font-size: 15px; letter-spacing: 4px; }
/* No 定位目标 (the flat map is all in view): 返回 and 施展 fit one row. */
.actpanel .ap-btns:not(:has(.ap-aim)) { grid-template-columns: auto minmax(0, 1fr); } .actpanel .ap-btns:not(:has(.ap-aim)) .ap-go { grid-column: auto; }
/* Held off for a moment after the target is picked (src/commitguard.js GUARD): it fills in as it becomes pressable. */
.actpanel .ap-go.arming { opacity: .55; animation: apArm .3s linear forwards; } @keyframes apArm { to { opacity: 1; } }
/* A short window (1024×600): the targets list keeps room for two rows; the hint under the summary goes (施展's own label and the card say it). */
@media (max-height: 760px) { .actpanel .ap-sum .hint { display: none; } .actpanel.strike .ap-sum .ap-who { display: none; } /* the step line above says it */ .actpanel .ap-sum p { line-height: 1.35; } .actpanel .ap-btns .btn { padding-top: 3px; padding-bottom: 3px; } .actpanel .ap-foot { gap: 4px; padding-top: 4px; } }
@media (max-width: 1200px) { .actpanel { padding: 6px 8px 8px; gap: 4px; } .actpanel .ap-body .btn { font-size: 14px; padding: 4px 8px; } .actpanel .ap-sum p { font-size: 12.5px; line-height: 1.4; } .actpanel .ap-sum .ap-does { display: none; } }
/* The log sits above the dock (its width, the last few lines) wherever there is no 300px gap between the foe's card and the dock; with that gap it stands beside the cards. */
body.flat2d .logbox { top: auto; bottom: 64px; left: auto; right: 12px; width: 372px; height: 64px; max-height: none; font-size: 12px; padding: 3px 10px; line-height: 1.4; }
body.flat2d .logbox p { margin: 1px 0; padding-bottom: 1px; }
@media (min-width: 1664px) { body.flat2d .logbox { bottom: 8px; left: calc(var(--cardw) * 2 + 36px); right: 396px; width: auto; height: 88px; } }
body.flat2d .deploybtn { top: auto; bottom: 8px; left: calc(var(--cardw) + 24px); right: 396px; transform: none; }
@media (max-width: 1200px) { body.flat2d .deploybtn { left: auto; right: 12px; bottom: 66px; width: 360px; } body.flat2d:has(.deploybtn) .logbox { display: none; } } /* the box takes the log's place above the dock while deploying */

/* An AI faction's turn on the strategy map (the original's 「××军　戦略中」 window, src/pace.js). */
.aiturn { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); opacity: 0; transition: opacity .2s, transform .2s; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 10px 26px 10px 14px; font: 600 20px/1 var(--serif); letter-spacing: 3px; pointer-events: auto; cursor: default; }
.aiturn.in { opacity: 1; transform: translate(-50%, 0); }
.aiturn > i { width: 6px; align-self: stretch; border-radius: 2px; }
.aiturn .avatar { width: 40px; height: 40px; }
.aiturn b { color: var(--gold); font-weight: 600; }
.aiturn.aside { opacity: 0; pointer-events: none; }
/* 欣赏模式 (F07): the HUD, the city tags and the hover tip step aside; a quiet way back stays in the corner (bottom left: not under 结束本月行动, which comes back where a second click would land). */
body.scenic #ui > *, body.scenic .labels, body.scenic #tip { opacity: 0 !important; pointer-events: none !important; transition: opacity .45s; }
body.scenic .labels * { pointer-events: none !important; }
.scenic-exit { position: fixed; left: 16px; bottom: 16px; z-index: 20; display: flex; gap: 8px; align-items: center; opacity: .9; transition: opacity 1.2s; }
.scenic-exit.dim { opacity: .35; } .scenic-exit:hover, .scenic-exit:focus-visible { opacity: 1; transition: opacity .2s; }

/* ---------- The ending (src/ending.js) ---------- */
.ending { position: fixed; inset: 0; z-index: 40; background: #000; overflow: hidden; outline: none; cursor: pointer; user-select: none; color: var(--ink); font-family: var(--serif); }
.end-shot { position: absolute; inset: -3%; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.4s ease; animation: end-drift 34s ease-out both; }
.end-shot.in { opacity: 1; }
.end-shot.dim { filter: brightness(.42) saturate(.8); }
.end-shot.deep { filter: brightness(.22) saturate(.6); }
.end-shot.still { animation: none; }
@keyframes end-drift { from { transform: scale(1.07) translateY(1.2%); } to { transform: scale(1) translateY(0); } }
.end-layer { position: absolute; z-index: 1; }
.end-more { color: var(--gold); font-size: 15px; letter-spacing: 3px; animation: end-more 1.3s ease-in-out infinite; }
@keyframes end-more { 50% { opacity: .35; } }

.end-text { left: 0; right: 0; bottom: 0; padding: 150px 8vw 7vh; text-align: center; background: linear-gradient(transparent, #000000c4 62%); transition: opacity .35s; }
.end-text p { margin: 0 0 .55em; font-size: clamp(20px, 2.5vw, 34px); letter-spacing: .14em; color: #fbf3df; text-shadow: 0 2px 10px #000; opacity: 0; transform: translateY(8px); transition: opacity 1.1s ease, transform 1.1s ease; }
.end-text.in p { opacity: 1; transform: none; }
.end-text.out, .end-result.out { opacity: 0; }

.end-frame { flex: none; border: 1px solid var(--gold); box-shadow: 0 0 0 4px #120c08d0, 0 0 0 5px var(--gold2), 0 18px 50px #000c; background: #120c08; overflow: hidden; }
.end-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }

.end-result { inset: 0; display: flex; align-items: center; justify-content: center; gap: 5vw; padding: 4vh 6vw; background: radial-gradient(ellipse at center, #000000a8, #00000070 75%); opacity: 0; transition: opacity 1s ease; }
.end-result.in { opacity: 1; }
.end-result.out { transition-duration: .35s; }
.end-result .end-frame { height: min(70vh, 620px); aspect-ratio: 2 / 3; }
.end-result-body { min-width: 0; width: min(520px, 48vw); text-shadow: 0 2px 8px #000; }
.end-result h2 { font: clamp(46px, 6.4vw, 84px) var(--brush); letter-spacing: .16em; color: #ffe08a; margin: 0 0 12px; text-shadow: 0 4px 0 #4a1408, 0 0 30px #f6a03c88; }
.end-when { font-size: clamp(16px, 1.8vw, 22px); letter-spacing: .08em; margin: 0 0 4px; }
.end-level { color: var(--dim); font-size: 14px; letter-spacing: .2em; margin: 0 0 22px; }
.end-score { display: flex; align-items: baseline; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--gold2); margin-bottom: 14px; }
.end-score span { font-size: 18px; letter-spacing: .2em; color: var(--gold); }
.end-score b { font-size: clamp(48px, 5.4vw, 72px); line-height: 1; color: #ffe08a; font-variant-numeric: tabular-nums; }
.end-parts { display: grid; gap: 8px; }
.end-part { display: grid; grid-template-columns: 3.4em 3em 1fr; align-items: baseline; gap: 10px; font-size: 18px; }
.end-part span { color: var(--gold); letter-spacing: .1em; }
.end-part b { text-align: right; font-size: 24px; font-variant-numeric: tabular-nums; }
.end-part small { color: var(--dim); font-size: 14px; }
.end-hint { margin: 20px 0 0; font-size: 15px; color: #f0d9a8; letter-spacing: .06em; }
.end-result > .end-more { position: absolute; right: 4vw; bottom: 4vh; }

.end-heading { left: 0; right: 0; top: 38vh; text-align: center; font: clamp(48px, 6vw, 80px) var(--brush); letter-spacing: .24em; color: #ffe08a; text-shadow: 0 4px 0 #4a1408, 0 0 30px #f6a03c88; transition: top .8s ease, font-size .8s ease, color .8s ease; }
.end-heading.small { top: 3.5vh; font-size: clamp(22px, 2.4vw, 32px); color: var(--gold); text-shadow: 0 2px 6px #000; }
.end-card { inset: 11vh 0 6vh; display: flex; align-items: center; justify-content: center; gap: 4.5vw; opacity: 0; transform: translateX(26px); transition: opacity .55s ease, transform .55s ease; }
.end-card.in { opacity: 1; transform: none; }
.end-card.out { opacity: 0; transform: translateX(-26px); transition-duration: .28s; }
.end-card .end-frame { height: min(74vh, 640px); aspect-ratio: 2 / 3; }
.end-card-body { width: min(400px, 44vw); min-width: 0; text-shadow: 0 2px 8px #000; }
.end-card-body > small { color: var(--gold); letter-spacing: .4em; font-size: 16px; }
.end-card h3 { font: clamp(46px, 5.6vw, 76px) var(--brush); letter-spacing: .1em; font-weight: 400; color: #fff4d8; margin: 4px 0 18px; }
.end-card.is-ruler h3 { color: #ffe08a; }
.end-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px 14px; padding: 14px 0; border-block: 1px solid var(--gold2); }
.end-stats span { display: block; font-size: 13px; color: var(--gold); letter-spacing: .14em; }
.end-stats b { font-size: 30px; font-variant-numeric: tabular-nums; }
.end-gear { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 14px; font-size: 17px; color: var(--dim); letter-spacing: .08em; }

.end-wall { inset: 11vh 0 0; overflow: hidden; mask-image: linear-gradient(transparent, #000 7%, #000 92%, transparent); }
.end-wall-roll { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 22px 12px; width: min(1120px, 92vw); margin: auto; will-change: transform; }
.end-wall-one { text-align: center; }
.end-wall-one img, .end-wall-one .avatar { width: 88px; height: 88px; object-fit: cover; object-position: top; border: 1px solid var(--gold2); display: block; margin: 0 auto 6px; }
.end-wall-one span { font-size: 16px; letter-spacing: .08em; text-shadow: 0 1px 4px #000; }

.end-credits { inset: 0; overflow: hidden; text-align: center; text-shadow: 0 2px 6px #000; }
.end-credits-roll { width: min(1040px, 92vw); margin: auto; will-change: transform; }
.end-credits h2 { font: clamp(44px, 5.4vw, 72px) var(--brush); letter-spacing: .2em; font-weight: 400; color: #ffe08a; margin: 0 0 12px; }
.end-credits-lead { font-size: clamp(16px, 1.8vw, 22px); letter-spacing: .12em; margin: 0 0 7vh; color: var(--gold); }
.end-names { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 18px; }
.end-names p, .end-makers p { margin: 0; font-size: clamp(15px, 1.6vw, 20px); overflow-wrap: anywhere; }
.end-names small, .end-makers small { color: var(--dim); font-size: .72em; margin-left: .3em; white-space: nowrap; overflow-wrap: normal; display: inline-block; }
.end-makers { margin-top: 10vh; padding-bottom: 2vh; }
.end-makers p { font-size: clamp(22px, 2.5vw, 32px); color: #fff4d8; margin-bottom: 10px; letter-spacing: .06em; }
.end-fin { left: 0; right: 0; bottom: 7vh; display: flex; flex-direction: column; align-items: center; gap: 12px; opacity: 0; transition: opacity 1.4s ease; }
.end-fin.in { opacity: 1; }
.end-fin b { font: 400 clamp(52px, 6vw, 84px) var(--brush); color: #ffe08a; text-shadow: 0 4px 0 #4a1408; }

.end-fall { left: 0; right: 0; bottom: 0; padding: 150px 8vw 6vh; text-align: center; background: linear-gradient(transparent, #000000d0 55%); opacity: 0; transition: opacity 1.4s ease; display: flex; flex-direction: column; align-items: center; }
.end-fall.in { opacity: 1; }
.end-fall h2 { font: 400 clamp(46px, 6vw, 80px) var(--brush); letter-spacing: .2em; color: #d8d4cc; margin: 0 0 14px; text-shadow: 0 4px 0 #0008; }
.end-fall p { margin: 0 0 .4em; font-size: clamp(18px, 2.2vw, 28px); letter-spacing: .12em; color: #e8e2d4; }
.end-fall .end-more { margin-top: 16px; color: var(--dim); }

@media (max-width: 720px) {
  .end-result, .end-card { flex-direction: column; gap: 14px; justify-content: flex-start; padding-top: 3vh; }
  .end-result .end-frame { height: 26vh; } .end-card .end-frame { height: 42vh; }
  .end-result-body, .end-card-body { width: 90vw; }
  .end-names { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Gamepad (src/pad.js, app.js "Gamepad") ----------
   body[data-input=pad] while the pad is the input in use: the pointer goes, the focus shows on whatever has it (a focus moved by
   the pad never counts as :focus-visible), and each <kbd> on a control bound to a button (data-pad) or naming one (data-glyph)
   shows that button's glyph (--g-a … from pad.js) instead of the key; keys with no button (the 单挑 numbers) step aside. */
body[data-input=pad], body[data-input=pad] * { cursor: none !important; }
body[data-input=pad] :is(button, [tabindex="0"], select, input, tr):focus { outline: 2px solid #ffd890; outline-offset: 2px; box-shadow: 0 0 0 4px #00000080, 0 0 18px #f6a03c66; }
body[data-input=pad] .otable tbody tr:focus { background: #ffffff16; }
kbd.pad-only { display: none; }
body[data-input=pad] kbd { display: none; }
body[data-input=pad] [data-pad] kbd, body[data-input=pad] kbd[data-glyph] {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 22px; height: 20px; margin-left: 6px; padding: 0 5px; font-size: 0;
  border: 1px solid #ffe2a080; border-radius: 10px; background: radial-gradient(circle at 50% 35%, #4a3a26, #1a120c); vertical-align: -3px; color: #fff1d0; opacity: 1;
}
body[data-input=pad] [data-pad] kbd::before, body[data-input=pad] kbd[data-glyph]::before { content: var(--g, ''); font: 600 12px/1 var(--serif); letter-spacing: 0; }
[data-pad~="a"] kbd, kbd[data-glyph="a"] { --g: var(--g-a); --gi: var(--gi-a); --gw: var(--gw-a); } [data-pad~="b"] kbd, kbd[data-glyph="b"] { --g: var(--g-b); --gi: var(--gi-b); --gw: var(--gw-b); }
[data-pad~="x"] kbd, kbd[data-glyph="x"] { --g: var(--g-x); --gi: var(--gi-x); --gw: var(--gw-x); } :is([data-pad~="y"], [data-pad~="y-hold"]) kbd, kbd[data-glyph="y"] { --g: var(--g-y); --gi: var(--gi-y); --gw: var(--gw-y); }
[data-pad~="lb"] kbd, kbd[data-glyph="lb"] { --g: var(--g-lb); --gi: var(--gi-lb); --gw: var(--gw-lb); } [data-pad~="rb"] kbd, kbd[data-glyph="rb"] { --g: var(--g-rb); --gi: var(--gi-rb); --gw: var(--gw-rb); }
[data-pad~="lt"] kbd, kbd[data-glyph="lt"] { --g: var(--g-lt); --gi: var(--gi-lt); --gw: var(--gw-lt); } [data-pad~="rt"] kbd, kbd[data-glyph="rt"] { --g: var(--g-rt); --gi: var(--gi-rt); --gw: var(--gw-rt); }
[data-pad~="view"] kbd, kbd[data-glyph="view"] { --g: var(--g-view); --gi: var(--gi-view); --gw: var(--gw-view); } [data-pad~="start"] kbd, kbd[data-glyph="start"] { --g: var(--g-start); --gi: var(--gi-start); --gw: var(--gw-start); }
[data-pad~="l3"] kbd, kbd[data-glyph="l3"] { --g: var(--g-l3); --gi: var(--gi-l3); --gw: var(--gw-l3); } [data-pad~="r3"] kbd, kbd[data-glyph="r3"] { --g: var(--g-r3); --gi: var(--gi-r3); --gw: var(--gw-r3); }
/* A long press: 长按 beside the glyph, and a ring round it filling as the button is held (--hold 0…1, set each frame). */
body[data-input=pad] [data-pad~="y-hold"] kbd { padding-right: 7px; border: 2px solid transparent;
  background: radial-gradient(circle at 50% 35%, #4a3a26, #1a120c) padding-box, conic-gradient(#ffd890 calc(var(--hold, 0) * 360deg), #ffe2a040 0) border-box; }
body[data-input=pad] [data-pad~="y-hold"] kbd::after { content: '长按'; font: 11px/1 var(--serif); color: var(--dim); }
kbd[data-glyph="dpad"] { --gi: var(--gi-dpad); --gw: var(--gw-dpad); } kbd[data-glyph="lstick"] { --gi: var(--gi-lstick); --gw: var(--gw-lstick); }
kbd[data-glyph="rstick"] { --gi: var(--gi-rstick); --gw: var(--gw-rstick); }
/* Text naming buttons (the help's 手柄 paragraph, a toast, a hint; app.js padText / padKbd) shows them whatever the input in use:
   their labels, or their pictures once loaded, sized to the text (the selectors outweigh the HUD's 20 px pad rules below). */
kbd.pg::before { content: attr(data-label); }
body:not([data-glyph-art]) kbd.pg[data-label=""] { display: none; }
body[data-glyph-art] kbd.pg[data-glyph][data-label] { display: inline-flex; font-size: inherit; height: auto; vertical-align: -0.35em; margin: 0 0.15em; min-width: 0; padding: 0; border: 0; background: none; }
body[data-glyph-art] kbd.pg[data-glyph][data-label]::before { content: ''; width: calc(var(--gw, 1) * 1.4em); height: 1.4em; background: var(--gi) center / contain no-repeat; }
/* The painted glyphs (pad.js paintGlyphs, body[data-glyph-art]): the button itself in place of the text pill, 20 px tall and as
   wide as its shape (--gw). A long press keeps its ring, round the picture. */
body[data-glyph-art][data-input=pad] :is([data-pad] kbd, kbd[data-glyph]) { min-width: 0; padding: 0; border-color: transparent; background: none; }
body[data-glyph-art][data-input=pad] :is([data-pad] kbd, kbd[data-glyph])::before { content: ''; width: calc(var(--gw, 1) * 20px); height: 20px; background: var(--gi) center / contain no-repeat; }
body[data-glyph-art][data-input=pad] [data-pad~="y-hold"] kbd { padding: 1px 7px 1px 1px; border: 2px solid transparent; border-radius: 13px;
  background: linear-gradient(#1a120c, #1a120c) padding-box, conic-gradient(#ffd890 calc(var(--hold, 0) * 360deg), #ffe2a040 0) border-box; }
.padhit { filter: brightness(1.35); }
/* A control's title under the pad's focus (app.js padTipFrame), as the pointer's tooltip would show it. */
.padtip { position: fixed; z-index: 60; max-width: min(460px, 92vw); padding: 6px 10px; pointer-events: none; white-space: pre-line; font-size: 14px; line-height: 1.55;
  color: var(--ink); background: var(--menu-bg); border: 1px solid var(--gold2); border-radius: 3px; box-shadow: 0 6px 18px #000a; }
body:not([data-input=pad]) .padtip { display: none; }
/* The 战略地图 cursor: a ring round the city it is on. */
.padcursor { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 9; pointer-events: none; }
.padcursor::before { content: ''; position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%; border: 2px solid #ffd890;
  box-shadow: 0 0 0 1px #0009, 0 0 14px #f6a03c99, inset 0 0 10px #f6a03c55; animation: padpulse 1.3s ease-in-out infinite; }
body:not([data-input=pad]) .padcursor { display: none; }
@keyframes padpulse { 50% { transform: scale(1.12); opacity: .75; } }
/* The city menu's pages turn with LB / RB: their glyphs at the two ends of the page row. */
body[data-input=pad] .dock .tabs::before, body[data-input=pad] .dock .tabs::after { align-self: center; padding: 0 6px; font: 600 12px/20px var(--serif); color: #fff1d0;
  border: 1px solid #ffe2a080; border-radius: 10px; background: #1a120c; }
body[data-input=pad] .dock .tabs::before { content: var(--g-lb); } body[data-input=pad] .dock .tabs::after { content: var(--g-rb); }
body[data-glyph-art][data-input=pad] .dock .tabs::before, body[data-glyph-art][data-input=pad] .dock .tabs::after { content: ''; padding: 0; border: 0; height: 20px;
  background: var(--gi) center / contain no-repeat; width: calc(var(--gw) * 20px); margin: 0 4px; }
body[data-glyph-art][data-input=pad] .dock .tabs::before { --gi: var(--gi-lb); --gw: var(--gw-lb); } body[data-glyph-art][data-input=pad] .dock .tabs::after { --gi: var(--gi-rb); --gw: var(--gw-rb); }

/* The help's 操作 page (src/controls.js): 键鼠 / 手柄, a tab per scene, the picture with a line from each callout to its control. */
.ctl { margin: 4px 0 10px; }
.ctl-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 10px; }
.ctl-kind, .ctl-tabs { display: flex; gap: 4px; } .ctl-head .btn { padding: 4px 12px; font-size: 15px; }
.ctl-head .btn.on { color: #fff1d0; border-color: var(--gold); background: #ffd89022; }
.ctl-pad { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 50%) minmax(0, 1fr); gap: 16px; align-items: center; }
.ctl-pad.mouse { grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr); }
.ctl-side { display: flex; flex-direction: column; justify-content: center; gap: 8px; position: relative; z-index: 1; }
.ctl-side.left { align-items: flex-end; text-align: right; }
.ctl-call { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 1.4; color: #e8dcc0; }
.ctl-side.left .ctl-call { flex-direction: row-reverse; }
.ctl-call b { font-weight: 600; color: var(--gold); white-space: nowrap; }
.ctl-fig { position: relative; container-type: inline-size; }
.ctl-fig img { display: block; width: 100%; height: auto; }
.ctl-on { position: absolute; transform: translate(-50%, -50%); font-size: 5.2cqw; line-height: 0; filter: drop-shadow(0 0 3px #000c); }
.ctl-call kbd.pg { flex: none; }
.ctl-on kbd.pg { margin: 0 !important; }
.ctl-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.ctl-lines polyline { fill: none; stroke: #c9a45c99; stroke-width: 1; } .ctl-lines circle { fill: #ffd890; }
.ctl-foot { margin: 8px 0 0 !important; font-size: 13px; color: var(--dim) !important; text-align: center; grid-column: 1 / -1; }
.ctl-keylist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; margin-top: 12px; }
.ctl-key { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #e8dcc0; }
.ctl-key .caps { display: flex; gap: 3px; flex: none; min-width: 92px; justify-content: flex-end; }
body[data-input=pad] .ctl-key kbd { display: inline-block; }
@media (max-width: 760px) { .ctl-pad { grid-template-columns: 1fr; } .ctl-side.left { align-items: flex-start; text-align: left; } .ctl-side.left .ctl-call { flex-direction: row; } .ctl-lines { display: none; } .ctl-keylist { grid-template-columns: 1fr; } }
.ctl-key kbd { min-width: 24px; padding: 1px 7px; text-align: center; font: 13px/1.5 var(--serif); color: #fff1d0; background: linear-gradient(#3a2c1c, #1a120c);
  border: 1px solid #ffe2a070; border-bottom-width: 3px; border-radius: 4px; }
/* LB / RB turn the scene tabs (app.js): their glyphs at the two ends, as on the city menu. */
body[data-glyph-art][data-input=pad] .ctl-tabs { align-items: center; }
body[data-glyph-art][data-input=pad] .ctl-tabs::before, body[data-glyph-art][data-input=pad] .ctl-tabs::after { content: ''; height: 20px; width: calc(var(--gw) * 20px); background: var(--gi) center / contain no-repeat; }
body[data-glyph-art][data-input=pad] .ctl-tabs::before { --gi: var(--gi-lb); --gw: var(--gw-lb); } body[data-glyph-art][data-input=pad] .ctl-tabs::after { --gi: var(--gi-rb); --gw: var(--gw-rb); }

/* 上次: the choice made last time, where a list starts on it (计略, its target, 开发's field); 再施 and the count of a run of commands. */
.lasttag { margin-left: 6px; padding: 0 4px; border: 1px solid #ffd89060; border-radius: 2px; font: normal 11px/1.5 var(--serif); color: var(--gold); letter-spacing: 0; vertical-align: 1px; white-space: nowrap; }
.unitpanel .acts .btn.recast small { margin-left: 5px; color: var(--gold); font-size: 13px; }
.runtimes { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; color: var(--dim); font-size: 14px; }
.runtimes b { min-width: 1.6em; text-align: center; font-size: 20px; color: var(--gold); } .runtimes .btn { min-width: 2.2em; padding: 2px 8px; } .runtimes .btn.ghost { margin-left: 6px; font-size: 13px; }
.modal em.runout { display: block; margin-top: 6px; font-style: normal; color: var(--bad); font-size: 14px; }
.lasttag::before { content: '上次'; } /* drawn, not text: a command's or a general's own text stays his name */
kbd.keycap::before { content: attr(data-label); } /* a key named beside a command without becoming part of its text */
.otable tbody tr:focus-visible { background: #ffd89018; box-shadow: inset 3px 0 0 #ffd890; } /* the row the keys are on (the officer of last time, to begin with) reads at a glance */
