:root {
  --ink: #1a211d;
  --ink-soft: #566056;
  --paper: #eee4cb;
  --paper-deep: #d8c8a5;
  --paper-light: #f7efdb;
  --forest: #172820;
  --forest-2: #20372c;
  --forest-3: #2d4a39;
  --moss: #7d8d55;
  --amber: #d29146;
  --amber-light: #f3c77b;
  --rust: #a85236;
  --blue: #6d9dac;
  --line: rgba(71, 58, 37, .24);
  --gold-line: rgba(222, 176, 98, .38);
  --shadow: 0 18px 60px rgba(2, 9, 7, .36);
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Aptos", "Segoe UI", Candara, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #111d18;
  color: var(--paper);
  font-family: var(--sans);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--amber-light);
  outline-offset: 3px;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

#lobby-canvas,
#world-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#lobby-canvas {
  background: #15251d;
}

.lobby-wash {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 25% 50%, rgba(10, 20, 15, .16) 0, rgba(9, 20, 14, .64) 40%, rgba(6, 14, 11, .92) 73%),
    linear-gradient(90deg, rgba(9, 16, 13, .28), rgba(9, 16, 13, .08) 54%, rgba(9, 16, 13, .54)),
    linear-gradient(0deg, rgba(9, 16, 13, .9), transparent 35%);
}

.lobby {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: min(620px, calc(100vw - 64px));
  height: fit-content;
  max-height: calc(100vh - 40px);
  margin: auto 0;
  overflow-y: auto;
  padding: clamp(24px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  animation: lobby-in .9s cubic-bezier(.2, .8, .2, 1) both;
}

.lobby::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 7% -12% 4% -10%;
  background: radial-gradient(ellipse at 40% 50%, rgba(17, 30, 23, .65), transparent 70%);
  filter: blur(20px);
}

@keyframes lobby-in {
  from { opacity: 0; transform: translateX(-22px); }
  to { opacity: 1; transform: translateX(0); }
}

.lobby-mark {
  width: 78px;
  height: 78px;
  margin-bottom: 17px;
  color: var(--amber-light);
  filter: drop-shadow(0 5px 16px rgba(225, 164, 71, .22));
}

.lobby-mark svg {
  width: 100%;
  height: 100%;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--amber-light);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.lobby h1 {
  margin: 5px 0 12px;
  color: #f3ead6;
  font-family: var(--serif);
  font-size: clamp(66px, 8.4vw, 118px);
  font-weight: 500;
  line-height: .86;
  letter-spacing: -.06em;
  text-shadow: 0 4px 34px rgba(0, 0, 0, .35);
}

.lobby h1 span {
  color: var(--amber-light);
  font-style: italic;
}

.lobby-copy {
  max-width: 520px;
  margin: 14px 0 30px;
  color: rgba(240, 232, 212, .74);
  font-family: var(--serif);
  font-size: clamp(16px, 1.35vw, 20px);
  line-height: 1.55;
  text-wrap: pretty;
}

.join-form {
  width: min(100%, 530px);
}

.join-form label {
  display: block;
  margin: 0 0 7px 2px;
  color: rgba(239, 225, 194, .62);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
  border: 1px solid rgba(236, 207, 148, .22);
  background: rgba(7, 16, 12, .52);
}

.auth-mode {
  padding: 10px 12px;
  border: 0;
  color: rgba(239, 228, 203, .46);
  background: transparent;
  font-family: var(--serif);
  font-size: 11px;
  cursor: pointer;
}

.auth-mode + .auth-mode {
  border-left: 1px solid rgba(236, 207, 148, .15);
}

.auth-mode.is-active {
  color: var(--amber-light);
  background: rgba(215, 157, 70, .09);
  box-shadow: inset 0 -1px var(--amber);
}

.join-form > input {
  width: 100%;
  margin-bottom: 11px;
  padding: 13px 15px;
  border: 1px solid rgba(236, 207, 148, .24);
  color: var(--paper-light);
  background: rgba(7, 16, 12, .68);
  font-family: var(--serif);
  font-size: 15px;
  backdrop-filter: blur(14px);
}

.auth-note {
  margin: -2px 2px 10px;
  color: rgba(239, 228, 204, .46);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.45;
}

.auth-submit {
  width: 100%;
  min-height: 47px;
  margin-top: 4px;
}

.lobby-status {
  min-height: 34px;
  margin: 11px 0 0;
  color: rgba(222, 199, 148, .78);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.45;
}

.join-row {
  display: flex;
  padding: 5px;
  gap: 5px;
  border: 1px solid rgba(236, 207, 148, .25);
  background: rgba(7, 16, 12, .64);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025), var(--shadow);
  backdrop-filter: blur(14px);
}

.join-row input {
  min-width: 0;
  flex: 1;
  padding: 14px 16px;
  border: 0;
  outline: 0;
  color: var(--paper-light);
  background: transparent;
  font-family: var(--serif);
  font-size: 16px;
}

.join-row input::placeholder {
  color: rgba(238, 226, 196, .38);
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 190px;
  padding: 0 17px;
  border: 1px solid rgba(255, 226, 157, .22);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, .1), transparent 34%),
    linear-gradient(180deg, #d39a52, #ac6b31);
  color: #1b2118;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255, 255, 255, .32), 0 7px 20px rgba(0, 0, 0, .2);
  transition: transform .16s ease, filter .16s ease;
}

.primary-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: .55;
  cursor: wait;
  transform: none;
}

.lobby-features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 22px;
  color: rgba(239, 230, 208, .62);
  font-size: 12px;
}

.lobby-features span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.feature-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.dot-green { color: #88aa70; background: currentColor; }
.dot-amber { color: var(--amber-light); background: currentColor; }
.dot-blue { color: #7fb3c2; background: currentColor; }

.lobby-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: #f0a58c;
  font-size: 12px;
}

.lobby-footnote {
  margin: 14px 0 0;
  color: rgba(236, 226, 203, .34);
  font-family: var(--serif);
  font-size: 11px;
  font-style: italic;
}

.loading-screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  background:
    radial-gradient(circle at center, rgba(44, 72, 53, .94), #0c1712 65%);
}

.loading-crest {
  width: 72px;
  height: 64px;
  border: 1px solid rgba(234, 189, 106, .55);
  transform: rotate(45deg);
  animation: crest-turn 4s ease-in-out infinite;
}

.loading-crest::before,
.loading-crest::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(234, 189, 106, .3);
}

.loading-crest::after {
  inset: 26px;
  background: var(--amber);
  border: 0;
}

@keyframes crest-turn {
  0%, 100% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 rgba(219, 157, 76, 0); }
  50% { transform: rotate(225deg) scale(1.08); box-shadow: 0 0 30px rgba(219, 157, 76, .12); }
}

.loading-screen p {
  margin: 28px 0 12px;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .03em;
}

.loading-track {
  width: 180px;
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
}

.loading-track span {
  display: block;
  width: 25%;
  height: 100%;
  background: var(--amber-light);
  animation: loading-slide 1.2s ease-in-out infinite;
}

@keyframes loading-slide {
  from { transform: translateX(-120%); }
  to { transform: translateX(520%); }
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #1a2b22;
}

#world-canvas {
  background: #10231f;
  cursor: default;
  touch-action: none;
}

#world-canvas.is-dragging {
  cursor: grabbing;
}

#world-canvas.is-selecting {
  cursor: crosshair;
}

#world-canvas.is-placing {
  cursor: crosshair;
}

.selection-box {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  border: 1px solid rgba(248, 220, 155, .95);
  background: rgba(211, 168, 84, .13);
  box-shadow: 0 0 0 1px rgba(40, 31, 20, .38), inset 0 0 22px rgba(246, 210, 132, .08);
}

.canvas-grain,
.canvas-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.canvas-grain {
  z-index: 2;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.canvas-vignette {
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(4, 12, 8, .24), transparent 18%, transparent 82%, rgba(4, 12, 8, .24)),
    linear-gradient(0deg, rgba(4, 12, 8, .38), transparent 20%, transparent 90%, rgba(4, 12, 8, .18));
}

.top-bar {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(237, 206, 142, .18);
  background:
    linear-gradient(180deg, rgba(19, 33, 26, .96), rgba(15, 28, 22, .86)),
    repeating-linear-gradient(90deg, transparent 0 64px, rgba(255, 255, 255, .015) 64px 65px);
  box-shadow: 0 9px 30px rgba(2, 9, 6, .18);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 210px;
  gap: 11px;
}

.brand-crest {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(232, 189, 109, .52);
  color: var(--amber-light);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: -.02em;
  transform: rotate(45deg);
  box-shadow: inset 0 0 0 4px rgba(228, 180, 95, .05);
}

.brand-crest::first-line {
  transform: rotate(-45deg);
}

.brand-lockup > div {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-lockup strong {
  color: #f1e5c9;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.brand-lockup span:last-child {
  color: rgba(234, 224, 201, .48);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.resource-ribbon {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.resource-ribbon::-webkit-scrollbar {
  display: none;
}

.resource-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 58px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: rgba(250, 241, 220, .92);
  background: rgba(255, 255, 255, .025);
  font-family: var(--serif);
  font-size: 12px;
  transition: background .2s, border-color .2s, transform .2s;
}

.resource-pill.is-changed {
  border-color: rgba(235, 183, 96, .4);
  background: rgba(218, 157, 69, .1);
  transform: translateY(-1px);
}

.resource-glyph {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: var(--amber-light);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 900;
}

.resource-glyph::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}

.resource-glyph > span {
  position: absolute;
  font-size: 7px;
}

.resource-pill small {
  color: rgba(235, 223, 195, .42);
  font-family: var(--sans);
  font-size: 6px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 214px;
  gap: 7px;
}

.economy-pill {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px 0 7px;
  border: 1px solid rgba(232, 189, 109, .24);
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(207, 158, 76, .1), rgba(29, 52, 42, .18)),
    rgba(0, 0, 0, .12);
  transition: border-color .2s, background .2s;
}

.economy-pill.is-changed {
  border-color: rgba(239, 194, 111, .57);
  background:
    linear-gradient(135deg, rgba(207, 158, 76, .2), rgba(34, 72, 55, .24)),
    rgba(0, 0, 0, .1);
}

.economy-mark {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(233, 191, 111, .52);
  border-radius: 50%;
  color: #eed29b;
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1;
}

.economy-copy {
  display: grid;
  line-height: 1.05;
}

.economy-copy small {
  color: rgba(235, 223, 195, .42);
  font-family: var(--sans);
  font-size: 6px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.economy-copy strong {
  color: #f1ddb4;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(232, 211, 168, .15);
  border-radius: 50%;
  color: rgba(239, 228, 201, .66);
  background: rgba(0, 0, 0, .1);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.icon-button:hover,
.icon-button.is-active {
  color: var(--amber-light);
  border-color: rgba(232, 189, 109, .4);
  background: rgba(216, 157, 72, .08);
}

.online-pill {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid rgba(235, 219, 181, .13);
  border-radius: 20px;
  color: rgba(240, 232, 214, .7);
  background: rgba(0, 0, 0, .12);
  font-size: 10px;
  white-space: nowrap;
}

.online-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8eb676;
  box-shadow: 0 0 0 0 rgba(142, 182, 118, .5);
  animation: online-pulse 2.6s infinite;
}

@keyframes online-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(142, 182, 118, .45); }
  50% { box-shadow: 0 0 0 5px rgba(142, 182, 118, 0); }
}

.left-rail,
.right-rail {
  position: absolute;
  z-index: 7;
  top: 78px;
  bottom: 196px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.left-rail {
  left: 14px;
  width: 232px;
}

.right-rail {
  right: 14px;
  width: 286px;
}

.panel {
  position: relative;
  border: 1px solid rgba(222, 178, 105, .42);
  border-radius: 1px;
  background:
    linear-gradient(135deg, rgba(255, 218, 154, .08), transparent 34%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .012) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, rgba(52, 42, 29, .97), rgba(25, 32, 25, .97));
  box-shadow:
    0 14px 38px rgba(2, 7, 4, .42),
    inset 0 0 0 2px rgba(20, 17, 12, .4),
    inset 0 0 35px rgba(255, 210, 128, .03);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid rgba(244, 201, 119, .7);
  border-left: 2px solid rgba(244, 201, 119, .7);
}

.panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid rgba(244, 201, 119, .5);
  border-bottom: 2px solid rgba(244, 201, 119, .5);
}

.settlement-card {
  padding: 13px;
}

.settler-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.settler-heading h2 {
  max-width: 178px;
  margin: 2px 0 0;
  overflow: hidden;
  color: #f1e6cf;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-sigil {
  width: 42px;
  height: 48px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 94% 15%, 86% 74%, 50% 100%, 14% 74%, 6% 15%);
  color: #fbefd4;
  background: var(--amber);
  font-family: var(--serif);
  font-size: 19px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 15px 0 13px;
  border-top: 1px solid var(--gold-line);
  border-left: 1px solid var(--gold-line);
}

.stat-grid > div {
  padding: 9px 10px;
  border-right: 1px solid var(--gold-line);
  border-bottom: 1px solid var(--gold-line);
}

.stat-grid span {
  display: block;
  margin-bottom: 2px;
  color: rgba(240, 229, 203, .45);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.stat-grid strong {
  color: #efe2c8;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.influence-block {
  margin-top: 4px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  color: rgba(240, 229, 203, .58);
  font-size: 10px;
}

.meter-label strong {
  color: var(--amber-light);
  font-weight: 600;
}

.meter {
  height: 3px;
  margin: 6px 0 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, .07);
}

.meter span {
  display: block;
  width: 52%;
  height: 100%;
  background: linear-gradient(90deg, #9e733a, var(--amber-light));
  box-shadow: 0 0 9px rgba(231, 177, 88, .25);
  transition: width .5s ease;
}

.influence-block p {
  margin: 0;
  color: rgba(239, 228, 204, .34);
  font-family: var(--serif);
  font-size: 10px;
  font-style: italic;
}

.minimap-card {
  padding: 13px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
}

.panel-heading h3,
.market-header h3,
.chronicle-heading h3 {
  margin: 0;
  color: #eadfc8;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
}

.panel-heading span {
  color: rgba(239, 228, 204, .38);
  font-size: 9px;
  letter-spacing: .06em;
}

.minimap-frame {
  position: relative;
  aspect-ratio: 1.75;
  overflow: hidden;
  background: #13241d;
  border: 1px solid rgba(231, 201, 140, .2);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .42);
}

#minimap {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

.compass {
  position: absolute;
  color: rgba(235, 219, 182, .43);
  font-family: var(--serif);
  font-size: 7px;
}

.compass-n { top: 3px; left: 50%; }
.compass-e { right: 4px; top: 50%; }
.compass-s { bottom: 3px; left: 50%; }
.compass-w { left: 4px; top: 50%; }

.rivals-card {
  min-height: 94px;
  padding: 13px;
  overflow: hidden;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 140px;
  overflow-y: auto;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 3px 5px;
  border-left: 2px solid var(--player-color, var(--amber));
  background: rgba(255, 255, 255, .025);
}

.player-row.is-you {
  background: rgba(231, 180, 93, .07);
}

.player-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--player-color, var(--amber));
  box-shadow: 0 0 7px color-mix(in srgb, var(--player-color) 50%, transparent);
}

.player-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: rgba(242, 233, 214, .78);
  font-family: var(--serif);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-type {
  color: rgba(239, 228, 204, .3);
  font-size: 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chronicle-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.tab-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid rgba(236, 204, 143, .2);
}

.tab-button {
  position: relative;
  padding: 14px 6px 11px;
  border: 0;
  color: rgba(239, 228, 204, .44);
  background: transparent;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}

.tab-button::after {
  content: "";
  position: absolute;
  right: 24%;
  bottom: -1px;
  left: 24%;
  height: 1px;
  background: var(--amber-light);
  transform: scaleX(0);
  transition: transform .2s;
}

.tab-button.is-active {
  color: var(--amber-light);
}

.tab-button.is-active::after {
  transform: scaleX(1);
}

.tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
}

.tab-panel.is-active {
  display: block;
}

.war-target-card {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid rgba(218, 185, 118, .16);
  background: rgba(5, 17, 12, .32);
}

.war-payroll-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid rgba(232, 207, 157, .12);
  color: rgba(239, 228, 204, .46);
  font-size: 8px;
}

.war-payroll-row b {
  color: #e5c47f;
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 500;
}

.war-target-card > strong {
  color: #ead6ad;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
}

.war-target-card > small {
  color: rgba(236, 223, 195, .46);
  font-family: var(--serif);
  font-size: 9px;
  line-height: 1.45;
}

.war-target-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.war-target-actions button,
.attack-target-row button {
  padding: 6px 8px;
  border: 1px solid rgba(119, 168, 158, .32);
  color: #c8ded6;
  background: rgba(64, 112, 103, .1);
  font-family: var(--serif);
  font-size: 9px;
  cursor: pointer;
}

.war-target-actions .military-wave-field {
  color: rgba(206, 227, 220, .62);
}

.war-target-actions .military-wave-field input {
  border-color: rgba(119, 168, 158, .32);
  color: #d7e9e3;
  background: rgba(64, 112, 103, .12);
}

#war-cancel-target {
  border-color: rgba(191, 111, 75, .35);
  color: #e0bfae;
  background: rgba(125, 62, 43, .12);
}

.attack-target-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.attack-target-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid rgba(232, 207, 157, .12);
  background: rgba(255, 255, 255, .018);
}

.attack-target-row.is-targeted {
  border-color: rgba(210, 148, 83, .42);
  background: rgba(142, 82, 42, .12);
}

.attack-target-row > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.attack-target-row strong {
  color: rgba(242, 224, 191, .84);
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 500;
}

.attack-target-row small,
.attack-target-empty {
  color: rgba(236, 223, 195, .4);
  font-family: var(--serif);
  font-size: 8px;
  line-height: 1.45;
}

.building-demolition,
.campaign-building-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(235, 215, 173, .12);
}

.selection-demolition {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(235, 215, 173, .12);
}

.selection-demolition button {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid rgba(181, 97, 69, .34);
  color: #dfb3a0;
  background: rgba(112, 49, 34, .11);
  font-family: var(--serif);
  font-size: 9px;
  cursor: pointer;
}

.selection-demolition button.is-confirming {
  border-color: rgba(217, 117, 82, .62);
  color: #ffd0bc;
  background: rgba(132, 53, 34, .23);
}

.building-demolition p,
.campaign-building-actions p:not(.section-label) {
  margin: 0 0 8px;
  color: rgba(239, 228, 204, .43);
  font-family: var(--serif);
  font-size: 9px;
  line-height: 1.45;
}

.building-demolition button,
.campaign-building-actions button {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid rgba(181, 97, 69, .34);
  color: #dfb3a0;
  background: rgba(112, 49, 34, .11);
  font-family: var(--serif);
  font-size: 9px;
  cursor: pointer;
}

.building-demolition button.is-confirming {
  border-color: rgba(217, 117, 82, .62);
  color: #ffd0bc;
  background: rgba(132, 53, 34, .23);
}

.campaign-building-actions button {
  border-color: rgba(119, 168, 158, .34);
  color: #c8ded6;
  background: rgba(64, 112, 103, .1);
}

.market-header,
.chronicle-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.market-header h3,
.chronicle-heading h3 {
  margin-top: 2px;
  font-size: 18px;
}

.market-header select {
  padding: 5px 7px;
  border: 1px solid rgba(233, 211, 165, .22);
  border-radius: 1px;
  color: rgba(237, 226, 202, .74);
  background: rgba(7, 18, 13, .35);
  font-size: 10px;
  cursor: pointer;
}

.trade-post-status {
  margin: -3px 0 9px;
  padding: 5px 7px;
  border-left: 2px solid rgba(111, 175, 154, .7);
  color: rgba(199, 224, 213, .68);
  background: rgba(55, 105, 88, .08);
  font-size: 8px;
  line-height: 1.35;
}

.trade-post-status.is-missing {
  border-left-color: rgba(213, 133, 86, .72);
  color: rgba(235, 185, 148, .78);
  background: rgba(120, 57, 32, .09);
}

.market-columns,
.market-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 82px 54px 44px;
  align-items: center;
  gap: 5px;
}

.market-columns {
  padding: 0 4px 5px;
  color: rgba(239, 228, 204, .3);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.market-columns span:last-child {
  text-align: right;
}

.market-goods {
  border-top: 1px solid rgba(233, 211, 165, .14);
}

.market-row {
  position: relative;
  min-height: 37px;
  padding: 3px 4px;
  border-bottom: 1px solid rgba(233, 211, 165, .1);
  transition: background .15s;
}

.market-row:hover {
  background: rgba(235, 190, 106, .035);
}

.trade-policy {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 5px;
  padding: 4px 1px 2px;
  border-top: 1px dashed rgba(232, 206, 153, .1);
  color: rgba(239, 228, 204, .38);
  font-size: 7px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.trade-policy label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.trade-policy input[type="checkbox"] {
  accent-color: #b08548;
}

.trade-policy-buy input[type="checkbox"] {
  accent-color: #699f7e;
}

.trade-policy input[type="number"] {
  width: 45px;
  padding: 2px 4px;
  border: 1px solid rgba(232, 206, 153, .16);
  color: #ecd8ae;
  background: rgba(4, 13, 9, .48);
  font-family: var(--sans);
  font-size: 8px;
  text-align: right;
}

.market-good-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.market-good-glyph {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  color: var(--amber-light);
  font-family: var(--serif);
  font-size: 12px;
}

.market-good-name strong {
  overflow: hidden;
  color: rgba(242, 233, 212, .82);
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offer-need {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: rgba(240, 228, 200, .36);
  font-size: 8px;
}

.offer-need span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.offer-need i {
  height: 2px;
  display: inline-block;
  max-width: 34px;
  background: #7d9a6a;
}

.offer-need span:last-child i {
  background: #c87956;
}

.price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: #f0d196;
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.1;
}

.price small {
  color: #83a87a;
  font-family: var(--sans);
  font-size: 7px;
}

.price small.is-up {
  color: #d38362;
}

.trade-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.trade-button {
  width: 20px;
  height: 21px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(233, 211, 165, .16);
  border-radius: 1px;
  color: rgba(238, 225, 196, .58);
  background: rgba(255, 255, 255, .025);
  font-size: 10px;
  cursor: pointer;
}

.trade-button:hover {
  color: var(--amber-light);
  border-color: rgba(233, 185, 105, .42);
}

.trade-button.is-buy:hover {
  color: #9fc290;
}

.recent-trades {
  margin-top: 15px;
}

.section-label {
  margin: 0 0 7px;
  color: rgba(237, 225, 198, .32);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.trade-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid rgba(236, 214, 171, .08);
  color: rgba(240, 230, 208, .54);
  font-family: var(--serif);
  font-size: 9px;
}

.trade-line b {
  color: rgba(243, 220, 172, .8);
  font-weight: 400;
}

.game-clock {
  padding: 4px 7px;
  border: 1px solid rgba(232, 199, 135, .2);
  color: rgba(242, 218, 167, .6);
  font-family: var(--serif);
  font-size: 9px;
  font-style: italic;
}

.event-list {
  display: flex;
  flex-direction: column;
}

.event {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 9px;
  padding: 10px 0 10px 2px;
  border-top: 1px solid rgba(235, 215, 173, .1);
}

.event-marker {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(233, 188, 108, .25);
  border-radius: 50%;
  color: var(--amber-light);
  font-family: var(--serif);
  font-size: 10px;
}

.event-copy {
  padding-top: 2px;
  color: rgba(241, 232, 212, .7);
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.4;
}

.event-copy small {
  display: block;
  margin-top: 3px;
  color: rgba(240, 227, 201, .28);
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.domain-detail {
  color: rgba(240, 229, 204, .55);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.6;
}

.domain-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid rgba(235, 215, 173, .1);
}

.domain-stat b {
  color: var(--amber-light);
  font-weight: 400;
}

.mode-banner {
  position: absolute;
  z-index: 10;
  top: 88px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 9px 8px 15px;
  border: 1px solid rgba(232, 185, 102, .35);
  color: rgba(246, 231, 197, .82);
  background: rgba(18, 32, 24, .9);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
  font-family: var(--serif);
  font-size: 12px;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.mode-banner.has-selection-filters {
  max-width: min(980px, calc(100vw - 32px));
  flex-wrap: wrap;
  gap: 8px 14px;
}

.selection-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid rgba(232, 185, 102, .18);
}

.selection-filters[hidden] {
  display: none;
}

.mode-banner .selection-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-color: rgba(221, 195, 141, .24);
  color: rgba(246, 231, 197, .76);
  background: rgba(111, 89, 48, .12);
  white-space: nowrap;
}

.mode-banner .selection-filter strong {
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 500;
}

.mode-banner .selection-filter span {
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 9px;
  color: #f2d79d;
  background: rgba(218, 166, 79, .18);
  font-size: 8px;
  text-align: center;
}

.mode-banner .selection-filter:hover,
.mode-banner .selection-filter:focus-visible {
  color: #fff0cf;
  border-color: rgba(238, 199, 120, .58);
  background: rgba(150, 111, 50, .28);
  outline: none;
}

.mode-banner .selection-filter.is-active {
  color: #fff1d2;
  border-color: rgba(235, 190, 101, .65);
  background: rgba(154, 111, 44, .36);
}

.mode-banner .selection-filter.is-active span {
  color: #23321f;
  background: #e0b264;
}

.mode-banner button {
  padding: 5px 8px;
  border: 1px solid rgba(233, 211, 165, .16);
  color: rgba(243, 230, 202, .62);
  background: transparent;
  font-family: var(--sans);
  font-size: 8px;
  cursor: pointer;
}

.mode-banner #confirm-mode {
  color: #1d241a;
  border-color: rgba(250, 219, 153, .48);
  background: linear-gradient(180deg, #d8a65c, #b97c37);
  font-weight: 700;
}

.mode-banner #scorched-earth-mode {
  color: #e1b29e;
  border-color: rgba(204, 102, 68, .35);
  background: rgba(116, 47, 28, .16);
}

.mode-banner #scorched-earth-mode.is-active {
  color: #ffe1ce;
  border-color: rgba(236, 121, 72, .72);
  background: linear-gradient(180deg, rgba(156, 61, 31, .9), rgba(99, 35, 23, .92));
  box-shadow: 0 0 12px rgba(205, 78, 39, .24);
}

.mode-banner #catapult-auto-attack {
  color: #b9d6c9;
  border-color: rgba(98, 157, 137, .34);
  background: rgba(39, 91, 73, .15);
}

.mode-banner #catapult-auto-attack.is-active {
  color: #ddf5eb;
  border-color: rgba(123, 195, 170, .7);
  background: linear-gradient(180deg, rgba(53, 116, 94, .9), rgba(27, 72, 57, .92));
  box-shadow: 0 0 12px rgba(75, 163, 135, .22);
}

.mode-banner #train-unit-mode {
  color: #f0d7a6;
  border-color: rgba(203, 165, 91, .4);
  background: rgba(116, 82, 30, .18);
}

kbd {
  display: inline-block;
  padding: 1px 4px;
  border: 1px solid rgba(237, 218, 178, .2);
  border-radius: 2px;
  background: rgba(0, 0, 0, .15);
  font-family: var(--sans);
  font-size: 8px;
}

.tile-tooltip {
  position: absolute;
  z-index: 12;
  min-width: 112px;
  max-width: 190px;
  padding: 8px 10px;
  border: 1px solid rgba(237, 204, 139, .26);
  pointer-events: none;
  color: rgba(239, 229, 208, .72);
  background: rgba(11, 23, 17, .9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
  font-family: var(--serif);
  font-size: 10px;
  line-height: 1.45;
  backdrop-filter: blur(8px);
}

.tile-tooltip strong {
  display: block;
  color: #f1dcae;
  font-size: 11px;
  font-weight: 500;
}

.toast-stack {
  position: absolute;
  z-index: 30;
  top: 88px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  min-width: 180px;
  max-width: 380px;
  padding: 9px 14px;
  border: 1px solid rgba(236, 200, 130, .25);
  color: rgba(244, 232, 207, .82);
  background: rgba(13, 27, 19, .94);
  box-shadow: 0 9px 30px rgba(0, 0, 0, .3);
  font-family: var(--serif);
  font-size: 11px;
  text-align: center;
  animation: toast-in .25s ease both;
  backdrop-filter: blur(8px);
}

.toast.is-error {
  border-color: rgba(204, 112, 83, .42);
  color: #efb09a;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.command-dock {
  position: absolute;
  z-index: 8;
  right: 14px;
  bottom: 14px;
  left: 14px;
  height: 176px;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(235, 205, 145, .25);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .013) 0 1px, transparent 1px 42px),
    linear-gradient(180deg, rgba(56, 43, 28, .98), rgba(25, 31, 24, .98));
  box-shadow: 0 -10px 45px rgba(1, 8, 5, .25), inset 0 1px rgba(255, 255, 255, .025);
  backdrop-filter: blur(16px);
}

.command-dock::before {
  content: "";
  position: absolute;
  right: 12px;
  bottom: calc(100% + 1px);
  left: 12px;
  height: 5px;
  border-top: 1px solid rgba(239, 197, 116, .34);
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
}

.quick-actions {
  width: 292px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.quick-button {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 9px;
  border: 1px solid rgba(235, 207, 153, .12);
  border-radius: 1px;
  color: rgba(244, 233, 211, .8);
  background: rgba(255, 255, 255, .025);
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}

.quick-button:hover,
.quick-button.is-active {
  border-color: rgba(232, 187, 105, .37);
  background: rgba(218, 153, 62, .07);
  transform: translateY(-1px);
}

.quick-button:disabled,
.trade-button:disabled,
.military-train-button:disabled,
.upgrade-button:disabled {
  opacity: .38;
  cursor: not-allowed;
  filter: grayscale(.45);
  transform: none;
}

.quick-button:disabled:hover,
.trade-button:disabled:hover,
.military-train-button:disabled:hover,
.upgrade-button:disabled:hover {
  border-color: inherit;
  background: inherit;
  transform: none;
}

.quick-icon {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(231, 190, 112, .2);
  border-radius: 50%;
  color: var(--amber-light);
  font-family: var(--serif);
  font-size: 15px;
}

.quick-button strong {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-button small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: rgba(239, 227, 201, .34);
  font-size: 7px;
  letter-spacing: .03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-divider {
  width: 1px;
  margin: 4px 0;
  background: linear-gradient(transparent, rgba(234, 204, 144, .22), transparent);
}

.build-strip-wrap {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.build-strip-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px;
}

.build-heading-copy {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 12px;
}

.build-heading-copy > span {
  color: var(--amber-light);
  font-family: var(--serif);
  font-size: 13px;
  white-space: nowrap;
}

.build-heading-copy small {
  overflow: hidden;
  color: rgba(239, 228, 204, .3);
  font-family: var(--serif);
  font-size: 9px;
  font-style: italic;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-support {
  display: flex;
  flex: 0 0 auto;
  gap: 3px;
}

.size-chip {
  padding: 2px 6px;
  border: 1px solid rgba(232, 200, 139, .16);
  color: rgba(239, 225, 196, .42);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.size-chip.is-supported {
  color: var(--amber-light);
  border-color: rgba(232, 188, 104, .38);
  background: rgba(218, 159, 73, .07);
}

.build-strip {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 5px;
  padding: 0 2px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-color: rgba(243, 199, 123, .68) rgba(5, 13, 9, .48);
  scrollbar-width: auto;
}

.build-strip::-webkit-scrollbar {
  height: 12px;
}

.build-strip::-webkit-scrollbar-track {
  margin: 0 3px;
  border-top: 1px solid rgba(235, 205, 145, .12);
  background: rgba(5, 13, 9, .48);
}

.build-strip::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(243, 199, 123, .68);
  background-clip: padding-box;
  box-shadow: inset 0 1px rgba(255, 241, 209, .18);
}

.build-strip::-webkit-scrollbar-thumb:hover {
  background: rgba(250, 213, 146, .88);
  background-clip: padding-box;
}

.build-strip::-webkit-scrollbar-button {
  display: none;
}

.build-placeholder {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  border: 1px dashed rgba(232, 204, 145, .15);
  color: rgba(240, 228, 202, .38);
  font-family: var(--serif);
  font-size: 11px;
}

.build-placeholder::before {
  content: "⌖";
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(231, 187, 105, .22);
  border-radius: 50%;
  color: var(--amber-light);
  font-size: 15px;
}

.build-card {
  position: relative;
  width: 93px;
  min-width: 93px;
  overflow: hidden;
  padding: 6px 7px 7px;
  border: 1px solid rgba(233, 207, 156, .13);
  border-radius: 1px;
  color: rgba(241, 230, 207, .76);
  background: rgba(255, 255, 255, .017);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}

.build-card:hover,
.build-card.is-active {
  border-color: rgba(232, 186, 102, .42);
  background: rgba(224, 163, 74, .06);
  transform: translateY(-2px);
}

.build-card.is-unaffordable {
  border-color: rgba(194, 111, 77, .22);
}

.build-card.is-unaffordable .build-cost {
  color: rgba(222, 143, 105, .7);
}

.build-card.is-unsupported {
  opacity: .42;
  filter: grayscale(.55);
}

.build-card:disabled {
  cursor: not-allowed;
  transform: none;
}

.build-card:disabled:hover,
.build-card.is-unsupported:hover {
  border-color: rgba(233, 207, 156, .13);
  background: rgba(255, 255, 255, .017);
  transform: none;
}

.build-art {
  position: relative;
  height: 66px;
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(232, 201, 139, .1);
  background: radial-gradient(ellipse at 50% 80%, rgba(226, 179, 96, .11), transparent 54%);
}

.build-art::before,
.build-art::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.build-art::before {
  bottom: 12px;
  width: 48px;
  height: 28px;
  border: 2px solid rgba(74, 50, 30, .8);
  background:
    repeating-linear-gradient(90deg, #9e724a 0 3px, #775136 3px 8px);
  box-shadow: inset 0 4px rgba(255, 224, 168, .17), 0 4px 0 #4d3527;
  clip-path: polygon(0 30%, 50% 0, 100% 30%, 100% 100%, 0 100%);
}

.build-art::after {
  bottom: 38px;
  width: 53px;
  height: 21px;
  background: linear-gradient(155deg, #c27a46, #673d2e 66%);
  clip-path: polygon(0 100%, 48% 0, 55% 0, 100% 100%, 76% 82%, 50% 50%, 24% 82%);
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .28));
}

.build-forester .build-art::before {
  width: 43px;
  height: 24px;
  border-color: #455335;
  background: repeating-linear-gradient(90deg, #866344 0 4px, #5f4834 4px 9px);
}

.build-forester .build-art::after {
  width: 61px;
  height: 34px;
  bottom: 27px;
  background:
    radial-gradient(circle at 14% 78%, #55763f 0 11px, transparent 12px),
    radial-gradient(circle at 46% 56%, #68894b 0 14px, transparent 15px),
    radial-gradient(circle at 79% 80%, #4e6d3c 0 12px, transparent 13px);
  clip-path: none;
}

.build-sawmill .build-art::before {
  width: 45px;
  height: 28px;
  margin-left: -9px;
  background: repeating-linear-gradient(90deg, #926b4b 0 4px, #654733 4px 9px);
}

.build-sawmill .build-art::after {
  width: 35px;
  height: 35px;
  margin-left: 25px;
  bottom: 15px;
  border: 3px solid #d1c299;
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 46%, #a9946d 47% 53%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, #a9946d 47% 53%, transparent 54%);
  clip-path: none;
}

.build-mill .build-art::before {
  width: 35px;
  height: 30px;
  background: linear-gradient(90deg, #a97b4d, #704b34);
}

.build-mill .build-art::after {
  width: 63px;
  height: 63px;
  bottom: 11px;
  background:
    linear-gradient(0deg, transparent 48%, #d8c593 49% 51%, transparent 52%),
    linear-gradient(90deg, transparent 48%, #d8c593 49% 51%, transparent 52%),
    linear-gradient(45deg, transparent 48%, #c7b27d 49% 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, #c7b27d 49% 51%, transparent 52%);
  clip-path: none;
  filter: opacity(.75) drop-shadow(0 2px 2px rgba(0, 0, 0, .2));
}

.build-bakery .build-art::before {
  width: 52px;
  height: 28px;
  background: repeating-linear-gradient(0deg, #b18357 0 6px, #8b6241 6px 8px);
}

.build-bakery .build-art::after {
  width: 49px;
  height: 25px;
  bottom: 35px;
  background:
    radial-gradient(circle at 82% 5%, rgba(226, 220, 196, .45) 0 9px, transparent 10px),
    linear-gradient(150deg, #b35e42, #713c31);
  clip-path: polygon(0 100%, 8% 22%, 86% 22%, 100% 100%);
}

.build-fisher .build-art::before {
  width: 46px;
  height: 24px;
  bottom: 9px;
  border-color: #3f5b55;
  background: repeating-linear-gradient(90deg, #82684d 0 4px, #5d4938 4px 9px);
}

.build-fisher .build-art::after {
  width: 58px;
  height: 31px;
  bottom: 24px;
  background:
    linear-gradient(28deg, transparent 47%, rgba(223, 210, 168, .72) 48% 51%, transparent 52%),
    linear-gradient(-28deg, transparent 47%, rgba(223, 210, 168, .72) 48% 51%, transparent 52%),
    linear-gradient(160deg, #607b69, #3b5048);
  clip-path: polygon(0 100%, 17% 20%, 83% 20%, 100% 100%);
}

.build-harbor .build-art::before {
  width: 62px;
  height: 22px;
  bottom: 8px;
  border-color: #4b3828;
  background:
    linear-gradient(90deg, #866444 0 31px, transparent 31px),
    repeating-linear-gradient(90deg, #7c5b3f 0 7px, #543e2e 7px 10px);
  clip-path: polygon(0 15%, 53% 0, 100% 24%, 100% 100%, 0 100%);
  transform: translateX(-38%);
}

.build-harbor .build-art::after {
  width: 47px;
  height: 38px;
  bottom: 24px;
  background:
    linear-gradient(105deg, transparent 0 45%, #cfb67e 46% 49%, transparent 50%),
    linear-gradient(165deg, rgba(234, 215, 167, .84) 0 42%, transparent 43%),
    linear-gradient(145deg, #657c70, #3d504a);
  clip-path: polygon(0 100%, 12% 31%, 39% 0, 58% 35%, 100% 100%);
  filter: drop-shadow(0 4px 2px rgba(0, 0, 0, .28));
}

.build-barracks .build-art::before {
  width: 59px;
  height: 27px;
  background: repeating-linear-gradient(90deg, #78634b 0 4px, #524333 4px 9px);
}

.build-barracks .build-art::after {
  width: 64px;
  height: 22px;
  bottom: 20px;
  background:
    linear-gradient(90deg, transparent 0 7%, #d6b873 8% 10%, transparent 11% 89%, #d6b873 90% 92%, transparent 93%),
    linear-gradient(150deg, #69523a, #3e3227);
  clip-path: polygon(0 100%, 4% 0, 96% 0, 100% 100%);
}

.build-guard_post .build-art::before {
  width: 54px;
  height: 27px;
  bottom: 8px;
  border: 2px solid #5b402c;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, #6e4c32 8px 11px),
    linear-gradient(180deg, #817057, #493d31);
  clip-path: polygon(4% 18%, 20% 0, 24% 18%, 40% 0, 44% 18%, 60% 0, 64% 18%, 80% 0, 84% 18%, 100% 6%, 96% 100%, 4% 100%);
}

.build-guard_post .build-art::after {
  width: 36px;
  height: 23px;
  bottom: 30px;
  background: linear-gradient(150deg, #a08056, #594735);
  clip-path: polygon(0 100%, 12% 24%, 88% 24%, 100% 100%);
}

.build-border_fort .build-art::before {
  width: 66px;
  height: 33px;
  bottom: 7px;
  border-color: #41453f;
  background:
    repeating-linear-gradient(0deg, #6d6f65 0 5px, #50534b 5px 7px);
  clip-path: polygon(0 26%, 12% 0, 18% 22%, 34% 0, 40% 22%, 60% 22%, 66% 0, 82% 22%, 88% 0, 100% 26%, 100% 100%, 0 100%);
}

.build-border_fort .build-art::after {
  width: 53px;
  height: 29px;
  bottom: 31px;
  background:
    linear-gradient(90deg, transparent 0 8%, #5f4030 8% 92%, transparent 92%),
    linear-gradient(150deg, #817865, #454941);
  clip-path: polygon(0 100%, 10% 18%, 24% 5%, 76% 5%, 90% 18%, 100% 100%);
}

.build-quarry .build-art::before {
  width: 55px;
  height: 31px;
  border-color: #4c4c41;
  background: repeating-linear-gradient(0deg, #777465 0 5px, #56574d 5px 7px);
}

.build-quarry .build-art::after {
  width: 57px;
  height: 27px;
  background: linear-gradient(160deg, #918c75, #474b43);
  clip-path: polygon(0 100%, 18% 44%, 35% 68%, 52% 15%, 71% 55%, 100% 100%);
}

.build-stone_pit .build-art::before {
  width: 58px;
  height: 22px;
  bottom: 8px;
  border: 1px solid rgba(67, 61, 48, .75);
  background:
    radial-gradient(circle at 24% 44%, #858274 0 4px, transparent 4.5px),
    radial-gradient(circle at 49% 28%, #969181 0 5px, transparent 5.5px),
    radial-gradient(circle at 72% 55%, #77766b 0 4px, transparent 4.5px),
    linear-gradient(180deg, #55594f, #373c35);
  clip-path: polygon(4% 54%, 20% 9%, 43% 0, 70% 16%, 97% 48%, 100% 100%, 0 100%);
  box-shadow: none;
}

.build-stone_pit .build-art::after {
  width: 32px;
  height: 27px;
  bottom: 9px;
  background: transparent;
  border-left: 3px solid #755135;
  border-right: 3px solid #5d412d;
  clip-path: polygon(0 100%, 34% 0, 66% 0, 100% 100%);
  filter: none;
}

.build-farm .build-art::before {
  width: 59px;
  height: 25px;
  bottom: 8px;
  background:
    repeating-linear-gradient(115deg, #bf9a51 0 3px, #876a38 3px 6px);
  clip-path: polygon(0 20%, 50% 0, 100% 20%, 92% 100%, 8% 100%);
  border-color: #6b552e;
}

.build-farm .build-art::after {
  width: 35px;
  height: 30px;
  bottom: 32px;
  background: linear-gradient(150deg, #d3b36a, #745334 70%);
  clip-path: polygon(0 100%, 0 35%, 50% 0, 100% 35%, 100% 100%);
}

.build-iron_mine .build-art::before {
  width: 54px;
  height: 34px;
  background:
    linear-gradient(90deg, transparent 0 17px, #2b241e 17px 36px, transparent 36px),
    repeating-linear-gradient(0deg, #55584f 0 6px, #393d38 6px 8px);
  clip-path: polygon(0 100%, 10% 42%, 30% 25%, 65% 18%, 100% 100%);
  border: 0;
}

.build-iron_mine .build-art::after {
  width: 28px;
  height: 30px;
  bottom: 8px;
  border: 3px solid #684b33;
  border-bottom: 0;
  background: #1d1c19;
  clip-path: none;
}

.build-smelter .build-art::before {
  width: 32px;
  height: 43px;
  bottom: 7px;
  background: linear-gradient(90deg, #605f53, #93907e 48%, #535449);
  clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%);
  border: 0;
}

.build-smelter .build-art::after {
  width: 42px;
  height: 23px;
  bottom: 36px;
  background: #4d4c43;
  clip-path: polygon(0 100%, 15% 20%, 85% 20%, 100% 100%);
}

.build-workshop .build-art::before {
  width: 51px;
  height: 29px;
  background: repeating-linear-gradient(90deg, #7b6a50 0 4px, #514536 4px 9px);
}

.build-workshop .build-art::after {
  width: 56px;
  height: 18px;
  background: linear-gradient(150deg, #9e865e, #54422e);
}

.build-warehouse .build-art::before {
  width: 58px;
  height: 31px;
  background:
    linear-gradient(90deg, transparent 0 40px, #8c643d 40px 50px, transparent 50px),
    repeating-linear-gradient(90deg, #8a6a49 0 7px, #604631 7px 12px);
  clip-path: polygon(0 14%, 50% 0, 100% 14%, 95% 100%, 5% 100%);
}

.build-warehouse .build-art::after {
  width: 24px;
  height: 22px;
  bottom: 8px;
  background: #3f3428;
  border: 1px solid #a57a4b;
}

.build-watchtower .build-art::before {
  width: 27px;
  height: 45px;
  bottom: 6px;
  background: repeating-linear-gradient(90deg, #765336 0 4px, #4b3929 4px 8px);
  clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%);
  border: 0;
}

.build-watchtower .build-art::after {
  width: 43px;
  height: 21px;
  bottom: 43px;
  background: #5f412a;
  clip-path: polygon(0 100%, 12% 25%, 88% 25%, 100% 100%);
}

.build-market .build-art::before {
  width: 57px;
  height: 26px;
  background: repeating-linear-gradient(105deg, #bb7248 0 8px, #e4c687 8px 15px);
  clip-path: polygon(0 35%, 50% 0, 100% 35%, 93% 100%, 7% 100%);
}

.build-market .build-art::after {
  width: 43px;
  height: 17px;
  bottom: 35px;
  background: linear-gradient(160deg, #ad7145, #6b4431);
  clip-path: polygon(0 100%, 15% 0, 85% 0, 100% 100%);
}

.build-well .build-art::before {
  bottom: 9px;
  width: 42px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse, #202926 0 33%, transparent 35%),
    #77766a;
  clip-path: none;
}

.build-well .build-art::after {
  bottom: 22px;
  width: 48px;
  height: 29px;
  background:
    linear-gradient(90deg, transparent 0 6px, #80603e 6px 11px, transparent 11px 37px, #80603e 37px 42px, transparent 42px),
    linear-gradient(155deg, transparent 0 12%, #8b5c39 13% 47%, #5d402d 48% 100%);
  clip-path: polygon(0 45%, 50% 0, 100% 45%, 89% 58%, 50% 28%, 11% 58%);
}

.build-brewery .build-art::before {
  bottom: 10px;
  width: 53px;
  height: 34px;
  border: 1px solid #4f382a;
  background:
    linear-gradient(90deg, transparent 0 43%, #9f703d 43% 64%, transparent 64%),
    repeating-linear-gradient(90deg, #8d6747 0 7px, #604832 7px 12px);
  clip-path: polygon(0 22%, 50% 0, 100% 22%, 94% 100%, 6% 100%);
}

.build-brewery .build-art::after {
  bottom: 9px;
  width: 18px;
  height: 24px;
  border-radius: 45% 45% 30% 30%;
  background: linear-gradient(90deg, #9a6a35, #c69750 48%, #82562f);
  border: 1px solid rgba(240, 196, 111, .5);
}

.build-gopher_farm .build-art::before {
  bottom: 9px;
  width: 51px;
  height: 49px;
  border: 1px solid rgba(33, 92, 101, .55);
  border-radius: 48% 48% 42% 42%;
  background:
    radial-gradient(circle at 34% 40%, #202625 0 4px, transparent 4.5px),
    radial-gradient(circle at 66% 40%, #202625 0 4px, transparent 4.5px),
    radial-gradient(ellipse at 50% 68%, #d9bd92 0 14px, transparent 15px),
    linear-gradient(180deg, #7bcbd5, #5fafbe);
  box-shadow:
    -22px 8px 0 -15px #65b7c7,
    22px 8px 0 -15px #65b7c7,
    inset 0 -7px rgba(35, 102, 111, .14);
  clip-path: none;
}

.build-gopher_farm .build-art::after {
  bottom: 8px;
  width: 13px;
  height: 8px;
  background:
    linear-gradient(90deg, transparent 0 1px, #fbf8e9 1px 6px, transparent 6px 7px, #fbf8e9 7px 12px, transparent 12px),
    #d9bd92;
  border: 0;
  filter: none;
}

.build-card-name {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.build-card-size {
  position: absolute;
  top: 4px;
  left: 5px;
  padding: 1px 4px;
  color: rgba(247, 228, 189, .76);
  background: rgba(13, 26, 18, .72);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.build-card-level {
  margin-left: 3px;
  color: rgba(236, 189, 102, .55);
  font-family: var(--sans);
  font-size: 7px;
}

.build-cost {
  display: flex;
  gap: 4px;
  margin-top: 3px;
  color: rgba(240, 226, 197, .35);
  font-size: 7px;
}

.build-key {
  position: absolute;
  top: 3px;
  right: 4px;
  color: rgba(241, 222, 181, .24);
  font-size: 7px;
}

.selection-card {
  position: absolute;
  z-index: 15;
  bottom: 212px;
  left: 50%;
  width: 270px;
  padding: 14px;
  border: 1px solid rgba(236, 201, 134, .36);
  color: rgba(241, 232, 212, .68);
  background: rgba(18, 32, 24, .95);
  box-shadow: var(--shadow);
  font-family: var(--serif);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.mobile-panel-button {
  position: absolute;
  z-index: 11;
  top: 80px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: none;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(236, 196, 118, .36);
  border-radius: 50%;
  color: var(--amber-light);
  background: rgba(18, 34, 25, .9);
  box-shadow: 0 7px 22px rgba(0, 0, 0, .24);
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.selection-card h3 {
  margin: 2px 0 5px;
  color: #f1e3c4;
  font-size: 17px;
  font-weight: 500;
}

.selection-card p {
  margin: 5px 0;
  font-size: 10px;
  line-height: 1.45;
}

#selection-close,
.modal-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  color: rgba(239, 228, 204, .45);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.selected-kicker {
  color: var(--amber-light);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.selected-progress {
  height: 2px;
  margin-top: 9px;
  background: rgba(255, 255, 255, .08);
}

.selected-progress span {
  display: block;
  height: 100%;
  background: var(--amber-light);
}

.modal-backdrop {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 13, 9, .7);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: clamp(24px, 4vw, 45px);
  border: 1px solid rgba(236, 202, 135, .42);
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, .08), transparent 25%),
    radial-gradient(circle at 100% 0, rgba(161, 121, 64, .2), transparent 28%),
    var(--paper);
  box-shadow: 0 35px 100px rgba(0, 0, 0, .5), inset 0 0 80px rgba(99, 76, 39, .08);
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(93, 74, 44, .14);
  pointer-events: none;
}

.modal-card h2 {
  margin: 5px 0 25px;
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(78, 64, 40, .16);
  border: 1px solid rgba(78, 64, 40, .16);
}

.help-grid article {
  padding: 18px;
  background: rgba(246, 238, 219, .72);
}

.help-grid article > span {
  color: #a36f32;
  font-family: var(--serif);
  font-size: 11px;
  font-style: italic;
}

.help-grid h3 {
  margin: 5px 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.help-grid p {
  margin: 0;
  color: #5f5a4d;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.55;
}

.controls-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  margin-top: 20px;
  color: #696150;
  font-size: 10px;
}

.controls-list kbd {
  color: #4f4737;
  border-color: rgba(73, 62, 42, .24);
  background: rgba(72, 61, 43, .05);
}

.military-policy-card {
  width: min(680px, 100%);
}

.military-policy-intro {
  margin: -14px 0 22px;
  color: #655d4e;
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.55;
}

.military-target-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -6px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(91, 66, 38, .22);
  background: rgba(111, 76, 41, .055);
}

.military-target-control > div:first-child {
  display: grid;
  gap: 3px;
}

.military-target-control strong {
  color: #514735;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
}

.military-target-control small {
  color: #766a55;
  font-family: var(--serif);
  font-size: 10px;
}

.military-target-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.military-wave-field {
  display: grid;
  grid-template-columns: auto 44px;
  align-items: center;
  gap: 5px;
  color: #766a55;
  font-family: var(--serif);
  font-size: 9px;
}

.military-wave-field input {
  width: 44px;
  padding: 5px 4px;
  border: 1px solid rgba(112, 76, 37, .25);
  color: #514735;
  background: rgba(255, 255, 255, .32);
  font-family: var(--sans);
  font-size: 10px;
  text-align: center;
}

.military-target-actions button {
  padding: 7px 9px;
  border: 1px solid rgba(112, 76, 37, .25);
  color: #694b29;
  background: rgba(134, 91, 43, .07);
  font-family: var(--serif);
  font-size: 9px;
  cursor: pointer;
}

.military-target-actions button:hover {
  background: rgba(134, 91, 43, .14);
}

.military-policy-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  padding: 16px;
  border: 1px solid rgba(82, 67, 43, .18);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 20px),
    rgba(244, 235, 215, .5);
}

.military-policy-form > label {
  display: grid;
  gap: 6px;
  color: #615947;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.military-policy-form > label > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.military-policy-form input:not([type="checkbox"]),
.military-policy-form select {
  width: 100%;
  height: 32px;
  padding: 5px 8px;
  border: 1px solid rgba(77, 65, 44, .24);
  color: #4f4738;
  background: rgba(252, 246, 231, .7);
  font-family: var(--serif);
  font-size: 11px;
}

.military-policy-form input[type="range"] {
  padding: 0;
  accent-color: #8d6a3e;
}

.military-policy-form output {
  color: #8f632b;
  font-family: var(--serif);
  font-size: 11px;
}

.military-distance-targets {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(94, 70, 39, .16);
  background: rgba(94, 70, 39, .035);
}

.military-distance-targets p {
  grid-column: 1 / -1;
  margin: 0;
  color: #655b48;
  font-family: var(--serif);
  font-size: 10px;
}

.military-distance-targets label {
  display: grid;
  gap: 5px;
  color: #746650;
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.military-distance-targets input,
.military-distance-targets select {
  width: 100%;
  height: 31px;
  padding: 5px 8px;
  border: 1px solid rgba(77, 65, 44, .22);
  color: #4f4738;
  background: rgba(252, 246, 231, .72);
  font-family: var(--serif);
  font-size: 11px;
}

.military-policy-form .military-policy-toggle-line {
  grid-column: 1 / -1;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(70, 91, 72, .16);
  color: #4f5848;
  background: rgba(54, 87, 61, .045);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.military-policy-form input[type="checkbox"] {
  accent-color: #667f59;
}

.military-policy-status {
  margin: 13px 0;
  color: #78684f;
  font-family: var(--serif);
  font-size: 11px;
}

.military-policy-card > .primary-button {
  width: 100%;
}

@media (max-width: 620px) {
  .military-policy-form {
    grid-template-columns: 1fr;
  }

  .military-policy-form .military-policy-toggle-line {
    grid-column: 1;
  }

  .military-distance-targets {
    grid-template-columns: 1fr;
  }

  .military-distance-targets p {
    grid-column: 1;
  }

  .military-target-control {
    align-items: stretch;
    flex-direction: column;
  }
}

.logout-button {
  margin-top: 20px;
  padding: 8px 11px;
  border: 1px solid rgba(82, 67, 43, .22);
  color: #655b49;
  background: rgba(72, 61, 43, .04);
  font-family: var(--sans);
  font-size: 9px;
  cursor: pointer;
}

.warehouse-rules {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(235, 215, 173, .12);
}

.warehouse-rule-row {
  display: grid;
  grid-template-columns: 1fr 55px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.warehouse-rule-row label {
  color: rgba(239, 228, 204, .58);
  font-family: var(--serif);
  font-size: 10px;
}

.warehouse-rule-row input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid rgba(233, 207, 155, .2);
  color: #f0ddb5;
  background: rgba(7, 18, 13, .42);
  text-align: right;
}

.upgrade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(235, 215, 173, .12);
}

.upgrade-copy {
  color: rgba(239, 228, 204, .45);
  font-size: 9px;
  line-height: 1.4;
}

.upgrade-button {
  padding: 7px 9px;
  border: 1px solid rgba(232, 187, 105, .35);
  color: var(--amber-light);
  background: rgba(217, 158, 71, .07);
  font-family: var(--serif);
  font-size: 9px;
  cursor: pointer;
}

.military-controls {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(235, 215, 173, .12);
}

.military-controls > p:not(.section-label) {
  margin: 0 0 8px;
  color: rgba(239, 228, 204, .45);
  font-family: var(--serif);
  font-size: 9px;
  line-height: 1.45;
}

.military-policy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 0 0 9px;
}

.military-policy-grid label {
  display: grid;
  gap: 3px;
  color: rgba(239, 228, 204, .45);
  font-size: 7px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.military-policy-grid select {
  width: 100%;
  padding: 5px;
  border: 1px solid rgba(232, 207, 157, .18);
  color: #ead7b0;
  background: rgba(5, 15, 11, .65);
  font-family: var(--serif);
  font-size: 9px;
}

.military-policy-grid .military-auto-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(112, 168, 159, .17);
  color: rgba(213, 231, 220, .65);
  background: rgba(63, 114, 105, .06);
  letter-spacing: 0;
  text-transform: none;
}

.military-policy-grid input[type="checkbox"] {
  accent-color: #78a89a;
}

.military-train-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 6px;
}

.military-train-button {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid rgba(112, 168, 159, .35);
  color: #c6ded5;
  background: rgba(63, 114, 105, .1);
  font-family: var(--serif);
  font-size: 10px;
  text-align: left;
  cursor: pointer;
}

.military-train-button small {
  display: block;
  margin-top: 2px;
  color: rgba(213, 231, 220, .4);
  font-family: var(--sans);
  font-size: 7px;
}

.domain-local-stock {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 9px;
}

.domain-good {
  padding: 3px 6px;
  border: 1px solid rgba(232, 207, 157, .11);
  color: rgba(239, 228, 203, .55);
  font-size: 8px;
}

.domain-good.complete {
  border-color: rgba(171, 199, 118, .3);
  color: #c9db9a;
  background: rgba(112, 143, 73, .1);
}

.construction-materials {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(222, 174, 94, .2);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .012) 0 1px, transparent 1px 18px),
    rgba(8, 16, 12, .3);
}

.construction-materials .section-label {
  margin-bottom: 7px;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .025);
}

::-webkit-scrollbar-thumb {
  background: rgba(225, 194, 132, .23);
}

.auth-page {
  overflow: auto;
  background:
    radial-gradient(circle at 72% 8%, rgba(218, 167, 82, .2), transparent 28%),
    linear-gradient(145deg, #1d3429, #0c1812 72%);
}

.auth-complete {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-complete-card {
  position: relative;
  width: min(480px, 100%);
  padding: clamp(28px, 6vw, 50px);
  border: 1px solid rgba(235, 198, 127, .38);
  color: var(--paper);
  background:
    linear-gradient(140deg, rgba(255, 226, 164, .08), transparent 36%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .015) 0 1px, transparent 1px 28px),
    rgba(22, 40, 30, .94);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .46), inset 0 0 70px rgba(225, 173, 90, .035);
}

.auth-complete-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(238, 207, 146, .1);
  pointer-events: none;
}

.auth-complete-card h1 {
  margin: 8px 0 16px;
  color: #f5e7ca;
  font-family: var(--serif);
  font-size: clamp(34px, 7vw, 52px);
  font-weight: 500;
  line-height: 1;
}

.auth-complete-card > p:not(.eyebrow) {
  margin: 0 0 14px;
  color: rgba(241, 231, 210, .7);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
}

.auth-complete-card .auth-email {
  padding: 9px 11px;
  border-left: 2px solid var(--amber);
  color: var(--amber-light);
  background: rgba(218, 158, 72, .07);
  overflow-wrap: anywhere;
}

.remember-device {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 22px 0 17px;
  color: rgba(241, 231, 210, .68);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}

.remember-device input {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin: 0;
  accent-color: #c98a42;
}

.auth-complete-card form .primary-button {
  width: 100%;
}

.auth-back-link {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  text-decoration: none;
}

@media (max-width: 1240px) {
  .top-bar {
    gap: 12px;
  }

  .brand-lockup {
    min-width: 174px;
  }

  .resource-pill {
    min-width: 64px;
    padding: 6px 7px;
  }

  .resource-pill small {
    display: none;
  }

  .left-rail {
    width: 224px;
  }

  .right-rail {
    width: 280px;
  }

  .quick-actions {
    width: 250px;
  }

  .quick-button {
    gap: 6px;
    padding: 6px;
  }

  .quick-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    font-size: 12px;
  }
}

@media (max-width: 1020px) {
  .left-rail,
  .right-rail {
    display: none;
  }

  .mobile-panel-button {
    display: grid;
  }

  .right-rail.is-mobile-open {
    z-index: 10;
    top: 72px;
    right: 12px;
    bottom: 202px;
    left: 12px;
    width: auto;
    display: flex;
    pointer-events: auto;
    animation: panel-reveal .2s ease both;
  }

  .right-rail.is-mobile-open .chronicle-panel {
    background:
      linear-gradient(135deg, rgba(255, 255, 255, .05), transparent 36%),
      linear-gradient(180deg, rgba(27, 43, 34, .98), rgba(18, 31, 24, .98));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  }

  .resource-ribbon {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .command-dock {
    height: 180px;
  }

  .selection-card {
    bottom: 212px;
  }

  .quick-actions {
    width: 250px;
  }
}

@keyframes panel-reveal {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .lobby {
    width: 100%;
    padding: 26px;
    justify-content: flex-end;
    padding-bottom: 12vh;
  }

  .lobby h1 {
    font-size: clamp(60px, 20vw, 92px);
  }

  .lobby-copy {
    max-width: 95%;
    font-size: 15px;
  }

  .join-row {
    display: block;
    background: rgba(7, 16, 12, .76);
  }

  .join-row input {
    width: 100%;
  }

  .primary-button {
    width: 100%;
    min-height: 46px;
  }

  .lobby-footnote {
    display: none;
  }

  .top-bar {
    height: 62px;
    padding: 0 8px;
  }

  .brand-lockup {
    min-width: 42px;
  }

  .brand-lockup > div,
  .online-pill,
  #sound-toggle {
    display: none;
  }

  .brand-crest {
    width: 31px;
    height: 31px;
  }

  .resource-ribbon {
    gap: 1px;
  }

  .resource-pill {
    min-width: 54px;
    padding: 5px;
    font-size: 11px;
  }

  .resource-glyph {
    width: 14px;
    height: 14px;
  }

  .resource-glyph::before {
    width: 10px;
    height: 10px;
  }

  .top-actions {
    min-width: 32px;
  }

  .command-dock {
    right: 0;
    bottom: 0;
    left: 0;
    height: 192px;
    padding: 8px;
    gap: 6px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
  }

  .right-rail.is-mobile-open {
    bottom: 208px;
  }

  .quick-actions {
    width: 48px;
    height: 152px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    overflow: hidden;
  }

  .quick-button {
    flex: 0 0 28px;
    justify-content: center;
    height: 28px;
    min-height: 28px;
    padding: 2px;
    border: 0;
    background: transparent;
  }

  .quick-button > span:last-child {
    display: none;
  }

  .quick-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .dock-divider {
    display: block;
  }

  .build-heading-copy small {
    display: none;
  }

  .build-heading-copy {
    gap: 0;
  }

  .build-heading-copy > span {
    max-width: 155px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
  }

  .build-strip-heading {
    gap: 4px;
  }

  .site-support {
    margin-left: auto;
  }

  .build-card {
    width: 78px;
    min-width: 78px;
  }

  .build-art {
    height: 68px;
    transform: scale(.86);
    transform-origin: center bottom;
  }

  .build-card-name {
    font-size: 9px;
  }

  .mode-banner {
    top: 70px;
    max-width: calc(100vw - 24px);
    flex-wrap: wrap;
    justify-content: center;
    white-space: normal;
  }

  .selection-filters {
    flex-basis: 100%;
    justify-content: center;
    padding-left: 0;
    border-left: 0;
  }

  .toast-stack {
    top: 72px;
    width: calc(100vw - 32px);
  }

  .toast {
    max-width: 100%;
  }

  .selection-card {
    right: 12px;
    bottom: 204px;
    left: auto;
    width: min(270px, calc(100vw - 24px));
    transform: none;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
