:root {
  --ink:#211f19; --muted:#6b5e4d; --paper:#f2ecdf; --white:#fbf7ec;
  --line:#d5c9b2; --gold:#aa7d4e; --dark:#242929; --deep:#1c2020;
  --red:#8d392e; --green:#345645; --serif:"Noto Serif SC","Songti SC","STSong","SimSun",serif;
  --sans:"Noto Sans SC","Microsoft YaHei UI","PingFang SC",system-ui,sans-serif;
}
*, *::before, *::after { box-sizing:border-box; }
body { margin:0; background:#e8dfce; color:var(--ink); font:14px/1.55 var(--sans); }
h1,h2,h3,p,ol,ul,dl { margin:0; }
button,select,input { font:inherit; color:inherit; }
button { cursor:pointer; }
button:disabled { cursor:default; opacity:.52; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline:3px solid #aa6a36; outline-offset:3px; }
a { color:var(--red); text-underline-offset:.22em; }
.skip { position:fixed; z-index:20; top:-80px; left:12px; padding:8px; background:var(--white); }
.skip:focus { top:8px; }
.topbar {
  height:75px; background:var(--deep); color:#f7e9cf; display:grid;
  grid-template-columns:1fr auto 1fr; align-items:center; padding:0 25px; gap:14px;
  border-bottom:3px solid #977347;
}
.brand,.top-actions,.date-display { display:flex; align-items:center; gap:13px; }
.brand h1 { font:700 29px/1 var(--serif); letter-spacing:.12em; }
.brand div > span { color:#d5b888; letter-spacing:.18em; font-size:11px; }
.seal { width:36px; height:39px; border:1px solid #d89473; display:grid; place-content:center; border-radius:3px; background:#87352a; font:700 22px var(--serif); }
.date-display { flex-direction:column; gap:0; }
.date-display span { font-size:11px; letter-spacing:.16em; color:#d7ba89; }
.date-display strong { font:700 20px var(--serif); font-variant-numeric:tabular-nums; white-space:nowrap; }
.top-actions { justify-content:flex-end; }
.time-ratio { color:#cfbea0; font-size:12px; white-space:nowrap; }
.clock,.top-quiet,.outline,.primary,.ghost { min-height:38px; padding:7px 11px; border-radius:4px; }
.clock,.primary { background:var(--red); border:1px solid #743023; color:#fff5e7; font-weight:700; }
.clock { min-width:87px; }
.clock.running { background:#434e44; border-color:#758270; }
.top-quiet { border:1px solid #76684e; background:transparent; }
.outline { background:rgba(255,255,255,.28); border:1px solid #bdaf96; white-space:nowrap; }
.outline:hover,.top-quiet:hover { border-color:var(--gold); }
.primary:not(:disabled):hover,.clock:not(.running):hover { background:#a94b3c; }
.ghost { border:1px solid transparent; background:transparent; }
.ghost:hover,.text-button:hover { background:#e4dac6; }
.text-button { color:var(--red); background:transparent; border:0; padding:6px 7px; border-radius:3px; font-size:12px; white-space:nowrap; }
.layout { display:grid; min-height:calc(100vh - 75px); grid-template-columns:238px minmax(0,1fr) 317px; max-width:1800px; margin-inline:auto; }
.command { min-width:0; background:var(--paper); border-right:1px solid var(--line); }
.lord-face { overflow:hidden;
  isolation:isolate; background:radial-gradient(ellipse at 52% 32%,#d8bd89,#867758 75%);
  border:1px solid #a88f61;
}
.lord-face img { position:absolute; top:-5px; left:-1%; width:442%; height:auto; mix-blend-mode:multiply; }
.command section { padding:17px 18px; border-bottom:1px solid var(--line); }
.identity-heading { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.identity-heading > div { min-width:0; }
.identity h2 { font:700 25px/1.2 var(--serif); overflow-wrap:anywhere; }
.identity p,.merit-line,.order-meta { font-size:12px; color:var(--muted); }
.identity p { margin:6px 0 0; }
.rank { color:var(--green); font-weight:700; font-size:12px; }
.merit-line { display:flex; justify-content:space-between; gap:6px; margin-top:14px; }
progress { appearance:none; width:100%; height:5px; background:#d4c8b0; border:0; border-radius:8px; overflow:hidden; color:var(--red); }
progress::-webkit-progress-bar { background:#d4c8b0; }
progress::-webkit-progress-value { background:var(--red); }
progress::-moz-progress-bar { background:var(--red); }
.command section > h2,.dispatch h2 { font:700 16px var(--serif); letter-spacing:.09em; margin-bottom:9px; }
.mission-card { border-left:3px solid var(--gold); padding:4px 0 4px 9px; }
.mission-card b { font-size:15px; }
.mission-card p { margin:5px 0 8px; color:var(--muted); font-size:12px; }
.mission-buttons { display:flex; flex-wrap:wrap; gap:4px; align-items:center; }
.mission-buttons .outline { min-height:32px; padding:4px 7px; font-size:12px; }
.command #orders p { font-size:12px; color:var(--muted); }
.command #orders strong { display:block; margin-bottom:5px; }
.command #orders .outline { margin-top:8px; }
.theater { min-width:0; background:#e8dfce; }
.theater-head,.legend,.dispatch { padding-inline:19px; }
.theater-head { display:flex; justify-content:space-between; align-items:center; gap:7px; padding-block:12px; }
.theater-head h2 { font:700 24px var(--serif); letter-spacing:.12em; }
.theater-head p { font-size:12px; color:var(--muted); }
.map-tools { display:flex; gap:6px; }
.map-scroll { overflow:auto; scrollbar-color:#aa9475 #e2d6bf; border-block:1px solid #c3ad88; background:#bbac8e; }
.map-field {
  position:relative; width:100%; min-width:670px; height:clamp(440px,55vh,660px); isolation:isolate;
  background:#c4bd94 url("../emperor-ui/maps/tang-terrain.webp") no-repeat 51% 50% / 164% 116%;
}
.map-field::before {
  content:""; position:absolute; inset:0; pointer-events:none; z-index:-1;
  background:radial-gradient(ellipse at center,#fbf0ca19 50%,#524e2f36 100%),linear-gradient(#f8ecc429,#c7ab6224);
}
.map-lines { position:absolute; inset:0; height:100%; width:100%; pointer-events:none; }
.map-lines .road { stroke:#66533a; stroke-opacity:.6; stroke-width:1.1; stroke-dasharray:2 3; vector-effect:non-scaling-stroke; }
.map-lines .active-road { stroke:#fff0b9; stroke-width:3; stroke-dasharray:6 4; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 2px #3d2f16); }
.map-region { position:absolute; left:var(--x); top:var(--y); font:700 clamp(16px,1.6vw,22px) var(--serif);
  text-shadow:0 0 5px #f5e9b8,0 0 8px #fff5da; color:#524432aa; letter-spacing:.14em; pointer-events:none; }
.map-city { position:absolute; left:var(--x); top:var(--y); width:max-content; min-width:44px; height:44px;
  padding:1px 4px; display:grid; justify-items:center; align-content:start; border:0; background:none;
  transform:translate(-50%,-9px); z-index:2;
}
.map-city:hover,.map-city:focus-visible,.map-city[aria-pressed="true"] { z-index:4; }
.map-city .point { width:14px; height:14px; border-radius:50%; display:block;
  background:var(--side); border:2px solid #f7e6be; box-shadow:0 0 0 1px #473b2c,0 2px 4px #43372598; }
.map-city.capital .point { border-radius:3px; transform:rotate(45deg); }
.map-city[aria-pressed="true"] .point,.map-city:hover .point { outline:3px solid #fcdb83; outline-offset:2px; }
.map-city .city-label { margin-top:4px; border:1px solid #e4d6ad99; padding:0 6px; border-radius:3px;
  white-space:nowrap; background:var(--side); color:#fff7e8; box-shadow:0 2px 4px #392f2a60;
  font:700 13px/1.42 var(--serif);
}
.map-city[aria-pressed="true"] .city-label { background:#272925; border-color:#fce198; }
.map-city.home .city-label::after { content:" · 驻"; color:#fae3a0; }
.army-pin { position:absolute; left:var(--x); top:var(--y); z-index:5; pointer-events:none;
  background:var(--side); border:1px solid #fff0c1; color:#fff4d6; text-shadow:0 1px 2px #333;
  padding:1px 4px; font-size:11px; box-shadow:0 2px 4px #33261c8c; transform:translate(-50%,-100%); white-space:nowrap;
}
.legend { display:flex; flex-wrap:wrap; gap:5px 16px; padding-block:9px; border-bottom:1px solid var(--line); background:#efe8d7; font-size:12px; }
.side-dot { display:inline-block; width:9px; height:9px; margin-right:5px; border-radius:50%; background:var(--side); }
.dispatch { padding-block:10px 20px; }
.news-head { display:flex; justify-content:space-between; align-items:center; }
.news-head h2 { margin:0; }
.dispatch ol,.full-news { display:grid; list-style:none; padding:0; gap:0; }
.news-item { display:grid; align-items:baseline; grid-template-columns:58px 19px minmax(0,1fr); gap:5px;
  border-bottom:1px solid #d5c8b3; padding:6px 0; font-size:12px; }
.news-item time { color:var(--muted); }
.news-type { color:var(--red); font-weight:700; }
.inspection { min-width:0; background:var(--white); border-left:1px solid var(--line); }
.inspector-tabs { display:grid; grid-template-columns:repeat(3,1fr); padding:0 12px; border-bottom:1px solid var(--line); }
.inspector-tabs button { border:0; border-bottom:3px solid transparent; background:transparent; min-height:48px; font-weight:700; }
.inspector-tabs button[aria-pressed="true"] { color:var(--red); border-bottom-color:var(--red); }
#panel { padding:16px; }
.city-scene { height:105px; border:1px solid #bda580; border-radius:4px; background-color:#b49877;
  background-repeat:no-repeat; background-size:200% auto; }
.city-scene.office { background-image:url("../emperor-ui/scenes/han-cities.webp"); background-position:100% 10%; }
.city-scene.market { background-image:url("../emperor-ui/scenes/han-daily.webp"); background-position:100% 86%; }
.city-title { display:flex; justify-content:space-between; align-items:end; gap:4px; padding:12px 0 6px; }
.city-title h2 { font:700 29px/1.05 var(--serif); }
.city-title span { color:var(--muted); font-size:12px; }
.city-owner { font-size:12px; white-space:nowrap; }
.city-stats { display:grid; grid-template-columns:1fr 1fr; gap:0; margin-block:8px 10px; border:1px solid var(--line); border-radius:4px; }
.city-stats div { padding:7px 8px; border-bottom:1px solid var(--line); }
.city-stats div:nth-child(odd) { border-right:1px solid var(--line); }
.city-stats div:nth-last-child(-n+2) { border-bottom:0; }
.city-stats dt { color:var(--muted); font-size:11px; }
.city-stats dd { margin:0; font-variant-numeric:tabular-nums; font-weight:700; }
.city-detail,.panel-hint { color:var(--muted); font-size:12px; }
.panel-hint { margin-block:8px; }
.panel-actions,.dialog-actions { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:12px; }
.local-works { display:grid; gap:5px; margin-top:12px; }
.subheading { margin:10px 0 6px; font:700 16px var(--serif); }
.work-button { display:flex; justify-content:space-between; align-items:center; gap:5px; min-height:38px; text-align:left;
  padding:5px 8px; border:1px solid var(--line); background:#f6eedc; border-radius:3px; font-size:13px; }
.work-button:hover:not(:disabled) { background:#ece0c6; }
.work-button small { font-size:11px; color:var(--muted); }
.person-list,.report-list,.city-list { padding:0; list-style:none; display:grid; gap:5px; }
.person-list button,.report-list button,.city-list button { width:100%; text-align:left; }
.list-heading { margin-bottom:8px; font:700 20px var(--serif); }
.notice { position:fixed; bottom:14px; left:50%; transform:translateX(-50%); z-index:10; max-width:calc(100% - 20px);
  width:max-content; background:#222925; color:#fff2d8; box-shadow:0 4px 10px #3b312a40; padding:9px 14px; border-radius:5px;
  font-size:13px; pointer-events:none; }
.notice:empty { display:none; }
dialog { width:min(calc(100% - 20px),520px); max-height:calc(100% - 25px); overflow:auto; color:var(--ink); background:var(--white);
  border:1px solid #ae946f; border-radius:6px; padding:0; box-shadow:0 13px 45px #24231bc0; }
dialog::backdrop { background:#272721a8; }
dialog > header { position:sticky; top:0; z-index:1; display:flex; justify-content:space-between; gap:10px; align-items:center;
  padding:12px 17px; border-bottom:1px solid var(--line); background:#eee4d0; }
dialog > header h2 { font:700 23px var(--serif); }
.dialog-close { min-width:40px; font-size:20px; line-height:1; }
#dialog-content { padding:16px 17px 18px; }
.form-fields { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:13px; }
.field { display:grid; gap:3px; color:var(--muted); font-size:12px; }
.field select,.field input { width:100%; min-width:0; min-height:39px; background:#fffaf0;
  border:1px solid #bead92; border-radius:4px; padding:4px 8px; color:var(--ink); font-size:14px; }
.reserve { display:flex; align-items:center; gap:6px; margin-top:12px; }
.reserve input { accent-color:var(--red); }
.preview { margin-top:12px; padding:9px; border-left:3px solid var(--gold); background:#f1e8d5; color:var(--muted); font-size:13px; }
.preview strong { color:var(--ink); }
.alert { color:var(--red); }
.full-news { max-height:56vh; overflow:auto; }
.city-list { grid-template-columns:1fr 1fr; }
.person-profile { display:grid; gap:14px; align-items:start; }
.person-profile.has-portrait { grid-template-columns:clamp(104px,28vw,158px) minmax(0,1fr); }
.profile-art {
  position:relative; overflow:hidden; isolation:isolate; display:block;
  aspect-ratio:2 / 3; border:1px solid #bcaa86; border-radius:4px;
  background:radial-gradient(ellipse at 54% 36%,#f1e3c6,#c5af87 87%);
}
.profile-art img {
  position:absolute; left:-2%; top:-3%; width:450%; max-width:none; height:auto;
  display:block; mix-blend-mode:multiply;
}
.profile-details { min-width:0; }
.profile-bonds { display:flex; flex-wrap:wrap; gap:5px; padding:0; list-style:none; }
.profile-bonds li { background:#ece2cb; border-radius:3px; padding:2px 6px; font-size:12px; }
.filter-row { display:flex; flex-wrap:wrap; gap:5px; margin:10px 0; }
.filter-row select,.filter-row input { max-width:100%; min-height:36px; background:#f8f0df; border:1px solid var(--line); border-radius:4px; padding-inline:6px; }
@media (max-width:1130px) {
  .layout { grid-template-columns:196px minmax(0,1fr) 284px; }
  .theater-head,.legend,.dispatch { padding-inline:10px; }
  #panel { padding:13px; }
}
@media (max-width:950px) {
  .layout { grid-template-columns:minmax(0,1fr) 302px; }
  .command { grid-column:1/-1; display:grid; grid-template-columns:155px 1fr 1.2fr 1fr; border-bottom:1px solid var(--line); border-right:0; }
  .command section { padding:11px; border:0; border-right:1px solid var(--line); }
}
@media (max-width:690px) {
  .topbar { min-height:62px; height:auto; padding:7px 8px; gap:5px; }
  .brand { gap:4px; }
  .brand h1 { font-size:21px; letter-spacing:0; white-space:nowrap; }
  .seal { width:25px; height:29px; font-size:17px; }
  .brand div > span,.date-display span { font-size:10px; letter-spacing:.01em; }
  .date-display strong { font-size:15px; }
  .top-actions { gap:4px; }
  .top-actions button { min-width:auto; padding:4px 6px; font-size:12px; }
  .time-ratio { display:none; }
  .layout { display:flex; flex-direction:column; }
  .command { display:grid; grid-template-columns:106px 1fr 1.3fr; }
  .command section { padding:7px 8px; }
  .command section > h2 { font-size:14px; margin-bottom:3px; }
  .command .orders { display:flex; flex-wrap:wrap; align-items:center; gap:7px; grid-column:1/-1; border-top:1px solid var(--line); }
  .command .orders > h2,.command #orders strong,.command #orders .outline { margin:0; }
  #orders { flex:1; }
  .identity h2 { font-size:19px; }
  .merit-line { margin-top:5px; }
  .theater-head { padding-block:8px; }
  .theater-head h2 { font-size:19px; }
  .map-field { min-width:630px; height:390px; }
  .inspection { border-top:1px solid var(--line); border-left:0; }
  .dispatch .news-item:nth-child(n+2) { display:none; }
  .map-tools button { font-size:12px; }
  .city-scene { height:125px; }
}
