@font-face {
  font-family: "Campaign Serif";
  src: url("./assets/campaign-serif.ttf");
  font-weight: 600;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #0e1717;
  --panel: #182220;
  --gold: #cbb282;
  --paper: #ded2b8;
  --muted: #b5b5a5;
  --line: #4a4f40;
  --danger: #de8b77;
  --display: "Campaign Serif", "Songti SC", "Noto Serif CJK SC", serif;
  --body: "PingFang SC", "Microsoft YaHei", sans-serif;
  --edge: 1px solid var(--line);
}
* {
  box-sizing: border-box;
}
html,
body,
#app {
  margin: 0;
  min-height: 100%;
  width: 100%;
}
body {
  background: var(--ink);
  color: var(--paper);
  font: 14px/1.6 var(--body);
  overflow: hidden;
}
/* 左侧32px留给退出按钮（旋转后为底边），不遮地图或弹层。 */
.manual-landscape #app {
  position: fixed;
  top: var(--viewport-top, 0px);
  left: var(--viewport-left, 0px);
  width: var(--manual-width);
  height: var(--manual-height);
  min-height: 0;
  overflow: hidden;
  transform-origin: 0 0;
  transform: translateX(var(--physical-width)) rotate(90deg);
}
#manual-landscape-exit {
  position: fixed;
  z-index: 200;
  left: 16px;
  top: 50%;
  width: 120px;
  height: 28px;
  padding: 2px 8px;
  font-size: 12px;
  transform: translate(-50%, -50%) rotate(90deg);
}
#manual-landscape-exit[hidden] { display: none; }
.home-header [data-action="manual-landscape"] { display: none; }
#manual-landscape-exit:active { transform: translate(-50%, -50%) rotate(90deg); }
button,
input,
select {
  font: inherit;
}
button {
  background: #26312b;
  border: 1px solid #67705b;
  border-radius: 3px;
  color: var(--paper);
  padding: 10px 15px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover:not(:disabled) {
  background: #394338;
  border-color: var(--gold);
  color: #fff6e0;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.44;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #f1d99b;
  outline-offset: 2px;
}
button svg {
  vertical-align: middle;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
}
h2 {
  font-size: 25px;
  line-height: 1.35;
  margin-bottom: 15px;
}
h3 {
  font-size: 20px;
  margin-bottom: 10px;
}
p {
  margin-bottom: 16px;
}
small {
  font-size: 12px;
}
::selection {
  background: #cbb282;
  color: #101715;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(14, 23, 20, 0.4);
}
::-webkit-scrollbar-thumb {
  background: #7a6e4d;
  border-radius: 3px;
  border: 1px solid rgba(203, 178, 130, 0.2);
}
::-webkit-scrollbar-thumb:hover {
  background: #9c8a5e;
}
input,
select {
  background: #14211d;
  border: 1px solid #5a523a;
  border-radius: 3px;
  color: var(--paper);
  padding: 8px 12px;
  width: 100%;
  accent-color: var(--gold);
  caret-color: var(--gold);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus,
select:focus {
  border-color: #baa179;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6), 0 0 8px rgba(186, 161, 121, 0.25);
  outline: none;
}
label {
  display: block;
  color: var(--muted);
  margin: 12px 0;
}
label select {
  display: block;
  margin-top: 6px;
}
.primary {
  background: linear-gradient(180deg, #2a372f 0%, #1a2520 100%);
  color: #f7e9cc;
  border: 1px solid #cbb282;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(203, 178, 130, 0.3);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #37473b 0%, #223028 100%);
  color: #fff4dc;
  border-color: #fde08a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75), 0 0 10px rgba(253, 224, 138, 0.3), inset 0 0 0 1px rgba(253, 224, 138, 0.5);
}
.quiet {
  background: transparent;
  border-color: transparent;
  color: #d4c5a8;
}
.quiet:hover:not(:disabled) {
  background: rgba(203, 178, 130, 0.12);
  border-color: transparent;
  color: #fff2d8;
}
.wide {
  width: 100%;
  margin-top: 9px;
}
.gold {
  color: var(--gold);
}
.muted,
.storage-note {
  color: var(--muted);
}
.warning {
  color: var(--danger);
}
.icon-button {
  padding: 6px;
  background: transparent;
  border-color: transparent;
  line-height: 1;
}
.wordmark {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.15em;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e5d2a1;
}
.wordmark span {
  font: 11px var(--body);
  letter-spacing: 0.13em;
  border: 1px solid #7b7154;
  padding: 3px 6px;
  color: var(--gold);
}
.wordmark:hover:not(:disabled) {
  background: transparent;
}
.portrait {
  display: block;
  background-color: #302d22;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}
/* 主公选择：军帐底图承托真实人物与可操作的将牌。 */
.home-screen {
  height: 100dvh;
  min-height: 630px;
  background:
    linear-gradient(90deg, #0b1515e8 0%, #0b151594 38%, #11161055 100%),
    url("./assets/covenant/scenes/council-chamber.webp") center/cover;
  display: flex;
  flex-direction: column;
  padding: 0 5vw;
}
.home-header,
.home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.home-header {
  height: 92px;
  flex-shrink: 0;
  border-bottom: 1px solid #cbb28244;
}
.home-header nav {
  display: flex;
  gap: 16px;
}
.home-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(480px, 1.28fr);
  gap: 5vw;
  align-items: center;
  max-width: 1500px;
  width: 100%;
  margin: auto;
}
.home-copy h1 {
  font-size: clamp(48px, 5.1vw, 82px);
  line-height: 1.22;
  letter-spacing: 0.08em;
  margin-bottom: 22px;
  color: #f1e5ca;
}
.home-lead {
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.9;
  color: #c4c6b6;
}
.chosen-faction {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 27px 0 12px;
}
.seal {
  font: 34px var(--display);
  width: 64px;
  height: 68px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--faction), #7a1f18 45%), color-mix(in srgb, var(--faction), #1c0806 75%));
  border: 2px solid #caa360;
  border-radius: 4px;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.65),
    inset 0 0 0 2px color-mix(in srgb, var(--faction), #000 35%),
    inset 0 0 10px rgba(0, 0, 0, 0.45);
  color: #fff4dc;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.04em;
}
.chosen-faction h2 {
  margin: 0 0 2px;
  font-size: 25px;
}
.chosen-faction p {
  font-size: 13px;
  margin: 0;
  color: var(--muted);
}
.faction-note {
  font-size: 12px;
  line-height: 1.9;
  color: #b5b9a9;
}
.start-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 26px;
  padding: 15px 22px;
  width: 100%;
  max-width: 310px;
  font-family: var(--display);
  font-size: 19px;
}
.faction-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 19px;
  max-width: 830px;
  max-height: calc(100dvh - 160px);
  padding: 5px;
}
.faction-card {
  position: relative;
  aspect-ratio: 0.95;
  border: 1px solid #9f865d80;
  border-image-source: none;
  border-image-slice: 140 fill;
  border-image-width: 14px;
  border-image-repeat: round;
  padding: 0;
  overflow: hidden;
  background: #302d22;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75);
}
.faction-card .portrait {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
}
.faction-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #0c1517 0%, #0c1517b0 17%, transparent 62%);
  pointer-events: none;
}
.faction-card-copy {
  position: absolute;
  z-index: 1;
  left: 15px;
  bottom: 14px;
  text-align: left;
  right: 12px;
}
.faction-card-copy small {
  color: #dbcaab;
  font-size: 11px;
  letter-spacing: 0.12em;
}
.faction-card-copy strong {
  font-family: var(--display);
  font-size: clamp(20px, 2.4vw, 34px);
  display: block;
  letter-spacing: 0.13em;
  line-height: 1.4;
}
.faction-card-copy > span {
  font-size: 11px;
  color: #aebdaf;
}
.faction-card.selected {
  outline: 2px solid #fde08a;
  outline-offset: 3px;
  box-shadow: 0 8px 32px rgba(253, 224, 138, 0.25), 0 0 16px rgba(253, 224, 138, 0.35);
}
.faction-card.selected .faction-card-copy strong {
  color: #ffe5ad;
}
.selected-mark {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ead4a5;
  color: #30281b;
  font-size: 10px;
  padding: 2px 5px;
  z-index: 2;
}
.home-footer {
  height: 55px;
  flex-shrink: 0;
  font-size: 11px;
  color: #bdbaaa;
  letter-spacing: 0.1em;
}
.storage-note {
  font-size: 12px;
  max-width: 310px;
  margin: 12px 0 0;
}
/* 战场：三列真实布局，不把面板压在可点击领地上。 */
.war-screen {
  height: 100dvh;
  min-height: 540px;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) 144px;
  background: #121a17 url("./assets/covenant/scenes/map-heroes.webp")
    center/cover;
}
.war-header {
  background: linear-gradient(180deg, #15221ff8 0%, #101a18f6 100%);
  border-bottom: 1px solid #7c683e;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 28px;
}
.war-header .wordmark {
  font-size: 23px;
  color: #f7e6ca;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
.resources {
  display: flex;
  gap: 24px;
}
.resources > span {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--gold);
}
.resources > span svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
}
.resources .reserve-stat {
  color: #f7dfa4;
}
.resources .reserve-stat strong {
  color: #ffdf97;
}
.resources > span > span {
  font-size: 10px;
  color: #aab2a1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.resources strong {
  font-size: 24px;
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
  color: #fff4dc;
  font-weight: 500;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}
.round-weather {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.round-weather b {
  font-size: 13px;
  color: #e2d2b4;
  white-space: nowrap;
  background: rgba(22, 35, 30, 0.8);
  border: 1px solid #6b5c37;
  border-radius: 3px;
  padding: 4px 10px;
}
.round-weather button {
  background: rgba(26, 40, 35, 0.7);
  border: 1px solid #7c683e;
  border-radius: 3px;
  color: #fce88b;
  font-size: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 5px 10px;
  transition: all 0.2s;
}
.round-weather button:hover:not(:disabled) {
  background: #2b3d35;
  border-color: #fde08a;
  color: #fff4dc;
  box-shadow: 0 0 10px rgba(253, 224, 138, 0.2);
}
.war-header nav {
  display: flex;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.war-header nav button {
  padding: 6px 11px;
  background: rgba(28, 42, 36, 0.7);
  border: 1px solid #6e5e3b;
  border-radius: 3px;
  color: #eedaba;
  transition: all 0.15s;
}
.war-header nav button:hover:not(:disabled) {
  background: #34483e;
  border-color: #baa179;
  color: #fff4dc;
}
.war-layout {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr) 252px;
  min-height: 0;
  background: #0816138a;
}
.faction-roster {
  padding: 22px 10px 12px 16px;
  background: linear-gradient(180deg, #15221ff8 0%, #111a18f6 100%);
  border-right: 1px solid #7c683e;
  box-shadow: inset -1px 0 0 rgba(203, 178, 130, 0.15);
  overflow-y: auto;
}
.roster-row {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #51604b5e;
  background: transparent;
  border-radius: 0;
  padding: 11px 4px;
  color: #c9cbb8;
  position: relative;
  transition: background 0.15s;
}
.roster-row .portrait {
  width: 44px;
  height: 44px;
  aspect-ratio: 1;
  border: 2px double rgba(195, 168, 121, 0.75);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.roster-row > span:last-child {
  flex: 1;
  min-width: 0;
}
.roster-row strong {
  font-size: 15px;
  display: block;
  font-family: var(--display);
  color: #f2e6cc;
}
.roster-row strong small {
  font: 10px var(--body);
  margin-left: 6px;
  color: var(--gold);
}
.roster-row > span > span {
  display: block;
  font-size: 11px;
}
.roster-row > span > small {
  display: block;
  font-size: 10px;
  color: #aab7a7;
}
.roster-row.current {
  background: linear-gradient(90deg, rgba(186, 161, 121, 0.24) 0%, rgba(186, 161, 121, 0.04) 100%);
  border-left: 3px solid #fde08a;
  padding-left: 6px;
}
.roster-row.current::before {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fde08a;
  left: -2px;
  box-shadow: 0 0 6px #fde08a;
}
.roster-row.eliminated {
  opacity: 0.36;
}
.victory-objective {
  padding: 22px 7px 0;
  color: #afbfad;
  font-size: 12px;
}
.victory-objective svg {
  width: 16px;
  vertical-align: middle;
  margin-right: 6px;
}
.victory-objective strong {
  font-weight: 500;
  color: var(--gold);
}
.victory-objective p {
  margin: 8px 0 0;
  line-height: 1.8;
}
.map-region {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #171f18;
}
.map-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  flex-shrink: 0;
  color: #c7c6aa;
  font-size: 11px;
  background: linear-gradient(180deg, #131c19 0%, #182420 100%);
  border-bottom: 1px solid #3c4a40;
}
.map-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px;
  flex-shrink: 0;
  color: #c7c6aa;
  font-size: 11px;
  background: linear-gradient(180deg, #182420 0%, #131c19 100%);
  border-top: 1px solid #3c4a40;
}
.map-caption span:first-child {
  color: var(--gold);
  font-family: var(--display);
  font-size: 15px;
}
.canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #151e18;
}
.sand-map-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960/544;
  max-height: 100%;
  object-fit: contain;
  touch-action: manipulation;
}
.map-bottom {
  height: 45px;
  border-top: 1px solid #695d3b;
}
.map-bottom > span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.map-bottom button {
  font-size: 11px;
  white-space: nowrap;
  padding: 3px 7px;
}
.command-panel {
  padding: 24px 20px 15px;
  background: linear-gradient(180deg, #152320f8 0%, #111a18f6 100%);
  border-left: 1px solid #7c683e;
  box-shadow: inset 1px 0 0 rgba(203, 178, 130, 0.2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-size: 12px;
}
.first-turn-guide {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #c3a879;
  border-radius: 4px;
  font-size: 12px;
}
.first-turn-guide strong { color: #c3a879; }
.first-turn-guide p { margin: 7px 0; line-height: 1.7; }
.draft-dialog .first-turn-guide strong { color: #20312f; }

.command-panel h2 {
  font-size: 26px;
  color: #fce88b;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}
.command-panel .instruction {
  color: #c3c9b7;
  line-height: 1.9;
}
.command-panel .panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
}
.command-panel .panel-heading h2 {
  margin-bottom: 5px;
}
.territory-subtitle {
  color: #bcb497;
  font-size: 11px;
}
.territory-army {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 8px 0 15px;
}
.territory-army strong {
  font-family: var(--display);
  font-size: 53px;
  line-height: 1;
  color: #ffdf97;
  text-shadow: 0 2px 12px rgba(255, 223, 151, 0.35);
}
.territory-army span {
  font-size: 11px;
  color: #bfc8b9;
}
.capital-note {
  border-top: 1px solid #9f825a;
  padding-top: 12px;
  color: #e0c186;
  font-size: 11px;
}
.panel-bottom {
  margin-top: auto;
  padding-top: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  font-size: 11px;
  color: #aebaab;
}
.panel-bottom strong {
  font-weight: 500;
  color: #e2d6b9;
}
.reserve-count {
  font: 52px var(--display);
  color: #e5c889;
  margin-bottom: 18px;
}
.reserve-count span {
  font: 12px var(--body);
  margin-left: 12px;
  color: #c4cdbb;
}
.reserve-breakdown {
  background: #1a2722;
  border: 1px solid #7c6c49;
  border-radius: 4px;
  padding: 10px 14px;
  margin: 10px 0 14px;
  text-align: left;
}
.reserve-breakdown span {
  display: block;
  font-size: 11px;
  color: #c7c6b4;
  letter-spacing: 0.05em;
}
.reserve-breakdown strong {
  font: 36px var(--display);
  color: #eed69f;
  line-height: 1.1;
  display: block;
  margin: 4px 0 2px;
}
.reserve-breakdown small {
  display: block;
  font-size: 11px;
  color: #9fac9b;
}
.troop-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1b2622;
  border: 1px solid #576550;
  border-radius: 3px;
  padding: 6px 12px;
  margin: 8px 0 10px;
  font-size: 12px;
  color: #d6dacd;
}
.troop-breakdown-row b {
  color: #eed69f;
}
.turn-quotas {
  display: flex;
  gap: 15px;
  margin: 18px 0;
  padding-top: 15px;
  border-top: var(--edge);
  font-size: 11px;
  color: var(--muted);
}
.turn-quotas b {
  color: #e1cb9d;
  margin-left: 4px;
}
.quantity-control {
  display: flex;
  align-items: center;
  border: 1px solid #63573c;
  border-radius: 4px;
  background: #121c19;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.75);
  margin: 15px 0 6px;
  overflow: hidden;
}
.quantity-control.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #151e1b;
}
.quantity-control button {
  padding: 8px 12px;
  border: 0;
  background: rgba(38, 52, 45, 0.6);
  color: #eedaba;
  flex-shrink: 0;
  min-width: 32px;
  font-weight: bold;
  transition: all 0.15s;
}
.quantity-control button:hover:not(:disabled) {
  background: #394b40;
  color: #fff4dc;
}
.quantity-control input {
  width: 100%;
  min-width: 20px;
  text-align: center;
  border: 0;
  background: transparent;
  color: #fce88b;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  box-shadow: none;
  appearance: textfield;
  -moz-appearance: textfield;
}
.quantity-control input::-webkit-inner-spin-button {
  display: none;
}
.quantity-control button:last-child {
  font-size: 11px;
  padding: 8px 10px;
  background: rgba(45, 60, 52, 0.8);
  border-left: 1px solid #4a3e2a;
}
.route-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e8d5ae;
  padding: 12px 0;
  border-top: var(--edge);
  font: 17px var(--display);
}
.target-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.target-list button {
  font-size: 12px;
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #5a4b32;
  background: rgba(28, 38, 34, 0.75);
  color: #eedaba;
  border-radius: 3px;
  transition: all 0.15s;
}
.target-list button:hover:not(:disabled) {
  border-color: #baa179;
  background: #2a3c34;
  color: #fff4dc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.status-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.status-chips button {
  color: #ffcfba;
  background: rgba(74, 30, 24, 0.85);
  border: 1px solid #a84c3d;
  border-radius: 2px;
  font-size: 10px;
  padding: 2px 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.15s;
}
.status-chips button:hover:not(:disabled) {
  background: #682c23;
  border-color: #f77a68;
  color: #ffffff;
}
.ai-standard svg {
  width: 42px;
  height: 42px;
  color: var(--gold);
  margin: 20px 0;
}
.ai-standard h2 {
  font-size: 23px;
}
.selected-targets {
  font-size: 18px;
  color: #e3c795;
  padding: 20px 0;
}
.command-panel select {
  font-size: 12px;
}
.war-footer {
  background: linear-gradient(180deg, #15221ff8 0%, #101a18f6 100%);
  border-top: 1px solid #7c683e;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(203, 178, 130, 0.15);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
}
.deck-label {
  width: 115px;
  flex-shrink: 0;
}
.deck-label strong {
  font: 19px var(--display);
  display: block;
}
.deck-label > span {
  display: block;
  color: #b4b9a7;
  font-size: 11px;
  margin: 5px 0;
}
.deck-label button {
  font-size: 11px;
  padding: 4px 0;
}
.active-deck {
  display: flex;
  gap: 10px;
  height: 112px;
  min-width: 0;
  flex: 1;
  overflow: auto;
}
.hero-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border: 1px solid #8a784b;
  border-image-source: none;
  border-image-slice: 140 fill;
  border-image-width: 14px;
  border-image-repeat: round;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
}
.hero-card.deck {
  width: 98px;
  height: 112px;
}
.hero-card .portrait {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(0deg, #0d1a19 0%, #0d1a19c4 30%, transparent 75%);
}
.hero-card-info {
  position: absolute;
  bottom: 6px;
  left: 8px;
  right: 6px;
  z-index: 1;
}
.hero-card-info strong {
  font: 18px var(--display);
  display: block;
  line-height: 1.3;
}
.hero-card-info small {
  font-size: 10px;
  color: #e2c48d;
}
.hero-card-info > span {
  font-size: 10px;
  color: #b9c7b5;
  display: block;
}
.empty-card {
  width: 98px;
  flex-shrink: 0;
  height: 112px;
  border: 1px dashed #3f5046;
  border-radius: 3px;
  background: rgba(14, 23, 20, 0.85);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.9);
  color: #8fa38e;
  font-size: 12px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.empty-card:hover:not(:disabled) {
  border-color: var(--gold);
  background: #1b2622;
  color: #f1dfb8;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.95), 0 0 8px rgba(203, 178, 130, 0.2);
}
.phase-command {
  margin-left: auto;
  flex-shrink: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.phase-command > span {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #bcbfa9;
}
.phase-command > small {
  font-size: 10px;
  color: #dcc993;
}
.phase-steps {
  display: flex;
  gap: 6px;
  font-size: 11px;
  margin: 6px 0 8px;
  color: #7b887b;
}
.phase-steps span {
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: rgba(22, 33, 28, 0.5);
  transition: all 0.2s;
}
.phase-steps span.active {
  color: #fce88b;
  background: rgba(43, 61, 51, 0.85);
  border-color: #baa179;
  border-bottom: 2px solid #fde08a;
  box-shadow: 0 0 8px rgba(253, 224, 138, 0.2);
  font-weight: 600;
}
.next-button {
  font-family: var(--display);
  font-size: 18px;
  padding: 10px 15px;
  letter-spacing: 0.07em;
}
/* 深色军帐之外的纸面详情，让长技能文本易读。 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #05110fbd;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.dialog {
  width: min(650px, 100%);
  max-width: 100%;
  max-height: calc(100dvh - 64px);
  background: #ede2c9;
  color: #27362e;
  border: 1px solid #9f865d;
  box-shadow:
    0 24px 90px rgba(0, 0, 0, 0.8),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 0 0 3px #cbb282;
  border-radius: 4px;
  overflow: auto;
  padding: 28px 32px;
}
.dialog button:focus-visible,
.dialog a:focus-visible,
.dialog input:focus-visible,
.dialog select:focus-visible {
  outline: 2px solid #5a4020;
  outline-offset: 2px;
}
.dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px double #b3a88c;
  padding-bottom: 16px;
  margin-bottom: 22px;
}
.dialog > header h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: 0.04em;
  color: #1e2e25;
}
.dialog .icon-button {
  color: #4b3e2a;
  background: rgba(186, 161, 121, 0.2);
  border: 1px solid #baa179;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.dialog .icon-button:hover {
  background: #baa179;
  color: #ede2c9;
}
.dialog p {
  line-height: 1.9;
}
.dialog .muted {
  color: #596954;
}
.dialog .warning {
  color: #963e2c;
}
.dialog button:not(.primary):not(.hero-card) {
  color: #2a382c;
  border: 1px solid #9c8e71;
  background: linear-gradient(180deg, #eae1cb 0%, #dbd0b3 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border-radius: 3px;
  font-weight: 500;
  transition: all 0.15s;
}
.dialog button:not(.primary):not(.hero-card):hover:not(:disabled) {
  background: linear-gradient(180deg, #f2ead7 0%, #e5dbc0 100%);
  border-color: #7d6e52;
  color: #17261e;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.dialog button.quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.dialog button.quiet:hover:not(:disabled) {
  background: rgba(45, 66, 53, 0.08);
  border-color: transparent;
  color: #1a2a22;
  box-shadow: none;
}
.dialog .primary {
  background: linear-gradient(180deg, #2b4538 0%, #1e3328 100%);
  color: #fce88b;
  border: 1px solid #5a755d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.dialog .primary:hover {
  background: linear-gradient(180deg, #375747 0%, #253e31 100%);
  border-color: #8db592;
  color: #fff4dc;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35), 0 0 10px rgba(252, 232, 139, 0.25);
}
.dialog input,
.dialog select {
  background: #f3ead5;
  border-color: #b2ab90;
  color: #22392e;
}
.dialog label {
  color: #405443;
}
.dialog .gold {
  color: #765728;
}
.market-dialog {
  width: 1000px;
  max-width: 100%;
  background:
    linear-gradient(90deg, #eee2ccee, #eee2ccee),
    url("./assets/covenant/scenes/council-chamber.webp") center/cover;
}
.market-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.market-card {
  aspect-ratio: 1.25;
  width: 100%;
  min-width: 0;
  min-height: 150px;
  overflow: hidden;
}
.market-card .portrait {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
}
.market-card .hero-card-info {
  bottom: 16px;
  left: 14px;
}
.market-card .hero-card-info strong {
  font-size: 26px;
}
.market-card .hero-card-info small {
  font-size: 11px;
}
.market-card .hero-card-info > span {
  font-size: 12px;
}
.card-price {
  position: absolute;
  right: 8px;
  top: 8px;
  color: #f4dfb0;
  background: #1c332acb;
  z-index: 2;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 2px;
}
.hero-dialog {
  width: 940px;
  max-width: 100%;
}
.hero-detail-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  align-items: start;
}
.hero-detail-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
}
.hero-cost-info {
  font-size: 12px;
  color: #52634e;
  margin: 0 0 6px;
  line-height: 1.4;
}
.hero-detail-actions {
  display: flex;
  flex-direction: column;
}
.hero-detail-main {
  min-width: 0;
}
.detail-portrait {
  width: 240px;
  height: 240px;
  aspect-ratio: 1;
  position: sticky;
  top: 0;
  object-fit: cover;
  border: 1px solid #8a784b;
  border-image-source: none;
  border-image-slice: 140 fill;
  border-image-width: 16px;
  border-image-repeat: round;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.skill-description {
  padding: 0 0 18px;
  margin: 0 0 16px;
  border-bottom: 1px solid #bdb79e;
}
.skill-description h3 {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 20px;
}
.skill-description h3 small {
  font: 11px var(--body);
  color: #a8382b;
  background: rgba(168, 56, 43, 0.08);
  border: 1px solid rgba(168, 56, 43, 0.35);
  border-radius: 2px;
  padding: 1px 7px;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.skill-description p {
  font-size: 13px;
  line-height: 1.9;
  margin: 0 0 10px;
}
.skill-use {
  font-size: 12px;
}
.public-hero .portrait {
  width: 100%;
  aspect-ratio: 1;
}
.dialog .public-hero .portrait {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border: 1px solid #8a784b;
  border-image-source: none;
  border-image-slice: 140 fill;
  border-image-width: 12px;
  border-image-repeat: round;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.draft-dialog {
  width: 1000px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.draft-dialog > header {
  flex-shrink: 0;
}
.draft-dialog .dialog-body {
  overflow: auto;
}
.draft-card {
  width: 100%;
}
.draft-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.draft-option {
  min-width: 0;
}
.draft-skills {
  padding: 8px;
  font-size: 12px;
}
.draft-skills summary {
  cursor: pointer;
  color: #405443;
}
.draft-skills h3 {
  font-size: 15px;
  margin: 10px 0 5px;
}
.draft-skills h3 small {
  display: block;
  font: 11px var(--body);
}
.draft-skills p {
  font-size: 12px;
}
.draft-confirm {
  padding-top: 12px;
  flex-shrink: 0;
}
.draft-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
}
.draft-card .portrait {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border: 1px solid #8a784b;
  border-image-source: none;
  border-image-slice: 140 fill;
  border-image-width: 12px;
  border-image-repeat: round;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
}
.draft-card.selected .portrait {
  outline: 2px solid #fde08a;
  outline-offset: 2px;
  box-shadow: 0 4px 16px rgba(253, 224, 138, 0.4);
}
.public-hero strong {
  display: block;
  text-align: center;
}
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 22px;
}
.rules-grid article {
  background: rgba(246, 238, 222, 0.7);
  border: 1px solid #c4b595;
  border-radius: 3px;
  padding: 14px 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 2px 6px rgba(0, 0, 0, 0.05);
}
.rules-grid h3 {
  font-size: 17px;
  color: #2b3a2f;
  margin-bottom: 8px;
  border-bottom: 1px solid #d5c8ad;
  padding-bottom: 6px;
  font-family: var(--display);
  letter-spacing: 0.04em;
}
.rules-grid p {
  font-size: 12px;
  line-height: 1.8;
  margin: 0;
  color: #3b4d40;
}
.battle-log {
  padding: 0;
  list-style: none;
}
.battle-log li {
  padding: 11px 8px;
  border-bottom: 1px dashed rgba(179, 168, 140, 0.6);
  font-size: 13px;
  line-height: 1.6;
  display: flex;
  align-items: baseline;
  transition: background 0.15s;
}
.battle-log li:hover {
  background: rgba(186, 161, 121, 0.12);
}
.battle-log li span {
  font-size: 10px;
  color: #a8382b;
  background: rgba(168, 56, 43, 0.08);
  border: 1px solid rgba(168, 56, 43, 0.35);
  border-radius: 2px;
  padding: 1px 6px;
  margin-right: 12px;
  font-family: var(--display);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.exchange-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 35px;
  margin: 10px 0 25px;
}
.exchange-preview > span {
  text-align: center;
  font-size: 12px;
}
.exchange-preview strong {
  font: 60px var(--display);
  display: block;
  line-height: 1.4;
}
.exchange-preview svg {
  width: 38px;
  height: 38px;
  color: #786143;
}
.territory-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.territory-list button {
  font-size: 12px;
  text-align: left;
  padding: 8px 12px;
  background: rgba(246, 238, 222, 0.6);
  border: 1px solid #c4b595;
  border-radius: 3px;
  color: #27362e;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.15s;
}
.territory-list button:hover:not(:disabled) {
  background: #fff8eb;
  border-color: #8f7952;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.territory-list small {
  display: block;
  color: #8c5b36;
  font-size: 10px;
  margin-top: 2px;
}
.blocked-routes {
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 11px;
  color: #e0b89b;
  background: rgba(64, 25, 20, 0.4);
  border: 1px solid rgba(168, 56, 43, 0.45);
  border-radius: 3px;
  list-style-position: inside;
}
.blocked-routes li {
  margin: 4px 0;
  line-height: 1.4;
}
.blocked-routes b {
  color: #f7a392;
}
.region-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.region-table article {
  background: rgba(246, 238, 222, 0.7);
  border: 1px solid #c4b595;
  border-radius: 3px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 2px 6px rgba(0, 0, 0, 0.05);
}
.region-table h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 17px;
  color: #2b3a2f;
  margin: 0 0 6px;
  border-bottom: 1px solid #d5c8ad;
  padding-bottom: 4px;
}
.region-table h3 span {
  font: bold 12px var(--display);
  color: #8b3a2b;
  background: rgba(139, 58, 43, 0.08);
  border: 1px solid rgba(139, 58, 43, 0.25);
  border-radius: 2px;
  padding: 1px 6px;
}
.region-table p {
  font-size: 11px;
  color: #4a5a4c;
  line-height: 1.5;
  margin: 6px 0;
}
.region-table progress {
  width: 100%;
  height: 8px;
  accent-color: #436e4f;
  border-radius: 4px;
  overflow: hidden;
}
.region-table small {
  color: #637562;
  font-size: 10px;
  display: block;
  margin-top: 4px;
}
.battle-dialog {
  width: 900px;
  max-width: 100%;
}
.battle-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.battle-preview > div {
  text-align: center;
}
.battle-preview .portrait {
  width: 140px;
  height: 140px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid #8a784b;
  border-image-source: none;
  border-image-slice: 140 fill;
  border-image-width: 14px;
  border-image-repeat: round;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.battle-preview h3 {
  margin: 7px 0;
  font-size: 18px;
  color: #1f3025;
}
.battle-preview p {
  font-size: 12px;
  color: #55442f;
}
.combat-skills {
  font-size: 12px;
  padding: 14px 18px;
  background: rgba(186, 161, 121, 0.2);
  border: 1px solid #c4b595;
  border-radius: 3px;
  margin: 14px 0;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.08);
}
.combat-skills p {
  margin: 0 0 6px;
  line-height: 1.6;
}
.combat-skills p:last-child {
  margin-bottom: 0;
}
.combat-skills b {
  color: #7d2a1d;
  font-family: var(--display);
}
.battle-overlay {
  background: #06110f url("./assets/covenant/scenes/iron-pass.webp") center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
}
.battle-overlay .battle-dialog {
  background: transparent;
  color: #f1e3c3;
  border: none;
  box-shadow: none;
  width: 100%;
  max-width: 1280px;
  height: 100%;
  max-height: 100vh;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}
.battle-header {
  text-align: center;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}
.battle-dialog > h2,
.battle-header h2 {
  font-size: clamp(24px, 2.8vw, 32px);
  margin-bottom: 4px;
  color: #fce88b;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95);
  letter-spacing: 0.08em;
}
.battle-dialog > h2 > span,
.battle-header h2 span {
  font-size: 16px;
  color: #d6be90;
  margin: 0 16px;
}
.battle-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  width: 100%;
  position: relative;
  min-height: 0;
}
.battle-hero-side {
  width: 260px;
  max-width: 25vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 5;
  pointer-events: none;
}
.battle-hero-side.attacker {
  align-items: flex-start;
}
.battle-hero-side.defender {
  align-items: flex-end;
}
.battle-bust-wrap {
  max-height: 52vh;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  -webkit-mask-image: linear-gradient(to bottom, black 65%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 65%, transparent 100%);
}
.battle-bust-img {
  max-height: 48vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.9));
}
.battle-hero-tag {
  background: rgba(18, 28, 24, 0.92);
  border: 1px solid #9f865d;
  border-radius: 3px;
  padding: 5px 14px;
  margin-top: 6px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}
.battle-hero-tag .hero-tag-title {
  display: block;
  font-size: 10px;
  color: #cbb282;
  letter-spacing: 0.15em;
}
.battle-hero-tag strong {
  font-family: var(--display);
  font-size: 17px;
  color: #fff4dc;
}
.battle-center-arena {
  max-width: 480px;
  width: 100%;
  z-index: 10;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(14, 25, 22, 0.88);
  border: 1px solid #baa179;
  border-radius: 6px;
  padding: 16px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}
.battle-dialog .dice-arena {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 24px;
}
.dice-side-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dice-side-group small,
.dice-arena small {
  font-size: 11px;
  color: #c7cbb5;
  margin-bottom: 4px;
}
.dice-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 6px 0 14px;
}
.dice-side-group.attacker .die {
  animation: dieSlideLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.dice-side-group.defender .die {
  animation: dieSlideRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dieSlideLeft {
  0% { transform: translateX(-24px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes dieSlideRight {
  0% { transform: translateX(24px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.die {
  background: #e7d5b0 linear-gradient(145deg,#e8dcc2,#c9b58d) center/cover;
  color: #2b1f14;
  border-radius: 9px;
  width: 62px;
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  border: 1px solid #cbb282;
}
.die strong {
  font-size: 28px;
  line-height: 1;
  color: #2b1f14;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.45), -1px -1px 0 rgba(0, 0, 0, 0.65);
}
.die small {
  font-size: 10px;
  color: #5d5338;
  margin-top: 2px;
  font-weight: 500;
}
.battle-verdict {
  text-align: center;
  margin: 12px 0;
}
.battle-seal {
  display: inline-block;
  padding: 3px 14px;
  border: 2px solid #b83b3b;
  border-radius: 3px;
  color: #ff6b6b;
  font: bold 15px var(--display);
  letter-spacing: 0.2em;
  margin-bottom: 6px;
  box-shadow: 0 0 14px rgba(184, 59, 59, 0.5), inset 0 0 8px rgba(184, 59, 59, 0.3);
  transform: rotate(-3deg);
  animation: sealStamp 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.battle-seal.seal-clash {
  border-color: #8c764a;
  color: #f1dfb8;
  box-shadow: 0 0 10px rgba(140, 118, 74, 0.4), inset 0 0 6px rgba(140, 118, 74, 0.2);
  transform: rotate(0deg);
}
@keyframes sealStamp {
  0% { transform: scale(2) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(-3deg); opacity: 1; }
}
.battle-verdict strong {
  display: block;
  font: 26px var(--display);
  color: #f1d191;
}
.battle-verdict span {
  font-size: 13px;
}
.modifier-list {
  max-height: 110px;
  overflow: auto;
  border-top: 1px solid #7f7557;
  border-bottom: 1px solid #7f7557;
  padding: 6px 0;
  font-size: 12px;
  color: #c6ccb7;
  width: 100%;
}
.modifier-list p {
  margin: 2px 0;
}
.battle-actions {
  width: 100%;
  margin-top: 12px;
}
.surrender-hero {
  text-align: center;
}
.surrender-hero .portrait {
  width: 180px;
  height: 180px;
  margin: 0 auto 15px;
  object-fit: cover;
  border: 1px solid #8a784b;
  border-image-source: none;
  border-image-slice: 140 fill;
  border-image-width: 14px;
  border-image-repeat: round;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.result-summary {
  text-align: center;
}
.report-details {
  margin-top: 16px;
  text-align: left;
}
.report-details summary {
  cursor: pointer;
  color: #5a4b35;
  font-size: 12px;
  padding: 6px 0;
}
.report-details pre {
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 35vh;
  overflow: auto;
  font-size: 11px;
  line-height: 1.6;
  background: #141f1c;
  color: #dfd7c2;
  border: 1px solid #4a3e2a;
  border-radius: 3px;
  padding: 12px 14px;
  margin-top: 6px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  font-family: monospace;
}
.result-summary h3 {
  font-size: 29px;
  color: #1e3025;
}
.result-summary dl {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 26px 0;
}
.result-summary dl > div {
  flex: 1;
  background: rgba(186, 161, 121, 0.15);
  border: 1px solid #c4b595;
  border-radius: 4px;
  padding: 16px 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 2px 8px rgba(0, 0, 0, 0.08);
}
.result-summary dt {
  font-size: 12px;
  color: #60503a;
  letter-spacing: 0.05em;
}
.result-summary dd {
  font: 36px var(--display);
  margin: 6px 0 0;
  color: #1e3025;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 160px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 12px 24px;
  background: #f4e8cb;
  color: #26382c;
  border: 1px solid #a68953;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), inset 0 0 0 1px #fff5df;
  border-radius: 3px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.05em;
  max-width: min(90vw, 600px);
}
.rotate-hint {
  display: none;
}
@media (min-width: 1800px) {
  .war-layout {
    grid-template-columns: 205px minmax(0, 1fr) 295px;
  }
  .war-screen {
    grid-template-rows: 82px minmax(0, 1fr) 160px;
  }
  .command-panel {
    padding: 30px 27px;
    font-size: 14px;
  }
  .hero-card.deck,
  .empty-card {
    width: 120px;
    height: 126px;
  }
  .active-deck {
    height: 126px;
    gap: 14px;
  }
  .faction-roster {
    padding: 25px 18px;
  }
  .roster-row {
    padding: 16px 0;
  }
  .roster-row .portrait {
    width: 52px;
    height: 52px;
    aspect-ratio: 1;
  }
  .home-layout {
    grid-template-columns: 0.65fr 1.35fr;
  }
  .faction-grid {
    max-width: 850px;
  }
  .faction-card {
    aspect-ratio: 0.96;
  }
}
@media (max-width: 1150px) {
  .war-header {
    gap: 16px;
    padding: 0 15px;
  }
  .war-header .wordmark {
    font-size: 20px;
  }
  .war-header .wordmark span {
    display: none;
  }
  .resources {
    gap: 15px;
  }
  .war-header nav {
    gap: 0;
  }
  .war-header nav button {
    font-size: 11px;
    padding: 6px;
  }
  .war-layout {
    grid-template-columns: 133px minmax(0, 1fr) 215px;
  }
  .faction-roster {
    padding: 12px 8px;
  }
  .roster-row {
    gap: 7px;
  }
  .roster-row .portrait {
    width: 36px;
    height: 36px;
    aspect-ratio: 1;
  }
  .roster-row strong {
    font-size: 13px;
  }
  .roster-row > span > span {
    font-size: 11px;
  }
  .roster-row > span > small {
    font-size: 10px;
  }
  .roster-row.current::before {
    display: none;
  }
  .command-panel {
    padding: 16px 13px;
  }
  .war-footer {
    gap: 12px;
    padding: 10px 14px;
  }
  .deck-label {
    width: 95px;
  }
  .deck-label strong {
    font-size: 16px;
  }
  .hero-card.deck,
  .empty-card {
    width: 84px;
  }
  .hero-card.deck .portrait {
    width: 84px;
    height: 84px;
    aspect-ratio: 1;
  }
  .phase-command {
    width: 195px;
  }
  .home-layout {
    gap: 30px;
    grid-template-columns: 230px 1fr;
  }
  .home-screen {
    padding: 0 4vw;
  }
  .faction-grid {
    gap: 13px;
  }
  .home-copy h1 {
    font-size: 48px;
  }
}
@media (max-height: 700px) and (orientation: landscape) {
  .home-screen {
    min-height: 0;
    padding: 0 4vw;
  }
  .home-header {
    height: 60px;
  }
  .home-footer {
    height: 32px;
    font-size: 10px;
  }
  .home-layout {
    grid-template-columns: 210px 1fr;
    gap: 35px;
  }
  .home-copy h1 {
    font-size: 39px;
    margin-bottom: 10px;
  }
  .home-lead {
    font-size: 13px;
    margin-bottom: 5px;
  }
  .chosen-faction {
    margin: 15px 0 5px;
    gap: 12px;
  }
  .seal {
    width: 40px;
    height: 43px;
    font-size: 26px;
  }
  .chosen-faction h2 {
    font-size: 20px;
  }
  .chosen-faction p {
    font-size: 11px;
  }
  .faction-note {
    font-size: 11px;
    margin-bottom: 10px;
  }
  .start-button {
    padding: 10px 12px;
    font-size: 15px;
  }
  .faction-grid {
    max-height: calc(100dvh - 115px);
    height: 100%;
    gap: 10px;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .faction-card {
    aspect-ratio: auto;
    min-height: 0;
    height: 100%;
  }
  .faction-card .portrait {
    height: 100%;
    aspect-ratio: auto;
  }
  .faction-card-copy {
    left: 10px;
    bottom: 8px;
  }
  .faction-card-copy strong {
    font-size: 24px;
  }
  .faction-card-copy > span {
    display: none;
  }
  .storage-note {
    font-size: 10px;
  }
  .war-screen {
    min-height: 0;
    grid-template-rows: 52px minmax(0, 1fr) 100px;
  }
  .war-header {
    gap: 15px;
    padding: 0 12px;
  }
  .war-header .wordmark {
    font-size: 18px;
  }
  .resources strong {
    font-size: 19px;
  }
  .round-weather {
    gap: 6px;
  }
  .war-layout {
    grid-template-columns: 105px minmax(0, 1fr) 188px;
  }
  .faction-roster {
    padding: 6px;
  }
  .roster-row {
    padding: 6px 0;
    gap: 6px;
  }
  .roster-row .portrait {
    width: 30px;
    height: 30px;
    aspect-ratio: 1;
  }
  .roster-row > span > small {
    display: none;
  }
  .roster-row strong {
    font-size: 12px;
  }
  .roster-row > span > span {
    font-size: 11px;
  }
  .victory-objective {
    display: none;
  }
  .command-panel {
    padding: 12px 11px;
    font-size: 11px;
  }
  .command-panel h2 {
    font-size: 20px;
    margin-bottom: 9px;
  }
  .command-panel p {
    margin-bottom: 9px;
    line-height: 1.7;
  }
  .panel-bottom {
    display: none;
  }
  .reserve-count {
    font-size: 35px;
    margin: 5px 0;
  }
  .command-panel button {
    padding: 6px 9px;
    font-size: 11px;
  }
  .turn-quotas {
    margin: 10px 0;
    font-size: 10px;
    padding-top: 8px;
  }
  .map-caption {
    padding: 6px 10px;
    font-size: 11px;
  }
  .map-caption span:first-child {
    font-size: 13px;
  }
  .map-bottom {
    height: 28px;
    padding: 3px 8px;
    font-size: 11px;
  }
  .map-bottom button {
    font-size: 11px;
  }
  .war-footer {
    gap: 12px;
    padding: 7px 12px;
  }
  .active-deck {
    height: 84px;
    gap: 6px;
  }
  .hero-card.deck,
  .empty-card {
    width: 74px;
    height: 84px;
  }
  .hero-card.deck .portrait {
    width: 74px;
    height: 74px;
    aspect-ratio: 1;
  }
  .hero-card-info {
    left: 6px;
    bottom: 4px;
  }
  .hero-card-info strong {
    font-size: 15px;
  }
  .hero-card-info small {
    font-size: 10px;
  }
  .hero-card-info > span {
    display: none;
  }
  .deck-label {
    width: 85px;
  }
  .deck-label strong {
    font-size: 14px;
  }
  .deck-label > span,
  .deck-label button {
    font-size: 11px;
  }
  .phase-command {
    width: 177px;
  }
  .phase-steps {
    margin: 3px 0 5px;
    font-size: 10px;
    gap: 4px;
  }
  .phase-steps span {
    padding: 1px 4px;
  }
  .next-button {
    padding: 7px;
    font-size: 15px;
  }
  .phase-command > span {
    font-size: 10px;
  }
  .phase-command > small {
    font-size: 10px;
  }
  .territory-army {
    margin: 3px 0 8px;
  }
  .territory-army strong {
    font-size: 35px;
  }
  .quantity-control {
    margin: 5px 0;
  }
  .overlay {
    padding: 16px;
  }
  .dialog {
    max-height: calc(100dvh - 24px);
    padding: 14px 20px;
  }
  .dialog > header {
    padding-bottom: 8px;
    margin-bottom: 10px;
  }
  .dialog > header h2 {
    font-size: 20px;
  }
  .hero-detail-layout {
    grid-template-columns: 130px 1fr;
    gap: 14px;
  }
  .hero-detail-side {
    gap: 4px;
  }
  .detail-portrait {
    width: 120px;
    height: 120px;
    aspect-ratio: 1;
    border-image-width: 10px;
  }
  .hero-cost-info {
    font-size: 11px;
    margin: 0 0 2px;
    line-height: 1.3;
  }
  .hero-detail-actions button {
    padding: 6px 10px;
    font-size: 12px;
    margin-top: 3px;
  }
  .skill-description {
    padding: 0 0 10px;
    margin: 0 0 10px;
  }
  .skill-description h3 {
    font-size: 16px;
    gap: 8px;
  }
  .skill-description p {
    font-size: 12px;
    line-height: 1.6;
    margin: 0 0 6px;
  }
  .exchange-preview {
    margin: 4px 0 8px;
    gap: 18px;
  }
  .exchange-preview strong {
    font-size: 36px;
    line-height: 1.1;
  }
  .exchange-preview svg {
    width: 22px;
    height: 22px;
  }
  .dialog .quantity-control {
    margin: 6px 0 4px;
  }
  .market-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
  }
  .market-card {
    min-height: 125px;
  }
  .market-card .hero-card-info {
    left: 6px;
    bottom: 8px;
  }
  .market-card .hero-card-info strong {
    font-size: 18px;
  }
  .market-card .hero-card-info > span {
    font-size: 10px;
  }
  .market-card .hero-card-info small,
  .card-price {
    font-size: 10px;
  }
  .battle-preview .portrait {
    width: 96px;
    height: 96px;
    aspect-ratio: 1;
  }
  .battle-preview h3 {
    font-size: 17px;
  }
  .battle-verdict {
    margin: 10px 0;
  }
  .battle-verdict strong {
    font-size: 22px;
  }
  .die {
    width: 48px;
    height: 48px;
  }
  .die strong {
    font-size: 22px;
  }
  .battle-hero-side {
    max-width: 22vw;
  }
  .battle-bust-wrap {
    max-height: 42vh;
  }
  .battle-bust-img {
    max-height: 40vh;
  }
  .battle-center-arena {
    padding: 10px 16px;
    max-width: 420px;
  }
  .dice-row {
    gap: 6px;
    margin: 4px 0 6px;
  }
  .modifier-list {
    max-height: 55px;
  }
  .battle-dialog > h2,
  .battle-header h2 {
    font-size: 20px;
    margin-bottom: 4px;
  }
  .toast {
    bottom: 110px;
  }
  .capital-note {
    padding-top: 7px;
  }
  .ai-standard svg {
    height: 28px;
    width: 28px;
    margin: 0 0 8px;
  }
}
@media (max-width: 900px) and (orientation: landscape) {
  .war-header nav button {
    font-size: 10px;
    padding: 4px;
  }
  .resources {
    gap: 9px;
  }
  .resources svg {
    display: none;
  }
  .round-weather b {
    font-size: 11px;
  }
  .round-weather button {
    font-size: 10px;
  }
  .war-header {
    gap: 12px;
  }
  .home-header .wordmark {
    font-size: 22px;
  }
  .home-header nav {
    gap: 0;
  }
  .home-header nav button {
    font-size: 11px;
    padding: 6px;
  }
  .home-copy h1 {
    font-size: 34px;
  }
  .home-layout {
    grid-template-columns: 185px 1fr;
    gap: 22px;
  }
  .home-lead {
    display: none;
  }
  .faction-card-copy small {
    font-size: 10px;
  }
  .faction-card-copy strong {
    font-size: 21px;
  }
  .home-footer {
    height: 25px;
  }
  .faction-grid {
    max-height: calc(100dvh - 100px);
  }
  .chosen-faction {
    margin-top: 12px;
  }
  .war-layout {
    grid-template-columns: 78px minmax(0, 1fr) 162px;
  }
  .roster-row .portrait {
    display: none;
  }
  .roster-row {
    padding: 6px 5px;
  }
  .roster-row strong {
    font-size: 11px;
  }
  .command-panel {
    padding: 9px;
  }
  .war-header .wordmark {
    font-size: 16px;
  }
  .round-weather svg {
    width: 15px;
  }
  .war-header nav button:first-child svg {
    display: none;
  }
  .war-footer {
    gap: 9px;
    padding: 6px 9px;
  }
  .deck-label {
    width: 74px;
  }
  .active-deck {
    gap: 5px;
  }
  .hero-card.deck,
  .empty-card {
    width: 64px;
  }
  .phase-command {
    width: 151px;
  }
  .phase-steps {
    gap: 10px;
  }
  .hero-card-info strong {
    font-size: 14px;
  }
  .map-caption span:last-child {
    display: none;
  }
  .rules-grid {
    gap: 12px 20px;
  }
}
@media (orientation: portrait) and (max-width: 800px) {
  .home-header [data-action="manual-landscape"] { display: inline-block; }
  /* 竖屏主页适配：单列流式排版，大触控热区 */
  .home-screen {
    min-width: 0;
    width: 100%;
    height: auto;
    min-height: 100dvh;
    padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .home-header {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
  }
  .home-header .wordmark {
    font-size: 20px;
  }
  .home-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    width: 100%;
  }
  .home-header nav button {
    font-size: 11px;
    padding: 5px 9px;
    min-height: 32px;
  }
  .home-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    width: 100%;
  }
  .home-copy {
    width: 100%;
    min-width: 0;
  }
  .home-copy h1 {
    font-size: 22px;
    margin-bottom: 4px;
  }
  .home-lead {
    display: none;
  }
  .chosen-faction {
    margin: 8px 0;
    gap: 10px;
  }
  .chosen-faction h2 {
    font-size: 18px;
  }
  .faction-note {
    font-size: 11px;
    margin-bottom: 8px;
    line-height: 1.5;
  }
  .start-button {
    width: 100%;
    min-height: 46px;
    font-size: 16px;
    margin: 8px 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .faction-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: none;
    height: auto;
    width: 100%;
  }
  .faction-card {
    min-height: 110px;
    height: 110px;
  }
  .faction-card-copy strong {
    font-size: 18px;
  }
  .home-footer {
    height: auto;
    padding: 12px 0;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    text-align: center;
  }

  /* 竖屏沙盘对战适配：垂直三段布局，顶栏-地图-操作令 */
  .war-screen {
    min-width: 0;
    width: 100vw;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .war-header {
    height: auto;
    min-height: 44px;
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  .war-header .wordmark {
    font-size: 15px;
  }
  .resources {
    gap: 8px;
    font-size: 11px;
  }
  .resources strong {
    font-size: 15px;
  }
  .resources > span > span {
    font-size: 9px;
  }
  .round-weather {
    gap: 4px;
  }
  .round-weather b {
    font-size: 11px;
    padding: 2px 6px;
  }
  .war-header nav {
    gap: 3px;
  }
  .war-header nav button {
    font-size: 10px;
    padding: 3px 6px;
  }
  .war-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: transparent;
  }
  .faction-roster {
    display: none;
  }
  .canvas-wrap {
    flex: 1;
    min-height: 200px;
    width: 100%;
    position: relative;
  }
  .canvas-wrap canvas {
    touch-action: none;
  }
  .command-panel {
    max-height: 38dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px;
    font-size: 12px;
    border-top: 1px solid #7c683e;
    border-left: none;
    background: rgba(18, 28, 25, 0.95);
  }
  .command-panel h2 {
    font-size: 17px;
    margin-bottom: 6px;
  }
  .hud-deck {
    height: 68px;
    padding: 3px;
    gap: 4px;
  }
  .hud-deck .card {
    width: 46px;
    height: 60px;
  }

  /* 竖屏弹窗适配 */
  .overlay {
    padding: 10px;
  }
  .dialog {
    padding: 14px 12px;
    max-height: calc(100dvh - 20px);
    width: 100%;
    border-radius: 6px;
  }
  .dialog > header h2 {
    font-size: 18px;
  }
  .hero-detail-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .detail-portrait {
    width: 90px;
    height: 90px;
    margin: 0 auto;
  }
  .rules-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .battle-stage {
    flex-direction: column;
    gap: 8px;
  }
  .battle-hero-side {
    max-width: 100%;
    width: 100%;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }
  .battle-bust-wrap {
    max-height: 18vh;
  }
  .battle-bust-img {
    max-height: 16vh;
  }
  .battle-center-arena {
    padding: 8px;
    max-width: 100%;
  }
  .dice-row {
    gap: 4px;
  }
  .die {
    width: 40px;
    height: 40px;
  }
  .die strong {
    font-size: 18px;
  }

  /* 旋转建议横幅：仅在对战中浮显，且可点击关闭进入竖屏对战 */
  .rotate-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 99;
    inset: 0;
    background: rgba(14, 22, 19, 0.94);
    padding: 24px;
    text-align: center;
    gap: 12px;
    color: #ecdaa9;
    font: 20px var(--display);
    backdrop-filter: blur(8px);
  }
  .rotate-hint small {
    font: 13px var(--body);
    color: #c5ccb8;
    max-width: 260px;
    line-height: 1.5;
  }
  .rotate-dismiss-btn {
    margin-top: 10px;
    padding: 10px 24px;
    font-size: 14px;
    background: rgba(40, 60, 50, 0.9);
    border: 1px solid #c3a879;
    color: #f7e6ca;
    border-radius: 4px;
    cursor: pointer;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
.map-zoom-control {
  font-size: 10px;
  padding: 3px 7px;
  white-space: nowrap;
}
.canvas-wrap.zoomed {
  overflow: auto;
  justify-content: flex-start;
  align-items: flex-start;
  touch-action: pan-x pan-y;
}
.canvas-wrap.zoomed .sand-map-canvas {
  width: 1100px;
  height: 623px;
  max-height: none;
  flex-shrink: 0;
  touch-action: pan-x pan-y;
}
.skill-runtime {
  font-size: 11px;
  color: #4b3e2a;
  background: rgba(186, 161, 121, 0.22);
  border-left: 3px solid #8e744a;
  padding: 4px 8px;
  margin: 6px 0 10px;
  border-radius: 0 2px 2px 0;
  display: inline-block;
  font-family: var(--display);
}
.mobile-roster-control {
  display: none;
}
.roster-dialog .faction-roster {
  display: flex;
  flex-direction: column;
  border: 0;
  background: #172920;
  padding: 12px;
}
.roster-dialog .roster-row {
  min-height: 70px;
}
@media (max-width: 900px) and (orientation: landscape) {
  .mobile-roster-control {
    display: inline-flex;
  }
  .map-bottom > span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .war-screen {
    grid-template-rows: 43px minmax(0, 1fr) 76px;
  }
  .war-layout {
    grid-template-columns: minmax(0, 1fr) 148px;
  }
  .faction-roster {
    display: none;
  }
  .war-footer {
    gap: 9px;
  }
  .active-deck {
    height: 62px;
  }
  .hero-card.deck,
  .empty-card {
    width: 67px;
    height: 62px;
  }
  .hero-card.deck .portrait {
    width: 62px;
    height: 62px;
    aspect-ratio: 1;
  }
  .hero-card-info small {
    display: none;
  }
  .empty-card {
    font-size: 10px;
  }
  .hero-card-info strong {
    font-size: 13px;
  }
  .phase-steps {
    margin: 0 0 3px;
  }
  .phase-command > span {
    display: none;
  }
  .next-button {
    font-size: 14px;
    padding: 6px;
  }
  .map-bottom {
    height: 22px;
  }
  .map-caption {
    padding: 4px 9px;
  }
  .canvas-wrap.zoomed .sand-map-canvas {
    width: 900px;
    height: 510px;
  }
  .war-header .resources strong {
    font-size: 18px;
  }
}

/* 聚贤馆名录图鉴 */
.gallery-dialog { width: 1080px; max-width: 95vw; }
.gallery-wrapper { display: flex; flex-direction: column; gap: 14px; }
.gallery-sub { margin: 0; color: #62543c; font-size: 14px; }
.gallery-filters { display: flex; flex-wrap: wrap; gap: 16px; background: #e5d8bb; padding: 10px 14px; border-radius: 4px; border: 1px solid #aa966c; }
.gallery-filters .filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gallery-filters .filter-group small { color: #62543c; font-weight: bold; }
.gallery-filters button { padding: 4px 10px; font-size: 13px; background: #efe6d0; border: 1px solid #806d46; color: #20312f; border-radius: 2px; cursor: pointer; }
.gallery-filters button.active { background: #20312f; color: #efe6d0; border-color: #20312f; }
.gallery-count { font-size: 13px; color: #62543c; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.gallery-card { background: #efe6d0; border: 1px solid #aa966c; border-radius: 4px; padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.gallery-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border-color: #806d46; }
.gallery-card-header { display: flex; gap: 10px; align-items: center; }
.gallery-card-header .portrait { width: 52px; height: 52px; border-radius: 4px; border: 1px solid #806d46; aspect-ratio: 1; object-fit: cover; }
.gallery-title-row { display: flex; align-items: center; gap: 8px; }
.gallery-title-row strong { font-size: 16px; color: #20312f; }
.lord-tag { font-size: 11px; padding: 1px 5px; background: #c3a879; color: #101715; border-radius: 2px; font-weight: bold; }
.gallery-stars { color: #806d46; font-size: 13px; letter-spacing: 2px; }
.gallery-skills { display: flex; flex-direction: column; gap: 6px; font-size: 12px; line-height: 1.4; border-top: 1px dashed #aa966c; padding-top: 6px; }
.gallery-skills b { color: #20312f; }
.skill-tag { font-size: 10px; padding: 1px 4px; background: #dfd2b5; border: 1px solid #aa966c; border-radius: 2px; color: #62543c; }
.gallery-skills p { margin: 2px 0 0; color: #404f4a; }
.gallery-quote { margin: 4px 0 0; padding: 6px 8px; background: #e5d8bb; border-left: 3px solid #806d46; font-size: 12px; font-style: italic; color: #20312f; border-radius: 0 2px 2px 0; }
.gallery-quote small { display: block; text-align: right; font-size: 10px; color: #806d46; font-style: normal; margin-top: 2px; }

/* 战役军情简报 */
.briefing-dialog { width: 720px; max-width: 95vw; }
.briefing-content { display: flex; flex-direction: column; gap: 16px; font-size: 14px; line-height: 1.6; color: #20312f; }
.briefing-section { background: #efe6d0; border: 1px solid #aa966c; border-radius: 4px; padding: 12px 16px; }
.briefing-section h3 { margin: 0 0 6px; color: #806d46; font-size: 16px; font-family: var(--display); }
.briefing-section p { margin: 0; }
.briefing-actions { display: flex; justify-content: flex-end; margin-top: 6px; }

/* 统帅生涯与战役成就 */
.career-dialog { width: 840px; max-width: 95vw; }
.career-content { display: flex; flex-direction: column; gap: 16px; color: #20312f; }
.career-hero-card { background: #efe6d0; border: 1px solid #aa966c; border-radius: 4px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.rank-badge { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.rank-badge h2 { margin: 0; font-family: var(--display); font-size: 24px; color: #806d46; }
.rank-badge p { margin: 0; color: #62543c; font-size: 14px; }
.merit-badge { background: #20312f; color: #efe6d0; padding: 4px 10px; border-radius: 4px; font-size: 14px; }
.merit-badge b { color: #c3a879; font-size: 16px; margin-left: 4px; }
.rank-progress-wrap { background: #dfd2b5; border-radius: 3px; height: 8px; overflow: hidden; position: relative; margin-top: 4px; }
.rank-progress-bar { background: #806d46; height: 100%; transition: width 0.3s ease; }
.career-hero-card small { display: block; text-align: right; color: #62543c; font-size: 12px; margin-top: 4px; }
.career-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.career-stats-grid article { background: #efe6d0; border: 1px solid #aa966c; border-radius: 4px; padding: 10px; text-align: center; }
.career-stats-grid small { display: block; color: #62543c; font-size: 12px; }
.career-stats-grid strong { display: block; font-size: 18px; margin-top: 4px; color: #20312f; }
.career-section h3 { margin: 0 0 8px; font-size: 15px; color: #806d46; font-family: var(--display); border-bottom: 1px solid #aa966c; padding-bottom: 4px; }
.scenario-records { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.scenario-records article { background: #efe6d0; border: 1px solid #aa966c; border-radius: 4px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.scenario-records strong { font-size: 15px; color: #20312f; }
.scenario-records span { font-size: 13px; color: #404f4a; }
.scenario-records small { font-size: 11px; color: #62543c; }
.factions-mastery { display: flex; flex-wrap: wrap; gap: 8px; }
.faction-mastery-chip { background: #efe6d0; border: 1px solid #aa966c; border-radius: 3px; padding: 4px 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.faction-mastery-chip b { color: #806d46; }
.achievements-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; max-height: 40vh; overflow-y: auto; padding-right: 4px; }
.achievement-item { background: #efe6d0; border: 1px solid #aa966c; border-radius: 4px; padding: 10px; display: flex; gap: 10px; align-items: flex-start; }
.achievement-item.locked { opacity: 0.6; filter: grayscale(0.5); }
.achievement-item.unlocked { border-color: #806d46; background: #f4ecdc; box-shadow: 0 2px 6px rgba(128,109,70,0.15); }
.ach-icon { font-size: 22px; flex-shrink: 0; }
.ach-body { flex: 1; min-width: 0; font-size: 12px; }
.ach-title-row { display: flex; justify-content: space-between; align-items: center; }
.ach-title-row strong { font-size: 14px; color: #20312f; }
.ach-reward { color: #806d46; font-weight: bold; }
.ach-body p { margin: 2px 0 4px; color: #52634e; }
.ach-time { color: #806d46; font-size: 10px; }
/* 终局战功盒子 */
.merit-box { background: #e5d8bb; border: 1px solid #806d46; border-radius: 4px; padding: 12px; margin: 12px 0; text-align: left; }
.merit-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; border-bottom: 1px dashed #aa966c; padding-bottom: 6px; margin-bottom: 8px; }
.merit-items { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: #404f4a; }
.achievements-unlocked { margin-top: 8px; border-top: 1px dashed #aa966c; padding-top: 6px; }
.achievements-unlocked p { margin: 2px 0; font-size: 13px; }
.achievements-unlocked em { color: #806d46; font-style: normal; font-weight: bold; margin-left: 6px; }

/* 战功百宝阁 */
.treasury-dialog { width: 880px; max-width: 95vw; }
.treasury-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.treasury-header-row p { margin: 0; color: #404f4a; font-size: 14px; }
.treasury-header-row .merit-badge { font-size: 14px; }
.treasury-section { margin-bottom: 16px; }
.treasury-section h3 { margin: 0 0 10px; font-size: 15px; color: #806d46; font-family: var(--display); border-bottom: 1px solid #aa966c; padding-bottom: 4px; }
.treasury-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.treasury-card { background: #efe6d0; border: 1px solid #aa966c; border-radius: 4px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; transition: transform 0.15s ease; }
.treasury-card.equipped { border-color: #806d46; background: #f5eedf; box-shadow: 0 0 0 2px #806d46; }
.treasury-card-top { display: flex; gap: 10px; align-items: flex-start; }
.treasury-icon { font-size: 26px; flex-shrink: 0; line-height: 1; }
.treasury-info { flex: 1; min-width: 0; }
.treasury-info strong { display: block; font-size: 14px; color: #20312f; }
.treasury-info p { margin: 4px 0 0; font-size: 12px; color: #52634e; line-height: 1.4; }
.treasury-card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; border-top: 1px dashed #cbb282; padding-top: 6px; }
.treasury-cost { font-size: 12px; color: #806d46; font-weight: bold; }
.treasury-status-equipped { font-size: 12px; color: #3d6840; font-weight: bold; background: #dceada; padding: 2px 8px; border-radius: 3px; }

/* 百宝阁外观定制生效规则 */
body[data-theme="theme-ember"] .canvas-wrap canvas { filter: sepia(0.2) saturate(1.15) contrast(1.05); }
body[data-theme="theme-ember"] .war-screen { background-color: #171110; }
body[data-theme="theme-obsidian"] .canvas-wrap canvas { filter: contrast(1.1) brightness(0.95); }
body[data-theme="theme-obsidian"] .war-screen { background-color: #0b1110; }

body[data-dice="dice-bronze"] .die { background: linear-gradient(135deg, #443c2c, #2b251a); border-color: #8f7949; }
body[data-dice="dice-bronze"] .die strong { color: #f0e2ca; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
body[data-dice="dice-bronze"] .die small { color: #b1a080; }

body[data-dice="dice-ebony"] .die { background: linear-gradient(135deg, #1f2422, #101514); border-color: #c3a879; box-shadow: 0 4px 10px rgba(0,0,0,0.6), inset 0 0 8px rgba(195,168,121,0.2); }
body[data-dice="dice-ebony"] .die strong { color: #f4d38e; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
body[data-dice="dice-ebony"] .die small { color: #d0ba8f; }

body[data-seal="seal-gold"] .seal { box-shadow: 0 0 0 1px #d4af37, 0 2px 4px rgba(0,0,0,0.4); border-color: #d4af37; }
body[data-seal="seal-jade"] .seal { box-shadow: 0 0 0 1px #4e8875, 0 2px 4px rgba(0,0,0,0.4); border-color: #4e8875; }

/* 移动端横屏专属优化：适用于所有高度 <= 520px 的横屏手机（iPhone / Android / 折叠屏） */
@media (max-height: 520px) and (orientation: landscape) {
  /* 1. 安全区域与全局适配：避开刘海、灵动岛与底部手势条 */
  .home-screen,
  .war-screen,
  .overlay {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  /* 2. 主公选择主页：双列紧凑排版，全屏 0 滚动 */
  .home-screen {
    min-height: 0;
    height: 100dvh;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
  .home-header {
    height: 38px;
    padding: 0 4px;
  }
  .home-header .wordmark {
    font-size: 16px;
  }
  .home-header nav {
    gap: 3px;
  }
  .home-header nav button {
    font-size: 11px;
    padding: 3px 6px;
  }
  .home-footer {
    height: 22px;
    font-size: 10px;
    line-height: 22px;
    padding: 0 4px;
  }
  .home-layout {
    grid-template-columns: 180px 1fr;
    gap: 14px;
    height: calc(100dvh - 60px);
    align-items: center;
  }
  .home-copy h1 {
    font-size: 22px;
    margin-bottom: 2px;
  }
  .home-lead {
    display: none;
  }
  .chosen-faction {
    margin: 4px 0 2px;
    gap: 6px;
  }
  .seal {
    width: 32px;
    height: 34px;
    font-size: 18px;
  }
  .chosen-faction h2 {
    font-size: 15px;
  }
  .chosen-faction p {
    font-size: 10px;
  }
  .faction-note {
    font-size: 10px;
    margin-bottom: 4px;
    line-height: 1.3;
  }
  .start-button {
    padding: 6px 12px;
    font-size: 13px;
  }
  .storage-note {
    font-size: 9px;
    margin-top: 2px;
  }
  .faction-grid {
    max-height: calc(100dvh - 66px);
    height: 100%;
    gap: 6px;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .faction-card {
    border-radius: 3px;
    min-height: 0;
    height: 100%;
  }
  .faction-card-copy {
    left: 6px;
    bottom: 4px;
  }
  .faction-card-copy strong {
    font-size: 16px;
  }
  .faction-card-copy small {
    font-size: 9px;
  }
  .faction-card-copy > span {
    display: none;
  }

  /* 3. 沙盘对战界面：最大化沙盘可视区域，紧凑指令与手牌栏 */
  .war-screen {
    min-height: 0;
    height: 100dvh;
    grid-template-rows: 34px minmax(0, 1fr) 48px;
    padding-left: 0;
    padding-right: 0;
  }
  .war-header {
    height: 34px;
    gap: 8px;
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }
  .war-header .wordmark {
    font-size: 14px;
  }
  .resources {
    gap: 6px;
  }
  .resources strong {
    font-size: 14px;
  }
  .resources small {
    font-size: 9px;
  }
  .resources svg {
    display: none;
  }
  .round-weather {
    gap: 4px;
  }
  .round-weather b {
    font-size: 10px;
    padding: 2px 5px;
  }
  .round-weather button {
    font-size: 9px;
    padding: 2px 5px;
  }
  .round-weather button svg {
    display: none;
  }
  .war-header nav {
    gap: 3px;
  }
  .war-header nav button {
    font-size: 10px;
    padding: 2px 4px;
  }
  .war-header nav button svg {
    display: none;
  }
  .war-layout {
    grid-template-columns: minmax(0, 1fr) 130px;
  }
  .faction-roster {
    display: none;
  }
  .mobile-roster-control {
    display: inline-flex;
  }
  .map-caption {
    padding: 2px 6px;
    font-size: 10px;
  }
  .map-caption span:first-child {
    font-size: 11px;
  }
  .map-bottom {
    height: 20px;
    font-size: 10px;
    padding: 2px 6px;
  }
  .map-bottom button {
    font-size: 9px;
    padding: 1px 4px;
  }
  .command-panel {
    padding: 6px 8px;
    font-size: 10px;
  }
  .command-panel h2 {
    font-size: 14px;
    margin-bottom: 2px;
  }
  .command-panel .instruction {
    font-size: 10px;
    line-height: 1.35;
    margin-bottom: 4px;
  }
  .reserve-count {
    font-size: 20px;
    margin: 1px 0 4px;
  }
  .territory-army {
    margin: 2px 0 4px;
    gap: 4px;
  }
  .territory-army strong {
    font-size: 24px;
  }
  .turn-quotas {
    margin: 3px 0;
    font-size: 9px;
    padding-top: 3px;
    gap: 6px;
  }
  .command-panel button {
    padding: 4px 6px;
    font-size: 10px;
    min-height: 26px;
  }
  .quantity-control {
    margin: 3px 0;
  }
  .quantity-control button {
    padding: 4px 6px;
    font-size: 10px;
    min-width: 24px;
  }
  .quantity-control input {
    font-size: 14px;
  }
  .capital-note {
    font-size: 9px;
    padding-top: 3px;
  }
  .panel-bottom {
    display: none;
  }
  .target-list button {
    padding: 4px 6px;
    font-size: 10px;
  }

  /* 4. 底部将牌与阶段控制 */
  .war-footer {
    height: 48px;
    gap: 6px;
    padding: 2px max(12px, env(safe-area-inset-right)) 2px max(12px, env(safe-area-inset-left));
  }
  .deck-label {
    width: 58px;
  }
  .deck-label strong {
    font-size: 11px;
  }
  .deck-label > span {
    display: none;
  }
  .deck-label button {
    font-size: 9px;
    padding: 2px 0;
  }
  .active-deck {
    height: 42px;
    gap: 4px;
  }
  .hero-card.deck,
  .empty-card {
    width: 48px;
    height: 42px;
  }
  .hero-card.deck .portrait {
    width: 42px;
    height: 42px;
  }
  .hero-card-info {
    left: 3px;
    bottom: 2px;
    right: 2px;
  }
  .hero-card-info strong {
    font-size: 11px;
  }
  .hero-card-info small,
  .hero-card-info > span {
    display: none;
  }
  .empty-card {
    font-size: 9px;
    padding: 2px;
  }
  .phase-command {
    width: 115px;
  }
  .phase-steps {
    margin: 0 0 2px;
    font-size: 8px;
    gap: 2px;
  }
  .phase-steps span {
    padding: 0 2px;
  }
  .phase-command > span,
  .phase-command > small {
    display: none;
  }
  .next-button {
    font-size: 12px;
    padding: 4px 6px;
    min-height: 28px;
  }

  /* 5. 弹窗与对决结算：控制高度避免被切断 */
  .overlay {
    padding: 4px max(14px, env(safe-area-inset-right)) 4px max(14px, env(safe-area-inset-left));
  }
  .dialog {
    max-height: calc(100dvh - 10px);
    padding: 8px 12px;
    overflow-y: auto;
  }
  .dialog > header {
    padding-bottom: 4px;
    margin-bottom: 6px;
    gap: 8px;
  }
  .dialog > header h2 {
    font-size: 16px;
  }
  .dialog p {
    line-height: 1.4;
    font-size: 11px;
    margin: 4px 0;
  }
  .dialog button {
    padding: 4px 8px;
    font-size: 11px;
  }
  .battle-stage {
    min-height: 0;
    max-height: calc(100dvh - 44px);
  }
  .battle-hero-side {
    width: 80px;
    max-width: 14vw;
  }
  .battle-bust-wrap {
    max-height: 26vh;
  }
  .battle-bust-img {
    max-height: 24vh;
  }
  .battle-hero-tag {
    padding: 2px 6px;
    margin-top: 2px;
  }
  .battle-hero-tag strong {
    font-size: 11px;
  }
  .battle-hero-tag .hero-tag-title {
    font-size: 9px;
  }
  .battle-center-arena {
    padding: 6px 10px;
    max-width: 360px;
  }
  .die {
    width: 40px;
    height: 40px;
    border-radius: 5px;
  }
  .die strong {
    font-size: 18px;
  }
  .die small {
    font-size: 8px;
  }
  .battle-verdict {
    margin: 3px 0;
  }
  .battle-verdict strong {
    font-size: 16px;
  }
  .battle-verdict span {
    font-size: 10px;
  }
  .modifier-list {
    max-height: 44px;
    font-size: 10px;
    padding: 2px 0;
  }
  .battle-actions {
    margin-top: 4px;
  }
  .market-dialog {
    max-width: 96vw;
  }
  .market-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }
  .market-card {
    min-height: 80px;
  }
  .market-card .hero-card-info strong {
    font-size: 12px;
  }
  .gallery-dialog {
    max-width: 96vw;
  }
  .gallery-grid {
    max-height: 48vh;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .career-dialog {
    max-width: 96vw;
  }
  .achievements-list {
    max-height: 32vh;
  }
  .treasury-dialog {
    max-width: 96vw;
  }
  .treasury-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .draft-card .portrait {
    max-height: 90px;
  }
  .draft-skills {
    padding: 4px;
    font-size: 10px;
  }
  .draft-skills h3 {
    font-size: 12px;
    margin: 4px 0 2px;
  }
}

