:root {
  color-scheme: light;
  --page: #f4f2ec;
  --panel: #fffdf8;
  --subtle: #eaf0e8;
  --text: #283731;
  --muted: #515d55;
  --faint: #656c60;
  --line: #d9ded2;
  --gold: #325e50;
  --green: #426f57;
  --ink-rose: #85504a;
  font-family: "PingFang SC","Microsoft YaHei",system-ui,sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 8% 0%, #e7eee5, transparent 54%), var(--page); color: var(--text); font-size: 15px; }
button,input,select,textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .47; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 max(25px,calc((100vw - 1580px) / 2));
  gap: 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 23px; letter-spacing: .06em; white-space: nowrap; }
.brand small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 14px; letter-spacing: .02em; }
.brand-mark { width: 34px; height: 34px; background: var(--gold); border: 1px solid var(--gold); border-radius: 9px; display: grid; place-items: center; color: #fff8e9; }
.brand-mark i { width: 13px; height: 16px; background: currentColor; clip-path: polygon(0 0,100% 0,100% 100%,50% 73%,0 100%); }
nav { display: flex; align-self: stretch; gap: 28px; }
nav a { display: grid; place-items: center; position: relative; color: var(--muted); white-space: nowrap; font-weight: 600; }
nav a[aria-current] { color: var(--gold); }
nav a[aria-current]::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--gold); }
.connection { align-items: center; display: flex; gap: 8px; color: var(--muted); white-space: nowrap; font-size: 13px; }
.connection i, .field-status i { width: 7px; height: 7px; border-radius: 50%; background: #ac7849; }
.connection.online i { background: #5c804e; }
.connection.offline i { background: #ac584b; }
main { max-width: 1920px; margin: 0 auto; padding: 18px 16px 36px; }
.overview { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.caption { margin: 0; color: var(--gold); font-size: 13px; font-weight: 650; letter-spacing: .12em; }
h1 { margin: 4px 0 6px; font-family: "Songti SC","Noto Serif CJK SC","SimSun",serif; font-size: clamp(34px,4.5vw,56px); font-weight: 800; line-height: 1.10; letter-spacing: .035em; }
.terrain-description { margin: 0; color: var(--muted); line-height: 1.5; }
.rest-note { display: inline-block; margin: 8px 0 0; padding: 5px 9px; border: 1px solid #dbccb4; border-radius: 6px; background: #fff4df; color: #684b2c; font-size: 13px; font-weight: 680; }
.round-actions { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; }
.round-actions .round-action { display: inline-flex; align-items: center; width: auto; margin-top: 8px; font-size: 13px; white-space: nowrap; }
.round-action-time { margin-top: 8px; color: var(--muted); font-size: 13px; }
.round-clock { padding: 8px 16px 9px; text-align: right; flex: 0 0 auto; border: 1px solid var(--line); background: var(--panel); border-radius: 11px; }
.round-clock strong { display: block; color: var(--text); font-family: ui-monospace,monospace; font-variant-numeric: tabular-nums; font-size: clamp(23px,3.2vw,38px); line-height: 1.18; margin: 3px 0; }
.clock-note { color: var(--muted); font-size: 13px; }
.round-clock[data-paused="true"], .demo-strip[data-paused="true"] { border-color: #dbc29d; background: #fff4df; }
.round-clock[data-paused="true"] .caption, #demo-paused { color: #704b26; }
.demo-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; }
.demo-controls, .demo-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.demo-controls { margin-left: auto; }
.demo-confirm { flex: 1 1 100%; padding-top: 8px; border-top: 1px solid #dbc29d; }
.demo-confirm p { flex: 1 1 230px; margin: 0; line-height: 1.6; }
#demo-quota { margin-right: auto; }
#demo-quota[data-full="true"] { color: #804335; font-weight: 700; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) clamp(250px, 22vw, 305px); gap: 14px; align-items: start; }
.battlefield, .sidebar { min-width: 0; }
.field-bar, .panel-head { min-height: 51px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-bar { background: var(--panel); border: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.field-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.field-meta { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; }
.field-final-city { padding: 3px 7px; border: 1px solid #c69a80; border-radius: 5px; background: #fff1df; color: #783f2f; font-size: 12px; font-weight: 700; white-space: nowrap; }
.field-effects { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; color: var(--muted); font-size: 13px; white-space: nowrap; cursor: pointer; }
.field-effects input { width: 16px; height: 16px; margin: 0; accent-color: var(--gold); cursor: pointer; }
.field-status.live i { background: var(--green); box-shadow: 0 0 9px #54784d28; }
.field-status.paused { color: #704b26; }
.map-wrap { position: relative; overflow: hidden; background: #d4d8bd; aspect-ratio: 8 / 5; max-height: 74svh; border-inline: 1px solid var(--line); }
.map-expand { border: 1px solid #b5c4b3; border-radius: 6px; min-height: 36px; padding: 0 9px; background: #f1f6ee; color: var(--text); white-space: nowrap; }
.map-expand:hover { background: #e0ebdf; }
#map-dialog { inset: 0; margin: 0; border: 0; padding: 0; width: 100%; height: 100dvh; max-height: none; max-width: none; background: #e5dbc3; color: var(--text); }
#map-dialog .map-desk { height: 100%; display: flex; flex-direction: column; }
#map-dialog .field-bar { border-radius: 0; padding-top: env(safe-area-inset-top); }
#map-dialog .map-wrap { flex: 1 1 0; width: 100%; min-height: 0; max-height: none; height: auto; aspect-ratio: auto; }
#map-dialog .terrain-strip { padding-bottom: max(7px, env(safe-area-inset-bottom)); }
body:has(#map-dialog[open]) { overflow: hidden; }
#field { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#field.dragging { cursor: grabbing; }
.compass { position: absolute; top: 15px; right: 16px; background: #fdf6e4f0; color: var(--gold); width: 38px; height: 52px; border: 1px solid #e5d6ad; border-radius: 5px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; font: 650 12px ui-monospace,monospace; pointer-events: none; }
.compass i { width: 16px; height: 18px; background: var(--gold); clip-path: polygon(50% 0,100% 100%,50% 74%,0 100%); }
.map-controls { position: absolute; bottom: 14px; right: 14px; display: flex; border: 1px solid #dfcfb4; overflow: hidden; border-radius: 6px; }
.map-controls button { min-width: 41px; min-height: 38px; border: 0; color: var(--text); background: #fff8e8; }
.map-controls button + button { border-left: 1px solid #e8dac0; }
.map-controls button:hover { background: #eee0ca; }
.map-legend { display: flex; position: absolute; bottom: 15px; left: 14px; gap: 12px; padding: 8px 10px; border: 1px solid #dfcfb4; border-radius: 5px; background: #fdf6e4f0; color: #4a4033; font-size: 12px; pointer-events: none; }
.map-legend span { display: flex; align-items: center; gap: 6px; }
.map-legend i { border-radius: 50%; width: 11px; height: 11px; border: 1px solid #9a6b4e; }
.map-legend span + span i { border: 1px dashed #9a6b4e; }
.stages { display: grid; grid-template-columns: repeat(6,1fr); border: 1px solid var(--line); border-radius: 0 0 12px 12px; background: var(--panel); overflow: hidden; }
.stage { min-width: 0; display: grid; gap: 5px; padding: 11px 8px 12px; color: var(--muted); text-align: center; font-size: 13px; }
.stage + .stage { border-left: 1px solid var(--line); }
.stage b { font-size: 14px; white-space: nowrap; }
.stage span { font: 12px ui-monospace,monospace; }
.stage small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.stage.current { color: var(--gold); background: var(--subtle); box-shadow: inset 0 2px var(--gold); }
.stage.past { color: var(--faint); }
.stage:last-child:not(.current) b { color: #a35240; }
.sidebar { display: grid; gap: 16px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; box-shadow: 0 4px 18px #8a634410; }
.panel-head { border-bottom: 1px solid var(--line); background: #f3f5ed; }
.panel-head h2 { margin: 0; font-size: 16px; letter-spacing: .03em; }
.panel-head > span { color: var(--muted); font-size: 13px; }
.panel-inner { padding: 15px; }
.panel-inner > :first-child { margin-top: 0; }
.panel-inner > :last-child { margin-bottom: 0; }
.hint { font-size: 14px; line-height: 1.65; color: var(--muted); margin: 9px 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: grid; gap: 10px; }
.name-label, .scheme-label { color: var(--text); display: block; font-size: 14px; margin-bottom: 6px; }
.text-input, textarea, select {
  width: 100%;
  border: 1px solid #d9cab6;
  border-radius: 5px;
  min-height: 41px;
  background: #fffdf7;
  color: var(--text);
  padding: 9px 10px;
}
textarea { line-height: 1.55; min-height: 82px; resize: vertical; }
select { padding-right: 12px; }
.primary, .secondary {
  border: 1px solid transparent;
  min-height: 42px;
  border-radius: 5px;
  font-weight: 720;
  padding: 8px 13px;
  width: 100%;
}
.primary { background: var(--gold); color: #fff7e8; }
.primary:hover:not(:disabled) { background: #254a3e; }
.secondary { border-color: var(--line); color: var(--text); background: var(--subtle); }
.secondary:hover:not(:disabled) { background: #dfeade; }
.roster-title { margin-bottom: 7px; }
.roster-title b { color: var(--gold); font: 750 18px ui-monospace,monospace; }
.roster-title span { color: var(--muted); font-size: 13px; }
.budget { height: 4px; border-radius: 3px; background: #eadfcc; margin-bottom: 7px; overflow: hidden; }
.budget i { background: var(--gold); height: 100%; display: block; transition: width .17s; }
.troop-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 9px; align-items: center; min-height: 45px; padding: 4px 0; border-bottom: 1px solid #eee4d4; }
.troop-name { font-weight: 640; font-size: 14px; }
.troop-name span { color: var(--muted); margin-left: 7px; font-size: 12px; font-weight: 500; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { color: var(--text); min-width: 28px; height: 29px; border: 1px solid #d4c4ad; border-radius: 4px; background: #f8ecdb; padding: 0; }
.stepper button:hover:not(:disabled) { background: #efe0c8; }
.stepper input { width: 36px; text-align: center; font: 700 14px ui-monospace,monospace; background: #fffdf7; color: var(--text); border: 1px solid #dfcfbc; border-radius: 3px; min-height: 29px; padding: 0 2px; }
.quick { display: flex; justify-content: space-between; gap: 8px; margin: 8px 0 12px; }
.subbutton { padding: 4px 0; border: 0; background: transparent; color: var(--gold); font-size: 13px; }
.subbutton:hover { text-decoration: underline; }
.saved { color: var(--green); font-size: 13px; margin: 8px 0; }
.opening { margin-top: 9px; font-size: 13px; }
.opening summary { color: var(--gold); cursor: pointer; padding-block: 3px; }
.opening label { margin-top: 7px; }
.opening textarea { min-height: 58px; }
.status-box { border: 1px solid #b7c7a1; border-radius: 5px; background: #edf2e6; padding: 9px 10px; margin: 8px 0 10px; color: #406043; font-size: 14px; line-height: 1.55; }
.status-box.locked { border-color: #d9c39b; background: #f9edda; color: #6d4935; }
.advice { background: #f1f5ed; border: 1px solid var(--line); border-radius: 7px; margin: 8px 0 11px; padding: 8px; }
.advice summary { cursor: pointer; color: var(--gold); font-weight: 700; font-size: 14px; }
.advice-cards { display: grid; gap: 5px; margin-top: 7px; }
.advice-card { text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 7px; align-items: baseline; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; color: var(--text); font-size: 13px; }
.advice-card:hover, .advice-card:focus-visible { border-color: var(--gold); background: #eaf1e9; }
.advice-scheme { color: var(--ink-rose); font-size: 12px; }
.advice-reason { grid-column: 1 / -1; color: var(--muted); line-height: 1.4; font-size: 12px; }
.scheme-heading { display: flex; justify-content: space-between; align-items: baseline; }
.scheme-heading a { font-size: 12px; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.opening summary span { margin-left: 6px; color: var(--muted); font-size: 12px; }
.preview { border: 1px solid #d1ad8f; border-radius: 5px; background: #f8ead7; padding: 10px; margin-top: 9px; }
.preview p { margin: 3px 0 8px; line-height: 1.5; color: #604132; font-size: 14px; }
.flag { width: 9px; height: 13px; flex-shrink: 0; background: var(--team); clip-path: polygon(0 0,100% 0,100% 100%,50% 75%,0 100%); }
.ranks, .report-list { padding: 0; list-style: none; margin: 0; }
.rank-views { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 9px 9px 0; }
.rank-views button { min-width: 0; min-height: 54px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 6px; background: #f3f5ed; color: var(--muted); font-size: 12px; }
.rank-views button[aria-pressed="true"] { background: #e8f0e4; border-color: #9daf9d; color: #355641; }
.rank-views small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; font-weight: 700; font-size: 12px; color: var(--text); }
.rank-note { margin: 6px 10px 3px; }
.rank-row { min-height: 41px; padding: 8px 13px; display: grid; grid-template-columns: 18px 11px minmax(0,1fr) auto; align-items: center; gap: 8px; border-bottom: 1px solid #e9dfd0; }
.rank-row:last-child { border-bottom: 0; }
.rank-row.mine { background: #f8ecdc; }
.rank-place { font: 13px ui-monospace,monospace; color: var(--faint); }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rank-name small { color: var(--gold); font-size: 11px; margin-left: 6px; }
.rank-score { color: var(--muted); font-size: 13px; }
.rank-score b { color: var(--text); font: 750 16px ui-monospace,monospace; margin-right: 3px; }
.empty { color: var(--muted); font-size: 14px; padding: 13px 15px; line-height: 1.55; }
.reports { margin-top: 16px; }
.report-list { max-height: 192px; overflow-y: auto; }
.report-list li:not(.empty) { display: flex; align-items: baseline; gap: 9px; border-bottom: 1px solid #e9dfd0; min-height: 39px; padding: 8px 14px; line-height: 1.45; }
.report-list li:last-child { border-bottom: 0; }
.report-list time { flex: 0 0 48px; color: var(--faint); font: 12px ui-monospace,monospace; }
.report-list b { color: var(--muted); font-size: 13px; white-space: nowrap; }
.report-list span { font-size: 14px; }
.report-list .zone b, .report-list .finish b { color: var(--gold); }
.report-list .spell b { color: #704b95; }
.report-list .loss b { color: #a8584b; }
.king-banner { position: absolute; left: 50%; top: 43%; width: min(340px,82%); transform: translate(-50%,-50%); padding: 19px 12px; background: #fff5daf5; border: 1px solid #c29a67; box-shadow: 0 12px 40px #4b3a2750; text-align: center; border-radius: 7px; pointer-events: none; }
.king-banner span { display: block; color: var(--gold); font: 750 13px ui-monospace,monospace; letter-spacing: .19em; }
.king-banner strong { display: block; margin: 7px 0; font-size: 30px; color: #8e503a; }
.king-banner small { font-size: 14px; color: var(--muted); }
.history { margin-top: 18px; color: var(--muted); line-height: 1.65; }
.history b { color: var(--gold); margin-right: 8px; }
.toast { position: fixed; bottom: 21px; left: 50%; transform: translateX(-50%); border: 1px solid #caa88b; border-radius: 6px; width: max-content; max-width: calc(100vw - 36px); background: #fff8e9; color: #66493a; padding: 12px 18px; box-shadow: 0 12px 35px #0008; z-index: 3; }
.toast.error { border-color: #c48c82; background: #fff0e9; }
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0,1fr) 245px; gap: 12px; }
  .stage b { font-size: 12px; }
  .brand small { display: none; }
}
@media (max-width: 740px) {
  .masthead { min-height: 65px; gap: 13px; padding: 0 15px; }
  .brand { font-size: 17px; gap: 7px; }
  .brand-mark { width: 28px; height: 28px; }
  nav { gap: 15px; font-size: 13px; }
  .connection { font-size: 11px; }
  main { padding: 20px 12px; }
  .layout { display: flex; flex-direction: column; }
  .battlefield, .sidebar { width: 100%; }
  .sidebar { grid-template-columns: minmax(0,1fr); }
  .overview { gap: 9px; margin-bottom: 15px; }
  .terrain-description { font-size: 13px; }
  .caption { font-size: 11px; }
  .stage { padding: 9px 2px; }
  .stage b, .stage span { font-size: 11px; }
}
@media (max-width: 400px) {
  nav { gap: 12px; }
  .map-legend { gap: 7px; padding: 7px 6px; }
}
.field-views {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  border-radius: 8px;
  background: var(--subtle);
  padding: 3px;
}
.field-views button {
  border: 1px solid transparent;
  min-height: 36px;
  border-radius: 6px;
  color: var(--muted);
  padding: 4px 10px;
  background: transparent;
  font-size: 13px;
  font-weight: 690;
  white-space: nowrap;
}
.field-views button[aria-pressed="true"] { background: var(--panel); border-color: #aebfb2; color: var(--gold); }
.field-views button:hover:not(:disabled) { color: var(--gold); background: var(--panel); }
#view-own { border-left: 1px solid #e4d3bf; border-radius: 0 6px 6px 0; }
.camera-cue {
  position: absolute;
  top: 14px;
  left: 14px;
  color: #4c3e32;
  background: #fff8e9ed;
  border: 1px solid #eadbb6;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 650;
  pointer-events: none;
}
.map-wrap[data-view="close"] .compass,
.map-wrap[data-view="close"] .map-legend { display: none; }
.watch-detail {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 6px 13px;
  border-inline: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: #fffbf1;
}
.fighter { min-width: 0; display: flex; align-items: center; gap: 9px; }
.fighter:last-child { justify-content: end; }
.fighter.waiting { color: var(--muted); font-size: 13px; padding: 0 10px; }
.fighter-data { min-width: 0; display: grid; gap: 1px; }
.fighter-data b { font-size: 15px; white-space: nowrap; }
.fighter-team { display: flex; align-items: center; gap: 5px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.fighter-team .flag { width: 7px; height: 9px; }
.fighter-action { border: 1px solid #e5d4bc; padding: 6px 9px; background: #f8eddb; border-radius: 6px; font-size: 12px; white-space: nowrap; color: #794d3b; }
.fighter-hp { display: flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; color: var(--muted); }
.health-track { height: 5px; width: 48px; display: block; border-radius: 3px; overflow: hidden; background: #e6ddc9; }
.health-track i { display: block; height: 100%; background: #608054; border-radius: inherit; }
.soldier-portrait {
  display: block;
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 1;
  background: url('/soldiers.webp') 0 0 / 300% 200% no-repeat;
}
.soldier-portrait.pike { background-position: 50% 0; }
.soldier-portrait.bow { background-position: 100% 0; }
.soldier-portrait.musket { background-position: 0 100%; }
.soldier-portrait.cavalry { background-position: 50% 100%; }
.fighter .soldier-portrait { width: min(62px, 8vw); }
.troop-guide {
  border-top: 1px solid #eadfce;
  padding-top: 10px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 4px;
}
.troop-guide div {
  display: grid;
  place-items: center;
  gap: 2px;
  text-align: center;
  color: #665544;
  font-size: 12px;
  font-weight: 650;
}
.troop-guide .soldier-portrait { background-color: #f7eddc; border: 1px solid #efe0cd; border-radius: 8px; }
.troop-guide div:nth-child(2n) .soldier-portrait { background-color: #f2efe0; }
body[data-stage="battle"] main { padding-top: 16px; }
body[data-stage="battle"] .overview { margin-bottom: 15px; }
body[data-stage="battle"] .overview h1 { font-size: clamp(28px, 3.2vw, 43px); }
body[data-stage="battle"] h1 { font-size: clamp(29px,3.4vw,45px); }
body[data-stage="battle"] .round-clock strong { font-size: clamp(21px,2.5vw,32px); }
@media (max-width: 740px) {
  .round-clock { padding: 6px 8px; }
  .field-bar, .panel-head { padding-inline: 10px; gap: 5px; }
  .field-views button { font-size: 12px; padding-inline: 6px; }
  .field-status { font-size: 11px; gap: 4px; }
  .watch-detail { gap: 6px; padding-inline: 6px; }
  .fighter { gap: 5px; }
  .fighter .soldier-portrait { width: 34px; }
  .fighter-data b { font-size: 13px; }
  .fighter-action { padding-inline: 5px; font-size: 11px; }
  .fighter-hp { font-size: 10px; }
  .health-track { display: none; }
}
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-action { display: inline-flex; align-items: center; min-height: 36px; position: relative; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--gold); background: var(--panel); font-size: 13px; white-space: nowrap; }
.header-action:hover { background: var(--subtle); }
.demo-pause { border-color: var(--gold); background: var(--gold); color: var(--panel); }
.demo-pause:hover { background: #254a3e; }
.demo-restart { border-color: #cb9f8e; color: #804335; background: #fff4ed; }
.demo-restart:hover { background: #f8e4d9; }
.catalog-entry { color: #fffdf8; border-color: var(--gold); background: var(--gold); }
.catalog-entry:hover { background: #254a3e; }
.command-jump { display: none; }
#mail-dot { position: absolute; right: 4px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: #ae4a3f; }
.campaign-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.campaign-facts span { padding: 3px 7px; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 5px; }
.troop-guide { grid-template-columns: repeat(6, minmax(0,1fr)); }
.soldier-portrait.strategist { background: url('/strategist.webp') center / 145% auto no-repeat; }
.rank-name small.rank-id, .month-table small { font: 11px ui-monospace,monospace; color: #766455; }
.fighter-trait { margin-left: 6px; color: #7b5f4b; font-size: 11px; }
.profile-name { margin: 1px 0; font-weight: 720; color: #7a4838; }
.report-list .city b { color: #896241; }
#service-dialog, #account-dialog, #demo-audit-dialog, #next-deployment-dialog {
  border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(680px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 32px)); overflow: hidden; color: var(--text); background: var(--panel); box-shadow: 0 18px 70px #25312c3b;
}
#account-dialog { width: min(420px, calc(100vw - 24px)); }
#service-dialog[data-view="shop"] { width: min(760px, calc(100vw - 24px)); }
#service-dialog::backdrop, #account-dialog::backdrop, #demo-audit-dialog::backdrop, #next-deployment-dialog::backdrop { background: #25312c70; }
#next-deployment-dialog[open] { display: flex; flex-direction: column; width: min(500px, calc(100vw - 24px)); height: min(735px, calc(100dvh - 32px)); max-height: none; }
#next-deployment-frame { flex: 1; width: 100%; min-height: 0; border: 0; }
body:has(#next-deployment-dialog[open]) { overflow: hidden; }
body[data-embedded-next] { background: var(--panel); }
body[data-embedded-next] :is(.masthead, .overview, .battlefield, #history),
body[data-embedded-next] .sidebar > :not(#command-panel, #embedded-round-start) { display: none; }
body[data-embedded-next] main { padding: 12px; }
body[data-embedded-next] :is(.layout, .sidebar) { display: block; }
.embedded-round-start { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.service-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--subtle); }
.service-head h2 { font-size: 19px; margin: 0; }
.service-head h2:focus { outline: none; }
.service-head button { font-size: 25px; line-height: 1; min-width: 40px; min-height: 40px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.service-content { max-height: min(603px, calc(100dvh - 113px)); padding: 14px 16px; overflow: auto; }
.demo-audit-summary { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.demo-audit-summary p { margin: 0; font-weight: 650; }
.demo-grant-actions { margin: 12px 0; }
.demo-grant-actions .demo-confirm { margin-top: 8px; }
.demo-audit-date { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.demo-audit-date input { width: auto; max-width: 100%; }
.demo-audit-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.demo-audit-list li { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.demo-audit-list small { color: var(--muted); }
#demo-audit-dialog details { margin-top: 12px; }
#demo-audit-dialog summary { cursor: pointer; color: var(--gold); }
.wallet-head, .wallet-shop-link, .wallet-history li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wallet-head { color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.wallet-head strong { font-family: ui-monospace,monospace; color: var(--gold); }
.wallet-shop-link { flex-wrap: wrap; }
.wallet-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 12px 0 16px; }
.wallet-metrics div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.wallet-metrics div:first-child { background: var(--subtle); }
.wallet-metrics dt, .wallet-history small { font-size: 12px; color: var(--muted); }
.wallet-metrics dd { margin: 3px 0 0; color: var(--gold); font-size: clamp(17px,4vw,26px); font-weight: 750; overflow-wrap: anywhere; }
.wallet-history ul { list-style: none; margin: 0; padding: 0; }
.wallet-history li { border-bottom: 1px solid var(--line); padding: 8px 0; }
.wallet-history li > span { min-width: 0; overflow-wrap: anywhere; }
.wallet-history small { display: block; margin: 2px 0; }
.wallet-history b { white-space: nowrap; flex-shrink: 0; }
.wallet-history { margin-top: 11px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; }
.wallet-history summary { cursor: pointer; color: var(--gold); }
.wallet-history li { font-size: 14px; }
.wallet-confirm { margin: 11px 0; padding: 10px 12px; border: 1px solid #aebfb2; border-radius: 7px; background: var(--subtle); }
.wallet-confirm p { margin: 0 0 8px; }
.wallet-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.wallet-buttons .primary { width: auto; }
#wallet-feedback:empty { display: none; }
.catalog-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 20px; padding: 18px; border: 1px solid #cad9cc; border-radius: 10px; background: #edf4ec; }
.catalog-summary p { margin: 6px 0 0; color: #46594e; font-size: 13px; line-height: 1.55; }
.catalog-summary p.catalog-balance-label { margin-top: 0; }
.catalog-summary > :last-child { flex: 1 1 250px; max-width: 420px; }
.catalog-balance { color: #254a3e; font-size: clamp(25px, 6vw, 37px); line-height: 1.1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.catalog-balance span { font-size: 14px; }
.catalog-status { color: #834f39; font-size: 15px; }
.catalog-status[data-open="true"] { color: #24583d; }
.catalog-tools { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 198px), 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.catalog-card { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 144px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); overflow-wrap: anywhere; }
.catalog-category { color: #665638; font-size: 12px; }
.catalog-card h3, .catalog-empty h3 { margin: 5px 0 8px; font-size: 17px; }
.catalog-description { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.6; white-space: pre-line; }
.catalog-card-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; flex-wrap: wrap; gap: 6px 10px; margin-top: auto; }
.catalog-card-foot strong { color: var(--gold); }
.catalog-card-foot small { display: block; color: var(--muted); }
.catalog-card-foot .header-action:not(:disabled) { border-color: #8da895; background: #eaf1e8; }
.catalog-card-foot .header-action:not(:disabled):hover { background: #dbeadd; }
.catalog-card-foot .header-action:disabled { opacity: 1; color: #525e54; background: #f1f2ed; }
.catalog-empty { padding: 24px 12px; border: 1px dashed #bccabe; border-radius: 8px; background: #f7faf4; text-align: center; }
.catalog-empty p { margin: 0 0 13px; color: var(--muted); font-size: 14px; }
.account-identity { margin: 0; font-size: 14px; color: var(--muted); }
.account-identity strong { margin-left: 5px; font: 700 14px ui-monospace,monospace; color: var(--text); }
.account-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#alias-note, .form-error { margin: 0; }
.form-error { color: #85403d; font-size: 14px; line-height: 1.5; }
.dispatch { padding: 11px 13px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf6; }
.dispatch h3 { margin: 3px 0 6px; font-size: 17px; color: #8f4b37; }
.dispatch p { margin: 0; line-height: 1.7; }
.dispatch .dispatch-time { color: var(--muted); font-size: 12px; }
.inbox-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.inbox-tabs button { justify-content: center; min-height: 42px; padding-inline: 4px; }
.inbox-tabs [aria-pressed="true"] { background: var(--subtle); border-color: var(--gold); color: var(--gold); font-weight: 700; }
.inbox-tabs .mail-unread::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #a4493d; }
.mail-channel { display: grid; gap: 12px; }
.mail-recipient { display: grid; grid-template-columns: auto minmax(0, 220px); align-items: center; gap: 8px; font-size: 13px; font-weight: 650; }
.mail-recipient select { min-height: 42px; }
.mail-feed { position: relative; min-height: 104px; max-height: min(350px, 38dvh); overflow: auto; overscroll-behavior: contain; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #f8f7ef; }
.mail-feed:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mail-feed ul { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.mail-empty { margin: 10px 2px; }
.mail-entry { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; background: var(--panel); overflow-wrap: anywhere; }
.mail-entry--world, .mail-entry--private { justify-self: start; max-width: 91%; }
.mail-entry--mine:is(.mail-entry--world, .mail-entry--private) { justify-self: end; background: #e6f1e7; border-color: #c5d9c8; }
.mail-entry--broadcast { background: #fff2d9; border-color: #e2c799; border-inline-start: 4px solid #995a23; }
.mail-entry--notices { background: #f9e9e6; border-color: #dbb7af; border-inline-start: 4px solid #a4493d; }
.mail-entry-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12px; line-height: 1.35; color: var(--muted); }
.mail-entry-meta time { font-variant-numeric: tabular-nums; }
.mail-kind { color: #74461b; }
.mail-entry--notices .mail-kind { color: #842d27; }
.mail-entry p { margin: 4px 0 0; white-space: pre-wrap; line-height: 1.55; }
.mail-composer { display: grid; gap: 6px; }
.mail-composer label { font-size: 13px; font-weight: 650; }
.mail-composer textarea { min-height: 62px; resize: vertical; }
.mail-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mail-composer-actions button { width: auto; min-height: 42px; white-space: nowrap; }
.mail-channel .hint:not(.mail-empty) { margin: 0; }
@media (max-width: 525px) {
  .inbox-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mail-feed { max-height: min(300px, 34dvh); }
  .mail-entry :is(p, b) { font-size: 14px; }
}
#suggestion-form { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
#suggestion-form :is(.name-label, .hint, .saved) { margin: 0; }
#suggestion-form button { justify-self: start; width: auto; }
.suggestion-history h3 { margin: 15px 0 8px; font-size: 16px; }
.suggestion-entry { overflow-wrap: anywhere; }
.suggestion-entry p:last-child { white-space: pre-wrap; }
.month-filter { display: flex; align-items: center; gap: 9px; }
.month-filter input { width: auto; }
.rank-scroll { overflow: auto; }
.month-table { width: 100%; border-collapse: collapse; margin-top: 9px; }
.month-table :is(th,td) { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.month-table thead th { font-size: 13px; color: #766255; }
.month-table small { display: block; margin-top: 3px; }
.month-table tbody tr:nth-child(-n+3) { background: #fbefdc; }
.king-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.king-tabs [aria-pressed="true"] { background: var(--subtle); border-color: var(--gold); color: var(--gold); }
#score-nav { padding: 12px 16px 0; }
.king-table tbody tr:nth-child(-n+3) { background: transparent; }
.king-table th[scope="row"] { white-space: normal; overflow-wrap: anywhere; }
.king-table :is(td:first-child,.king-employee) { font-variant-numeric: tabular-nums; }
.manual { max-width: 980px; padding-bottom: 64px; }
.manual h1 { margin-top: 12px; }
.manual-intro { color: var(--muted); line-height: 1.7; }
.manual-jump { display: flex; gap: 9px; flex-wrap: wrap; margin-block: 16px; }
.manual section { margin-bottom: 16px; padding: 17px 20px; }
.manual h2 { font-size: 23px; margin: 0 0 11px; color: #7a4838; }
.manual h3 { font-size: 17px; margin: 15px 0 5px; }
.manual p, .manual li { line-height: 1.75; }
.manual li + li { margin-top: 4px; }
.damage-guide { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 10px 0; }
.damage-guide li { margin: 0; padding: 4px 9px; background: var(--subtle); color: var(--gold); border-radius: 6px; font-size: 14px; }
.manual a:not(.header-action) { text-decoration: underline; text-decoration-color: #b77b65; text-underline-offset: 3px; }
.stratagem-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.stratagem-group { padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: #faf3e8; }
.stratagem-group h3 { margin: 0 0 6px; color: var(--gold); }
.stratagem-group dl { margin: 0; font-size: 14px; line-height: 1.5; }
.stratagem-group dt { margin-top: 6px; font-weight: 700; }
.stratagem-group dd { margin: 0; color: var(--muted); }
@media (max-width: 960px) {
  .masthead { gap: 12px; }
  nav { gap: 14px; }
  .header-actions { gap: 3px; flex-wrap: wrap; }
}
@media (max-width: 740px) {
  .masthead { flex-wrap: wrap; gap: 0 10px; padding-block: 10px 3px; }
  .masthead nav { order: 2; width: 100%; padding: 5px 0 0; }
  .masthead nav a { padding-block: 7px; }
  .masthead .connection { order: 1; }
  .header-actions { order: 3; flex-wrap: wrap; width: 100%; padding-block: 5px 6px; }
  .header-action { padding-inline: 9px; font-size: 13px; min-height: 40px; }
  .command-jump { display: inline-flex; margin-top: 8px; }
  .field-views button { min-height: 40px; }
  .map-wrap { max-height: none; }
  .map-expand { min-height: 40px; }
  .fighter-trait { display: none; }
  .manual section { padding-inline: 14px; }
}
.daily-scores-title { font-size: 17px; color: #7f4e3c; }
.daily-score { border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px; margin-block: 7px; background: #fffdf5; }
.daily-score summary { cursor: pointer; color: #694c3a; }
.daily-score ol { padding-left: 23px; }
.daily-score li { padding: 4px 0; }
.daily-score small { color: #796450; }
.daily-score strong { float: right; color: #8f4b37; }
.match-points { color: #8a4a38; margin-left: 4px; }
.terrain-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 13px; padding: 7px 11px; background: #fff8eb; border-inline: 1px solid var(--line); border-top: 1px solid #e7d9c4; color: #655342; font-size: 12px; }
.hazard-list { display: flex; align-items: center; gap: 8px; overflow-x: auto; padding: 7px 11px; background: #fff4e3; border: 1px solid #e7d4bb; color: #663532; font-size: 12px; white-space: nowrap; }
.hazard-list button { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 6px; min-height: 30px; border: 1px solid #dcbfaa; background: #fffbf3; color: #663532; border-radius: 4px; padding: 5px 7px; line-height: 1.2; }
.hazard-list button[data-engaged="true"] { background: #fbe8df; border-color: #ad5848; }
.hazard-list small { font-size: 11px; color: #795242; }
.terrain-strip span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.terrain-strip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.terrain-brush { background: #668d42; }
.terrain-rock { background: #b3926b; }
.terrain-scree { background: #96857e; }
.terrain-strip a { margin-left: auto; color: #97513f; text-decoration: underline; text-underline-offset: 3px; }
.map-wrap[data-view="explore"] .compass { display: none; }
.fighter-condition { display: block; color: #6b5846; font-size: 11px; white-space: nowrap; }
@media (max-width: 500px) {
  .round-clock { max-width: 47%; }
  .clock-note { font-size: 12px; }
  .field-bar { flex-wrap: wrap; padding-block: 5px; gap: 4px; }
  .field-meta { width: 100%; justify-content: space-between; padding-inline: 3px; }
  .stage small { font-size: 10px; }
  .fighter-condition { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
#target-camp { margin-bottom: 9px; }
.reinforcement-status { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; padding: 0 3px; margin: 0; font-size: 13px; color: var(--muted); }
.reinforcement-status[hidden] { display: none; }
.reinforcement-status strong { font-weight: 700; color: var(--text); }
.match-losses { color: #865a45; margin-left: 5px; font-size: 11px; white-space: nowrap; }
.quick:has(#clear) { align-items: center; margin: 9px 0 4px; }
.quick .scheme-label { margin: 0; }
