:root {
  --ink: #2b1a0c;
  --ink-soft: #5a3c22;
  --gold: #f3d68f;
  --gold-deep: #c99a3e;
  --lacquer: #120c08;
  --red: #8c1c14;
  --font-title: "DFKai-SB", "BiauKai", "KaiTi", "標楷體", "STKaiti", serif;
  --font-body: "Microsoft JhengHei", "微軟正黑體", "PingFang TC", "Noto Sans TC", sans-serif;
  --kit: url("../../ui/kit/");
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--lacquer); color: var(--gold); font-family: var(--font-body); overflow: hidden; }
img { -webkit-user-drag: none; user-select: none; }
/* the whole game is one 1920x1080 stage, scaled to fit the window (black bars around it), so the layout never changes shape */
html, body { background: #000; }
#app { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform: translate(-50%, -50%) scale(var(--k, 1)); transform-origin: 50% 50%; container-type: size; overflow: hidden; background: var(--lacquer); }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: none; opacity: 0; transition: opacity .35s ease; }
.screen.active { display: block; }
.screen.shown { opacity: 1; }

/* ---------- buttons (bronze & lacquer kit) ---------- */
.btn {
  font-family: var(--font-title); font-size: 26px; letter-spacing: .25em; color: var(--gold);
  min-width: 240px; height: 68px; padding: 0 28px 0 34px; border: 0; cursor: pointer;
  background: url("../../ui/kit/button_normal.png") center / 100% 100% no-repeat;
  text-shadow: 0 2px 2px #000, 0 0 8px rgba(0,0,0,.6);
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover:not(:disabled) { background-image: url("../../ui/kit/button_hover.png"); filter: brightness(1.12); }
.btn:active:not(:disabled) { background-image: url("../../ui/kit/button_pressed.png"); transform: translateY(1px); }
.btn:disabled { filter: grayscale(.8) brightness(.6); cursor: not-allowed; }
.btn-small { font-size: 18px; min-width: 132px; height: 46px; letter-spacing: .15em; padding: 0 18px 0 22px; }

/* ---------- parchment panels ---------- */
.parchment {
  color: var(--ink);
  border: 56px solid transparent;
  border-image: url("../../ui/kit/panel_large.png") 110 120 110 120 fill / 56px 60px 56px 60px stretch;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.6));
}

.plate-title {
  margin: 0; font-family: var(--font-title); font-weight: normal; font-size: 30px; letter-spacing: .4em;
  color: var(--gold); text-shadow: 0 2px 3px #000;
  min-width: 300px; padding: 22px 40px 26px 52px; text-align: center;
  background: url("../../ui/kit/title_plate.png") center / 100% 100% no-repeat;
}

.screen-head { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 28px 6px; }
.screen-head > :first-child { justify-self: start; }

/* ---------- title ---------- */
#screen-title { background: #e9e1d0; }
#screen-title .title-art { position: absolute; inset: 0; background: url("../../ui/main_title.png") center top / cover no-repeat; }
#screen-title::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,0) 55%, rgba(0,0,0,.65)); pointer-events: none; }
/* the logo sits in the blank paper sky above Cao Cao's crown */
.title-logo { position: absolute; z-index: 2; top: 1.4cqh; left: 0; right: 0; margin: 0; text-align: center; }
.title-logo img { width: min(44cqw, 22cqh * 2.7); height: auto; filter: drop-shadow(0 3px 6px rgba(60,30,5,.45)); }
.title-menu { position: absolute; z-index: 2; left: 0; right: 0; bottom: 7cqh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.title-menu .btn { min-width: 300px; }

/* ---------- scenario select ---------- */
.scenario-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 26px; padding: 10px 40px 30px; height: calc(100cqh - 110px); align-content: center; max-width: 1500px; margin: 0 auto; }
.scenario-card { position: relative; cursor: pointer; transition: transform .18s ease, filter .18s ease; }
.scenario-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; filter: brightness(.88); transition: filter .18s ease; }
.scenario-card:hover { transform: translateY(-4px) scale(1.02); }
.scenario-card:hover img { filter: brightness(1.05) drop-shadow(0 0 14px rgba(243,214,143,.55)); }
.scenario-card .plate-year, .scenario-card .plate-name {
  position: absolute; display: flex; align-items: center; justify-content: center; white-space: nowrap;
  font-family: var(--font-title); font-weight: bold; color: #200c02; text-shadow: 0 0 2px rgba(255,236,190,.9), 0 1px 0 rgba(255,236,190,.7);
}
.scenario-card .plate-year { left: 37.5%; width: 25%; top: 1.2%; height: 6.6%; font-size: 1.15cqw; letter-spacing: .15em; }
.scenario-card .plate-name { left: 23.5%; width: 53%; top: 88.6%; height: 7.8%; font-size: 1.75cqw; letter-spacing: .45em; padding-left: .45em; }

/* ---------- menu background (war-council table) ---------- */
.menu-bg { background: #120b07 url("../../ui/menu_bg.png") center / cover no-repeat; }
.menu-bg::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, rgba(10,6,4,.15) 0%, rgba(10,6,4,.55) 70%, rgba(6,4,2,.8) 100%); }
.menu-bg > * { position: relative; }

/* ---------- ruler select ---------- */
.ruler-layout {
  display: grid; gap: 22px; padding: 14px 24px 14px; height: 100cqh;
  grid-template-columns: minmax(0, 1fr) min(31cqw, calc((100cqh - 28px) * .6));
}
/* everything in the left column shares one width (the scenario art's), so the
   plate, art, head-shot frame and buttons line up on both edges; the column's top
   and bottom line up with the profile panel on the right */
.ruler-main {
  --w: min(100%, calc((100cqh - 400px) * 1.5));
  width: var(--w); justify-self: end;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-width: 0;
}
.ruler-plate { align-self: flex-start; font-size: 34px; letter-spacing: .3em; min-width: 420px; padding: 20px 48px 24px 58px; }
.scenario-card.static { cursor: default; width: 100%; flex: 0 0 auto; filter: drop-shadow(0 10px 24px rgba(0,0,0,.7)); }
.ruler-actions { display: flex; gap: 14px; align-items: center; justify-content: flex-end; }
.ruler-actions .btn-small { min-width: 140px; height: 54px; font-size: 20px; }
.scenario-card.static:hover { transform: none; }
.scenario-card.static img, .scenario-card.static:hover img { filter: none; }
.scenario-card.static .plate-year { font-size: 1.4cqw; }
.scenario-card.static .plate-name { font-size: 2.2cqw; }

/* row of ruler head-shots in a fixed frame as wide as the art; the hovered one
   grows (transform only, so the frame never changes size) and every head-shot on
   its left slides left, every one on its right slides right */
.ruler-chips {
  --gap: clamp(5px, .6cqw, 10px);
  list-style: none; margin: 0; width: 100%; padding: 30px clamp(14px, 1.4cqw, 26px) 10px; display: flex; gap: var(--gap); justify-content: center; align-items: flex-end;
  background: rgba(12,8,5,.72); border: 1px solid rgba(201,154,62,.55); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.ruler-chips li {
  position: relative; flex: 1 1 0; min-width: 0; max-width: 92px; cursor: pointer; text-align: center;
  transition: transform .22s ease;
}
.ruler-chips .face {
  display: block; width: 100%; aspect-ratio: 3 / 4; height: auto; object-fit: cover; object-position: top;
  border: 2px solid #5a4027; border-radius: 3px; transform-origin: 50% 100%;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.ruler-chips li:hover { z-index: 10; }
.ruler-chips li:hover .face { transform: scale(1.32); border-color: var(--gold); box-shadow: 0 6px 16px rgba(0,0,0,.8); }
.ruler-chips li:has(~ li:hover) { transform: translateX(-18%); }
.ruler-chips li:hover ~ li { transform: translateX(18%); }
.ruler-chips li:has(+ li:hover) { transform: translateX(-24%); }
.ruler-chips li:hover + li { transform: translateX(24%); }
.ruler-chips li.selected .face { border-color: var(--gold); box-shadow: 0 0 0 2px var(--red), 0 0 14px rgba(243,214,143,.6); }
.ruler-chips .nm { display: block; margin-top: 3px; font-family: var(--font-title); font-size: var(--name-size, 16px); color: #f0dcae; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.ruler-chips li.selected .nm { color: #ffd77a; }

/* selected ruler: half-body art with the profile over its dark lower part */
.ruler-hero { position: relative; overflow: hidden; border-radius: 6px; border: 1px solid rgba(201,154,62,.55); background: #0c0805; box-shadow: 0 10px 28px rgba(0,0,0,.7); }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; transition: opacity .25s ease; }
.hero-art.fallback { object-position: 50% 0; height: 72%; -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent); }
.hero-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 22px 16px; color: #eedcb2;
  background: linear-gradient(to bottom, rgba(8,5,3,0) 0%, rgba(8,5,3,.86) 26%, rgba(8,5,3,.95) 100%);
  display: flex; flex-direction: column; gap: 6px;
}
.hero-name { display: flex; align-items: center; gap: 12px; }
#hero-name { font-family: var(--font-title); font-size: 42px; letter-spacing: .15em; color: var(--gold); text-shadow: 0 2px 4px #000; line-height: 1; }
#hero-name img { display: block; height: clamp(46px, 7cqh, 70px); width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.8)); }
.hero-title { font-family: var(--font-title); font-size: 16px; padding: 2px 10px; border-radius: 3px; background: var(--red); color: #fbe6bf; letter-spacing: .15em; }
.hero-sub { font-size: 14px; color: #cdb488; }
.hero-stats { display: grid; grid-template-columns: auto 1fr 28px; gap: 3px 10px; align-items: center; font-size: 14px; }
.hero-stats .bar { height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.hero-stats .bar i { display: block; height: 100%; background: linear-gradient(90deg, #8c1c14, #e0a040); border-radius: 4px; }
.hero-stats b { text-align: right; color: #ffe1a0; font-weight: normal; }
.hero-bio { margin: 2px 0 4px; font-size: 14px; line-height: 1.6; color: #e4d3ab; }
#btn-start { min-width: 240px; }

/* ---------- map ---------- */
#screen-map { background: #0b1520; }
/* the bar art (1518x136) has iron dragons at both ends and leather straps at
   x 16.5% / 83.1%; text and buttons stay on the parchment strip between the
   straps (y 34%-69%), the portrait hangs from the bar's left end */
.top-bar {
  position: absolute; z-index: 5; left: 0; right: 0; top: 0; height: 100px;
  background: url("../../ui/kit/top_bar.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.6));
}
#tb-portrait {
  position: absolute; left: 17.4%; top: 14px; width: 98px; height: 130px; object-fit: cover; object-position: top;
  border: 3px solid var(--gold-deep); border-radius: 4px; background: #000;
  box-shadow: 0 0 0 2px #2a1a0c, 0 8px 18px rgba(0,0,0,.75);
}
.tb-strip {
  position: absolute; left: calc(17.4% + 116px); right: 17.6%; top: 34%; height: 35%;
  display: flex; align-items: center; gap: 22px; white-space: nowrap; overflow: hidden;
}
.tb-ruler { font-family: var(--font-title); font-size: 26px; line-height: 1; letter-spacing: .12em; color: var(--gold); text-shadow: 0 2px 3px #000; }
.tb-ruler img { display: block; height: 30px; width: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.8)); }
.tb-sub { font-size: 15px; color: #f6e3b4; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.tb-date { margin-left: auto; font-family: var(--font-title); font-size: 22px; letter-spacing: .2em; color: var(--gold); text-shadow: 0 1px 3px #000; }
.tb-btn {
  height: 28px; padding: 0 14px; border: 1px solid rgba(243,214,143,.6); border-radius: 3px; cursor: pointer;
  font-family: var(--font-title); font-size: 16px; letter-spacing: .15em; color: var(--gold);
  background: linear-gradient(to bottom, #3a2414, #1c110a); box-shadow: inset 0 1px 0 rgba(255,230,170,.2), 0 1px 3px rgba(0,0,0,.6);
}
.tb-btn:hover { filter: brightness(1.3); }

.map-viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; }
.map-viewport.dragging { cursor: grabbing; }
.map-world { position: absolute; left: 0; top: 0; width: 1536px; height: 1024px; transform-origin: 0 0; background: url("../../maps/base_map.png") 0 0 / 1536px 1024px no-repeat; }

.city:not(.pk), .pass { position: absolute; width: 0; height: 0; }
.city .hit { position: absolute; cursor: pointer; }
.city .icon { position: absolute; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.city .flag { position: absolute; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.city .label, .pass .label {
  position: absolute; left: 0; white-space: nowrap; transform: translateX(-50%); pointer-events: none;
  font-family: var(--font-title); color: #faf0d7; -webkit-text-stroke: 3px #140c05; paint-order: stroke fill; text-shadow: 0 0 3px #000, 0 0 5px #000, 0 1px 2px #000;
}
.city.mine .label { color: #ffe08a; }
.city.selected .icon { filter: drop-shadow(0 0 6px #ffe9a8) drop-shadow(0 0 3px #fff); }
.city .hit:hover ~ .icon { filter: drop-shadow(0 0 5px #ffe9a8); }
.pass .icon { position: absolute; pointer-events: none; opacity: .95; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.pass .label { color: #e1d7be; font-size: 11px; }

/* dark lacquer panels with a thin gold rule, same look as the ruler profile */
.dark-panel {
  color: #eedcb2; padding: 18px 20px;
  background: linear-gradient(to bottom, rgba(24,16,10,.95), rgba(10,7,4,.95));
  border: 1px solid rgba(201,154,62,.65); border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(0,0,0,.35), 0 12px 28px rgba(0,0,0,.7), inset 0 0 0 1px rgba(255,230,170,.06);
}
.city-panel { position: absolute; z-index: 6; right: 18px; top: 108px; width: 360px; max-height: calc(100cqh - 110px); overflow: hidden auto; }
.city-panel h3 { margin: 0; font-family: var(--font-title); font-weight: normal; font-size: 40px; letter-spacing: .25em; color: var(--gold); text-shadow: 0 2px 4px #000; }
.city-panel .sub { color: #cdb488; font-size: 15px; margin: 2px 0 14px; letter-spacing: .1em; }
.city-panel .owner { display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: center; padding-top: 14px; border-top: 1px solid rgba(201,154,62,.35); }
.city-panel .owner img.face { width: 104px; height: 138px; object-fit: cover; object-position: top; border: 2px solid var(--gold-deep); border-radius: 3px; box-shadow: 0 6px 14px rgba(0,0,0,.7); }
.city-panel .owner .who { display: flex; align-items: center; gap: 8px; font-family: var(--font-title); font-size: 28px; color: var(--gold); }
.city-panel .owner .who img.flag { width: 24px; }
.city-panel .owner .who img.nm { height: 44px; width: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.8)); }
.city-panel .owner .role { font-size: 14px; color: #cdb488; margin-top: 4px; }
.city-panel .tag { display: inline-block; padding: 1px 12px; border-radius: 3px; font-family: var(--font-title); font-size: 15px; letter-spacing: .15em; background: var(--red); color: #fbe6bf; margin-top: 8px; }
.city-panel .close { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border: 0; cursor: pointer; background: url("../../ui/kit/close_button.png") center / contain no-repeat; }
.city-panel .later { margin-top: 16px; padding-top: 10px; border-top: 1px solid rgba(201,154,62,.2); font-size: 13px; color: #9c8762; }

.map-hint { position: absolute; z-index: 4; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 6px 18px; border-radius: 16px; background: rgba(10,6,3,.65); color: #e8d6ac; font-size: 14px; letter-spacing: .15em; pointer-events: none; transition: opacity 1s ease; }
.map-hint.fade { opacity: 0; }

/* ---------- custom ruler (ruler select chip + editor) ---------- */
/* the custom-ruler chip is an empty frame */
.ruler-chips .face.add { background: rgba(30,20,12,.55); border-color: var(--gold-deep); box-shadow: inset 0 0 12px rgba(0,0,0,.8); }
.ruler-note { margin: 0; font-size: 13px; line-height: 1.4; color: #e2cb98; text-shadow: 0 1px 2px #000; text-align: center; }
.ruler-chips li.custom .nm { color: #e9c77a; }

#screen-custom { flex-direction: column; }
#screen-custom.active { display: flex; }
.ce-done { justify-self: end; }
.ce-layout {
  flex: 1; min-height: 0; display: grid; gap: 18px; padding: 6px 28px 22px;
  grid-template-columns: 300px minmax(0, 1fr) min(27cqw, calc((100cqh - 120px) * .62));
}
.ce-layout > .dark-panel, .ce-midcol > .dark-panel { display: flex; flex-direction: column; min-height: 0; padding: 16px 18px; }
.ce-layout h4 { margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; font-family: var(--font-title); font-weight: normal; font-size: 24px; letter-spacing: .2em; color: var(--gold); }
.ce-layout h4 small { font-family: var(--font-body); font-size: 13px; letter-spacing: .05em; color: #a89068; }
.dark-panel input { font: inherit; color: #f5e4bc; background: rgba(0,0,0,.45); border: 1px solid rgba(201,154,62,.45); border-radius: 3px; padding: 4px 6px; }
.dark-panel input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(243,214,143,.2); }
.dark-panel input.bad { border-color: #e04030; box-shadow: 0 0 0 2px rgba(224,64,48,.35); }

.ce-ruler { overflow: hidden auto; }
.ce-midcol { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.ce-midcol > .ce-mid { flex: 1 1 0; }
/* 儲存 / 開始遊戲 under the middle panel, flush with its right edge */
.ce-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.ce-actions .btn-small { height: 54px; min-width: 140px; font-size: 20px; }
.ce-actions .ce-go { min-width: 240px; }
.ce-cp, .ghead { display: flex; gap: 6px; align-items: center; }
.ce-cp { justify-content: flex-end; margin-top: 8px; }
.ce-cp button, .ghead button { flex: 0 0 auto; font-size: 12px; padding: 3px 9px; color: #f0dcae; background: rgba(201,154,62,.15); border: 1px solid rgba(201,154,62,.5); border-radius: 3px; cursor: pointer; }
.ce-cp button:hover, .ghead button:hover { background: rgba(201,154,62,.32); }
.ce-cp button:disabled, .ghead button:disabled { color: #ffe08a; cursor: default; }
.ce-gen { display: grid; grid-template-columns: 18px var(--gface, 84px) 1fr; grid-template-rows: auto auto; gap: 6px 10px; align-items: start; padding: 8px 10px; border: 1px solid rgba(201,154,62,.2); border-radius: 4px; background: rgba(0,0,0,.25); opacity: .6; transition: opacity .15s, border-color .15s; }
.ce-gen .on { grid-row: 1 / 3; grid-column: 1; align-self: center; }
.ce-gen .ghead { grid-row: 1; grid-column: 2 / 4; }
.ce-gen .gstats { grid-row: 2; grid-column: 3; }
.ce-gen .ce-gface { grid-row: 2; grid-column: 2; width: 100%; height: auto; aspect-ratio: 3 / 4; align-self: center; }
.dark-panel input.gname { flex: 1; min-width: 0; font-family: var(--font-title); font-size: 17px; padding: 2px 6px; }
.ce-stats.gstats { margin: 0; grid-template-columns: auto 1fr 46px; gap: 2px 8px; font-size: 12px; }
.ce-stats.gstats input[type=number] { width: 46px; padding: 1px 2px; font-size: 13px; }
.ce-id { display: grid; grid-template-columns: 120px 1fr; gap: 14px; }
.ce-face { position: relative; padding: 0; border: 2px solid var(--gold-deep); border-radius: 3px; background: #000; cursor: pointer; width: 120px; height: 160px; overflow: hidden; box-shadow: 0 6px 14px rgba(0,0,0,.7); }
.ce-face img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.ce-face span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 0; font-size: 13px; color: #f5e4bc; background: rgba(0,0,0,.65); opacity: 0; transition: opacity .15s; }
.ce-face:hover span { opacity: 1; }
.ce-face:hover { border-color: var(--gold); }
.ce-idr { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ce-lbl { font-size: 13px; color: #a89068; letter-spacing: .1em; }
.dark-panel input.ce-name { font-family: var(--font-title); font-size: 26px; letter-spacing: .1em; width: 100%; margin-bottom: 6px; }
.ce-tip { margin: 2px 0 0; font-size: 12px; line-height: 1.6; color: #8f7a58; }
.ce-ruler > .ce-lbl { margin-top: 14px; display: block; }
.ce-flags { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px 10px; margin-top: 4px; }
.ce-flags button { position: relative; padding: 3px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; }
.ce-flags button i { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--c); border: 2px solid #1e140a; box-shadow: inset 0 -3px 5px rgba(0,0,0,.35), inset 0 2px 3px rgba(255,255,255,.25); }
.ce-flags button:hover:not(.used) { border-color: rgba(243,214,143,.5); }
.ce-flags button.on { border-color: var(--gold); box-shadow: 0 0 8px rgba(243,214,143,.6); }
.ce-flags button.used { opacity: .22; cursor: not-allowed; }
.ce-flags button.used::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: #f3e2b8; transform: rotate(-45deg); }
.ce-legend { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid rgba(201,154,62,.25); display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--font-title); font-size: 16px; color: #f0dcae; }
.ce-legend li { display: flex; align-items: center; gap: 6px; }
.ce-legend i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 2px solid #1e140a; }
.ce-legend small { font-family: var(--font-body); font-size: 12px; color: #a89068; }
.ce-legend li.you i { background: var(--gold); border-color: #fff3c4; box-shadow: 0 0 6px 2px rgba(255,220,130,.8); }
.ce-stats { margin-top: 16px; display: grid; grid-template-columns: auto 1fr 58px; gap: 8px 10px; align-items: center; font-size: 15px; }
.ce-stats input[type=range] { accent-color: #c8822e; width: 100%; padding: 0; border: 0; background: none; box-shadow: none; }
.ce-stats input[type=number] { width: 58px; text-align: center; }
.ce-total { margin-top: 10px; text-align: right; font-size: 14px; color: #cdb488; }

.ce-head-r { justify-self: end; display: flex; align-items: center; gap: 10px; }
.ce-head-r .ce-go { min-width: 170px; }
.ce-saved { font-size: 14px; color: #f3d68f; text-shadow: 0 1px 2px #000; opacity: 0; }
.ce-saved.fade { animation: ce-saved 2.4s ease forwards; }
@keyframes ce-saved { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.ce-mid { min-width: 0; }
.ce-tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid rgba(201,154,62,.4); }
.ce-tabs button { padding: 6px 22px 8px; border: 1px solid transparent; border-bottom: 0; border-radius: 5px 5px 0 0; background: none; cursor: pointer; font-family: var(--font-title); font-size: 22px; letter-spacing: .15em; color: #a89068; }
.ce-tabs button small { font-family: var(--font-body); font-size: 12px; letter-spacing: 0; }
.ce-tabs button:hover { color: #f0dcae; }
.ce-tabs button.on { color: var(--gold); background: rgba(201,154,62,.14); border-color: rgba(201,154,62,.5); margin-bottom: -1px; }
.ce-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ce-pane.hidden { display: none !important; }
.ce-hint { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: #a89068; }
.ce-hero { min-height: 0; }
.ce-hero .hn { font-family: var(--font-title); font-size: 40px; letter-spacing: .12em; color: var(--gold); text-shadow: 0 2px 4px #000; line-height: 1; }
.ce-hero .hero-stats .bar i { transition: width .25s ease; }
.ce-land { min-width: 0; container-type: size; overflow: hidden; }
.ce-map { position: relative; width: min(100%, (100cqh - 175px) * 1.5); align-self: center; aspect-ratio: 1536 / 1024; flex: 0 0 auto; border: 1px solid rgba(201,154,62,.45); border-radius: 4px; overflow: hidden; }
.ce-map > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ce-map .dot { position: absolute; transform: translate(-50%, -50%); padding: 0; border-radius: 50%; cursor: pointer; background: var(--c); border: 2px solid #1e140a; box-shadow: 0 1px 3px rgba(0,0,0,.6); }
.ce-map .dot.t1 { width: 16px; height: 16px; } .ce-map .dot.t2 { width: 13px; height: 13px; }
.ce-map .dot.t3 { width: 11px; height: 11px; } .ce-map .dot.t4 { width: 9px; height: 9px; }
.ce-map .dot:hover { transform: translate(-50%, -50%) scale(1.4); z-index: 3; }
.ce-map .dot.off { opacity: .35; cursor: not-allowed; }
.ce-map .dot.off:hover { transform: translate(-50%, -50%); }
.ce-map .dot.sel { z-index: 4; border-color: #fff3c4; box-shadow: 0 0 0 3px var(--gold), 0 0 14px 4px rgba(255,220,130,.9); animation: ce-pulse 1.4s ease-in-out infinite; }
@keyframes ce-pulse { 50% { box-shadow: 0 0 0 5px var(--gold), 0 0 22px 8px rgba(255,220,130,.7); } }
.ce-map .lbl { position: absolute; transform: translate(-50%, 7px); pointer-events: none; white-space: nowrap; font-family: var(--font-title); font-size: 12px; color: #faf0d7; text-shadow: -1px -1px 0 #1e140a, 1px -1px 0 #1e140a, -1px 1px 0 #1e140a, 1px 1px 0 #1e140a; }
.ce-map .lbl.t1 { font-size: 14px; transform: translate(-50%, 9px); }
.ce-pick { margin-top: 12px; font-size: 15px; color: #cdb488; }
.ce-pick b { font-family: var(--font-title); font-size: 26px; font-weight: normal; color: var(--gold); letter-spacing: .15em; }
.ce-pick span { color: #e8c88a; }

.ce-gens { min-width: 0; }
.ce-all { margin-left: auto; display: flex; gap: 6px; }
.ce-all button { font-family: var(--font-body); font-size: 13px; padding: 3px 10px; color: #f0dcae; background: rgba(201,154,62,.15); border: 1px solid rgba(201,154,62,.5); border-radius: 3px; cursor: pointer; letter-spacing: 0; }
.ce-all button:hover { background: rgba(201,154,62,.3); }
.ce-list { flex: 1; min-height: 0; overflow: hidden auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; align-content: start; padding-right: 4px; }
.ce-gen.on { opacity: 1; border-color: rgba(201,154,62,.6); background: rgba(201,154,62,.08); }
.ce-gen .on { accent-color: #c8822e; width: 16px; height: 16px; cursor: pointer; }
.ce-gface { padding: 0; border: 1px solid #5a4027; border-radius: 2px; background: #000; cursor: pointer; overflow: hidden; }
.ce-gface:hover { border-color: var(--gold); }
.ce-gface img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }

.ce-picker { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); }
.ce-picker > .dark-panel { width: min(1100px, 92cqw); max-height: 86cqh; display: flex; flex-direction: column; }
.ce-picker h4 { margin: 0 0 6px; display: flex; justify-content: space-between; font-family: var(--font-title); font-weight: normal; font-size: 24px; letter-spacing: .2em; color: var(--gold); }
.ce-x { width: 30px; height: 30px; border: 0; cursor: pointer; background: url("../../ui/kit/close_button.png") center / contain no-repeat; }
.ce-grid { overflow: auto; min-height: 0; }
.ce-grid h5 { margin: 12px 0 6px; font-weight: normal; font-size: 14px; color: #cdb488; letter-spacing: .15em; }
.ce-faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; padding: 4px; }
.ce-faces button { padding: 0; aspect-ratio: 3 / 4; border: 2px solid #3a2a1a; border-radius: 3px; background: #000; cursor: pointer; overflow: hidden; transition: transform .12s; }
.ce-faces button img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.ce-faces button:hover { border-color: var(--gold); transform: scale(1.04); }
.ce-faces button.cur { border-color: var(--gold); box-shadow: 0 0 0 2px var(--red); }

/* ---------- city interior: court hall ---------- */
#screen-city { flex-direction: column; background: #120b07 center / cover no-repeat; }
/* darken the edges so plaques and text read over the art */
#screen-city::before { background: linear-gradient(to bottom, rgba(6,4,2,.55) 0%, rgba(6,4,2,0) 22%, rgba(6,4,2,0) 60%, rgba(6,4,2,.75) 100%); }
#screen-city .plate-title small { margin-left: .6em; font-size: 16px; letter-spacing: .2em; color: #e6c27a; }
.cy-date { font-family: var(--font-title); font-size: 24px; letter-spacing: .2em; color: var(--gold); text-shadow: 0 2px 3px #000; }

.hall { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; padding: 4px 28px 10px; align-items: start; }
.hall-side { min-height: 0; max-height: 100%; display: flex; flex-direction: column; }
.hall-side h5 { margin: 0 0 8px; text-align: center; font-family: var(--font-title); font-weight: normal; font-size: 20px; letter-spacing: .3em; color: var(--gold); text-shadow: 0 2px 3px #000; }
.hall-side .plqs { overflow: hidden auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px 8px; padding: 4px; align-content: start; }
.hall-side.left .plqs { direction: rtl; }          /* fill from the dais outwards */
.hall-side.left .plq { direction: ltr; }
.hall-dais { display: flex; justify-content: center; padding-top: 6px; }

/* standing plaques: head-shot, name, office, loyalty bar */
.plq {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 5px 6px; cursor: pointer;
  background: linear-gradient(to bottom, rgba(32,20,11,.92), rgba(14,9,5,.94)); border: 1px solid rgba(201,154,62,.55); border-radius: 4px;
  box-shadow: 0 6px 14px rgba(0,0,0,.6); color: #eedcb2; font: inherit; transition: transform .15s, border-color .15s;
}
.plq:hover { transform: translateY(-3px); border-color: var(--gold); }
.plq.sel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--red), 0 0 16px rgba(243,214,143,.5); }
.plq img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border-radius: 2px; }
.plq b { font-family: var(--font-title); font-weight: normal; font-size: 17px; color: #f6e4b8; line-height: 1.2; white-space: nowrap; }
.plq small { font-size: 11px; color: #e3b866; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* loyalty gauge: green >= 80, yellow lamp below 80, red below 70 (a rival can lure them); tick at 70 */
.plq .ly { position: relative; width: 92%; height: 7px; margin-top: 3px; background: rgba(0,0,0,.6); border: 1px solid rgba(201,154,62,.55); border-radius: 4px; overflow: hidden; }
.plq .ly i { display: block; height: 100%; background: linear-gradient(to bottom, #8fd47a, #4c9a3a); }
.plq .ly u { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.55); }
.plq.low .ly i { background: linear-gradient(to bottom, #ffe27a, #e0a820); box-shadow: 0 0 8px 1px #ffd24a; animation: ly-lamp 1.6s ease-in-out infinite; }
.plq.danger .ly i { background: linear-gradient(to bottom, #ff8a6a, #c8321a); box-shadow: 0 0 8px 1px #ff5a3a; animation: ly-lamp 1s ease-in-out infinite; }
@keyframes ly-lamp { 50% { filter: brightness(1.35); } }
.plq.danger { border-color: rgba(216,74,48,.8); }
.plq.acted img { filter: grayscale(.7) brightness(.7); }
.plq em { position: absolute; top: 8px; left: 50%; transform: translateX(-50%) rotate(-8deg); padding: 1px 6px; font-style: normal; font-size: 12px; color: #fbe6bf; background: rgba(140,28,20,.9); border-radius: 2px; }
.plq.lord { width: clamp(130px, 13cqw, 180px); padding: 8px 8px 10px; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(0,0,0,.4), 0 10px 26px rgba(0,0,0,.75), 0 0 22px rgba(243,214,143,.25); }
.plq.lord b { font-size: 28px; }
.plq.lord small { font-size: 14px; }
.plq.lord:not(.empty) small { display: none; }
.plq.lord.empty { cursor: default; }

/* officer detail, sliding in from the right */
.hall-detail {
  position: absolute; z-index: 15; right: 28px; top: 90px; bottom: var(--bar-h, 170px); width: min(340px, 28cqw); overflow: hidden; display: flex; flex-direction: column;
  background: #0c0805; border: 1px solid rgba(201,154,62,.65); border-radius: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.8); animation: hd-in .2s ease;
}
@keyframes hd-in { from { transform: translateX(30px); opacity: 0; } }
.hall-detail .ce-x { position: absolute; z-index: 2; right: 8px; top: 8px; }
.hall-detail .art { width: 100%; flex: 1; min-height: 0; object-fit: cover; object-position: 50% 0; -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); mask-image: linear-gradient(to bottom, #000 70%, transparent); }
.hall-detail .info { padding: 0 18px 14px; margin-top: -40px; position: relative; display: flex; flex-direction: column; gap: 6px; color: #eedcb2; }
.hall-detail .hn { font-family: var(--font-title); font-size: 34px; letter-spacing: .12em; color: var(--gold); text-shadow: 0 2px 4px #000; }
.hall-detail dl { margin: 0; display: grid; grid-template-columns: repeat(3, auto 1fr); gap: 2px 8px; font-size: 14px; }
.hall-detail dt { color: #a89068; }
.hall-detail dd { margin: 0; color: #ffe1a0; }
.hall-detail dd.low { color: #ffb84a; }
.hall-detail dd.danger { color: #ff7050; }

/* hall on the left, city ledger on the right, command rail along the bottom */
#screen-city.active { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
#screen-city > .screen-head { grid-column: 1 / -1; }
#screen-city > .hall { grid-column: 1; grid-row: 2; }

#screen-city > .rail { grid-area: auto; }

/* command rail: lacquered beam with paper slips */
.rail {
  position: relative; z-index: 5; display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 0 28px 14px; padding: 10px 34px 12px;
  background: linear-gradient(to bottom, #5a1810 0%, #3a0e08 55%, #240804 100%); border: 2px solid #b8893c; border-radius: 6px;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.35), inset 0 2px 0 rgba(255,220,150,.25), 0 -6px 24px rgba(0,0,0,.6);
}
.tile-w { position: relative; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 66px; height: 96px; padding: 0; cursor: pointer;
  font-family: var(--font-title); font-size: 30px; line-height: 1.05; color: var(--c);
  background: linear-gradient(to bottom, #f6ead0, #e4d0a6); border: 2px solid #8a6a36; border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.5), inset 0 0 14px rgba(140,100,40,.35), 0 4px 10px rgba(0,0,0,.6);
  text-shadow: 0 1px 0 rgba(255,255,255,.6); transition: transform .12s, box-shadow .12s;
}
.tile:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 2px rgba(255,255,255,.6), 0 8px 16px rgba(0,0,0,.7), 0 0 12px rgba(255,220,140,.5); }
.tile.on { transform: translateY(-6px); border-color: var(--gold); box-shadow: inset 0 0 0 2px rgba(255,255,255,.6), 0 0 0 2px var(--c), 0 8px 18px rgba(0,0,0,.7); }
.tile.back { margin-left: 6px; }
.tile.end { margin-left: 18px; color: #fbe6bf; font-size: 24px; background: linear-gradient(to bottom, #b8893c, #7a5420); border-color: #f3d68f; text-shadow: 0 1px 2px #000; }
.rail-note { margin: 10px 0; color: #e9cf96; font-size: 15px; }
.menu {
  position: absolute; z-index: 30; left: 50%; bottom: calc(100% + 14px); transform: translateX(-50%); width: 230px; padding: 6px;
  display: flex; flex-direction: column; gap: 3px;
  background: linear-gradient(to bottom, rgba(30,20,12,.98), rgba(12,8,5,.98)); border: 1px solid var(--gold-deep); border-radius: 5px; box-shadow: 0 10px 26px rgba(0,0,0,.8);
}
.menu::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg); background: #0c0805; border-right: 1px solid var(--gold-deep); border-bottom: 1px solid var(--gold-deep); }
.menu button { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 10px; text-align: left; background: none; border: 1px solid transparent; border-radius: 3px; cursor: pointer; color: #f0dcae; }
.menu button b { font-family: var(--font-title); font-weight: normal; font-size: 19px; letter-spacing: .15em; }
.menu button small { font-size: 12px; color: #a89068; }
.menu button:hover:not(:disabled) { background: rgba(201,154,62,.2); border-color: rgba(201,154,62,.5); }
.menu button:disabled { opacity: .4; cursor: not-allowed; }

/* officer detail now slides in on the left (the ledger holds the right) */
.hall-detail { left: 28px; right: auto; animation-name: hd-in-l; }
@keyframes hd-in-l { from { transform: translateX(-30px); opacity: 0; } }

/* ---------- city screen inside the thin ornate frame (ui/kit/city_frame_thin.png) ----------
   the frame is a thin border all round (opening x 1.6%-98.4%, y 4%-95%); the
   command bar (ui/kit_tiger/cmd_bar.png, 8.6:1) is a short separate piece centred
   at the bottom, the dragon plaques standing on it */
#screen-city.active { padding: 4cqh 1.8cqw 13cqh; }
#screen-city .city-frame { position: absolute; inset: 0; z-index: 10; pointer-events: none; background: url("../../ui/kit/city_frame_gemini.png") 0 0 / 100% 100% no-repeat; }
#screen-city > .screen-head { padding-top: 6px; }
#screen-city > .back-bl { left: 8cqw; bottom: 1.4cqh; z-index: 12; min-width: 132px; height: 44px; font-size: 18px; white-space: nowrap; padding: 0 10px; }
#screen-city > .rail {
  --rw: clamp(520px, 54cqw, 900px);
  position: absolute; z-index: 11; left: 50%; bottom: .6cqh; transform: translateX(-50%); width: var(--rw); height: calc(var(--rw) / 8.6); aspect-ratio: auto;
  margin: 0; padding: 0; gap: 2.2%; display: flex; justify-content: center; align-items: flex-end;
  background: url("../../ui/kit_tiger/cmd_bar.png") 0 0 / 100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none; filter: drop-shadow(0 -4px 12px rgba(0,0,0,.55));
}
/* command plaques (ui/kit/cmd_plaque*.png): a dragon-crested bronze tablet with
   a paper face; the two characters sit on the paper */
.tile-w { display: flex; align-items: flex-end; margin-bottom: calc(var(--rw) / 8.6 * .34); }
.tile {
  position: relative; height: calc(var(--rw) / 8.6 * 1.02); width: auto; aspect-ratio: 489 / 845; padding: 26% 0 12%; gap: 0;
  font-size: clamp(15px, 1.5cqw, 24px); line-height: 1.05; font-weight: bold;
  background: url("../../ui/kit_tiger/cmd_plaque.png") center / 100% 100% no-repeat; background-image: url("../../ui/kit_tiger/cmd_plaque.png"), url("../../ui/kit_tiger/cmd_plaque_hover.png"), url("../../ui/kit_tiger/cmd_plaque_pressed.png"); background-size: 100% 100%, 0 0, 0 0; background-position: center; background-repeat: no-repeat; border: 0; border-radius: 0; box-shadow: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.7)); text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.tile:hover { transform: translateY(-3px); background-image: url("../../ui/kit_tiger/cmd_plaque_hover.png"), url("../../ui/kit_tiger/cmd_plaque.png"), url("../../ui/kit_tiger/cmd_plaque_pressed.png"); background-size: 100% 100%, 0 0, 0 0; box-shadow: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)) drop-shadow(0 0 8px rgba(255,210,120,.45)); }
.tile.on { transform: translateY(1px); background-image: url("../../ui/kit_tiger/cmd_plaque_pressed.png"), url("../../ui/kit_tiger/cmd_plaque.png"), url("../../ui/kit_tiger/cmd_plaque_hover.png"); background-size: 100% 100%, 0 0, 0 0; border: 0; box-shadow: none; color: #fbe6bf; text-shadow: 0 1px 2px #000; }

/* popup menu on the ornate panel (ui/kit/menu_panel.png) */
.menu {
  width: 340px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px; bottom: calc(100% + 10px);
  background: none; border: 64px solid transparent; border-width: 62px 30px 30px; box-shadow: none;
  border-image: url("../../ui/kit/menu_panel.png") 120 70 70 70 fill / 62px 30px 30px 30px stretch;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.8));
}
.menu > button { margin: 0; }
.menu::after { display: none; }
.menu.wide { width: 380px; }
#screen-city .hall-detail { left: auto; right: 2.6cqw; top: 12cqh; bottom: 14cqh; animation-name: hd-in; }

/* pickers: amounts and offices */
.pk-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(201,154,62,.3); }
.pk-foot .btn-small { min-width: 120px; height: 46px; }
.cy-pick [data-v].chosen { background: rgba(201,154,62,.3) !important; border-color: var(--gold) !important; box-shadow: 0 0 0 1px var(--gold), 0 0 12px rgba(243,214,143,.35); }
.cy-pick .pk-msg { margin: 8px 0; font-size: 18px; color: #f6e4b8; text-align: center; }
/* picker rows have no photo: a flat row of name, numbers and cost */
.cy-pick .pk { display: flex; align-items: center; gap: 18px; padding: 8px 14px; }
.cy-pick .pk .nm { flex: 0 0 168px; white-space: nowrap; }
.cy-pick .pk .st { flex: 0 0 auto; min-width: 96px; white-space: nowrap; }
.cy-pick .pk .pv { flex: 1 1 auto; white-space: nowrap; }
.cy-pick .pk .co { margin-left: auto; min-width: 96px; white-space: nowrap; }
.cy-pick .pk.city { display: grid; }
.cy-pick .pk .nm small { display: block; font-family: var(--font-body); font-size: 11px; color: #c9a25a; }
.cy-pick .pk .st b.low { color: #ffb84a; }
.cy-pick .pk .st b.danger { color: #ff7050; }
.cy-pick .amt { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: #f0dcae; font-size: 15px; background: rgba(0,0,0,.3); border: 1px solid rgba(201,154,62,.35); border-radius: 4px; cursor: pointer; }
.cy-pick .amt b { font-family: var(--font-title); font-weight: normal; font-size: 20px; color: var(--gold); }
.cy-pick .amt span { color: #9fd08a; }
.cy-pick .amt:hover:not(:disabled) { background: rgba(201,154,62,.2); }
.cy-pick .amt:disabled { opacity: .4; cursor: not-allowed; }
.cy-pick .ranks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cy-pick .ranks > div { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-content: start; }
.cy-pick .rk { display: flex; flex-direction: column; padding: 4px 8px; text-align: left; color: #f0dcae; background: rgba(0,0,0,.3); border: 1px solid rgba(201,154,62,.3); border-radius: 3px; cursor: pointer; }
.cy-pick .rk b { font-family: var(--font-title); font-weight: normal; font-size: 16px; }
.cy-pick .rk span { font-size: 11px; color: #a89068; }
.cy-pick .rk:hover { background: rgba(201,154,62,.2); }
.cy-pick .rk.cur { border-color: var(--gold); background: rgba(201,154,62,.18); }

/* month report */
.report { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); }
.report > .dark-panel { width: min(560px, 92cqw); max-height: 80cqh; display: flex; flex-direction: column; gap: 10px; }
.report h4 { margin: 0; font-family: var(--font-title); font-weight: normal; font-size: 26px; letter-spacing: .2em; color: var(--gold); text-align: center; }
.report ul { list-style: none; margin: 0; padding: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.5; }
.report li.ev { color: #ffcf7a; }
.report li.gr { padding: 6px 10px; color: #ffd9c8; background: rgba(140,28,20,.25); border-left: 3px solid #d84a30; border-radius: 3px; }
.report .btn { align-self: center; }

/* map side panel: city facts and the enter button */
.city-panel .facts { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid rgba(201,154,62,.35); display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.city-panel .facts li { display: contents; }
.city-panel .facts span { color: #a89068; }
.city-panel .facts b { font-weight: normal; color: #ffe1a0; }
.city-panel .enter { display: block; margin: 16px auto 0; }

/* ---------- step 3: commands, end turn, report ---------- */
.cy-head-r { justify-self: end; margin-right: 5.6cqw; display: flex; align-items: center; gap: 14px; }
.cy-head-r .tb-btn { height: 36px; font-size: 18px; padding: 0 18px; }
.cy-pick { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); }
.cy-pick > .dark-panel { width: min(780px, 94cqw); max-height: 80cqh; display: flex; flex-direction: column; }
.cy-pick h4 { margin: 0; display: flex; justify-content: space-between; font-family: var(--font-title); font-weight: normal; font-size: 24px; letter-spacing: .15em; color: var(--gold); }
.cy-pick .d { margin: 6px 0 12px; font-size: 14px; color: #cdb488; }
.cy-pick .list { overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.cy-pick .pk { display: grid; grid-template-columns: 40px 1fr 80px 1.4fr 110px; gap: 10px; align-items: center; padding: 4px 10px; text-align: left; color: #eedcb2; font-size: 14px; background: rgba(0,0,0,.3); border: 1px solid rgba(201,154,62,.2); border-radius: 4px; cursor: pointer; }
.cy-pick .pk:hover:not(:disabled) { background: rgba(201,154,62,.2); border-color: var(--gold-deep); }
.cy-pick .pk:disabled { opacity: .45; cursor: not-allowed; }
.cy-pick .pk img { width: 40px; height: 53px; object-fit: cover; object-position: top; border-radius: 2px; }
.cy-pick .pk .nm { font-family: var(--font-title); font-size: 19px; color: #f6e4b8; }
.cy-pick .pk .st b { color: #ffe1a0; font-weight: normal; font-size: 17px; }
.cy-pick .pk .pv { color: #9fd08a; }
.cy-pick .pk .co { text-align: right; color: #cdb488; font-size: 13px; }
.toast {
  position: fixed; z-index: 50; left: 50%; top: 110px; transform: translate(-50%, -12px); min-width: 280px; padding: 12px 24px;
  text-align: center; font-size: 15px; line-height: 1.7; color: #f3e2b8; pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s;
  background: linear-gradient(to bottom, rgba(30,20,12,.96), rgba(12,8,5,.96)); border: 1px solid var(--gold-deep); border-radius: 6px; box-shadow: 0 10px 26px rgba(0,0,0,.7);
}
.toast b { display: block; font-family: var(--font-title); font-weight: normal; font-size: 20px; letter-spacing: .15em; color: var(--gold); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad b { color: #ff9a80; }

/* every back button sits at the bottom left */
.menu-bg > .back-bl, .back-bl { position: absolute; z-index: 12; left: 22px; bottom: 16px; }
#screen-custom .ce-layout { padding-bottom: 80px; }
#screen-ruler .ruler-layout { padding-bottom: 14px; }
/* ---------- step 4: city arrows, season strip, free officers, tables ---------- */
.cy-titlebar { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cy-titlebar .plate-title { position: relative; }
.cy-titlebar .dg { position: absolute; right: 12%; bottom: 6px; padding: 0 8px; font-style: normal; font-size: 12px; letter-spacing: .1em; color: #fbe6bf; background: rgba(140,28,20,.9); border-radius: 2px; }
.cy-nav {
  position: relative; width: 52px; height: 52px; padding: 0; border: 2px solid #c99a3e; border-radius: 50%; cursor: pointer; color: #f3d68f; flex: 0 0 auto;
  background: radial-gradient(circle at 35% 30%, #8a5a2a, #4a2a14 60%, #2a170a); box-shadow: inset 0 0 0 2px rgba(0,0,0,.4), inset 0 2px 0 rgba(255,225,160,.35), 0 4px 10px rgba(0,0,0,.7);
}
.cy-nav i { position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; border: solid #ffe08a; border-width: 0 4px 4px 0; filter: drop-shadow(0 1px 1px #000); }
.cy-nav.prev i { transform: translate(-30%, -50%) rotate(135deg); }
.cy-nav.next i { transform: translate(-70%, -50%) rotate(-45deg); }
.cy-nav small { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; white-space: nowrap; font-family: var(--font-title); font-size: 14px; color: #f3d68f; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.cy-nav:hover { filter: brightness(1.3); transform: scale(1.06); }
.cy-nav.off { visibility: hidden; }

.hall-dais { flex-direction: column; align-items: center; gap: 10px; }
.hall-free { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 10px 8px; background: rgba(8,5,3,.55); border: 1px dashed rgba(201,154,62,.5); border-radius: 5px; }
.hall-free h5 { margin: 0; font-family: var(--font-title); font-weight: normal; font-size: 15px; letter-spacing: .3em; color: #e6c27a; }
.hall-free .plqs { display: flex; gap: 6px; }
.hall-free .plq { width: 62px; padding: 3px; }
.hall-free .plq b { font-size: 13px; }
.hall-free small { font-size: 11px; color: #cdb488; }

.hall-detail dt.itk { grid-column: 1; }
.hall-detail dd.it { grid-column: 2 / -1; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.hall-detail dd.it img { width: 20px; height: 20px; object-fit: contain; }
.cy-pick .pk.city { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
.cy-pick .pk-sub { margin: 10px 0 2px; font-family: var(--font-title); font-weight: normal; font-size: 16px; letter-spacing: .2em; color: #e6c27a; border-bottom: 1px solid rgba(201,154,62,.3); }
.cy-pick .amt.item { gap: 10px; }
.cy-pick .amt.item img { width: 34px; height: 34px; object-fit: contain; }
.cy-pick .amt.item b { flex: 1; text-align: left; }
.cy-pick .amt.item b small { display: block; font-family: var(--font-body); font-size: 11px; color: #a89068; }
.cy-pick .pk-msg.dim { font-size: 14px; color: #a89068; }
.cy-pick .list > .amt { margin-bottom: 4px; }
.tb-date { font-size: 18px; letter-spacing: .1em; }

/* league tables */
.cy-tbl { position: absolute; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); }
.cy-tbl > .dark-panel { position: relative; width: min(1180px, 94cqw); height: min(82cqh, 700px); display: flex; flex-direction: column; }
.cy-tbl h4 { margin: 0 0 8px; display: flex; align-items: baseline; gap: 12px; font-family: var(--font-title); font-weight: normal; font-size: 26px; letter-spacing: .2em; color: var(--gold); }
.cy-tbl h4 small { font-family: var(--font-body); font-size: 13px; letter-spacing: 0; color: #a89068; }
.cy-tbl h4 .flt { margin-left: auto; margin-right: 40px; font: 14px var(--font-body); color: #f5e4bc; background: rgba(0,0,0,.5); border: 1px solid rgba(201,154,62,.5); border-radius: 3px; padding: 3px 8px; }
.cy-tbl h4 .ce-x { position: absolute; right: 14px; top: 14px; }
.tbl-wrap { flex: 1; min-height: 0; overflow: auto; border: 1px solid rgba(201,154,62,.25); border-radius: 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; color: #eedcb2; text-align: right; font-variant-numeric: tabular-nums; }
.tbl th { position: sticky; top: 0; z-index: 1; padding: 7px 10px; cursor: pointer; white-space: nowrap; font-weight: normal; font-size: 14px; color: #e9cf96; background: #1a110a; border-bottom: 1px solid rgba(201,154,62,.5); }
.tbl th:hover { color: #fff3d0; }
.tbl th.on { color: #ffd77a; }
.tbl td { padding: 4px 10px; border-bottom: 1px solid rgba(201,154,62,.1); white-space: nowrap; }
.tbl .l { text-align: left; }
.tbl tbody tr:nth-child(even) { background: rgba(255,255,255,.025); }
.tbl tbody tr:hover { background: rgba(201,154,62,.14); }
.tbl tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.tbl tr.mine { background: rgba(201,154,62,.08) !important; }
.tbl tr.go { cursor: pointer; }
.tbl img.pt { width: 28px; height: 37px; object-fit: cover; object-position: top; border-radius: 2px; vertical-align: middle; margin-right: 8px; border: 1px solid #5a4027; }
.tbl img.fl { width: 22px; vertical-align: middle; margin-right: 8px; }


/* city ledger: a compact, wide panel in the top-left corner of the hall */
#screen-city .cl {
  position: absolute; z-index: 9; left: 7.4cqw; top: 4.6cqh; width: 28.5cqw; min-width: 330px; padding: .55cqh .9cqw .7cqh;
  font-size: clamp(11px, .88cqw, 15px); line-height: 1.25; color: #f6e4b8;
  background: linear-gradient(to bottom, rgba(26,17,10,.93), rgba(10,7,4,.95)); border: 1px solid rgba(201,154,62,.65); border-radius: 5px;
  box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.65);
}
.cl-top { display: flex; align-items: center; gap: .6em; padding-bottom: .3em; margin-bottom: .3em; border-bottom: 1px solid rgba(201,154,62,.4); }
.cl-top .fl { width: 1.7em; }
.cl-top > b { font-family: var(--font-title); font-weight: normal; font-size: 1.9em; letter-spacing: .15em; color: var(--gold); text-shadow: 0 2px 3px #000; line-height: 1; }
.cl-top > small { font-size: .95em; color: #e6c27a; }
.cl-season { margin-left: auto; display: inline-flex; align-items: baseline; gap: .4em; padding: .1em .7em; border-radius: 3px; font-family: var(--font-title); background: linear-gradient(90deg, var(--sc, #444), rgba(0,0,0,.2)); }
.cl-season b { font-weight: normal; font-size: 1.35em; color: #fff3d0; }
.cl-season i { font-style: normal; font-family: var(--font-body); font-size: .8em; color: #fbe6bf; }
.cl-season.s-春 { --sc: rgba(70,140,70,.75); } .cl-season.s-夏 { --sc: rgba(200,120,30,.75); }
.cl-season.s-秋 { --sc: rgba(170,100,30,.75); } .cl-season.s-冬 { --sc: rgba(70,110,170,.75); }
.cl-line { display: flex; flex-wrap: wrap; gap: .1em 1.1em; color: #a89068; }
.cl-line b { font-weight: normal; color: #ffe1a0; }
.cl-line small { color: #a89068; }
.cl .tag { font-style: normal; padding: 0 .4em; border-radius: 2px; font-size: .85em; background: var(--red); color: #fbe6bf; }
.cl-res { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 .6em; margin: .3em 0 .25em; padding: .25em 0; border-top: 1px solid rgba(201,154,62,.2); border-bottom: 1px solid rgba(201,154,62,.2); }
.cl-res span { display: flex; justify-content: space-between; gap: .4em; color: #a89068; }
.cl-res b { font-weight: normal; color: #ffe1a0; font-variant-numeric: tabular-nums; }
.cl-dev { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 .6em; }
.cl-dev span { position: relative; display: flex; justify-content: space-between; gap: .3em; padding-bottom: .25em; color: #a89068; }
.cl-dev b { font-weight: normal; color: #ffe1a0; font-variant-numeric: tabular-nums; }
.cl-dev small { color: #8f7a58; }
.cl-dev i { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #8c1c14, #e0a040); border-radius: 2px; }
.cl-dev span::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; }
.cl-dev i { z-index: 1; }
/* ---------- 稟報: one officer steps forward, the rest stand small at the sides ---------- */
.hall .hall-side .plqs { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px 5px; }
.hall .hall-side .plq { padding: 2px 2px 3px; opacity: .78; }
.hall .hall-side .plq b { font-size: 11px; }
.hall .hall-side .plq .ly { height: 4px; margin-top: 1px; }
.hall .hall-side .plq em { display: none; }
.hall .hall-side h5 { font-size: 15px; }
.hall-stage { display: flex; align-items: flex-end; gap: 14px; margin-top: 8px; animation: stage-in .35s ease; }
@keyframes stage-in { from { transform: translateY(26px); opacity: 0; } }
.stage-who .plq { width: clamp(84px, 7.5cqw, 112px); padding: 4px 4px 5px; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 0 18px rgba(243,214,143,.4), 0 8px 18px rgba(0,0,0,.7); cursor: default; }
.stage-who .plq b { font-size: clamp(15px, 1.2cqw, 20px); }
.stage-bubble {
  position: relative; width: clamp(300px, 27cqw, 420px); padding: 10px 14px 10px; color: #f6e4b8;
  background: linear-gradient(to bottom, rgba(32,20,11,.97), rgba(14,9,5,.97)); border: 1px solid var(--gold-deep); border-radius: 6px; box-shadow: 0 8px 22px rgba(0,0,0,.75);
}
.stage-bubble::before { content: ""; position: absolute; left: -8px; bottom: 26px; width: 14px; height: 14px; transform: rotate(45deg); background: #1c120a; border-left: 1px solid var(--gold-deep); border-bottom: 1px solid var(--gold-deep); }
.sb-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.sb-head b { font-family: var(--font-title); font-weight: normal; font-size: 20px; letter-spacing: .1em; color: var(--gold); }
.sb-head small { font-size: 12px; color: #e3b866; }
.sb-head i { font-style: normal; padding: 0 7px; font-size: 12px; border-radius: 2px; color: #fff3d0; background: #555; }
.sb-head i.k-軍師 { background: #a8781e; } .sb-head i.k-內政 { background: #3f8f4a; } .sb-head i.k-軍事 { background: #b23a2a; } .sb-head i.k-人事 { background: #2f5fa8; } .sb-head i.k-外交 { background: #7b3f9e; }
.sb-head span { margin-left: auto; font-size: 12px; color: #a89068; }
.stage-bubble p { margin: 0 0 8px; font-size: clamp(13px, 1.05cqw, 16px); line-height: 1.6; }
.sb-btns { display: flex; gap: 8px; justify-content: flex-end; }
.sb-btns button { padding: 4px 16px; font-family: var(--font-title); font-size: 17px; letter-spacing: .15em; color: #f0dcae; cursor: pointer; background: linear-gradient(to bottom, #4a2e18, #22140a); border: 1px solid rgba(201,154,62,.7); border-radius: 3px; }
.sb-btns button:first-child { color: #fff3d0; background: linear-gradient(to bottom, #8c2a1c, #4a140c); border-color: #e0a040; }
.sb-btns button:hover { filter: brightness(1.3); }
.sb-btns button.ghost { margin-right: auto; font-family: var(--font-body); font-size: 12px; letter-spacing: 0; background: none; border-color: transparent; color: #a89068; }
/* while someone is reporting the command rail waits */
#screen-city.in-aud .rail { opacity: .45; pointer-events: none; filter: grayscale(.4); }

/* ---------- 結束回合: days go by, the messenger reports ---------- */
.cal { position: fixed; inset: 0; z-index: 75; background: rgba(0,0,0,.3); }
.cal-date { position: absolute; left: 50%; top: 7cqh; transform: translateX(-50%); display: flex; align-items: baseline; gap: 14px; padding: 8px 34px 10px;
  font-family: var(--font-title); color: var(--gold); text-shadow: 0 2px 6px #000; white-space: nowrap;
  background: linear-gradient(to bottom, rgba(26,17,10,.92), rgba(10,7,4,.92)); border: 1px solid var(--gold-deep); border-radius: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.75); }
.cal-date small { font-size: 20px; letter-spacing: .2em; color: #e3b866; }
.cal-date b { font-weight: normal; font-size: 46px; letter-spacing: .12em; min-width: 5.3em; text-align: center; }
.cal-date i { font-style: normal; font-size: 20px; color: #cdb488; }
.cal-msg { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); display: flex; align-items: flex-end; gap: 16px; animation: stage-in .3s ease; }
.cal-msg.hidden { display: none; }
.rider { width: clamp(110px, 9.5cqw, 150px); padding: 5px 5px 6px; text-align: center; background: linear-gradient(to bottom, rgba(32,20,11,.97), rgba(14,9,5,.97)); border: 1px solid var(--gold); border-radius: 4px; box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 0 20px rgba(243,214,143,.4), 0 10px 22px rgba(0,0,0,.75); }
.rider img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border-radius: 2px; display: block; }
.rider b { display: block; margin-top: 3px; font-family: var(--font-title); font-weight: normal; font-size: 19px; letter-spacing: .15em; color: #f6e4b8; }
.cal-bubble { position: relative; width: clamp(340px, 34cqw, 500px); padding: 12px 16px 12px; color: #f6e4b8; background: linear-gradient(to bottom, rgba(32,20,11,.97), rgba(14,9,5,.97)); border: 1px solid var(--gold-deep); border-radius: 6px; box-shadow: 0 10px 26px rgba(0,0,0,.8); }
.cal-bubble::before { content: ""; position: absolute; left: -8px; bottom: 30px; width: 14px; height: 14px; transform: rotate(45deg); background: #1c120a; border-left: 1px solid var(--gold-deep); border-bottom: 1px solid var(--gold-deep); }
.cb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cb-head .k { font-style: normal; padding: 1px 10px; font-family: var(--font-title); font-size: 16px; letter-spacing: .1em; border-radius: 2px; color: #fff3d0; background: #555; }
.cb-head .n { margin-left: auto; font-size: 12px; color: #a89068; }
.k-戰事 { background: #b23a2a !important; } .k-稱號 { background: #a8781e !important; } .k-獨立 { background: #8a2a6a !important; } .k-外交 { background: #7b3f9e !important; }
.k-叛逃, .k-密報, .k-抱怨 { background: #c0561e !important; } .k-計略 { background: #1f8a8a !important; } .k-災害 { background: #4a6a8a !important; } .k-結算 { background: #5a4a30 !important; }
.cal-bubble p { margin: 0 0 10px; font-size: clamp(14px, 1.15cqw, 17px); line-height: 1.7; }
.cb-btns { display: flex; justify-content: space-between; align-items: center; }
.cb-btns button { padding: 4px 22px; font-family: var(--font-title); font-size: 18px; letter-spacing: .15em; cursor: pointer; color: #fff3d0; background: linear-gradient(to bottom, #8c2a1c, #4a140c); border: 1px solid #e0a040; border-radius: 3px; }
.cb-btns button:hover { filter: brightness(1.3); }
.cb-btns button.ghost { padding: 2px 8px; font-family: var(--font-body); font-size: 12px; letter-spacing: 0; background: none; border-color: transparent; color: #a89068; }

/* the account of recent events, bottom-left of the hall */
.evbox { position: absolute; z-index: 9; left: 8.5cqw; bottom: 2.6cqh; width: 15cqw; min-width: 0; padding: 6px 12px 8px; cursor: pointer; color: #f0dcae; font-size: clamp(11px, .85cqw, 14px); line-height: 1.45;
  background: linear-gradient(to bottom, rgba(26,17,10,.9), rgba(10,7,4,.93)); border: 1px solid rgba(201,154,62,.55); border-radius: 5px; box-shadow: 0 6px 16px rgba(0,0,0,.6); }
.evbox:hover { border-color: var(--gold); }
.evbox h6 { margin: 0 0 3px; display: flex; align-items: baseline; justify-content: space-between; font-family: var(--font-title); font-weight: normal; font-size: 1.25em; letter-spacing: .3em; color: var(--gold); }
.evbox h6 small { font-family: var(--font-body); font-size: .8em; letter-spacing: 0; color: #a89068; }
.evbox p { margin: 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.evbox p i { font-style: normal; margin-right: .6em; color: #e3b866; }
.evbox p.dim { color: #8f7a58; }

/* 記事 / info dialogs */
.lg-wrap { padding: 4px 14px; }
.lg-month { margin: 12px 0 4px; font-family: var(--font-title); font-weight: normal; font-size: 18px; letter-spacing: .2em; color: var(--gold); border-bottom: 1px solid rgba(201,154,62,.3); }
.lg-row { margin: 0; padding: 4px 0; font-size: 15px; line-height: 1.55; color: #eedcb2; border-bottom: 1px solid rgba(201,154,62,.08); }
.lg-row i { font-style: normal; display: inline-block; min-width: 2.8em; color: #a89068; font-size: 13px; }
.lg-row b { display: inline-block; margin-right: .7em; padding: 0 .6em; font-family: var(--font-title); font-weight: normal; font-size: 13px; border-radius: 2px; color: #fff3d0; background: #555; }
.lg-row.dim { color: #8f7a58; }
.info-panel { width: min(640px, 94cqw) !important; height: auto !important; max-height: 84cqh; }
.info-lead { margin: 4px 14px 8px; font-size: 16px; color: #cdb488; }
.info-lead b { font-family: var(--font-title); font-weight: normal; font-size: 22px; color: var(--gold); }
.info-grid { list-style: none; margin: 0 14px 10px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.info-grid li { display: flex; justify-content: space-between; padding: 4px 10px; font-size: 14px; color: #a89068; background: rgba(0,0,0,.3); border: 1px solid rgba(201,154,62,.2); border-radius: 3px; }
.info-grid b { font-weight: normal; color: #ffe1a0; }
.info-note { margin: 8px 14px; font-size: 13px; color: #8f7a58; }

/* officers sit lower so they never touch the ledger or the title plate */
#screen-city .hall { padding-top: 7.5cqh; }
/* the event box scrolls with the mouse wheel (newest at the top) */
.evbox .ev-list { max-height: calc(4 * 1.45em); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #8a6a36 transparent; }
.evbox .ev-list::-webkit-scrollbar { width: 6px; }
.evbox .ev-list::-webkit-scrollbar-thumb { background: #8a6a36; border-radius: 3px; }
/* sound button and panel */
.snd-btn { position: fixed; z-index: 90; right: 8.4cqw; top: 26px; width: 34px; height: 34px; padding: 0; font-size: 18px; line-height: 1; color: var(--gold); cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #6a4524, #2a170a); border: 1px solid var(--gold-deep); border-radius: 50%; box-shadow: 0 3px 8px rgba(0,0,0,.7); }
.snd-btn:hover { filter: brightness(1.3); }
.snd-panel { position: fixed; z-index: 90; right: 14px; top: 112px; width: 240px; padding: 12px 14px; color: #eedcb2; font-size: 14px;
  background: linear-gradient(to bottom, rgba(32,20,11,.97), rgba(14,9,5,.97)); border: 1px solid var(--gold-deep); border-radius: 6px; box-shadow: 0 10px 24px rgba(0,0,0,.75); }
.snd-panel h6 { margin: 0 0 8px; font-family: var(--font-title); font-weight: normal; font-size: 18px; letter-spacing: .4em; color: var(--gold); }
.snd-panel label { display: grid; grid-template-columns: 70px 1fr; align-items: center; margin: 6px 0; }
.snd-panel input[type=range] { accent-color: #c8822e; width: 100%; }
.snd-track { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 6px; padding-top: 8px; border-top: 1px solid rgba(201,154,62,.3); font-size: 13px; color: #cdb488; }
.snd-track button { width: 28px; height: 26px; padding: 0; color: var(--gold); cursor: pointer; background: #2a1a10; border: 1px solid var(--gold-deep); border-radius: 3px; }
.snd-panel a { font-size: 12px; color: #e3b866; }
/* the 結束回合 tile has four characters, so two per line */
.tile.two { font-size: clamp(13px, 1.15cqw, 19px); line-height: 1.15; }
#screen-city > .rail { --rw: clamp(600px, 62cqw, 1000px); }
.snd-voice { margin: 8px 0 4px; padding-top: 8px; border-top: 1px solid rgba(201,154,62,.3); display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #cdb488; line-height: 1.5; }
.snd-voice span.ok { color: #9fd08a; }
.snd-voice button { align-self: flex-start; padding: 2px 12px; font-size: 13px; color: var(--gold); cursor: pointer; background: #2a1a10; border: 1px solid var(--gold-deep); border-radius: 3px; }
.snd-chk { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: #cdb488; cursor: pointer; }
.snd-chk input { margin-top: 2px; accent-color: #c8822e; }
.hidden { display: none !important; }

/* (no media queries: the whole game is one fixed 1920x1080 stage that is scaled, so a small window never re-flows the layout) */

/* looping action animations (ui/anim/<name>.png: 8 frames side by side, drawn by GPT) */
.anim { --sz: 96px; display: inline-block; width: var(--sz); height: var(--sz); background: var(--img) 0 0 / calc(var(--n, 8) * 100%) 100% no-repeat; animation: anim8 var(--dur, 1.1s) steps(var(--n, 8)) infinite; filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
@keyframes anim8 { to { background-position: calc(var(--n, 8) / (var(--n, 8) - 1) * 100%) 0; } }   /* 8 frames in an 800%-wide strip: frame k sits at k/7 of the travel */

/* a framed action scene: the animation (with its empty plaque at the bottom) and the action's name written on the plaque */
.act { --sz: 256px; --ar: 1; flex: none; position: relative; display: inline-block; height: var(--sz); width: calc(var(--sz) * var(--ar)); }
.act .anim { --sz: 100%; width: 100%; height: 100%; }
.act b { position: absolute; left: calc(var(--bx, .09) * 100%); top: calc(var(--by, .85) * 100%); width: calc(var(--bw, .82) * 100%); height: calc(var(--bh, .11) * 100%); display: grid; place-items: center; font-size: calc(var(--sz) * .062); line-height: 1; letter-spacing: .25em; padding-left: .25em; box-sizing: border-box; overflow: hidden; white-space: nowrap; color: #f3d68f; text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.8); font-weight: bold; }
.cy-pick > .dark-panel { position: relative; }
.cy-pick .act { --sz: 150px; position: absolute; left: 26px; bottom: 16px; }
.cy-pick .dark-panel:has(.act) .pk-foot { min-height: 160px; align-items: flex-end; }
.cy-pick .dark-panel:has(.act) .list { margin-bottom: 8px; }
/* officers stand on the lower floor, just above the command bar */
#screen-city .hall-side { align-self: end; margin-bottom: 2cqh; }
.hall-detail .btn[data-cy=recruit] { margin-top: 6px; align-self: flex-start; }
/* no portraits in the pickers any more: a flex row (the old photo-grid columns made names overlap the stats) */
.cy-pick .pk:not(.city) { display: flex; align-items: center; gap: 18px; }
.cy-pick .list { clear: both; }

/* officers stand against the outer walls, so the centre stays free for the advisor / audience */
#screen-city .hall-side .plqs { display: flex; flex-wrap: wrap; gap: 8px 6px; direction: ltr; }
#screen-city .hall-side .plq { flex: 0 0 62px; }
#screen-city .hall-side.left { padding-left: 5.5cqw; }
#screen-city .hall-side.left .plqs { justify-content: flex-start; }
#screen-city .hall-side.left h5 { text-align: left; padding-left: 4px; }
#screen-city .hall-side.right { padding-right: 5.5cqw; }
#screen-city .hall-side.right .plqs { justify-content: flex-end; }
#screen-city .hall-side.right h5 { text-align: right; padding-right: 4px; }

/* ---- battle screen (battle.js) */
.battle { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0,0,0,.72); }
.bt-panel { position: relative; width: min(1180px, 96cqw); max-height: 94cqh; display: flex; flex-direction: column; gap: 10px; padding: 16px 22px 18px; color: #eedcb2;
  background: linear-gradient(#2a1a10, #170e08); border: 2px solid #8a6428; border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 10px 40px #000; }
.bt-panel header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid rgba(201,154,62,.35); padding-bottom: 6px; }
.bt-panel h3 { margin: 0; font-family: var(--font-title); font-weight: normal; font-size: 28px; letter-spacing: .2em; color: var(--gold); }
.bt-panel header span { color: #cdb488; font-size: 15px; }
.bt-field { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 14px; min-height: 0; }
.bt-side { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: rgba(0,0,0,.3); border: 1px solid rgba(201,154,62,.3); border-radius: 4px; }
.bt-side.a { border-color: rgba(120,170,230,.45); } .bt-side.d { border-color: rgba(230,120,100,.45); }
.bt-side h5 { margin: 0; font-family: var(--font-title); font-weight: normal; font-size: 22px; letter-spacing: .25em; color: var(--gold); }
.bt-side h5 small { font-family: var(--font-body); letter-spacing: 0; font-size: 14px; color: #cdb488; }
.bt-unit { display: flex; gap: 10px; align-items: center; padding: 6px; background: rgba(0,0,0,.35); border: 1px solid rgba(201,154,62,.2); border-radius: 4px; }
.bt-unit.dead { opacity: .35; filter: grayscale(1); }
.bt-unit img, .bt-nopic { width: 54px; height: 72px; object-fit: cover; object-position: top; border-radius: 3px; flex: none; }
.bt-nopic { display: grid; place-items: center; font-size: 26px; background: #3a2616; color: var(--gold); font-family: var(--font-title); }
.bt-ui { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.bt-ui b { font-family: var(--font-title); font-weight: normal; font-size: 19px; color: #f6e4b8; }
.bt-ui .k { font-size: 13px; color: #9fd08a; }
.bt-ui .n { font-size: 12px; color: #cdb488; }
.bt-panel .bar { display: block; height: 8px; background: rgba(0,0,0,.6); border: 1px solid rgba(201,154,62,.4); border-radius: 4px; overflow: hidden; }
.bt-panel .bar i { display: block; height: 100%; background: linear-gradient(#e6c27a, #a8742a); transition: width .5s; }
.bt-panel .bar.m i { background: linear-gradient(#7fc3ff, #3a78c0); } .bt-panel .bar.w i { background: linear-gradient(#c9b38a, #7a6a4a); }
.bt-morale, .bt-wall { display: grid; grid-template-columns: 40px 1fr 30px; gap: 8px; align-items: center; font-size: 13px; color: #cdb488; }
.bt-wall { grid-template-columns: 40px 1fr; }
.bt-log { overflow: auto; max-height: 52cqh; padding: 10px 12px; font-size: 14px; line-height: 1.6; background: rgba(0,0,0,.4); border: 1px solid rgba(201,154,62,.25); border-radius: 4px; }
.bt-log p { margin: 0 0 4px; } .bt-log p.dim { color: #a89068; }
.bt-cmd { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.bt-cmd .btn { display: flex; flex-direction: column; align-items: center; gap: 2px; height: auto; min-height: 62px; padding: 8px 6px; }
.bt-cmd .btn b { font-family: var(--font-title); font-weight: normal; font-size: 22px; letter-spacing: .2em; }
.bt-cmd .btn small { font-size: 11px; opacity: .85; line-height: 1.3; }
.bt-tip { margin: 0; text-align: center; font-size: 13px; color: #a89068; }
.bt-result { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 18px; align-items: center; justify-content: center; background: rgba(0,0,0,.62); border-radius: 4px; }
.bt-result b { font-family: var(--font-title); font-weight: normal; font-size: 64px; letter-spacing: .4em; padding-left: .4em; text-shadow: 0 3px 8px #000; }
.bt-result.win b { color: #f3d68f; } .bt-result.lose b { color: #ff8a70; } .bt-result.retreat b { color: #cdb488; }
.bt-cmd { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bt-cmd .btn { min-width: 0; width: 100%; height: 84px; padding: 6px 26px; letter-spacing: normal; }
.bt-cmd .btn b { font-size: 20px; letter-spacing: .15em; }
.bt-cmd .btn small { max-width: 100%; white-space: normal; text-align: center; }
/* the command plaques are wide boards with wolf-head corners: keep the words on the paper in the middle */
.bt-cmd .btn { height: 96px; padding: 20px 17% 14px; gap: 1px; justify-content: center; }
.bt-cmd .btn b { font-size: 19px; letter-spacing: .25em; padding-left: .25em; line-height: 1.1; }
.bt-cmd .btn small { font-size: 11px; line-height: 1.2; white-space: nowrap; }
.bt-side.me { border-color: rgba(120,170,230,.45); } .bt-side.foe { border-color: rgba(230,120,100,.45); }

/* officer card in the middle of the hall: portrait on the left half, name / numbers / story on the right half */
@keyframes hd-in-c { from { transform: translateX(-50%) scale(.96); opacity: 0; } }
#screen-city .hall-detail {
  left: 50%; right: auto; top: 21cqh; bottom: auto; transform: translateX(-50%);
  width: min(780px, 56cqw); height: min(500px, 54cqh); display: grid; grid-template-columns: 1fr 1fr; animation-name: hd-in-c;
}
#screen-city .hall-detail .art { grid-column: 1; grid-row: 1; width: 100%; height: 100%; flex: none; object-fit: cover; object-position: 50% 0; -webkit-mask-image: none; mask-image: none; }
#screen-city .hall-detail .info { grid-column: 2; grid-row: 1; margin-top: 0; padding: 22px 22px 16px; overflow: auto; min-height: 0; gap: 8px; border-left: 1px solid rgba(201,154,62,.35); background: linear-gradient(#150d07, #0c0805); }
#screen-city .hall-detail .hero-stats { margin-top: 2px; }
.hero-story { margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(201,154,62,.3); }
.hero-story h6 { margin: 0 0 6px; font-family: var(--font-title); font-weight: normal; font-size: 18px; letter-spacing: .5em; color: var(--gold); }
.hero-story ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.55; color: #e6d3a6; }
.hero-story li { position: relative; padding-left: 16px; }
.hero-story li::before { content: "◆"; position: absolute; left: 0; top: 1px; font-size: 10px; color: var(--gold); }

/* ---- 單挑 (inside the battle screen) */
.bt-cmd { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bt-cmd .duel-btn b { color: #ffcf7a; }
.duel { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(0,0,0,.66); }
.du-panel { position: relative; width: min(900px, 90%); display: flex; flex-direction: column; gap: 12px; padding: 16px 22px 18px; color: #eedcb2;
  background: linear-gradient(#2c170c, #140b06); border: 2px solid #b0782c; border-radius: 6px; box-shadow: 0 0 0 1px #000, 0 10px 40px #000; }
.du-panel header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid rgba(201,154,62,.35); padding-bottom: 6px; }
.du-panel h3 { margin: 0; font-family: var(--font-title); font-weight: normal; font-size: 30px; letter-spacing: .3em; color: #ffcf7a; }
.du-field { display: grid; grid-template-columns: 200px 1fr 200px; gap: 14px; align-items: start; }
.du-side { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; background: rgba(0,0,0,.35); border: 1px solid rgba(201,154,62,.3); border-radius: 4px; }
.du-side.me { border-color: rgba(120,170,230,.5); } .du-side.foe { border-color: rgba(230,120,100,.5); }
.du-side img { width: 150px; height: 200px; object-fit: cover; object-position: top; border-radius: 3px; }
.du-side b { font-family: var(--font-title); font-weight: normal; font-size: 24px; color: #f6e4b8; }
.du-side small { font-size: 13px; color: #cdb488; }
.du-side .bar { width: 100%; height: 10px; display: block; background: rgba(0,0,0,.6); border: 1px solid rgba(201,154,62,.4); border-radius: 5px; overflow: hidden; }
.du-side .bar i { display: block; height: 100%; background: linear-gradient(#ff8a70, #b0302a); transition: width .4s; }
.du-side em { font-style: normal; font-size: 13px; color: #cdb488; }
.du-log { min-height: 240px; max-height: 300px; overflow: auto; padding: 10px 12px; font-size: 14px; line-height: 1.6; background: rgba(0,0,0,.4); border: 1px solid rgba(201,154,62,.25); border-radius: 4px; }
.du-log p { margin: 0 0 4px; } .du-log p.dim { color: #a89068; }
.du-cmd { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.du-cmd .btn { min-width: 0; width: 100%; height: 90px; padding: 20px 17% 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; letter-spacing: normal; }
.du-cmd .btn b { font-family: var(--font-title); font-weight: normal; font-size: 22px; letter-spacing: .25em; padding-left: .25em; }
.du-cmd .btn small { font-size: 11px; white-space: nowrap; }
.du-end { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(0,0,0,.72); border-radius: 4px; cursor: pointer; }
.du-end p { margin: 0; color: #cdb488; font-size: 14px; }

.du-side { position: relative; }
.du-say { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); width: 230px; padding: 8px 10px; font-size: 14px; line-height: 1.5; color: #2a1608; background: #f1dfb2; border: 2px solid #8a5a1c; border-radius: 8px; text-align: left; z-index: 2; box-shadow: 0 4px 10px rgba(0,0,0,.6); }
.du-say::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; background: #f1dfb2; border-right: 2px solid #8a5a1c; border-bottom: 2px solid #8a5a1c; transform: translateX(-50%) rotate(45deg); }
.du-side.me .du-say { left: 62%; } .du-side.foe .du-say { left: 38%; }
.du-skip { position: absolute; right: 18px; bottom: 14px; z-index: 3; min-width: 140px; height: 42px; font-size: 15px; }
.du-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.du-center p { margin: 0; text-align: center; font-size: 15px; color: #f6e4b8; max-width: 330px; }
.du-final.lose .du-center p { color: #ff9c86; } .du-final.win .du-center p { color: #ffd98a; }
.sb-kind.k-人才 { background: #2f5fa8; } .sb-kind.k-計略 { background: #1f8a8a; } .sb-kind.k-回報 { background: #6a8a2a; } .sb-kind.k-外交 { background: #7b3f9e; }

/* objections and the third opinion inside the officer's speech bubble */
.sb-dissent { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 2px; padding: 6px 8px; background: rgba(120,30,20,.28); border-left: 3px solid #c0564a; border-radius: 3px; }
.sb-dissent img { width: 34px; height: 44px; object-fit: cover; object-position: top; border-radius: 2px; flex: none; }
.sb-dissent b { font-size: 12px; color: #f0b8a8; } .sb-dissent b i { font-style: normal; margin-left: 4px; padding: 0 5px; font-size: 11px; color: #fff; background: #a8402f; border-radius: 3px; }
.sb-dissent p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.5; color: #f2dccb; }
.sb-dissent.third.pro { background: rgba(40,90,40,.3); border-left-color: #6aa85a; } .sb-dissent.third.pro b { color: #bfe3b0; } .sb-dissent.third.pro b i { background: #3f7a35; }
.sb-dissent.third.con { background: rgba(110,60,20,.3); border-left-color: #c98a3a; } .sb-dissent.third.con b { color: #f0d0a0; } .sb-dissent.third.con b i { background: #a8702f; }

/* city: messages appear right under the ruler's portrait */
body:has(#screen-city.active) .toast { top: 515px; }

/* 軍師: stands to the left of the lord; click to ask */
.hall-dais { position: relative; }
.plq.adv { position: absolute; right: calc(100% + 16px); top: 52px; width: clamp(96px, 9cqw, 124px); cursor: pointer; }
.plq.adv small { display: block; font-size: 12px; color: #e6c27a; letter-spacing: .2em; }
.plq.adv:hover { filter: brightness(1.15); transform: translateY(-2px); }
.consult { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0,0,0,.5); }
.consult.hidden { display: none; }
.consult .dark-panel { width: min(900px, 86cqw); max-height: 82cqh; overflow: auto; }
.consult h4 { margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; font-family: var(--font-title); font-weight: normal; font-size: 26px; letter-spacing: .2em; color: var(--gold); }
.cs-who { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.cs-who img { width: 64px; height: 84px; object-fit: cover; object-position: top; border: 2px solid var(--gold-deep); border-radius: 3px; }
.cs-who b { font-family: var(--font-title); font-size: 22px; color: #f6e4b8; font-weight: normal; }
.cs-who b small { margin-left: 10px; font-size: 13px; color: #c9a25a; letter-spacing: .2em; }
.cs-who p { margin: 4px 0 0; color: #d9c598; font-size: 15px; }
.cs-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cs-tabs button { padding: 6px 16px; font-size: 16px; letter-spacing: .15em; color: #eedcb2; background: rgba(0,0,0,.35); border: 1px solid rgba(201,154,62,.35); border-radius: 4px; cursor: pointer; }
.cs-tabs button.on { background: rgba(201,154,62,.3); border-color: var(--gold); color: #fff1c8; }
.cs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cs-list li { display: flex; align-items: center; gap: 14px; padding: 8px 12px; font-size: 16px; line-height: 1.6; color: #eedcb2; background: rgba(0,0,0,.28); border: 1px solid rgba(201,154,62,.2); border-radius: 4px; }
.cs-list li span { flex: 1; }
.cs-list li button { flex: none; padding: 6px 14px; font-size: 14px; color: #2a1608; background: linear-gradient(#f0d28a, #c9954a); border: 1px solid #8a5a1c; border-radius: 4px; cursor: pointer; }

/* 內府 */
.palace .pl-note { margin: 0 0 10px; color: #d9c598; font-size: 15px; line-height: 1.6; }
.palace .pl-off { display: block; margin-bottom: 10px; color: #f6e4b8; font-size: 17px; }
.palace select { margin-left: 8px; padding: 6px 10px; font-size: 16px; color: #2a1608; background: #f1dfb2; border: 1px solid #8a5a1c; border-radius: 4px; }
.palace .cs-list li small { color: #c9a25a; font-size: 13px; }
.palace .pl-when { color: #9fd08a !important; }
.palace .pl-step { flex: none; display: flex; align-items: center; gap: 12px; }
.palace .pl-step b { min-width: 24px; text-align: center; font-size: 22px; color: #fff1c8; }
.palace .pl-step button { width: 34px; height: 34px; padding: 0; font-size: 20px; }
.palace .pl-step button:disabled { opacity: .35; cursor: default; }
.palace .pl-warn { margin: 8px 0 0; color: #ffb84a; font-size: 14px; }

/* 後宮 */
.harem .dark-panel { width: min(1240px, 92cqw); }
.harem h4 { gap: 18px; }
.harem .hm-count { margin-left: auto; margin-right: 14px; font-family: var(--font-body); font-size: 15px; letter-spacing: .05em; color: #d9c598; }
.hm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hm-card { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: 1fr auto; gap: 6px 12px; padding: 8px; background: rgba(0,0,0,.3); border: 1px solid rgba(201,154,62,.25); border-radius: 5px; }
.hm-card.in { border-color: var(--gold-deep); background: rgba(201,154,62,.12); }
.hm-card.fav { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(243,214,143,.3); }
.hm-card img { grid-row: 1 / 3; width: 96px; height: 128px; object-fit: cover; object-position: top; border: 2px solid var(--gold-deep); border-radius: 3px; background: #1a110a; }
.hm-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hm-info b { font-family: var(--font-title); font-weight: normal; font-size: 22px; color: #f6e4b8; }
.hm-info small { color: #c9a25a; font-size: 12px; }
.hm-info i { font-style: normal; color: #e6c27a; font-size: 14px; }
.hm-info span { color: #9fd08a; font-size: 13px; line-height: 1.4; }
.hm-btns { display: flex; gap: 6px; flex-wrap: wrap; align-self: end; }
.hm-btns button { padding: 5px 10px; font-size: 13px; color: #2a1608; background: linear-gradient(#f0d28a, #c9954a); border: 1px solid #8a5a1c; border-radius: 4px; cursor: pointer; }
.hm-btns button.ghost { color: #eedcb2; background: rgba(0,0,0,.4); border-color: rgba(201,154,62,.4); }
.hm-btns button:disabled { opacity: .4; cursor: default; }

/* 挑牌子 */
.harem .hm-grid { grid-template-columns: repeat(4, 1fr); }
.hm-pick { margin-left: auto; margin-right: 8px; padding: 6px 16px; font-size: 16px; letter-spacing: .1em; color: #2a1608; background: linear-gradient(#a6e08a, #4f9a3c); border: 1px solid #2a5a1c; border-radius: 4px; cursor: pointer; }
.hm-pick:disabled { opacity: .4; cursor: default; }
.harem h4 .hm-count { margin-left: 8px; margin-right: 0; }
.hm-tabs { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 14px 0; }
.hm-tab { position: relative; width: 66px; height: 360px; padding: 0; border: 0; cursor: pointer; background: url("../../ui/harem/tablet.png") center / 100% 100% no-repeat, linear-gradient(#2f8a4a 0 18%, #efe3c0 18%); filter: drop-shadow(0 6px 8px rgba(0,0,0,.6)); transition: transform .15s; }
.hm-tab:hover { transform: translateY(-8px); }
.hm-tab span { position: absolute; left: 0; right: 0; top: 22%; bottom: 20%; display: grid; place-items: center; white-space: pre; font-family: var(--font-title); font-size: 26px; line-height: 1.15; color: #3a1a0a; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.hm-reveal { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; width: min(900px, 88cqw); cursor: pointer; }
.hm-reveal img { height: min(560px, 70cqh); aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border: 3px solid var(--gold); border-radius: 4px; box-shadow: 0 10px 28px rgba(0,0,0,.7); }
.hm-say b { font-family: var(--font-title); font-weight: normal; font-size: 40px; color: #f6e4b8; letter-spacing: .15em; }
.hm-say p { margin: 14px 0; font-size: 24px; line-height: 1.7; color: #fff1c8; }
.hm-say small { display: block; color: #9fd08a; font-size: 15px; }
.hm-say em { display: block; margin-top: 22px; font-style: normal; color: #a89068; font-size: 14px; }

/* 工作圖示: what an officer is busy with */
.plq b i.dg { display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; margin-right: 3px; font-style: normal; font-weight: bold; font-size: .78em; line-height: 1; color: #fff; background: var(--c); border: 1px solid rgba(255,255,255,.65); border-radius: 50%; vertical-align: .08em; text-shadow: 0 1px 1px rgba(0,0,0,.6); box-shadow: 0 1px 3px rgba(0,0,0,.6); }


/* 大地圖上播放外國的行動 */
.army-mk { position: absolute; z-index: 600; width: 0; height: 0; pointer-events: none; }
.army-mk img { position: absolute; left: -9px; top: -34px; width: 18px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); }
.army-mk i { position: absolute; left: -13px; top: -16px; width: 26px; height: 26px; display: grid; place-items: center; font-style: normal; font-weight: bold; font-size: 15px; color: #fff; background: #b23a2a; border: 2px solid #f6e4b8; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.7); }
.army-mk.plot i { background: #1f8a8a; }
.army-mk.horse i { background: #6e4a12; }
.city.flip .flag { animation: flag-flip 1.2s ease; }
@keyframes flag-flip { 0% { transform: scale(0) rotate(-40deg); } 60% { transform: scale(1.6) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.city.hit-fx .icon { animation: hit-fx .5s ease 2; }
.city.plot-fx .icon { animation: plot-fx .5s ease 2; }
@keyframes hit-fx { 50% { filter: drop-shadow(0 0 10px #ff5a30) brightness(1.5); } }
@keyframes plot-fx { 50% { filter: drop-shadow(0 0 10px #3fe0d0) brightness(1.4); } }
.war-report { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.45); cursor: pointer; }
.wr-panel { width: min(760px, 80cqw); padding: 22px 28px 16px; color: #eedcb2; text-align: center; background: linear-gradient(to bottom, rgba(36,22,12,.97), rgba(14,9,5,.97)); border: 2px solid var(--gold-deep); border-radius: 8px; box-shadow: 0 0 0 4px rgba(0,0,0,.4), 0 14px 34px rgba(0,0,0,.75); }
.wr-panel h3 { margin: 0 0 14px; font-family: var(--font-title); font-weight: normal; font-size: 32px; letter-spacing: .3em; color: var(--gold); }
.wr-panel h3 small { font-size: 22px; letter-spacing: .15em; color: #f6e4b8; }
.wr-sides { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.wr-sides em { font-style: normal; font-family: var(--font-title); font-size: 38px; color: #ff9a80; }
.wr-side { display: grid; gap: 4px; justify-items: center; }
.wr-flag img { width: 42px; }
.wr-side b { font-family: var(--font-title); font-weight: normal; font-size: 24px; color: #f6e4b8; }
.wr-side small { color: #c9a25a; font-size: 14px; }
.wr-bar { width: 100%; height: 14px; background: rgba(0,0,0,.5); border: 1px solid rgba(201,154,62,.5); border-radius: 7px; overflow: hidden; }
.wr-bar i { display: block; height: 100%; background: linear-gradient(#e86a40, #a83418); transition: width 2.2s ease; }
.wr-side span { font-size: 15px; color: #d9c598; }
.wr-verdict { margin: 16px 0 6px; font-family: var(--font-title); font-size: 30px; letter-spacing: .2em; }
.wr-verdict.won { color: #ffd98a; } .wr-verdict.lost { color: #9fb8d0; }
.wr-lines { margin: 6px 0; font-size: 16px; line-height: 1.7; color: #cdb488; }
.wr-hint { display: block; margin-top: 10px; color: #8f7a58; font-size: 13px; }


/* 道路網與行軍、城上戰鬥 */
.map-world .roads { position: absolute; left: 0; top: 0; pointer-events: none; filter: drop-shadow(0 0 1px rgba(0,0,0,.6)); }
.roads line { stroke: rgba(46, 28, 10, .8); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 7 4; }
.roads line.lit { stroke: #ffd98a; stroke-width: 4.2; stroke-dasharray: none; filter: drop-shadow(0 0 5px #ffb030); }
.army { position: absolute; z-index: 2000; width: 0; height: 0; pointer-events: none; }
.army-flag { position: absolute; left: -9px; top: -52px; width: 20px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); }
.army-sp { position: absolute; width: 28px; transform: translate(-50%, -82%) scaleX(var(--fx, 1)); animation: sp-walk .5s ease-in-out infinite alternate; filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); }
@keyframes sp-walk { from { transform: translate(-50%, -82%) scaleX(var(--fx, 1)); } to { transform: translate(-50%, -96%) scaleX(var(--fx, 1)); } }
.army-label { position: absolute; left: 0; top: 6px; transform: translateX(-50%); white-space: nowrap; padding: 1px 6px; font-size: 12px; color: #fff1c8; background: rgba(20, 12, 6, .8); border: 1px solid rgba(201,154,62,.6); border-radius: 3px; }
.bfx { position: absolute; z-index: 2100; width: 0; height: 0; pointer-events: none; }
.bfx-glow { position: absolute; left: -46px; top: -46px; width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle, rgba(255,140,40,.5), transparent 68%); animation: glow-pulse .5s ease-in-out infinite alternate; }
@keyframes glow-pulse { to { opacity: .35; transform: scale(1.15); } }
.bfx-sp { position: absolute; width: 30px; transform: translate(-50%, -82%) scaleX(var(--fx, 1)); animation: lunge .55s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); transition: opacity 1s, transform 1s; }
@keyframes lunge { 0%, 100% { transform: translate(-50%, -82%) scaleX(var(--fx, 1)); } 50% { transform: translate(calc(-50% + var(--lx)), calc(-82% + var(--ly))) scaleX(var(--fx, 1)); } }
.bfx.won .bfx-sp.def { animation: none; opacity: 0; transform: translate(-50%, -40%) rotate(80deg) scaleX(var(--fx, 1)); }
.bfx.lost .bfx-sp.att { animation: none; opacity: 0; transform: translate(-50%, -40%) rotate(-80deg) scaleX(var(--fx, 1)); }
.bfx-hp { position: absolute; display: flex; align-items: center; gap: 3px; }
.bfx-hp img { width: 12px; }
.bfx-hp span { width: 46px; height: 6px; background: rgba(0,0,0,.65); border: 1px solid rgba(255,255,255,.6); border-radius: 3px; overflow: hidden; }
.bfx-hp.att i { background: #e8503a; } .bfx-hp.def i { background: #4aa0e8; }
.bfx-hp i { display: block; height: 100%; }
.bfx .spark { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: radial-gradient(#fff, #ffb030 60%, transparent); animation: spark .55s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--sx), var(--sy)) scale(.2); opacity: 0; } }
.bfx .smoke { position: absolute; width: 22px; height: 22px; margin: -11px; border-radius: 50%; background: radial-gradient(rgba(90,80,70,.75), transparent 70%); animation: smoke 1.3s ease-out forwards; }
@keyframes smoke { to { transform: translateY(-30px) scale(2.2); opacity: 0; } }
.bfx .dmg { position: absolute; font-style: normal; font-weight: bold; font-size: 11px; color: #ff6a50; text-shadow: 0 1px 2px #000; white-space: nowrap; animation: dmg-up 1.2s ease-out forwards; }
@keyframes dmg-up { to { transform: translateY(-26px); opacity: 0; } }
.city.under-attack .icon { animation: hit-fx .35s ease infinite; }
.city.burn .icon { animation: burn 1s ease 1; }
@keyframes burn { 0%, 100% { filter: none; } 40% { filter: drop-shadow(0 0 12px #ff5a20) brightness(1.7) sepia(.4); } }
.map-cap { position: absolute; z-index: 2200; transform: translateX(-50%); white-space: nowrap; padding: 2px 10px; font-size: 14px; font-weight: bold; letter-spacing: .1em; color: #fff1c8; background: rgba(20, 12, 6, .88); border: 1px solid rgba(201,154,62,.7); border-radius: 4px; pointer-events: none; animation: cap-rise 2.6s ease-out forwards; }
.map-cap.won { color: #ffd98a; font-size: 18px; border-color: #ffd98a; }
.map-cap.lost { color: #9fb8d0; }
.map-cap.flee { color: #cdb488; font-size: 12px; }
.map-cap.free { color: #a89068; font-size: 12px; }
@keyframes cap-rise { 0% { opacity: 0; margin-top: 8px; } 12% { opacity: 1; margin-top: 0; } 80% { opacity: 1; } 100% { opacity: 0; margin-top: -14px; } }


/* 道路: 畫好的道路圖層在城池下面；彎曲的路徑只在軍隊走過時發亮 */
.map-world .road-img { position: absolute; left: 0; top: 0; width: 1536px; height: 1024px; pointer-events: none; opacity: .95; }
.roads path { fill: none; stroke: transparent; stroke-width: 6; stroke-linecap: round; }
.roads path.lit { stroke: rgba(255, 226, 150, .55); stroke-width: 7; filter: drop-shadow(0 0 6px #ffb030); }
.roads.no-art path { stroke: rgba(110, 76, 38, .6); stroke-width: 3; }
.roads.no-art path.lit { stroke: rgba(255, 226, 150, .75); }


/* 大地圖：君主大頭與名字在左邊（條子下面），大頭有龍頭框 */
.map-ruler { position: absolute; z-index: 6; left: 14px; top: 104px; width: 168px; display: grid; justify-items: center; gap: 4px; pointer-events: none; }
.mr-frame { position: relative; width: 168px; height: 164px; }
.mr-frame img { position: absolute; left: 20px; top: 16px; width: 128px; height: 132px; object-fit: cover; object-position: top; background: #000; border-radius: 2px; }
.mr-frame i { position: absolute; inset: 0; background: url("../../ui/kit/portrait_frame_open.png") 0 0 / 100% 100% no-repeat; filter: drop-shadow(0 6px 10px rgba(0,0,0,.7)); }
.map-ruler .tb-ruler { text-shadow: 0 2px 4px #000, 0 0 8px #000; }
.map-ruler .tb-sub { text-align: center; line-height: 1.4; }
#tb-portrait { position: absolute; left: 20px; top: 16px; width: 128px; height: 132px; border: 0; box-shadow: none; }
.top-bar .tb-strip { left: 18%; right: 17.6%; }
.top-bar .tb-date { margin-left: 0; margin-right: auto; }

/* 旗幟：亮一點、鮮明一點 */
.city .flag { filter: brightness(1.38) saturate(1.45) contrast(1.05) drop-shadow(0 1px 2px rgba(0,0,0,.7)); }

/* 存檔／讀檔視窗（save.js）：蓋在畫面上的深色面板，六個存檔欄位＋自動存檔 */
.sv { position: absolute; inset: 0; z-index: 95; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.sv .dark-panel { width: min(900px, 82cqw); max-height: 88cqh; overflow: auto; }
.sv h4 { margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; font-family: var(--font-title); font-weight: normal; font-size: 28px; letter-spacing: .3em; color: var(--gold); }
.sv-d { margin: 0 0 12px; color: #d9c598; font-size: 15px; }
.sv-list { display: grid; gap: 8px; }
.sv-row { position: relative; display: grid; grid-template-columns: 110px 54px 1fr 150px; align-items: center; gap: 14px; padding: 8px 14px; min-height: 66px; color: #eedcb2; background: rgba(0,0,0,.32); border: 1px solid rgba(201,154,62,.28); border-radius: 5px; cursor: pointer; }
.sv-row:hover:not(.off) { background: rgba(201,154,62,.2); border-color: var(--gold); }
.sv-row.off { opacity: .45; cursor: default; }
.sv-row.empty { grid-template-columns: 110px 1fr; }
.sv-name { font-family: var(--font-title); font-size: 19px; letter-spacing: .12em; color: #f6e4b8; }
.sv-face { width: 48px; height: 62px; object-fit: cover; object-position: top; border: 2px solid var(--gold-deep); border-radius: 3px; }
.sv-info { font-size: 16px; line-height: 1.5; color: #f6e4b8; }
.sv-info span { font-size: 14px; color: #c9a25a; }
.sv-info.dim { color: #8f7a58; }
.sv-time { text-align: right; font-size: 14px; color: #a89068; padding-right: 36px; }
.sv-x { position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; padding: 0; font-size: 13px; color: #ffb4a0; background: rgba(60,10,6,.7); border: 1px solid rgba(255,140,110,.5); border-radius: 4px; cursor: pointer; }
.sv-x:hover { background: rgba(130,24,12,.9); }
.sv-msg { min-height: 22px; margin: 10px 0 0; text-align: center; color: #9fd08a; font-size: 15px; }
.sv-foot { display: flex; justify-content: flex-end; gap: 12px; }

/* 外掛與設定 */
/* 外掛面板 */
.mods-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.72); display: grid; place-items: center; }

.mods-box { width: min(900px, 94vw); max-height: 90vh; display: flex; flex-direction: column; }

.mods-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }

.mods-bar .on { box-shadow: 0 0 0 2px var(--gold); }

.mods-q { margin-left: auto; padding: 4px 8px; font-size: 14px; background: #1a110a; color: #f6e4b8; border: 1px solid var(--gold-deep); border-radius: 4px; }

.mods-list { overflow-y: auto; display: grid; gap: 6px; padding-right: 6px; }

.mods-row { display: grid; grid-template-columns: 56px 1fr auto auto; gap: 10px; align-items: center; padding: 6px; background: rgba(0,0,0,.3); border: 1px solid rgba(201,154,62,.25); border-radius: 5px; }

.mods-thumb img { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--gold-deep); border-radius: 3px; display: block; }

.mods-txt b { display: block; color: #f6e4b8; font-weight: normal; font-size: 16px; }

.mods-txt small { color: #c9a25a; font-size: 12px; }

.mods-txt em { color: #9fd08a; font-style: normal; }

.mods-up { cursor: pointer; }

.anim-gif { width: 100%; height: auto; display: block; }

/* 外掛面板：按鈕固定大小，字不超出木牌框 */
.mods-row .btn, .mods-bar .btn { width: 96px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; font-size: 17px; line-height: 1; box-sizing: border-box; background-size: 100% 100%; }

.mods-row .btn.ghost { width: 84px; }

.mods-bar .btn { width: auto; min-width: 84px; padding: 0 12px; }

.mods-up { position: relative; }

/* 設定畫面 */
.settings-body { display: grid; gap: 14px; width: min(760px, 92vw); margin: 10px auto; max-height: 70vh; overflow-y: auto; }

.set-box { padding: 12px 18px; }

.set-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; margin: 8px 0; color: #f6e4b8; font-size: 16px; }

.set-row input[type=range] { width: 100%; }

.set-row b { text-align: right; font-weight: normal; color: #d9c598; }

.set-row em { font-style: normal; color: #d9c598; }

.set-chk { grid-template-columns: 110px 1fr; }

.set-track { grid-template-columns: 110px 40px 1fr 40px; }

.set-test { grid-template-columns: 110px 1fr 1fr; }

/* 設定畫面版面修正 */
#settings-body { width: min(760px, 92vw) !important; max-width: 92vw; overflow-x: hidden; }

#settings-body .set-box { width: 100%; box-sizing: border-box; }

.set-row input[type=checkbox] { justify-self: start; width: 18px; height: 18px; }

.set-track { display: flex; align-items: center; gap: 10px; }

.set-track span { width: 110px; flex: none; }

.set-track em { flex: 1; text-align: center; }

.set-track .btn { flex: none; width: 44px; height: 36px; padding: 0; }

.set-test { display: flex; align-items: center; gap: 10px; }

.set-test span { width: 110px; flex: none; }

.set-test .btn { flex: 1; }

.set-track .btn { font-size: 24px; line-height: 1; color: #2a1608; }

.set-music { display: grid; grid-template-columns: 110px 1fr 84px; gap: 10px; align-items: center; }

.set-music select { width: 100%; padding: 4px 6px; font-size: 15px; background: #1a110a; color: #f6e4b8; border: 1px solid var(--gold-deep); border-radius: 4px; }

.set-music .btn { width: 84px; height: 36px; padding: 0; font-size: 16px; color: #2a1608; }

#settings-body .set-music { grid-template-columns: 96px minmax(0, 1fr) 76px; }

#settings-body .set-music .btn { width: 76px; }

/* 遊戲中的設定浮層 */
#screen-settings.settings-over { position: fixed; inset: 0; z-index: 950; background: rgba(0,0,0,.72); }

/* 挑牌子：一次 4 位、揭曉並排、確定後場景 */
.hm-tabs { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 14px 0; }

.hm-tab { position: relative; width: 66px; height: 360px; padding: 0; border: 0; cursor: pointer; background: var(--mod-tablet, url("../../ui/harem/tablet.png")) center / 100% 100% no-repeat, linear-gradient(#2f8a4a 0 18%, #efe3c0 18%); filter: drop-shadow(0 6px 8px rgba(0,0,0,.6)); transition: transform .15s; }

.hm-tab:hover { transform: translateY(-8px); }

.hm-tab span { position: absolute; left: 0; right: 0; top: 22%; bottom: 20%; display: grid; place-items: center; white-space: pre; font-family: var(--font-title); font-size: 26px; line-height: 1.15; color: #3a1a0a; text-shadow: 0 1px 0 rgba(255,255,255,.4); }

.hm-say i { display: block; font-style: normal; color: #e6c27a; font-size: 18px; letter-spacing: .2em; margin-bottom: 6px; }

/* 一次 4 位侍寢：並排揭曉、牌子選中 */
.hm-tab.on { transform: translateY(-14px); filter: drop-shadow(0 0 12px rgba(243,214,143,.9)) drop-shadow(0 6px 8px rgba(0,0,0,.6)); }

.harem .hm-reveal.hm-multi { display: block; width: min(1500px, 96cqw); text-align: center; }

.hm-row { display: flex; gap: 14px; justify-content: center; align-items: flex-start; }

.hm-row figure { margin: 0; flex: 1 1 0; max-width: 24%; }

.harem .hm-multi img { height: min(640px, 66cqh); width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: center; border: 3px solid var(--gold); border-radius: 4px; }

.hm-row figcaption { padding-top: 8px; }

.hm-row figcaption i { display: block; font-style: normal; color: #e6c27a; font-size: 14px; letter-spacing: .15em; }

.hm-row figcaption b { font-family: var(--font-title); font-weight: normal; font-size: 26px; color: #f6e4b8; letter-spacing: .1em; }

.hm-row figcaption p { margin: 4px 0; font-size: 15px; line-height: 1.5; color: #fff1c8; }

.hm-row figcaption small { display: block; color: #9fd08a; font-size: 13px; }

.hm-multi > em { display: block; margin-top: 10px; font-style: normal; color: #a89068; font-size: 14px; }

/* 翻牌後：確定後顯示的場景圖 */
.harem .hm-scene { padding: 0; overflow: hidden; width: min(1100px, 92cqw); }

.harem .hm-scene img { display: block; width: 100%; height: auto; max-height: 78cqh; object-fit: cover; }

.hm-scene em { display: block; text-align: center; padding: 8px; font-style: normal; color: #a89068; font-size: 14px; }
