:root {
  color-scheme:dark;
  --ink:#efe4ce;
  --muted:#c0b093;
  --paper:#211f1a;
  --white:#24211c;
  --line:#5e513c;
  --gold:#c4a477;
  --dark:#231f1a;
  --deep:#171713;
  --red:#b34c3e;
  --green:#a9bc91;
  --heading:"KaiTi","STKaiti","Kaiti SC","Noto Serif SC","Songti SC",serif;
}
[hidden] { display:none !important; }
body { background:var(--deep); }
button:focus-visible, a:focus-visible { outline-color:#f7cc83; }
.topbar {
  height:65px; position:relative; z-index:2; padding-inline:clamp(12px,3vw,48px);
  color:#e8dcc5; background:linear-gradient(90deg,#161713,#232018,#171714);
  border-bottom:1px solid #77583a;
}
.game-nav { display:flex; align-items:center; gap:clamp(5px,2vw,24px); }
.game-nav button,.camp-menu button {
  position:relative; min-height:44px; padding:5px 8px; color:#e8d7b6;
  background:transparent; border:1px solid transparent; white-space:nowrap;
  font:700 21px var(--heading);
}
.game-nav button[aria-pressed="true"],.game-nav button:hover { color:#fff0cd; }
.game-nav button[aria-pressed="true"]::after {
  content:""; position:absolute; bottom:3px; left:18%; right:18%; height:2px; background:#b24b3c;
}
.date-display strong { font:700 21px var(--heading); }
.top-actions { gap:9px; }
.top-quiet,.outline,.clock { min-height:42px; color:#f3e2c4; border-color:#8b7150; background:#372e22; }
.top-quiet:hover,.outline:hover { background:#52412d; border-color:#d2ac73; }
.clock { background:#74322a; border-color:#af6251; }
.clock.running { background:#363f31; border-color:#81916f; }
.camp-stage {
  position:relative; isolation:isolate; min-height:calc(100svh - 65px);
  display:grid; grid-template-columns:minmax(240px,1fr) minmax(340px,.9fr); align-items:center; gap:6vw;
  padding:clamp(35px,7vh,90px) clamp(28px,8vw,138px);
  background:#241f19 url("scenes/zitong-camp.webp") center / cover;
}
.camp-stage::before {
  content:""; position:absolute; inset:0; z-index:-1;
  background:linear-gradient(90deg,#12130e49,#1e1a140e 40%,#191713c9 57%,#161511ed),
    linear-gradient(0deg,#141510de,#15151100 52%);
}
.camp-title { justify-self:start; display:flex; align-items:end; gap:clamp(7px,2vw,22px); user-select:none; text-shadow:0 4px 35px #211812; }
.camp-title h1 {
  writing-mode:vertical-rl; margin:0; font:700 clamp(82px,9vw,156px)/.88 var(--heading); letter-spacing:.06em; color:#f2e4ca;
}
.camp-title p {
  writing-mode:vertical-rl; font:700 23px var(--heading); color:#e2c89f;
  letter-spacing:.16em; border-top:34px solid transparent;
}
.camp-title p::after {
  content:"汉"; display:inline-grid; place-items:center; width:26px; height:27px;
  writing-mode:horizontal-tb; margin-block-start:2px; margin-inline-start:12px;
  border:1px solid #da886b; color:#f2c09b; background:#7a3026;
  font:700 16px var(--heading);
}
.camp-desk { min-width:0; max-width:580px; padding:18px 0; }
.camp-location { color:#d3b27e; font:700 17px var(--heading); letter-spacing:.13em; }
.camp-desk h2 { margin:.21em 0 .26em; color:#faeace; font:700 clamp(42px,5.4vw,85px)/1 var(--heading); letter-spacing:.06em; }
.camp-copy {
  max-width:34em; color:#eee0c6; font:17px/1.85 var(--serif); letter-spacing:.035em;
  margin-bottom:20px; text-wrap:pretty;
}
.camp-primary,.primary {
  min-height:44px; background:linear-gradient(110deg,#783027,#873b30); color:#fff0d6; border:1px solid #b67259;
}
.camp-primary {
  padding:8px 20px; font:700 24px var(--heading); letter-spacing:.12em; border-radius:2px;
}
.camp-primary:hover,.primary:not(:disabled):hover { background:#a24a3a; }
.camp-menu {
  display:flex; flex-wrap:wrap; gap:4px 22px; margin-block:20px 0; border-top:1px solid #8c72545e; padding-top:7px;
}
.camp-menu button { padding-inline:0; font-size:20px; }
.camp-menu button:hover { color:#ffc77e; }
#camp-status { color:#cfb68f; min-height:22px; font-size:14px; }
.camp-foot { display:flex; flex-wrap:wrap; align-items:center; gap:6px 16px; margin-top:8px; }
.camp-lord { display:flex; align-items:center; gap:7px; min-height:44px; border:0; padding:0; background:transparent; color:#d7b987; }
.camp-lord strong { font:700 21px var(--heading); color:#f3ddbc; }
.camp-lord .lord-face { position:relative; inset:auto; width:33px; height:40px; border-radius:2px; }
.camp-lord .lord-face img { top:-1px; }
.camp-progress { margin:0 0 12px; font:700 19px var(--heading); color:#e3c395; }

/* Tactical view keeps the map in focus and opens detailed figures only for the selected city. */
.layout { min-height:calc(100svh - 65px); grid-template-columns:minmax(0,1fr) 325px; }
.command {
  grid-column:1/-1; display:grid; min-height:72px; grid-template-columns:minmax(190px,.8fr) minmax(240px,1.4fr) minmax(170px,.8fr);
  align-items:stretch; border-right:0; border-bottom:1px solid var(--line);
  background:linear-gradient(106deg,#2b241a,#211d18);
}
.command section { padding:9px 17px; border:0; border-right:1px solid #6a553b7a; }
.command .identity { display:grid; grid-template-columns:1fr 1fr; align-content:center; gap:1px 10px; }
.identity-heading { grid-column:1/-1; }
.identity-heading > div { display:flex; align-items:baseline; gap:7px; }
.identity h2 { font:700 22px var(--heading); }
.identity p,.merit-line { margin:0; }
.merit-line { justify-content:flex-start; gap:8px; }
.identity progress,.identity #command-cap,.identity #promotion { display:none; }
.command .mission { display:flex; align-items:center; gap:10px; }
.command .mission > h2 { display:none; }
.mission-card { padding:0 0 0 11px; border-color:#a75542; display:flex; align-items:center; flex-wrap:wrap; gap:3px 11px; }
.mission-card p { margin:0; width:100%; order:2; }
.mission-card b { font:700 21px var(--heading); }
.command .orders { align-content:center; }
.command .orders > h2 { margin:0 0 2px; }
.command #orders strong { margin-bottom:2px; }
.theater { background:#221f19; }
.theater-head h2,.command section > h2,.dispatch h2,.city-title h2,.subheading,.list-heading,dialog > header h2 {
  font-family:var(--heading);
}
.theater-head h2 { font-size:28px; }
.theater-head { padding-block:6px; }
.legend { background:#2f281f; color:#ead5b1; }
.map-field { height:clamp(420px,62vh,780px); }
.map-scroll { border-color:#715c3e; }
.news-item { border-color:#5a4b37; }
.news-type,.text-button,.alert { color:#e6a18b; }
.text-button:hover,.ghost:hover { background:#4d3828; }
.inspection { background:#242019; }
.inspector-tabs button[aria-pressed="true"] { color:#f6c2a0; }
.city-scene { height:92px; opacity:.87; }
.city-title h2 { font-size:34px; }
.city-stats { background:#201c17; }
.work-button { color:#f2e2c2; background:#31281e; }
.work-button:hover:not(:disabled) { background:#48372a; }
.work-button small { color:#d1bd9c; }
dialog {
  color:#f1e4ca; background:linear-gradient(130deg,#30271f,#201d19);
  border:1px solid #9a7852; box-shadow:0 22px 55px #090806cb;
}
dialog::backdrop { background:#0e0e0acc; }
dialog > header { background:#2b231b; padding-block:10px; }
dialog > header h2 { font-size:29px; }
.form-fields input,.form-fields select,.field input,.filter-row select {
  border-color:#846f51; color:#f4e8ce; background:#231e18;
}
.preview { color:#e2cbaa; background:#34291e; }
.preview strong { color:#fff0d2; }
.notice { background:#2b2119; border:1px solid #957453; color:#f1d8ac; }
.profile-bonds li { background:#51402b; }
.profile-art { border-color:#a58b64; }
dialog[data-mode="character"] { width:min(780px,calc(100% - 20px)); }
dialog[data-mode="character"] .person-profile.has-portrait {
  grid-template-columns:minmax(160px,.77fr) minmax(0,1fr); gap:clamp(10px,3vw,30px);
}
dialog[data-mode="character"] .profile-art { aspect-ratio:4 / 5; }
dialog[data-mode="character"] .profile-details { align-self:center; }
dialog[data-mode="character"] .profile-details > p:first-child { color:#f1dfbc; font:17px/1.7 var(--serif); }
dialog[data-mode="character"] .city-stats dd { font-size:18px; }
.council-scene { display:grid; grid-template-columns:92px minmax(0,1fr); align-items:center; gap:13px; }
.council-scene .profile-art { width:100%; }
.council-scene p { color:#eddbc0; font:16px/1.75 var(--serif); }
.council-scene strong { font:700 21px var(--heading); color:#e3bd84; }
.council-options { display:grid; gap:7px; margin-top:12px; }
.council-options button {
  min-height:62px; padding:8px 11px; display:grid; gap:2px; color:var(--ink); text-align:left;
  background:#31271d; border:1px solid #736046; border-left:3px solid #9c4839; border-radius:2px;
}
.council-options button:not(:disabled):hover { background:#52372a; }
.council-options b { font:700 20px var(--heading); }
.council-options small { color:#d6bc96; font-size:13px; }
.journal-list { display:grid; gap:10px; padding:0; list-style:none; }
.journal-list li { border-bottom:1px solid #6a5239; padding:0 0 9px; }
.journal-list time { color:#d2ae77; font-size:12px; }
.journal-list h3 { font:700 22px var(--heading); }
.army-pin.convoy { background:#765328; }

@media (max-width:950px) {
  .camp-stage { padding-inline:5vw; gap:4vw; grid-template-columns:minmax(130px,.65fr) minmax(285px,1fr); }
  .camp-title h1 { font-size:clamp(74px,12vw,104px); }
  .layout { grid-template-columns:minmax(0,1fr) 280px; }
  .command { grid-template-columns:1fr 1.25fr 1fr; }
  .command section { padding:7px 10px; }
}
@media (max-width:690px) {
  .topbar { min-height:60px; height:auto; padding:6px 9px; gap:4px; grid-template-columns:auto minmax(0,1fr) auto; }
  .game-nav { gap:0; }
  .game-nav button { padding:5px; font-size:17px; }
  .date-display span { display:none; }
  .date-display strong { font-size:16px; }
  .top-actions { gap:4px; }
  .top-actions button { min-height:44px; padding:4px 6px; white-space:nowrap; }
  .camp-stage {
    min-height:calc(100svh - 60px); grid-template-columns:1fr; align-content:start; gap:18px;
    padding:26px 19px 30px; background-position:41% center;
  }
  .camp-stage::before {
    background:linear-gradient(0deg,#181611 10%,#181611ea 44%,#201c1475 84%),linear-gradient(90deg,#241b16a6,#1615114d);
  }
  .camp-title { gap:8px; }
  .camp-title h1 { writing-mode:horizontal-tb; font-size:53px; }
  .camp-title p { writing-mode:horizontal-tb; font-size:16px; border:0; }
  .camp-title p::after { display:none; }
  .camp-desk { padding:18px 0 0; }
  .camp-desk h2 { font-size:49px; }
  .camp-copy { font-size:16px; }
  .camp-menu { margin-top:18px; }
  .camp-menu button { font-size:19px; }
  .layout { display:flex; flex-direction:column; }
  .command { grid-template-columns:1fr 1fr; }
  .command .orders { grid-column:1/-1; border-top-color:#604c34; }
  .command .mission .mission-card p { display:none; }
  .theater-head h2 { font-size:23px; }
  .map-field { height:420px; }
  dialog[data-mode="character"] .person-profile.has-portrait { grid-template-columns:minmax(94px,.73fr) minmax(0,1fr); }
}
@media (max-width:380px) {
  .date-display strong { font-size:14px; }
  .game-nav button { padding-inline:3px; font-size:15px; }
  .council-scene { grid-template-columns:73px minmax(0,1fr); gap:9px; }
}

/* Character folio: the complete front elevation, not an enlarged face tile. */
dialog[data-mode="character"] {
  width:min(1000px,calc(100% - 24px)); color:#352a20;
  background:radial-gradient(ellipse at 35% 40%,#f5eddb,#ddcbaa);
  border:1px solid #ad9167;
}
dialog[data-mode="character"] > header { background:transparent; border-bottom:1px solid #ab90634d; }
dialog[data-mode="character"] > header h2 { color:#483322; font-size:38px; letter-spacing:.15em; }
dialog[data-mode="character"] .person-profile.has-portrait { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:32px; }
dialog[data-mode="character"] .profile-art {
  width:min(100%,280px); justify-self:center; aspect-ratio: .46;
  border:0; border-radius:0; background:transparent; isolation:auto;
  mix-blend-mode:multiply;
  mask-image:linear-gradient(90deg,transparent,#000 5%,#000 94%,transparent),linear-gradient(0deg,#000 97%,transparent 100%); mask-composite:intersect;
}
dialog[data-mode="character"] .profile-art img {
  width:400%; left:-103%; top:0; height:auto; mix-blend-mode:multiply;
}
dialog[data-mode="character"] .profile-details > p:first-child { color:#51402d; font:20px/1.9 var(--heading); }
dialog[data-mode="character"] .city-stats { background:transparent; border:0; gap:18px 24px; margin-block:28px; }
dialog[data-mode="character"] .city-stats > div { border:0; padding:0 0 7px; border-bottom:1px solid #ab90635c; background:transparent; }
dialog[data-mode="character"] .city-stats dt { color:#766245; font:16px var(--heading); }
dialog[data-mode="character"] .city-stats dd { color:#513b26; font:32px var(--heading); }
dialog[data-mode="character"] .profile-bonds li { color:#773b2b; background:transparent; border:1px solid #a97455; padding:4px 10px; }
dialog[data-mode="character"] .panel-hint { color:#756044; }
dialog[data-mode="character"] .primary { margin-top:12px; min-width:150px; font:22px var(--heading); }
/* Small portraits show the entire first panel with its face and shoulders. */
.council-scene .profile-art { aspect-ratio:.46; }
.council-scene .profile-art img { width:400%; left:0; top:0; }
@media(max-width:690px) {
  dialog[data-mode="character"] .person-profile.has-portrait { grid-template-columns:minmax(0,1fr) minmax(0,1.1fr); gap:12px; }
  dialog[data-mode="character"] .profile-details > p:first-child { font-size:16px; line-height:1.6; }
  dialog[data-mode="character"] .city-stats { gap:10px; margin-block:16px; }
  dialog[data-mode="character"] .city-stats dd { font-size:25px; }
  dialog[data-mode="character"] .primary { min-width:0; width:100%; font-size:18px; }
}

