/* Warfare — interface.

   Lacquered gunmetal panels, bone-coloured inner cards, brass rules and
   olive-drab actions: the look of a 1940s command room rendered in glass and
   steel. Dialogs are dark with bone borders; anything holding data is a bone
   card inset into them. */

:root {
  /* Chrome */
  --panel:        rgba(35, 37, 43, .93);
  --panel-solid:  #23252b;
  --panel-deep:   #13131b;
  --ink-black:    #12100b;
  --chrome-hi:    #3e4041;
  --chrome-lo:    #2c2d2e;

  /* Bone / parchment */
  --bone:         #c5bea8;
  --bone-lit:     #dfdccd;
  --bone-dim:     #b3ac95;
  --bone-deep:    #9d9680;

  /* Ink and text */
  --ink:          #1d1b12;
  --ink-soft:     #4c4839;
  --text:         #e5e2d5;
  --text-dim:     #9b9682;
  --gold:         #fff9bf;
  --brass:        #c9a949;
  --brass-dim:    #8d7631;

  /* Lines */
  --edge:         #827c67;
  --edge-dark:    #1d1a12;

  /* Signals */
  --red:          #c43222;
  --red-dark:     #8a2418;
  --green-1:      #798f43;
  --green-2:      #38451b;
  --green-solid:  #596c2b;
  --amber:        #d8a63c;

  /* Metrics */
  /* Spacing scale. The original works on one grid and never leaves it:
     inside a control, between rows, inside a card, between cards, and the
     inset from the dialog edge. Nothing in the interface uses anything else,
     which is what makes it obvious what belongs to what. */
  --s1: 4px;      /* icon to its label, chip internals          */
  --s2: 8px;      /* row to row inside one group                */
  --s3: 12px;     /* the padding inside a card                  */
  --s4: 16px;     /* card to card, section to section           */
  --s5: 20px;     /* the inset from a dialog's edge             */

  /* Type scale, four steps and no more. */
  --fs-title: 22px;   /* a dialog's name          */
  --fs-head: 15px;    /* a section heading        */
  --fs-body: 13.5px;  /* running text             */
  --fs-small: 12px;   /* captions and footnotes   */
  --lh-body: 1.5;

  --topbar-h: 50px;
  --rail-w: 70px;
  /* The advert column on the right (src/ui/sidecolumn.js): 0 or 300px. The game
     lives in the width left over, so anything placed against the right edge
     or centred on the screen measures from --game-w, never from 100vw. */
  --ad-w: 0px;
  --game-w: calc(100vw - var(--ad-w));
  --f-head: Oswald, "Arial Narrow", sans-serif;
  --f-ui: Montserrat, "Segoe UI", sans-serif;
  --f-serif: Kameron, Georgia, serif;

  --shadow-dialog: 0 0 10px 2px #000;
  --shadow-inset: inset 0 0 8px rgba(0, 0, 0, .7);
  --shadow-btn: inset 0 1px 2px rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0a0b0d; color: var(--text);
  font-family: var(--f-ui); font-size: 14px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }

.ic { display: inline-flex; width: 1em; height: 1em; flex: none; }
.ic svg { width: 100%; height: 100%; display: block; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, .35); }
::-webkit-scrollbar-thumb { background: #4a4738; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #63604d; }

/* ------------------------------------------------------------------ shell */
/* A query container, so the game's own breakpoints follow the room the game
   has rather than the window's width. Nothing fixed-position lives inside
   #app (see the note on #tooltip), so the containment costs nothing. */
#app { position: fixed; inset: 0; right: var(--ad-w); container: game / inline-size; }
#map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ----------------------------------------------------------------- topbar */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; padding: 0 6px; gap: 10px;
  background: var(--panel);
  border-bottom: 1px solid #000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
  z-index: 40;
}

.tp-box {
  background: var(--panel-deep); border-radius: 1px; height: 40px;
  display: flex; align-items: center; box-shadow: var(--shadow-inset);
}

.bar-player { display: flex; align-items: center; gap: 4px; }
.bar-player .avatar {
  width: 43px; height: 40px; flex: none; border-radius: 1px;
  background: var(--panel-deep) center/cover no-repeat;
  box-shadow: var(--shadow-inset);
}
.bar-player .who { padding: 0 9px; flex-direction: column; align-items: flex-start; justify-content: center; }
.bar-player .who b {
  font-family: var(--f-head); font-weight: 500; font-size: 14px; line-height: 1.15;
  color: var(--text); letter-spacing: .04em; white-space: nowrap;
}
.bar-player .who span { font-size: 11.5px; color: var(--text-dim); letter-spacing: .08em; text-transform: uppercase; }
.bar-player .flag { width: 45px; height: 25px; margin: 0 5px; background-size: cover; box-shadow: 0 0 0 1px #000, 0 0 0 2px rgba(130,124,103,.45); }

.vp-chip {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px;
  background: var(--panel-solid); border-radius: 1px; cursor: pointer;
}
.vp-chip .ic { font-size: 17px; color: var(--brass); }
.vp-chip b { font-family: var(--f-head); font-weight: 500; font-size: 16px; color: var(--gold); }

#resource-bar { display: flex; align-items: center; margin: 0 auto; height: 40px; }
.res {
  width: 96px; height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 5px;
  border-radius: 2px; cursor: default;
}
.res:hover { background: rgba(255, 249, 191, .07); }
.res .ic { font-size: 23px; color: var(--brass); filter: drop-shadow(0 1px 0 rgba(0,0,0,.8)); }
.res .amt { font-family: var(--f-head); font-weight: 400; font-size: 16px; line-height: 1.05; color: var(--text); }
.res .rate { font-family: var(--f-ui); font-size: 12px; font-weight: 600; line-height: 1.2; color: var(--green-1); white-space: nowrap; }
.res .rate.neg { color: #e0705a; }
.res.low .amt { color: #eb9d84; }

.bar-right { display: flex; align-items: center; gap: 5px; }
.gold-chip { height: 40px; padding: 0 12px; gap: 8px; border-radius: 1px; }
.gold-chip button { min-width: 28px; min-height: 28px; }
.gold-chip .ic { font-size: 18px; color: #e9c765; }
.gold-chip b { font-family: var(--f-head); font-weight: 400; font-size: 17px; color: var(--gold); letter-spacing: .03em; }

.chrome-btn {
  width: 38px; height: 34px; display: grid; place-items: center; border-radius: 2px;
  color: #b5ab86; font-size: 19px; position: relative;
  background: linear-gradient(var(--chrome-hi) 36%, var(--chrome-lo) 51%, var(--chrome-lo) 67%);
  border: 1px solid var(--edge-dark);
  box-shadow: inset 0 -1px 0 #1a1a1b, var(--shadow-btn);
}
.chrome-btn:hover { color: var(--gold); filter: brightness(1.22); }
.chrome-btn.on { color: #1a1710; background: linear-gradient(#e0c164, #a8862f); }

/* ------------------------------------------------------------------- rail */
#rail {
  position: absolute; left: 0; top: 152px;
  display: flex; flex-direction: column; gap: 10px; z-index: 30;
}
.rail-btn {
  width: 60px; height: 60px; display: grid; place-items: center; border-radius: 0;
  color: var(--brass); font-size: 29px; position: relative;
  background: linear-gradient(var(--chrome-hi) 36%, var(--chrome-lo) 51%, var(--chrome-lo) 67%);
  border: 1px solid var(--edge-dark);
  box-shadow: inset 0 -1px 0 #1a1a1b, 0 2px 5px rgba(0, 0, 0, .5);
  transition: filter .12s;
}
.rail-btn:hover { filter: brightness(1.28); color: var(--gold); }
.rail-btn.on { color: #17140d; background: linear-gradient(#e2c366, #a8862f); }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-family: var(--f-ui); font-weight: 700; font-size: 10px; line-height: 17px; text-align: center;
  border: 1px solid #000; box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

/* --------------------------------------------------------------- map tools */
#map-tools { position: absolute; right: 0; top: calc(var(--topbar-h) + 96px); display: flex; flex-direction: column; gap: 10px; z-index: 30; }
#map-tools .rail-btn { width: 48px; height: 48px; font-size: 24px; border-radius: 0; }

#speed-bar {
  position: absolute; right: 6px; bottom: 8px; display: flex; gap: 3px; z-index: 32;
  background: var(--panel); border: 1px solid var(--edge-dark); border-radius: 3px; padding: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
}
.speed-btn {
  min-width: 38px; height: 30px; padding: 0 9px; border-radius: 2px;
  font-family: var(--f-head); font-weight: 500; font-size: 14px; color: #bda76a;
  background: linear-gradient(var(--chrome-hi), var(--chrome-lo));
  border: 1px solid var(--edge-dark);
}
.speed-btn:hover { color: var(--gold); filter: brightness(1.25); }
.speed-btn.on { color: #18150e; background: linear-gradient(#e2c366, #a8862f); }

/* Two lines, the time over the countdown to the next day, so the chip is
   tall enough to hold both rather than letting the second spill out of it. */
#clock-chip {
  position: absolute; right: 6px; bottom: 50px; z-index: 32;
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px;
  line-height: 1.1; font-variant-numeric: tabular-nums;
  background: var(--panel); border: 1px solid var(--edge-dark); border-radius: 3px;
  font-family: var(--f-head); font-weight: 400; font-size: 15px; color: var(--text);
  letter-spacing: .05em; box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
#clock-chip .ic { color: var(--brass); font-size: 15px; }
#clock-chip .night { color: #7f93b8; }

#minimap {
  position: absolute; right: 6px; bottom: 96px; width: 232px; height: 56px; z-index: 30;
  border: 1px solid var(--edge-dark); border-radius: 2px; overflow: hidden; cursor: crosshair;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .6), var(--shadow-inset);
}
#minimap canvas { display: block; width: 100%; height: 100%; }
/* The key to the map's relation colours, tucked into the minimap's lower
   left corner over the southern ocean. It never takes a click. */
#minimap .mm-legend {
  position: absolute; left: 3px; bottom: 3px; display: flex; gap: 7px; pointer-events: none;
  padding: 1px 5px; border-radius: 2px; background: rgba(12, 14, 16, .72);
  font-family: var(--f-ui); font-size: 9px; font-weight: 700; line-height: 13px;
  letter-spacing: .03em; color: #e9e4d2;
}
#minimap .mm-legend[hidden] { display: none; }
#minimap .mm-legend span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
#minimap .mm-legend i { width: 7px; height: 7px; border-radius: 1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .7); }

/* ------------------------------------------------------ panel primitives */
.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow-dialog);
}
.panel-header {
  height: 35px; display: flex; align-items: center; gap: 6px; padding: 0 6px;
  background: linear-gradient(180deg, #4a4534, #322e22 60%, #262318);
  border-bottom: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(201, 169, 73, .28);
}
.panel-header .title {
  flex: 1; text-align: center; font-family: var(--f-head); font-weight: 600;
  font-size: 18px; letter-spacing: .18em; text-transform: uppercase; color: var(--text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.panel-header .sub { font-family: var(--f-ui); font-size: 11px; letter-spacing: .1em; color: var(--text-dim); text-transform: uppercase; }
.panel-section {
  background: rgba(29, 27, 18, .55); border: 1px solid rgba(76, 72, 57, .6);
  border-radius: 5px; box-shadow: var(--shadow-inset);
}
/* Cards inside a dialog carry one padding and one gap between them, always. */
.dialog-body .panel-section { padding: var(--s3); }
.dialog-body .panel-section + .panel-section { margin-top: var(--s3); }
/* A labelled panel: a dark title bar over a body, the way the original
   groups everything in its side columns. The title bar is flush to the
   panel's edges, the body carries one padding, and panels are separated by
   one gap — so a glance tells you where a group starts and stops. */
.pan {
  background: rgba(29, 27, 18, .55); border: 1px solid rgba(76, 72, 57, .6);
  border-radius: 4px; overflow: hidden; box-shadow: var(--shadow-inset);
}
.pan + .pan { margin-top: var(--s3); }
.pan.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pan-head {
  height: 34px; flex: none; display: flex; align-items: center; gap: var(--s2);
  padding: 0 var(--s3);
  background: linear-gradient(180deg, #4a4534, #322e22);
  border-bottom: 1px solid rgba(0, 0, 0, .55);
  box-shadow: inset 0 1px 0 rgba(201, 169, 73, .22);
  font-family: var(--f-head); font-weight: 600; font-size: var(--fs-head);
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim);
}
.pan-head .ic { font-size: 17px; color: var(--brass); }
.pan-head .spacer { flex: 1; }
.pan-body { padding: var(--s3); }
.pan.grow .pan-body { flex: 1; min-height: 0; overflow: auto; }

.card-bone {
  background: linear-gradient(var(--bone-lit), var(--bone));
  border: 1px solid var(--edge); border-radius: 2px; color: var(--ink);
}

.hchip {
  display: inline-flex; align-items: center; gap: 5px; height: 27px; padding: 0 9px;
  background: rgba(0, 0, 0, .34); border: 1px solid rgba(0, 0, 0, .55); border-radius: 2px;
  color: var(--text); font-size: 12.5px; white-space: nowrap;
}
.hchip .ic { font-size: 16px; color: var(--brass); }
.hchip .flag { width: 22px; height: 14px; background-size: cover; box-shadow: 0 0 0 1px #000; }
.icon-btn { color: #d6c9a0; font-size: 16px; padding: 3px 5px; border-radius: 2px; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.icon-btn.red { color: #e07a68; }
.icon-btn.red:hover { color: #fff; background: var(--red); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px; border-radius: 3px;
  font-family: var(--f-head); font-weight: 500; font-size: 14.5px; letter-spacing: .1em;
  text-transform: uppercase; color: #f2efe2;
  background: linear-gradient(180deg, #8ba549 0%, var(--green-solid) 52%, #44561f 100%);
  border: 1px solid #2c3813;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 3px rgba(0, 0, 0, .5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.btn:hover:not(:disabled) { filter: brightness(1.14); }
.btn:active:not(:disabled) { transform: translateY(1px); filter: brightness(.94); }
.btn:disabled { filter: grayscale(.75) brightness(.72); }
.btn.sm { height: 29px; padding: 0 12px; font-size: 12.5px; }
.btn.lg { height: 46px; padding: 0 30px; font-size: 18px; }
.btn.wide { width: 100%; }
.btn.grey { background: linear-gradient(180deg, #6b6857 0%, #4c4839 52%, #35321f 100%); border-color: #221f14; }
.btn.red { background: linear-gradient(180deg, #d04a34 0%, var(--red) 52%, #7d2014 100%); border-color: #4d1409; }
.btn.gold {
  background: linear-gradient(180deg, #ecd47f 0%, #c9a949 52%, #8d7631 100%);
  border-color: #5b4a17; color: #241d0c; text-shadow: 0 1px 0 rgba(255, 255, 255, .3);
}

/* ------------------------------------------------------- bottom panels

   The province bar and the army panel share one frame, as in the original:
   about two thirds of the map's width, centred on the bottom edge, with
   arrows on the outer edges to step through your provinces or armies. A
   225px block on the left (the army's picture, or the province's daily
   production), then a gold header with the name centred, then the columns. */
:root { --bp-h: 190px; --bp-head: 35px; --bp-left: 225px; }

#province-panel, #army-panel {
  position: absolute; left: 50%; bottom: 0; z-index: 35;
  width: min(1260px, calc(100% - 140px)); height: var(--bp-h);
  display: flex;
  background: var(--panel); border: 1px solid var(--edge); border-bottom: 0;
  box-shadow: 0 -3px 14px rgba(0, 0, 0, .6);
}
#province-panel {
  /* Kept in the layout and slid out of sight, so opening it can be animated.
     A panel that appears with display:block cannot be. */
  transform: translate(-50%, calc(100% + 6px));
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .3s cubic-bezier(.16, .84, .32, 1.06), opacity .18s ease,
              visibility 0s linear .3s;
}
#province-panel.open {
  transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto;
  transition: transform .3s cubic-bezier(.16, .84, .32, 1.06), opacity .16s ease,
              visibility 0s;
}

/* The speed bar, clock and minimap stand in the bottom-right corner. Where
   the open panel would reach under them they step up above it, together,
   rather than half of them being covered. */
#speed-bar, #clock-chip, #minimap { transition: transform .3s cubic-bezier(.16, .84, .32, 1.06); }
@media (max-width: 1800px) {
  #app:has(#province-panel.open, #army-panel.open) :is(#speed-bar, #clock-chip, #minimap) {
    transform: translateY(calc(-1 * var(--bp-h) - 2px));
  }
}

.bp-left { width: var(--bp-left); flex: none; position: relative; overflow: hidden; border-right: 1px solid #000; }
.bp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.bp-head {
  height: var(--bp-head); flex: none;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--s2);
  padding: 0 var(--s1) 0 var(--s2);
  background: linear-gradient(180deg, #ecd585 0%, #cfb055 46%, #a3873a 100%);
  border-bottom: 1px solid #3b3115; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
  color: #241d0c;
}
.bp-head-l, .bp-head-r { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bp-head-r { justify-content: flex-end; }
.bp-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; white-space: nowrap; }
.bp-title .nm {
  font-family: var(--f-head); font-weight: 600; font-size: 20px; line-height: 1; letter-spacing: .05em;
  text-transform: uppercase; color: #1d170a; text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  overflow: hidden; text-overflow: ellipsis;
}
.bp-title .sub {
  font-family: var(--f-ui); font-weight: 600; font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: #54461a; overflow: hidden; text-overflow: ellipsis;
}
.bp-head .hchip { height: 25px; padding: 0 7px; font-size: 12px; font-weight: 600; color: #241d0c; background: rgba(36, 29, 12, .14); border-color: rgba(36, 29, 12, .38); }
.bp-head .hchip .ic { color: #3b3115; font-size: 15px; }
.bp-x {
  width: 27px; height: 27px; display: grid; place-items: center; flex: none; font-size: 13px; color: #fff;
  background: linear-gradient(180deg, #d04a34, var(--red) 52%, #7d2014); border: 1px solid #4d1409; border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.bp-x:hover { filter: brightness(1.15); }
.bp-emblem { display: block; flex: none; padding: 2px; background: #1d1a12; border: 1px solid #6b5a22; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.bp-emblem i { display: block; width: 100%; height: 100%; background-size: cover !important; background-position: center !important; }
.bp-emblem.sm { width: 27px; height: 27px; }

.bp-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 30px; height: 64px; display: grid; place-items: center; font-size: 20px; color: var(--gold);
  background: var(--panel); border: 1px solid var(--edge); border-radius: 3px; box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
}
.bp-nav:hover { filter: brightness(1.3); }
.bp-nav.prev { right: calc(100% + 6px); }
.bp-nav.prev .ic { transform: scaleX(-1); }
.bp-nav.next { left: calc(100% + 6px); }

.bp-body { flex: 1; min-height: 0; display: flex; gap: var(--s3); padding: var(--s2) 10px; overflow: hidden; }
.bp-col { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.bp-col > h4 {
  margin: 0 0 2px; display: flex; align-items: center; gap: 5px;
  font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text);
}
.bp-col > h4 .info { display: inline-flex; font-size: 13px; color: var(--text-dim); cursor: help; }
.bp-bar { height: 12px; border-radius: 2px; overflow: hidden; background: rgba(0, 0, 0, .55); box-shadow: var(--shadow-inset); border: 1px solid rgba(0, 0, 0, .6); }
.bp-bar i { display: block; height: 100%; background: linear-gradient(180deg, #8fbc4a, #5d8a2b); transition: width .3s; }
.bp-num { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.bp-hint { margin-top: auto; font-size: 11px; line-height: 1.35; color: var(--text-dim); }

/* ---------------------------------------------------------- province bar */
.pb-summary { background: linear-gradient(180deg, #1c1c19, #111110); padding: 10px 12px; display: flex; flex-direction: column; gap: var(--s2); }
.pb-summary > h4 {
  margin: 0; font-family: var(--f-ui); font-weight: 700; font-size: 13px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text);
}
.pb-morale { width: 150px; flex: none; }
.pb-morale .moral { flex: none; height: 12px; }
.moral-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.plus-btn {
  width: 26px; height: 24px; display: grid; place-items: center; font-size: 13px; color: #fff; border-radius: 2px;
  background: linear-gradient(180deg, #8ba549 0%, var(--green-solid) 52%, #44561f 100%); border: 1px solid #2c3813;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 3px rgba(0, 0, 0, .5);
}
.plus-btn:hover { filter: brightness(1.15); }
.pb-thumb-col { width: 180px; flex: none; }
/* The slots are the thing the player comes here to press, so they get the
   slack rather than giving it up to the panels either side. */
.pb-buildings { flex: 1; min-width: 150px; }
/* Two rows of slots fit the bar's height before it has to scroll. */
.pb-buildings .bslot { width: 56px; height: 56px; }
.pb-buildings .bslot .ic { font-size: 19px; }
.pb-ongoing { width: 170px; flex: none; }

/* Each resource is an icon and a number, both big enough to read without
   leaning in — the original sizes these generously and lets the column be
   two across rather than cramming four. */
.prod-rows { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.prod-rows .r {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 15px; font-weight: 600; line-height: 24px; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.prod-rows .r .ic {
  font-size: 22px; color: var(--brass); flex: none;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .7));
}

.moral-wrap { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s1); }
.moral-wrap .flag { width: 30px; height: 20px; background-size: cover; box-shadow: 0 0 0 1px #000; flex: none; }
.moral {
  flex: 1; height: 17px; border-radius: 2px; position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--ink), #3a3628); box-shadow: var(--shadow-inset);
  border: 1px solid rgba(0, 0, 0, .6);
}
.moral i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--green-2), var(--green-1)); }
.moral.low i { background: linear-gradient(90deg, #6b4a12, var(--amber)); }
.moral.bad i { background: linear-gradient(90deg, #6d1d12, var(--red)); }
.moral span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--text); text-shadow: 0 1px 2px #000; }
.moral-label { font-family: var(--f-head); font-weight: 500; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }

.bslots { display: flex; gap: var(--s2); flex-wrap: wrap; align-content: flex-start; overflow-y: auto; max-height: 100%; padding-right: var(--s1); }
.bslot {
  width: 66px; height: 66px; border-radius: 2px; position: relative; overflow: hidden;
  background: linear-gradient(var(--bone-lit), var(--bone-dim));
  border: 1px solid var(--edge); box-shadow: inset 0 0 6px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.bslot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .82; }
.bslot .ic { position: relative; font-size: 22px; color: #f4eeda; margin: auto auto 1px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.95)); }
.bslot .nm {
  position: relative; width: 100%; font-size: 10.5px; font-weight: 600; line-height: 15px; text-align: center;
  color: #f6f1de; background: rgba(15, 13, 8, .72); letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 1px;
}
.bslot .lv {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 var(--s1);
  background: rgba(10, 9, 5, .85); color: var(--gold); border-radius: 2px;
  font-family: var(--f-head); font-size: 11px; line-height: 16px; text-align: center;
}
.bslot .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(0, 0, 0, .55); }
.bslot .prog i { display: block; height: 100%; background: var(--green-1); }
.bslot:hover:not(:disabled) { filter: brightness(1.12); border-color: var(--bone-lit); }
.bslot:disabled { filter: grayscale(.85) brightness(.62); }
.bslot.empty { background: rgba(29, 27, 18, .45); border-style: dashed; border-color: rgba(130, 124, 103, .5); }
.bslot.empty .ic { color: rgba(197, 190, 168, .5); }

.qlist { overflow-y: auto; flex: 1; padding-right: 2px; }
.qrow { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2); font-size: var(--fs-small); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.qrow .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.qrow .t { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.qbar { width: 72px; height: 8px; border-radius: 2px; overflow: hidden; background: rgba(0, 0, 0, .5); box-shadow: var(--shadow-inset); }
.qbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-2), var(--green-1)); }
.empty-note { font-size: 11px; color: var(--text-dim); font-style: italic; padding: 4px; }

/* Construct and Recruit: the two big square buttons at the right-hand end. */
.pb-actions { display: flex; gap: var(--s2); flex: none; align-items: stretch; }
.big-btn {
  width: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px;
  font-family: var(--f-head); font-weight: 600; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  color: #f2efe2; text-shadow: 0 1px 2px rgba(0, 0, 0, .55); border-radius: 3px;
  background: linear-gradient(180deg, #8ba549 0%, var(--green-solid) 52%, #44561f 100%); border: 1px solid #2c3813;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 3px rgba(0, 0, 0, .5);
}
.big-btn .ic { font-size: 34px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)); }
.big-btn:hover { filter: brightness(1.12); }
.big-btn:active { transform: scale(.97); }
.big-btn.construct { background: linear-gradient(180deg, #ecd47f 0%, #c9a949 52%, #8d7631 100%); border-color: #5b4a17; color: #241d0c; text-shadow: 0 1px 0 rgba(255, 255, 255, .3); }
.big-btn.war { background: linear-gradient(180deg, #d04a34 0%, var(--red) 52%, #7d2014 100%); border-color: #4d1409; }
/* Greyed, but still opens the screen, which shows what each unit needs. */
.big-btn.off { filter: grayscale(1) brightness(.62); }
.big-btn.off:hover { filter: grayscale(1) brightness(.75); }
.big-btn small {
  font-family: var(--f-ui); font-weight: 600; font-size: 11px; line-height: 1.2; letter-spacing: 0;
  text-transform: none; text-align: center; text-shadow: none;
}

/* ----------------------------------------------------------------- dialogs */
#modal-layer { position: absolute; inset: 0; right: var(--ad-w); z-index: 60; display: none; }
#modal-layer.open { display: block; }
#modal-scrim { position: absolute; inset: 0; background: rgba(4, 5, 7, .55); }

.dialog {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(1020px, calc(var(--game-w) - 80px)); max-height: calc(100vh - 110px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 3px solid var(--bone); border-radius: 5px;
  box-shadow: var(--shadow-dialog);
}
.dialog.narrow { width: min(560px, calc(var(--game-w) - 60px)); }
.dialog.wide { width: min(1240px, calc(var(--game-w) - 50px)); }
/* The research tree is seventeen columns long and reads as a whole or not at
   all, so on a big screen it is allowed more room than the other dialogs.
   On a laptop the viewport clamp brings it back to the same width as .wide. */
.dialog.tree { width: min(1680px, calc(var(--game-w) - 64px)); }

.dialog-head {
  height: 52px; display: flex; align-items: center; gap: var(--s2);
  padding: 0 var(--s4); flex: none;
  background: linear-gradient(180deg, #4a4534, #322e22 62%, #262318);
  border-bottom: 1px solid #000; border-radius: 2px 2px 0 0;
  box-shadow: inset 0 1px 0 rgba(201, 169, 73, .3);
}
.dialog-head h2 {
  margin: 0; font-family: var(--f-head); font-weight: 600; font-size: var(--fs-title);
  line-height: 1.1; letter-spacing: .2em; text-transform: uppercase; color: var(--text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.dialog-head .spacer { flex: 1; }

.dialog-tabs { display: flex; gap: var(--s1); padding: var(--s2) var(--s5) 0; flex: none; }
.prov-picker {
  display: flex; gap: var(--s1); flex-wrap: wrap; margin-bottom: var(--s4);
  padding-bottom: var(--s3); border-bottom: 1px solid rgba(130, 124, 103, .22);
}
.tab {
  display: flex; align-items: center; gap: var(--s2); height: 32px; padding: 0 var(--s3);
  font-family: var(--f-ui); font-weight: 600; font-size: var(--fs-small); letter-spacing: .09em;
  text-transform: uppercase; color: #a49d84; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #34363c, #26282d);
  border: 1px solid var(--edge-dark); border-bottom: 0;
}
.tab .ic { font-size: 16px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--gold); background: linear-gradient(180deg, #4a4534, #322e22); }

.dialog-body {
  padding: var(--s4) var(--s5) var(--s5);
  overflow: auto; flex: 1;
  font-size: var(--fs-body); line-height: var(--lh-body);
}
.dialog-foot {
  flex: none; padding: var(--s3) var(--s5); border-top: 1px solid rgba(0, 0, 0, .6);
  display: flex; align-items: center; gap: var(--s2); background: rgba(19, 19, 27, .5);
}

/* --------------------------------------------------------------- content */
/* A section heading owns everything down to the next one: it sits a full
   card-gap below whatever came before and a row-gap above its own content. */
.sec-title {
  margin: var(--s4) 0 var(--s2);
  font-family: var(--f-head); font-weight: 600; font-size: var(--fs-head);
  line-height: 1.2; letter-spacing: .13em; text-transform: uppercase; color: var(--text-dim);
  border-bottom: 1px solid rgba(130, 124, 103, .3); padding-bottom: var(--s1);
}
.sec-title:first-child { margin-top: 0; }
.muted { color: var(--text-dim); }
.tiny { font-size: var(--fs-small); line-height: var(--lh-body); }
/* Something that is not wrong but is costing you something — a stack carrying
   more men than it can bring to bear, say. */
.warn {
  color: var(--amber); font-weight: 600; letter-spacing: .02em;
  border-bottom: 1px dotted rgba(216, 166, 60, .6); cursor: help;
}

.cost { display: inline-flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.cost .c { display: inline-flex; align-items: center; gap: var(--s1); font-size: var(--fs-body); font-variant-numeric: tabular-nums; color: var(--text); }
.cost .c .ic { font-size: 16px; color: var(--brass); }
.cost .c.no { color: #e0705a; }
.cost .c.no .ic { color: #b5503c; }

.row-list .lrow {
  display: grid; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3);
  border-bottom: 1px solid rgba(130, 124, 103, .16);
}
.row-list .lrow:hover { background: rgba(255, 249, 191, .06); }
.row-list .lrow.me { background: rgba(201, 169, 73, .13); }
.sw { width: 26px; height: 17px; background-size: cover; box-shadow: 0 0 0 1px #000; }
.status { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.status.war { color: #e0705a; font-weight: 700; }
.status.alliance { color: #a3c765; font-weight: 700; }
.status.peace { color: var(--text-dim); }

.bar { height: 11px; border-radius: 2px; overflow: hidden; background: rgba(0, 0, 0, .5); box-shadow: var(--shadow-inset); }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-2), var(--green-1)); }

/* ----------------------------------------------------------------- feedback */
.fb-rate { display: flex; gap: var(--s2); }
.fb-star {
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
  background: rgba(20, 18, 12, .35); border: 1px solid var(--edge); border-radius: 3px;
  color: rgba(214, 205, 178, .35); font-size: 17px; transition: color .12s, background .12s;
}
.fb-star:hover { color: var(--gold); }
.fb-star.on { color: var(--gold); background: rgba(216, 166, 60, .16); border-color: rgba(216, 166, 60, .5); }
.fb-select, .fb-text {
  width: 100%; font-family: var(--f-ui); font-size: var(--fs-body); color: var(--text);
  background: rgba(12, 11, 8, .5); border: 1px solid var(--edge); border-radius: 3px;
  padding: var(--s2) var(--s3);
}
.fb-text { resize: vertical; min-height: 96px; line-height: var(--lh-body); }
.fb-select:focus, .fb-text:focus { outline: none; border-color: rgba(216, 166, 60, .65); }
/* What the report is worth, and what becomes of it. */
.fb-note {
  display: flex; align-items: flex-start; gap: var(--s2); margin-top: var(--s4);
  padding: var(--s3); border-radius: 3px; line-height: var(--lh-body);
  background: rgba(216, 166, 60, .10); border: 1px solid rgba(216, 166, 60, .30);
  color: var(--text-dim);
}
.fb-note .ic { color: var(--gold); font-size: 15px; flex: none; margin-top: 1px; }
.gold-text { color: var(--gold); }
.fb-text[readonly] { background: rgba(8, 8, 6, .55); color: var(--text-dim); font-size: 11.5px; }

/* ------------------------------------------------------------ research tree */
.rt-wrap { display: flex; gap: var(--s3); height: min(620px, calc(100vh - 230px)); }
.rt-tree {
  flex: 1; min-width: 0; overflow: auto; position: relative; border-radius: 3px;
  background: linear-gradient(var(--bone-lit), var(--bone));
  border: 1px solid var(--edge); box-shadow: inset 0 0 14px rgba(70, 62, 40, .35);
}
.rt-grid { position: relative; }
.rt-daycol {
  position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(76, 72, 57, .22);
}
.rt-daycol.now { width: 100px; background: rgba(121, 143, 67, .2); border-left: 1px solid rgba(89, 108, 43, .5); border-right: 1px solid rgba(89, 108, 43, .5); }
.rt-dayhdr {
  position: sticky; top: 0; z-index: 3; height: 26px; display: flex; align-items: center;
  background: linear-gradient(var(--bone-lit), var(--bone-dim)); border-bottom: 1px solid var(--edge);
}
.rt-dayhdr .d {
  position: absolute; text-align: center; font-family: var(--f-ui); font-weight: 600;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft);
}
.rt-rowlabel {
  position: absolute; left: 0; width: 118px; display: flex; align-items: center; gap: var(--s2);
  font-family: var(--f-ui); font-weight: 600; font-size: 11px; color: var(--ink);
  line-height: 1.15; padding-right: var(--s1);
}
.rt-rowpic {
  width: 34px; height: 34px; flex: none; border: 1px solid var(--edge); border-radius: 3px;
  overflow: hidden; background: #b8b199; box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.rt-rowpic img { width: 100%; height: 100%; object-fit: cover; }
.rt-node {
  position: absolute; width: 60px; height: 51px; border-radius: 3px; overflow: hidden;
  background: linear-gradient(#b8b199, #a29b83); border: 1px solid var(--edge);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.rt-node img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rt-node .lv {
  position: absolute; top: 0; left: 0; right: 0; height: 15px; background: rgba(20, 18, 10, .75);
  color: var(--bone-lit); font-size: 9.5px; line-height: 15px; text-align: center; letter-spacing: .04em;
}
.rt-node .tick { position: absolute; right: 1px; bottom: 1px; width: 15px; height: 15px; display: grid; place-items: center;
  border-radius: 50%; background: var(--green-solid); color: #fff; font-size: 10px; box-shadow: 0 0 0 1px #000; }
.rt-node.locked { filter: grayscale(.9) brightness(.62); }
.rt-node.can { box-shadow: 0 0 0 2px var(--green-1), 0 1px 3px rgba(0, 0, 0, .45); }
.rt-node.sel { box-shadow: 0 0 0 2px var(--gold), 0 1px 3px rgba(0, 0, 0, .5); }
.rt-node:hover:not(.locked) { filter: brightness(1.12); }
.rt-link { position: absolute; background: rgba(76, 72, 57, .45); }

.rt-side { width: 280px; flex: none; display: flex; flex-direction: column; gap: var(--s3); }
.rt-slot { display: flex; align-items: center; gap: var(--s3); }
.rt-slot .ic { font-size: 16px; color: var(--brass); }
.rt-info { flex: 1; overflow: auto; }
.rt-info .pic { width: 64px; height: 64px; border: 1px solid var(--edge); border-radius: 2px; overflow: hidden; flex: none; }
.rt-info .pic img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------- production */
.prod-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--s3); }
.ucard {
  display: flex; gap: var(--s3); padding: var(--s3); border-radius: 4px;
  background: rgba(29, 27, 18, .5); border: 1px solid rgba(76, 72, 57, .6);
}
.ucard .pic { width: 76px; height: 76px; flex: none; border: 1px solid var(--edge); border-radius: 2px; overflow: hidden; background: #3a3730; }
.ucard .pic img { width: 100%; height: 100%; object-fit: cover; }
.ucard .meta { flex: 1; min-width: 0; }
.ucard .nm { display: flex; justify-content: space-between; gap: var(--s2); font-family: var(--f-head); font-weight: 500; font-size: var(--fs-head); line-height: 1.25; letter-spacing: .04em; color: var(--text); }
.ustats { display: flex; gap: var(--s3); margin: var(--s2) 0; font-size: var(--fs-small); color: var(--text-dim); }
.ustats span { display: inline-flex; align-items: center; gap: var(--s1); }
.ustats b { color: var(--text); font-weight: 600; }
.ustats .ic { font-size: 13px; color: var(--brass); }
/* Cost is a different kind of number from a stat, so it is ruled off rather
   than left as a second identical row. */
.ucard .cost {
  margin-top: var(--s2); padding-top: var(--s2);
  border-top: 1px solid rgba(130, 124, 103, .22);
}
.ucard .cost .ic { font-size: 17px; }

/* --------------------------------------------------------------- newspaper */
.paper {
  background: linear-gradient(#e7e2cf, #d9d3bd); border: 1px solid var(--edge);
  padding: 16px 20px; color: #1a170f; box-shadow: var(--shadow-inset);
}
.paper h1 {
  margin: 0; font-family: var(--f-serif); font-weight: 700; font-size: 38px;
  letter-spacing: .06em; text-align: center; text-transform: uppercase;
  border-bottom: 3px double #241f12; padding-bottom: 7px;
}
.paper .dateline { display: flex; justify-content: space-between; font-family: var(--f-ui); font-size: 10px; color: #5d5642; margin: 5px 0 12px; text-transform: uppercase; letter-spacing: .1em; }
.paper .story { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(0, 0, 0, .13); }
.paper .story .pic { width: 92px; height: 66px; flex: none; overflow: hidden; border: 1px solid #8a8471; filter: grayscale(1) contrast(1.15); }
.paper .story .pic img { width: 100%; height: 100%; object-fit: cover; }
.paper .story h4 { margin: 0 0 3px; font-family: var(--f-serif); font-weight: 700; font-size: 16px; }
.paper .story .when { font-family: var(--f-ui); font-size: 10px; color: #6a6148; text-transform: uppercase; letter-spacing: .08em; }
.paper .lead h4 { font-size: 25px; line-height: 1.12; }
.paper .lead .pic { width: 200px; height: 132px; }

/* 2030: a live news site rather than newsprint. Full-colour photographs, a
   navy masthead with a red LIVE tag, and each story tagged in its colour. */
.paper.modern {
  background: #f7f9fc; color: #14202e; padding: 0 0 8px; border-color: #20324a;
}
.paper.modern h1 {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-family: var(--f-head); font-size: 34px; letter-spacing: .08em; color: #fff;
  background: linear-gradient(90deg, #0d2340, #17406e); border-bottom: 4px solid #d8262e;
  padding: 12px 20px;
}
.paper.modern h1 .live {
  font-family: var(--f-ui); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #fff; background: #d8262e; padding: 3px 8px; border-radius: 3px;
  animation: live-blink 1.6s ease-in-out infinite;
}
@keyframes live-blink { 50% { opacity: .55; } }
.paper.modern .dateline { color: #3d5674; margin: 0; padding: 7px 20px; background: #e4ecf5; border-bottom: 1px solid #c9d6e6; }
.paper.modern .story {
  margin: 0 20px; padding: 10px 0 10px 12px; border-bottom: 1px solid #dbe3ee;
  border-left: 4px solid var(--k, #4fb4d4);
}
.paper.modern .lead { margin-top: 12px; }
.paper.modern .story .pic { filter: none; border: 0; border-radius: 4px; }
.paper.modern .story h4 { font-family: var(--f-ui); font-weight: 700; color: #0f1c2b; }
.paper.modern .lead h4 { font-size: 23px; }
.paper.modern .story .when { color: var(--k, #4fb4d4); font-weight: 700; }
.paper.modern .tiny { color: #33475f; }
.paper.modern .k-war, .paper.modern .k-battle, .paper.modern .k-loss { --k: #d8262e; }
.paper.modern .k-capture, .paper.modern .k-victory { --k: #2e9d57; }
.paper.modern .k-diplomacy, .paper.modern .k-world, .paper.modern .k-nation { --k: #2f6fd0; }
.paper.modern .k-research, .paper.modern .k-build, .paper.modern .k-unit { --k: #8a4fd6; }
.paper.modern .k-espionage { --k: #e08a1e; }

/* ----------------------------------------------------------------- toasts */
#toasts {
  position: absolute; left: calc(var(--rail-w) + 8px); top: calc(var(--topbar-h) + 12px);
  width: 296px; display: flex; flex-direction: column; gap: 5px; z-index: 45; pointer-events: none;
}
.toast {
  display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px; border-radius: 3px;
  background: var(--panel); border: 1px solid var(--edge-dark); border-left: 3px solid var(--brass);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55); color: var(--text); font-size: 13.5px;
  animation: toast-in .2s ease-out; pointer-events: auto; cursor: pointer;
}
.toast.war, .toast.loss { border-left-color: var(--red); }
.toast.capture { border-left-color: var(--green-1); }
.toast.research { border-left-color: #6fa0c8; }
.toast .ic { font-size: 16px; color: var(--brass); margin-top: 1px; }
.toast .when { display: block; font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- army panel */
#army-panel { z-index: 36; transform: translateX(-50%); display: none; }
#army-panel.open { display: flex; }

/* The left block: the lead unit's picture over the nation's flag, with the
   flag again in a framed square in the corner. */
.army-left { background: #1b1a14; }
.army-flag { position: absolute; inset: 0; background-size: cover !important; background-position: center !important; opacity: .6; filter: saturate(.8); }
.army-art {
  position: absolute; inset: 0 0 0 18%; width: 82%; height: 100%; object-fit: cover; object-position: center 35%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 34%); mask-image: linear-gradient(90deg, transparent, #000 34%);
}
.army-left::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .55)); pointer-events: none; }
.army-left .bp-emblem { position: absolute; left: 10px; bottom: 10px; z-index: 1; width: 52px; height: 40px; border-color: #c9a949; }

.army-hp { width: 150px; flex: none; }
.army-status { width: 172px; flex: none; }
.army-status > h4, .army-activity > h4 { font-size: 11px; }
.army-activity { flex: 1 1 160px; min-width: 140px; }

/* The units, as cards standing on a faded battle scene. */
.army-cards {
  flex: 1 1 470px; min-width: 0; max-width: 560px; position: relative; isolation: isolate;
  display: flex; gap: 6px; align-items: stretch; padding: 7px 8px; overflow-x: auto; overflow-y: hidden;
  background: #2b271d; border: 1px solid #000; border-radius: 2px; box-shadow: var(--shadow-inset);
}
/* Set inline on the element, so the path resolves from the page, not this sheet. */
.army-cards > .scene {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: center 40% / cover no-repeat;
  filter: grayscale(.5) sepia(.9) brightness(.62) contrast(.92);
}
.ucard2 {
  position: relative; flex: none; width: 74px; display: flex; flex-direction: column;
  border: 1px solid #0d0c08; border-radius: 2px; overflow: hidden;
  background: linear-gradient(var(--bone-lit), var(--bone-dim)); box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.ucard2:hover { box-shadow: 0 0 0 1px var(--gold), 0 2px 6px rgba(0, 0, 0, .6); }
.ucard2 .pic { flex: 1; min-height: 0; background: #3a3730; overflow: hidden; }
.ucard2 .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ucard2 .rank {
  position: absolute; top: 0; left: 3px; min-width: 20px; height: 21px; padding: 1px 3px 0;
  font-family: var(--f-head); font-weight: 600; font-size: 11px; line-height: 14px; text-align: center; color: #241d0c;
  background: linear-gradient(#ecd47f, #b8952f); clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
}
.ucard2 .foot { display: flex; align-items: center; justify-content: center; gap: 3px; height: 18px; font-size: 12px; font-weight: 700; color: #22200f; }
.ucard2 .sym { width: 18px; height: 18px; }
.ucard2 .segs { display: flex; gap: 1px; height: 7px; padding: 0 3px 3px; }
.segs i { flex: 1; display: block; background: rgba(0, 0, 0, .45); }
.segs b { display: block; height: 100%; background: #6c9a33; }
.segs.mid b { background: var(--amber); }
.segs.low b { background: var(--red); }

.srows { display: flex; flex-direction: column; gap: 3px; }
.srow {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s2);
  padding-bottom: 3px; border-bottom: 1px solid rgba(255, 255, 255, .06);
  font-size: 11px; color: var(--text-dim);
}
.srow > span:first-child { display: inline-flex; align-items: center; gap: 4px; }
.srow .ic { font-size: 12px; color: var(--brass); }
.srow .sv { display: inline-flex; gap: var(--s2); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.srow .sv i { font-style: normal; display: inline-flex; align-items: center; gap: 2px; }
.srow .att .ic { color: #f08a3c; }
.srow .def .ic { color: #9dbbd9; }

.act-line { display: flex; flex-direction: column; gap: 3px; }
.act-state { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); }
.act-place, .act-time { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text); }
.act-place span, .act-time span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-place .ic, .act-time .ic { font-size: 13px; color: var(--brass); }
.act-btns { margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px;
  font-family: var(--f-ui); font-weight: 600; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text); background: linear-gradient(var(--chrome-hi), var(--chrome-lo));
  border: 1px solid var(--edge-dark); border-radius: 2px;
}
.mini-btn:hover { color: var(--gold); filter: brightness(1.2); }
.mini-btn .ic { font-size: 11px; color: var(--brass); }

/* Move and Attack, standing just above the panel's left end. Pressing one
   arms it: the next click on the map is the order. */
.bp-orders { position: absolute; left: 0; bottom: calc(100% + 8px); display: flex; gap: 6px; }
.bp-orders[hidden] { display: none; }
.bp-order {
  width: 45px; height: 45px; display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(180deg, #393a34, #1b1b18); border: 1px solid #000; border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .09);
}
.bp-order.move { color: #f0cf4a; }
.bp-order.attack { color: #e8432e; }
.bp-order:hover { filter: brightness(1.35); }
.bp-order.on { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(255, 249, 191, .55); background: linear-gradient(180deg, #4b4a3c, #2a2920); }

#order-hint {
  position: absolute; left: 50%; top: calc(var(--topbar-h) + 14px); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: var(--s2); padding: 7px 12px; pointer-events: none;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 3px; box-shadow: 0 3px 10px rgba(0, 0, 0, .55);
  font-size: 13px; font-weight: 600; color: var(--text);
}
#order-hint .ic { font-size: 18px; color: #f0cf4a; }
#order-hint.attack .ic { color: #e8432e; }
#order-hint kbd { font-family: var(--f-ui); font-size: 11px; padding: 1px 5px; border: 1px solid var(--edge); border-radius: 2px; color: var(--text-dim); }

/* ---------------------------------------------------------------- tooltip */
/* A tooltip is a small parchment card: a name, then the numbers behind it.
   The original sets its tips in dark ink on bone with a generous inset, and
   that is what makes them readable at a glance rather than a dense strip of
   pale text on black. */
#tooltip {
  position: fixed; z-index: 200; width: max-content; max-width: 300px;
  padding: var(--s4) var(--s4) var(--s3); border-radius: 5px;
  background: linear-gradient(var(--bone-lit), var(--bone));
  border: 1px solid var(--edge);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .45);
  color: var(--ink-soft); font-size: var(--fs-body); line-height: var(--lh-body);
  pointer-events: none; display: none;
}
#tooltip.on { display: block; }
#tooltip h5 {
  margin: 0 0 var(--s2); padding-bottom: var(--s1);
  font-family: var(--f-head); font-weight: 600; font-size: var(--fs-head);
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink);
  border-bottom: 1px solid rgba(130, 124, 103, .45);
}
#tooltip .row { display: flex; justify-content: space-between; gap: var(--s5); padding: 1px 0; }
#tooltip .row span:last-child { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
#tooltip .tiny { font-size: var(--fs-small); color: #6b6248; }
#tooltip hr { border: 0; border-top: 1px solid rgba(130, 124, 103, .45); margin: var(--s2) 0; }
#tooltip .tt-flag {
  display: inline-block; width: 18px; height: 12px; margin-right: 5px; vertical-align: -1px;
  background-size: cover !important; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6);
}
#tooltip .row span:first-child .tt-flag { margin-right: 6px; }
#tooltip .tt-battle {
  margin: var(--s1) 0 var(--s2); padding: var(--s2) var(--s3);
  border: 1px solid rgba(140, 40, 30, .55); border-radius: 4px;
  background: linear-gradient(rgba(150, 40, 25, .13), rgba(150, 40, 25, .05));
}
#tooltip .tt-battle-head {
  display: flex; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s2);
  font-family: var(--f-head); font-size: var(--fs-small); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: #8a2a1c;
}
#tooltip .tt-battle-head span:last-child { color: #6b6248; font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; }
#tooltip .tt-side-name { display: flex; align-items: center; flex-wrap: wrap; font-weight: 600; color: var(--ink); }
#tooltip .tt-side.ours .tt-side-name span { color: #1f4f7a; }
#tooltip .tt-side-stats { font-size: var(--fs-small); color: #6b6248; padding-left: 1px; }
#tooltip .tt-vs {
  margin: 3px 0; text-align: center; font-size: 10px; font-style: italic;
  letter-spacing: .15em; text-transform: uppercase; color: #8a2a1c;
}
#tooltip .tt-balance {
  display: flex; height: 7px; margin: var(--s2) 0 2px; overflow: hidden;
  border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}
#tooltip .tt-balance i { display: block; min-width: 3px; }
#tooltip .tt-balance i + i { border-left: 1px solid rgba(0, 0, 0, .6); }

/* --------------------------------------------------------------- tutorial */
/* Above the modal layer: a dialog step has to be gated too. It lives
   outside #app because a fixed-position ancestor would trap its z-index. */
#tutorial { position: fixed; inset: 0; right: var(--ad-w); z-index: 80; pointer-events: none; display: none; }
#tutorial.on { display: block; }

/* The darkness is one flat fill with the lit rectangle cut out of it by a
   clip-path (set every frame from tutorial.js). The outline is a separate,
   small element moved by transform, so following a target never repaints a
   giant shadow — the old 4000px box-shadow cost a full-screen repaint per
   frame and smeared while it moved. */
#tut-mask {
  position: absolute; inset: 0; pointer-events: none;
  background: rgba(6, 7, 9, .58);
  opacity: 0; transition: opacity .25s ease;
}
#tutorial.lit #tut-mask { opacity: 1; }

/* The four blockers. They tile the screen around the lit rectangle, so a
   click anywhere but the thing being pointed at never reaches the game. */
.tut-block { position: absolute; pointer-events: auto; display: none; }
#tutorial.gated .tut-block { display: block; }
#tut-hole {
  position: absolute; left: 0; top: 0; pointer-events: none;
  will-change: transform; opacity: 0; transition: opacity .25s ease;
}
#tutorial.lit #tut-hole { opacity: 1; }
/* Ring and glow live on pseudo-elements, so the pulse and the nudge only ever
   animate opacity and transform — both composited, neither repaints. */
#tut-hole::before, #tut-hole::after {
  content: ''; position: absolute; inset: 0; border-radius: 5px;
}
#tut-hole::before { box-shadow: 0 0 0 2px rgba(255, 249, 191, .9); }
#tut-hole::after {
  box-shadow: 0 0 0 3px rgba(255, 249, 191, .55), 0 0 24px 6px rgba(255, 249, 191, .45);
  animation: tut-pulse 1.6s ease-in-out infinite;
}
#tut-hole.nudge::before, #tut-hole.nudge::after { animation: tut-nudge-hole .21s ease-in-out 4 alternate; }
@keyframes tut-nudge-hole { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes tut-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

#tut-banner {
  position: absolute; top: calc(var(--topbar-h) + 18px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: flex-start; gap: 14px;
  min-width: 330px; width: min(600px, calc(var(--game-w) - 24px)); padding: 12px 22px 14px 14px;
  background: linear-gradient(#f1ecd8, #ddd5bb);
  border: 1px solid #8d8158; border-radius: 3px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .5);
  text-align: left; color: #2a2416; pointer-events: auto;
}
/* The general who gives the orders, Call-of-War style: his face on the left
   of the despatch, his words on the right. */
#tut-banner .tut-speaker { flex: none; width: 86px; text-align: center; }
#tut-banner .tut-face {
  position: relative; display: block; width: 86px; height: 86px; border-radius: 4px; overflow: hidden;
  border: 1px solid #8d8158; box-shadow: 0 2px 8px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .25);
  background: #2a2416;
}
#tut-banner .tut-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* While he talks, a soft brass glow breathes around the portrait. */
#tut-banner .tut-face::after {
  content: ''; position: absolute; inset: 0; border-radius: 4px; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(201, 169, 73, .9), 0 0 0 0 rgba(201, 169, 73, 0);
  opacity: 0; transition: opacity .3s ease;
}
#tut-banner .tut-speaker.talking .tut-face::after { opacity: 1; animation: tut-talk .5s ease-in-out infinite alternate; }
@keyframes tut-talk { from { opacity: .35; } to { opacity: 1; } }
#tut-banner .tut-who { display: block; margin-top: 5px; line-height: 1.15; }
#tut-banner .tut-who b { display: block; font-family: var(--f-ui); font-size: 11px; font-weight: 700; color: #2a2416; }
#tut-banner .tut-who i { display: block; font-style: normal; font-family: var(--f-ui); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: #6f6340; }
#tut-banner .tut-body { flex: 1; min-width: 0; padding-top: 2px; }
#tut-banner .txt .w { opacity: 0; animation: tut-word .22s ease forwards; }
@keyframes tut-word { to { opacity: 1; } }

#tut-banner .step { font-family: var(--f-ui); font-weight: 600; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #6f6340; margin-bottom: 4px; }
#tut-banner .txt { font-family: var(--f-serif); font-size: 18px; line-height: 1.32; word-spacing: .14em; }
#tut-banner .hint { font-family: var(--f-ui); font-size: 13px; font-weight: 600; color: #4f4830; margin-top: 7px; }
#tut-skip {
  position: absolute; right: 7px; top: 5px; font-family: var(--f-ui); font-size: 11px;
  letter-spacing: .1em; text-transform: uppercase; color: #6f6340; pointer-events: auto;
}
#tut-skip:hover { color: #2a2416; }

/* The marker is named for the side of the target it sits on; the arrow is
   always on the near end and points at the target. */
#tut-marker {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 0;
  pointer-events: none; will-change: transform; opacity: 0; transition: opacity .25s ease;
}
#tutorial.lit #tut-marker.show { opacity: 1; }
#tut-marker .arrow {
  width: 0; height: 0; flex: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6));
  animation: tut-nudge-l 1s ease-in-out infinite;
}
/* Left of the target: label, then an arrow pointing right. */
#tut-marker.left .arrow { order: 2; border-top: 13px solid transparent; border-bottom: 13px solid transparent; border-left: 15px solid var(--green-1); animation-name: tut-nudge-r; }
/* Right of the target: an arrow pointing left, then the label. */
#tut-marker.right .arrow { border-top: 13px solid transparent; border-bottom: 13px solid transparent; border-right: 15px solid var(--green-1); animation-name: tut-nudge-l; }
/* Below the target: an arrow pointing up, above the label. */
#tut-marker.below { flex-direction: column; }
#tut-marker.below .arrow { border-left: 13px solid transparent; border-right: 13px solid transparent; border-bottom: 15px solid var(--green-1); animation-name: tut-nudge-u; }
/* Above the target: the label, then an arrow pointing down. */
#tut-marker.above { flex-direction: column; }
#tut-marker.above .arrow { order: 2; border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 15px solid var(--green-1); animation-name: tut-nudge-d; }
#tut-marker .label {
  background: rgba(12, 12, 14, .94); color: #fff; padding: 7px 14px; border-radius: 2px;
  font-family: var(--f-head); font-weight: 500; font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .6); white-space: nowrap;
}
/* Each nudge moves the arrow towards the target. */
@keyframes tut-nudge-l { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-5px); } }
@keyframes tut-nudge-r { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }
@keyframes tut-nudge-u { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes tut-nudge-d { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
#tut-banner .hint { animation: tut-fade .3s ease .25s both; }
@keyframes tut-fade { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- start menu */
/* Laid out like the lobby players of the genre already know: a top bar with
   the logo and the mode tabs, then one centred column, 1000px wide, of
   parchment panels under dark title bars (34px, condensed caps), the
   "Choose a country!" dialog with its map, list and footer bar, and a framed
   "Ready for a new fight?" box holding the one big button. The parchment is
   our bone, the accent our 1939 gold or 2030 cyan.

   The accent is registered so it can animate: the whole menu warms from 1939
   gold to 2030 cyan in one transition, everything below simply reads it. */
@property --acc { syntax: '<color>'; inherits: true; initial-value: #c9a949; }
@property --acc-hi { syntax: '<color>'; inherits: true; initial-value: #f2e08a; }
#menu {
  --acc: #c9a949; --acc-hi: #f2e08a; --acc-ink: #241d0c; --acc-dk: #7a6420;
  --acc-soft: color-mix(in srgb, var(--acc) 16%, transparent);
  --acc-line: color-mix(in srgb, var(--acc) 55%, transparent);
  /* Parchment, three depths, and the ink written on it. */
  --paper: #e5e2d5; --paper-2: #d9d5c5; --paper-3: #cbc6b3;
  --paper-ink: #4c4839; --paper-strong: #29261a; --paper-line: rgba(76, 72, 57, .22);
  --bar-bg: linear-gradient(180deg, #3d3f44, #25272c);
  /* The small political map's sea and borders (src/ui/menu-map.js reads these). */
  --mm-sea: #9db1b3; --mm-border: rgba(40, 36, 24, .45);
  --m-ease: cubic-bezier(.2, .8, .2, 1);
  transition: --acc .6s ease, --acc-hi .6s ease;
  position: fixed; inset: 0; z-index: 100; display: none;
  background: #0a0c0e; align-items: flex-start; justify-content: center;
  /* Taller than most screens: it scrolls, and the start box stays in view. */
  overflow-y: auto; overflow-x: hidden; padding: 0;
}
#menu[data-theme="2030"] {
  --acc: #4fb4d4; --acc-hi: #9fe3f5; --acc-ink: #06222c; --acc-dk: #17708c;
  --paper: #e0e4e4; --paper-2: #d1d8da; --paper-3: #c1cacd;
  --paper-ink: #39454c; --paper-strong: #1c262c; --paper-line: rgba(57, 69, 76, .22);
  --mm-sea: #8ea6b2; --mm-border: rgba(20, 32, 40, .45);
}
#menu.open { display: flex; }
/* Both eras' backdrops are always there; the chosen one fades in over the other. */
#menu .menu-bg { position: fixed; inset: 0; z-index: 0; }
#menu .menu-bg i { position: absolute; inset: 0; background: center/cover no-repeat; opacity: 0; transition: opacity .7s ease; }
#menu:not([data-theme="2030"]) .menu-bg i[data-bg="1939"], #menu[data-theme="2030"] .menu-bg i[data-bg="2030"] { opacity: 1; }
/* The painting reads at the sides; the column in the middle sits on a soft shadow. */
#menu::after { content: ''; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse 60% 90% at 50% 45%, rgba(8, 9, 11, .55), rgba(8, 9, 11, .15) 75%), linear-gradient(rgba(8, 9, 11, .2), rgba(8, 9, 11, .55)); }
.menu-inner { position: relative; z-index: 1; width: min(1000px, calc(100% - 32px)); margin: 0 auto; }

/* Anything marked hidden is hidden, whatever display its class gives it. */
[hidden] { display: none !important; }

/* The top bar: logo on the left, the mode tabs (200 × 60, condensed caps) on the right. */
.menu-top {
  display: flex; align-items: stretch; justify-content: space-between; min-height: 60px; margin-bottom: 12px;
  background: rgba(14, 16, 19, .9); border-bottom: 2px solid var(--acc); box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}
.menu-brand { display: flex; flex-direction: column; justify-content: center; padding: 6px 18px; }
.menu-logo {
  font-family: var(--f-head); font-weight: 700; font-size: 28px; letter-spacing: .18em; line-height: 1;
  text-transform: uppercase; color: var(--acc-hi); margin: 0; text-shadow: 0 2px 0 #17120a;
}
.menu-sub { font-family: var(--f-ui); font-weight: 600; font-size: 10px; letter-spacing: .32em; text-transform: uppercase; color: var(--acc); margin: 5px 0 0; }
.mode-tabs { display: flex; }
.mode-tabs button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 200px; height: 60px; cursor: pointer;
  font-family: var(--f-head); font-weight: 700; font-size: 16px; letter-spacing: .06em; text-transform: uppercase;
  color: #bdb8a6; background: transparent; border: 0; border-left: 1px solid rgba(255, 255, 255, .08);
  transition: background .2s, color .2s;
}
.mode-tabs button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.mode-tabs button.on { color: var(--acc-ink); background: linear-gradient(180deg, var(--acc-hi), var(--acc)); }
.mode-tabs .ic { font-size: 18px; }

.menu-card { display: flex; flex-direction: column; gap: 12px; text-align: left; }

/* A panel: dark title bar, parchment body. */
.m-panel, .m-dialog {
  background: var(--paper); color: var(--paper-ink); border: 1px solid #0e0f11;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .5); transition: background .6s ease;
}
.m-bar {
  margin: 0; height: 34px; line-height: 34px; padding: 0 12px; background: var(--bar-bg); border-bottom: 2px solid var(--acc);
  font-family: var(--f-head); font-weight: 600; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: #e5e2d5;
}
.m-body { padding: 12px; }
.m-dbar {
  margin: 0; height: 46px; line-height: 46px; padding: 0 16px; text-align: center; background: var(--bar-bg); border-bottom: 2px solid var(--acc);
  font-family: var(--f-head); font-weight: 600; font-size: 22px; letter-spacing: .05em; text-transform: uppercase; color: #e5e2d5;
}
.m-error { margin-top: 8px; color: #9a3a24; font-size: 13px; font-weight: 600; }

/* The saved war as a game row: picture with its flag, the name in orange, a big Continue. */
.m-game { display: flex; align-items: center; gap: 14px; }
.m-game-pic { position: relative; flex: none; width: 96px; height: 60px; background: center/cover no-repeat; border: 1px solid var(--paper-ink); }
.m-game-pic .sw { position: absolute; left: 4px; bottom: 4px; width: 30px; height: 20px; border: 1px solid rgba(0, 0, 0, .5); }
.m-game-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin-right: auto; }
.m-game-txt b { font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: rgb(208, 128, 45); }
.m-game-txt span { font-size: 11px; color: var(--paper-ink); }
.m-link { font-family: var(--f-ui); font-size: 11px; font-weight: 600; color: var(--paper-ink); text-decoration: underline; background: none; border: 0; cursor: pointer; }
.m-link:hover { color: var(--paper-strong); }
#menu .m-continue { width: 150px; height: 60px; padding: 0 12px; font-family: var(--f-ui); font-weight: 700; font-size: 19px; letter-spacing: .02em; }

/* Fresh content slides up out of nothing: transform and opacity only. */
.m-fade { animation: m-in .38s var(--m-ease) both; }
@keyframes m-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* The two wars, as picture cards. */
.era-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.era-opt {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 68px; padding: 8px 18px; text-align: left; color: var(--text);
  border: 2px solid rgba(0, 0, 0, .55); border-radius: 2px; background: #0d0f12;
  transition: transform .25s var(--m-ease), border-color .25s, box-shadow .25s;
}
.era-art {
  position: absolute; inset: 0; z-index: -2; background: center 60%/cover no-repeat;
  opacity: .5; transform: scale(1.06); filter: saturate(.55);
  transition: opacity .4s ease, transform .6s var(--m-ease), filter .4s ease;
}
.era-opt::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(6, 7, 9, .85), transparent 75%); }
.era-opt:hover { transform: translateY(-1px); border-color: rgba(0, 0, 0, .8); }
.era-opt:hover .era-art { opacity: .75; }
.era-opt:active { transform: scale(.985); }
.era-opt.on { border-color: var(--era-c); box-shadow: 0 0 0 1px var(--era-c), 0 6px 20px color-mix(in srgb, var(--era-c) 35%, transparent); }
.era-opt.on .era-art { opacity: 1; transform: scale(1); filter: none; }
.era-opt.era-1939 { --era-c: #c9a949; }
.era-opt.era-2030 { --era-c: #4fb4d4; }
.era-opt .era-year { font-family: var(--f-head); font-weight: 600; font-size: 28px; line-height: 1; letter-spacing: .06em; color: var(--era-c); text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.era-opt .era-sub { font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #f1ead2; text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
/* A tick in the corner of the chosen card, scaling in. */
.era-opt::before {
  content: '✓'; position: absolute; top: 50%; right: 14px; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; font-weight: 700; color: #0a0c0e; background: var(--era-c);
  transform: scale(0); transition: transform .3s var(--m-ease);
}
.era-opt.on::before { transform: scale(1); }

/* "Choose a country!": the map and the chosen country on the left, the list on the right. */
.m-cols { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px 16px; padding: 14px 16px; align-items: stretch; }
.m-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.m-map { position: relative; aspect-ratio: 2 / 1; overflow: hidden; border: 1px solid color-mix(in srgb, var(--paper-ink) 55%, transparent); box-shadow: inset 0 0 12px rgba(0, 0, 0, .25); background: var(--mm-sea); }
.m-map canvas { display: block; width: 100%; height: 100%; }
.m-map-name {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 7px; padding: 4px 9px 4px 5px; pointer-events: none;
  font-family: var(--f-ui); font-weight: 600; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: #e5e2d5;
  background: rgba(20, 22, 26, .84); border-radius: 2px;
}
.m-map-name:empty { display: none; }
.m-map-name .sw { width: 22px; height: 15px; flex: none; }

.m-nations { display: flex; flex-direction: column; min-width: 0; background: var(--paper-2); border: 1px solid var(--paper-line); }
.m-playas {
  margin: 0; padding: 8px 12px; font-family: var(--f-head); font-weight: 600; font-size: 14px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--paper-strong); background: var(--paper-3); border-bottom: 1px solid var(--paper-line);
}
.nation-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--paper-line); }
.nation-tools input {
  flex: 1 1 120px; min-width: 0; height: 30px; padding: 0 10px; border-radius: 2px; font: 500 12px var(--f-ui);
  color: var(--paper-strong); background: #f5f3ec; border: 1px solid color-mix(in srgb, var(--paper-ink) 40%, transparent); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.nation-tools input::placeholder { color: color-mix(in srgb, var(--paper-ink) 70%, transparent); }
.nation-tools input:focus { border-color: var(--acc-dk); box-shadow: 0 0 0 3px var(--acc-soft); }
/* Filter chips as sub-tabs: small bold caps. */
#menu .chip {
  height: 30px; padding: 0 10px; border-radius: 2px; font: 700 11px var(--f-ui); letter-spacing: .04em; text-transform: uppercase;
  color: var(--paper-ink); background: transparent; border: 1px solid var(--paper-line); transition: background .2s, color .2s, transform .12s;
}
#menu .chip:hover { background: rgba(255, 255, 255, .4); color: var(--paper-strong); }
#menu .chip:active { transform: scale(.95); }
#menu .chip.on { background: #2c2e33; border-color: #2c2e33; color: #e5e2d5; box-shadow: inset 0 -2px 0 var(--acc); }
/* The list: rows 60px tall, a 48px flag, the name in small caps, a badge for the great powers.
   Its own height never stretches the dialog: it fills whatever the left column is. */
.nation-grid { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; overflow-y: auto; scrollbar-width: thin; }
.m-nations .nation-grid { flex: 1 1 0; min-height: 300px; contain: size; }
.mp-grid { max-height: 420px; background: var(--paper-2); border: 1px solid var(--paper-line); }
.nation-opt {
  display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 0 12px 0 8px; text-align: left; min-width: 0; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid var(--paper-line); color: var(--paper-ink);
  transition: background .18s, box-shadow .18s;
}
.nation-opt .sw { width: 48px; height: 32px; flex: none; border: 1px solid rgba(0, 0, 0, .3); border-radius: 1px; }
.nation-opt:hover { background: rgba(255, 255, 255, .45); }
.nation-opt.on { background: color-mix(in srgb, var(--acc) 34%, var(--paper)); box-shadow: inset 4px 0 0 var(--acc-dk); }
.nation-opt > span:not(.sw) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nation-opt .nm { font-family: var(--f-ui); font-weight: 600; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; color: var(--paper-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nation-opt .vp { font-size: 11px; color: var(--paper-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-badge {
  flex: none; font-style: normal; font-family: var(--f-ui); font-weight: 700; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 2px; color: var(--acc-hi); background: #2c2e33;
}
.nation-opt.taken { opacity: .45; cursor: not-allowed; }
.m-instr {
  margin: 0; padding: 8px 12px; text-align: center; border-top: 1px solid var(--paper-line);
  font-family: var(--f-head); font-weight: 400; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--paper-ink);
}

/* The dialog's footer bar: doctrine buttons and Random, 120 × 32 each; the doctrine spelt out under it. */
.m-dfoot { display: flex; align-items: center; gap: 6px; padding: 9px 16px; background: var(--bar-bg); }
.m-dfoot-k { margin-right: 6px; font-family: var(--f-head); font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #bdb8a6; }
.doctrine-grid { display: flex; gap: 6px; min-width: 0; }
.doctrine-opt, .m-fbtn {
  min-width: 120px; height: 32px; padding: 0 12px; white-space: nowrap; border-radius: 2px; cursor: pointer;
  font-family: var(--f-ui); font-weight: 600; font-size: 10.7px; letter-spacing: .05em; text-transform: uppercase;
  color: #e5e2d5; background: linear-gradient(180deg, #5a5c61, #3b3d42); border: 1px solid #111214;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); transition: filter .15s, transform .12s var(--m-ease);
}
.doctrine-opt:hover, .m-fbtn:hover { filter: brightness(1.18); }
.doctrine-opt:active, .m-fbtn:active { transform: scale(.96); }
.doctrine-opt.on { color: var(--acc-ink); background: linear-gradient(180deg, var(--acc-hi), var(--acc)); border-color: color-mix(in srgb, var(--acc) 40%, #000); }
.m-fbtn { margin-left: auto; flex: none; }
/* The 2030 schools have longer names and one more of them: the buttons give up their minimum. */
.doctrine-grid:has(> :nth-child(5)) .doctrine-opt { min-width: 0; padding: 0 9px; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; }
.doctrine-detail { margin: 0; padding: 10px 16px 12px; font-size: 13px; line-height: 1.45; color: var(--paper-ink); cursor: help; }
.doctrine-detail b { color: var(--paper-strong); font-weight: 700; }

/* The chosen country, written on the parchment: who, signature and traits on
   the left, the figures on the right, the national units across the foot. */
.m-profile { container-type: inline-size; min-width: 0; }
.nation-brief { display: grid; gap: 8px; margin: 0; }
@container (min-width: 480px) {
  .nation-brief { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "head stats" "sig stats" "tags stats" "uh uh" "units units"; gap: 8px 14px; align-content: start; }
  .nb-head { grid-area: head; } .nb-sig { grid-area: sig; } .nb-tags { grid-area: tags; }
  .nb-stats { grid-area: stats; align-content: start; } .nb-units-h { grid-area: uh; } .nb-units { grid-area: units; }
}
.nb-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nb-head img { width: 56px; height: 56px; flex: none; object-fit: cover; border: 1px solid var(--paper-ink); filter: sepia(.18) contrast(1.05); }
.nb-title { min-width: 0; }
.nb-title h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--f-head); font-weight: 600; font-size: 22px; line-height: 1.1; letter-spacing: .03em; color: var(--paper-strong); }
.nb-title h2 .sw { width: 30px; height: 20px; flex: none; border: 1px solid rgba(0, 0, 0, .3); }
.nb-gen { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--acc-dk); }
.nation-brief .ident { margin: 0; padding: 0; border: 0; background: none; }
.nation-brief .ident-axes { display: none; }
.nb-sig { display: grid; gap: 1px; padding: 6px 10px; border: 1px solid var(--acc-dk); background: color-mix(in srgb, var(--acc) 24%, var(--paper)); cursor: help; }
.nb-sig-k { display: flex; align-items: center; gap: 5px; font-family: var(--f-ui); font-weight: 700; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--acc-dk); }
.nb-sig b { font-family: var(--f-head); font-weight: 500; font-size: 16px; letter-spacing: .03em; color: var(--paper-strong); }
/* The country's bonuses as one total per stat, strongest first, with a bar
   for how much each is worth; weaknesses after, in red. The signature,
   traits and flaw that make them up are the tags (hover for each). */
.nb-tags { display: flex; flex-wrap: wrap; gap: 4px; align-content: start; }
.nb-tag { padding: 3px 8px; border-radius: 2px; font-size: 11px; font-weight: 600; color: var(--paper-strong); cursor: help;
  background: var(--paper-2); border: 1px solid var(--paper-line); }
.nb-tag.bad { color: #9a3a24; border-color: rgba(154, 58, 36, .4); }
.nb-stats { display: grid; gap: 3px; }
.nb-stat { display: grid; grid-template-columns: 52px 1fr 56px; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: 2px; background: var(--paper-2); cursor: help; }
.nb-stat-v { font-family: var(--f-head); font-weight: 500; font-size: 16px; line-height: 1; text-align: right; color: #4d6b1f; }
.nb-stat-k { font-size: 12px; color: var(--paper-strong); }
.nb-stat-bar { height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .12); overflow: hidden; }
.nb-stat-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--acc-dk), var(--acc)); }
.nb-stat.bad { grid-template-columns: 52px 1fr; background: rgba(160, 60, 40, .12); }
.nb-stat.bad .nb-stat-v { color: #a3341f; }
.nb-stat.bad .nb-stat-k { color: #7e2d1c; }
.nb-units-h { font-family: var(--f-ui); font-weight: 700; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--paper-ink); }
.nb-units-h b { color: var(--acc-dk); margin-left: 4px; }
/* Every national unit, in a short scrolling grid so the page never grows with the kit. */
.nb-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; max-height: 96px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; margin-top: -4px; }
.nb-units .natunit { margin: 0; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 2px; background: var(--paper-2); min-width: 0; }
.nb-units .natunit img { width: 34px; height: 34px; }
.nb-units .natunit > span { min-width: 0; display: flex; flex-direction: column; }
.nb-units .natunit .nm { font-size: 13px; line-height: 1.15; color: var(--paper-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-units .natunit .ty { font-size: 11px; line-height: 1.15; color: var(--paper-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Multiplayer: the match list, the countries still free, the chosen one. */
.mp-cols { grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr); }
.mp-cols .m-playas { margin-bottom: 8px; }
.mp-who { margin-bottom: 10px; font-size: 13px; color: var(--paper-strong); }
.mp-who .muted { color: var(--paper-ink); }
.mp-list .btn.wide { width: 100%; margin-bottom: 10px; }
.mp-matches { display: grid; gap: 6px; max-height: 420px; overflow-y: auto; }
.mp-matches .muted, .mp-nations .muted { color: var(--paper-ink); }
.mp-match { display: grid; gap: 3px; padding: 10px 12px; text-align: left; cursor: pointer; color: var(--paper-ink);
  background: var(--paper-2); border: 1px solid var(--paper-line); border-radius: 2px; }
.mp-match.on { border-color: var(--acc-dk); box-shadow: inset 4px 0 0 var(--acc-dk); background: color-mix(in srgb, var(--acc) 30%, var(--paper)); }
.mp-match.done { opacity: .55; }
.mp-match .nm { font-family: var(--f-ui); font-weight: 700; font-size: 12px; text-transform: uppercase; color: var(--paper-strong); }
.mp-match .meta { font-size: 11px; color: var(--paper-ink); }
.mp-mine { font-style: normal; font-family: var(--f-ui); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 6px; margin-left: 6px; border-radius: 2px; color: var(--acc-ink); background: var(--acc); vertical-align: middle; }
.mp-match-head { margin-bottom: 8px; font-size: 12px; color: var(--paper-ink); }

/* The Multiplayer tab's sub-tabs (Matches, Leaderboard, Friends): bold small caps, 40px tall, on a dark strip. */
.mp-tabs { display: flex; background: var(--bar-bg); border: 1px solid #0e0f11; box-shadow: 0 4px 18px rgba(0, 0, 0, .5); overflow-x: auto; scrollbar-width: none; }
.mp-tabs button {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 18px; cursor: pointer;
  font: 700 12px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: #bdb8a6;
  background: transparent; border: 0; border-right: 1px solid rgba(255, 255, 255, .08); transition: background .2s, color .2s;
}
.mp-tabs button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.mp-tabs button.on { color: #f1ecd8; box-shadow: inset 0 -3px 0 var(--acc); background: rgba(255, 255, 255, .05); }
.mp-tabs .ic { font-size: 16px; }
.mp-count { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10px; line-height: 18px; text-align: center; color: #fff; background: #b8452c; }

/* Leaderboard and Friends: two columns of paper. */
.mp-two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.mp-two .m-playas { margin-bottom: 8px; }
.mp-two .muted { color: var(--paper-ink); }
.lb-table { display: grid; max-height: 520px; overflow-y: auto; scrollbar-width: thin; background: var(--paper-2); border: 1px solid var(--paper-line); }
.lb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 56px 56px 86px; align-items: center; gap: 6px; min-height: 38px; padding: 0 10px;
  font-size: 13px; color: var(--paper-strong); border-bottom: 1px solid color-mix(in srgb, var(--paper-line) 60%, transparent); }
.lb-row.lb-head { position: sticky; top: 0; min-height: 30px; font: 700 10px var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--paper-ink); background: var(--paper-3); }
.lb-row.me { background: color-mix(in srgb, var(--acc) 28%, var(--paper)); box-shadow: inset 4px 0 0 var(--acc-dk); }
.lb-rank { font-family: var(--f-head); font-weight: 600; font-size: 16px; text-align: center; color: var(--paper-ink); }
.lb-rank.top { display: grid; place-items: center; width: 28px; height: 28px; margin: 0 auto; border-radius: 50%; color: #241a06; font-size: 14px; }
.lb-rank.top1 { background: linear-gradient(180deg, #f3d77a, #c9a949); }
.lb-rank.top2 { background: linear-gradient(180deg, #e6e6e6, #a9aaa8); }
.lb-rank.top3 { background: linear-gradient(180deg, #e0a974, #a8693a); }
.lb-name { font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-num { text-align: right; font-variant-numeric: tabular-nums; }
.lb-empty, .lb-foot { padding: 10px; margin: 0; }
.mp-me-name { font-family: var(--f-ui); font-weight: 700; font-size: 18px; letter-spacing: .03em; text-transform: uppercase; color: rgb(208, 128, 45); overflow-wrap: anywhere; }
.mp-me-rank { margin: 4px 0 12px; font-size: 13px; color: var(--paper-ink); }
.mp-me-rank b { color: var(--paper-strong); font-size: 15px; }
.mp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.mp-stats span { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; font: 700 10px var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--paper-ink);
  background: var(--paper-2); border: 1px solid var(--paper-line); }
.mp-stats b { font-family: var(--f-head); font-size: 22px; font-weight: 600; letter-spacing: 0; color: var(--paper-strong); }
.mp-form { display: grid; gap: 6px; margin-bottom: 8px; }
.mp-form label { font: 700 11px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--paper-strong); }
.mp-form p { margin: 0; }
.mp-inline { display: flex; gap: 6px; }
.mp-inline input {
  flex: 1 1 0; min-width: 0; height: 32px; padding: 0 10px; border-radius: 2px; font: 500 13px var(--f-ui);
  color: var(--paper-strong); background: #f5f3ec; border: 1px solid color-mix(in srgb, var(--paper-ink) 40%, transparent); outline: none;
}
.mp-inline input:focus { border-color: var(--acc-dk); box-shadow: 0 0 0 3px var(--acc-soft); }
.mp-inline .btn { height: 32px; flex: none; }
.mp-note { margin: 6px 0 10px; padding: 7px 10px; font-size: 12.5px; font-weight: 600; border-left: 3px solid; background: var(--paper-2); }
.mp-note.ok { color: #2f5a22; border-color: #4f8a3a; }
.mp-note.bad { color: #9a3a24; border-color: #b8452c; }

/* Friends, requests and invitations as rows. */
.fr-sub { margin-top: 14px; }
.fr-list { display: grid; gap: 6px; max-height: 480px; overflow-y: auto; scrollbar-width: thin; }
.fr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--paper-2); border: 1px solid var(--paper-line); border-radius: 2px; }
.fr-row .btn { flex: none; }
.fr-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; margin-right: auto; font-size: 11.5px; color: var(--paper-ink); }
.fr-txt > b { font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: var(--paper-strong); overflow-wrap: anywhere; }
.fr-match { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; }
.fr-match .btn { height: 26px; padding: 0 10px; font-size: 11px; }
.fr-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #9c968a; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.fr-dot.on { background: #4caf50; box-shadow: 0 0 0 3px rgba(76, 175, 80, .22); }
.fr-x { flex: none; width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer; color: var(--paper-ink); background: transparent; border: 1px solid transparent; border-radius: 2px; }
.fr-x:hover { color: #9a3a24; border-color: var(--paper-line); }
.fr-era { flex: none; width: 30px; height: 20px; background: center/cover no-repeat url(../assets/img-e0af07af/bg_menu.webp); }
.fr-era.era2030 { background-image: url(../assets/img-e0af07af/bg_menu_2030.webp); }

/* The home rows: figures beside a game row, and a rule between rows. */
.m-game-fig { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 54px; font-size: 16px; color: var(--paper-ink); }
.m-game-fig b { font-family: var(--f-ui); font-size: 13px; color: var(--paper-strong); }
.m-game-sep { margin: 10px 0; border: 0; border-top: 1px solid var(--paper-line); }

/* "Open matches": a row of cards that scrolls sideways, with arrows. */
.carousel { display: flex; align-items: stretch; gap: 8px; }
.car-arrow { flex: none; width: 32px; cursor: pointer; font-size: 24px; line-height: 1; color: #e5e2d5; background: var(--bar-bg); border: 1px solid #0e0f11; border-radius: 2px; transition: background .2s; }
.car-arrow:hover { background: #3a3d44; }
.car-track { flex: 1; min-width: 0; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; padding-bottom: 4px; }
.car-card { flex: 0 0 210px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 4px; padding: 0 0 10px; background: var(--paper-2); border: 1px solid var(--paper-line); border-radius: 2px; }
.car-pic { position: relative; height: 84px; margin-bottom: 4px; background: center/cover no-repeat; border-bottom: 1px solid var(--paper-line); }
.car-era { position: absolute; left: 6px; top: 6px; padding: 2px 7px; font: 700 11px var(--f-head); letter-spacing: .06em; font-style: normal; color: #0a0c0e; background: #c9a949; border-radius: 2px; }
.car-era.era-2030 { background: #4fb4d4; }
.car-name { padding: 0 10px; font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; color: rgb(208, 128, 45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-meta { padding: 0 10px; font-size: 11px; color: var(--paper-ink); }
.car-join { margin: 6px 10px 0; align-self: flex-start; }
.car-empty { flex-basis: 260px; padding-top: 12px; }

/* In a match's ranking: the players' names, and the friends to invite. */
.rk-player { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 7px; font-size: 11px; font-weight: 700; border-radius: 2px;
  color: #f1ecd8; background: rgba(201, 169, 73, .22); border: 1px solid rgba(201, 169, 73, .45); vertical-align: 1px; }
.rk-player .ic { font-size: 11px; color: var(--gold); }
.rk-player.on .ic { color: #6fd36f; }
.row-list .lrow.human:not(.me) { box-shadow: inset 3px 0 0 rgba(201, 169, 73, .6); }
.inv-pan { margin-top: var(--s3); }
.inv-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.inv-row .spacer { flex: 1; }
.inv-note { margin: 8px 0 0; color: var(--gold); }
/* A phone: the three sub-tabs share the width, without their icons. */
@media (max-width: 640px) {
  .mp-tabs button { flex: 1 1 0; justify-content: center; gap: 4px; padding: 0 4px; font-size: 11px; letter-spacing: .03em; }
  .mp-tabs .ic { display: none; }
}

/* "Ready for a new fight?": a framed box with the one big button, kept on
   screen however far the page is scrolled. */
.menu-start {
  position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
  padding: 10px 10px 10px 22px; padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: rgba(16, 18, 22, .97); border: 2px solid var(--acc);
  box-shadow: inset 0 0 0 3px rgba(16, 18, 22, .97), inset 0 0 0 4px var(--acc-line), 0 -6px 24px rgba(0, 0, 0, .55);
}
.ms-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-right: auto; }
.ms-q { font-family: var(--f-ui); font-weight: 700; font-size: 18px; letter-spacing: .02em; text-transform: uppercase; color: #f1ecd8; }
.start-pick { display: flex; align-items: center; gap: 8px; min-width: 0; }
.start-pick .sw { width: 30px; height: 20px; flex: none; }
.start-pick b { font-family: var(--f-ui); font-weight: 600; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; color: var(--acc-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-pick i { font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--acc); white-space: nowrap; }
.start-more { display: none; height: 34px; padding: 0 12px; border-radius: 2px; font: 700 11px var(--f-ui); letter-spacing: .05em; text-transform: uppercase; color: var(--acc-hi); border: 1px solid var(--acc-line); background: var(--acc-soft); transition: transform .12s var(--m-ease); }
.start-more:active { transform: scale(.95); }
/* Blitz or Campaign: how fast the war is fought. Two keys of one switch. */
.pace-pick { display: flex; flex: none; border: 1px solid var(--acc-line); border-radius: 2px; overflow: hidden; }
.pace-opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 96px; height: 46px; padding: 0 12px; background: transparent; color: #bdb8a6; transition: background .15s, color .15s, transform .12s var(--m-ease); }
.pace-opt + .pace-opt { border-left: 1px solid var(--acc-line); }
.pace-opt b { font: 700 13px var(--f-ui); letter-spacing: .08em; text-transform: uppercase; }
.pace-opt i { font: 600 10px var(--f-ui); font-style: normal; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.pace-opt:hover { background: var(--acc-soft); color: #f1ecd8; }
.pace-opt:active { transform: scale(.96); }
.pace-opt.on { background: linear-gradient(180deg, var(--acc-hi), var(--acc)); color: var(--acc-ink); }
.pace-opt.on i { opacity: .85; }
.opt-row { display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  font-family: var(--f-ui); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #bdb8a6; }
.opt-row input { width: 18px; height: 18px; accent-color: var(--acc); }
.menu-start .opt-row { margin: 0; }
#menu .menu-start .ms-go {
  position: relative; overflow: hidden; width: 260px; height: 80px; padding: 0 16px; border-radius: 2px;
  font-family: var(--f-ui); font-weight: 700; font-size: 22px; letter-spacing: .04em; color: var(--acc-ink); text-shadow: 0 1px 0 rgba(255, 255, 255, .3);
  background: linear-gradient(180deg, var(--acc-hi), var(--acc) 55%, color-mix(in srgb, var(--acc) 70%, #000)); border-color: color-mix(in srgb, var(--acc) 45%, #000);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 18px rgba(0, 0, 0, .5); transition: transform .12s var(--m-ease), box-shadow .25s, filter .15s;
}
#menu .menu-start .ms-go:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 4px var(--acc-soft), 0 6px 24px rgba(0, 0, 0, .55); transform: translateY(-1px); }
#menu .menu-start .ms-go:active:not(:disabled) { transform: scale(.97); }
#menu :focus-visible { outline: 2px solid var(--acc-hi); outline-offset: 2px; }
.menu-legal { padding: 4px 0 16px; text-align: center; font-size: 11px; color: #a49b7c; }
.menu-legal a { color: #c9bd93; }

/* Short desktop windows: a lower box and map, so more of the dialog shows above it. */
@media (min-width: 901px) and (max-height: 960px) {
  .m-map { aspect-ratio: 2.3 / 1; }
  #menu .menu-start .ms-go { height: 60px; font-size: 20px; }
  .menu-start { padding-top: 8px; padding-bottom: 8px; }
}
@media (max-width: 1040px) {
  .mp-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mp-cols .m-profile { grid-column: 1 / -1; }
}
/* One column: the map, then the list, then the country and its doctrine. */
@media (max-width: 900px) {
  .start-more { display: block; }
  .m-cols, .mp-cols, .mp-two { grid-template-columns: minmax(0, 1fr); }
  .m-game { flex-wrap: wrap; }
  .m-game-fig { display: none; }
  .lb-row { grid-template-columns: 34px minmax(0, 1fr) 40px 40px 64px; padding: 0 6px; font-size: 12px; }
  .car-card { flex-basis: 180px; }
  .car-arrow { display: none; }
  .m-left { display: contents; }
  .m-map { order: 1; }
  .m-nations { order: 2; }
  .m-profile { order: 3; }
  .m-nations .nation-grid { flex: none; contain: none; max-height: 360px; min-height: 0; }
  .doctrine-grid { flex: 1; flex-wrap: wrap; }
  .doctrine-opt { flex: 1; min-width: 0; }
}
@media (max-width: 640px) {
  .menu-top { flex-direction: column; align-items: stretch; margin-bottom: 10px; }
  .menu-brand { align-items: center; padding: 10px 12px 8px; }
  .menu-logo { font-size: 26px; }
  .mode-tabs button { flex: 1; width: auto; height: 46px; font-size: 14px; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08); }
  .m-dbar { height: 40px; line-height: 40px; font-size: 18px; }
  .m-cols { padding: 10px; gap: 10px; }
  .m-map { aspect-ratio: 16 / 10; }
  .era-grid { gap: 8px; }
  .era-opt { min-height: 64px; padding: 8px 12px; }
  .era-opt .era-year { font-size: 24px; }
  .era-opt .era-sub { font-size: 10px; letter-spacing: .04em; }
  .era-opt::before { right: 8px; width: 22px; height: 22px; margin-top: -11px; font-size: 13px; }
  .m-game { flex-wrap: wrap; gap: 10px; }
  .m-game-txt { flex: 1 1 140px; }
  #menu .m-continue { flex: 1 1 100%; width: auto; height: 50px; font-size: 17px; }
  .m-dfoot { flex-wrap: wrap; padding: 8px 10px; }
  .doctrine-grid { order: 3; flex: 1 1 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .doctrine-opt { height: auto; min-height: 32px; padding: 4px 6px; white-space: normal; }
  .doctrine-detail { padding: 8px 10px 10px; }
  .menu-start { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 8px 10px; }
  /* Two rows: the country and the pace, then the tutorial switch, Details and the big button. */
  .ms-text { flex: 1 1 40%; gap: 4px; }
  .ms-q { display: none; }
  .pace-pick { flex: none; }
  .pace-opt { min-width: 0; height: 40px; padding: 0 10px; }
  .pace-opt b { font-size: 12px; }
  .pace-opt i { font-size: 9px; }
  .menu-start .opt-row { order: 3; gap: 5px; font-size: 10px; letter-spacing: .04em; }
  .menu-start .start-more { padding: 0 6px; height: 44px; font-size: 10px; letter-spacing: .03em; }
  .start-pick i { display: none; }
  .opt-row { flex: none; font-size: 11px; }
  .start-more { order: 3; }
  #menu .menu-start .ms-go { order: 4; flex: 1 1 0; width: auto; min-width: 132px; height: 48px; padding: 0 6px; font-size: 15px; letter-spacing: .02em; white-space: nowrap; }
  .nb-title h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  #menu, #menu * { transition-duration: .01s !important; animation-duration: .01s !important; }
}

/* ---------------------------------------------------------------- loading */
/* The painting fills the screen; a small logo at the top, and at the foot
   the progress (a hairline under spaced caps) and a "Did you know?" tip. */
#loading {
  position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; align-items: center;
  padding: 28px 16px 14px; background: #0a0c0e center/cover no-repeat; color: #d8cba0; text-align: center;
}
#loading::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(8, 9, 11, .55), rgba(8, 9, 11, 0) 22%, rgba(8, 9, 11, .1) 50%, rgba(8, 9, 11, .88)); }
#loading > * { position: relative; z-index: 1; }
#loading .lg { font-family: var(--f-head); font-weight: 700; font-size: 30px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); text-shadow: 0 2px 0 #17120a, 0 4px 18px rgba(0, 0, 0, .8); }
#loading .ld-foot { margin-top: auto; margin-bottom: 34px; display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(620px, 100%); }
#loading .msg { font-family: var(--f-ui); font-weight: 600; font-size: 12px; letter-spacing: .38em; text-transform: uppercase; color: #ece4c6; text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
#loading .bar2 { width: 250px; max-width: 100%; height: 2px; background: rgba(255, 255, 255, .18); overflow: hidden; }
#loading .bar2 i { display: block; height: 100%; width: 0; background: var(--gold); box-shadow: 0 0 8px rgba(255, 249, 191, .7); transition: width .3s; }
#loading .ld-tip { margin-top: 18px; }
#loading .ld-tip b { display: block; font-family: var(--f-head); font-weight: 600; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); }
#loading .ld-tip p { margin: 6px 0 0; min-height: 2.9em; font-family: var(--f-ui); font-size: 13px; line-height: 1.45; color: #ddd6bd; text-shadow: 0 1px 6px rgba(0, 0, 0, .9); opacity: 0; transition: opacity .5s ease; }
#loading .ld-tip p.in { opacity: 1; }
#loading .ld-mark { font-family: var(--f-ui); font-weight: 600; font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: rgba(229, 226, 213, .45); }

/* ------------------------------------------------------------- end screen */
#endscreen { position: fixed; inset: 0; z-index: 110; display: none; align-items: center; justify-content: center; background: #08090b center/cover no-repeat; }
#endscreen.open { display: flex; }
/* A vignette, not a blanket. The flat wash that used to sit here was dark
   enough to hide the artwork entirely and left the screen looking broken; this
   darkens only the middle, where the words are, and lets the picture read. */
#endscreen::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 52% 40% at 50% 46%,
      rgba(8, 9, 11, .86) 0%, rgba(8, 9, 11, .62) 45%, rgba(8, 9, 11, 0) 100%),
    linear-gradient(rgba(8, 9, 11, .18), rgba(8, 9, 11, .48));
}
.end-card { position: relative; z-index: 1; text-align: center; }
.end-card h1 { font-family: var(--f-head); font-weight: 700; font-size: 66px; letter-spacing: .2em; text-transform: uppercase; margin: 0 0 6px; }
.end-card h1.win { color: var(--gold); text-shadow: 0 3px 0 #17120a; }
.end-card h1.lose { color: #c07a68; text-shadow: 0 3px 0 #190d09; }
.end-card p {
  color: #d8cfae; margin: 0 0 22px; font-size: 16px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .95), 0 0 18px rgba(0, 0, 0, .8);
}

/* Measured against the game area (#app), not the window: with the advert
   column up the game is 300px narrower than the screen it is on. */
@container game (max-width: 1280px) {
  .pb-ongoing { display: none; }
}
@container game (max-width: 1040px) {
  #minimap { display: none; }
  :root { --bp-left: 170px; }
}

/* Generic label/value row used inside dialogs and info panels. */
.row { display: flex; justify-content: space-between; gap: var(--s4); align-items: baseline; }
.row > span:last-child { color: var(--text); }
.dialog-body .row { padding: var(--s1) 0; }

/* A crop of the real map, warmed a little towards the sepia of the scene
   behind the army's cards. Clicking it centres the map on the province. */
.pb-thumb {
  width: 100%; flex: 1; min-height: 0; border: 1px solid #000; border-radius: 2px;
  box-shadow: var(--shadow-inset); display: block; cursor: pointer;
  filter: sepia(.3) saturate(.9);
}

/* Short screens: tighten the rail and the bottom bar so nothing is cut off. */
@media (max-height: 780px) {
  #rail { gap: 6px; }
  .rail-btn { width: 48px; height: 48px; font-size: 23px; }
  #map-tools .rail-btn { width: 40px; height: 40px; font-size: 19px; }
  :root { --bp-h: 166px; }
  .bslot { width: 48px; height: 48px; }
  .bslot .ic { font-size: 17px; }
  #minimap { height: 46px; width: 200px; }
}
@media (max-height: 640px) {
  #minimap { display: none; }
  :root { --bp-h: 150px; }
}

/* ------------------------------------------------------- strategic advisor */
#right-rail {
  position: absolute; right: 4px; top: calc(var(--topbar-h) + 10px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 31;
}
.portrait-btn {
  width: 64px; height: 64px; position: relative; transform: rotate(45deg);
  border-radius: 8px; overflow: hidden;
  border: 2px solid var(--brass);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .6);
  background: var(--panel-deep);
}
.portrait-btn img {
  position: absolute; left: 50%; top: 50%; width: 132%; height: 132%;
  transform: translate(-50%, -50%) rotate(-45deg); object-fit: cover;
}
.portrait-btn:hover { border-color: var(--gold); filter: brightness(1.12); }
.portrait-btn .badge { transform: rotate(-45deg); top: -2px; right: -2px; z-index: 2; }

.adv-wrap { display: flex; gap: var(--s3); height: min(560px, calc(100vh - 250px)); }
.adv-list {
  width: 330px; flex: none; overflow: auto; border-radius: 3px;
  background: linear-gradient(var(--bone-lit), var(--bone));
  border: 1px solid var(--edge); box-shadow: inset 0 0 12px rgba(70, 62, 40, .3);
}
.adv-head, .adv-section {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px; font-family: var(--f-ui); font-weight: 600; font-size: 10.5px;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 1px solid rgba(76, 72, 57, .25);
}
.adv-section { background: rgba(76, 72, 57, .1); }
.adv-section .ic { font-size: 15px; }
.adv-section.claim { color: #4d6b1f; }
.adv-section.claim .ic { color: #6f9430; }
.adv-section.open { color: #9c3a25; }
.adv-section.open .ic { color: #b8452c; }

.adv-row {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; text-align: left;
  border-bottom: 1px solid rgba(76, 72, 57, .18); color: var(--ink);
}
.adv-row:hover { background: rgba(255, 255, 255, .4); }
.adv-row.on { background: rgba(201, 169, 73, .28); }
.adv-row.done { opacity: .55; }
/* "Do it": straight to the screen where the advice is acted on. */
.adv-go {
  flex: none; display: inline-flex; align-items: center; gap: 4px; margin-left: auto;
  padding: 4px 10px; border-radius: 3px; cursor: pointer; white-space: nowrap;
  font-family: var(--f-ui); font-size: 12px; font-weight: 700; color: #241d0c;
  background: linear-gradient(180deg, #f0d77a, #c9a949); border: 1px solid #5b4a17;
}
.adv-go .ic { transform: rotate(90deg); font-size: 12px; }
.adv-go:hover { background: linear-gradient(180deg, #f7e39a, #d8b856); }
.adv-go.big { padding: 9px 20px; font-size: 15px; letter-spacing: .04em; }
.adv-go.claim { color: #fff; background: linear-gradient(180deg, #86ad3c, #55801f); border-color: #2f4a10; }
.adv-go.claim .ic { transform: none; }
.adv-go.claim:hover { background: linear-gradient(180deg, #98c048, #629226); }
/* A phone has no room for the list and the page side by side: one under the other, both in reach. */
@media (max-width: 720px) {
  .adv-wrap { flex-direction: column; height: auto; }
  .adv-list { width: 100%; max-height: 44vh; }
  .adv-detail { flex: none; overflow: visible; }
  .adv-go { padding: 8px 10px; }
}
.adv-row .mark { font-size: 17px; color: #6f9430; flex: none; }
.adv-row.done .mark { color: var(--ink-soft); }
.adv-row .body { flex: 1; min-width: 0; }
.adv-row .nm { display: block; font-family: var(--f-ui); font-weight: 600; font-size: 11.5px; letter-spacing: .03em; }
.adv-row .prog { display: block; height: 5px; margin-top: 4px; background: rgba(40, 36, 22, .3); border-radius: 2px; overflow: hidden; }
.adv-row .prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-2), var(--green-1)); }
.adv-row .cnt { font-size: 11px; color: var(--ink-soft); }

.adv-detail {
  flex: 1; min-width: 0; overflow: auto; padding: 14px 18px; border-radius: 3px;
  background: linear-gradient(var(--bone-lit), var(--bone));
  border: 1px solid var(--edge); color: var(--ink);
}
.adv-title {
  margin: 0 0 14px; text-align: center; font-family: var(--f-head); font-weight: 600;
  font-size: 19px; letter-spacing: .14em; text-transform: uppercase; color: #35301c;
}
.adv-sub {
  text-align: center; font-family: var(--f-ui); font-weight: 600; font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 1px solid rgba(76, 72, 57, .25); padding-bottom: 5px; margin-bottom: 12px;
}
.adv-rewards { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.adv-reward {
  width: 74px; padding: 6px 4px; text-align: center; border-radius: 3px;
  background: linear-gradient(#5d5847, #423e31); border: 1px solid var(--edge-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.adv-reward .v { display: block; font-family: var(--f-head); font-size: 13px; color: var(--gold); }
.adv-reward .ic { font-size: 24px; color: var(--brass); margin: 2px 0; }
.adv-reward .l { display: block; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: #b9b19a; }
.adv-tip { margin: 0; text-align: center; font-size: 12.5px; line-height: 1.55; color: #3d3724; }

.dialog-head .portrait {
  width: 34px; height: 34px; border-radius: 3px; overflow: hidden; flex: none;
  border: 1px solid var(--brass); box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.dialog-head .portrait img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------------------------------------------------- front reports */
.rep-filters { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.rep-filter {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 14px;
  border-radius: 14px; font-family: var(--f-ui); font-weight: 600; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
  background: rgba(29, 27, 18, .5); border: 1px solid rgba(76, 72, 57, .6);
}
.rep-filter i {
  width: 11px; height: 11px; border-radius: 50%; background: #3a3728;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6);
}
.rep-filter.on { color: var(--text); }
.rep-filter.on i { background: var(--green-1); box-shadow: inset 0 0 0 1px rgba(0,0,0,.6), 0 0 6px rgba(121,143,67,.8); }
.rep-filter:hover { border-color: var(--edge); }

.rep-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; position: relative;
  border-bottom: 1px solid rgba(130, 124, 103, .16);
}
.rep-row[data-jump] { cursor: pointer; }
.rep-row:hover { background: rgba(255, 249, 191, .06); }
.rep-row.fresh { background: rgba(196, 50, 34, .14); }
.rep-row.fresh:hover { background: rgba(196, 50, 34, .2); }
.rep-new {
  position: absolute; left: 0; top: 0; padding: 1px 5px; border-radius: 0 0 3px 0;
  background: var(--red); color: #fff; font-size: 8.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.rep-pic { width: 62px; height: 46px; flex: none; overflow: hidden; border: 1px solid var(--edge-dark); border-radius: 2px; }
.rep-pic img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1); }
.rep-body { flex: 1; min-width: 0; }
.rep-head {
  display: block; font-family: var(--f-ui); font-weight: 700; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
}
.rep-text { display: block; font-size: 12.5px; color: var(--text); margin: 1px 0; }
.rep-when { display: block; font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.rep-go { font-size: 18px; color: var(--brass); flex: none; }

/* ---------------------------------------------------- national character */


.trait {
  padding: 5px 8px; margin-bottom: 5px; border-radius: 3px;
  background: rgba(0, 0, 0, .18); border-left: 3px solid var(--brass);
}
.trait.good { border-left-color: #7d9a4e; }
.trait.bad { border-left-color: #a2543f; }
.trait .nm { display: block; font-family: var(--f-head); font-size: 13px; color: var(--text); }
.trait .fx { display: block; font-size: 11px; color: var(--gold); }
.trait.bad .fx { color: #d08d75; }

.natunit { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 7px; }
.natunit img {
  width: 44px; height: 44px; flex: none; object-fit: cover;
  border: 1px solid var(--brass-dim); border-radius: 3px;
}
.natunit .nm { display: block; font-family: var(--f-head); font-size: 13px; color: var(--gold); }

.ucard .nm .natl { color: var(--gold); }

.dip-gen img {
  width: 30px; height: 30px; object-fit: cover; display: block;
  border: 1px solid var(--brass-dim); border-radius: 3px;
  filter: sepia(0.2) contrast(1.05);
}

/* --------------------------------------------- sortable list headers */
.row-list .lhead {
  position: sticky; top: 0; z-index: 2;
  padding: 0; border-bottom: 1px solid rgba(130, 124, 103, .35);
  background: linear-gradient(180deg, #3a3628, #2b2820);
}
.row-list .lhead:hover { background: linear-gradient(180deg, #3a3628, #2b2820); }
.lsort {
  display: flex; align-items: center; gap: var(--s1);
  padding: var(--s2) var(--s1); min-width: 0;
  font-family: var(--f-ui); font-weight: 600; font-size: var(--fs-small);
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim);
}
.lsort span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lsort .ic { font-size: 16px; color: var(--brass); flex: none; }
.lsort:hover { color: var(--text); }
.lsort.on { color: var(--gold); }
.lsort .dir { font-style: normal; font-size: 9px; }

/* A resource figure in a list row: icon then number, nothing else. */
.pcell { display: flex; align-items: center; gap: var(--s1); font-variant-numeric: tabular-nums; }
.pcell .ic { font-size: 18px; color: var(--brass); flex: none; }
.pcell b { font-weight: 600; color: var(--text); }

.trend { font-style: normal; font-size: 9px; }
.trend.up { color: var(--green-1); }
.trend.down { color: #e0705a; }
.trend.flat { color: var(--text-dim); }

/* ------------------------------------------------------------- unit page */
.uhero {
  position: relative; height: 176px; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--edge); background: #2a2820; margin-bottom: var(--s4);
}
.uhero img { width: 100%; height: 100%; object-fit: cover; }
.uhero .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s3);
  background: linear-gradient(transparent, rgba(8, 8, 6, .92));
  display: flex; flex-direction: column; gap: 2px;
}
.uhero .cap b {
  font-family: var(--f-head); font-weight: 600; font-size: 21px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text);
}
.uhero .cap .tiny { color: var(--text-dim); text-transform: uppercase; letter-spacing: .1em; }

.ustats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2) var(--s4); }
.ustat {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 0 var(--s2); padding: var(--s1) 0;
}
.ustat .lbl { display: flex; align-items: center; gap: var(--s2); color: var(--text-dim); font-size: var(--fs-small); }
.ustat .lbl .ic { font-size: 17px; color: var(--brass); flex: none; }
.ustat .val { font-family: var(--f-head); font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.ustat .meter {
  grid-column: 1 / -1; height: 6px; margin-top: var(--s1); border-radius: 2px;
  background: rgba(0, 0, 0, .5); box-shadow: var(--shadow-inset); overflow: hidden;
}
.ustat .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-2), var(--green-1)); }

.urole-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.urole {
  padding: var(--s1) var(--s3); border-radius: 3px;
  background: linear-gradient(180deg, #5c6f2c, var(--green-2));
  border: 1px solid #2c3714; color: #eef3dd;
  font-family: var(--f-ui); font-weight: 600; font-size: var(--fs-small);
  letter-spacing: .06em; text-transform: uppercase;
}
.udesc { margin: 0; color: var(--text-dim); }
.ucard-foot { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.ucard-foot .icon-btn { margin-left: auto; }

/* The morale a build costs the province, shown in red as the original does. */
.mcost {
  display: block; margin-top: 2px;
  font-size: var(--fs-small); font-weight: 600; color: #c0553f;
  letter-spacing: .03em;
}

.nextday {
  display: block; font-size: var(--fs-small); color: var(--text-dim);
  letter-spacing: .04em; text-transform: none; margin-top: 1px;
}

/* Build-loop slots: how many jobs a province may stack. */
.loopslots { display: inline-flex; gap: 3px; align-items: center; }
.loopslots i {
  width: 9px; height: 9px; border-radius: 2px; display: block;
  background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px rgba(130, 124, 103, .5);
}
.loopslots i.on { background: var(--green-1); box-shadow: inset 0 0 0 1px #2c3714; }

/* The plain class under a unit's pattern name. */
.usub {
  display: block; font-size: var(--fs-small); color: var(--text-dim);
  letter-spacing: .04em; margin-top: -1px;
}

/* Building slots, grouped by what they are for. */
.bgroup { display: block; margin-bottom: var(--s2); }
.bgroup-h {
  display: block; margin-bottom: var(--s1);
  font-family: var(--f-ui); font-weight: 600; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
}
.bgroup-row { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* ---------------------------------------------------------- nation badge */
/* Every list row in the original opens with a picture. Ours is the country's
   commander with its flag across the corner. */
.nface {
  position: relative; display: block; width: 36px; height: 36px; flex: none;
  border: 1px solid var(--edge); border-radius: 3px; overflow: hidden;
  background: #2a2820; box-shadow: var(--shadow-inset);
}
.nface img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.18) contrast(1.05); }
.nface i {
  position: absolute; left: 0; bottom: 0; width: 15px; height: 10px;
  background-size: cover !important; box-shadow: 0 0 0 1px rgba(0, 0, 0, .8);
}
.lrow .rank {
  font-family: var(--f-head); font-size: 15px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.lrow.me .rank { color: var(--gold); }

/* A themed picture bled into the right of a dialog's header, faded into the
   bar. The original frames every one of its dialogs this way. */
.dialog-head { position: relative; overflow: hidden; }
.dialog-banner {
  position: absolute; right: 0; top: 0; height: 100%; width: 46%;
  object-fit: cover; object-position: center 40%;
  opacity: .5; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 65%);
  mask-image: linear-gradient(90deg, transparent, #000 65%);
}
.dialog-head > *:not(.dialog-banner) { position: relative; z-index: 1; }

/* ------------------------------------------------------------- wire room */
/* Docked bottom-left at the original's own size: 400x300, a header of room
   tabs, the traffic on the left and the rooms on the right. */
#chat {
  position: fixed; left: 70px; bottom: 0; width: 400px; height: 300px;
  z-index: 55; display: none; flex-direction: column;
  background: var(--panel); border: 1px solid var(--edge); border-bottom: 0;
  box-shadow: 0 -3px 16px rgba(0, 0, 0, .6);
}
#chat.open { display: flex; }
.chat-head {
  height: 40px; flex: none; display: flex; align-items: center; gap: var(--s1);
  padding: 0 var(--s2);
  background: linear-gradient(180deg, #4a4534, #322e22 60%, #262318);
  border-bottom: 1px solid #000;
}
.chat-head .spacer { flex: 1; }
.chat-tabs { display: flex; gap: var(--s1); }
.chat-tab {
  display: flex; align-items: center; gap: var(--s1); height: 28px; padding: 0 var(--s2);
  border-radius: 2px; background: linear-gradient(180deg, #34363c, #26282d);
  border: 1px solid var(--edge-dark);
  font-family: var(--f-ui); font-weight: 600; font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; color: #a49d84;
}
.chat-tab .ic { font-size: 14px; }
.chat-tab.on { color: var(--gold); background: linear-gradient(180deg, #4a4534, #322e22); }
.chat-tab:disabled { opacity: .4; }
.chat-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--text-dim); }
.chat-icon:hover { color: var(--text); }

.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-log { flex: 1; min-width: 0; overflow-y: auto; padding: var(--s2) var(--s3); }
.chat-empty { margin: var(--s3) 0; color: var(--text-dim); font-size: var(--fs-small); line-height: 1.5; }
.chat-msg { margin-bottom: var(--s2); font-size: var(--fs-small); line-height: 1.45; }
.chat-msg .who {
  font-family: var(--f-ui); font-weight: 700; font-size: 10.5px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--brass); margin-right: var(--s1);
}
.chat-msg.mine .who { color: var(--gold); }
.chat-msg .txt { color: var(--text); }
.chat-msg .at { color: var(--ink-soft); font-size: 10px; margin-left: var(--s1); }

.chat-rooms {
  width: 56px; flex: none; overflow-y: auto; padding: var(--s2) var(--s1);
  display: flex; flex-direction: column; gap: var(--s1); align-items: center;
  border-left: 1px solid rgba(130, 124, 103, .25); background: rgba(0, 0, 0, .18);
}
.chat-room {
  position: relative; width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--edge-dark); border-radius: 3px; overflow: hidden;
  background: rgba(29, 27, 18, .5); color: var(--brass); font-size: 19px;
}
.chat-room img { width: 100%; height: 100%; object-fit: cover; }
.chat-room.on { box-shadow: 0 0 0 2px var(--gold); }
.chat-room:disabled { opacity: .35; }
.chat-room .dot {
  position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--red); color: #fff; border: 1px solid #000;
  font-family: var(--f-ui); font-weight: 700; font-size: 9px; line-height: 15px; font-style: normal;
}

.chat-foot { flex: none; display: flex; gap: var(--s2); padding: var(--s2) var(--s3) var(--s3); }
.chat-foot input {
  flex: 1; min-width: 0; height: 30px; padding: 0 var(--s2);
  background: rgba(0, 0, 0, .4); border: 1px solid var(--edge-dark); border-radius: 2px;
  color: var(--text); font-family: var(--f-ui); font-size: var(--fs-small);
}
.chat-foot input:focus { outline: none; border-color: var(--brass-dim); }


/* --------------------------------------------------------------- icons */
/* The original's icons are painted and sit slightly proud of their ground.
   Ours are line art, so they get the same treatment cheaply: a warm inner
   highlight and a dropped edge, which reads as struck metal rather than as
   a flat glyph. */
.ic svg { display: block; }
.res .ic, .cost .ic, .pcell .ic, .ustat .lbl .ic, .prod-rows .r .ic,
.pan-head .ic, .lsort .ic, .ustats .ic {
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .65)) drop-shadow(0 0 3px rgba(201, 169, 73, .28));
}
.rail-btn .ic, .chat-room .ic {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8));
}
.rail-btn.on .ic { filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .35)); }

/* --------------------------------------------- the file on foreign ground */
.hidden-fact {
  display: inline-block; letter-spacing: .28em; color: var(--ink-soft);
  border-bottom: 1px dashed rgba(130, 124, 103, .5);
}
.act-row { display: grid; grid-template-columns: 1fr; gap: var(--s2); }
.act-card {
  display: grid; grid-template-columns: 30px 1fr; align-items: center;
  gap: 0 var(--s3); padding: var(--s3);
  text-align: left; border-radius: 4px;
  background: linear-gradient(180deg, #5c6f2c, var(--green-2));
  border: 1px solid #2c3714; color: #eef3dd;
}
.act-card .ic { grid-row: span 2; font-size: 22px; color: #dbe7bd; }
.act-card .nm {
  font-family: var(--f-head); font-weight: 600; font-size: var(--fs-head);
  letter-spacing: .06em; text-transform: uppercase;
}
.act-card .sub { font-size: var(--fs-small); color: #c6d3a8; }
.act-card:hover:not(:disabled) { filter: brightness(1.12); }
.act-card:disabled { filter: grayscale(.8) brightness(.62); }

/* A research bench: one row per slot, filled or free. */
.rt-bench {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) 0; border-bottom: 1px solid rgba(130, 124, 103, .18);
}
.rt-bench:last-child { border-bottom: 0; }
.rt-bench .ic { font-size: 18px; color: var(--brass); flex: none; }
.rt-bench .body { flex: 1; min-width: 0; }
.rt-bench .body b { display: block; font-size: var(--fs-small); color: var(--text); }
.rt-bench .bar { display: block; height: 6px; margin: var(--s1) 0 2px; }
.rt-bench.free { opacity: .55; }

.confirm-body { margin: 0; color: var(--text); line-height: var(--lh-body); }

/* ------------------------------------------------------ the commander

   Your general, docked bottom-right under his own portrait. He talks
   unprompted when something happens and answers when asked, so the window
   reads as a conversation rather than as another data panel: his lines sit
   left on parchment, yours sit right in gunmetal. */

#commander {
  /* Docked above the clock, speed buttons and minimap rather than over them. */
  position: fixed; right: calc(70px + var(--ad-w)); bottom: 160px; width: 380px; max-height: calc(100vh - 240px);
  z-index: 55; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--edge); border-bottom: 0;
  box-shadow: 0 -3px 16px rgba(0, 0, 0, .6);
  transform: translateY(calc(100% + 4px));
  opacity: 0; pointer-events: none;
  transition: transform .26s cubic-bezier(.2, .9, .3, 1), opacity .2s ease;
}
#commander.open { transform: none; opacity: 1; pointer-events: auto; }

.cmd-head {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s1) var(--s2);
  background: linear-gradient(180deg, var(--chrome-hi), var(--chrome-lo));
  border-bottom: 1px solid var(--edge-dark);
}
.cmd-head .spacer { flex: 1; }
.cmd-face {
  width: 34px; height: 34px; object-fit: cover; object-position: top center;
  border: 1px solid var(--edge); background: #000;
}
.cmd-who { display: flex; flex-direction: column; line-height: 1.15; }
.cmd-who b { font-family: var(--f-head); font-size: 14px; letter-spacing: .04em; color: var(--text); }
.cmd-who i {
  font-style: normal; font-family: var(--f-ui); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
}
.cmd-icon {
  background: none; border: 0; color: var(--text-dim); cursor: pointer;
  font-size: 15px; padding: var(--s1) var(--s2);
}
.cmd-icon:hover { color: var(--gold); }

.cmd-log {
  flex: 1; overflow-y: auto; padding: var(--s3);
  display: flex; flex-direction: column; gap: var(--s2);
  min-height: 120px;
}
.cmd-line {
  align-self: flex-start; max-width: 92%;
  background: var(--bone); color: var(--ink);
  font-family: var(--f-serif); font-size: var(--fs-body); line-height: var(--lh-body);
  padding: var(--s2) var(--s3);
  border-left: 3px solid var(--brass);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  animation: cmd-in .26s ease both;
}
.cmd-line.urgent { border-left-color: var(--red); background: #d2bfae; }
.cmd-line.mine {
  align-self: flex-end; background: var(--chrome-lo); color: var(--text);
  font-family: var(--f-ui); font-size: var(--fs-small);
  border-left: 0; border-right: 3px solid var(--edge);
}
.cmd-line[data-focus] { cursor: pointer; }
.cmd-line[data-focus]:hover { background: var(--bone-lit); }
.cmd-go {
  display: block; margin-top: var(--s1);
  font-family: var(--f-ui); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft);
}
.cmd-go .ic { font-size: 11px; }
@keyframes cmd-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.cmd-asks {
  display: flex; flex-wrap: wrap; gap: var(--s1);
  padding: var(--s2); border-top: 1px solid var(--edge-dark);
  background: rgba(0, 0, 0, .25);
}
.cmd-ask {
  font-family: var(--f-ui); font-size: 11px;
  background: linear-gradient(180deg, #3d4030, #2b2d22);
  color: var(--text); border: 1px solid var(--edge-dark);
  padding: 5px var(--s2); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.cmd-ask:hover { background: linear-gradient(180deg, #4e5240, #3a3d2c); color: var(--gold); }
.cmd-ask.objectives { color: var(--brass); }

/* Call of War's advisor: a big portrait at the head of the window, his words
   in large type on parchment, and every tip that names somewhere carries a
   gold button that takes you there. */
/* Open, the window is the advisor himself at the bottom centre: the large
   portrait of the tip bubble, standing over the edge of a parchment speech
   box that holds the conversation and the questions. `bottom` is set from
   script so he clears the province bar or an army's orders. */
#commander {
  left: calc(var(--game-w) / 2); right: auto; bottom: 26px;
  width: min(780px, calc(var(--game-w) - 32px)); max-height: none;
  flex-direction: row; align-items: flex-end;
  background: none; border: 0; box-shadow: none;
  transform: translate(-50%, 18px);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2, .9, .3, 1), bottom .2s ease;
}
#commander.open { transform: translate(-50%, 0); }
.cmd-face {
  flex: none; width: 150px; height: 178px; object-fit: cover; object-position: top;
  margin-right: -16px; position: relative; z-index: 1;
  border: 2px solid var(--brass); border-radius: 4px 4px 0 4px;
  background: #2a2818; box-shadow: 0 6px 22px rgba(0, 0, 0, .7);
}
.cmd-box {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  max-height: min(430px, calc(100vh - 220px));
  background: linear-gradient(180deg, var(--bone-lit), var(--bone)); color: var(--ink);
  border: 1px solid var(--edge-dark); border-left: 4px solid var(--gold);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .65), 0 0 0 1px rgba(233, 199, 101, .45);
}
.cmd-head { padding: 10px 10px 4px 30px; gap: 10px; background: none; border: 0; }
.cmd-who { flex-direction: row; align-items: baseline; gap: 10px; }
.cmd-who b { font-size: 18px; color: #2a2412; }
.cmd-who i { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: #7a5a10; }
.cmd-icon { color: #6f6340; font-size: 16px; }
.cmd-icon:hover { color: #241d0c; }
/* What he said reads as speech, not chat bubbles: large serif lines on the
   parchment itself, the newest at the bottom, your questions small and
   right-aligned between them. */
.cmd-log { gap: 8px; padding: 2px 18px 10px 30px; min-height: 0; max-height: 240px; }
.cmd-line {
  max-width: 100%; padding: 0; background: none; box-shadow: none; border: 0;
  font-size: 17px; line-height: 1.45; color: #1d1a0e;
}
.cmd-line + .cmd-line:not(.mine) { padding-top: 8px; border-top: 1px dashed rgba(90, 74, 23, .3); }
.cmd-line.urgent { background: none; color: #6a1a10; }
.cmd-line.mine {
  align-self: flex-end; background: none; border: 0; padding: 0;
  font-family: var(--f-ui); font-size: 12px; font-style: italic; color: #6f6340;
}
.cmd-line.mine::before { content: '— '; }
.cmd-line[data-focus]:hover { background: none; color: #000; }
.cmd-go {
  display: flex; width: fit-content; align-items: center; gap: 5px; margin-top: 8px; padding: 5px 12px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: none; border-radius: 3px;
  color: #241d0c; background: linear-gradient(180deg, #f0d77a, #c9a949); border: 1px solid #5b4a17;
}
.cmd-line[data-focus]:hover .cmd-go { background: linear-gradient(180deg, #f7e39a, #d8b856); }
.cmd-asks {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 10px 12px 12px 30px; background: rgba(90, 74, 23, .12); border-top: 1px solid rgba(90, 74, 23, .3);
}
.cmd-ask { font-size: 13px; padding: 8px 10px; text-align: left; border-radius: 3px; }
@media (max-width: 640px) {
  #commander { width: calc(var(--game-w) - 16px); }
  .cmd-face { width: 84px; height: 100px; margin-right: -12px; }
  .cmd-head, .cmd-log { padding-left: 20px; }
  .cmd-asks { grid-template-columns: 1fr 1fr; padding-left: 20px; }
  .cmd-line { font-size: 15px; }
  .cmd-box { max-height: calc(100vh - 160px); }
  .cmd-who { flex-direction: column; gap: 2px; }
  .cmd-who b { white-space: nowrap; }
}

/* What he says when the window is shut: the general steps in at the bottom
   centre of the screen, a large portrait beside his words, briefing-style.
   `bottom` is set from script so it clears the province bar or army panel. */
#cmd-bubble {
  position: fixed; left: calc(var(--game-w) / 2); bottom: 26px; z-index: 56;
  width: min(640px, calc(var(--game-w) - 32px));
  display: flex; align-items: flex-end;
  cursor: pointer; pointer-events: none;
  opacity: 0; transform: translate(-50%, 18px);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2, .9, .3, 1), bottom .2s ease;
}
#cmd-bubble.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.cmb-face {
  flex: none; width: 128px; height: 150px; object-fit: cover; object-position: top;
  margin-right: -14px; position: relative; z-index: 1;
  border: 2px solid var(--brass); border-radius: 4px 4px 0 4px;
  background: #2a2818;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .7);
}
.cmb-box {
  position: relative; flex: 1; min-width: 0;
  padding: 12px 40px 12px 30px;
  background: linear-gradient(180deg, var(--bone-lit), var(--bone));
  color: var(--ink);
  border: 1px solid var(--edge-dark); border-left: 4px solid var(--gold);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .65), 0 0 0 1px rgba(233, 199, 101, .45);
}
#cmd-bubble.urgent .cmb-box { border-left-color: var(--red); }
#cmd-bubble.urgent .cmb-face { border-color: var(--red); }
.cmb-who { display: flex; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.cmb-who b { font-family: var(--f-head); font-size: 17px; letter-spacing: .04em; color: #2a2412; }
.cmb-who i {
  font-style: normal; font-family: var(--f-ui); font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: #7a5a10;
}
.cmb-text { margin: 0; font-family: var(--f-serif); font-size: 17px; line-height: 1.45; color: #1d1a0e; }
.cmb-foot { display: flex; align-items: center; gap: 14px; margin-top: 8px; font-family: var(--f-ui); font-size: 12px; }
.cmb-go {
  display: none; align-items: center; gap: 5px; padding: 3px 9px;
  font-weight: 700; color: #f3e7bf; background: #4a4630; border-radius: 3px;
}
#cmd-bubble.has-focus .cmb-go { display: inline-flex; }
.cmb-go:hover { background: #5e5a3c; color: var(--gold); }
.cmb-more { color: #6f6340; }
.cmb-x {
  position: absolute; top: 6px; right: 8px; width: 26px; height: 26px;
  border: 0; background: none; color: #6f6340; font-size: 16px; cursor: pointer;
}
.cmb-x:hover { color: #241d0c; }
@media (max-width: 640px) {
  .cmb-face { width: 64px; height: 78px; margin-right: -10px; }
  .cmb-text { font-size: 15px; line-height: 1.4; }
  .cmb-box { padding: 8px 32px 9px 18px; }
  /* The name on one line; his rank is in the portrait. "Click to talk" is a mouse hint. */
  .cmb-who { margin-bottom: 3px; }
  .cmb-who b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .cmb-who i, .cmb-more { display: none; }
  .cmb-foot { margin-top: 6px; }
  .cmb-go { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 6px 10px; }
}


/* --------------------------------------------------- construct & recruit

   The two things you do to a province you own. They are the largest controls
   on the bar because they are the ones the whole screen exists to reach. */

.pb-main {
  display: flex; align-items: center; justify-content: flex-start; gap: var(--s2);
  width: 100%; padding: 9px var(--s3);
  font-family: var(--f-head); font-size: 15px; letter-spacing: .1em;
  text-transform: uppercase;
  transition: transform .1s ease, filter .12s ease, box-shadow .12s ease;
}
.pb-main .ic { font-size: 18px; }
.pb-main:hover { transform: translateY(-1px); filter: brightness(1.1); }
.pb-main:active { transform: translateY(1px) scale(.985); filter: brightness(.95); }

/* ------------------------------------------------- the construction screen

   One card per building. Everything the decision needs is on the card: the
   picture, what the next level is worth, what it costs, how long it takes
   and what it does to morale — so nothing lives only in a tooltip. */

.build-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: var(--s3); margin-bottom: var(--s4);
}
.bcard {
  display: flex; gap: var(--s3); padding: var(--s3);
  background: var(--bone); color: var(--ink);
  border: 1px solid var(--edge-dark); border-left: 3px solid var(--bone-deep);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  transition: transform .14s cubic-bezier(.2, .9, .3, 1), box-shadow .14s ease,
              border-left-color .14s ease;
}
.bcard:hover { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(0, 0, 0, .55); }
.bcard.built { border-left-color: var(--green-solid); }
.bcard.off { filter: saturate(.55) brightness(.92); }

.bcard .pic {
  position: relative; width: 84px; height: 84px; flex: none;
  background: #241f16; border: 1px solid var(--edge-dark); overflow: hidden;
}
.bcard .pic img { width: 100%; height: 100%; object-fit: cover; }
.bcard .pic .lvl {
  position: absolute; right: 0; bottom: 0; min-width: 20px; padding: 0 4px;
  font-family: var(--f-head); font-size: 13px; line-height: 19px; text-align: center;
  background: var(--green-solid); color: #fff; border-top-left-radius: 3px;
}

.bcard .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.bcard .nm {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  font-family: var(--f-head); font-size: 15px; letter-spacing: .04em; color: var(--ink);
}
.bcard .pips { display: flex; gap: 2px; flex: none; }
.bcard .pips i {
  width: 7px; height: 7px; background: rgba(29, 27, 18, .22);
  border: 1px solid rgba(29, 27, 18, .35);
}
.bcard .pips i.on { background: var(--green-solid); border-color: var(--green-2); }
.bcard .pips i.queued { background: var(--amber); border-color: #8a6a1e; }

.bcard .blurb {
  font-family: var(--f-serif); font-size: var(--fs-small); line-height: 1.4;
  color: var(--ink-soft);
}
.bcard .fx { display: flex; flex-wrap: wrap; gap: 3px var(--s2); margin-top: 1px; }
.bcard .fx i {
  font-style: normal; font-family: var(--f-ui); font-size: 10.5px;
  color: #2f5a2a; white-space: nowrap;
}
.bcard .fx i::before { content: '▸ '; opacity: .6; }

.bcard .cost { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); margin-top: 2px; }
.bcard .cost .c {
  display: inline-flex; align-items: center; gap: 2px;
  font-family: var(--f-ui); font-size: 11px; color: var(--ink);
}
.bcard .cost .c .ic { font-size: 13px; opacity: .8; }
.bcard .cost .c.no { color: var(--red); font-weight: 600; }
.bcard .cost .c.time { color: var(--ink-soft); }
.bcard .cost .c.mor { color: #8a4030; }

.bcard-foot { display: flex; align-items: center; gap: var(--s2); margin-top: auto; padding-top: var(--s1); }
.bcard-foot .btn { transition: transform .1s ease, filter .12s ease; }
.bcard-foot .btn:active { transform: scale(.94); }

/* The press that started a building: a short shove, so the click is answered
   before the panel has finished re-rendering. */
.btn.thunk { animation: thunk .16s ease; }
@keyframes thunk {
  0% { transform: scale(1); }
  45% { transform: scale(.9); filter: brightness(1.3); }
  100% { transform: scale(1); }
}

.bq-row .lvtag {
  font-family: var(--f-ui); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-dim); font-weight: 400;
}
.qrow { animation: qrow-in .22s ease both; }
@keyframes qrow-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------- dialog transitions

   Dialogs grow very slightly into place rather than appearing, which makes
   opening one feel like an action rather than a page load. */

#modal-layer.open .dialog.entering { animation: dialog-in .2s cubic-bezier(.2, .9, .3, 1) both; }
/* A refresh redraws the dialog with new numbers; nothing in it should
   play its entrance again. */
.dialog.settled .qrow, .cmd-line.seen { animation: none; }
@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.965); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
#modal-layer.open #modal-scrim { animation: scrim-in .18s ease both; }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }

/* A formation cut past its breaking point. The white flag on the map counter
   says the same thing; this says what it means and what you may now do. */
.army-broken {
  display: flex; align-items: center; gap: var(--s1);
  margin-top: var(--s2); padding: 3px var(--s2);
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .04em;
  color: #f0d8c8; background: rgba(196, 50, 34, .22);
  border-left: 2px solid var(--red);
}
.army-broken .ic { font-size: 12px; color: #f4f1e4; }

/* ------------------------------------------------------------ war chest

   The shop: resource cells in the top bar and the gold counter open it. */
#resource-bar .res { cursor: pointer; position: relative; transition: background .12s, box-shadow .12s; }
#resource-bar .res:hover {
  background: rgba(255, 249, 191, .1);
  box-shadow: inset 0 0 0 1px rgba(201, 169, 73, .45);
}
#resource-bar .res:hover .ic { color: var(--gold); }
#resource-bar .res:active { transform: translateY(1px); }
.gold-chip { cursor: pointer; transition: filter .12s, box-shadow .12s; }
.gold-chip:hover { filter: brightness(1.2); box-shadow: inset 0 0 0 1px rgba(233, 199, 101, .55); }

.dialog.shop { width: min(900px, calc(var(--game-w) - 60px)); }
.shop-top {
  display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3);
  padding: var(--s2) var(--s3); border-radius: 4px;
  background: linear-gradient(180deg, rgba(74, 69, 52, .55), rgba(38, 35, 24, .55));
  border: 1px solid rgba(201, 169, 73, .35);
}
.shop-top .spacer { flex: 1; }
.shop-bal { display: inline-flex; align-items: baseline; gap: var(--s2); }
.shop-bal .ic { font-size: 26px; color: #e9c765; align-self: center;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .7)) drop-shadow(0 0 5px rgba(233, 199, 101, .35)); }
.shop-bal b { font-family: var(--f-head); font-size: 26px; font-weight: 500; color: var(--gold); letter-spacing: .03em; }
.shop-bal small { font-size: var(--fs-small); color: var(--text-dim); text-transform: uppercase; letter-spacing: .1em; }

.shop-picker { display: flex; gap: var(--s1); flex-wrap: wrap; margin-bottom: var(--s3); }
.shop-res {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border-radius: 3px; border: 1px solid var(--edge-dark);
  background: linear-gradient(180deg, #34363c, #26282d); color: #a49d84;
  font-size: var(--fs-small); text-transform: uppercase; letter-spacing: .06em;
}
.shop-res .ic { font-size: 18px; color: var(--brass); }
.shop-res b { font-family: var(--f-head); font-weight: 400; color: var(--text); letter-spacing: .02em; }
.shop-res:hover { color: var(--text); }
.shop-res.on { color: var(--gold); background: linear-gradient(180deg, #4a4534, #322e22); border-color: rgba(201, 169, 73, .55); }

.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-bottom: var(--s3); }
.shop-grid .pan + .pan { margin-top: 0; }
.shop-sum, .shop-ad { display: flex; align-items: center; gap: var(--s3); }
.shop-sum > div, .shop-ad > div { flex: 1; }
.shop-ad { margin-bottom: var(--s3); }
.shop-big { font-size: 44px; color: var(--brass); display: inline-flex;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .7)) drop-shadow(0 0 6px rgba(201, 169, 73, .3)); }
.pos-text { color: var(--green-1); }
.neg-text { color: #e0705a; }
.shop-trade { display: flex; flex-direction: column; gap: var(--s2); }
.shop-trade-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.shop-trade-row .btn .ic { font-size: 14px; }

.shop-packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.shop-packs.four { grid-template-columns: repeat(4, 1fr); }
.shop-pack, .shop-gpack {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--s3); border-radius: 4px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, rgba(201, 169, 73, .16), rgba(19, 19, 27, .45) 70%);
  border: 1px solid rgba(130, 124, 103, .45);
  transition: transform .12s, border-color .12s;
}
.shop-pack:hover, .shop-gpack:hover { transform: translateY(-1px); border-color: rgba(201, 169, 73, .7); }
.shop-gpack.best { border-color: rgba(233, 199, 101, .75); box-shadow: 0 0 12px rgba(233, 199, 101, .18); }
.shop-pack-ic { font-size: 38px; color: #e9c765; display: inline-flex; margin: 4px 0 2px;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .7)) drop-shadow(0 0 5px rgba(233, 199, 101, .3)); }
.shop-pack .shop-pack-ic { color: var(--brass); }
.shop-pack-amt { font-family: var(--f-head); font-weight: 500; font-size: 20px; color: var(--gold); letter-spacing: .03em; }
.shop-pack .btn, .shop-gpack .btn { margin-top: var(--s2); }
.shop-pack .btn .ic, .shop-gpack .btn .ic { font-size: 15px; }
.shop-ribbon {
  position: absolute; top: 6px; right: -1px; padding: 1px 7px; font-style: normal;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; color: #241d0c;
  background: linear-gradient(180deg, #ecd47f, #c9a949); border-radius: 2px 0 0 2px;
}
.test-banner {
  display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3);
  padding: 6px 10px; border-radius: 3px; font-size: var(--fs-small);
  color: #f3e6b0; background: rgba(216, 166, 60, .14); border: 1px dashed rgba(216, 166, 60, .6);
}
.test-banner .ic { color: var(--amber); font-size: 16px; }
.test-note { color: var(--amber); margin-top: 3px; }
.shop-limit { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.shop-limit select { padding: 4px 6px; font-family: inherit; }

/* The limited-time offer: a card, a badge by the gold, a one-time popup. */
.offer-card {
  display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3);
  border-radius: 5px; border: 1px solid rgba(233, 199, 101, .7);
  background: linear-gradient(160deg, rgba(90, 76, 36, .95), rgba(35, 37, 43, .97) 65%);
  box-shadow: 0 0 18px rgba(233, 199, 101, .18), inset 0 1px 0 rgba(255, 249, 191, .18);
}
.offer-card.inline { margin-bottom: var(--s3); }
.offer-head { display: flex; align-items: center; gap: var(--s2); }
.offer-head .ic { font-size: 22px; color: #e9c765; }
.offer-head b { font-family: var(--f-head); font-weight: 600; font-size: var(--fs-head); letter-spacing: .12em;
  text-transform: uppercase; color: var(--gold); }
.offer-head .spacer { flex: 1; }
.offer-left { font-family: var(--f-head); font-variant-numeric: tabular-nums; color: var(--text);
  padding: 1px 8px; border-radius: 2px; background: rgba(0, 0, 0, .35); }
.offer-items .c { font-family: var(--f-head); font-size: 16px; }
.offer-items .c .ic { font-size: 18px; color: #e9c765; }
.offer-actions { display: flex; gap: var(--s2); }
.offer-price { display: flex; align-items: baseline; gap: var(--s2); }
.offer-price s { color: var(--muted, #9a9a9a); font-size: 14px; }
.offer-price b { font-family: var(--f-head); font-size: 24px; color: var(--gold); letter-spacing: .02em; }
.offer-price i { font-style: normal; font-weight: 700; font-size: 12px; padding: 1px 6px; border-radius: 2px;
  color: #fff; background: #a33a2c; }
.shop-ribbon.first { background: linear-gradient(180deg, #8fd07f, #4f9a42); color: #10240c; }
.shop-gpack s { display: block; line-height: 1; }
.first-note { margin-bottom: var(--s3); padding: 6px 10px; border-radius: 3px; font-size: var(--fs-small);
  color: #dff3d4; background: rgba(95, 154, 82, .16); border: 1px solid rgba(95, 154, 82, .55); }
.first-note .ic { color: #8fd07f; }
/* The one-time popup: a tall card, 700 × 900 at most, over the dimmed war.
   An olive band (cyan in 2030) with the offer's name in two serif lines,
   what it is worth, a picture with a round badge for the extra value, the
   countdown in a pill, one big gold button and a quiet way out. */
#offer-pop {
  /* Over the game area only: the advert column stays uncovered. */
  position: fixed; inset: 0; right: var(--ad-w, 0px); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(6, 7, 9, .72); outline: none; animation: offer-fade .25s ease both;
}
@keyframes offer-fade { from { opacity: 0; } }
@keyframes offer-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.offer-card.big {
  position: relative; width: min(700px, 100%); height: min(900px, 100%); padding: 0; gap: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  border: 2px solid #e9c765; border-radius: 6px; background: linear-gradient(180deg, #2a2c31, #16171b);
  box-shadow: 0 0 0 1px #000, 0 24px 80px rgba(0, 0, 0, .8), 0 0 40px rgba(233, 199, 101, .2);
  animation: offer-in .35s cubic-bezier(.2, .9, .3, 1) both;
}
.offer-card.big.modern { border-color: #9fe3f5; box-shadow: 0 0 0 1px #000, 0 24px 80px rgba(0, 0, 0, .8), 0 0 40px rgba(79, 180, 212, .22); }
.offer-x {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; font-size: 18px; color: #fff9bf; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 249, 191, .35);
}
.offer-x:hover { background: rgba(0, 0, 0, .6); }
.offer-band { flex: none; width: 100%; padding: 20px 60px 18px; background: linear-gradient(180deg, #7a8f3a, #44561f); border-bottom: 3px solid #e9c765; }
.modern .offer-band { background: linear-gradient(180deg, #2384a5, #0f3a4c); border-color: #9fe3f5; }
.offer-kicker { display: block; font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: #fff9bf; opacity: .85; }
.offer-band h2 {
  margin: 6px 0 0; font-family: var(--f-serif); font-weight: 700; font-size: 50px; line-height: 1.02; letter-spacing: .01em;
  color: #fff9bf; text-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.offer-band h2 span { display: block; }
.offer-sub { flex: none; margin: 14px 16px 12px; font-family: var(--f-ui); font-weight: 700; font-size: 20px; letter-spacing: .03em; text-transform: uppercase; color: #e5e2d5; }
.offer-art {
  position: relative; flex: 1 1 auto; min-height: 140px; width: calc(100% - 40px); background: center/cover no-repeat;
  border: 1px solid rgba(233, 199, 101, .5); box-shadow: inset 0 -90px 70px -30px rgba(0, 0, 0, .85);
}
.offer-badge-round {
  position: absolute; top: -16px; right: -12px; width: 112px; height: 112px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: #241d0c;
  background: radial-gradient(circle at 35% 30%, #f6e39a, #c9a949 60%, #8d7631); border: 3px solid #fff9bf;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .6); transform: rotate(-8deg);
}
.offer-badge-round b { font-family: var(--f-head); font-weight: 700; font-size: 30px; line-height: 1; }
.offer-badge-round small { font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.offer-card.big .offer-items { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 0 12px; cursor: help; }
.offer-card.big .offer-items .c {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 3px;
  background: rgba(14, 16, 19, .84); border: 1px solid rgba(233, 199, 101, .55);
}
.offer-card.big .offer-items .c .ic { font-size: 22px; color: #e9c765; }
.offer-card.big .offer-items .c b { font-family: var(--f-head); font-weight: 600; font-size: 20px; color: #fff9bf; }
.offer-card.big .offer-items .c small { font-family: var(--f-ui); font-weight: 600; font-size: 11px; text-transform: uppercase; color: #bdb8a6; }
.offer-timer {
  flex: none; display: inline-flex; align-items: center; gap: 8px; margin: 16px 0 4px; padding: 5px 18px; border-radius: 999px;
  font-family: var(--f-head); font-weight: 600; font-size: 22px; font-variant-numeric: tabular-nums; color: #f1ecd8;
  background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .14);
}
.offer-timer .ic { font-size: 22px; color: #e9c765; }
.offer-card.big .offer-price { flex: none; margin: 4px 0 6px; }
.offer-card.big .offer-price s { font-size: 16px; color: #9b9682; }
.offer-cta {
  flex: none; width: min(360px, calc(100% - 40px)); height: 65px; border-radius: 4px; cursor: pointer;
  font-family: var(--f-ui); font-weight: 700; font-size: 30px; letter-spacing: .02em; color: #241d0c; text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
  background: linear-gradient(180deg, #f3dc8a, #c9a949 55%, #8d7631); border: 1px solid #5b4a17;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 20px rgba(0, 0, 0, .5); transition: filter .15s, transform .12s;
}
.offer-cta:hover:not(:disabled) { filter: brightness(1.08); }
.offer-cta:active:not(:disabled) { transform: scale(.97); }
.offer-cta:disabled { filter: grayscale(.6) brightness(.8); cursor: default; }
.offer-later { flex: none; margin: 12px 0 18px; font-family: var(--f-ui); font-weight: 500; font-size: 15px; color: #bdb8a6; text-decoration: underline; background: none; border: 0; cursor: pointer; }
.offer-later:hover { color: #f1ecd8; }
@media (max-width: 640px), (max-height: 760px) {
  .offer-band { padding: 16px 48px 14px; }
  .offer-band h2 { font-size: 38px; }
  .offer-sub { font-size: 16px; margin: 10px 12px 8px; }
  .offer-art { width: calc(100% - 24px); }
  .offer-badge-round { width: 88px; height: 88px; top: -12px; right: -8px; }
  .offer-badge-round b { font-size: 24px; }
  .offer-badge-round small { font-size: 10px; }
  .offer-timer { margin-top: 12px; font-size: 19px; }
  .offer-cta { height: 58px; font-size: 26px; }
  .offer-later { margin: 8px 0 12px; }
}
.offer-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px;
  border-radius: 3px; color: #241d0c; font-family: var(--f-head); font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ecd47f 0%, #c9a949 52%, #8d7631 100%);
  border: 1px solid #5b4a17; box-shadow: 0 0 10px rgba(233, 199, 101, .35);
  animation: offer-glow 2.4s ease-in-out infinite;
}
.offer-badge .ic { font-size: 16px; }
.offer-badge:hover { filter: brightness(1.12); }
@keyframes offer-glow { 50% { box-shadow: 0 0 16px rgba(233, 199, 101, .6); } }

/* The development stand-in for a rewarded advert. */
#ad-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 5, 7, .82);
}
#ad-overlay .ad-box {
  width: min(560px, calc(100vw - 32px)); padding: var(--s4); border-radius: 5px;
  background: var(--panel-solid); border: 3px solid var(--bone); box-shadow: var(--shadow-dialog);
}
#ad-overlay .ad-tag { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); margin-bottom: var(--s2); }
#ad-overlay .ad-screen {
  aspect-ratio: 16 / 9; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s2); border-radius: 3px; text-align: center; padding: var(--s4);
  background: repeating-linear-gradient(45deg, #1b1c21 0 14px, #212228 14px 28px);
  border: 1px dashed rgba(216, 166, 60, .5);
}
#ad-overlay .ad-count { font-family: var(--f-head); font-size: 64px; line-height: 1; color: var(--gold); }
#ad-overlay .ad-note { font-size: var(--fs-small); color: var(--text-dim); max-width: 340px; }
#ad-overlay .ad-bar { height: 4px; margin: var(--s3) 0; background: rgba(255, 255, 255, .08); border-radius: 2px; overflow: hidden; }
#ad-overlay .ad-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brass-dim), var(--gold)); transition: width 1s linear; }
#ad-overlay .ad-foot { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-small); color: var(--text-dim); }

@media (max-width: 720px) {
  .shop-grid { grid-template-columns: 1fr; }
  .shop-packs, .shop-packs.four { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------- construction and recruitment */
/* Both screens: every province down the left, the chosen one on the right.
   Each column scrolls on its own, so the list never drags the cards away. */
.bu-dialog .dialog-body { padding: 0; overflow: hidden; display: flex; }
.bu-wrap {
  display: grid; grid-template-columns: 250px 1fr; width: 100%;
  height: min(680px, calc(100vh - 190px));
}
.bu-side {
  display: flex; flex-direction: column; min-height: 0;
  background: rgba(13, 13, 18, .55); border-right: 1px solid rgba(0, 0, 0, .6);
}
.bu-search {
  display: flex; align-items: center; gap: var(--s2); margin: var(--s3) var(--s3) var(--s2);
  padding: 0 var(--s2); height: 32px; border-radius: 3px;
  background: rgba(0, 0, 0, .35); border: 1px solid rgba(130, 124, 103, .35); color: var(--text-dim);
}
.bu-search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--text); font: inherit; font-size: 13px;
}
.bu-filters { display: flex; gap: var(--s1); padding: 0 var(--s3) var(--s2); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: 13px; cursor: pointer; font-size: 12px; color: var(--text-dim);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(130, 124, 103, .35);
}
.chip:hover { color: var(--text); background: rgba(201, 169, 73, .12); }
.chip.on { color: #241d0c; background: linear-gradient(#e9cf7a, var(--brass)); border-color: var(--brass-dim); font-weight: 600; }
.chip b { font-size: 11px; padding: 0 5px; border-radius: 8px; background: rgba(0, 0, 0, .25); }
.chip .ic { font-size: 14px; }
.bu-plist { flex: 1; overflow: auto; padding: 0 var(--s2) var(--s3); }
.bu-prow {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name q" "sub q";
  gap: 1px var(--s2); width: 100%; padding: 7px 9px; margin-bottom: 3px; text-align: left;
  border-radius: 3px; border: 1px solid transparent; border-left: 3px solid transparent;
  background: rgba(255, 255, 255, .03); color: var(--text); cursor: pointer;
}
.bu-prow:hover { background: rgba(201, 169, 73, .1); }
.bu-prow.on { background: rgba(201, 169, 73, .2); border-color: rgba(201, 169, 73, .55); border-left-color: var(--brass); }
.bu-prow.idle { border-left-color: var(--amber); }
.bu-pname { grid-area: name; font-family: var(--f-head); font-size: 14px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bu-pname .cap { color: var(--brass); font-weight: 400; }
.bu-psub { grid-area: sub; font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bu-psub .ic { font-size: 13px; margin-right: 3px; color: var(--brass); }
.bu-pq { grid-area: q; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; }
.bu-pq .qbar { width: 54px; height: 6px; }
.bu-idle {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 2px; color: #2b1f05; background: var(--amber);
}

.bu-main { overflow: auto; padding: var(--s4) var(--s5) var(--s5); min-width: 0; }
.bu-head {
  margin-bottom: var(--s3); padding: var(--s3); border-radius: 4px;
  background: rgba(0, 0, 0, .28); border: 1px solid rgba(130, 124, 103, .3);
}
.bu-title { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.bu-title .nm { font-family: var(--f-head); font-size: 20px; letter-spacing: .06em; color: var(--gold); }
.bu-morale { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-dim); }
.bu-morale .bar { width: 70px; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .5); overflow: hidden; }
.bu-morale .bar i { display: block; height: 100%; background: var(--green-1); }
.bu-morale.low .bar i { background: var(--amber); }
.bu-morale.bad .bar i { background: var(--red); }
.bu-queue { margin-top: var(--s2); display: grid; gap: 4px; }
.bu-queue.empty { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); font-style: italic; }
.bu-queue .qrow { display: flex; align-items: center; gap: var(--s2); padding: 4px 6px; border-radius: 3px; background: rgba(255, 255, 255, .04); }
.bu-queue .qbar { width: 160px; }
.bu-queue .t { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-dim); min-width: 52px; text-align: right; }

.bu-flash {
  display: flex; align-items: center; gap: 6px; margin-bottom: var(--s3); padding: 7px 10px;
  border-radius: 3px; font-size: 13px; color: #e8f0d0;
  background: rgba(89, 108, 43, .35); border: 1px solid rgba(121, 143, 67, .6);
  animation: bu-flash 2.6s ease forwards;
}
.bu-flash.bad { color: #ffd9cf; background: rgba(196, 50, 34, .25); border-color: rgba(196, 50, 34, .55); }
@keyframes bu-flash { 0%, 75% { opacity: 1; } 100% { opacity: .55; } }

.bu-suggest { display: flex; align-items: stretch; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s2); }
.bu-suggest .lbl {
  display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--brass);
}
.bu-sug {
  display: flex; align-items: center; gap: var(--s2); padding: 5px 10px 5px 5px; border-radius: 4px;
  text-align: left; cursor: pointer; color: var(--text);
  background: linear-gradient(rgba(201, 169, 73, .22), rgba(201, 169, 73, .1));
  border: 1px solid rgba(201, 169, 73, .6);
}
.bu-sug:hover:not(:disabled) { filter: brightness(1.15); }
.bu-sug:disabled { opacity: .5; cursor: default; }
.bu-sug img { width: 36px; height: 36px; object-fit: cover; border-radius: 2px; }
.bu-sug span { display: flex; flex-direction: column; line-height: 1.25; }
.bu-sug .tiny { color: var(--text-dim); }

.bu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s2); }
.bu-card {
  display: flex; gap: var(--s3); padding: 10px; border-radius: 3px;
  background: var(--bone); color: var(--ink);
  border: 1px solid var(--edge-dark); border-left: 3px solid var(--bone-deep);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  transition: transform .12s ease, box-shadow .12s ease;
}
.bu-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, .5); }
.bu-card.built { border-left-color: var(--green-solid); }
.bu-card.off { background: var(--bone-dim); }
.bu-card.locked { opacity: .82; }
.bu-card.locked .pic img { filter: grayscale(1) brightness(.75); }
.bu-card .pic { position: relative; width: 64px; height: 64px; flex: none; border: 1px solid var(--edge-dark); overflow: hidden; background: #241f16; }
.bu-card .pic img { width: 100%; height: 100%; object-fit: cover; }
.bu-card .pic .lvl {
  position: absolute; right: 0; bottom: 0; min-width: 18px; padding: 0 4px; text-align: center;
  font-family: var(--f-head); font-size: 12px; line-height: 17px; background: var(--green-solid); color: #fff;
}
.bu-card .meta { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.bu-card .nm {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  font-family: var(--f-head); font-size: 15px; letter-spacing: .03em; color: var(--ink);
}
.bu-card .nm .natl { color: #7a5a10; }
.bu-card .pips { display: flex; gap: 2px; flex: none; }
.bu-card .pips i { width: 7px; height: 7px; background: rgba(29, 27, 18, .2); border: 1px solid rgba(29, 27, 18, .35); }
.bu-card .pips i.on { background: var(--green-solid); border-color: var(--green-2); }
.bu-card .pips i.queued { background: var(--amber); border-color: #8a6a1e; }
.bu-card .fx { font-size: 11px; color: #2f5a2a; line-height: 1.35; }
.bu-card .usub { font-size: 11.5px; color: var(--ink-soft); }
.bu-card .tag { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; padding: 0 4px; border-radius: 2px; color: #fff; }
.bu-card .tag.robot { background: #3d6e8a; }
.bu-card .tag.drone { background: #7a4c8a; }
.bu-card .ustats { margin: 2px 0; color: var(--ink-soft); gap: var(--s3); }
.bu-card .ustats b { color: var(--ink); }
.bu-card .ustats .ic { color: #8a6a1e; }
.bu-card .cost { display: flex; flex-wrap: wrap; gap: 2px var(--s2); font-size: 12px; color: var(--ink); }
.bu-card .cost .c { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.bu-card .cost .c.no { color: var(--red-dark); font-weight: 700; }
.bu-card .cost .c.time, .bu-card .cost .c.mor { color: var(--ink-soft); }
.bu-card .cost .ic { font-size: 15px; }
.bu-card .icon-btn.sm { width: 22px; height: 22px; font-size: 13px; }
.bu-act { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.bu-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-soft); }
.bu-state.done { color: var(--green-solid); }
.bu-missing { display: inline-flex; align-items: center; gap: var(--s2); font-size: 12px; font-weight: 600; color: var(--red-dark); }
.bu-need { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.bu-cats { display: flex; flex-wrap: wrap; gap: var(--s1); margin: var(--s2) 0 var(--s3); }
.bu-none { margin: var(--s3) 0; }

@media (max-width: 900px) {
  .bu-wrap { grid-template-columns: 1fr; grid-template-rows: 200px 1fr; }
  .bu-side { border-right: 0; border-bottom: 1px solid rgba(0, 0, 0, .6); }
}

/* The offer card never sits on top of an open dialog. */
body:has(#modal-layer.open) #offer-pop { display: none; }

/* ------------------------------------------------------------ nations book */
#map-tools .nations-btn { margin-top: 10px; color: #8fd0e8; }
.nat-row {
  display: flex; align-items: center; gap: var(--s2); width: 100%; padding: 6px 8px; margin-bottom: 2px;
  border-radius: 3px; border: 1px solid transparent; border-left: 3px solid transparent;
  background: rgba(255, 255, 255, .03); color: var(--text); text-align: left; cursor: pointer;
}
.nat-row:hover { background: rgba(201, 169, 73, .1); }
.nat-row.on { background: rgba(201, 169, 73, .2); border-color: rgba(201, 169, 73, .55); border-left-color: var(--brass); }
.nat-row .flag { width: 22px; height: 15px; flex: none; background-size: cover !important; box-shadow: 0 0 0 1px #000; }
.nat-row .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.nat-row .rel { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.nat-row.rel-war .rel { color: #ff8a73; }
.nat-row.rel-ally .rel { color: #a6d37a; }
.nat-row.rel-you .rel { color: var(--brass); }
.nat-detail { max-width: 860px; }
.nat-top { display: flex; gap: var(--s4); align-items: center; margin-bottom: var(--s3); }
.nat-face { position: relative; width: 92px; height: 92px; flex: none; border: 2px solid var(--brass); border-radius: 4px; overflow: hidden; background: var(--panel-deep); }
.nat-face img { width: 100%; height: 100%; object-fit: cover; }
.nat-face i { position: absolute; right: 0; bottom: 0; width: 34px; height: 23px; background-size: cover !important; box-shadow: 0 0 0 1px #000; }
.nat-id h3 { margin: 0 0 2px; font-family: var(--f-head); font-size: 22px; letter-spacing: .05em; color: var(--gold); display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.nat-id .tiny { color: var(--text-dim); }
.rel-chip { font-family: var(--f-ui); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--text-dim); }
.rel-chip.rel-war { background: rgba(196, 50, 34, .3); color: #ffb3a3; }
.rel-chip.rel-ally { background: rgba(121, 143, 67, .35); color: #d2e8a8; }
.rel-chip.rel-you { background: rgba(201, 169, 73, .3); color: var(--gold); }
.nat-facts { display: flex; gap: var(--s4); margin-top: var(--s2); font-family: var(--f-head); font-size: 16px; color: var(--text); }
.nat-facts span { display: inline-flex; align-items: center; gap: 5px; }
.nat-facts .ic { color: var(--brass); }
.nat-h { margin: var(--s3) 0 var(--s2); display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.nat-trait {
  display: grid; gap: 2px; padding: 8px 10px; margin-bottom: 6px; border-radius: 3px;
  background: rgba(121, 143, 67, .14); border-left: 3px solid var(--green-1);
}
.nat-trait.bad { background: rgba(196, 50, 34, .13); border-left-color: var(--red); }
.nat-trait.doc { background: rgba(201, 169, 73, .12); border-left-color: var(--brass); }
.nat-trait .nm { font-family: var(--f-head); font-size: 15px; letter-spacing: .03em; color: var(--text); display: flex; align-items: center; gap: 5px; }
.nat-trait .fx { font-size: 12.5px; font-weight: 600; color: #b9d98a; }
.nat-trait.bad .fx { color: #ff9f8c; }
.nat-trait.doc .fx { color: #ead48a; }
.nat-trait .tiny { color: var(--text-dim); }
.nat-units { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s2); }
.nat-unit { display: flex; gap: var(--s2); padding: 6px; border-radius: 3px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(130, 124, 103, .25); }
.nat-unit img { width: 56px; height: 56px; object-fit: cover; flex: none; border-radius: 2px; }
.nat-unit span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.nat-unit .tiny { color: var(--text-dim); line-height: 1.35; }
.nat-rel { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.nat-mini { width: 28px; height: 19px; padding: 0; margin: 0 4px 4px 0; border: 0; cursor: pointer; background: none; }
.nat-mini i { display: block; width: 100%; height: 100%; background-size: cover !important; box-shadow: 0 0 0 1px #000; }
.nat-mini:hover i { box-shadow: 0 0 0 2px var(--brass); }
.nat-actions { display: flex; gap: var(--s2); margin-top: var(--s4); }

/* ------------------------------------------------------- resource tiles

   Every resource has a signature colour, a coloured picture (icons.js
   RES_ICONS) and a painted backdrop (assets/img-e0af07af/res_<id>.webp, made by
   tools/gen-res-art.mjs). The top bar cells and the province bar's daily
   production rows are small tiles: the backdrop faded behind a dark gradient,
   a coloured edge, the picture and the number. Cost chips anywhere in the
   game take a light wash of the same colour. The selectors key off the icon's
   ic-<id> class, so any .prod-rows / .cost markup gets this without changes. */
:root {
  --res-money: #7cbf5e;
  --res-manpower: #9aab55;
  --res-food: #e8b840;
  --res-goods: #c98c4e;
  --res-oil: #8a95ad;
  --res-metal: #b4c2cf;
  --res-rare: #b07cf5;
}
#resource-bar .res[data-res="money"], .prod-rows .r:has(> .ic-money), .cost .c:has(> .ic-money) { --rc: var(--res-money); }
#resource-bar .res[data-res="manpower"], .prod-rows .r:has(> .ic-manpower), .cost .c:has(> .ic-manpower) { --rc: var(--res-manpower); }
#resource-bar .res[data-res="food"], .prod-rows .r:has(> .ic-food), .cost .c:has(> .ic-food) { --rc: var(--res-food); }
#resource-bar .res[data-res="goods"], .prod-rows .r:has(> .ic-goods), .cost .c:has(> .ic-goods) { --rc: var(--res-goods); }
#resource-bar .res[data-res="oil"], .prod-rows .r:has(> .ic-oil), .cost .c:has(> .ic-oil) { --rc: var(--res-oil); }
#resource-bar .res[data-res="metal"], .prod-rows .r:has(> .ic-metal), .cost .c:has(> .ic-metal) { --rc: var(--res-metal); }
#resource-bar .res[data-res="rare"], .prod-rows .r:has(> .ic-rare), .cost .c:has(> .ic-rare) { --rc: var(--res-rare); }

/* The coloured pictures carry their own ink outline: they want a plain drop
   shadow, not the brass glow the line icons get. */
:is(.res, .cost, .pcell, .ustat .lbl, .prod-rows .r, .pan-head, .lsort, .ustats, .shop-pack-ic, .shop-big, .adv-reward, .tab, .btn)
  .ic:is(.ic-money, .ic-manpower, .ic-food, .ic-goods, .ic-oil, .ic-metal, .ic-rare) {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .55));
}

/* The tile: art on ::before, the darkening wash on ::after, content above. */
#resource-bar { gap: 3px; }
#resource-bar .res[data-res],
.prod-rows .r:has(> .ic) {
  position: relative; isolation: isolate; overflow: hidden;
  border-left: 3px solid var(--rc, var(--brass));
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .05);
}
#resource-bar .res[data-res]::before,
.prod-rows .r:has(> .ic)::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background: center / cover no-repeat; opacity: .85;
}
#resource-bar .res[data-res]::after,
.prod-rows .r:has(> .ic)::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--rc) 30%, rgba(16, 14, 9, .42)) 0%, rgba(16, 14, 9, .58) 40%, rgba(16, 14, 9, .74) 100%);
}
#resource-bar .res[data-res="money"]::before, .prod-rows .r:has(> .ic-money)::before { background-image: url("../assets/img-e0af07af/res_money.webp"); }
#resource-bar .res[data-res="manpower"]::before, .prod-rows .r:has(> .ic-manpower)::before { background-image: url("../assets/img-e0af07af/res_manpower.webp"); }
#resource-bar .res[data-res="food"]::before, .prod-rows .r:has(> .ic-food)::before { background-image: url("../assets/img-e0af07af/res_food.webp"); }
#resource-bar .res[data-res="goods"]::before, .prod-rows .r:has(> .ic-goods)::before { background-image: url("../assets/img-e0af07af/res_goods.webp"); }
#resource-bar .res[data-res="oil"]::before, .prod-rows .r:has(> .ic-oil)::before { background-image: url("../assets/img-e0af07af/res_oil.webp"); }
#resource-bar .res[data-res="metal"]::before, .prod-rows .r:has(> .ic-metal)::before { background-image: url("../assets/img-e0af07af/res_metal.webp"); }
#resource-bar .res[data-res="rare"]::before, .prod-rows .r:has(> .ic-rare)::before { background-image: url("../assets/img-e0af07af/res_rare.webp"); }

#resource-bar .res[data-res] { width: 98px; padding: 0 6px 0 4px; gap: 6px; }
#resource-bar .res[data-res] .ic { font-size: 24px; }
#resource-bar .res[data-res] .amt { color: #f3ecd6; text-shadow: 0 1px 2px rgba(0, 0, 0, .9); }
#resource-bar .res[data-res] .rate { color: #b5dc86; text-shadow: 0 1px 2px rgba(0, 0, 0, .95); }
#resource-bar .res[data-res] .rate.neg { color: #ff9a80; }
#resource-bar .res[data-res]:hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 70%, transparent), 0 0 6px color-mix(in srgb, var(--rc) 40%, transparent);
}
#resource-bar .res[data-res]:hover::after { opacity: .82; }
#resource-bar .res.low[data-res] { border-left-color: #e0705a; }

/* Daily production: two tiles across the left-hand block. */
.prod-rows .r:has(> .ic) {
  height: 28px; padding: 0 4px 0 3px; gap: 4px; line-height: 28px; font-size: 14px;
  color: #f3ecd6; text-shadow: 0 1px 2px rgba(0, 0, 0, .95);
}
.prod-rows .r:has(> .ic) .ic { font-size: 19px; }
.prod-rows .r:has(> .ic) b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Cost chips: the coloured picture plus a faint wash and underline in the
   resource's colour, readable on both the dark tooltips and the bone panels. */
.cost .c:has(> .ic:is(.ic-money, .ic-manpower, .ic-food, .ic-goods, .ic-oil, .ic-metal, .ic-rare)) {
  padding: 0 5px 0 3px; border-radius: 3px;
  background: color-mix(in srgb, var(--rc) 16%, transparent);
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--rc) 60%, transparent);
}
/* On the bone cards and the bone tooltip the chip's number is ink, not the chrome's light text. */
:is(.bu-card, .bcard, .ucard, #tooltip) .cost .c:not(.no):has(> .ic:is(.ic-money, .ic-manpower, .ic-food, .ic-goods, .ic-oil, .ic-metal, .ic-rare)) { color: var(--ink); }
:is(.bu-card, .bcard, .ucard, #tooltip) .cost .c:has(> .ic:is(.ic-money, .ic-manpower, .ic-food, .ic-goods, .ic-oil, .ic-metal, .ic-rare)) .ic { opacity: 1; }
.cost .c.no:has(> .ic) .ic { filter: grayscale(.6) drop-shadow(0 1px 1px rgba(0, 0, 0, .55)); opacity: .8; }
.cost .c.no:has(> .ic:is(.ic-money, .ic-manpower, .ic-food, .ic-goods, .ic-oil, .ic-metal, .ic-rare)) {
  box-shadow: inset 0 -2px 0 rgba(224, 112, 90, .8);
}

/* The top bar gives up its least needed parts as the game area narrows, so
   the gold and the menu buttons at its right end always stay on screen:
   first the leader's name and the victory share (the flag and the points
   stay), then the autopilot's word, then the portrait, with the resource
   tiles narrowing as it goes. */
.bar-right, .bar-player { flex: none; }
#resource-bar { flex: 0 1 auto; min-width: 0; }
#resource-bar .res[data-res] { flex: 0 1 auto; min-width: 58px; overflow: hidden; }
@container game (max-width: 1640px) {
  /* Both are in Settings as well. */
  .bar-right .chrome-btn[data-act="tutorial"], .bar-right .chrome-btn[data-act="feedback"] { display: none; }
}
/* (Desktop widths only: a phone lays the bar out in rows and has room for these.) */
@container game (min-width: 1041px) and (max-width: 1460px) { #hud-rank .rk-name, #hud-rank .rk-bar { display: none; } }
@container game (min-width: 1041px) and (max-width: 1240px) { #hud-rank, .chrome-btn.free-gold span:not(.ic) { display: none; } }
@container game (max-width: 1460px) {
  #resource-bar .res[data-res] { padding: 0 3px; }
  #resource-bar .res[data-res] .ic { font-size: 19px; }
  #resource-bar .res[data-res] .amt { font-size: 15px; }
  #resource-bar .res[data-res] .rate { font-size: 11px; letter-spacing: -.02em; }
  .chrome-btn.menu-btn { padding: 0 8px; }
  .chrome-btn.menu-btn .mn-lbl { display: none; }
  #resource-bar .res[data-res] { width: 86px; gap: 3px; }
  #resource-bar .res[data-res="manpower"] { width: 96px; flex-shrink: .4; }
  .bar-player .who, .vp-chip .vp-share { display: none; }
  .chrome-btn.autoplay-btn { padding: 0 6px; flex: none; }
  .chrome-btn.autoplay-btn .ap-lbl { display: none; }
}
@container game (max-width: 1280px) {
  #resource-bar .res[data-res] { width: 90px; gap: 4px; }
  #resource-bar .res[data-res] .ic { font-size: 21px; }
}
@container game (max-width: 1240px) {
  .bar-player .avatar { display: none; }
  #resource-bar .res[data-res] .ic { font-size: 16px; }
  #resource-bar .res[data-res] .amt { font-size: 13.5px; }
  #resource-bar .res[data-res] .rate { font-size: 10.5px; }
  #resource-bar .res[data-res] { width: 84px; }
  /* "20k/127k" is the longest figure on the bar and needs the old width. */
  #resource-bar .res[data-res="manpower"] { width: 90px; }
}
@media (max-width: 1040px) {
  .prod-rows { grid-template-columns: repeat(2, 1fr); }
}
@media (max-height: 780px) {
  /* The tiles say what they are by themselves: give the heading's line to
     the tiles on a short bar. */
  .pb-summary > h4 { display: none; }
  .prod-rows { gap: 3px; }
  .prod-rows .r:has(> .ic) { height: 21px; line-height: 21px; font-size: 13px; }
  .prod-rows .r:has(> .ic) .ic { font-size: 16px; }
}

/* --------------------------------------------------- national identity */
.ident { margin: var(--s2) 0 var(--s3); padding: var(--s2) var(--s3); border-radius: 4px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(201, 169, 73, .35); }
.ident-label { font-family: var(--f-head); font-size: 15px; letter-spacing: .06em; color: var(--gold); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ident-axes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px var(--s4); }
.ident-ax { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-size: 12px; color: var(--text-dim); }
.ident-ax .ax-n { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ident-ax .ax-n .ic { font-size: 14px; }
.ident-ax.best .ax-n { color: var(--text); font-weight: 600; }
.ax-bar { display: inline-flex; gap: 2px; }
.ax-bar i { width: 12px; height: 7px; border-radius: 1px; background: rgba(255, 255, 255, .1); }
.ax-bar i.on { background: linear-gradient(#d9c46a, var(--brass)); }
.ident-ax.best .ax-bar i.on { background: linear-gradient(#f2e08a, #d9b34a); box-shadow: 0 0 4px rgba(242, 224, 138, .45); }
.ax-bar i.neg { width: 64px; background: linear-gradient(90deg, rgba(196, 50, 34, .85), rgba(196, 50, 34, .25)); }
.ident-ax.weak .ax-n { color: #ff9f8c; }
.bu-card .icon-btn { color: var(--ink-soft); background: rgba(29, 27, 18, .1); border-color: rgba(29, 27, 18, .3); }
.bu-card .icon-btn:hover { color: var(--ink); background: rgba(29, 27, 18, .2); }

/* Twelve rail entries have to fit a laptop screen. */
@media (max-height: 1000px) {
  #rail { gap: 6px; }
  .rail-btn { width: 52px; height: 52px; font-size: 25px; }
}
@media (max-height: 780px) {
  .rail-btn { width: 44px; height: 44px; font-size: 21px; }
}
/* A 1366x768 laptop leaves about 650px of viewport: 12 x 40 + gaps fits under the top bar. */
@media (max-height: 700px) {
  #rail { top: 104px; gap: 4px; }
  .rail-btn { width: 40px; height: 40px; font-size: 19px; }
}
@media (max-height: 640px) {
  #rail { top: 96px; gap: 3px; }
  .rail-btn { width: 36px; height: 36px; font-size: 17px; }
}


/* Victory points: the share of the world held, against the winning line. */
.vp-chip .vp-share { margin-left: 6px; font-size: 11px; opacity: .75; font-variant-numeric: tabular-nums; }
#tooltip .vp-bar { display: block; height: 5px; margin: 1px 0 5px; border-radius: 2px; background: rgba(0, 0, 0, .15); overflow: hidden; }
#tooltip .vp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6a1e, #c9a949); }

/* ------------------------------------------------------------ autopilot */
#autopilot-banner {
  position: absolute; left: 50%; top: calc(var(--topbar-h) + 8px); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 4px;
  background: linear-gradient(rgba(60, 90, 120, .95), rgba(34, 52, 72, .95)); color: #e4eef6;
  border: 1px solid #6f9ac0; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); font-size: 13px;
}
#autopilot-banner .ic { font-size: 18px; color: #9fd0f0; animation: ap-spin 6s linear infinite; }
@keyframes ap-spin { to { transform: rotate(360deg); } }
.away-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; margin: 10px 0; }
.away-stats > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 3px; background: rgba(0, 0, 0, .25); }
.away-stats .ic { font-size: 18px; color: var(--brass); }
.away-stats b { font-family: var(--f-head); font-size: 16px; color: var(--text); }
.away-stats .up { color: #a6d37a; font-size: 12px; }
.away-stats .down { color: #ff8a73; font-size: 12px; }
.away-news { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.away-news .k-loss { color: #ffb3a3; }
.away-news .k-capture { color: #cde8a8; }

#catch-up {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 4px;
  background: rgba(19, 19, 27, .92); border: 1px solid var(--brass); color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .6); font-size: 14px;
}
#catch-up .ic { color: var(--brass); font-size: 18px; animation: ap-spin 2.5s linear infinite; }

/* Tutorial progress. */
#tut-banner .tut-progress { height: 3px; margin: 2px 0 8px; width: 160px; border-radius: 2px; background: rgba(42, 36, 22, .15); overflow: hidden; }
#tut-banner .tut-progress i { display: block; height: 100%; background: linear-gradient(90deg, #8a6a1e, #c9a949); transition: width .3s ease; }
#tut-banner .hint b { color: #2a2416; }
/* A step that is running the war (the opening attack): a live mark, so the player knows to watch. */
#tut-banner .tut-live { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; font-family: var(--f-head, Oswald, sans-serif); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #8a2a1c; }
#tut-banner .tut-live i { width: 8px; height: 8px; border-radius: 50%; background: #c0392b; box-shadow: 0 0 0 0 rgba(192, 57, 43, .6); animation: tut-live 1.1s ease-out infinite; }
@keyframes tut-live { to { box-shadow: 0 0 0 9px rgba(192, 57, 43, 0); } }
#tut-banner .txt b { font-weight: 700; }

.dip-tools { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; margin-bottom: var(--s2); }
.dip-tools input {
  height: 28px; width: 200px; margin-right: var(--s2); padding: 0 10px; border-radius: 3px; font: inherit; font-size: 13px;
  color: var(--text); background: rgba(0, 0, 0, .35); border: 1px solid rgba(130, 124, 103, .45); outline: none;
}

#tooltip .tt-battle { background: #f3e2d6; border-color: rgba(140, 40, 30, .6); color: #2a2416; }
#tooltip .tt-battle .tt-side-name { color: #1d1b12; }
#tooltip .tt-battle .tt-side.ours .tt-side-name span { color: #17406a; }
#tooltip .tt-battle .tt-side-stats, #tooltip .tt-battle .tiny { color: #5a5240; }



/* With a dialog open the tutorial banner moves to the foot of the screen, so
   it never sits over the dialog's own header and tabs. */
body:has(#modal-layer.open) #tut-banner { top: auto; bottom: 18px; }
/* ...and on a narrow screen it then covers the foot of the dialog: room to scroll what is under it clear. */
@media (max-width: 900px) {
  body:has(#tutorial.on):has(#modal-layer.open) .dialog-body { padding-bottom: 260px; }
}

/* ------------------------------------------------------------- speed-ups */
/* The "advert −25%" and "gold, finish now" pair on running jobs and marches. */
.hurry { display: inline-flex; gap: 3px; flex: none; align-items: center; }
.hurry-btn {
  display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px;
  border-radius: 3px; font-family: var(--f-ui); font-size: 10.5px; font-weight: 700; line-height: 1;
  border: 1px solid rgba(255, 255, 255, .14); color: #fff; cursor: pointer; white-space: nowrap;
  transition: filter .15s ease, transform .1s ease;
}
.hurry-btn svg { width: 11px; height: 11px; }
.hurry-btn:hover { filter: brightness(1.15); }
.hurry-btn:active { transform: translateY(1px); }
.hurry-btn:disabled { opacity: .5; cursor: progress; }
.hurry-btn.ad { background: linear-gradient(#3d7a3a, #2b5a29); border-color: #5f9a52; }
.hurry-btn.gold { background: linear-gradient(#a9852c, #7d6120); border-color: #d1ad4c; color: #fff8dc; }
/* In the province bar's narrow "In progress" column a queue row stacks:
   name and time, then its progress bar, then speed-ups and cancel. */
.pb-ongoing .qrow { flex-wrap: wrap; row-gap: 4px; column-gap: 4px; }
.pb-ongoing .qrow .grow { order: 1; flex: 1 1 0; }
.pb-ongoing .qrow .t { order: 2; white-space: nowrap; }
.pb-ongoing .qrow .qbar { order: 3; flex: 1 0 100%; width: auto; }
.pb-ongoing .qrow .hurry { order: 4; }
.pb-ongoing .qrow [data-cancel] { order: 5; margin-left: auto; }

/* Doctrine cards: the chosen country's own school of the doctrine, and the
   special units that come with it. */
.nat-kit { margin-top: 6px; cursor: help; color: var(--gold); }
/* "Watch an advert for gold", next to the gold counter. */
.chrome-btn.free-gold { width: auto; padding: 0 9px; gap: 4px; display: inline-flex; align-items: center;
  background: linear-gradient(#3d7a3a, #2b5a29); border-color: #5f9a52; color: #fff; font-weight: 700; font-size: 12px; }
.chrome-btn.free-gold svg { width: 12px; height: 12px; }
.chrome-btn.free-gold.beckon { animation: free-beckon 2.2s ease-in-out infinite; }
@keyframes free-beckon { 50% { box-shadow: 0 0 0 3px rgba(95, 154, 82, .35), 0 0 14px rgba(95, 154, 82, .6); } }

/* ---------------------------------------------------------- morale window */
/* Morale: a gauge, effect chips and three action cards; the explanations live in tooltips. */
.mor-head { padding: 12px 14px; margin-bottom: 10px; color: var(--text);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); border-radius: 4px; }
.mor-place { font-family: var(--f-ui); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.mor-nums { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.mor-now { font-family: var(--f-head); font-size: 34px; font-weight: 600; line-height: 1; }
.mor-now.target { font-size: 24px; opacity: .85; }
.mor-now.good { color: #a9c46a; } .mor-now.low { color: #d8a63c; } .mor-now.bad { color: #e0503a; }
.mor-dir { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 16px;
  background: rgba(255, 255, 255, .08); color: var(--text-dim); }
.mor-dir.up { background: rgba(127, 168, 62, .25); color: #a9c46a; }
.mor-dir.down { background: rgba(196, 50, 34, .25); color: #e0503a; }
.mor-gauge { position: relative; height: 12px; border-radius: 6px; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.mor-gauge i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; transition: width .4s ease; }
.mor-gauge i.good { background: linear-gradient(90deg, #5f8a2c, #a9c46a); }
.mor-gauge i.low { background: linear-gradient(90deg, #a4741e, #d8a63c); }
.mor-gauge i.bad { background: linear-gradient(90deg, #8a2216, #e0503a); }
.mor-gauge b { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: #fff9bf; border-radius: 2px; box-shadow: 0 0 6px rgba(255, 249, 191, .8); }
.mor-parts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mor-fx { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 10px;
  font-family: var(--f-ui); font-size: 13px; font-weight: 700; }
.mor-fx .ic { font-size: 14px; }
.mor-fx.up { color: #b9d77a; background: rgba(127, 168, 62, .2); }
.mor-fx.down { color: #f08a72; background: rgba(196, 50, 34, .2); }
.mor-fx.none { color: var(--text-dim); background: rgba(255, 255, 255, .06); font-weight: 600; }
.mor-policy { padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.mor-ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--text); font-size: 14px; cursor: help; }
.mor-wait { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-dim); }
.mor-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mor-opt { display: flex; flex-direction: column; gap: 6px; min-width: 130px; flex: 1; padding: 8px 10px; text-align: left;
  color: var(--text); border: 1px solid rgba(255, 255, 255, .14); border-radius: 4px; background: rgba(255, 255, 255, .05); cursor: pointer; }
.mor-opt b { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.mor-fxs { display: flex; flex-wrap: wrap; gap: 4px; }
.mor-opt.on { border-color: #8faa4f; background: rgba(121, 143, 67, .28); box-shadow: inset 0 0 0 1px #8faa4f; cursor: default; }
.mor-opt:disabled:not(.on) { opacity: .4; cursor: not-allowed; }
.mor-opt:not(:disabled):hover { background: rgba(255, 255, 255, .1); }
.mor-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mor-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px 10px; text-align: center; color: var(--text);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .12); border-radius: 4px; }
.mor-card-ic { font-size: 24px; color: var(--gold); }
.mor-card > b { font-family: var(--f-head); font-size: 15px; letter-spacing: .04em; }
.mor-card-big { font-family: var(--f-head); font-size: 26px; line-height: 1; color: #a9c46a; }
.mor-card-foot { min-height: 18px; font-size: 12px; color: var(--text-dim); }
.mor-cost { display: inline-flex; align-items: center; gap: 4px; }
.mor-pips { display: inline-flex; gap: 4px; }
.mor-pips i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.mor-pips i.on { background: #a9c46a; }
.mor-card .btn { width: 100%; margin-top: 4px; }
@media (max-width: 560px) { .mor-cards { grid-template-columns: 1fr; } }

/* The training boost, top right of the recruitment screen. */
.boost { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; }
.boost-lbl { font-size: var(--fs-small, 11px); color: var(--muted, #9a9a9a); }
.boost-lbl:empty { display: none; }
.boost-btn { white-space: nowrap; }
.boost-btn.ad { background: linear-gradient(#3d7a3a, #2b5a29); border-color: #5f9a52; color: #fff; }
.boost-on {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 3px;
  font-family: var(--f-head); font-size: 13px; color: #241d0c; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ecd47f 0%, #c9a949 60%, #8d7631 100%); border: 1px solid #5b4a17;
  box-shadow: 0 0 10px rgba(233, 199, 101, .35);
}
.boost-on .ic { font-size: 15px; }


/* Phones: the top bar was one row and pushed every resource off screen. Two
   rows now (who and gold on top, resources scrolling below), and smaller rail
   buttons so the map is not buried under them. */
@media (max-width: 720px) {
  /* The bar is four rows on a phone and --topbar-h is its real height, so the
     panels, rails and the general's portrait that hang from it clear it. */
  :root { --topbar-h: 172px; --rail-w: 46px; }
  #topbar { flex-wrap: wrap; align-content: flex-start; gap: 4px 6px; padding: 4px 6px; }
  .bar-player { order: 1; flex: none; min-width: 0; }
  .bar-player .who, .vp-chip .vp-share { display: none; }
  .bar-player .flag { width: 38px; height: 22px; margin: 0 3px; }
  .bar-player .who { padding: 0 6px; min-width: 0; overflow: hidden; }
  .bar-player .who b { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
  .vp-chip { flex: none; padding: 0 7px; }
  /* Row 1: who you are, then share, save and settings. Row 2: bank, gold and the
     free-gold button. Then every resource, four to a row, none hidden off to the side. */
  .bar-right { display: contents; }
  #topbar::before { content: ''; order: 3; flex: 0 0 100%; height: 0; }
  .bar-right > * { order: 4; }
  .bar-right > .gold-chip { order: 2; margin-left: auto; }
  .bar-right > .free-gold { order: 5; }
  .bar-right > .share-btn { order: 6; }
  .bar-right > [data-act="save"] { order: 7; }
  .bar-right > [data-act="settings"] { order: 8; }
  .bar-right > [data-act="menu"] { order: 8; }
  .bar-right .chrome-btn { min-width: 32px; padding: 0 4px; }
  .bar-right .chrome-btn[data-act="tutorial"], .bar-right .chrome-btn[data-act="feedback"] { display: none; }
  .gold-chip { padding: 0 8px; }
  #resource-bar { order: 9; flex: 0 0 100%; margin: 0; height: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; overflow: visible; }
  #resource-bar .res, #resource-bar .res[data-res] { width: auto; min-width: 0; }
  #rail { top: calc(var(--topbar-h) + 6px); max-height: calc(100% - var(--topbar-h) - 70px); overflow-y: auto; scrollbar-width: none; }
  #rail::-webkit-scrollbar { display: none; }
  .rail-btn { width: 40px; height: 40px; font-size: 20px; }
  #rail { gap: 4px; }
  #map-tools .rail-btn { width: 36px; height: 36px; font-size: 17px; }
  #tut-banner { gap: 8px; padding: 10px 14px 12px 10px; }
  #tut-banner .tut-speaker { width: 52px; }
  #tut-banner .tut-face { width: 52px; height: 62px; }
  #tut-banner .tut-who { display: none; }
  #tut-banner .txt { font-size: 15.5px; }
}

/* "Take me there": the control a jump button sent the player to. */
.guide-target {
  z-index: 3;
  outline: 2px solid #ffe28a; outline-offset: 3px;
  animation: guide-pulse 1.1s ease-in-out infinite;
}
.guide-lift { position: relative; }
/* Its tag: what the control is, with an arrow at it, in the tutorial's style. */
.guide-tag {
  position: fixed; left: 0; top: 0; z-index: 70; display: flex; align-items: center;
  pointer-events: none; will-change: transform; opacity: 0; transition: opacity .2s ease;
}
.guide-tag.show { opacity: 1; }
.guide-tag[hidden] { display: none; }
.guide-tag .arrow { width: 0; height: 0; flex: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); animation: tut-nudge-l 1s ease-in-out infinite; }
.guide-tag.right .arrow { border-top: 11px solid transparent; border-bottom: 11px solid transparent; border-right: 13px solid #ffe28a; }
.guide-tag.left .arrow { order: 2; border-top: 11px solid transparent; border-bottom: 11px solid transparent; border-left: 13px solid #ffe28a; animation-name: tut-nudge-r; }
.guide-tag.above { flex-direction: column; }
.guide-tag.above .arrow { order: 2; border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 13px solid #ffe28a; animation-name: tut-nudge-d; }
.guide-tag .label {
  background: rgba(12, 12, 14, .94); color: #ffe28a; padding: 6px 12px; border-radius: 2px;
  font-family: var(--f-head); font-weight: 500; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .6); white-space: nowrap;
}
@keyframes guide-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 226, 138, .75), 0 0 14px rgba(255, 226, 138, .5); }
  50% { box-shadow: 0 0 0 8px rgba(255, 226, 138, 0), 0 0 24px rgba(255, 226, 138, .8); }
}
@media (prefers-reduced-motion: reduce) { .guide-target, .guide-tag .arrow { animation: none; } }

/* ---------------------------------------------------- war chest, redesign
   Money screen order: the live offer, then the two primary actions (the
   free advert, then the gold packs), then small quiet print. */
.shop-top { padding: var(--s1) var(--s3); margin-bottom: var(--s2); }
.shop-sec {
  margin: var(--s3) 0 var(--s2); display: flex; align-items: center; gap: var(--s2);
  font-family: var(--f-head); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass);
}
.shop-sec::after { content: ''; flex: 1; height: 1px; background: rgba(130, 124, 103, .35); }
.shop-sec .first-note { margin: 0; padding: 1px 8px; font-family: var(--f-ui); letter-spacing: .04em; text-transform: none; }
.shop-adcard {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); margin-bottom: var(--s2);
  border-radius: 5px; border: 1px solid rgba(143, 208, 127, .55);
  background: linear-gradient(160deg, rgba(62, 92, 40, .55), rgba(25, 30, 24, .9) 70%);
}
.shop-adcard .shop-big { font-size: 40px; color: #b5dc86; }
.shop-adtxt { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.shop-adtxt b { font-family: var(--f-head); font-size: 18px; letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
.shop-adtxt span { font-family: var(--f-head); font-size: 22px; }
.shop-adtxt small { font-size: 12.5px; color: var(--text-dim); }
.shop-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s4);
  padding-top: var(--s2); border-top: 1px solid rgba(130, 124, 103, .25); font-size: 12px; color: var(--text-dim);
}
.shop-foot .spacer { flex: 1; }
.shop-foot a { color: var(--text-dim); text-decoration: underline; }
.shop-foot a:hover { color: var(--gold); }
.shop-fine summary { cursor: pointer; list-style: none; }
.shop-fine summary::after { content: ' ▾'; }
.shop-fine[open] summary::after { content: ' ▴'; }
.shop-fine summary::-webkit-details-marker { display: none; }
.shop-fine select { margin-top: 4px; padding: 3px 6px; font-family: inherit; }
.test-banner { margin: 0; padding: 1px 8px; font-size: 12px; }
.offer-card.inline { margin-bottom: var(--s2); padding: var(--s2) var(--s3); }
.offer-body { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.offer-body .offer-items { flex: 1; min-width: 160px; }
.shop-sum { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s1); }
.shop-sum .shop-big { font-size: 34px; }
.shop-sum-name { font-family: var(--f-head); font-size: 20px; letter-spacing: .06em; text-transform: uppercase; color: var(--text); flex: 1; }
.shop-sum-fig { font-family: var(--f-head); font-size: 17px; font-variant-numeric: tabular-nums; color: var(--text); }
.shop-short { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s2); font-size: 13px; color: var(--text-dim); }
.shop-trade-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.shop-pack-amt { font-size: 22px; }
.shop-gpack .shop-pack-ic { font-size: 32px; margin: 2px 0 0; }
.shop-gpack.best .btn { box-shadow: 0 0 10px rgba(233, 199, 101, .45); }
@media (max-width: 720px) {
  .shop-adcard { flex-wrap: wrap; }
  .shop-adcard .btn { width: 100%; }
  .shop-foot { flex-direction: column; align-items: flex-start; }
}

/* Phone dialogs: the research tree and diplomacy rows were squeezed to nothing. */
@media (max-width: 720px) {
  .rt-wrap { flex-direction: column; height: auto; }
  .rt-tree { flex: none; height: 360px; }
  .rt-wrap > :not(.rt-tree) { flex: none; width: auto; }
  .lrow[data-dname] { grid-template-columns: 40px 1fr !important; row-gap: 6px; }
  .lrow[data-dname] > :nth-child(3) { grid-column: 2; }
  .lrow[data-dname] > :nth-child(4) { grid-column: 1 / -1; justify-content: flex-start !important; flex-wrap: wrap; }
}

.toast-more { align-self: flex-start; padding: 2px 10px; border-radius: 10px; font-size: 12px; color: var(--text-dim); background: rgba(19, 19, 27, .8); border: 1px solid var(--edge-dark); }
@media (max-width: 720px) {
  .boost { flex-wrap: wrap; }
  #toasts { width: min(296px, calc(var(--game-w) - 130px)); }
}

.peace-chip { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: #b5dc86; }
.peace-chip[hidden] { display: none; }
/* Sits beside the clock rather than inside it, so the chip keeps its height. */
#clock-chip { overflow: visible; }
.peace-chip {
  position: absolute; right: calc(100% + 6px); top: 3px; margin: 0; padding: 4px 9px; white-space: nowrap;
  background: var(--panel); border: 1px solid rgba(143, 208, 127, .5); border-radius: 3px; box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  font-family: var(--f-ui);
}
@media (max-width: 720px) {
  #tut-banner .hint { font-size: 12px; font-weight: 500; line-height: 1.3; margin-top: 4px; }
  #tut-banner .step { margin-bottom: 2px; }
}

/* Autopilot toggle in the top bar: lit while the generals are in command. */
.chrome-btn.autoplay-btn { width: auto; padding: 0 9px; gap: 4px; display: inline-flex; align-items: center; font-weight: 700; font-size: 12px; }
/* The way out to the main menu: the one top-bar button with its name on it. */
.chrome-btn.menu-btn { width: auto; padding: 0 10px; gap: 5px; display: inline-flex; align-items: center; font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
@media (max-width: 720px) { .chrome-btn.menu-btn .mn-lbl { display: none; } }
.chrome-btn.autoplay-btn.on { background: linear-gradient(#e9c765, #b8942f); color: #241d0c; border-color: #6b5520; box-shadow: 0 0 10px rgba(233, 199, 101, .55); }
.chrome-btn.autoplay-btn.on .ic { animation: ap-spin 6s linear infinite; }
@media (max-width: 720px) {
  /* Phones: the autopilot toggle is icon-only, so the gold counter keeps its room. */
  .chrome-btn.autoplay-btn { padding: 0 6px; flex: none; }
  .chrome-btn.autoplay-btn .ap-lbl { display: none; }
  #bar-player .flag { flex: none; width: 34px; height: 24px; }
  #bar-player .avatar { display: none; }
}

/* A multiplayer match runs on the server's clock and sells nothing. */
#app.remote #speed-bar, #app.remote .free-gold { display: none; }

/* -------------------------------------------------------- advert column */
/* Call of War's layout: a dark column the advert's own width down the right
   of the page, beside the game rather than over it, with a small line at the
   foot offering the way out. Below the dialogs and the tutorial in z-order,
   though nothing of the game reaches this far right while it stands. */
#side-ad {
  position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 50;
  display: flex; flex-direction: column; justify-content: space-between;
  background: #0d0e10; border-left: 1px solid #000;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, .04);
}
#side-ad[hidden] { display: none; }
/* Asking Google for its advert: laid out, so the unit has a width, but not
   seen and not in the way until there is something to show. */
#side-ad.waiting { visibility: hidden; pointer-events: none; }
.side-ad-slot { width: 300px; min-height: 250px; }
/* The development stand-in: the advert's size and nothing else. */
.side-ad-stand {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 300px; background: #4a4b4f; color: #c9c9c9;
  font-family: var(--f-ui); font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
}
.side-ad-stand small { font-size: 11px; letter-spacing: 0; opacity: .7; }
.side-ad-shop {
  display: block; padding: 8px 10px 10px; text-align: center;
  font-family: var(--f-ui); font-size: 12px; line-height: 1.35;
  color: var(--text-dim); text-decoration: none;
}
.side-ad-shop:hover { color: var(--gold); text-decoration: underline; }
/* ------------------------------------------------------------------ sound */

/* The menu's speaker: a quiet round button in the top corner, out of the way. */
#menu .menu-sound {
  position: fixed; top: 14px; right: 14px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(10, 12, 14, .55); color: var(--acc-hi);
  border: 1px solid var(--acc-line); opacity: .75;
  transition: opacity .2s, background .2s, transform .12s;
}
#menu .menu-sound:hover, #menu .menu-sound:focus-visible { opacity: 1; background: rgba(10, 12, 14, .8); }
#menu .menu-sound:active { transform: scale(.94); }
#menu .menu-sound[aria-pressed="false"] { color: var(--text-dim); }

/* Settings: a volume slider per channel, each with its own mute box. */
.sound-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.sound-row > span:first-child { width: 64px; flex: none; }
.sound-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--brass); }
.sound-row .vol { width: 36px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }
.sound-row label { display: flex; align-items: center; gap: 4px; flex: none; cursor: pointer; }

/* The card shown on an army under the pointer: emblem, name and owner,
   what it is doing and where, then its units and its strength. */
#tooltip:has(> .tt-army) { padding: 10px 12px; min-width: 200px; max-width: 280px; }
.tt-army { display: flex; align-items: center; gap: var(--s2); margin-bottom: 6px; }
.tt-emb { width: 34px; height: 24px; flex: none; background-size: cover !important; background-position: center !important; box-shadow: 0 0 0 1px #000, 0 0 0 2px #c9a949; }
.tt-army-id { min-width: 0; display: flex; flex-direction: column; }
.tt-army-id b { font-family: var(--f-ui); font-weight: 600; font-size: 14px; line-height: 1.2; letter-spacing: .03em; text-transform: uppercase; color: var(--ink); }
.tt-army-id span { font-size: 12px; line-height: 1.3; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.tt-army-state { font-size: 11px; font-weight: 600; line-height: 1.4; color: #6a5a24; }
.tt-army-loc { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 1.4; color: var(--ink); }
.tt-army-loc .ic { font-size: 12px; color: #6a5a24; }
.tt-army-units { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(29, 27, 18, .18); font-size: 12px; font-weight: 700; color: var(--ink); }
.tt-army-units > span { display: inline-flex; align-items: center; gap: 2px; }
.tt-army-units img { width: 16px; height: 16px; }
.tt-army-units .hp { flex: 1 0 60px; height: 5px; border-radius: 2px; overflow: hidden; background: rgba(29, 27, 18, .2); }
.tt-army-units .hp i { display: block; height: 100%; background: #5fae2e; }

/* Phones: the bottom panels take the full width and scroll their columns. */
@media (max-width: 720px) {
  :root { --bp-left: 112px; }
  #province-panel, #army-panel { width: 100%; }
  .bp-nav, .bp-title .sub, .bp-head .hchip { display: none; }
  .bp-body { overflow-x: auto; }
  .big-btn { width: 78px; }
  /* Construct and Recruit are what a province is opened for: on a phone they come
     first, where the thumb is, instead of past the right edge. The map crop goes. */
  #province-panel .pb-actions { order: -1; }
  #province-panel .pb-thumb-col, #province-panel .pb-morale .bp-hint { display: none; }
  .big-btn { font-size: 13px; letter-spacing: .03em; }
  #province-panel .pb-morale { flex: 1 1 auto; width: auto; min-width: 80px; }
  /* The army panel: its picture goes, the orders (Halt, Split, Centre) come first,
     then the units; hit points and status follow if you swipe. */
  #army-panel .army-left { display: none; }
  #army-panel .army-activity { order: -2; flex: 0 0 104px; min-width: 0; }
  #army-panel .army-cards { order: -1; flex: 0 0 240px; }
  #army-panel .army-hp { width: auto; flex: 0 0 130px; }
}

/* ------------------------------------------------- one family of controls

   A finishing pass over the in-game chrome, kept together at the end so it
   wins over the older rules above without each of them being rewritten.
   The original's interface reads as one machine because every control is
   cut from the same stock: gunmetal with a one-pixel bevel, parchment where
   there is something to read, three button heights (28, 32 and 40), one
   close button, one tab strip, one field. The buttons are scoped to the war
   (#app, the dialogs, the tutorial and the commander), so the start menu,
   which has its own finished look, is left alone. */

:root {
  --t-fast: .12s;
  /* A gold ring two pixels clear of the control, for keyboard users only. */
  --focus-ring: 2px solid var(--gold);
  /* The one-pixel bevel every gunmetal surface carries: light on top, dark below. */
  --bevel: inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 -1px 0 rgba(0, 0, 0, .45);
}

/* Keyboard focus is shown everywhere in the war and nowhere for the mouse. */
:is(#app, #modal-layer, #commander, #tutorial) :focus-visible {
  outline: var(--focus-ring); outline-offset: 2px;
}
:is(#app, #modal-layer, #commander, #tutorial) :focus:not(:focus-visible) { outline: none; }

/* Scrollbars: a gunmetal thumb with a dark rim on a sunken track, and an ink
   thumb on the parchment areas. Firefox only understands the two colours. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, .3); box-shadow: inset 1px 0 0 rgba(0, 0, 0, .35); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #5a5643, #4a4738); border-radius: 5px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #6e6a54; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
:is(.rt-tree, .paper, .card-bone)::-webkit-scrollbar-track { background: rgba(76, 72, 57, .14); box-shadow: none; }
:is(.rt-tree, .paper, .card-bone)::-webkit-scrollbar-thumb { background: rgba(76, 72, 57, .55); background-clip: padding-box; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-color: #5a5643 rgba(0, 0, 0, .3); scrollbar-width: thin; }
}

/* ----------------------------------------------------------- the top bar */
/* A gunmetal bar with a light top edge and a brass hairline under it, like
   the lid of an ammunition box. */
#topbar {
  background: linear-gradient(180deg, rgba(46, 48, 54, .97), rgba(30, 31, 36, .97));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 0 rgba(201, 169, 73, .16), 0 2px 8px rgba(0, 0, 0, .55);
  gap: var(--s2);
}
/* Figures that tick over every second keep their width as they do. */
#resource-bar .res .amt, #resource-bar .res .rate, .gold-chip b, .vp-chip b, .vp-chip .vp-share,
.speed-btn, .badge, .toast .when { font-variant-numeric: tabular-nums; }
#resource-bar .res .rate { font-size: 11px; letter-spacing: .01em; }
.vp-chip { box-shadow: var(--bevel); transition: filter var(--t-fast); }
.vp-chip:hover { filter: brightness(1.18); }

/* The gold counter ends in the original's yellow "+": the one control on the
   bar that always says "more", so it is the one bright thing on it. */
.gold-chip { padding: 0 6px 0 12px; }
.gold-plus {
  width: 24px; height: 24px; margin-left: 2px; flex: none; display: grid; place-items: center;
  font-family: var(--f-ui); font-weight: 800; font-size: 19px; line-height: 1; color: #2a2108;
  background: linear-gradient(180deg, #ffe680 0%, #f0c43a 55%, #c99a1e 100%);
  border: 1px solid #6b5216; border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 1px 2px rgba(0, 0, 0, .6);
  transition: filter var(--t-fast), transform var(--t-fast);
}
.gold-plus:hover { filter: brightness(1.1); }
.gold-plus:active { transform: translateY(1px); filter: brightness(.95); }

/* The utility buttons are squares of one size, evenly spaced. */
.chrome-btn {
  width: 34px; height: 34px; font-size: 18px;
  box-shadow: var(--bevel), 0 1px 2px rgba(0, 0, 0, .5);
  transition: filter var(--t-fast), color var(--t-fast);
}
.chrome-btn:active { transform: translateY(1px); filter: brightness(.92); }
.bar-right { gap: var(--s1); }
.bar-right .gold-chip { margin-right: var(--s1); }

/* ------------------------------------------------------------- the rails */
.rail-btn {
  box-shadow: var(--bevel), 0 2px 5px rgba(0, 0, 0, .5);
  transition: filter var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.rail-btn:hover { box-shadow: var(--bevel), inset 0 0 0 1px rgba(201, 169, 73, .45), 0 2px 5px rgba(0, 0, 0, .5); }
.rail-btn:active { transform: translateY(1px); filter: brightness(.94); }
/* The screen that is open: a brass edge on the side facing the map. */
.rail-btn.cur { color: var(--gold); box-shadow: var(--bevel), inset -3px 0 0 var(--brass), 0 2px 5px rgba(0, 0, 0, .5); }
#map-tools .rail-btn.cur { box-shadow: var(--bevel), inset 3px 0 0 var(--brass), 0 2px 5px rgba(0, 0, 0, .5); }
.badge { min-width: 18px; height: 18px; line-height: 16px; border-radius: 9px; font-size: 10px; letter-spacing: 0; }
.portrait-btn { transition: filter var(--t-fast), border-color var(--t-fast); }

/* ------------------------------------------------------- the dialog frame */
/* One window: a thin bone frame with a black hairline outside it, a dark
   title bar with the name in condensed capitals, the screen's icon in a
   square on the left and a red square close on the right. */
.dialog {
  border-width: 2px; border-radius: 3px;
  box-shadow: 0 0 0 1px #000, 0 10px 40px rgba(0, 0, 0, .7);
}
.dialog-head {
  height: 46px; padding: 0 var(--s2) 0 var(--s3); gap: var(--s2);
  border-radius: 1px 1px 0 0;
  box-shadow: inset 0 1px 0 rgba(201, 169, 73, .32), inset 0 -1px 0 rgba(201, 169, 73, .12);
}
.dialog-head h2 { font-size: 20px; letter-spacing: .16em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dialog-head > .hchip {
  width: 30px; height: 30px; padding: 0; justify-content: center;
  background: rgba(0, 0, 0, .38); border-color: rgba(201, 169, 73, .35); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6);
}
.dialog-head > .hchip .ic { font-size: 17px; }
.dialog-head .portrait { width: 30px; height: 30px; }
.dialog-x {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; font-size: 13px; color: #fff;
  background: linear-gradient(180deg, #d04a34, var(--red) 52%, #7d2014);
  border: 1px solid #4d1409; border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .6);
  transition: filter var(--t-fast), transform var(--t-fast);
}
.dialog-x:hover { filter: brightness(1.15); }
.dialog-x:active { transform: translateY(1px); filter: brightness(.92); }

/* The tab strip: tabs standing on one ruled line, the open one lit in gold
   with a brass bar along its top, the way a folder's tab is cut. */
.dialog-tabs {
  padding: var(--s2) var(--s5) 0; gap: var(--s1);
  border-bottom: 1px solid rgba(201, 169, 73, .3);
  background: linear-gradient(180deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, .08));
}
.tab {
  height: 32px; margin-bottom: -1px; font-size: var(--fs-small);
  border-color: rgba(0, 0, 0, .7); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: color var(--t-fast), filter var(--t-fast);
}
.tab:hover:not(.on) { filter: brightness(1.15); }
.tab.on {
  color: var(--gold); border-color: rgba(201, 169, 73, .45); border-bottom: 1px solid #322e22;
  box-shadow: inset 0 2px 0 var(--brass);
}

.dialog-foot { background: rgba(0, 0, 0, .28); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }

/* Filter chips and list rows answer the pointer at the same speed as buttons. */
.chip, .bu-prow, .row-list .lrow, .icon-btn, .speed-btn, .fb-star {
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast), filter var(--t-fast);
}

/* ---------------------------------------------------------------- buttons */
/* Four colours (gold primary, green go, grey secondary, red danger) at three
   heights. The press sinks the button by a pixel and shades its top, so it
   moves without anything around it moving. */
:is(#app, #modal-layer, #tutorial, #commander) .btn {
  height: 32px; padding: 0 16px; font-size: 14px; border-radius: 2px;
  transition: filter var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
:is(#app, #modal-layer, #tutorial, #commander) .btn.sm { height: 28px; padding: 0 12px; font-size: 12.5px; }
:is(#app, #modal-layer, #tutorial, #commander) .btn.lg { height: 40px; padding: 0 24px; font-size: 17px; }
:is(#app, #modal-layer, #tutorial, #commander) .btn:active:not(:disabled) {
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35);
}
:is(#app, #modal-layer, #tutorial, #commander) .btn:disabled {
  cursor: not-allowed; filter: grayscale(.85) brightness(.62); box-shadow: none; text-shadow: none;
}

/* ----------------------------------------------------------------- fields */
/* Text, number and search boxes and drop-downs: sunk into the panel, light
   text, a brass edge when they have the caret. Never the browser's white. */
.field, .dip-tools input, .fb-select, .shop-limit select, .shop-fine select {
  height: 32px; padding: 0 10px; border-radius: 2px;
  font-family: var(--f-ui); font-size: 13px; color: var(--text);
  background: rgba(0, 0, 0, .38); border: 1px solid rgba(130, 124, 103, .5);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .55);
  transition: border-color var(--t-fast);
}
/* Beside a row of filter chips the search box takes the small height, as a .sm button would. */
.dip-tools input { height: 28px; }
.fb-text { border-radius: 2px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .55); }
.field { display: block; margin-top: var(--s1); }
.field:hover, .dip-tools input:hover, .fb-select:hover { border-color: rgba(201, 169, 73, .55); }
.field:focus, .dip-tools input:focus, .fb-select:focus, .fb-text:focus, .bu-search:focus-within {
  outline: none; border-color: var(--brass);
}
:is(.field, .fb-select, .shop-limit select, .shop-fine select) option { background: var(--panel-solid); color: var(--text); }
.bu-search { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .55); transition: border-color var(--t-fast); }

/* ---------------------------------------------- tooltip, toasts, corner */
/* The tooltip fades in rather than blinking on, and sits on a crisper edge. */
#tooltip { border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), 0 8px 26px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .45); }
#tooltip.on { animation: tip-in .1s ease-out; }
@keyframes tip-in { from { opacity: 0; } to { opacity: 1; } }

.toast {
  gap: var(--s2); padding: var(--s2) 10px; border-radius: 2px; font-size: 13px; line-height: 1.35;
  box-shadow: var(--bevel), 0 3px 10px rgba(0, 0, 0, .55);
  transition: filter var(--t-fast);
}
.toast:hover { filter: brightness(1.15); }
#toasts { gap: var(--s1); }

#speed-bar, #clock-chip { box-shadow: var(--bevel), 0 2px 8px rgba(0, 0, 0, .55); }
.speed-btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.speed-btn:active { transform: translateY(1px); }
/* "No news yet" stands in the column the stories would, not against the edge. */
.paper > .muted { margin: var(--s2) 0 0; }
.paper.modern > .muted { margin: var(--s3) 20px var(--s1); }

/* The clock is two lines tall now: the peace chip beside it sits on its middle. */
#clock-chip .peace-chip { top: 50%; transform: translateY(-50%); }
#clock-chip .nextday { font-family: var(--f-ui); font-size: 11px; font-weight: 500; letter-spacing: .02em; margin-top: 2px; }
#minimap { border-color: #000; box-shadow: 0 0 0 1px rgba(130, 124, 103, .45), 0 2px 10px rgba(0, 0, 0, .6); }

@media (prefers-reduced-motion: reduce) {
  #tooltip.on { animation: none; }
}

/* The thirty days of war: a slim bar under the clock that fills as the war
   runs out, warming to amber over the last few days. */
#clock-chip .war-days {
  display: block; height: 3px; margin-top: 4px; border-radius: 2px; overflow: hidden;
  background: rgba(0, 0, 0, .5); box-shadow: inset 0 0 0 1px rgba(130, 124, 103, .35);
}
#clock-chip .war-days i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8f7a3c, var(--brass)); }
#clock-chip.late { border-color: rgba(224, 146, 62, .75); }
#clock-chip.late [data-clock-time] { color: #f0b46a; }
#clock-chip.late .war-days i { background: linear-gradient(90deg, #b8642c, #f0a04b); }

/* The ranking's "who would win today" line. */
.rk-lead {
  display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 10px;
  background: rgba(0, 0, 0, .28); border: 1px solid rgba(130, 124, 103, .35); border-radius: 3px; font-size: 13px;
}
.rk-lead.mine { border-color: rgba(201, 169, 73, .6); background: rgba(201, 169, 73, .1); }
.rk-lead .tiny { display: block; margin-top: 2px; }
.rk-lead-flags { display: inline-flex; gap: 3px; flex: none; }
.rk-flag { display: block; width: 24px; height: 16px; background-size: cover !important; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }

/* The final ranking on the end screen. */
.end-card { max-width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 0 4px; }
.end-ranking {
  margin: -8px auto 20px; padding: 8px 10px; text-align: left;
  background: rgba(10, 11, 13, .78); border: 1px solid rgba(130, 124, 103, .45); border-radius: 3px;
  font-size: 13px; color: var(--text); box-shadow: 0 4px 18px rgba(0, 0, 0, .6);
}
.end-ranking .er-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font-family: var(--f-head); letter-spacing: .08em; text-transform: uppercase; color: var(--brass); font-size: 12px; }
.end-ranking .er-where { text-transform: none; letter-spacing: .02em; color: #d8cfae; font-family: var(--f-ui); }
.end-ranking .er-row {
  display: grid; grid-template-columns: 22px 24px 1fr 62px 52px 50px; align-items: center; gap: 6px;
  padding: 3px 4px; border-radius: 2px; font-variant-numeric: tabular-nums;
}
.end-ranking .er-row + .er-row { border-top: 1px solid rgba(130, 124, 103, .15); }
.end-ranking .er-row .sw { display: block; width: 22px; height: 15px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.end-ranking .er-rank { color: var(--text-dim); text-align: right; }
.end-ranking .er-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end-ranking .er-name em { font-style: normal; color: var(--text-dim); font-size: 12px; }
.end-ranking .er-prov { color: var(--text-dim); font-size: 12px; text-align: right; }
.end-ranking .er-vp { color: var(--gold); text-align: right; font-family: var(--f-head); }
.end-ranking .er-share { text-align: right; color: #d8cfae; }
.end-ranking .er-row.won .er-rank { color: var(--gold); }
.end-ranking .er-row.me { background: rgba(201, 169, 73, .2); box-shadow: inset 0 0 0 1px rgba(201, 169, 73, .55); }
.end-ranking .er-gap { text-align: center; color: var(--text-dim); line-height: 1; }
@media (max-width: 560px) {
  .end-card h1 { font-size: 44px; }
  .end-card p { font-size: 14px; margin-bottom: 16px; }
  .end-ranking .er-row { grid-template-columns: 18px 22px 1fr 44px 44px; }
  .end-ranking .er-prov { display: none; }
  .end-ranking .er-head { flex-direction: column; gap: 0; }
}

/* The central banks' daily credit (ui/bank.js). */
#bank-pop {
  position: fixed; inset: 0; right: var(--ad-w, 0px); z-index: 91; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(6, 7, 9, .72); outline: none; animation: offer-fade .25s ease both;
}
.offer-card.big.bank-card { height: min(720px, 100%); }
.bank-note { flex: none; margin: 14px 28px 4px; font-family: var(--f-ui); font-size: 15px; line-height: 1.45; color: #bdb8a6; }
.bank-card .offer-cta { margin-top: 12px; }
.bank-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; margin-right: 6px;
  border-radius: 3px; font-family: var(--f-head); font-size: 13px; font-variant-numeric: tabular-nums;
  color: #bdb8a6; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .14); cursor: help;
}
.bank-badge .ic { font-size: 16px; }
.bank-badge.ready {
  color: #102010; cursor: pointer; background: linear-gradient(180deg, #b6e08a 0%, #6fa847 52%, #3f6b26 100%);
  border-color: #23401a; animation: bank-glow 2s ease-in-out infinite;
}
.bank-badge.ready:hover { filter: brightness(1.12); }
@keyframes bank-glow { 0%, 100% { box-shadow: 0 0 8px rgba(140, 210, 100, .35); } 50% { box-shadow: 0 0 18px rgba(140, 210, 100, .75); } }

/* The one-time rating request on itch.io (ui/rate.js). */
#rate-card {
  position: fixed; left: 70px; bottom: 16px; z-index: 80; width: min(320px, calc(100vw - 32px)); padding: 14px 16px;
  font-family: var(--f-ui); color: #e5e2d5; background: linear-gradient(180deg, #2a2c31, #16171b);
  border: 1px solid #e9c765; border-radius: 6px; box-shadow: 0 12px 40px rgba(0, 0, 0, .6); animation: offer-in .35s ease both;
}
#rate-card b { display: flex; align-items: center; gap: 6px; font-size: 16px; color: #fff9bf; }
#rate-card b .ic { color: #e9c765; }
#rate-card p { margin: 6px 0 10px; font-size: 14px; line-height: 1.4; color: #bdb8a6; }
#rate-card .rate-actions { display: flex; gap: 8px; }
@media (max-width: 640px) { #rate-card { left: 16px; bottom: 90px; } }

/* ---------------------------------------------------------- spoils of war */
/* Plunder: coins fly from a captured province to the money in the resource
   bar, which pops with the sum. A streak of quick captures gets its word
   under the top bar; the run-up to victory gets a banner mid-screen. */
.loot-coin {
  position: fixed; z-index: 60; width: 16px; height: 16px; margin: -8px 0 0 -8px; pointer-events: none;
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c4, #f2c443 45%, #a8771c 100%);
  box-shadow: 0 0 10px rgba(255, 210, 80, .8), inset 0 -2px 0 rgba(0,0,0,.25);
}
#resource-bar .res.loot-pop { animation: loot-pop .55s cubic-bezier(.2,1.6,.4,1); }
#resource-bar .res.loot-pop .amt { animation: loot-glow 1.2s ease-out; }
@keyframes loot-pop { 0% { transform: scale(1); } 35% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes loot-glow { 0% { color: #fff3a0; text-shadow: 0 0 12px #ffd34d; } 100% { color: var(--text); text-shadow: none; } }
.loot-sum {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  font-family: var(--f-head); font-size: 18px; color: #ffe17a; text-shadow: 0 2px 0 #000, 0 0 10px rgba(255, 200, 60, .6);
  animation: loot-sum 1.6s ease-out forwards;
}
@keyframes loot-sum { 0% { opacity: 0; transform: translate(-50%, -6px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, 4px) scale(1.15); } 70% { opacity: 1; transform: translate(-50%, 10px) scale(1); } 100% { opacity: 0; transform: translate(-50%, 18px); } }

#streak-banner {
  position: absolute; left: 50%; top: 96px; z-index: 40; pointer-events: none; opacity: 0;
  display: flex; align-items: baseline; gap: 10px; padding: 6px 18px 8px; transform: translateX(-50%);
  font-family: var(--f-head); text-transform: uppercase; color: #fff4c0;
  background: linear-gradient(90deg, transparent, rgba(20, 16, 6, .82) 18%, rgba(20, 16, 6, .82) 82%, transparent);
}
#streak-banner b { font-size: 40px; font-weight: 700; color: #ffd34d; text-shadow: 0 3px 0 #3a2a05, 0 0 18px rgba(255, 200, 60, .7); }
#streak-banner span { font-size: 26px; letter-spacing: .08em; text-shadow: 0 2px 0 #000; }
#streak-banner i { font-style: normal; font-family: var(--f-ui); font-size: 12px; font-weight: 700; color: #e9c765; letter-spacing: .06em; }
#streak-banner.s4 b, #streak-banner.s5 b { color: #ff9a3c; text-shadow: 0 3px 0 #3a1505, 0 0 24px rgba(255, 120, 40, .8); }
#streak-banner.show { animation: streak-in .5s cubic-bezier(.2,1.5,.4,1) forwards; }
#streak-banner.hide { animation: streak-out .4s ease-in forwards; }
@keyframes streak-in { 0% { opacity: 0; transform: translateX(-50%) scale(1.8); } 100% { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes streak-out { 0% { opacity: 1; transform: translateX(-50%); } 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

#vp-milestone {
  position: absolute; left: 50%; top: 26%; z-index: 40; pointer-events: none; opacity: 0;
  width: min(440px, calc(100vw - 32px)); padding: 12px 20px 14px; transform: translateX(-50%); text-align: center;
  background: rgba(18, 16, 10, .88); border: 1px solid var(--brass); border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
#vp-milestone .k { font-family: var(--f-ui); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
#vp-milestone .t { margin-top: 2px; font-family: var(--f-head); font-size: 30px; text-transform: uppercase; color: #fff4c0; text-shadow: 0 2px 0 #000; }
#vp-milestone .bar { margin-top: 10px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
#vp-milestone .bar i { display: block; height: 100%; background: linear-gradient(90deg, #a8771c, #ffd34d); animation: vp-fill 1.1s .2s cubic-bezier(.3,0,.2,1) backwards; }
#vp-milestone.show { animation: streak-in .5s cubic-bezier(.2,1.4,.4,1) forwards; }
#vp-milestone.hide { animation: streak-out .4s ease-in forwards; }
@keyframes vp-fill { from { width: 0; } }
@media (max-width: 640px) { #streak-banner { top: 84px; } #streak-banner b { font-size: 32px; } #streak-banner span { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) {
  #streak-banner.show, #vp-milestone.show { animation: none; opacity: 1; }
  #resource-bar .res.loot-pop, #resource-bar .res.loot-pop .amt, #vp-milestone .bar i { animation: none; }
}

/* ------------------------------------------------------- share your war (ui/share.js) */
.chrome-btn.share-btn { color: #e8c25a; }
#share-layer {
  position: fixed; inset: 0; z-index: 190; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 6, 8, .78); padding: 16px;
}
.share-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  max-height: 100%; width: min(420px, 100%); padding: 18px 18px 14px;
  background: var(--panel-solid); border: 1px solid var(--edge); box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}
.share-card h2 { font-family: var(--f-head); font-weight: 600; font-size: 24px; letter-spacing: .04em; text-transform: uppercase; color: #e8c25a; margin: 0; }
.share-sub { margin: 0; font-size: 13px; color: var(--text-dim); text-align: center; }
.share-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; justify-content: center; }
.share-stage canvas { height: min(62vh, 640px); max-width: 100%; aspect-ratio: 9 / 16; object-fit: contain; border: 1px solid var(--edge-dark); background: #1c3a4c; }
.share-rec {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 3px 10px;
  background: rgba(150, 20, 10, .85); color: #fff; font: 600 12px var(--f-ui); border-radius: 2px;
}
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.share-note { margin: 0; min-height: 1.2em; font-size: 12.5px; color: var(--text); text-align: center; max-width: 360px; }
.share-x { position: absolute; top: 6px; right: 10px; font-size: 26px; line-height: 1; color: var(--text-dim); }
.share-x:hover { color: var(--text); }

/* Plain-text introduction under the start menu, for people and for crawlers. */
/* The home page below the mode cards: what the game is, in words and
   pictures, for a visitor who wants to know before pressing anything (and for
   search engines and advert reviewers, who read the page and never play). */
.menu-more { display: none; margin: 34px auto 0; max-width: 880px; padding: 26px 26px 10px; color: #cfc9b6; font-size: 15px; line-height: 1.65; background: rgba(12, 13, 15, .78); border: 1px solid rgba(201, 169, 73, .28); border-radius: 4px; }
#menu[data-page="home"] .menu-more { display: block; }
.menu-more h2 { margin: 30px 0 10px; font-family: var(--f-head); font-weight: 600; font-size: 24px; letter-spacing: .04em; text-transform: uppercase; color: #e9c765; }
.menu-more h2:first-child { margin-top: 0; }
.menu-more h3 { margin: 0 0 6px; font-family: var(--f-head); font-weight: 600; font-size: 17px; letter-spacing: .04em; text-transform: uppercase; color: #f4efe0; }
.menu-more p { margin: 0 0 12px; }
.menu-more .mm-lead { font-size: 17px; color: #e5e0cf; }
.menu-more a { color: #e9c765; }
.menu-more b { color: #f4efe0; }
.menu-more .mm-shot { margin: 18px 0; }
.menu-more .mm-shot img { display: block; width: 100%; height: auto; border: 1px solid rgba(201, 169, 73, .45); box-shadow: 0 8px 28px rgba(0, 0, 0, .6); }
.menu-more figcaption { margin-top: 7px; font-size: 13px; color: #9b9480; text-align: center; }
.menu-more .mm-pair, .menu-more .mm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.menu-more .mm-cols.three { grid-template-columns: repeat(3, 1fr); }
.menu-more .mm-steps { margin: 0 0 6px; padding-left: 22px; }
.menu-more .mm-steps li { margin-bottom: 8px; }
.menu-more .mm-faq dt { margin-top: 14px; font-weight: 700; color: #f4efe0; }
.menu-more .mm-faq dd { margin: 4px 0 0; }
.menu-more .mm-links { margin: 0 0 14px; padding-left: 20px; columns: 2; column-gap: 28px; }
.menu-more .mm-links li { margin-bottom: 6px; break-inside: avoid; }
@media (max-width: 700px) {
  .menu-more { padding: 18px 16px 6px; font-size: 14px; }
  .menu-more h2 { font-size: 20px; }
  .menu-more .mm-pair, .menu-more .mm-cols, .menu-more .mm-cols.three { grid-template-columns: 1fr; gap: 6px; }
  .menu-more .mm-links { columns: 1; }
}
.menu-about { margin: 18px auto 8px; max-width: 760px; padding: 0 16px 24px; text-align: center; color: #9b9480; font-size: 13px; line-height: 1.55; }
.menu-about p { margin: 0 0 8px; }
.menu-about nav { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; }
.menu-about a { color: #c9b26b; text-decoration: none; }
.menu-about a:hover { text-decoration: underline; }

/* Phones: dialogs that were built for a wide screen. */
@media (max-width: 720px) {
  /* Tab strips scroll sideways inside the dialog instead of widening the page. */
  .dialog-tabs { overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .dialog-tabs::-webkit-scrollbar { display: none; }
  .dialog-tabs .tab { flex: none; }
  /* Titles fit: "Province management" no longer ends in an ellipsis. */
  .dialog-head h2 { font-size: 16px; letter-spacing: .06em; }
  /* Wide tables (provinces, nations) keep their columns and scroll sideways. */
  .row-list:has(> .lhead) { overflow-x: auto; overscroll-behavior-x: contain; }
  /* One shared column: every row is as wide as the widest, so columns line up. */
  .row-list:has(> .lhead) { display: grid; grid-template-columns: max-content; }
  .row-list:has(> .lhead) > .lrow { min-width: 100%; }
}
@media (max-width: 720px) {
  /* Lists without a header (armies, ranking, coalition) wrap their cells onto a
     second line instead of pushing the last columns out of the dialog. */
  .row-list:not(:has(> .lhead)) > .lrow[style*="grid-template-columns"] {
    display: flex !important; flex-wrap: wrap; column-gap: var(--s3); row-gap: var(--s1);
  }
  .row-list:not(:has(> .lhead)) > .lrow[style*="grid-template-columns"] > * { flex: 1 1 auto; min-width: 0; }
  .row-list:not(:has(> .lhead)) > .lrow[style*="grid-template-columns"] > :first-child { flex: none; }
}

/* Two side-by-side halves of a dialog (market, espionage); stacked on phones. */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .dialog-foot .btn { white-space: nowrap; }
}

/* Multiplayer: what went wrong, said calmly where the player is looking. */
.ms-problem { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.ms-problem .ic { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--acc); opacity: .85; }
.ms-problem .ic svg { width: 100%; height: 100%; }
.ms-problem span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; color: #b9b29d; }
.ms-problem b { font-family: var(--f-ui); font-size: 14px; font-weight: 600; letter-spacing: .01em; color: #f1ecd8; }
.mp-alert {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 10px;
  background: var(--paper-2); border: 1px solid var(--paper-line); border-radius: 2px;
  font-size: 12.5px; line-height: 1.35; color: var(--paper-strong);
}
.mp-alert .ic { flex: none; width: 16px; height: 16px; color: var(--paper-ink); }
.mp-alert span { flex: 1; min-width: 0; }
.mp-closed {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 7px 10px;
  background: var(--paper-2); border: 1px dashed var(--paper-line); font-size: 12.5px; font-weight: 600; color: var(--paper-strong);
}
.mp-closed .ic { width: 16px; height: 16px; flex: none; }
.mp-tag { font-style: normal; font-family: var(--f-ui); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 6px; margin-left: 4px; border-radius: 2px; color: var(--paper); background: var(--paper-ink); vertical-align: middle; }
.mp-grid .nation-opt.taken { filter: grayscale(.85); }
.mp-grid .nation-opt.taken .vp { font-style: italic; }


/* ------------------------------------------------------------- the war bar
   Us against them, flag to flag, at the top of the map while a war is on
   (ui/hud.js, updateWarBar). Their bar drains as their provinces fall. */
#war-bar {
  position: absolute; top: calc(var(--topbar-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 31;
  display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100% - 230px)); padding: 6px 10px;
  background: linear-gradient(180deg, rgba(30, 31, 36, .96), rgba(18, 19, 23, .96));
  border: 1px solid rgba(0, 0, 0, .8); border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 0 0 1px rgba(201, 169, 73, .28), 0 4px 14px rgba(0, 0, 0, .55);
  color: var(--text); cursor: pointer; transition: box-shadow .2s;
  animation: wb-in .35s cubic-bezier(.2, .9, .3, 1.2) both;
}
#war-bar[hidden] { display: none; }
#war-bar:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 0 0 1px rgba(201, 169, 73, .6), 0 4px 16px rgba(0, 0, 0, .6); }
#war-bar.fighting { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 0 0 1px rgba(214, 72, 52, .7), 0 0 18px rgba(214, 72, 52, .28), 0 4px 14px rgba(0, 0, 0, .55); }
#war-bar .wb-flag { flex: none; width: 36px; height: 24px; border: 1px solid rgba(0, 0, 0, .7); box-shadow: 0 0 0 1px rgba(201, 169, 73, .55); }
#war-bar .wb-flag.foe { box-shadow: 0 0 0 1px rgba(214, 72, 52, .8); }
#war-bar .wb-mid { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#war-bar .wb-names { display: flex; align-items: baseline; justify-content: center; gap: 7px; min-width: 0; font-family: var(--f-head); font-size: 14px; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
#war-bar .wb-names b { font-weight: 500; color: #ecd58a; overflow: hidden; text-overflow: ellipsis; }
#war-bar .wb-names b.foe { color: #f08a78; }
#war-bar .wb-names em { font-style: normal; font-size: 10px; letter-spacing: .14em; color: #9a957f; }
#war-bar .wb-more { font-style: normal; font-size: 11px; padding: 0 5px; border-radius: 8px; background: rgba(214, 72, 52, .25); color: #f3b3a6; }
#war-bar .wb-track { display: block; height: 5px; min-width: 190px; border-radius: 3px; background: rgba(236, 213, 138, .85); overflow: hidden; direction: rtl; }
#war-bar .wb-track i { display: block; height: 100%; background: linear-gradient(90deg, #a52b1c, #e0563f); transition: width .6s ease; }
#war-bar .wb-sub { display: flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--f-ui); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #b9b39c; white-space: nowrap; }
#war-bar.fighting .wb-sub { color: #f3b3a6; }
#war-bar .wb-live { width: 7px; height: 7px; border-radius: 50%; background: #e0563f; animation: tut-live 1.1s ease-out infinite; }
@keyframes wb-in { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } }
@media (max-width: 900px) {
  #war-bar { max-width: calc(100% - 120px); gap: 7px; padding: 5px 7px; }
  #war-bar .wb-flag { width: 26px; height: 18px; }
  #war-bar .wb-names { font-size: 12px; gap: 5px; }
  #war-bar .wb-track { min-width: 120px; }
  #war-bar .wb-sub { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) { #war-bar, #war-bar .wb-live { animation: none; } }


/* ------------------------------------------------------------ the menu hero
   A first visit opens on this: what the game is, in one line, and the one
   button that starts it (main.js, renderMenu). */
.m-hero {
  position: relative; margin: 0 0 12px; padding: 26px 24px 24px; text-align: center; overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 16, 19, .72), rgba(14, 16, 19, .93)), url(../assets/img-e0af07af/bg_menu.webp) center 30% / cover;
  border: 1px solid rgba(0, 0, 0, .8); box-shadow: inset 0 0 0 1px var(--acc-line), 0 6px 24px rgba(0, 0, 0, .5);
}
#menu[data-theme="2030"] .m-hero { background-image: linear-gradient(180deg, rgba(10, 14, 20, .7), rgba(10, 14, 20, .93)), url(../assets/img-e0af07af/bg_loading_2030.webp); }
.mh-kick { margin: 0 0 10px; font: 700 11px var(--f-ui); letter-spacing: .24em; text-transform: uppercase; color: var(--acc-hi); }
.mh-head { margin: 0; font-family: var(--f-head); font-weight: 700; font-size: clamp(26px, 4.6vw, 44px); line-height: 1.08; letter-spacing: .03em; text-transform: uppercase; color: #f4eed8; text-shadow: 0 2px 0 #17120a, 0 6px 22px rgba(0, 0, 0, .7); }
.mh-head em { font-style: normal; color: var(--acc-hi); }
.mh-sub { margin: 12px auto 0; max-width: 620px; font: 500 14.5px/1.5 var(--f-ui); color: #d5cfba; }
.mh-row { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; }
#menu .mh-go {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 230px; height: 62px; padding: 0 26px; border-radius: 2px;
  font-family: var(--f-ui); font-weight: 700; font-size: 21px; letter-spacing: .05em; text-transform: uppercase; color: var(--acc-ink);
  background: linear-gradient(180deg, var(--acc-hi), var(--acc) 55%, color-mix(in srgb, var(--acc) 70%, #000)); border-color: color-mix(in srgb, var(--acc) 45%, #000);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 4px 18px rgba(0, 0, 0, .5); transition: transform .12s var(--m-ease), box-shadow .25s;
  animation: mh-pulse 2.4s ease-in-out infinite;
}
#menu .mh-go:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 4px var(--acc-soft), 0 6px 24px rgba(0, 0, 0, .55); }
#menu .mh-go:active { transform: scale(.97); }
.mh-as { font: 500 13px var(--f-ui); color: #bdb8a6; }
.mh-as b { color: var(--acc-hi); font-weight: 700; }
@keyframes mh-pulse { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 6px var(--acc-soft), 0 4px 22px rgba(0, 0, 0, .5); } }
@media (max-width: 900px) {
  .m-hero { padding: 20px 14px 18px; margin-bottom: 10px; }
  .mh-sub { font-size: 13.5px; }
  #menu .mh-go { width: 100%; height: 56px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { #menu .mh-go { animation: none; } }

/* The line under the name on the loading screen. */
#loading .ld-tag { margin-top: 8px; font: 600 13px var(--f-ui); letter-spacing: .2em; text-transform: uppercase; color: #ece4c6; text-shadow: 0 1px 8px rgba(0, 0, 0, .9); }
/* What to do next, under the verdict on the end screen. */
.end-card p.end-next { margin-top: 4px; font-style: italic; opacity: .85; }


/* ------------------------------------------------------------------ the rank
   The player's career rank (ui/career.js): a chip by the victory points, a
   strip on the start menu, a bar on the end screen, a banner on promotion. */
.rank-chip { position: relative; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; background: var(--panel-solid); border-radius: 1px; cursor: default; white-space: nowrap; }
.rank-chip .rk-star { color: var(--gold); font-size: 13px; line-height: 1; }
.rank-chip .rk-name { font-family: var(--f-head); font-weight: 500; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: #e9e2c8; }
.rank-chip .rk-bar, .m-rank .rk-bar { display: block; width: 46px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.rank-chip .rk-bar i, .m-rank .rk-bar i { display: block; height: 100%; background: linear-gradient(90deg, #a8771c, #ffd34d); transition: width .7s cubic-bezier(.3, 0, .2, 1); }
.rank-chip.gain { animation: rk-gain .6s ease-out; }
.rank-chip .rk-pop { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); z-index: 60; pointer-events: none; padding: 2px 7px; border-radius: 3px; background: rgba(18, 16, 10, .92); border: 1px solid var(--brass); font: 700 12px var(--f-ui); letter-spacing: .04em; color: #ffe27a; animation: rk-pop 1.5s ease-out forwards; }
@keyframes rk-gain { 30% { box-shadow: 0 0 0 2px rgba(255, 211, 77, .7), 0 0 16px rgba(255, 211, 77, .45); } }
@keyframes rk-pop { 0% { opacity: 0; transform: translate(-50%, -6px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 4px) scale(1.08); } 70% { opacity: 1; transform: translate(-50%, 10px); } 100% { opacity: 0; transform: translate(-50%, 18px); } }
@media (max-width: 900px) {
  .rank-chip { flex: none; padding: 0 7px; gap: 4px; }
  .rank-chip .rk-name { font-size: 11px; max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
  .rank-chip .rk-bar { width: 26px; }
}

#rank-up {
  position: absolute; left: 50%; top: 30%; z-index: 41; pointer-events: none; opacity: 0;
  width: min(420px, calc(100vw - 32px)); padding: 14px 20px 16px; transform: translateX(-50%); text-align: center;
  background: rgba(18, 16, 10, .92); border: 1px solid #ffd34d; border-radius: 6px; box-shadow: 0 0 40px rgba(255, 211, 77, .28), 0 12px 40px rgba(0, 0, 0, .6);
}
#rank-up .k { font: 700 12px var(--f-ui); letter-spacing: .3em; text-transform: uppercase; color: var(--brass); }
#rank-up .t { margin-top: 4px; font-family: var(--f-head); font-size: 34px; letter-spacing: .06em; text-transform: uppercase; color: #fff4c0; text-shadow: 0 2px 0 #000; }
#rank-up .t span { color: #ffd34d; }
#rank-up .s { margin-top: 4px; font: 500 13px var(--f-ui); color: #cfc8ad; }
#rank-up.show { animation: streak-in .5s cubic-bezier(.2, 1.4, .4, 1) forwards; }
#rank-up.hide { animation: streak-out .4s ease-in forwards; }
@media (prefers-reduced-motion: reduce) { #rank-up.show { animation: none; opacity: 1; } .rank-chip.gain { animation: none; } }

/* On the start menu: the record the next war adds to. */
.m-rank { display: flex; align-items: center; gap: 12px 14px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 16px; background: rgba(14, 16, 19, .92); border: 1px solid rgba(0, 0, 0, .8); box-shadow: inset 0 0 0 1px var(--acc-line); }
.m-rank .rk-star { color: var(--acc-hi); font-size: 22px; line-height: 1; }
.m-rank .rk-txt { display: flex; flex-direction: column; gap: 2px; }
.m-rank .rk-txt b { font-family: var(--f-head); font-weight: 600; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; color: #f1ecd8; }
.m-rank .rk-txt i { font: 600 11px var(--f-ui); font-style: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--acc); }
.m-rank .rk-bar { flex: 1 1 120px; height: 6px; }
.m-rank .rk-stat { font: 500 12px var(--f-ui); color: #a9a38d; }

/* On the end screen: what this war added. */
.end-xp { width: min(360px, 86vw); margin: 10px auto 6px; padding: 10px 14px 12px; background: rgba(12, 12, 10, .72); border: 1px solid rgba(201, 169, 73, .5); border-radius: 4px; }
.end-xp.up { border-color: #ffd34d; box-shadow: 0 0 26px rgba(255, 211, 77, .25); }
.end-xp .ex-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.end-xp .ex-top b { font-family: var(--f-head); font-size: 24px; color: #ffd34d; }
.end-xp .ex-top span { font: 700 12px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: #ece4c6; }
.end-xp .ex-bar { margin-top: 8px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.end-xp .ex-bar i { display: block; height: 100%; background: linear-gradient(90deg, #a8771c, #ffd34d); animation: ex-fill 1.4s .5s cubic-bezier(.3, 0, .2, 1) backwards; }
@keyframes ex-fill { from { width: var(--from, 0%); } }
.end-xp .ex-next { margin-top: 6px; font: 500 12px var(--f-ui); color: #b9b39c; }

/* The next target, on the war bar. */
#war-bar .wb-sub b { font-weight: 700; color: #ecd58a; overflow: hidden; text-overflow: ellipsis; }
#war-bar .wb-aim { font-style: normal; color: #f3b3a6; }
#war-bar .wb-dim { font-style: normal; opacity: .8; }
@media (max-width: 900px) { #war-bar .wb-dim { display: none; } #war-bar .wb-sub b { max-width: 150px; } }
/* A narrow phone has no room in the top row for the rank's name: the star and its bar stay. */
@media (max-width: 480px) { .rank-chip .rk-name { display: none; } .rank-chip .rk-bar { width: 30px; } }

/* ------------------------------------------------------------ zoom ladder */
/* Four rungs over the minimap: how close the map is, and a press to any of
   the others (src/ui/zoomladder.js). */
#zoom-ladder {
  position: absolute; right: 6px; bottom: 157px; width: 232px; height: 24px; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: #000; border: 1px solid #000; border-radius: 2px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(130, 124, 103, .45), 0 2px 10px rgba(0, 0, 0, .6);
  transition: transform .3s cubic-bezier(.16, .84, .32, 1.06);
}
#zoom-ladder button {
  font-family: var(--f-head); font-size: 10.5px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: #a79f85;
  background: linear-gradient(#34363a, #26272b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: color .12s, filter .12s;
}
#zoom-ladder button:hover { color: var(--gold); filter: brightness(1.25); }
#zoom-ladder button.on {
  color: #18150e; font-weight: 600;
  background: linear-gradient(#e2c366, #a8862f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
@media (max-width: 1800px) {
  #app:has(#province-panel.open, #army-panel.open) #zoom-ladder { transform: translateY(calc(-1 * var(--bp-h) - 2px)); }
}
@container game (max-width: 1040px) { #zoom-ladder { bottom: 96px; } }
@media (max-height: 780px) { #zoom-ladder { bottom: 147px; width: 200px; } }
@media (max-height: 640px) { #zoom-ladder { bottom: 96px; } }
@container game (max-width: 640px) { #zoom-ladder { width: 176px; height: 22px; } #zoom-ladder button { font-size: 9px; letter-spacing: .06em; } }
@media (prefers-reduced-motion: reduce) { #zoom-ladder { transition: none; } }

/* The tutorial's buttons: the way straight back to the war in gold, the
   longer lesson beside it as the quieter choice. */
#tut-banner .tut-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#tut-banner .tut-go {
  color: #18150e; font-weight: 700;
  background: linear-gradient(#f0d275, #b08a2c); border-color: #5a4612;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 6px rgba(0, 0, 0, .35);
  animation: tut-go 1.6s ease-in-out infinite;
}
#tut-banner .tut-go:hover { filter: brightness(1.08); }
#tut-banner .tut-more { background: none; border-color: rgba(42, 36, 22, .45); color: #3d3622; box-shadow: none; }
#tut-banner .tut-more:hover { background: rgba(42, 36, 22, .1); }
@keyframes tut-go { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 0 0 4px rgba(201, 169, 73, .35), 0 2px 6px rgba(0, 0, 0, .35); } }
@media (prefers-reduced-motion: reduce) { #tut-banner .tut-go { animation: none; } }

/* ------------------------------------------------------- HUD finishing pass */
/* The map is seated under the interface instead of running flat to the glass:
   a soft shade down from the top bar, in from the rail and up from the foot.
   It never takes a click and sits under every control. */
#app::before {
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 8, 11, .5) 0, rgba(6, 8, 11, .22) calc(var(--topbar-h) + 26px), transparent calc(var(--topbar-h) + 96px)),
    linear-gradient(90deg, rgba(6, 8, 11, .38) 0, transparent 120px),
    linear-gradient(0deg, rgba(6, 8, 11, .42) 0, transparent 110px);
}

/* The rail names its buttons. An icon alone asks a new commander to guess;
   a word under it does not. The names are set here, by panel, so the rail's
   own markup stays as it was. */
#rail .rail-btn { grid-template-rows: 1fr auto; padding: 7px 0 6px; font-size: 25px; }
#rail .rail-btn::after {
  font-family: var(--f-head); font-size: 9.5px; font-weight: 500; line-height: 1;
  letter-spacing: .1em; text-transform: uppercase; color: #a39a7c;
  transition: color var(--t-fast);
}
#rail .rail-btn:hover::after, #rail .rail-btn.cur::after { color: var(--gold); }
#rail .rail-btn.on::after { color: #2a2410; }
#rail .rail-btn[data-panel="news"]::after { content: "News"; }
#rail .rail-btn[data-panel="diplomacy"]::after { content: "Allies"; }
#rail .rail-btn[data-panel="market"]::after { content: "Market"; }
#rail .rail-btn[data-panel="coalition"]::after { content: "Pact"; }
#rail .rail-btn[data-panel="espionage"]::after { content: "Spies"; }
#rail .rail-btn[data-panel="provinces"]::after { content: "Lands"; }
#rail .rail-btn[data-panel="construct"]::after { content: "Build"; }
#rail .rail-btn[data-panel="production"]::after { content: "Recruit"; }
#rail .rail-btn[data-panel="armies"]::after { content: "Armies"; }
#rail .rail-btn[data-panel="research"]::after { content: "Research"; }
#rail .rail-btn[data-panel="reports"]::after { content: "Reports"; }
#rail .rail-btn[data-panel="chat"]::after { content: "Wire"; }
/* A brass tick down the inner edge of whichever button the pointer is on. */
#rail .rail-btn::before {
  content: ""; position: absolute; right: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--brass); opacity: 0; transform: scaleY(.4);
  transition: opacity var(--t-fast), transform var(--t-fast);
}
#rail .rail-btn:hover::before { opacity: .9; transform: none; }
/* Where the rail is squeezed (short or narrow screens) the words go and the
   icons keep the room. */
@media (max-height: 780px) {
  #rail .rail-btn { padding: 0; font-size: 23px; grid-template-rows: 1fr; }
  #rail .rail-btn::after { content: none !important; }
}
@container game (max-width: 720px) {
  #rail .rail-btn { padding: 0; font-size: 20px; grid-template-rows: 1fr; }
  #rail .rail-btn::after { content: none !important; }
}

/* The bottom-right corner reads as one instrument: ladder, minimap, clock and
   speed all the same width and square to each other. */
#clock-chip { width: 232px; justify-content: flex-start; }
#speed-bar { width: 232px; }
#speed-bar .speed-btn { flex: 1; min-width: 0; }
@media (max-height: 780px) { #clock-chip, #speed-bar { width: 200px; } }
@container game (max-width: 640px) { #clock-chip, #speed-bar { width: auto; } #speed-bar .speed-btn { flex: none; min-width: 38px; } }

/* The despatch: a brass rule along its head and a deeper shadow, so it sits
   over the map as an object rather than a box. */
#tut-banner {
  border-top: 3px solid var(--brass);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .62), 0 2px 6px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .5);
}
@media (prefers-reduced-motion: reduce) { #rail .rail-btn::before { transition: none; } }
/* A phone held sideways: the despatch in the middle of so short a screen
   covered the very army it asked the player to select. It keeps to the left
   and is set smaller; the tutorial frames its target to the right of it
   (frame() in ui/tutorial.js). */
@media (max-height: 500px) and (orientation: landscape) {
  #tut-banner { left: 54px; transform: none; top: calc(var(--topbar-h) + 6px); min-width: 0; width: min(330px, 42vw); gap: 8px; padding: 8px 12px 10px 8px; }
  #tut-banner .tut-speaker { width: 40px; }
  #tut-banner .tut-face { width: 40px; height: 48px; }
  #tut-banner .tut-who { display: none; }
  #tut-banner .txt { font-size: 14px; line-height: 1.25; }
  #tut-banner .hint { font-size: 11.5px; line-height: 1.25; margin-top: 4px; }
  #tut-banner .tut-progress { margin: 1px 0 5px; width: 110px; }
  /* The menu down the left is taller than the screen: it scrolls, or its
     lower half (research, reports) cannot be reached at all. */
  #rail { top: calc(var(--topbar-h) + 4px); max-height: calc(100% - var(--topbar-h) - 8px); overflow-y: auto; scrollbar-width: none; }
  #rail::-webkit-scrollbar { display: none; }
  /* Dialogs get the height there is. Construction and recruitment stacked
     their province list (200px) over the units, which on a screen this short
     left the units no height at all: nothing could be built or recruited.
     Here the list stands beside them again, narrower. */
  .dialog { max-height: calc(100vh - 12px); }
  .bu-wrap { grid-template-columns: 180px 1fr; grid-template-rows: 1fr; height: calc(100vh - 66px); }
  .bu-side { border-right: 1px solid rgba(0, 0, 0, .6); border-bottom: 0; }
  body:has(#tutorial.on):has(#modal-layer.open) .dialog-body { padding-bottom: 0; }
  body:has(#tutorial.on):has(#modal-layer.open) .bu-main { padding-bottom: 190px; }
  body:has(#modal-layer.open) #tut-banner { bottom: 8px; }
}

/* ------------------------------------------------------- the menu's pages

   The menu is a few pages with one thing to do on each: the home page asks
   which game to play, and each game's own page has its one big button. */
.menu-back {
  display: inline-flex; align-items: center; gap: 8px; height: 60px; padding: 0 22px; cursor: pointer;
  font-family: var(--f-head); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
  color: #bdb8a6; background: transparent; border: 0; border-left: 1px solid rgba(255, 255, 255, .08); transition: background .2s, color .2s;
}
.menu-back:hover { color: #fff; background: rgba(255, 255, 255, .06); }

/* The navigation: one bar of tabs, on every page, the current one lit. It stays at the top while the
   page scrolls, so wherever you are the way to everywhere else is in the same place. */
.menu-top { position: sticky; top: 0; z-index: 30; }
#menu-tabs { display: flex; align-items: stretch; }
.menu-nav { display: flex; align-items: stretch; }
.menu-nav button {
  position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 60px; padding: 0 24px; cursor: pointer;
  font-family: var(--f-head); font-weight: 700; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  color: #bdb8a6; background: transparent; border: 0; border-left: 1px solid rgba(255, 255, 255, .08); transition: background .15s, color .15s;
}
.menu-nav button:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.menu-nav button[aria-current="page"] { color: var(--acc-ink); background: linear-gradient(180deg, var(--acc-hi), var(--acc)); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.menu-nav .ic { font-size: 18px; }
.menu-nav .dot { position: absolute; top: 11px; right: 11px; width: 9px; height: 9px; border-radius: 50%; background: #7fd65a; box-shadow: 0 0 0 2px rgba(14, 16, 19, .9), 0 0 8px #7fd65a; }
@media (max-width: 900px) {
  .menu-top { flex-direction: column !important; align-items: stretch !important; }
  .menu-brand { align-items: center !important; padding: 8px 12px 6px !important; }
  .menu-nav { width: 100%; border-top: 1px solid rgba(255, 255, 255, .08); }
  .menu-nav button { flex: 1 1 0; min-width: 0; min-height: 50px; padding: 0 4px; gap: 3px; flex-direction: column; justify-content: center; font-size: 10.5px; letter-spacing: .04em; border-left: 0; }
  .menu-nav button + button { border-left: 1px solid rgba(255, 255, 255, .08); }
  .menu-nav .ic { font-size: 17px; }
  .menu-nav .dot { top: 6px; right: calc(50% - 20px); }
}

/* Finding a match: one button that picks for you, then the list, the open wars first. */
.mp-quick { height: 50px; font-size: 17px; }
.mp-quickhint { margin: 6px 2px 12px; font-size: 12px; line-height: 1.4; color: var(--paper-ink); }
.mp-filter { display: flex; gap: 4px; margin-bottom: 8px; }
.mp-filter button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; cursor: pointer; border-radius: 3px;
  font: 700 11.5px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--paper-ink); background: rgba(255, 255, 255, .35); border: 1px solid var(--paper-line);
}
.mp-filter button i { font-style: normal; padding: 0 5px; border-radius: 8px; font-size: 10.5px; color: #e5e2d5; background: #4c4839; }
.mp-filter button.on { color: #e5e2d5; background: #2c2e33; border-color: #2c2e33; box-shadow: inset 0 -2px 0 var(--acc); }
.mp-filter button.on i { color: #241d0c; background: var(--acc); }
.mp-filter button:disabled { opacity: .45; cursor: default; }
.mp-filter .mp-newbtn { margin-left: auto; }
.mp-match .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.mp-bar { flex: 0 0 62px; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .22); overflow: hidden; }
.mp-bar i { display: block; height: 100%; background: var(--acc-dk); }
.mp-room { margin-left: auto; padding: 1px 7px; border-radius: 9px; font-size: 10.5px; font-weight: 700; color: #1c2a12; background: #a9d67c; }
.mp-match.mine { box-shadow: inset 4px 0 0 #5fa2d8; }
.menu-back .ic { font-size: 16px; }
.m-head { padding: 14px 12px 4px; text-align: center; }
.m-title {
  margin: 0; font-family: var(--f-head); font-weight: 700; font-size: clamp(24px, 4vw, 38px); line-height: 1.1; letter-spacing: .1em;
  text-transform: uppercase; color: #f4eed8; text-shadow: 0 2px 0 #17120a, 0 6px 22px rgba(0, 0, 0, .7);
}
.m-lede { margin: 6px 0 0; font: 500 14px/1.5 var(--f-ui); color: #cfc9b4; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mode-grid.two { grid-template-columns: repeat(2, 1fr); }
.mode-grid.four { grid-template-columns: repeat(4, 1fr); }
.mode-grid.four .mode-name { font-size: 26px; letter-spacing: .05em; }
.mode-grid.four .mode-text { min-height: 84px; }
.mode-grid.four .mode-cta { padding: 0 16px; }
@media (max-width: 1100px) and (min-width: 721px) { .mode-grid.four { grid-template-columns: repeat(2, 1fr); } .mode-grid.four .mode-card { min-height: 300px; } }
/* The cards show the games themselves: the picture is kept clear for longer before the text's shade begins. */
.mode-card[data-go="lines"] .mode-pic, .mode-card[data-go="rush"] .mode-pic { background-position: center top; background-size: auto 62%; }
.mode-card[data-go="lines"] .mode-pic::after, .mode-card[data-go="rush"] .mode-pic::after { background: linear-gradient(180deg, rgba(8, 9, 11, 0) 30%, rgba(8, 9, 11, .9) 58%, rgba(8, 9, 11, .98) 100%); }
.mode-card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 400px; padding: 0; overflow: hidden;
  text-align: left; cursor: pointer; color: #fff; background: #111; border: 2px solid rgba(255, 255, 255, .16); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55); transition: transform .2s var(--m-ease), border-color .2s, box-shadow .2s;
}
.mode-card:hover, .mode-card:focus-visible { transform: translateY(-5px); border-color: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft), 0 16px 40px rgba(0, 0, 0, .65); outline: 0; }
.mode-card:active { transform: scale(.985); }
.mode-pic { position: absolute; inset: 0; background: center/cover no-repeat; transition: transform .6s var(--m-ease); }
.mode-card:hover .mode-pic { transform: scale(1.06); }
.mode-pic::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 9, 11, .05) 20%, rgba(8, 9, 11, .78) 58%, rgba(8, 9, 11, .96) 100%); }
.mode-tag {
  position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 2px;
  font: 700 11px var(--f-head); font-style: normal; letter-spacing: .14em; text-transform: uppercase; color: var(--acc-ink); background: linear-gradient(180deg, var(--acc-hi), var(--acc));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
.mode-body { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 20px; }
.mode-kick { font: 700 10.5px var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--acc-hi); }
.mode-name { font-family: var(--f-head); font-weight: 700; font-size: 32px; line-height: 1; letter-spacing: .08em; text-transform: uppercase; text-shadow: 0 2px 0 #17120a; }
.mode-text { min-height: 63px; font: 500 13.5px/1.55 var(--f-ui); color: #d5cfba; }
.mode-cta {
  display: inline-flex; align-items: center; align-self: flex-start; height: 44px; margin-top: 8px; padding: 0 24px; border-radius: 3px;
  font-family: var(--f-head); font-weight: 600; font-size: 16px; letter-spacing: .1em; text-transform: uppercase;
  color: #241d0c; background: linear-gradient(180deg, #ecd47f 0%, #c9a949 52%, #8d7631 100%); border: 1px solid #5b4a17;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 2px 6px rgba(0, 0, 0, .5);
}
#menu[data-page="home"] .m-rank { margin-top: 2px; }

/* The Pocket Generals page opens as a title screen does: the game itself behind, its name struck in gold
   (the same lettering as its victory banner and the end of its reels), one line under it, one button. */
.lines-hero { padding-top: 26px !important; padding-bottom: 28px !important; background-image: linear-gradient(180deg, rgba(10, 9, 6, .5) 0%, rgba(10, 9, 6, .38) 40%, rgba(10, 9, 6, .9) 100%), radial-gradient(ellipse 66% 78% at 50% 42%, rgba(10, 9, 6, .84) 0%, rgba(10, 9, 6, .2) 100%), url(../assets/img-e0af07af/menu_pg_wide.webp) !important; background-position: center, center, center 55% !important; background-size: cover !important; }
.pg-logo { margin: 2px 0 10px; font: 700 clamp(40px, 8.4vw, 88px)/.96 var(--f-head); letter-spacing: .08em; text-transform: uppercase; }
.pg-logo::before { content: '★  ★  ★'; display: block; margin-bottom: 8px; font-size: 13px; letter-spacing: .5em; white-space: pre; color: #f2c84a; text-shadow: 0 0 10px rgba(255, 200, 80, .8); }
.pg-logo span { display: inline-block; color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(100deg, transparent 42%, rgba(255, 255, 255, .95) 50%, transparent 58%), linear-gradient(180deg, #fffbe0 0%, #ffe58a 30%, #f0b93a 55%, #9c6a16 80%, #f6d67a 100%);
  background-size: 300% 100%, 100% 100%; background-position: 140% 0, 0 0; background-repeat: no-repeat;
  filter: drop-shadow(0 3px 0 #2a1a03) drop-shadow(0 5px 0 rgba(0, 0, 0, .6)) drop-shadow(0 0 22px rgba(255, 180, 60, .45)); animation: pg-shine 5.5s ease-in-out 1s infinite; }
@keyframes pg-shine { 0% { background-position: 140% 0, 0 0; } 22%, 100% { background-position: -40% 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .pg-logo span { animation: none; } }
.lines-hero .mh-head { font-size: clamp(15px, 2.3vw, 23px); letter-spacing: .16em; }
.lines-hero .mh-kick { margin-bottom: 6px; }
#menu .lines-new { color: #d5cfba; }
.lines-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.lines-flag {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px 0 6px; cursor: pointer;
  font: 600 12.5px var(--f-ui); color: var(--paper-strong); background: rgba(255, 255, 255, .35); border: 1px solid var(--paper-line); border-radius: 3px;
}
.lines-flag:hover { background: rgba(255, 255, 255, .6); }
.lines-flag .sw { display: block; width: 26px; height: 17px; border: 1px solid rgba(0, 0, 0, .5); }
.lines-flag.on { background: #2c2e33; border-color: #2c2e33; color: #e5e2d5; box-shadow: inset 0 -2px 0 var(--acc); }
.lines-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lines-step span { display: block; height: 120px; margin-bottom: 8px; background: center/cover no-repeat; border: 1px solid var(--paper-ink); }
.lines-step b { font: 700 14px var(--f-head); letter-spacing: .08em; text-transform: uppercase; color: var(--paper-strong); }
.lines-step p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--paper-ink); }

/* The battlefields: a picture of each, what it is, and Use or its price in gold. */
.bf-wallet { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.bf-gold { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 3px; background: #2c2e33; color: #e5e2d5; font: 600 13px var(--f-ui); }
.bf-gold .ic { color: #e9c765; font-size: 17px; }
.bf-gold b { font: 600 17px var(--f-head); color: #fff3a8; letter-spacing: .03em; }
.bf-msg { font: 600 12.5px var(--f-ui); color: var(--paper-strong); }
/* Diamonds, and what marks a battlefield's worth: its tier and what goes on round it. */
.dia { display: inline-block; font-style: normal; font-size: 1.05em; line-height: 1; color: #7fe3ff; text-shadow: 0 0 8px rgba(110, 215, 255, .75), 0 1px 0 #0b3a52; transform: translateY(-.04em); }
.bf-gold .dia { font-size: 18px; }
.bf-gold b { color: #cdf3ff; }
.bf-ad .ic { font-size: 13px; }
.bf-pic { position: relative; }
.bf-tier { position: absolute; right: 8px; top: 8px; padding: 3px 9px 2px; border-radius: 3px; font: 700 11px var(--f-head); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; color: #10141a; background: #c9ced6; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.tier-rare .bf-tier { background: #6fb7ff; }
.tier-epic .bf-tier { background: #c58bff; }
.tier-legendary .bf-tier { background: linear-gradient(#ffe58a, #e0a030); }
.bf-card.tier-epic { box-shadow: inset 0 0 0 1px rgba(197, 139, 255, .45); }
.bf-card.tier-legendary { box-shadow: inset 0 0 0 1px rgba(255, 214, 110, .7), 0 0 22px rgba(255, 190, 80, .22); }
.bf-fx { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0 0; padding: 0; list-style: none; }
.bf-fx li { padding: 2px 7px; border-radius: 3px; font: 700 10.5px var(--f-ui); color: #1d4152; background: rgba(40, 140, 185, .14); box-shadow: inset 0 0 0 1px rgba(40, 140, 185, .38); }
.bf-packs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px; background: rgba(0, 0, 0, .07); border: 1px solid var(--paper-line); border-radius: 3px; }
.bf-pack {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; cursor: pointer; border-radius: 3px;
  color: #241d0c; background: linear-gradient(180deg, #ecd47f 0%, #c9a949 52%, #8d7631 100%); border: 1px solid #5b4a17;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 2px 5px rgba(0, 0, 0, .3);
}
.bf-pack:hover { filter: brightness(1.07); }
.bf-pack:disabled { filter: grayscale(.7); cursor: default; }
.bf-pack .ic { font-size: 20px; }
.bf-pack b { font: 700 18px var(--f-head); letter-spacing: .03em; }
.bf-pack span { font: 700 12.5px var(--f-ui); padding-left: 8px; border-left: 1px solid rgba(36, 29, 12, .4); }
.bf-fine { flex: 1 1 240px; margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--paper-ink); }
.bf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(226px, 1fr)); gap: 12px; }
.bf-card { display: flex; flex-direction: column; background: rgba(255, 255, 255, .4); border: 1px solid var(--paper-line); border-radius: 4px; overflow: hidden; }
.bf-card.on { border-color: #2c2e33; box-shadow: 0 0 0 2px #2c2e33, 0 4px 12px rgba(0, 0, 0, .25); }
.bf-pic { position: relative; display: block; aspect-ratio: 16 / 10; background: #23241f center/cover no-repeat; border-bottom: 1px solid var(--paper-ink); }
.bf-card.locked .bf-pic { filter: saturate(.8); }
.bf-pic i { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 2px; font: 700 10px var(--f-ui); font-style: normal; letter-spacing: .14em; text-transform: uppercase; color: #e5e2d5; background: rgba(20, 19, 15, .82); }
.bf-pic i.own { color: #1c2a12; background: #a9d67c; }
.bf-text { flex: 1; padding: 10px 12px 4px; }
.bf-text b { display: block; font: 700 16px var(--f-head); letter-spacing: .07em; text-transform: uppercase; color: var(--paper-strong); }
.bf-text em { display: block; margin-top: 1px; font: 700 10.5px var(--f-ui); font-style: normal; letter-spacing: .12em; text-transform: uppercase; color: var(--paper-ink); opacity: .8; }
.bf-text p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--paper-ink); }
.bf-act { display: flex; justify-content: flex-end; align-items: center; min-height: 45px; padding: 6px 12px 10px; }
.bf-act .btn .ic { font-size: 15px; margin-right: 3px; vertical-align: -2px; }
.bf-buy.short { opacity: .75; }
.bf-state { display: inline-flex; align-items: center; gap: 5px; font: 700 12px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--paper-strong); }

@media (max-width: 760px) {
  .mode-grid, .mode-grid.two, .mode-grid.four { grid-template-columns: 1fr; gap: 10px; }
  .mode-grid.four .mode-name { font-size: 30px; } .mode-grid.four .mode-text { min-height: 0; }
  .mode-card[data-go="lines"] .mode-pic, .mode-card[data-go="rush"] .mode-pic { background-size: cover; background-position: center 22%; }
  .mode-card[data-go="lines"] .mode-pic::after, .mode-card[data-go="rush"] .mode-pic::after { background: linear-gradient(180deg, rgba(8, 9, 11, .1) 0%, rgba(8, 9, 11, .82) 55%, rgba(8, 9, 11, .96) 100%); }
  .mode-card { min-height: 230px; }
  .mode-body { padding-top: 52px; }
  .mode-text { min-height: 0; }
  .mode-name { font-size: 26px; }
  .mode-cta { height: 40px; font-size: 15px; }
  .menu-back { padding: 0 14px; }
  .menu-back span:last-child { display: none; }
  .lines-steps { grid-template-columns: 1fr; }
  .lines-step { display: grid; grid-template-columns: 96px 1fr; column-gap: 10px; align-items: start; }
  .lines-step span { grid-row: 1 / 3; height: 70px; margin: 0; }
}
@media (max-width: 640px) {
  /* A game's page on a phone: the way back sits left of the logo, not under it. */
  #menu:not([data-page="home"]) .menu-top { flex-direction: row-reverse; justify-content: flex-end; align-items: stretch; }
  #menu:not([data-page="home"]) .menu-brand { align-items: flex-start; }
  .menu-back { height: auto; min-height: 56px; border-left: 0; border-right: 1px solid rgba(255, 255, 255, .08); }
}

/* ------------------------------------------------- rails that fit any window
   The left rail's entries give up height before any of them leaves the bottom
   of the window; if they would get too small to press, the rail scrolls. The
   advisor's portrait (a square stood on its corner) stays inside the right edge. */
#rail { bottom: 8px; max-height: none; pointer-events: none; overflow-y: auto; scrollbar-width: none; }
#rail::-webkit-scrollbar { display: none; }
#rail .rail-btn { pointer-events: auto; flex: 0 1 auto; min-height: 30px; }
#right-rail { right: 14px; max-height: calc(100% - var(--topbar-h) - 20px); }
@media (max-height: 520px) {
  #rail .rail-btn { padding: 0; grid-template-rows: 1fr; }
  #rail .rail-btn::after { content: none !important; }
  #right-rail { max-height: calc(100% - var(--topbar-h) - 150px); overflow-y: auto; scrollbar-width: none; gap: 5px; }
  #right-rail::-webkit-scrollbar { display: none; }
  #right-rail .portrait-btn { width: 44px; height: 44px; flex: none; margin: 8px 0; }
}

/* Between a tablet and a small laptop the seven resources no longer fit at full
   width: they share what room there is instead of running under the gold. */
@media (min-width: 721px) and (max-width: 1260px) {
  #resource-bar { flex: 1 1 0; min-width: 0; overflow: hidden; margin: 0 4px; }
  #resource-bar .res, #resource-bar .res[data-res] { flex: 1 1 0; width: auto; min-width: 0; overflow: hidden; gap: 4px; }
  #resource-bar .res .amt { font-size: 14px; white-space: nowrap; }
  #resource-bar .res .rate { font-size: 11px; }
}
@media (min-width: 721px) and (max-width: 1100px) {
  #resource-bar .res[data-res] .ic { display: none; }
}
/* A tablet or a phone on its side: the rank is a star, the bank is its icon,
   and each resource is its figure without the daily rate. */
@media (min-width: 721px) and (max-width: 1000px) {
  #hud-rank .rk-name, #hud-rank .rk-bar { display: none; }
  #bar-right [data-bank] span, #bar-right .bank-btn span { display: none; }
  #resource-bar .res .rate { display: none; }
  #resource-bar .res .amt { font-size: 14px; }
  .gold-chip { padding: 0 6px; gap: 5px; }
}
#end-card .end-more { margin: 18px 0 0; font-size: 13px; opacity: .8; }
#end-card .end-more a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; color: inherit; }

/* Fingers need more to hit than a pointer does: the small fields, ticks and links inside dialogs. */
@media (pointer: coarse) {
  .dialog input[type="text"], .dialog input[type="search"], .dialog input:not([type]) { min-height: 34px; }
  .dialog input[type="checkbox"] { width: 20px; height: 20px; }
  .dialog input[type="range"] { min-height: 28px; }
  .bu-card .icon-btn.sm { width: 30px; height: 30px; }
  .shop-legal a { display: inline-block; padding: 6px 4px; }
}

/* Short and very narrow screens: the map buttons on the right ran down under the clock, where they
   could not be pressed. They now stop above it and go on in a second column. */
@media (max-height: 600px) {
  #map-tools { max-height: calc(100% - var(--topbar-h) - 96px - 170px); flex-wrap: wrap-reverse; align-content: flex-start; gap: 6px; }
}
@media (max-height: 440px) {
  #map-tools { top: calc(var(--topbar-h) + 64px); max-height: calc(100% - var(--topbar-h) - 64px - 160px); }
}
@media (max-width: 340px) {
  #right-rail { top: calc(var(--topbar-h) + 90px); max-height: calc(100% - var(--topbar-h) - 90px - 130px); overflow-y: auto; scrollbar-width: none; }
  #map-tools { top: calc(var(--topbar-h) + 176px); max-height: calc(100% - var(--topbar-h) - 176px - 125px); }
}
