.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.resource-ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  margin-bottom: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #181a17;
  box-shadow: var(--shadow);
}

.resource-ledger div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-width: 0;
  font-size: 10.5px;
}

.resource-ledger .ledger-divider {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.resource-ledger span {
  color: var(--muted);
}

.resource-ledger strong {
  color: #dfc98f;
  font-size: 12px;
}

.summary-card,
.selection-card,
.list-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  box-shadow: var(--shadow);
}

.summary-card {
  min-width: 0;
  padding: 7px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  overflow: hidden;
  font-size: 9px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.mode-button {
  min-height: 82px;
  padding: 8px;
  font-size: 12px;
  text-align: left;
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  align-content: center;
  gap: 8px;
}

.mode-button.active {
  color: var(--text);
  background: #3a3a31;
  border-color: var(--gold);
}

.mode-button strong {
  color: #e5d7ae;
  font-size: 13px;
}

.mode-glyph,
.action-glyph {
  display: grid;
  place-items: center;
  width: 72px;
  height: 58px;
  border: 1px solid rgba(195, 164, 99, 0.38);
  border-radius: 4px;
  background: #171916;
  color: #c3a463;
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 2px rgba(195, 164, 99, 0.06);
}

.catalog-art {
  display: block;
  overflow: hidden;
  border: 1px solid rgba(195, 164, 99, 0.34);
  border-radius: 4px;
  background-color: #171916;
  background-image: url("../assets/ui/kingdom-works-catalog.png");
  background-repeat: no-repeat;
  background-position: var(--catalog-x) var(--catalog-y);
  background-size: 500% auto;
  box-shadow: inset 0 0 0 1px rgba(238, 212, 150, 0.08);
}

.mode-art {
  width: 72px;
  aspect-ratio: 1.76;
  align-self: center;
}

.mode-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mode-button small {
  color: #d9c783;
  font-size: 11px;
  line-height: 1.2;
}

.mode-benefit {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
}

.mode-button.active strong,
.mode-button.active small,
.mode-button.active .mode-benefit {
  color: #eee6d2;
}

.hint {
  min-height: 38px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.castle-style-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.castle-style-grid:empty {
  display: none;
}

.castle-style-grid h3 {
  margin: 2px 0 0;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.castle-option {
  width: 100%;
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 9px;
  padding: 8px;
  text-align: left;
}

.castle-option.selected {
  border-color: var(--gold);
  background: #34342d;
  box-shadow: inset 0 0 0 1px rgba(230, 196, 103, 0.28);
}

.castle-emblem {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(230, 196, 103, 0.28);
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(195, 164, 99, 0.1), transparent 55%), #171916;
  color: #c3a463;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
}

.castle-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.castle-option strong {
  color: #fff4c4;
  font-size: 12px;
}

.castle-option small {
  font-size: 10.5px;
  line-height: 1.2;
}

.stack-list {
  display: grid;
  gap: 8px;
}

.online-panel {
  display: grid;
  gap: 8px;
}

.online-disconnected,
.online-command,
.army-muster,
.online-army,
.world-dispatches {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1c1f1b;
}

.online-disconnected span,
.online-command small,
.ruler-row small,
.online-army p,
.world-dispatches p {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.online-command > header,
.army-muster > header,
.online-army > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.online-command > header > span,
.ruler-row > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.online-command > header button {
  min-height: 25px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 9px;
}

.online-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.online-stats span {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid #35372f;
  background: #151714;
  color: var(--muted);
  font-size: 9.5px;
}

.online-stats strong {
  color: #ddc786;
}

.trade-switch {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px;
  text-align: left;
  border-color: #6f473e;
  background: #2b201d;
}

.trade-switch.active {
  border-color: #596f48;
  background: #20291d;
}

.trade-switch small {
  font-weight: 400;
}

.profile-sync {
  min-height: 30px;
  font-size: 10px;
}

.ruler-roster {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #171916;
}

.ruler-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 8px;
  border-bottom: 1px solid #30322b;
}

.ruler-row:last-child {
  border-bottom: 0;
}

.ruler-row.self {
  background: #26271f;
}

.ruler-row > i {
  width: 8px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 2px;
  background: var(--ruler-color);
}

.ruler-row strong,
.ruler-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ruler-row em {
  font-size: 9px;
  font-style: normal;
}

.ruler-row em.online {
  color: #9fbd80;
}

.ruler-row em.offline {
  color: #77776f;
}

.army-muster input,
.army-muster select,
.online-army input,
.online-army select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
  background: #10130f;
  color: var(--text);
  font-size: 11px;
}

.army-muster button,
.online-army > button {
  min-height: 33px;
  font-size: 10.5px;
}

.online-armies {
  display: grid;
  gap: 7px;
}

.online-army header span {
  color: #d5c184;
  font-size: 9px;
}

.army-meter {
  overflow: hidden;
  height: 5px;
  border-radius: 3px;
  background: #0e100d;
}

.army-meter span {
  display: block;
  height: 100%;
  background: #8e9d69;
}

.inline-order {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
}

.inline-order button {
  min-height: 32px;
  font-size: 9px;
}

.world-dispatches p {
  padding-top: 6px;
  border-top: 1px solid #30322b;
}

.list-card {
  padding: 10px;
}

.list-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.list-card strong {
  font-size: 13px;
}

.list-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.list-card button {
  width: 100%;
  min-height: 32px;
  margin-top: 8px;
  font-size: 12px;
}

.action-button {
  width: 100%;
  min-height: 50px;
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  text-align: left;
}

.action-button.with-icon {
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 92px;
}

.action-glyph {
  width: 62px;
  height: 58px;
  font-size: 14px;
}

.action-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  font-weight: 400;
}

.action-button > span:not(.action-copy),
.action-button strong {
  font-weight: 700;
}

.action-button small,
.action-button em {
  display: block;
  font-style: normal;
  line-height: 1.25;
  font-size: 11px;
}

.action-button small {
  color: var(--muted);
}

.benefit-line {
  color: #d9c783;
}

.action-button.compact {
  min-height: 38px;
}

.blocked-reason {
  color: #ffb9ac;
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #131511;
  margin-top: 8px;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7c8968, #c3a463);
}

.project-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 7px 0 5px;
  color: #e7d497;
  font-size: 11px;
}

.project-stage span {
  color: #b8c4b1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.selection-card {
  min-height: 148px;
  padding: 12px;
}

.selection-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.selection-card dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 5px 8px;
  margin: 0;
  font-size: 12px;
}

.selection-card dt {
  color: var(--muted);
}

.selection-actions {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.heraldry-editor {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(225, 194, 108, 0.28);
  border-radius: 6px;
  background: #181a17;
}

.heraldry-editor > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.heraldry-editor > header strong {
  color: var(--gold);
  font-size: 12px;
}

.heraldry-editor > header span,
.heraldry-editor label span {
  color: var(--muted);
  font-size: 10px;
}

.heraldry-name {
  display: grid;
  gap: 4px;
}

.heraldry-name input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  background: #0e150f;
  color: var(--text);
}

.heraldry-name input:focus {
  border-color: var(--gold);
}

.heraldry-colors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.heraldry-colors label {
  display: grid;
  grid-template-columns: 1fr 32px;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.heraldry-colors input[type="color"] {
  width: 32px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0e150f;
  cursor: pointer;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.tag {
  border-radius: 999px;
  padding: 3px 7px;
  background: #111811;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.cost {
  color: var(--gold);
}

.selection-note {
  margin-top: 10px;
  padding: 8px;
  border-radius: 6px;
  background: #181a17;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.section-heading h2 {
  margin-bottom: 6px;
}

.section-heading span {
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-intro {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.catalog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 9px;
}

.catalog-filters button {
  min-height: 27px;
  padding: 0 8px;
  border-radius: 3px;
  color: var(--muted);
  font-size: 10px;
}

.catalog-filters button.active {
  border-color: #b79a5b;
  background: #3a3528;
  color: #f0dfb5;
}

.build-catalog {
  display: grid;
  gap: 10px;
}

.catalog-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #1e211d;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.catalog-card > .catalog-art {
  width: 100%;
  aspect-ratio: 1.76;
  border: 0;
  border-bottom: 1px solid #665b42;
  border-radius: 0;
}

.catalog-copy {
  display: grid;
  gap: 7px;
  padding: 9px 10px 10px;
}

.catalog-copy header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.catalog-copy header strong {
  color: #ead9ad;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
}

.catalog-copy header span {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid #535044;
  border-radius: 3px;
  color: #b9b4a7;
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.catalog-copy p {
  color: #c7c2b6;
  font-size: 11px;
  line-height: 1.4;
}

.catalog-copy dl {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 4px 7px;
  margin: 0;
  font-size: 10px;
  line-height: 1.35;
}

.catalog-copy dt {
  color: var(--faint);
  text-transform: uppercase;
}

.catalog-copy dd {
  margin: 0;
  color: #d7c58f;
}

.catalog-command {
  min-height: 30px;
  border-color: #766641;
  border-radius: 3px;
  background: #302d24;
  color: #eddfb9;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .mode-grid,
  .build-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .mode-grid,
  .build-catalog {
    grid-template-columns: 1fr;
  }
}
