/* Swarājya: an old map, ink and saffron. */
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/cormorant-normal-300-700-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/cormorant-normal-300-700-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 300 700; font-display: swap; src: url(../fonts/cormorant-italic-300-700-latin.woff2) format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 300 600; font-display: swap; src: url(../fonts/jost-normal-300-600-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 300 600; font-display: swap; src: url(../fonts/jost-normal-300-600-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --ink: #2a1a0c; --ink2: #5a4026; --paper: #f4e7c8; --paper2: #ead8ae; --line: #b79a63; --saffron: #e8891d; --deep: #8a4a06; --indigo: #26365f; --leaf: #2f7a4d; --red: #a8322a; --gold: #c99a2e;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif; --sans: 'Jost', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: #1c1108; color: var(--ink); font-family: var(--sans); font-size: 15px; overflow: hidden; }
[hidden] { display: none !important; }
p, h1, h2, h3 { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--deep); font-weight: 600; }
.muted { color: var(--ink2); font-size: 13px; line-height: 1.45; }
.fine { font-size: 12px; color: var(--ink2); line-height: 1.4; }
.btn { padding: 9px 18px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .35); font-weight: 600; letter-spacing: .01em; transition: transform .12s ease-out, background .15s, border-color .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--saffron); border-color: var(--deep); color: #2a1404; box-shadow: 0 2px 0 var(--deep); }
.btn.primary:hover { background: #f59c33; }
.btn.ghost:hover { border-color: var(--deep); background: rgba(255, 255, 255, .6); }
.btn.small { padding: 5px 12px; min-height: 32px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.chip { padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink2); }
.chip.on { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }

/* ---- title ---- */
.screen { position: fixed; inset: 0; overflow: auto; }
#title { background: #1c1108; display: grid; align-items: center; }
.title-art { position: fixed; inset: 0; background: url(../art/title.webp) 62% 40% / cover no-repeat; }
.title-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(28, 17, 8, .93) 0%, rgba(28, 17, 8, .78) 38%, rgba(28, 17, 8, .12) 72%); }
.title-card { position: relative; width: min(100%, 760px); padding: clamp(18px, 4vw, 56px); color: #f6ead0; }
.title-card .eyebrow { color: #f0b45a; }
.title-card h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(54px, 9vw, 116px); line-height: .95; letter-spacing: -.01em; color: #fff3da; margin: 6px 0 12px; text-shadow: 0 3px 24px rgba(0, 0, 0, .5); }
.title-card .lead { font-family: var(--serif); font-size: clamp(17px, 1.9vw, 21px); line-height: 1.45; max-width: 58ch; color: #f2e3c2; }
.title-card .btn { color: #f6ead0; border-color: rgba(246, 234, 208, .4); background: rgba(0, 0, 0, .25); }
.title-card .fine { color: #d9c7a0; }
.powers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.power { text-align: left; padding: 11px 14px 12px; border-radius: 10px; border: 1px solid rgba(246, 234, 208, .28); background: rgba(20, 12, 6, .62); color: #f6ead0; display: grid; gap: 3px; border-left: 5px solid var(--c); transition: transform .14s ease-out, background .15s; }
.power:hover { background: rgba(40, 24, 10, .82); transform: translateY(-1px); }
.power b { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.power small { font-size: 12.5px; line-height: 1.4; color: #dbcaa6; }
.power .go { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #f0b45a; font-weight: 600; margin-top: 2px; }
@media (max-width: 640px) { .powers { grid-template-columns: 1fr; } }

/* ---- the campaign screen ---- */
#game { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr; background: #1c1108; }
#bar { display: flex; align-items: center; gap: 16px; padding: 6px 12px; background: linear-gradient(180deg, #3a2412, #2a1a0c); color: #f6ead0; border-bottom: 2px solid var(--gold); position: relative; z-index: 10; flex-wrap: wrap; }
#bar .who { display: flex; gap: 9px; align-items: center; min-width: 150px; }
#bar .who b { display: block; font-family: var(--serif); font-size: 19px; line-height: 1; }
#bar .who small { font-size: 11px; color: #d9c7a0; letter-spacing: .04em; }
#bar .year { min-width: 150px; }
#bar-year { font-family: var(--serif); font-size: 26px; line-height: 1; }
#bar-season { font-family: var(--serif); font-size: 17px; color: #f0b45a; font-style: italic; }
.timeline { display: flex; gap: 3px; margin-top: 4px; }
.timeline i { width: 9px; height: 5px; border-radius: 2px; background: rgba(246, 234, 208, .22); position: relative; overflow: hidden; }
.timeline i.past { background: #c99a2e; } .timeline i.now { background: rgba(255,255,255,.3); } .timeline i.now::after { content: ""; position: absolute; inset: 0; width: calc(var(--s, 0) * 100%); background: #fff; }
.stores { display: flex; gap: 12px; flex: 1; flex-wrap: wrap; }
.store { display: flex; align-items: center; gap: 6px; }
.store .ic { width: 28px; height: 28px; }
.store b { font-size: 16px; font-weight: 600; }
.store small { display: block; font-size: 10.5px; color: #cdbb93; line-height: 1; }
.store small.minus { color: #ff9a8a; }
.bar-books { display: flex; gap: 6px; flex-wrap: wrap; }
#bar .btn.ghost { color: #f6ead0; border-color: rgba(246, 234, 208, .35); background: transparent; position: relative; }
#bar .btn.ghost:hover { background: rgba(246, 234, 208, .12); }
#btn-tasks[data-n]:not([data-n=""])::after { content: attr(data-n); position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--saffron); color: #2a1404; font-size: 11px; line-height: 17px; }
.flag { display: inline-block; width: 14px; height: 18px; position: relative; flex: none; }
.flag::before { content: ""; position: absolute; left: 1px; top: 0; bottom: -4px; width: 2px; background: #3a2412; border-radius: 1px; }
.flag::after { content: ""; position: absolute; left: 3px; top: 0; width: 11px; height: 9px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); clip-path: polygon(0 0, 100% 0, 82% 50%, 100% 100%, 0 100%); }
.flag.swallow::after { clip-path: polygon(0 0, 100% 15%, 62% 38%, 100% 62%, 100% 85%, 0 100%); }
#bar-flag .flag { transform: scale(1.8); transform-origin: left center; margin-right: 18px; }
#hint { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); z-index: 6; max-width: min(80vw, 720px); padding: 4px 14px; border-radius: 999px; background: rgba(28, 17, 8, .82); color: #f6ead0; font-size: 12.5px; line-height: 1.35; text-align: center; pointer-events: none; }
#toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 12px); max-width: min(90vw, 620px); padding: 9px 16px; border-radius: 9px; background: rgba(28, 17, 8, .94); color: #f6ead0; border: 1px solid var(--gold); font-size: 14px; line-height: 1.4; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.ic { display: inline-block; width: 22px; height: 22px; background: url(../art/icons.webp) 0 0 / 400% 400% no-repeat; flex: none; }
.mi { display: block; width: 46px; height: 46px; background: url(../art/map_icons.webp) 0 0 / 400% 200% no-repeat; flex: none; }
.uicon { display: inline-block; flex: none; background-repeat: no-repeat; }
.owner { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; }
.task { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); align-items: start; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; }
.task.link:hover { background: rgba(255,255,255,.4); }
.task i { width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--line); }
.task.done i { background: var(--leaf); border-color: var(--leaf); box-shadow: inset 0 0 0 2px var(--paper); }
.task b { font-weight: 500; font-size: 14px; line-height: 1.35; }
.task small { display: block; color: var(--ink2); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.task em { font-style: normal; font-size: 12px; color: var(--deep); font-weight: 600; white-space: nowrap; }
.rec { padding: 12px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.rec > div:only-child { grid-column: 1 / -1; }
.rec .face { width: 72px; height: 72px; }
.rec .rt { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--deep); line-height: 1.15; margin-bottom: 4px; }
.rec .say { font-family: var(--serif); font-size: 17px; line-height: 1.5; }
.rec.big .face { width: 96px; height: 96px; }
.pg { font-family: var(--sans); font-size: 11px; color: var(--ink2); letter-spacing: .04em; margin-top: 4px; }
.news { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.45; }
.news b { color: var(--deep); font-weight: 600; margin-right: 8px; white-space: nowrap; }
.news.good { color: #1f5a37; } .news.bad { color: var(--red); } .news.link { cursor: pointer; } .news.link:hover { background: rgba(255,255,255,.4); }
.word { padding: 9px 0; border-bottom: 1px dashed var(--line); } .word b { font-family: var(--serif); font-size: 20px; color: var(--deep); } .word p { font-family: var(--serif); font-size: 16.5px; line-height: 1.45; }
h3.sec { font-family: var(--serif); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--deep); margin: 16px 0 6px; font-weight: 700; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 8px 0 4px; }
.tabs button { flex: 1; padding: 9px 4px; border: 0; background: transparent; font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink2); border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--saffron); }
.book { max-height: 62vh; overflow: auto; padding-right: 6px; }

/* the army chosen on the map */
#army-card { position: absolute; left: 12px; bottom: 54px; z-index: 8; width: min(360px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 10px; background: var(--paper) url(../art/map_paper.webp) 0 0 / 420px; border: 2px solid var(--gold); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.ac-head { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; }
.ac-head b { font-family: var(--serif); font-size: 20px; display: block; line-height: 1.1; } .ac-head small { font-size: 12px; color: var(--ink2); }
#army-card .actions { margin-top: 8px; } #army-card .actions .fine { margin-right: auto; }

/* the advisers in the corner */
#advisers { position: absolute; right: 12px; bottom: 12px; z-index: 8; width: min(430px, calc(100vw - 24px)); }
#advisers.quiet { width: auto; }
#advisers.quiet .btn { display: inline-flex; align-items: center; gap: 8px; } #advisers.quiet .mface { width: 30px; height: 30px; border-width: 1px; }
.adv { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: end; animation: rise .35s ease-out; }
.adv .mface { width: 92px; height: 92px; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.adv-body { position: relative; padding: 10px 12px 8px; border-radius: 12px 12px 12px 2px; background: #fbf3dc; border: 2px solid var(--gold); box-shadow: 0 10px 28px rgba(0,0,0,.45); }
.adv-body b { display: block; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--deep); }
.adv-body p { font-family: var(--serif); font-size: 16.5px; line-height: 1.38; margin-top: 3px; }
.adv-row { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 6px; } .adv-row small { margin-right: auto; font-size: 11px; color: var(--ink2); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.mface { background-image: url(../art/ministers.webp); background-size: 400% 300%; }

/* ---- the map ---- */
#map { position: relative; overflow: hidden; background: #2f5668; cursor: grab; }
#map.drag { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.world .relief { position: absolute; left: 0; top: 0; width: 1020px; height: 1294px; user-select: none; pointer-events: none; }
.world .tint { position: absolute; left: 0; top: 0; image-rendering: auto; opacity: .34; mix-blend-mode: multiply; filter: blur(2.4px) saturate(1.5); pointer-events: none; }
.world svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.marks { position: absolute; inset: 0; }
.pl { position: absolute; transform: translate(-50%, -62%) scale(var(--k, 1)); display: grid; justify-items: center; cursor: pointer; }
.pl .mi { width: 46px; height: 46px; filter: drop-shadow(0 3px 2px rgba(30, 15, 0, .55)); transition: transform .12s ease-out; }
.pl:hover .mi { transform: scale(1.1); }
.pl > .flag { position: absolute; top: -12px; left: calc(50% + 4px); transform: scale(1.15); transform-origin: left bottom; z-index: 1; }
.pl .nm { margin-top: -5px; padding: 0 6px 1px; font-family: var(--serif); font-size: 14.5px; font-weight: 700; line-height: 1.15; color: var(--ink); background: rgba(250, 240, 214, .9); border-radius: 3px; border-bottom: 3px solid var(--c); white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.pl.mine .nm { background: #fff8e6; }
.world.far .pl .nm { font-size: 13px; }
.pl .tag { position: absolute; top: -6px; right: -18px; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 999px; background: var(--red); color: #fff; white-space: nowrap; }
.pl .tag.coin { background: var(--gold); color: #2a1404; right: auto; left: -20px; }
.pl .tag.seat { background: var(--ink); color: #f6ead0; top: auto; bottom: -15px; right: auto; }
.pl .tag.work { background: var(--leaf); right: auto; left: -18px; top: 14px; }
.pl.can .mi { filter: drop-shadow(0 0 5px #b4ffcf) drop-shadow(0 0 2px #0a4f2a); }
.pl.hit .mi { filter: drop-shadow(0 0 6px #ff6a5a) drop-shadow(0 0 2px #5a0a0a); }
.pl.hit .nm { border-bottom-color: #d6392b; box-shadow: 0 0 0 2px #d6392b; }
.pl.target::before { content: ""; position: absolute; top: -2px; width: 58px; height: 58px; border-radius: 50%; border: 2px dashed var(--saffron); animation: turn 14s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
/* an army: a few soldiers together under their flag */
.ar { position: absolute; transform: translate(-50%, -78%) scale(var(--k, 1)); cursor: pointer; display: grid; justify-items: center; transition: filter .15s; }
.ar.moving { transition: left .07s linear, top .07s linear; }
.ar.gliding { transition: left .5s ease-in-out, top .5s ease-in-out; }
.grp { position: relative; width: 44px; height: 34px; transform: scale(var(--g, 1)); transform-origin: 50% 100%; }
.grp::before { content: ""; position: absolute; left: 4px; right: 4px; bottom: -2px; height: 8px; border-radius: 50%; background: rgba(20, 10, 0, .35); }
.grp .uicon { position: absolute; bottom: 0; filter: drop-shadow(0 1px 0 rgba(255,255,255,.6)) drop-shadow(0 0 1px var(--c)); }
.grp .s0 { left: 0; z-index: 2; } .grp .s1 { left: 14px; bottom: 4px; z-index: 1; } .grp .s2 { left: 24px; z-index: 3; }
.grp.sea { width: 50px; } .grp.sea .uicon { left: 0; }
.ar > .flag { position: absolute; top: -12px; left: 2px; transform: scale(1.1); transform-origin: left bottom; z-index: 4; }
.ar .n { position: absolute; right: -6px; bottom: -4px; min-width: 16px; font-size: 10.5px; font-weight: 700; padding: 0 4px; border-radius: 999px; background: var(--c); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); text-align: center; z-index: 5; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.ar.mine .grp::before { background: rgba(255, 250, 230, .55); box-shadow: 0 0 0 1.5px #fff; }
.ar.sel .grp::before { background: rgba(255, 214, 120, .8); box-shadow: 0 0 0 2px #fff, 0 0 10px 3px var(--saffron); }
.ar.spent { filter: grayscale(.65) brightness(.88); }
.ar.hit .grp::before { background: rgba(214, 57, 43, .6); box-shadow: 0 0 0 2px #ffb0a8, 0 0 10px 2px #d6392b; }
.ar.can .grp::before { box-shadow: 0 0 0 2px #b4ffcf; }
.ar .who { position: absolute; top: -26px; white-space: nowrap; font-size: 10.5px; font-weight: 600; padding: 0 5px; border-radius: 4px; background: rgba(28, 17, 8, .85); color: #f6ead0; }
.lbl { position: absolute; transform: translate(-50%, -50%) scale(var(--k, 1)); font-family: var(--serif); font-style: italic; font-size: 12px; color: rgba(60, 40, 20, .8); white-space: nowrap; pointer-events: none; text-shadow: 0 0 3px rgba(255,248,225,.9); }
.lbl.sea { color: rgba(225, 240, 245, .75); font-size: 18px; letter-spacing: .35em; text-shadow: none; }
.lbl.river { color: #23596b; font-size: 11px; transform: translate(-50%, -50%) rotate(var(--a)) scale(var(--k, 1)); }
.world.far .lbl.river { opacity: .0; }
.zoom { position: absolute; right: 12px; top: 12px; display: grid; gap: 4px; z-index: 7; }
.zoom button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-size: 18px; font-weight: 600; }
.mini { position: absolute; left: 12px; top: 12px; z-index: 7; width: 118px; padding: 4px; border-radius: 6px; background: #3a2412; border: 2px solid var(--gold); box-shadow: 0 6px 18px rgba(0,0,0,.45); cursor: pointer; }
.mini canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.mini .view { position: absolute; margin: 4px; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #000; pointer-events: none; }
.legend { position: absolute; left: 12px; bottom: 12px; z-index: 7; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: 46%; padding: 5px 10px; border-radius: 8px; background: rgba(250, 240, 214, .92); font-size: 11.5px; }
.legend .flag { margin-right: 2px; }
.tip { position: absolute; z-index: 9; padding: 2px 8px; border-radius: 5px; background: rgba(28,17,8,.88); color: #f6ead0; font-size: 12px; pointer-events: none; white-space: nowrap; }

/* ---- the town screen ---- */
#town { z-index: 30; background: #1c1108; }
#town-hero { position: relative; height: min(46vh, 420px); background: center 60% / cover no-repeat; border-bottom: 3px solid var(--gold); }
#town-hero .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(28,17,8,.1) 40%, rgba(28,17,8,.85)); }
#town-title { position: absolute; left: clamp(16px, 4vw, 48px); bottom: 18px; display: flex; gap: 12px; align-items: flex-end; color: #fff3da; }
#town-title .flag { transform: scale(2.2); transform-origin: left bottom; margin-right: 22px; margin-bottom: 30px; }
#town-title h2 { font-family: var(--serif); font-size: clamp(38px, 6vw, 64px); line-height: .95; font-weight: 600; text-shadow: 0 3px 20px rgba(0,0,0,.6); }
#town-title .sub { font-size: 14px; color: #f0dcb0; margin-top: 4px; }
#town-close { position: absolute; right: clamp(16px, 4vw, 48px); top: 18px; }
#town-body { background: var(--paper) url(../art/map_paper.webp) 0 0 / 420px; min-height: 54vh; padding: 18px clamp(16px, 4vw, 48px) 40px; }
.town-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 1200px; margin: 0 auto; }
@media (max-width: 860px) { .town-cols { grid-template-columns: 1fr; } }
.yields { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; } .yields span { display: inline-flex; align-items: center; gap: 4px; }
.built { display: flex; flex-wrap: wrap; gap: 6px; } .chip-b { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border-radius: 999px; background: rgba(255,255,255,.55); border: 1px solid var(--line); font-size: 13px; }
.progress { position: relative; display: flex; gap: 8px; align-items: center; padding: 8px 10px 12px; margin-top: 8px; border-radius: 8px; background: rgba(255,255,255,.55); border: 1px solid var(--line); font-weight: 600; }
.progress > i:last-child { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 4px; border-radius: 2px; background: rgba(0,0,0,.15); }
.progress > i:last-child::after { content: ""; display: block; height: 100%; width: var(--n); background: var(--leaf); border-radius: 2px; }
.army-box { margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .4); }
.army-box header { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.army-box header small { font-weight: 400; color: var(--ink2); }
.units { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.unit { position: relative; width: 52px; padding: 2px 2px 8px; border: 1px solid transparent; border-radius: 6px; background: rgba(255, 255, 255, .55); text-align: center; }
.unit:disabled { cursor: default; opacity: 1; }
.unit.pick { border-color: var(--deep); background: #ffe2b4; box-shadow: 0 0 0 2px rgba(232,137,29,.4); }
.unit .bar, .bt-unit .bar { position: absolute; left: 4px; right: 4px; bottom: 2px; height: 3px; background: rgba(0, 0, 0, .18); border-radius: 2px; }
.unit .bar::after, .bt-unit .bar::after { content: ""; display: block; height: 100%; width: var(--n, 100%); background: var(--leaf); border-radius: 2px; }
.unit .xp { position: absolute; right: 2px; top: 0; font-size: 9px; color: var(--gold); }
.opt { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 7px 10px; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .5); }
.opt:hover:not(:disabled) { border-color: var(--deep); background: rgba(255, 255, 255, .85); }
.opt:disabled { opacity: .55; cursor: not-allowed; }
.opt b { font-size: 14px; font-weight: 600; display: block; }
.opt small { font-size: 12px; color: var(--ink2); line-height: 1.35; display: block; }
.opt .cost { font-size: 12.5px; font-weight: 600; white-space: nowrap; text-align: right; color: var(--deep); }
.opt .ic { width: 32px; height: 32px; }
.field { display: block; width: 100%; margin: 10px 0; padding: 10px 12px; font: inherit; border-radius: 8px; border: 1px solid #b79a63; background: rgba(255,255,255,.7); }
.fact { font-family: var(--serif); font-size: 16px; line-height: 1.38; }

/* ---- sheets over the game: the record, the council, the end of an age ---- */
#modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 14px; background: rgba(20, 12, 6, .62); overflow: auto; }
.sheet { width: min(100%, 720px); max-height: 100%; overflow: auto; padding: clamp(16px, 3vw, 28px); background: var(--paper) url(../art/map_paper.webp) 0 0 / 420px; border: 2px solid var(--gold); border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.sheet.wide { width: min(100%, 900px); }
.sheet h2 { font-family: var(--serif); font-size: clamp(26px, 3.6vw, 38px); line-height: 1.05; font-weight: 600; margin: 4px 0 10px; }
.sheet .say { font-family: var(--serif); font-size: clamp(17px, 1.9vw, 20px); line-height: 1.45; }
.sheet .story + .story { margin-top: 10px; } .sheet .story.you { margin-top: 12px; padding: 8px 12px; border-left: 3px solid var(--saffron); background: rgba(255,255,255,.4); font-style: italic; }
.choice.best { border-color: #8a4a06; }
.council { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } @media (max-width: 640px) { .council { grid-template-columns: 1fr; } }
.sheet .banner { margin: -28px -28px 14px; height: 170px; background: center / cover no-repeat; border-radius: 10px 10px 0 0; border-bottom: 2px solid var(--gold); }
.with-face { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; }
.face { width: 96px; height: 96px; border-radius: 10px; border: 2px solid var(--gold); background: url(../art/portraits.webp) 0 0 / 400% 400% no-repeat; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); }
.record-box { margin-top: 12px; padding: 10px 12px; border-left: 4px solid var(--gold); background: rgba(255, 255, 255, .5); border-radius: 0 8px 8px 0; }
.record-box .eyebrow { margin-bottom: 3px; }
.choice { display: block; width: 100%; text-align: left; margin-top: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, .5); font-family: var(--serif); font-size: 18px; line-height: 1.35; }
.choice:hover:not(:disabled) { border-color: var(--deep); background: #fff; }
.choice.right { border-color: var(--leaf); background: #dcf1df; } .choice.wrong { border-color: var(--red); background: #f7dcd7; }
.verdict { margin-top: 10px; font-weight: 600; } .verdict.good { color: #1f5a37; } .verdict.bad { color: var(--red); }
.stars { font-size: 38px; letter-spacing: .08em; color: var(--gold); } .stars i { font-style: normal; opacity: .25; } .stars i.on { opacity: 1; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } @media (max-width: 640px) { .cols2 { grid-template-columns: 1fr; } }
.board ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.board li { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; padding: 4px 8px; border-radius: 6px; background: rgba(255, 255, 255, .45); font-size: 14px; }
.board li.me { background: #ffe2b4; font-weight: 600; box-shadow: inset 0 0 0 1px var(--deep); }
.board .rank { color: var(--deep); font-weight: 700; }
.minister { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .45); align-items: center; }
.minister .mface { width: 72px; height: 72px; } .minister b { font-family: var(--serif); font-size: 20px; display: block; } .minister em { display: block; font-size: 12px; color: var(--deep); font-style: normal; font-weight: 600; } .minister small { display: block; font-size: 12.5px; color: var(--ink2); margin: 2px 0 6px; }
.minister.has { border-color: var(--leaf); background: #e3f1e0; }

/* ---- the battle ---- */
#battle { position: fixed; inset: 0; z-index: 35; background: #1c1108; overflow: auto; }
.bt { min-height: 100%; display: grid; grid-template-rows: auto auto 1fr auto; padding: 10px 14px 12px; color: #f6ead0; gap: 6px; }
.bt-head .eyebrow { color: #f0b45a; } .bt-head h2 { font-family: var(--serif); font-size: clamp(22px, 3vw, 32px); font-weight: 600; }
.bt-hint { font-size: 14px; color: #e6d6b2; min-height: 20px; }
.bt-body { display: grid; grid-template-columns: 1fr minmax(230px, 300px); gap: 12px; min-height: 0; align-items: start; }
.bt-stage { position: relative; border: 2px solid var(--gold); border-radius: 8px; overflow: hidden; background: #33421f; align-self: start; }
.bt-stage canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.bt-side { background: var(--paper) url(../art/map_paper.webp) 0 0 / 420px; color: var(--ink); border-radius: 8px; padding: 10px; max-height: calc(100vh - 170px); overflow: auto; }
.bt-roster { display: grid; gap: 4px; margin: 6px 0 12px; }
.bt-unit { position: relative; display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; text-align: left; padding: 3px 8px 8px 4px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .5); }
.bt-unit.on { border-color: var(--deep); background: #ffe2b4; } .bt-unit.out { border-style: dashed; }
.bt-unit b { display: block; font-size: 13.5px; } .bt-unit small { font-size: 11.5px; color: var(--ink2); }
.bt-orders { display: grid; gap: 4px; margin-top: 6px; }
.bt-order { text-align: left; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .5); }
.bt-order.on { border-color: var(--indigo); background: #dfe6fa; } .bt-order:disabled { opacity: .5; }
.bt-order b { display: block; font-size: 13.5px; } .bt-order small { font-size: 11.5px; color: var(--ink2); line-height: 1.3; display: block; }
.bt-wait { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 12px; }
.bt-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bt-foot .btn.ghost { color: #f6ead0; border-color: rgba(246, 234, 208, .4); background: transparent; }
.bt-speeds { display: flex; gap: 5px; } .bt-speeds .chip { color: #f6ead0; border-color: rgba(246, 234, 208, .4); } .bt-speeds .chip.on { background: var(--saffron); border-color: var(--saffron); color: #2a1404; }
.bt-status { font-size: 13px; color: #d9c7a0; margin-left: auto; }
.bt-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); padding: 14px 30px 16px; border-radius: 12px; text-align: center; background: rgba(28, 17, 8, .9); border: 2px solid var(--gold); color: #fff3da; display: grid; gap: 4px; }
.bt-banner b { font-family: var(--serif); font-size: 46px; line-height: 1; } .bt-banner.won b { color: #ffd27a; } .bt-banner.lost b { color: #ff9a8a; }
@media (max-width: 900px) { .bt-body { grid-template-columns: 1fr; } .stores { gap: 8px; } .adv .mface { width: 64px; height: 64px; } .adv { grid-template-columns: 64px 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.face.mface { background: url(../art/ministers.webp) 0 0 / 400% 300% no-repeat; }
.pl.lw .nm { position: absolute; right: 78%; top: 38%; margin: 0; }

/* ---- attack pointer, soldier counts and army options ---- */
/* crossed swords: red where the chosen army can attack this season, grey where the enemy is out of reach */
.pl.hit, .ar.hit { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M4 4 21 21M28 4 11 21M17 25l8-8M15 25 7 17M22 22l6 6M10 22l-6 6' stroke='%23180c04' stroke-width='5.5'/%3E%3Cpath d='M4 4 21 21M28 4 11 21' stroke='%23ff4a36' stroke-width='2.8'/%3E%3Cpath d='M17 25l8-8M15 25 7 17M22 22l6 6M10 22l-6 6' stroke='%23ffd166' stroke-width='2.6'/%3E%3C/g%3E%3C/svg%3E") 16 16, crosshair; }
.pl.nohit, .ar.nohit { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M4 4 21 21M28 4 11 21M17 25l8-8M15 25 7 17M22 22l6 6M10 22l-6 6' stroke='%23180c04' stroke-width='5.5'/%3E%3Cpath d='M4 4 21 21M28 4 11 21M17 25l8-8M15 25 7 17M22 22l6 6M10 22l-6 6' stroke='%23b9b2a4' stroke-width='2.6'/%3E%3C/g%3E%3C/svg%3E") 16 16, not-allowed; }
.pl.hit:hover .mi { transform: scale(1.12); } .ar.hit:hover .grp { transform: scale(calc(var(--g, 1) * 1.12)); }
.ar .n { right: auto; left: 50%; bottom: -15px; transform: translateX(-50%); white-space: nowrap; padding: 0 6px; font-size: 10.5px; line-height: 15px; }
.store.force { padding-left: 12px; border-left: 1px solid rgba(246, 234, 208, .25); gap: 12px; }
.store.force .flag { transform: scale(1.4); transform-origin: left center; }
.unit { padding-bottom: 9px; } .unit .cnt { display: block; margin-top: -3px; font-size: 10.5px; font-weight: 700; line-height: 1.1; color: var(--ink); }
.ac-count { margin-top: 6px; font-size: 14px; font-weight: 700; color: var(--deep); }
.ac-state { margin-top: 8px; padding: 4px 8px; border-radius: 6px; font-size: 13px; font-weight: 600; background: rgba(0, 0, 0, .08); color: var(--ink2); }
.ac-state.ok { background: #dcf1df; color: #1f5a37; }
#army-card { max-height: calc(100vh - 130px); overflow: auto; width: min(380px, calc(100vw - 24px)); }
#army-card .fine { margin-top: 6px; }
.ac-opts { display: grid; gap: 5px; margin-top: 8px; }
.ac-opt { display: block; width: 100%; text-align: left; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .6); }
.ac-opt:hover:not(:disabled) { border-color: var(--deep); background: #fff; }
.ac-opt:disabled { opacity: .5; cursor: not-allowed; }
.ac-opt b { display: block; font-size: 14px; font-weight: 600; } .ac-opt small { display: block; font-size: 12px; color: var(--ink2); line-height: 1.3; }
.choice.off { opacity: .55; cursor: not-allowed; }
.war-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.war-row b { display: block; font-size: 15px; font-weight: 600; } .war-row small { display: block; font-size: 12.5px; color: var(--ink2); } .war-row em { font-style: normal; }
/* the bar stays on one row on a laptop screen */
#bar { gap: 12px; } #bar .who, #bar .year { min-width: 136px; }
.stores { flex-wrap: nowrap; gap: 9px; flex: 1 1 auto; min-width: 0; } .store { gap: 4px; } .store .ic { width: 24px; height: 24px; } .store b { font-size: 15px; } .store small { font-size: 10px; white-space: nowrap; }
.store.force { padding-left: 9px; gap: 9px; }
.bar-books { gap: 4px; flex-wrap: nowrap; } #bar .bar-books .btn.small { padding-left: 9px; padding-right: 9px; }
@media (max-width: 1180px) { .stores { flex-wrap: wrap; } }

/* ---- the map: no dragging, sharp at any zoom ---- */
#map { cursor: default; }
/* no will-change here: with it the browser keeps the first, small drawing of the map and stretches it when the player zooms */
.world { will-change: auto; }
.world .tiles { position: absolute; left: 0; top: 0; pointer-events: none; }
.world .tiles img { position: absolute; display: block; user-select: none; }
.world svg .ln { fill: none; }
.world svg .b1 { stroke-width: calc(2.2px * var(--ln, 1)); }
.world svg .b2 { stroke-width: calc(0.9px * var(--ln, 1)); stroke-dasharray: calc(3px * var(--ln, 1)) calc(2.2px * var(--ln, 1)); }
.world svg .r1 { stroke-width: calc(1.1px * var(--ln, 1)); } .world svg .r2 { stroke-width: calc(0.45px * var(--ln, 1)); }
.world svg .h1 { stroke-width: calc(2.6px * var(--ln, 1)); } .world svg .h2 { stroke-width: calc(1.3px * var(--ln, 1)); stroke-dasharray: calc(3px * var(--ln, 1)) calc(2.4px * var(--ln, 1)); }
.bt-sure { display: inline-flex; gap: 8px; align-items: center; color: #ffd9c9; } .bt-sure b { font-weight: 600; font-size: 14px; }
.bt-foot .bt-status { margin-left: auto; }

/* ---- the battle: time, health and morale on the right while it runs ---- */
.bt-side.live { display: grid; gap: 4px; align-content: start; }
.lbar { height: 12px; border-radius: 6px; background: rgba(0, 0, 0, .18); overflow: hidden; }
.lbar i { display: block; height: 100%; width: var(--n, 100%); border-radius: 6px; transition: width .2s linear; }
.lbar.hp i { background: #3f9a52; } .lbar.mo i { background: #d9a520; } .lbar.time i { background: #c0563a; }
.bt-side.live > small { font-size: 12px; color: var(--ink2); line-height: 1.3; }
.larmy { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .55); border-left: 6px solid var(--c); display: grid; gap: 3px; }
.larmy b { font-family: var(--serif); font-size: 20px; line-height: 1.1; }
.larmy small { font-size: 12px; color: var(--ink2); line-height: 1.3; } .larmy .lstate { margin-top: 3px; color: var(--ink); }
.llab { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink2); margin-top: 4px; font-weight: 600; }
.bt-side.live .eyebrow { margin-top: 8px; }
.lrows { display: grid; gap: 4px; }
.lrow { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: center; padding: 3px 6px; border-radius: 6px; background: rgba(255, 255, 255, .45); }
.lrow.out { opacity: .5; }
.lrow b { font-size: 12.5px; font-weight: 600; } .lrow small { font-size: 11px; color: var(--ink2); margin-left: 6px; } .lrow .lbar { height: 5px; margin-top: 2px; }
.bt-banner em { font-style: normal; font-size: 15px; max-width: 560px; line-height: 1.35; color: #ffe9c4; }
.bt-banner span { font-size: 13.5px; max-width: 560px; opacity: .9; }

/* ---- the town screen ---- */
#town-hero { height: min(50vh, 460px); }
.plan { position: absolute; z-index: 1; right: clamp(16px, 4vw, 48px); bottom: 14px; max-width: 56%; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.plot { display: grid; justify-items: center; align-content: start; gap: 2px; width: 86px; padding: 6px 4px 5px; border-radius: 10px; background: rgba(28, 17, 8, .66); border: 1px solid rgba(255, 214, 120, .7); color: #fff3da; text-align: center; }
.plot .ic { width: 50px; height: 50px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); }
.plot span { font-size: 10.5px; line-height: 1.15; }
.plot.work { border-style: dashed; } .plot.work .ic { filter: grayscale(.85) opacity(.7); }
@media (max-width: 900px) { .plan { position: static; max-width: none; justify-content: flex-start; padding: 8px 16px; background: #1c1108; } #town-hero { height: auto; min-height: 300px; display: flex; flex-direction: column; justify-content: flex-end; } }
.town-stats { display: flex; flex-wrap: wrap; gap: 10px; max-width: 1200px; margin: 0 auto 6px; }
.stat { display: flex; gap: 9px; align-items: center; padding: 8px 14px 8px 10px; border-radius: 10px; background: #fff8e6; border: 1px solid var(--gold); box-shadow: 0 2px 6px rgba(60, 30, 0, .15); }
.stat .ic { width: 36px; height: 36px; } .stat .flag { transform: scale(1.5); margin: 0 8px 0 4px; }
.stat b { display: block; font-family: var(--serif); font-size: 22px; line-height: 1; } .stat small { font-size: 11.5px; color: var(--ink2); }
.pips { display: inline-flex; gap: 3px; margin-left: 2px; } .pips i { width: 9px; height: 18px; border-radius: 2px; background: rgba(0, 0, 0, .15); } .pips i.on { background: var(--deep); }
.town-alert { max-width: 1200px; margin: 0 auto 8px; }
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 8px; }
.bcard { display: grid; gap: 8px; align-content: start; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(180deg, #fffaf0, #f6e7c4); box-shadow: 0 2px 5px rgba(60, 30, 0, .12); transition: transform .12s, box-shadow .12s, border-color .12s; }
.bcard:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--deep); box-shadow: 0 8px 18px rgba(60, 30, 0, .22); }
.bcard.off { opacity: .66; cursor: not-allowed; }
.bhead { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; } .bhead .ic { width: 56px; height: 56px; }
.bhead b { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.1; } .bhead small { display: block; font-size: 12px; color: var(--ink2); line-height: 1.35; margin-top: 2px; }
.perks { display: flex; flex-wrap: wrap; gap: 5px; }
.perk { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: #e3f1e0; border: 1px solid #b5d6b0; font-size: 12px; font-weight: 600; color: #1f5a37; line-height: 1.25; }
.perk .ic { width: 18px; height: 18px; margin-left: -4px; } .perk .uicon { margin-left: -4px; }
.perk.troop { background: #e6ecf7; border-color: #b9c6e2; color: #263a66; } .perk.star { background: #fff0c2; border-color: var(--gold); color: #6b4300; }
.bfoot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink2); border-top: 1px dashed var(--line); padding-top: 6px; } .bfoot .cost { font-weight: 700; color: var(--deep); }
.bcard .why { font-size: 12px; color: var(--red); font-weight: 600; }
.opt.star { border: 2px solid var(--gold); background: linear-gradient(180deg, #fff6d6, #f9e6ad); grid-template-columns: 46px 1fr auto; }
.ribbon { display: inline-block; font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b4300; background: #ffd97a; padding: 1px 8px; border-radius: 999px; margin-bottom: 3px; }
.opt small.stats { color: var(--deep); font-weight: 600; }
/* an army inside a place stands beside the place's picture, by the same distance on screen at any zoom */
.ar { transform: translate(calc(var(--ox, 0px) * var(--k, 1)), calc(var(--oy, 0px) * var(--k, 1))) translate(-50%, -78%) scale(var(--k, 1)); }

/* ---- playing with friends: the title button, levels, the list of games, the clock, notices ---- */
.title-card .btn.primary { background: var(--saffron); border-color: var(--deep); color: #2a1404; }
.title-card .btn.primary:hover { background: #f59c33; }
.level { display: inline-block; margin-left: 9px; padding: 2px 8px; border-radius: 999px; font: 600 10.5px/1.5 Jost, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; color: #1c1108; background: #cfe6b8; }
.level.l2 { background: #e2e6a8; } .level.l3 { background: #f2d68a; } .level.l4 { background: #f0b07a; } .level.l5 { background: #ee9a8a; }
.room { padding: 10px 12px; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .5); }
.room-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.room-head b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.15; }
.room-head small { display: block; font-size: 13px; color: var(--ink2); }
.room-who { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 8px; }
.room-who .who { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .55); font-size: 13px; color: var(--ink2); }
.room-who .who.on { color: var(--ink); border-color: var(--leaf); }
.room-who .who.on::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--leaf); }
.room .fine { margin-top: 6px; }
#bar-clock { min-width: 58px; text-align: center; font-family: var(--serif); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; color: #ffe9c4; }
#bar-clock.low { color: #ff9a8a; }
.bar-books .btn[data-n]:not([data-n=""])::after { content: attr(data-n); position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--saffron); color: #2a1404; font-size: 11px; line-height: 17px; }
#notes { position: absolute; right: 12px; top: 112px; z-index: 8; width: min(340px, calc(100vw - 24px)); display: grid; gap: 5px; }
#notes[hidden] { display: none; }
#notes .note { display: block; width: 100%; text-align: left; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--gold); border-left: 4px solid var(--gold); background: rgba(28, 17, 8, .93); color: #f6ead0; font-size: 13px; line-height: 1.38; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
#notes button.note { cursor: pointer; } #notes button.note:hover { background: rgba(58, 36, 18, .97); }
#notes .note.record { border-left-color: #f0b45a; } #notes .note.test { border-left-color: var(--leaf); } #notes .note.bad { border-left-color: #ff9a8a; } #notes .note.war { border-left-color: #c9c2ae; }
#notes .note-close { justify-self: end; padding: 1px 9px; border-radius: 999px; border: 1px solid rgba(246, 234, 208, .4); background: rgba(28, 17, 8, .85); color: #d9c7a0; font-size: 11px; }
#veil { position: fixed; inset: 0; z-index: 60; cursor: progress; }
#veil[hidden] { display: none; }
#veil span { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); padding: 4px 14px; border-radius: 999px; background: rgba(28, 17, 8, .9); color: #f6ead0; font-size: 12.5px; opacity: 0; animation: veil-in .2s .8s forwards; }
@keyframes veil-in { to { opacity: 1; } }

/* ---- the town screen as an illuminated album page: a painted frame, a name plaque, medallions and seals ---- */
#town-hero { height: min(54vh, 500px); border: 30px solid #1d2a55; border-image: url(../art/frame.webp) 12.5% / 30px / 0 round; background-clip: padding-box; background-origin: padding-box; box-shadow: 0 0 0 2px var(--gold); }
#town-hero .shade { background: linear-gradient(180deg, rgba(28, 17, 8, 0) 55%, rgba(24, 34, 74, .55)); }
#town-title { left: 50%; right: auto; bottom: -34px; transform: translateX(-50%); z-index: 3; align-items: center; gap: 14px; padding: 12px 36px 12px 28px; white-space: nowrap; background: linear-gradient(180deg, #2b3c75, #18224a); border: 2px solid var(--gold); border-radius: 46px 46px 14px 14px / 40px 40px 14px 14px; box-shadow: 0 0 0 4px #18224a, 0 0 0 6px var(--gold), 0 14px 30px rgba(0, 0, 0, .5); }
#town-title h2 { font-size: clamp(30px, 4.4vw, 50px); text-shadow: none; color: #ffe9b8; }
#town-title .sub { color: #d9c7a0; letter-spacing: .04em; margin-top: 2px; }
#town-title .flag { transform: scale(1.9); margin: 0 18px 22px 0; }
#town-close { top: 12px; right: 12px; }
#town-body { position: relative; padding-top: 64px; }
/* a festoon of small gold scallops under the painting */
#town-body::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: radial-gradient(circle at 12px -2px, var(--gold) 0 9px, rgba(201, 154, 46, .25) 10px 11px, transparent 12px) 0 0 / 24px 12px repeat-x; opacity: .9; }
#town-body h3.sec { display: flex; align-items: center; gap: 12px; margin: 24px 0 8px; font-size: 17px; letter-spacing: .14em; color: #18224a; }
#town-body h3.sec::before { content: "❖"; color: var(--gold); font-size: 15px; }
#town-body h3.sec::after { content: ""; flex: 1; height: 5px; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); opacity: .8; }
.town-stats { justify-content: center; gap: 14px; margin-bottom: 16px; }
.stat { padding: 7px 20px 7px 8px; border-radius: 999px; background: linear-gradient(180deg, #fffaf0, #f3e0b0); border: 1px solid var(--gold); box-shadow: 0 0 0 3px #fff6dc, 0 0 0 4px var(--gold), 0 4px 10px rgba(60, 30, 0, .2); }
.stat .ic { width: 44px; height: 44px; border-radius: 14px; background-color: #fff3d2; box-shadow: 0 0 0 2px var(--gold); margin: 2px 4px 2px 6px; }
.stat .flag { margin: 0 14px 0 12px; }
.stat b { color: #18224a; }
.plan { position: static; display: block; max-width: 1200px; margin: 0 auto 8px; padding: 12px 18px 14px; border-radius: 14px; background: linear-gradient(180deg, #24336c, #18224a); border: 2px solid var(--gold); box-shadow: inset 0 0 0 4px #18224a, inset 0 0 0 5px rgba(217, 164, 65, .7), 0 8px 20px rgba(40, 20, 0, .25); color: #f6ead0; }
.plan-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.plan-head b { font-family: var(--serif); font-size: 23px; font-weight: 600; color: #ffe9b8; }
.plan-head span { font-size: 13px; color: #d9c7a0; }
.plan-head .meter { position: relative; flex: 1; min-width: 120px; height: 8px; align-self: center; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(217, 164, 65, .6); }
.plan-head .meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--n, 0%); background: linear-gradient(90deg, #d9a441, #ffd97a); }
.plots { display: flex; flex-wrap: wrap; gap: 10px 10px; margin-top: 12px; }
.plot { width: 86px; padding: 0; border: 0; border-radius: 0; background: none; display: grid; justify-items: center; align-content: start; gap: 3px; color: #b9ad90; text-align: center; }
.plot .disc { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #3a4a86, #131b3d); box-shadow: 0 0 0 2px rgba(217, 164, 65, .4); }
.plot .ic { width: 44px; height: 44px; filter: grayscale(1) brightness(.8) opacity(.5); }
.plot.has { color: #fff3da; }
.plot.has .disc { background: radial-gradient(circle at 35% 30%, #fff6dc, #e8c877); box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px #18224a, 0 0 0 6px var(--gold), 0 4px 10px rgba(0, 0, 0, .4); }
.plot.has .ic { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .3)); }
.plot.work { color: #fff3da; }
.plot.work .disc { background: radial-gradient(circle, #1d2a55 0 56%, transparent 57%), conic-gradient(#ffd97a var(--n, 0%), rgba(255, 255, 255, .16) 0); box-shadow: 0 0 0 2px var(--gold); }
.plot.work .ic { width: 34px; height: 34px; filter: grayscale(.3) opacity(.95); }
.plot .nm { font-size: 11px; line-height: 1.15; }
.plot em { font-style: normal; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: #ffd97a; }
.plot em.ok { color: #9fd6a8; } .plot em.no { color: #8f8a7c; }
@media (max-width: 900px) { .plan { padding: 12px 14px; background: linear-gradient(180deg, #24336c, #18224a); } #town-hero { min-height: 320px; } #town-title { white-space: normal; max-width: 92vw; } }
#town-body .record-box { border: 1px solid var(--gold); border-left: 6px double var(--gold); border-radius: 0 10px 10px 0; background: rgba(255, 250, 235, .72); box-shadow: 0 2px 6px rgba(60, 30, 0, .1); }
.bcard { padding: 14px 14px 12px; border: 1px solid var(--gold); background: linear-gradient(180deg, #fffaf0, #f4e3b8); box-shadow: inset 0 0 0 3px #fff8e6, inset 0 0 0 4px rgba(201, 154, 46, .55), 0 3px 8px rgba(60, 30, 0, .16); }
.bhead { grid-template-columns: 62px 1fr; gap: 12px; }
.bhead .ic { width: 54px; height: 54px; margin: 6px 4px 6px 6px; border-radius: 27px 27px 9px 9px; background-color: #fff3d2; box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px #1d2a55, 0 0 0 6px var(--gold); }
.bhead b { color: #18224a; font-size: 20px; }
.bfoot { align-items: center; border-top: 0; padding-top: 2px; }
.bfoot .cost, #town-body .opt .cost { padding: 2px 11px; border-radius: 999px; background: #18224a; color: #ffd97a; font-weight: 700; box-shadow: 0 0 0 1px var(--gold); }
.army-box { padding: 10px 12px; border: 1px solid var(--gold); border-radius: 12px; background: linear-gradient(180deg, rgba(255, 250, 240, .88), rgba(244, 227, 184, .72)); box-shadow: inset 0 0 0 3px rgba(255, 248, 230, .9), inset 0 0 0 4px rgba(201, 154, 46, .45), 0 2px 6px rgba(60, 30, 0, .1); }
.army-box header span:first-child { font-family: var(--serif); font-size: 20px; color: #18224a; }
#town-body .opt { border: 1px solid var(--gold); border-radius: 12px; background: linear-gradient(180deg, #fffaf0, #f6e7c4); box-shadow: inset 0 0 0 3px #fff8e6, inset 0 0 0 4px rgba(201, 154, 46, .4); padding: 9px 12px; }
#town-body .opt b { color: #18224a; font-size: 15px; }
#town-body .progress { border: 1px solid var(--gold); border-radius: 12px; background: linear-gradient(180deg, #fffaf0, #f6e7c4); box-shadow: inset 0 0 0 3px #fff8e6, inset 0 0 0 4px rgba(201, 154, 46, .4); padding: 10px 12px 14px; }
/* A regiment's strength is a bar that stands upright at its side, never one that lies flat. */
.unit { width: 60px; padding: 3px 3px 4px 10px; border: 1px solid rgba(201, 154, 46, .6); border-radius: 8px; background: linear-gradient(180deg, #fffdf6, #f3e3bd); }
.unit .bar, .bt-unit .bar { left: 3px; right: auto; top: 4px; bottom: 4px; width: 5px; height: auto; border-radius: 3px; background: rgba(0, 0, 0, .16); }
.unit .bar::after, .bt-unit .bar::after { position: absolute; left: 0; bottom: 0; width: 100%; height: var(--n, 100%); border-radius: 3px; }
.bt-unit { padding-left: 12px; }
/* ---- the battle screen in the same frame ---- */
.bt-stage { border: 24px solid #1d2a55; border-image: url(../art/frame.webp) 12.5% / 24px / 0 round; border-radius: 0; box-shadow: 0 0 0 2px var(--gold), 0 18px 50px rgba(0, 0, 0, .5); }
.bt-head h2 { display: flex; align-items: center; gap: 14px; color: #ffe9b8; }
.bt-head h2::before { content: "❖"; color: var(--gold); font-size: .5em; }
.bt-head h2::after { content: ""; flex: 1; height: 5px; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); opacity: .7; }
.bt-side { border: 2px solid var(--gold); box-shadow: inset 0 0 0 4px rgba(255, 248, 230, .9), inset 0 0 0 5px rgba(201, 154, 46, .5); }

/* ---- the record of battles, in the News book ---- */
.battle { padding: 8px 12px; margin-top: 8px; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 0 10px 10px 0; background: rgba(255, 255, 255, .45); }
.battle.won { border-left-color: var(--leaf); } .battle.lost { border-left-color: var(--red); } .battle:not(.mine) { opacity: .82; }
.battle .bh { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--deep); font-weight: 600; }
.battle .bt2 { font-family: var(--serif); font-size: 19px; line-height: 1.25; margin: 2px 0 3px; }
.battle .bn { font-size: 13.5px; line-height: 1.4; color: var(--ink); }

/* ---- diplomacy: every power, how you stand with it, and what it holds ---- */
.war-row.dip { align-items: start; border-left: 4px solid var(--line); padding-left: 10px; margin-top: 6px; }
.war-row.dip.war { border-left-color: var(--red); } .war-row.dip.ally { border-left-color: var(--leaf); } .war-row.dip.peace { border-left-color: var(--gold); }
.war-row.dip .rel { font-weight: 600; color: var(--ink); } .war-row.dip.war .rel { color: var(--red); } .war-row.dip.ally .rel { color: #1f5a37; }
