/* Compact, village-first interface. The landing page's parchment, red and gold
   remain; navigation and building controls use plain labels. */
:root { --game-width: 1320px; }
body { background: #e9dfca; font-size: 14px; }
.app { height: 100dvh; overflow: hidden; }
.topbar { min-height: 62px; gap: 18px; padding: 0 max(24px, calc((100vw - var(--game-width)) / 2)); background: var(--wood-dark); color: var(--parchment); border-bottom: 1px solid #6d5231; }
.topbar__brand { width: auto; gap: 10px; font: 500 22px var(--serif); letter-spacing: -.4px; color: #f5ead3; white-space: nowrap; }
.topbar__brand:hover { color: var(--gold); }
.topbar__brand > svg { width: 30px; height: 30px; }
.world-name { color: #c6b18a; border-left: 1px solid #5e4830; padding-left: 16px; font-size: 11px; }
.res-pills { display: flex; justify-content: flex-end; flex: 1; min-width: 0; max-width: none; gap: 22px; }
.res-pill { display: flex; flex-direction: column; align-items: flex-start; gap: 0; min-width: 48px; line-height: 1.5; }
.res-pill__label { font-size: 10px; color: #c7b99d; font-weight: 400; letter-spacing: 0; }
.res-pill strong { font-size: 15px; color: #fff5df; font-weight: 550; letter-spacing: 0; white-space: nowrap; }
.res-pill strong small { font-size: 10px; color: #bbab8c; font-weight: 400; }
.topbar__lord { display: block; width: auto; min-width: 62px; max-width: none; min-height: 36px; padding: 8px 0 8px 18px; margin: 0 0 0 4px; border-left: 1px solid #5e4830; color: #e7d6b8; font-size: 11px; text-align: right; }
.topbar__lord:hover { color: #fff8e8; }
.body { flex-direction: column; min-height: 0; }
.rail { position: static; width: 100%; flex-direction: row; padding: 0 max(24px, calc((100vw - var(--game-width)) / 2)); border: 0; border-bottom: 1px solid #d3c19c; background: #eee2ca; overflow: visible; }
.rail__nav { display: flex; flex-direction: row; gap: 2px; min-height: 46px; }
.nav-item { display: flex; flex-direction: row; justify-content: center; width: auto; min-width: 83px; min-height: 46px; padding: 0 18px; gap: 7px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: #726047; box-shadow: none; }
.nav-item__label { font-size: 13px; font-weight: 500; }
.nav-item:hover { color: var(--garnet); background: #e6d5af60; }
.nav-item.is-active { color: var(--garnet); background: transparent; border: 0; border-bottom: 3px solid var(--garnet); box-shadow: none; }
.nav-item__badge { position: static; margin: 0; background: #8f2c2210; color: var(--garnet); padding: 0 4px; font-size: 10px; min-width: 15px; }
.main { width: 100%; flex: 1; overflow-y: auto; padding: 24px max(24px, calc((100vw - var(--game-width)) / 2)) 32px; background: #f2ebdc; }
.screen, .screen--village, .screen--map { max-width: var(--game-width); }
.screen--narrow { max-width: 1000px; margin-left: 0; }
.screen-head, .screen--village .screen-head { display: flex; align-items: center; flex-wrap: nowrap; gap: 16px; min-height: 36px; margin-bottom: 18px; }
.title { font: 500 28px/1.2 var(--serif); letter-spacing: -.4px; }
.screen-head__extra { display: block; }
.estate-view-tabs { display: flex; padding: 3px; border: 1px solid #d4c5a8; border-radius: 6px; background: #e9dfca; gap: 3px; }
.estate-view-tabs button { min-height: 31px; padding: 5px 15px; border: 0; border-radius: 4px; background: none; color: #79684e; font-size: 12px; }
.estate-view-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--garnet); box-shadow: 0 1px 4px #2b201610; }
.village-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; }
.village-land { background: #667342; border: 1px solid #b6a17b; box-shadow: none; border-radius: 7px; }
.village-stage { min-width: 0; width: 100%; aspect-ratio: 4/3; }
.village-scroll { overflow-x: auto; }
.village-sidebar { display: flex; gap: 16px; }
.village-picker { display: none; }
.village-detail { padding: 22px; border: 1px solid #d1c09e; background: var(--surface); border-radius: 7px; box-shadow: none; }
.village-detail-title { align-items: center; gap: 12px; }
.village-detail h2 { font: 500 24px/1.1 var(--serif); }
.village-detail-level { font-size: 11px; color: #8b7654; white-space: nowrap; margin: 0; }
.village-effect { margin: 18px 0; padding: 14px 0; border-color: var(--line); }
.village-effect small { font-size: 10px; letter-spacing: 0; text-transform: none; color: var(--muted); }
.village-effect strong { font: 500 13px/1.6 var(--sans); }
.village-build-time { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.building-cost { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 0 18px; }
.building-cost > span { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.building-cost > span > span { font-size: 10px; color: var(--muted); }
.building-cost strong { font-size: 13px; color: var(--ink); font-weight: 550; }
.village-detail .building-cost { font-size: 12px; gap: 12px; padding-bottom: 18px; }
.village-detail .upgrade-btn { justify-content: center; font-size: 12px; min-height: 40px; }
.village-detail .btn--primary { background: var(--garnet); border-color: var(--garnet); box-shadow: none; }
.village-recruit { width: 100%; margin-top: 10px; }
.building-help { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 11px; }
.building-help summary { cursor: pointer; width: fit-content; }
.building-help p { font: 400 12px/1.7 var(--sans); margin: 10px 0 0; color: var(--muted); }
.village-tools { text-align: right; }
.village-tools button { color: #8b795b; background: none; border: 0; padding: 2px; font-size: 10px; }
.village-pause-icon { font-size: 10px; margin-right: 6px; }
.village-motion[aria-pressed="false"] { background: none; }
.village-map-caption { display: none; }
.plot-label { padding: 4px 8px; gap: 6px; font: 500 clamp(10px, .95vw, 13px)/1.3 var(--sans); border-radius: 4px; border-color: #ac976c; background: #fcf5e1f0; box-shadow: 0 2px 5px #2b20162b; }
.plot-label small { font-size: 10px; padding-left: 6px; }
.village-plot.is-selected .plot-label { background: var(--garnet); border-color: #e3c37d; box-shadow: 0 2px 6px #2b201640; }
.is-unbuilt .plot-cover { font-size: 11px; border: 1px dashed #d5c38f; background: #b8b083d9; box-shadow: inset 0 0 16px #62613750; }
.is-unbuilt .plot-cover > span { display: none; }
.village-sidebar .panel { background: var(--surface); border-color: var(--line); }
.village-sidebar .panel__head { padding: 12px 16px; font: 600 11px var(--sans); background: #eee6d7; border-color: var(--line); letter-spacing: .2px; }
.village-sidebar .panel__body { padding: 16px; }
.village-sidebar .kv { font-size: 11px; }
.village-progress { margin-top: 0; font-size: 11px; }
.village-progress strong { font-size: 12px; font-weight: 550; }
.building-table-wrap { overflow-x: auto; border: 1px solid #d1c09e; border-radius: 7px; background: var(--surface); }
.building-table { width: 100%; border-collapse: collapse; min-width: 740px; text-align: left; font-size: 12px; }
.building-table th, .building-table td { padding: 13px 16px; border-bottom: 1px solid #e3d9c5; font-variant-numeric: tabular-nums; }
.building-table thead { background: #eaddc2; }
.building-table thead th { font-size: 11px; color: #746044; font-weight: 600; }
.building-table tbody th { font-weight: 550; }
.building-table tbody tr:nth-child(even) { background: #f6f0e4; }
.building-table tbody tr:last-child > * { border-bottom: 0; }
.building-table__name { background: none; border: 0; padding: 2px 0; color: var(--ink); text-align: left; font-weight: 550; }
.building-table__name:hover { color: var(--garnet); text-decoration: underline; }
.building-table__number { color: #756750; }
.building-table__number.is-short { color: var(--garnet); }
.building-table__time { white-space: nowrap; color: #756750; }
.building-table__action { min-width: 160px; }
.building-table .upgrade-btn { justify-content: center; min-height: 31px; margin: 0; font-size: 11px; }
.building-table__status { color: var(--green); font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.map-view { height: clamp(400px, calc(100dvh - 230px), 900px); }
.btn { font-size: 12px; }
.kv { font-size: 12px; }
.live-form label { font-size: 12px; }
.empty-state { padding: 45px 24px; border-style: solid; }
.empty-state h2 { font-size: 23px; }
.profile-screen { margin: 0 auto; }
.auth-shell { flex-shrink: 0; }
@media (max-width: 1080px) {
  .topbar { gap: 14px; padding: 0 22px; }
  .topbar__brand { font-size: 20px; }
  .res-pills { gap: 16px; }
  .world-name { display: none; }
  .main, .rail { padding-left: 22px; padding-right: 22px; }
  .village-layout { grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; }
  .village-detail { padding: 18px; }
  #village-detail { grid-row: auto; }
  .village-stage { min-width: 0; }
}
@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; padding: 13px 18px 10px; gap: 10px; }
  .topbar__brand { flex: 1; font-size: 20px; }
  .topbar__lord { margin: 0; padding: 0; border: 0; min-height: 28px; min-width: 50px; }
  .res-pills { order: 3; flex-basis: 100%; justify-content: space-between; padding-top: 10px; border-top: 1px solid #5e4830; gap: 12px; }
  .res-pill { min-width: 0; }
  .res-pill__label { font-size: 9px; }
  .res-pill strong { font-size: 14px; }
  .rail { padding: 0 18px; }
  .rail__nav { width: 100%; justify-content: space-between; }
  .nav-item { min-width: 0; flex: 1; padding: 0 10px; min-height: 42px; }
  .nav-item__label { font-size: 12px; }
  .main { padding: 20px 18px 32px; }
  .village-layout { grid-template-columns: minmax(0, 1fr); }
  .village-stage { min-width: 0; }
  .village-sidebar { display: flex; }
  .village-picker { display: flex; }
  .village-picker > span { display: none; }
  .village-detail { padding: 20px; }
  .building-cost { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .village-detail .building-cost { padding-bottom: 20px; }
  .village-tools { padding-right: 2px; }
  .title { font-size: 25px; }
  .estate-view-tabs button { padding: 5px 11px; font-size: 11px; }
  .map-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { height: auto; min-height: 100dvh; overflow: visible; }
  .topbar { position: static; }
  .body { display: flex; }
  .rail { position: sticky; inset: auto; top: 0; z-index: 10; border-bottom: 1px solid #d3c19c; }
  .rail__nav { display: flex; gap: 0; min-height: 42px; }
  .nav-item { flex-direction: row; gap: 3px; }
  .nav-item__badge { position: static; }
  .main { overflow: visible; }
  .screen-head, .screen--village .screen-head { align-items: center; flex-wrap: nowrap; gap: 10px; }
  .screen-head__extra { display: block; }
  .screen-head__extra:empty { display: none; }
  .screen-head__extra .btn svg { display: none; }
  .map-legend { gap: 8px; font-size: 9px; }
  .screen-head > .title { overflow-wrap: anywhere; }
  .village-detail h2 { font-size: 24px; }
  .plot-label { font-size: 11px; }
  .map-view { min-height: 340px; height: 60dvh; }
}
@media (max-width: 420px) {
  .topbar__brand { font-size: 18px; gap: 8px; }
  .topbar__brand > svg { width: 26px; height: 26px; }
  .topbar, .rail { padding-left: 14px; padding-right: 14px; }
  .main { padding-left: 14px; padding-right: 14px; }
  .nav-item { padding-left: 4px; padding-right: 4px; }
  .nav-item__label { font-size: 11px; }
  .res-pills { gap: 8px; }
  .res-pill strong small { font-size: 8px; }
  .title { font-size: 23px; }
  .estate-view-tabs button { padding: 5px 8px; font-size: 10px; }
}

/* Level markers keep the village readable; names appear on selection or hover. */
.plot-label > span { display: none; }
.plot-label small { border: 0; padding-left: 0; font-size: 11px; }
.village-plot.is-selected .plot-label > span,
.village-plot:hover .plot-label > span,
.village-plot:focus-visible .plot-label > span { display: inline; }
.village-plot.is-selected .plot-label small,
.village-plot:hover .plot-label small,
.village-plot:focus-visible .plot-label small { border-left: 1px solid #bba370; padding-left: 6px; }
@media (max-width: 800px) {
  .plot-label { padding: 3px 5px; font-size: 9px; }
  .plot-label small { font-size: 9px; }
  .village-plot.is-selected .plot-label small { padding-left: 4px; }
}
.village-sidebar { align-items: stretch; }
.village-picker { width: 100%; }
@media (max-width: 800px) {
  .village-picker select { width: 100%; }
}

.building-table-wrap { position: relative; width: 100%; max-width: 100%; }
@media (max-width: 720px) {
  .app { overflow-x: clip; }
}

/* Resource and task controls: each number keeps its own space at every width. */
.topbar { min-height: 82px; gap: 20px; padding-top: 10px; padding-bottom: 10px; }
.topbar__identity { display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: 0 0 182px; min-width: 0; }
.topbar__brand { font-size: 20px; line-height: 1.05; gap: 9px; white-space: normal; }
.topbar__brand > span > span { display: block; margin: 3px 0 0; font-size: 14px; letter-spacing: .4px; }
.world-name { display: block; margin-left: 39px; padding: 0; border: 0; color: #c8b38c; font-size: 10px; letter-spacing: .5px; }
.res-pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(100px, .85fr); min-width: 0; gap: 8px; width: 100%; }
.res-pill { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 5px; min-width: 0; padding: 5px 8px; border: 0; border-radius: 5px; background: transparent; color: #f7ecd8; text-align: left; line-height: 1.2; }
.res-pill:hover { background: #fff6dc0c; }
.res-pill:focus-visible { outline: 2px solid #e4c77c; outline-offset: 2px; }
.res-pill__heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 3px 7px; }
.res-pill__name { display: flex; align-items: center; gap: 5px; min-width: 0; }
.res-pill__name svg { filter: brightness(1.25); }
.res-pill__label { font-size: 12px; letter-spacing: 0; color: #dac8a4; }
.res-pill__rate { display: inline; align-self: auto; padding: 0; color: #b9cb9c; font-size: 11px; font-weight: 450; }
.res-pill__balance { display: flex; align-items: baseline; flex-wrap: wrap; gap: 1px 4px; font-variant-numeric: tabular-nums; }
.res-pill strong { font-size: 17px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; white-space: normal; }
.res-pill__balance > small { color: #c1ae8d; font-size: 11px; line-height: 1.3; overflow-wrap: anywhere; }
.res-pill__track { height: 3px; display: block; width: 100%; overflow: hidden; border-radius: 3px; background: #6e573831; }
.res-pill__track > span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: #91a772; }
.res-pill.is-full .res-pill__track > span { background: #dcb85e; }
.res-pill--people .res-pill__track > span { background: #8ba6af; }
.topbar__lord { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 46px; min-height: 44px; padding: 0 0 0 15px; margin: 0; font-size: 10px; }
.topbar__lord > span { display: block; }
.navigation-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-width: 0; }
.rail__nav { min-width: 0; }
.nav-item { min-width: 0; padding-right: 17px; padding-left: 17px; }
.nav-item__label { font-size: 14px; }
.quick-tasks { display: flex; align-items: center; gap: 6px; padding: 5px 0; flex-shrink: 0; }
.quick-task { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 12px; border: 1px solid #d0bd96; border-radius: 5px; background: #f7efde; color: #624d2e; font-size: 13px; font-weight: 550; }
.quick-task:hover { color: var(--garnet); border-color: #aa8057; background: #fff6e5; }
.quick-task.is-active { color: #fff5de; border-color: var(--garnet); background: var(--garnet); }
.quick-task.is-active svg { filter: brightness(1.9); }
.main { padding-top: 20px; }
.screen--village .screen-head { margin-bottom: 14px; }
.village-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.village-sidebar { gap: 12px; }
.village-detail { padding: 17px; }
.village-detail h2 { font-size: 25px; }
.village-detail-level { font-size: 12px; }
.village-effect { margin: 12px 0; padding: 10px 0; }
.village-effect small { font-size: 12px; margin-bottom: 4px; }
.village-effect strong { display: block; font-size: 14px; line-height: 1.45; }
.village-build-time { margin-bottom: 12px; font-size: 13px; }
.village-build-time strong { color: #5c4c35; font-size: 13px; font-weight: 550; }
.building-cost, .village-detail .building-cost { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 0; margin: 0; }
.cost-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 4px; padding: 7px 8px; border: 1px solid #e1d7c0; border-radius: 5px; background: #f5eedf; }
.cost-item__name { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #77664c; }
.cost-item__name svg { width: 14px; height: 14px; }
.cost-item strong { font-size: 15px; line-height: 1.2; color: #453621; font-weight: 600; font-variant-numeric: tabular-nums; }
.cost-item small { grid-column: 1 / -1; font-size: 11px; color: #53713d; line-height: 1.2; }
.cost-item:not(.is-short) small { display: none; }
.cost-item.is-short { border-color: #cf9b7d; background: #f8e9dd; }
.cost-item.is-short strong, .cost-item.is-short small { color: #96392a; }
.upgrade-readiness { margin: 9px 0 !important; color: #6e5e45 !important; font: 400 12px/1.45 var(--sans) !important; }
.upgrade-readiness.ready { color: #496b35 !important; }
.upgrade-readiness.storage, .upgrade-readiness.production { color: var(--garnet) !important; }
.resource-queue-note { margin: -4px 0 10px !important; color: #877759 !important; font: 400 11px/1.4 var(--sans) !important; }
.resource-fix { display: inline-block; padding: 0; margin: 0 0 10px; border: 0; background: none; color: var(--garnet); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.village-detail .upgrade-btn { min-height: 42px; font-size: 14px; }
.village-detail .upgrade-btn:disabled { color: #817158; background: #eee7d8; border-color: #d8cbb1; }
.building-help { margin-top: 12px; padding-top: 10px; font-size: 12px; }
.building-help p { font-size: 14px; }
.village-recruit { font-size: 13px; }
.village-sidebar .panel__head { padding: 10px 13px; font-size: 13px; }
.village-sidebar .panel__body { padding: 12px 13px; gap: 9px; }
.construction-panel .panel__head > span:last-child { color: #8c7754; font-size: 11px; font-weight: 450; }
.queue-empty { font: 400 12px/1.5 var(--sans); color: var(--muted); margin: 0; }
.queue-building { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; min-height: 26px; padding: 0; border: 0; background: transparent; text-align: left; color: #57462e; font-size: 12px; }
.queue-building:hover > span:first-child { color: var(--garnet); text-decoration: underline; }
.queue-building > span:last-child, .queue-building small { flex-shrink: 0; color: #607946; font-variant-numeric: tabular-nums; font-size: 11px; }
.queue-building--queued small { color: #8c7754; }
.queue-active .bar { margin-top: 5px; height: 5px; }
.village-tools button { min-height: 30px; font-size: 12px; }
.army-recruit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; max-width: 1000px; }
.army-recruit-layout .live-form label { font-size: 14px; }
.army-recruit-layout .card__desc { font-size: 14px; }
.command-dialog { width: min(1120px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid #ad9162; border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: 0 15px 70px #1c130e80; font-family: var(--sans); }
.command-dialog::backdrop { background: #1c130e99; }
.command-content { padding: 18px 20px 0; }
.command-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.command-header h2 { margin: 0; font: 500 28px var(--serif); }
.command-header button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid #cbb991; border-radius: 4px; color: #715331; background: #efe4ce; font-size: 25px; line-height: 1; }
.command-destination { display: grid; grid-template-columns: minmax(0, 1fr) 160px; align-items: start; gap: 12px; max-width: 650px; }
.command-destination label { display: grid; gap: 5px; color: #746044; font-size: 12px; font-weight: 600; }
.command-address { min-width: 0; padding: 0; margin: 0; border: 0; }
.command-address legend { margin-bottom: 5px; color: #746044; font-size: 12px; font-weight: 600; }
.command-coordinate-fields { display: flex; align-items: end; gap: 8px; }
.command-coordinate-fields label { display: flex; align-items: center; gap: 5px; }
.command-coordinate-fields input { width: 76px; min-width: 0; min-height: 36px; padding: 6px 9px; border: 1px solid #cbb991; border-radius: 4px; background: #fffdf7; color: var(--ink); font: 500 14px var(--sans); font-variant-numeric: tabular-nums; }
.command-coordinate-fields > span { align-self: center; color: #aa9470; }
.command-coordinate-fields .btn { padding: 6px 10px; min-height: 36px; font-size: 12px; white-space: nowrap; }
.command-coordinate-help { margin: 6px 0; color: var(--muted); font-size: 11px; }
.command-destination select { width: 100%; min-width: 0; min-height: 36px; padding: 6px 9px; border: 1px solid #cbb991; border-radius: 4px; background: #fffdf7; color: var(--ink); font: 400 14px var(--sans); }
.command-target-details { margin: 8px 0 14px; color: #746044; font-size: 12px; }
.command-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 0 12px; color: var(--muted); font-size: 12px; }
.command-tools > span { margin-right: auto; }
.command-tools button { padding: 3px 0; border: 0; background: none; color: var(--garnet); font: 600 12px var(--sans); text-decoration: underline; text-underline-offset: 3px; }
.command-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.command-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.command-group legend { display: block; width: 100%; padding: 8px; margin-bottom: 5px; background: #eaddc2; color: #624b2d; font-size: 13px; font-weight: 650; }
.command-unit { display: grid; grid-template-columns: minmax(0, 1fr) 60px auto; align-items: center; gap: 4px; min-height: 40px; padding: 3px 1px; border-bottom: 1px solid #e8dfce; }
.command-unit label { display: flex; align-items: center; gap: 4px; min-width: 0; color: #59462e; font-size: 12px; line-height: 1.3; }
.command-unit label > span { display: flex; flex-shrink: 0; }
.command-unit input { width: 100%; min-width: 0; min-height: 32px; padding: 5px; border: 1px solid #c5b28d; border-radius: 4px; background: #fffdf7; color: var(--ink); font: 500 14px var(--sans); font-variant-numeric: tabular-nums; }
.command-unit button { min-width: 33px; min-height: 32px; padding: 4px 1px; border: 0; background: none; color: var(--garnet); font: 600 12px var(--sans); font-variant-numeric: tabular-nums; }
.command-unit button:hover:not(:disabled) { text-decoration: underline; }
.command-unit.is-unavailable label, .command-unit.is-unavailable button { opacity: .45; }
.command-unit input:disabled { color: var(--muted); background: #eee8dc; }
.command-dialog :focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.command-footer { position: sticky; bottom: 0; margin: 0 -20px; padding: 12px 20px 16px; border-top: 1px solid #d2c1a0; background: var(--surface); }
.command-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; max-width: 680px; }
.command-summary > div { display: grid; gap: 4px; }
.command-summary span { color: var(--muted); font-size: 11px; }
.command-summary strong { color: #493720; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.command-supply { margin: 10px 0 0; color: #746044; font-size: 11px; }
.command-supply p { margin: 6px 0 0; line-height: 1.4; }
.command-error { margin: 8px 0; color: var(--garnet); font-size: 12px; }
.command-error:empty { display: none; }
.command-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.command-actions .btn { min-width: 100px; min-height: 38px; font-size: 13px; }
.command-dialog button:disabled { cursor: not-allowed; opacity: .5; }
.command-launch-target { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: #59462e; font-size: 14px; }
.command-launch-target span { color: var(--muted); }
@media (max-width: 950px) {
  .command-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .command-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 24px); }
  .command-content { padding: 12px 12px 0; }
  .command-header { margin-bottom: 12px; }
  .command-header h2 { font-size: 25px; }
  .command-destination { grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; }
  .command-coordinate-fields { gap: 5px; flex-wrap: wrap; }
  .command-coordinate-fields input { width: 60px; padding: 6px; }
  .command-coordinate-fields .btn { flex-basis: 100%; margin-top: 3px; }
  .command-tools { padding: 3px 0 10px; gap: 7px 16px; }
  .command-tools > span { flex-basis: 100%; font-size: 11px; }
  .command-groups { gap: 12px; }
  .command-unit { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 6px; padding: 5px 0; }
  .command-unit label { grid-column: 1 / -1; min-height: 20px; }
  .command-unit input { max-width: 85px; min-height: 34px; }
  .command-unit button { min-height: 34px; }
  .command-footer { margin: 0 -12px; padding: 10px 12px 12px; }
  .command-summary { gap: 8px; }
  .command-summary strong { font-size: 12px; }
}
.army-recruit-layout { max-width: 1260px; grid-template-columns: minmax(0, 1fr) 280px; }
.army-recruit-layout > div { min-width: 0; }
.training-panel { overflow: hidden; }
.training-intro { margin: 0; padding: 9px 12px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.training-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.training-table thead { background: #eaddc2; color: #746044; font-size: 12px; }
.training-table th, .training-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.training-table tbody th { width: 23%; font-weight: 600; }
.training-table tbody tr:nth-child(even) { background: #f6f0e4; }
.training-unit { display: flex; align-items: center; gap: 8px; }
.training-unit > span { display: flex; flex-shrink: 0; }
.training-costs { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.training-cost { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: #756750; font-size: 12px; }
.training-cost > span:first-child { display: flex; }
.training-cost strong { font-weight: 550; font-variant-numeric: tabular-nums; }
.training-cost.is-short { color: var(--garnet); }
.training-time { display: block; margin-top: 5px; color: #756750; font-size: 11px; font-variant-numeric: tabular-nums; }
.training-time::before { content: 'Training · '; }
.training-home { text-align: center; font-variant-numeric: tabular-nums; }
.training-mobile-label { display: none; }
.training-table td:last-child { width: 212px; }
.training-form { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; min-width: 192px; align-items: center; }
.training-quantity { grid-column: 1; grid-row: 1; }
.training-quantity { display: flex; align-items: center; gap: 6px; }
.training-form input[type="number"] { min-width: 0; width: 66px; min-height: 34px; padding: 6px; font-size: 13px; }
.training-max { padding: 6px 0; min-height: 34px; border: 0; background: none; color: var(--garnet); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.training-max:hover:not(:disabled) { text-decoration: underline; }
.training-form small { grid-column: 1 / -1; color: var(--garnet); font-size: 11px; line-height: 1.4; }
.training-form small:empty { display: none; }
.training-form .btn { grid-column: 2; grid-row: 1; margin: 0; min-height: 34px; padding: 6px 10px; font-size: 12px; }
.training-form button:disabled, .training-form input:disabled { cursor: not-allowed; opacity: .5; }
.training-locked { padding: 16px 18px; }
.training-locked h2 { margin: 0 0 12px; color: #746044; font: 600 13px var(--sans); }
.training-locked ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.training-locked li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.training-locked li > span:last-child { color: #88785c; }
.training-building-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.training-building-tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border: 1px solid #cbb991; border-radius: 5px; color: #746044; background: #eee4cf; font-size: 13px; }
.training-building-tabs button[aria-pressed="true"] { background: var(--garnet); border-color: var(--garnet); color: #fff8ea; }
.training-building-tabs svg { flex-shrink: 0; }
.training-panel .panel__head { display: flex; align-items: center; justify-content: space-between; padding: 12px; }
.training-panel .panel__head > span { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--muted); font-weight: 400; }
.training-queue-group + .training-queue-group { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.training-queue-group h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin: 0 0 8px; font: 600 13px var(--sans); }
.training-queue-group h3 small { color: var(--muted); font-size: 10px; font-weight: 400; }
.training-queue-group p { margin: 0; color: var(--muted); font: 400 12px var(--sans); }
.training-queue-group ol { list-style: none; margin: 0; padding: 0; max-height: 310px; overflow-y: auto; }
.training-queue-group li + li { padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--line); }
.training-queue-order { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.training-queue-order strong { font-weight: 550; }
.training-queue-order > span { white-space: nowrap; color: var(--green); font-size: 11px; font-variant-numeric: tabular-nums; }
.training-queue-group li > small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.training-queue-group .bar { margin-top: 6px; height: 4px; }
@media (max-width: 1100px) {
  .army-recruit-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .training-intro { padding: 9px 12px; font-size: 12px; }
  .training-table, .training-table tbody { display: block; }
  .training-table thead { display: none; }
  .training-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 6px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .training-table th, .training-table td { padding: 0; border: 0; width: auto !important; }
  .training-table tbody th { grid-column: 1; font-size: 14px; }
  .training-requirements { grid-column: 1; }
  .training-table td:last-child { grid-column: 2; grid-row: 1 / span 3; }
  .training-costs { gap: 6px 10px; }
  .training-unit { gap: 5px; }
  .training-unit svg { width: 21px; height: 21px; }
  .training-home { grid-column: 1; text-align: left; color: #756750; font-size: 12px; }
  .training-mobile-label { display: inline; margin-right: 6px; }
  .training-form { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .training-form input[type="number"] { width: 65px; min-height: 36px; }
  .training-form .btn { grid-column: 1; grid-row: 2; min-height: 36px; }
  .training-building-tabs button { flex: 1; padding: 8px 6px; font-size: 12px; gap: 4px; }
}
.activity-strip { display: flex; flex-shrink: 0; flex-wrap: wrap; justify-content: center; gap: 6px 20px; padding: 6px 20px; border-bottom: 1px solid #d8c6a3; background: #e9dec5; }
.activity-strip[hidden] { display: none; }
.activity-item { display: flex; align-items: baseline; gap: 9px; min-height: 24px; padding: 2px 0; border: 0; background: none; color: #6a583b; font-size: 12px; }
.activity-item strong { color: #526d3d; font-size: 12px; font-weight: 550; font-variant-numeric: tabular-nums; }
.activity-item:hover > span { color: var(--garnet); text-decoration: underline; }
.map-navigation { position: absolute; top: 12px; left: 12px; width: 190px; padding: 9px 10px; border: 1px solid #b5a17a; border-radius: 6px; background: #fbf5e8f5; box-shadow: 0 2px 10px #2b201628; z-index: 3; cursor: auto; }
.map-navigation summary { color: #624e31; font-size: 12px; cursor: pointer; }
.map-coordinate-form { display: flex; align-items: end; gap: 7px; padding-top: 10px; }
.map-coordinate-form label { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: #7c6848; font-size: 11px; }
.map-coordinate-form input { width: 57px; min-height: 32px; padding: 5px; border: 1px solid #cbb991; border-radius: 4px; background: #fffaf0; color: #43351f; font-size: 13px; }
.map-coordinate-form button { min-height: 32px; padding: 5px 9px; border: 1px solid #b69a63; border-radius: 4px; background: #ead9b4; color: #584222; font-size: 12px; }
.map-minimap { display: block; width: 100%; padding: 0; margin-top: 10px; border: 1px solid #a18d62; border-radius: 3px; overflow: hidden; background: #75825b; }
.map-minimap svg { display: block; width: 100%; height: auto; }
.map-centre { display: block; padding-top: 5px; color: #7a6746; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.building-table { min-width: 760px; font-size: 14px; }
.building-table th, .building-table td { padding: 10px 14px; }
.building-table thead th { font-size: 12px; }
.building-table tbody th { width: 25%; }
.building-table__name { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.3; }
.building-table__name small { display: block; margin-top: 3px; color: #7a694f; font: 400 12px/1.3 var(--sans); }
.building-table__icon { display: flex; flex: 0 0 32px; align-items: center; justify-content: center; }
.building-table__resource { display: inline-flex; align-items: center; gap: 5px; }
.building-table__resource > span { display: flex; }
.building-table__number { white-space: nowrap; }
.building-table__number.is-short { font-weight: 650; }
.building-table__action { width: 175px; min-width: 150px; }
.building-table .upgrade-btn { min-height: 34px; font-size: 13px; }
.building-table .btn--queue:not(:disabled) { background: #775538; border-color: #66462d; color: #fff9ee; }
.building-table .btn--queue:not(:disabled):hover { background: #62432c; }
.building-table__blocked { display: block; margin-top: 4px; color: #7a694f; font: 400 11px/1.3 var(--sans); text-align: center; }
.construction-summary { margin-bottom: 22px; overflow: hidden; border: 1px solid #cbb991; border-radius: 7px; background: var(--surface); }
.construction-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.construction-table thead { background: #eaddc2; color: #746044; font-size: 12px; }
.construction-table th, .construction-table td { padding: 10px 14px; }
.construction-table thead th:first-child { width: 50%; }
.construction-table thead small { margin-left: 10px; font-weight: 400; }
.construction-current .construction-duration { color: #526d3d; font-weight: 650; }
.construction-table time { white-space: nowrap; }
.construction-table .construction-progress td { padding: 0 14px 10px; }
.construction-progress .bar { height: 4px; }
.construction-queued { border-top: 1px solid #e3d9c5; color: #7a694f; }
.construction-position { flex: 0 0 32px; text-align: center; color: #9a8056; font: 400 13px var(--sans); }
.construction-note { margin: 0; padding: 9px 14px; border-top: 1px solid #e3d9c5; color: #7a694f; font: 400 11px/1.5 var(--sans); }
.construction-summary--empty { display: flex; align-items: center; gap: 14px; padding: 14px; font-size: 13px; }
.construction-summary--empty > span { color: #7a694f; }
.construction-summary--empty > small { margin-left: auto; white-space: nowrap; color: #7a694f; }
@media (max-width: 600px) {
  .construction-table th, .construction-table td { padding: 9px 10px; }
  .construction-table .building-table__name { gap: 6px; font-size: 13px; }
  .construction-table .building-table__icon { display: none; }
  .construction-table { font-size: 12px; }
  .construction-table thead th:first-child { width: 40%; }
  .construction-table time { white-space: normal; }
  .construction-position { flex-basis: 16px; }
  .construction-summary--empty { flex-wrap: wrap; gap: 6px 12px; }
  .construction-summary--empty > span { order: 3; flex-basis: 100%; }
}
.building-plan { margin: 5px 0 0 !important; color: #7a6544 !important; font: 400 12px/1.45 var(--sans) !important; }
.village-detail > .village-progress { margin: 12px 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 1080px) {
  .topbar { flex-wrap: wrap; gap: 8px 18px; padding-top: 10px; padding-bottom: 10px; }
  .topbar__identity { flex: 1; flex-direction: row; align-items: center; justify-content: flex-start; gap: 15px; }
  .topbar__brand { font-size: 18px; }
  .topbar__brand > span > span { display: inline; font-size: 16px; margin: 0 0 0 4px; letter-spacing: 0; }
  .world-name { margin: 0; font-size: 10px; }
  .res-pills { order: 3; flex: 0 0 100%; padding-top: 8px; border-top: 1px solid #5e4830; gap: 8px; }
  .topbar__lord { flex-direction: row; padding: 0; border: 0; min-height: 30px; }
  .nav-item { padding-left: 12px; padding-right: 12px; }
  .quick-task { padding-left: 10px; padding-right: 10px; }
  .village-layout { grid-template-columns: minmax(0, 1fr) 285px; }
}
@media (max-width: 800px) {
  .navigation-inner { gap: 5px; }
  .nav-item { padding-left: 9px; padding-right: 9px; }
  .nav-item__label { font-size: 13px; }
  .quick-task { padding: 6px 8px; font-size: 12px; }
  .quick-task svg { display: none; }
  .village-layout, .army-recruit-layout { grid-template-columns: minmax(0, 1fr); }
  .village-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .village-picker { grid-column: 1 / -1; }
  #village-detail { grid-row: span 3; }
  .village-tools { text-align: left; }
}
@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 10px 14px; }
  .topbar__identity { min-width: 0; gap: 8px; }
  .topbar__brand { gap: 6px; font-size: 17px; white-space: nowrap; }
  .topbar__brand > span > span { font-size: 15px; margin-left: 3px; }
  .topbar__brand > svg { width: 24px; height: 24px; }
  .world-name { display: none; }
  .topbar__lord { min-width: 28px; }
  .topbar__lord > span { display: none; }
  .res-pills { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .res-pill { padding: 3px 1px; gap: 4px; }
  .res-pill__heading { flex-direction: column; align-items: flex-start; gap: 2px; }
  .res-pill__name { gap: 3px; }
  .res-pill__name svg { width: 13px; height: 13px; }
  .res-pill__label { font-size: 11px; }
  .res-pill__rate { font-size: 11px; }
  .res-pill strong { font-size: 15px; }
  .res-pill__balance { flex-direction: column; gap: 1px; }
  .res-pill__balance > small { font-size: 10px; }
  .res-pill--people { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; align-items: center; gap: 12px; padding-top: 7px; border-top: 1px solid #5e4830; }
  .res-pill--people .res-pill__balance { flex-direction: row; gap: 3px; align-items: baseline; }
  .res-pill--people .res-pill__track { width: 70px; margin-left: auto; }
  .navigation-inner { flex-direction: column; gap: 0; align-items: stretch; }
  .rail__nav { justify-content: space-between; }
  .nav-item { min-height: 40px; padding: 0 5px; }
  .nav-item__label { font-size: 13px; }
  .quick-tasks { gap: 8px; justify-content: flex-end; border-top: 1px solid #d9c9a8; padding: 5px 0; }
  .quick-task { min-height: 30px; flex: 1; font-size: 12px; padding: 4px 10px; }
  .quick-task svg { display: block; width: 14px; height: 14px; }
  .main { padding-top: 16px; }
}
@media (max-width: 520px) {
  .village-sidebar { display: flex; }
  .village-detail { padding: 16px; }
  .building-cost, .village-detail .building-cost { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .village-detail .building-cost { padding-bottom: 0; }
  .village-tools { text-align: right; }
}

/* Construction cancellation stays separate from the building-detail link. */
.construction-actions { width: 1%; text-align: right; }
.construction-cancel { flex-shrink: 0; min-height: 30px; padding: 5px 10px; border: 1px solid #c8ae8a; border-radius: 4px; background: #f4e9d6; color: var(--garnet); font: 500 12px var(--sans); white-space: nowrap; }
.construction-cancel:hover:not(:disabled) { background: #ead8bc; border-color: var(--garnet); }
.construction-cancel:disabled { opacity: .5; cursor: wait; }
.queue-entry { display: flex; align-items: center; gap: 8px; }
.queue-entry .queue-building { min-width: 0; flex: 1; flex-wrap: wrap; gap: 3px 8px; }
.queue-entry .construction-cancel { padding: 4px 7px; font-size: 11px; }
@media (max-width: 600px) {
  .construction-table th, .construction-table td { padding-left: 7px; padding-right: 7px; }
  .construction-table thead th:first-child { width: auto; }
  .construction-table thead small { display: block; margin: 2px 0 0; }
  .construction-table .construction-cancel { padding: 5px 7px; font-size: 11px; }
}
@media (max-width: 400px) {
  .construction-table { font-size: 11px; }
  .construction-table thead { font-size: 10px; }
  .construction-table th, .construction-table td { padding-left: 4px; padding-right: 4px; }
  .construction-table .building-table__name { font-size: 12px; gap: 4px; }
  .construction-table .building-table__name small { font-size: 11px; }
  .construction-table .construction-cancel { padding-left: 6px; padding-right: 6px; }
  .construction-position { flex-basis: 12px; }
}
/* Village context stays separate from account identity and resource controls. */
.village-context{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 24px;background:var(--parchment,#f0e5cb);border-bottom:1px solid #b9a784;font:13px var(--sans,sans-serif)}
.village-context label{display:flex;align-items:center;gap:9px;font-weight:700}
.village-context select,.transfer-form select{max-width:100%;padding:7px;border:1px solid #aa9670;border-radius:4px;background:#fff9eb;color:#33220f}
.village-context>span{color:#6b593e}
.transfer-resources{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.transfer-order{display:grid;gap:5px;padding:14px 0;border-bottom:1px solid #c8b690}
.transfer-order p{margin:0}
.transfer-form [data-transfer-summary]{min-height:40px;font-size:13px}
@media(max-width:600px){.village-context{padding:8px 12px;flex-wrap:wrap}.village-context>span{font-size:11px}.village-context select{max-width:240px}}

/* Crown and wordmark match the live public landing page. */
.brand-crest { display: block; width: 44px; height: auto; flex: 0 0 auto; filter: drop-shadow(0 2px 10px #e2b65c59); }
.brand-wordmark { font-family: "Cinzel", var(--serif); font-weight: 700; line-height: 1.3; letter-spacing: .08em; text-transform: uppercase; }
.brand-wordmark em { font-style: normal; font-size: .7em; color: var(--gold); letter-spacing: .12em; white-space: nowrap; }
.topbar__identity { flex-basis: 224px; }
.topbar__brand { gap: 10px; }
.topbar__brand .brand-wordmark { font-size: 14px; }
.topbar__brand .brand-crest { width: 40px; }
.world-name { margin-left: 50px; }
.auth-brand .brand-wordmark { flex: 1; min-width: 0; font-size: clamp(13px, 3.8vw, 17.6px); }
.auth-brand .tag-parchment { flex-shrink: 0; background: #f4e8ce; color: #3b2b18; border-color: #c9a23f; font-size: 11px; font-weight: 700; }
.app:has(.auth-shell), .app:has(.loading-state) { background: radial-gradient(ellipse at 50% 0, #443625, #211b15 75%); }
.auth-brand, .loading-state { color: #f5ead3; }
.auth-about, .loading-state p { color: #c7b99d; }
.loading-state .brand-crest { width: 88px; }
.loading-state .brand-wordmark { font-family: "Cinzel", var(--serif); font-weight: 700; font-size: clamp(20px, 5vw, 28px); text-align: center; }
@media (max-width: 1080px) {
  .topbar__identity { flex-basis: auto; }
  .world-name { margin-left: 0; }
}
@media (max-width: 720px) {
  .topbar__brand .brand-crest { width: 36px; }
  .topbar__brand .brand-wordmark { font-size: clamp(11px, 3.3vw, 14px); }
  .topbar__brand { white-space: normal; }
}
