/* Writ & Ruin: a colour woodcut print. Cream paper, carved black rules, flat colour set a little off the line. */
/* Writ Woodblock: the headings face, traced from a painted letter sheet by tools/prep-font.py. It has the letters,
   figures and plain punctuation only; anything else (brackets, symbols) falls back to IM Fell English. */
@font-face {
  font-family: 'Writ Woodblock';
  src: url(../fonts/writ-woodblock.woff2) format('woff2'), url(../fonts/writ-woodblock.woff) format('woff');
  font-display: swap;
}
:root {
  --paper: #f4ead2; --ink: #17140f; --moss: #7f8b4c; --slate: #7c8796; --rust: #a5492f;
  --ochre: #c49a45; --bone: #e6dcc2; --peat: #5a4632;
  --head: 'Writ Woodblock', 'IM Fell English', 'Alegreya', Georgia, 'Times New Roman', serif;
  --fell: 'IM Fell English', 'Alegreya', Georgia, 'Times New Roman', serif;
  --body: 'Alegreya', Georgia, 'Times New Roman', serif;
  --line: 2.5px;
  --gap: 10px;
  --bar-h: 94px;     /* phones: the action bar is two rows of five */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 17px/1.4 var(--body);
  /* parchment behind every screen: a calm seamless tile (tools/prep-title.py) that averages to --paper */
  background: var(--paper) url(../art/paper.jpg) 0 0 / 512px 512px repeat;
  min-height: 100vh; overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--head); font-weight: 400; line-height: 1.12; margin: .3em 0 .35em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; border-bottom: var(--line) solid var(--ink); padding-bottom: 2px; margin-top: .9em; }
h3 small { font-family: var(--body); font-size: .8rem; color: var(--peat); }
p { margin: .4em 0; }
small { font-size: .78em; }
.muted { color: var(--peat); }
.lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--peat); font-weight: 700; }
.warn { color: var(--rust); font-weight: 700; }
.note { background: var(--bone); border-left: 4px solid var(--ochre); padding: 6px 8px; }
b.big { font-size: 1.9rem; font-family: var(--head); line-height: 1; }
svg { display: block; }

/* ---------------------------------------------------------------- plank buttons */
/* Every button is a woodcut plank (art/ui-plank-*.png as a 9-slice): the image is drawn 8px deep at the ends and
   edges over a thin transparent border, so its outline keeps its natural weight on a small button and the box
   is the same size as a plain 2.5px-ruled one. It stands on a hard ink shadow and, pressed, sinks 2px onto it.
   Cream is the default; .go/.end/.green are the green plank (the one main action in a place); .red has a
   vermilion outline (assault, poison, raze, start anew); .active is the ochre plank, held down (a chosen mode
   or toggle); .off is dashed and flat, so it reads as unavailable at a glance. tools/prep-planks.py makes the
   rust and ochre planks from the cream one. */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 8px 14px; margin: 3px;
  font: 600 1rem/1.15 var(--body); color: var(--ink); background: transparent;
  border: var(--line) solid transparent; border-radius: 0;
  border-image: url(../art/ui-plank-cream.png) 40 fill / 8px stretch; box-shadow: 3px 3px 0 var(--ink);
  transition: transform .06s, box-shadow .06s;
  cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent;
}
.btn small { font-weight: 400; opacity: .85; }
.btn:active, .btn.active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px dashed var(--ochre); outline-offset: 3px; }
.btn.go, .btn.end, .btn.green { border-image-source: url(../art/ui-plank-green.png); }
.btn.active { border-image-source: url(../art/ui-plank-ochre.png); }
.btn.red { border-image-source: url(../art/ui-plank-rust.png); color: var(--rust); }
.btn.off { color: rgba(23, 20, 15, .45); border: var(--line) dashed rgba(23, 20, 15, .5); border-image: none; box-shadow: none; transform: none; }
.btn.big { font-size: 1.12rem; min-height: 52px; padding: 10px 22px; }
.btn.small { min-height: 44px; padding: 4px 10px; font-size: .9rem; }
.btn.icon { font-size: 1.3rem; padding: 4px; width: 44px; }
.btn.wide { flex: 1; }
.btn.step { font-size: 1.5rem; width: 56px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 8px -3px 0; }
.row.wrap { gap: 2px; }

/* ---------------------------------------------------------------- the age screen (phone first) */
.app { max-width: 1400px; margin: 0 auto; }
.age { display: flex; flex-direction: column; padding: 0 8px calc(var(--bar-h) + 70px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0 4px; border-bottom: 4px solid var(--ink); }
.topbar h1 { font-size: 1.3rem; margin: 0; }
.topbar .sub { font-size: .88rem; color: var(--peat); }
.strip { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 5px; padding: 6px 0 2px; }
.strip .key { grid-column: 1 / -1; font-size: .7rem; color: var(--peat); margin: 0; }
.chip {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-height: 44px; min-width: 0;
  padding: 4px 3px 4px; background: var(--paper); border: 2px solid var(--ink); border-radius: 3px 5px 3px 6px;
  font: inherit; color: var(--ink); cursor: pointer; z-index: 0; text-align: left;
}
.chip::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--house); transform: translate(2px, 1px); z-index: -1; }
.chip.now { border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
.chip.mine { background: var(--bone); }
.chip-top { display: flex; align-items: center; gap: 2px; min-width: 0; padding-top: 3px; }
.chip-top svg { flex: none; }
.chip-name { font-family: var(--head); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crownmark { font-size: .8rem; margin-left: auto; }
.chip-nums { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 700; }
.chip-nums small { font-weight: 400; color: var(--peat); }
.claimtag { position: absolute; top: -8px; right: -3px; background: var(--rust); color: var(--paper); font-size: .62rem; text-transform: uppercase; padding: 0 4px; border: 1.5px solid var(--ink); }
.bars { display: grid; gap: 2px; }
.bar { position: relative; height: 9px; border: 1.5px solid var(--ink); background: var(--paper); overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; transform: translate(1px, 1px); }
.bar b { position: absolute; right: 1px; top: -4px; font-size: .55rem; line-height: 1; display: none; }
.b-seize i { background: var(--rust); } .b-foretell i { background: var(--slate); } .b-depart i { background: var(--moss); } .b-seat i { background: var(--ochre); }

.mapbox { margin-top: 4px; }
.hint { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 8px; border: 2px solid var(--ink); background: var(--bone); font-size: .92rem; }
.hint span { flex: 1; }
.hint.rival { cursor: pointer; }
.hint > svg, .hint > img, .pk-title > svg, .pk-title > img, .chip-top > svg, .chip-top > img { flex: none; }
.hint.warn { background: var(--paper); border-color: var(--rust); color: var(--ink); }
.hint.pickhint { background: var(--ochre); }
.hint.mine { background: var(--paper); }
.hint .skip { font-size: .8rem; color: var(--peat); white-space: nowrap; }
/* the Undo plank sits beside the turn's numbers, and drops under them when the two do not fit side by side */
.hint.can-undo { flex-wrap: wrap; row-gap: 2px; padding: 3px 4px 3px 8px; }
.hint.can-undo span { min-width: 9.5em; }
.hint .btn.undo { flex: 0 1 auto; max-width: 100%; margin: 1px 2px 1px auto; padding: 4px 12px; line-height: 1.1; }
.mapframe { position: relative; margin-top: 6px; border: 4px solid var(--ink); background: var(--paper); padding: 2px; }
.mapframe::after { content: ''; position: absolute; inset: 3px; border: 1.5px solid var(--ink); pointer-events: none; }
.mapframe.small { max-width: 520px; margin: 10px auto; }
.map { width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.map [data-region] { cursor: pointer; }
.map text { font-family: var(--head); }
.map .rname { font-size: 12.5px; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
/* the count printed on a warband squad's front soldier: ink, on a thin paper halo so it reads on the darkest houses */
.map .cnt { font: 12px var(--head); fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 2.4px; stroke-linejoin: round; }
.map .cnt.n2 { font-size: 10px; letter-spacing: -0.3px; }
.map .tiny { font: 600 9px var(--body); fill: var(--ink); }
.map .tiny.b { font-weight: 700; }
.map .mk { font: 700 11px var(--body); }
.map .dk { font: 700 9px var(--body); }
.map .pick { animation: none; }
.map .arrow { pointer-events: none; }
.map .flash { stroke-dasharray: 3 4; }
.status { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .86rem; padding: 6px 2px; border-bottom: var(--line) solid var(--ink); }
.status > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.fc { display: inline-flex; align-items: baseline; gap: 1px; padding: 0 5px; border: 1.5px solid var(--ink); background: var(--bone); font-size: .82rem; }
.fc b { font-family: var(--head); font-size: 1rem; }
.ends { font-size: .84rem; }

.side { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.panel { position: relative; border: var(--line) solid var(--ink); padding: 6px 10px 8px; background: var(--paper); }
.panel > h3:first-child, .panel > h2:first-child { margin-top: .1em; }
.panel.danger { border-color: var(--rust); border-width: 3px; }
/* folding panels: the heading is a full-width button; shut, it shows a one-line summary under the title */
.panel.fold.shut { padding-bottom: 4px; }
.panel > h3.fold-h { margin: 0; padding: 0; border: 0; font-size: 1.1rem; }
.fold-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; align-content: center; column-gap: 8px; width: 100%; min-height: 44px;
  margin: 0; padding: 4px 0; background: none; border: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fold-head:focus-visible { outline: 3px dashed var(--ochre); outline-offset: 2px; }
.fold-title { font-family: var(--head); line-height: 1.12; }
.panel.open > h3.fold-h { border-bottom: var(--line) solid var(--ink); margin-bottom: 2px; }
.chev { grid-column: 2; grid-row: 1 / span 2; font: 1.35rem/1 var(--body); padding: 4px 2px; color: var(--ink); }
.panel.open .chev { grid-row: 1; }
.fold-sum { grid-column: 1; font: .86rem/1.3 var(--body); color: var(--peat); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold-sum.warn { color: var(--rust); font-weight: 700; }
.fold-sum.good { color: var(--moss); font-weight: 700; }
.rows { list-style: none; padding: 0; margin: 4px 0; }
.rows li { display: flex; align-items: flex-start; gap: 6px; padding: 5px 0; border-bottom: 1px solid rgba(23, 20, 15, .25); font-size: .92rem; }
.rows li:last-child { border-bottom: 0; }
.rows li svg, .rows li > img { flex: none; margin-top: 1px; }
.rows .claim { font-weight: 600; color: var(--rust); }
.rows .claim.good { color: var(--moss); }
.rows .urg { color: var(--rust); }
.rows .newplan { color: var(--rust); }
.plainlist li { display: block; }
.prophecy { font-style: italic; }
.loglist { list-style: none; margin: 4px 0; padding: 0; max-height: 300px; overflow-y: auto; font-size: .88rem; }
.loglist li { display: flex; align-items: flex-start; gap: 6px; padding: 3px 0; border-bottom: 1px dotted rgba(23, 20, 15, .3); }
.loglist li > svg, .loglist li > img { flex: none; margin-top: 2px; }   /* a house stamp keeps its shape when the entry wraps */
.loglist li.round { font-family: var(--head); font-size: 1rem; border-bottom: 2px solid var(--ink); padding-top: 8px; }
.loglist li.battle { font-weight: 600; }
.loglist li.me { color: var(--peat); }
.loglist li.warn { color: var(--rust); }

/* fixed action bar along the bottom */
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper); border-top: 4px solid var(--ink); }
.actions:empty { display: none; }
.abar { display: flex; flex-wrap: wrap; gap: 0; padding: 4px 6px max(4px, env(safe-area-inset-bottom)); max-width: 1400px; margin: 0 auto; justify-content: center; }
.abar .btn { flex: 1 0 auto; margin: 3px; padding: 6px 10px; }
.abar.one .btn { flex: 1; }
/* your turn: two rows of five, each label on one line; End turn fills the last two cells unless a Poisoner
   or Bell Seer takes one; holding both puts the pair on a third row.
   Cells are about 78px wide at 412px and 68px at 360px; the side padding is trimmed so "End turn" fits one cell. */
.abar.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 3px 2px max(3px, env(safe-area-inset-bottom)); }
.abar.grid .btn { min-height: 38px; margin: 2px; padding: 3px 1px; white-space: nowrap; }
.abar.grid .span2 { grid-column: span 2; }
.abar.grid .pair { grid-column: 1 / -1; display: flex; }
.abar.grid .pair .btn { flex: 1; }

/* looking at the map before answering: the decision's title and its answers in the bar's place.
   With answers to give, the title takes its own line on phones and the buttons share the row below. */
.abar.peekbar { align-items: center; flex-wrap: nowrap; }
.peekbar .pk-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; margin: 0 4px; font: 1.05rem/1.15 var(--head); }
.peekbar .pk-title svg, .peekbar .pk-title img { flex: none; }
.peekbar .pk-title b { font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peekbar .pk-btns { flex: none; display: flex; }
.peekbar .pk-btns .btn { white-space: nowrap; }
.abar.peekbar.answers { flex-wrap: wrap; }
.peekbar.answers .pk-title { flex-basis: 100%; margin-top: 2px; }
.peekbar.answers .pk-btns { flex: 1 1 100%; }
.peekbar.answers .pk-btns .btn { flex: 1 1 0; padding: 6px 4px; }
@media (min-width: 760px) {
  .abar.peekbar.answers { flex-wrap: nowrap; }
  .peekbar.answers .pk-title { flex-basis: auto; margin-top: 0; }
  .peekbar.answers .pk-btns { flex: none; }
  .peekbar.answers .pk-btns .btn { flex: none; padding: 6px 16px; }
}

body.busy .map [data-region] { cursor: default; }

/* ---------------------------------------------------------------- sheets */
.sheet { display: none; }
.sheet.open { display: block; position: fixed; inset: 0; z-index: 50; }
.sheet-back { position: absolute; inset: 0; background: rgba(23, 20, 15, .55); }
.sheet-card {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-top: 5px solid var(--ink); padding: 10px 14px 24px; box-shadow: 0 -4px 0 var(--ochre);
}
.sheet-card > h2:first-child, .sheet-card > .sheet-x + h2, .sheet-card > .sheet-x + header { margin-top: 0; padding-right: 48px; }
/* the close button floats at the top right and scrolls away with the sheet, so the text below wraps around it
   and never runs under it (a sticky button sat over the text as the sheet scrolled) */
.sheet-x {
  position: relative; float: right; z-index: 2; width: 44px; height: 44px; margin: -4px -6px 4px 8px;
  font: 1.8rem/1 var(--head); background: var(--paper); border: var(--line) solid var(--ink); border-radius: 50%; cursor: pointer; color: var(--ink);
}
body.sheet-up { overflow: hidden; }
.sheet h2.won { color: var(--moss); }
.sheet h2.lost { color: var(--rust); }
.rhead { display: flex; align-items: center; gap: 10px; padding-right: 48px; }
.rhead h2 { margin: 0; }
.rhead p { margin: 0; }
.sitebox { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border: var(--line) solid var(--ink); background: var(--bone); box-shadow: 2px 2px 0 var(--ochre); }
/* an undeveloped region: its structure shown faded and dashed until someone builds it */
.sitebox.unbuilt { border-style: dashed; box-shadow: none; }
.sitebox.unbuilt svg { opacity: 0.4; filter: grayscale(1); }
.map .cost { font: 700 12px var(--head); fill: #000; stroke: #000; stroke-width: .15px; letter-spacing: .3px; }   /* the build cost on an unbuilt site's coin: black and thickened so it holds on the silver */
.sitetext { border-left: 4px solid var(--moss); padding-left: 8px; }
.facts { font-size: .92rem; line-height: 1.55; }
.facts svg { display: inline-block; vertical-align: -3px; }
.actlist { display: flex; flex-direction: column; align-items: stretch; }
.actlist > .btn { justify-content: flex-start; text-align: left; }
.choice { border: 2px solid var(--ink); padding: 6px 10px; margin: 6px 0; background: var(--paper); }
.choice .ptext { font-style: italic; font-size: 1.05rem; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0; }
.stepn { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.stepn b { font: 2.2rem/1 var(--head); }
.stepn small { color: var(--peat); }
.info { font-size: .95rem; }
.versus { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0; padding: 8px; border-top: var(--line) solid var(--ink); border-bottom: var(--line) solid var(--ink); }
.vs-side { display: flex; flex-direction: column; align-items: center; min-width: 80px; }
.vs-side small { color: var(--peat); }
/* Writ Woodblock has no italic, so the italic "against" keeps IM Fell's real one */
.vs { font-family: var(--fell); font-style: italic; color: var(--peat); }
.odds { font-size: 1.05rem; margin-bottom: 2px; }
.losses { margin-top: 0; font-size: .95rem; }
.fortune-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.faces { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin: 6px 0; }
.fface { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; max-width: 120px; }
.fnum {
  position: relative; display: grid; place-items: center; width: 64px; height: 84px; z-index: 0;
  font: 3rem/1 var(--head); border: 3px solid var(--ink); border-radius: 4px 7px 5px 8px;
}
.fnum::before { content: ''; position: absolute; inset: 6px; background: var(--blk); transform: translate(2px, 2px); z-index: -1; }

/* cards */
.cards { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 6px 0; }
.card { display: flex; gap: 8px; border: var(--line) solid var(--ink); background: var(--paper); padding: 6px; border-radius: 2px 5px 3px 6px; }
.card-glyph { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; z-index: 0; border: 2px solid var(--ink); }
.card-glyph::before { content: ''; position: absolute; inset: 0; background: var(--suit); transform: translate(2px, 2px); z-index: -1; }
.card-body { flex: 1; min-width: 0; }
.card-name { font-family: var(--head); font-size: 1.05rem; }
.card-name .cost { font-family: var(--body); font-size: .8rem; font-weight: 700; padding: 0 4px; border: 1.5px solid var(--ink); background: var(--ochre); }
.card-suit { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--peat); }
.card-text { font-size: .9rem; }
.card .row { margin-top: 2px; }
/* a resident's painted portrait in place of the suit block: an ink frame, the suit colour printed off it.
   thumb: a head-and-shoulders crop for lists (faces sit in the upper part, so the crop keeps the top).
   full: the whole portrait beside the text, for a resident offered or shown on its own. */
.card.has-pic { gap: 11px; }
.card-pic { position: relative; flex: none; align-self: flex-start; overflow: hidden; border: 2px solid var(--ink);
  background: var(--bone); box-shadow: 3px 3px 0 var(--suit); }
.card-pic img { display: block; max-width: none; }
.card-pic.thumb { width: 56px; height: 70px; }
.card-pic.thumb img { position: absolute; top: -2px; left: var(--pic-x, 50%); width: 150%; height: auto; transform: translateX(calc(-1 * var(--pic-x, 50%))); }
/* the thumb shows the middle two thirds of a portrait's width. --pic-x moves that window like object-position:
   0% shows the left two thirds, 100% the right two thirds. Set only where the face or the resident's
   identifying detail sits off centre and the middle crop would cut it or jam it against the edge. */
.card[data-card="bellSeer"] .card-pic { --pic-x: 65%; }        /* the bell she holds up */
.card[data-card="ditchEel"] .card-pic { --pic-x: 90%; }        /* the eel's head and the man on the bank */
.card[data-card="drover"] .card-pic { --pic-x: 85%; }          /* the drover, beside his cattle */
.card[data-card="moorHound"] .card-pic { --pic-x: 80%; }       /* the hound's head */
.card[data-card="oldBoar"] .card-pic { --pic-x: 95%; }         /* the snout and tusks */
.card[data-card="stagOfThePass"] .card-pic { --pic-x: 38%; }   /* both antlers */
.card[data-card="starReader"] .card-pic { --pic-x: 80%; }      /* the star disc she holds up */
.card[data-card="wallWarden"] .card-pic { --pic-x: 80%; }      /* the lantern */
.card-pic.full { width: 128px; aspect-ratio: 3 / 4; }
.card-pic.full img { width: 100%; height: 100%; object-fit: cover; }
.card-relic { flex: none; align-self: flex-start; display: grid; place-items: center; }
.card-relic.thumb { width: 60px; height: 70px; }
.card-relic.full { width: 128px; height: 140px; }
.card-relic img { display: block; max-width: 100%; max-height: 100%; filter: drop-shadow(2px 2px 0 var(--ochre)); }
.progress { margin: 6px 0; }
.prow { display: flex; align-items: center; gap: 8px; font-size: .88rem; padding: 2px 0; }
.prow span:first-child { flex: 1; }
.pbar { position: relative; width: 90px; height: 12px; border: 2px solid var(--ink); overflow: hidden; flex: none; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; transform: translate(1px, 1px); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bar-h) + 40px); transform: translate(-50%, 20px); z-index: 80;
  max-width: min(92vw, 520px); padding: 10px 14px; background: var(--ink); color: var(--paper); border: 2px solid var(--ochre);
  font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- other screens */
.screen { max-width: 760px; margin: 0 auto; padding: 12px 14px 48px; }
/* the title page: framed by the woodcut border (a 9-slice of art/ui-border.png), thin on a phone. --tpad and --tbord
   are its padding and frame width, so the picture, the heraldry and the burned edge can reach out to the frame. */
.screen.title-screen { --tpad: 12px; --tbord: 16px; position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  min-height: calc(100vh - 12px); min-height: calc(100dvh - 12px); margin: 0 auto; padding: 0 var(--tpad) 12px;
  border: var(--tbord) solid transparent; border-image: url(../art/ui-border.png) 48 round;
  box-shadow: inset 0 0 26px 4px rgba(105, 62, 24, .32), inset 0 0 6px 1px rgba(80, 45, 15, .35); }   /* the burned edge just inside the frame */
body.on-title { padding: 6px; background-image: url(../art/paper-title.jpg); }   /* a little paper round the frame; the more aged sheet */
.titleblock { text-align: center; flex: 1 0 auto; display: flex; flex-direction: column; }
/* on a tall screen the spare height goes either side of the wordmark and tagline, the picture staying under the frame */
.title-art { position: relative; }
.title-art.painted { display: flex; flex-direction: column; align-items: center; }   /* centres the picture even where it is wider than the column */
.title-art svg { width: 100%; max-width: 440px; margin: 0 auto; height: auto; }
/* the painting keeps its 3:2 shape, snug under the top of the frame and nearly as wide as it, in a double-ruled ink
   frame on a heavy offset shadow; it gives up height before the menu does */
.title-art.painted img { display: block; width: calc(100% + 2 * var(--tpad) - 22px); max-width: min(740px, calc(42vh * 1.5)); height: auto;
  margin: 10px 0 18px; flex: none;
  border: 1.5px solid var(--ink); box-shadow: 0 0 0 3px #efe4c9, 0 0 0 6.5px var(--ink), 7px 8px 0 6.5px rgba(23, 20, 15, .9); }
.gametitle { margin: auto 0 4px; line-height: 0; }
.gametitle img { display: inline-block; width: min(94%, 470px); height: auto; }
/* the heraldry: shields on the frame beside the picture and the tagline, overlapping its inner edge; the lion and the
   stag on the scroll flourishes that grow out of the frame, a small divider between them */
.hd { display: block; background: center / contain no-repeat; }
.hd.pale-l, .hd.pale-r { position: absolute; top: 50%; width: 26px; height: 37px; margin-top: -24px; }
.hd.pale-l { left: calc(-1 * var(--tpad) - var(--tbord) / 2 - 13px); background-image: url(../art/ui-herald-pale-l.png); }
.hd.pale-r { right: calc(-1 * var(--tpad) - var(--tbord) / 2 - 13px); background-image: url(../art/ui-herald-pale-r.png); }
.herald { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; column-gap: 4px; align-items: center; justify-items: center;
  margin: 0 calc(-1 * var(--tpad) - var(--tbord) * .75) auto; padding-bottom: 6px; }
.tagline { font-size: 1.12rem; margin: 0; text-wrap: balance; max-width: 30em; }
.hd.shield-l, .hd.shield-r { width: 32px; height: 41px; }
.hd.shield-l { justify-self: start; background-image: url(../art/ui-herald-shield-l.png); }
.hd.shield-r { justify-self: end; background-image: url(../art/ui-herald-shield-r.png); }
.hd.lion, .hd.stag { width: 56px; height: 68px; align-self: end; margin-top: -10px; }
.hd.lion { justify-self: start; margin-left: calc(var(--tbord) * .75 - 1px); background-image: url(../art/ui-herald-lion.png); }
.hd.stag { justify-self: end; margin-right: calc(var(--tbord) * .75 - 1px); background-image: url(../art/ui-herald-stag.png); }
.tdivider { display: block; width: 100%; max-width: 176px; aspect-ratio: 689 / 96; align-self: end; margin-bottom: 14px;
  background: url(../art/ui-divider.png) center / contain no-repeat; }
.menu { display: flex; flex-direction: column; align-items: stretch; max-width: 380px; margin: 0 auto; width: 100%; }
.menu .btn { margin: 6px 0; flex-direction: column; }
@media (max-width: 380px) {
  .herald { grid-template-columns: 28px minmax(0, 1fr) 28px; column-gap: 3px; }
  .hd.shield-l, .hd.shield-r { width: 27px; height: 35px; }
  .hd.lion, .hd.stag { width: 46px; height: 56px; }
  .tagline { font-size: 1rem; }
}
@media (min-width: 600px) {
  body.on-title { padding: 10px; }
  .screen.title-screen { --tpad: 28px; --tbord: 22px; min-height: calc(100vh - 20px); min-height: calc(100dvh - 20px); padding-bottom: 20px; }
  .hd.pale-l, .hd.pale-r { width: 32px; height: 46px; margin-top: -30px; }
  .hd.shield-l, .hd.shield-r { width: 40px; height: 52px; }
  .herald { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .hd.lion, .hd.stag { width: 70px; height: 85px; }
  .tdivider { max-width: 320px; margin-bottom: 6px; }   /* phones keep the small one; here it spans the tagline */
  .herald { padding-bottom: 2px; }
}
/* title page only: darker edges, a fixed layer over the parchment and under the page */
body.on-title::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 50%, rgba(100, 66, 34, .16) 80%, rgba(70, 44, 22, .38) 100%);
}
/* the title page's planks: boardy ones cut from the mock-up (art/ui-tplank-*.png, 9-sliced: a carved end each side, the
   heavy slab shadow drawn in the image so no box shadow), with a big icon (<i class="plank-icon pi-crown|pi-quill|pi-book|pi-scroll">
   first inside the button) overhanging the left end. Cream by default, tan for the second action, green for the main one. */
.btn.plank { min-height: 58px; padding: 3px 60px 9px; border: 2px solid transparent; box-shadow: none;
  border-image: url(../art/ui-tplank-cream.png) 15 95 17 95 fill / 8px 50px 9px 50px stretch;
  font: 400 1.35rem/1.15 var(--body); }
.btn.plank small { font-size: .78em; opacity: .9; }
/* a backing in the face colour under the 9-slice, so the browser's hairline seams where the slices meet don't show paper */
.btn.plank { --face: #ead6b8; background: linear-gradient(var(--face), var(--face)) 50% 7px / calc(100% - 64px) calc(100% - 22px) no-repeat border-box; }
.btn.plank.tan { --face: #e3c795; }
.btn.plank.green { --face: #777a47; background-size: calc(100% - 64px) calc(100% - 32px); }
.btn.plank.off { background: none; }
.btn.plank.tan { border-image-source: url(../art/ui-tplank-tan.png); }
.btn.plank.green { border-image: url(../art/ui-tplank-green.png) 16 95 34 95 fill / 8px 50px 18px 50px stretch; }
.btn.plank.big { min-height: 84px; padding: 4px 64px 18px; }
.btn.plank:active { box-shadow: none; }
.btn.plank.off { min-height: 54px; margin: 6px 4px 6px 0; border: var(--line) dashed rgba(23, 20, 15, .5); border-image: none; }
.plank-icon { position: absolute; left: -6px; top: 50%; width: 66px; height: 58px; margin-top: -33px; pointer-events: none;
  background: center / contain no-repeat; }
.btn.plank.big .plank-icon { left: -4px; width: 72px; height: 66px; margin-top: -40px; }
.btn.plank.off .plank-icon { left: -8px; opacity: .45; }
.pi-crown { background-image: url(../art/ui-crown.png); }
.pi-quill { background-image: url(../art/ui-quill.png); }
.pi-book { background-image: url(../art/ui-book.png); }
.pi-scroll { background-image: url(../art/ui-scroll.png); }
.banner { display: flex; align-items: center; gap: 12px; border: 4px solid var(--ink); padding: 10px 12px; background: var(--bone); position: relative; z-index: 0; }
.banner::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; transform: translate(2px, 2px); z-index: -1; }
.banner.won::before { background: var(--moss); }
.banner.lost::before { background: var(--rust); }
.banner h2 { margin: 0 0 4px; }
.banner svg { flex: none; }
/* ---------------------------------------------------------------- the Reckoning
   The three steps are plank tiles in the woodblock face: the current one ochre on a hard ink shadow, the ones to
   come cream on a lighter shadow, the finished ones pressed in (sunk 2px like a held button) with a moss tick.
   Each step's panel leads with its rule; counts are chips (ochre when complete) and asides sit behind an ochre rule. */
.reckon-screen .steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 10px 0 16px; }
.reckon-screen .steps li {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 6px 6px 7px;
  font: 1rem/1.1 var(--head); text-align: center; color: var(--ink);
  border: var(--line) solid transparent; border-image: url(../art/ui-plank-cream.png) 40 fill / 8px stretch;
  box-shadow: 2px 2px 0 rgba(23, 20, 15, .38);
}
.reckon-screen .steps li.now { border-image-source: url(../art/ui-plank-ochre.png); box-shadow: 3px 3px 0 var(--ink); }
.reckon-screen .steps li.done {
  border: var(--line) solid rgba(23, 20, 15, .55); border-image: none; background: var(--bone); color: var(--peat);
  box-shadow: inset 2px 2px 0 rgba(23, 20, 15, .16); transform: translate(2px, 2px); position: relative;
}
.reckon-screen .steps li.done::before {
  content: ''; position: absolute; left: 8px; top: 5px; width: 5px; height: 10px; transform: rotate(45deg);
  border: solid var(--moss); border-width: 0 3px 3px 0;
}
.reckon-screen .rk-h { display: flex; align-items: center; gap: 10px; }
.reckon-screen .rk-num {
  flex: none; display: inline-grid; place-items: center; min-width: 1.75em; height: 1.75em; padding: 1px .3em 0;
  font: .78em/1 var(--head); color: var(--paper); background: var(--ink); box-shadow: 2px 2px 0 var(--ochre);
}
.reckon-screen .rk-lead { font-size: 1.06rem; margin: .35em 0 .5em; }
.reckon-screen .rk-hint { margin: 6px 0; padding: 1px 0 1px 9px; border-left: 4px solid var(--ochre); color: var(--peat); font-size: .94rem; }
.reckon-screen .rk-tally { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 6px; }
.reckon-screen .rk-tally .lbl { margin-right: 2px; }
.reckon-screen .rk-chip {
  display: inline-flex; align-items: baseline; gap: .35em; padding: 3px 9px 2px; white-space: nowrap;
  font: .98rem/1.15 var(--head); background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}
.reckon-screen .rk-chip b { font-weight: 400; }
.reckon-screen .rk-chip.full { background: var(--ochre); }
.reckon-screen .panel h3 { font-size: 1.18rem; margin-top: 1.35em; padding-bottom: 3px; border-bottom: 6px double var(--ink); }
.reckon-screen .rk-foot { margin-top: 14px; padding-top: 8px; border-top: 6px double var(--ink); }
.bigtext { font-size: 1.15rem; }
.reckon-screen .panel > svg { float: right; }
.annals { list-style: none; padding: 0; }
.entry { display: flex; gap: 12px; align-items: flex-start; border-bottom: var(--line) solid var(--ink); padding: 10px 0; }
.entry .vignette { flex: none; width: 110px; height: auto; }
/* the painted vignette: framed like the site banner, cropped a little so the print's paper margin goes,
   beside the words on a wide screen and above them on a phone; the winner's banner small in a corner */
.entry .painted-vignette { position: relative; width: 200px; margin: 2px 0 0; aspect-ratio: 4 / 3; overflow: hidden;
  border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); background: var(--bone); }
.painted-vignette img { position: absolute; left: -5%; top: -5%; width: 110%; height: 110%; max-width: none; object-fit: cover; display: block; }
.painted-vignette .vg-stamp { position: absolute; right: 6px; bottom: 6px; line-height: 0; padding: 3px; background: var(--paper);
  border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.painted-vignette .vg-stamp img, .painted-vignette .vg-stamp svg { position: static; width: 26px; height: auto; display: block; }
@media (max-width: 540px) {
  .entry:has(.painted-vignette) { flex-direction: column; }
  .entry .painted-vignette { width: 100%; max-width: 360px; aspect-ratio: 16 / 9; }
  .painted-vignette .vg-stamp img, .painted-vignette .vg-stamp svg { width: 32px; }
}
.entry h2 { margin-top: 0; }

/* ---------------------------------------------------------------- larger screens */
@media (min-width: 640px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .cards.solo { grid-template-columns: 1fr; }   /* the residents on a region sheet: room for the portrait and the text */
  .bar b { display: block; }
}
@media (min-width: 700px) {
  .sheet-card {
    left: 50%; top: 50%; bottom: auto; right: auto; transform: translate(-50%, -50%);
    width: min(560px, 94vw); max-height: 86vh; border: 5px solid var(--ink); box-shadow: 6px 6px 0 var(--ochre);
  }
  .sheet-card.wide { width: min(820px, 94vw); }
}
/* two columns: the map on the left, sized by the height left between the hint and the action bar so the whole
   board shows and nothing sits under the bar; the strip, status and side panels take the spare width.
   The map is 420x521 (4:5); its frame is 12px wider and taller (border and padding). */
@media (min-width: 760px) {
  :root { --bar-h: 64px; }
  /* wide screens: the whole bar on one row */
  .abar.grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 4px 6px max(4px, env(safe-area-inset-bottom)); }
  .abar.grid .btn { min-height: 44px; margin: 3px; padding: 6px 8px; }
  .abar.grid .span2 { grid-column: auto; }
  .abar.grid .pair { display: contents; }
  .age {
    --map-h: min(max(300px, calc(100vh - 212px)), calc((100vw - 400px) * 521 / 420));
    display: grid; grid-template-columns: auto minmax(300px, 1fr); grid-template-rows: auto auto auto auto 1fr;
    grid-template-areas: 'top top' 'hint hint' 'map strip' 'map status' 'map side';
    column-gap: 16px; padding: 0 16px calc(var(--bar-h) + 30px);
  }
  .topbar { grid-area: top; }
  .mapbox { display: contents; }
  .hint { grid-area: hint; margin-top: 4px; }
  .mapframe { grid-area: map; align-self: start; }
  .mapframe .map { display: block; height: var(--map-h); width: calc(var(--map-h) * 420 / 521); max-height: none; }
  .strip { grid-area: strip; margin-top: 2px; }
  .status { grid-area: status; }
  .side { grid-area: side; margin-top: 4px; }
}
@media (min-width: 960px) {
  .strip { gap: 8px; }
  .chip { padding: 5px 8px; }
  .chip-name { font-size: 1rem; }
  .chip-nums { font-size: .9rem; }
  .bar { height: 11px; }
  .loglist { max-height: 360px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.rkart { display: flex; align-items: center; gap: 10px; }
/* great works: the Reckoning's work buttons (name over effect), the next-age starts, the region sheet's line */
.btn.work > span { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.btn.work small { font-size: .88rem; }
.actlist > .btn svg { flex: none; }
.starts { margin: 4px 0 10px; padding-left: 1.2em; }
.starts li { margin: 3px 0; }
.worktext { display: flex; align-items: flex-start; gap: 8px; border-left: 4px solid var(--ochre); padding-left: 8px; }
.worktext svg { flex: none; }
.rkart svg { flex: none; }
/* the Reckoning's build line with the painting: framed like the title painting, the caption beside it or, when narrow, under it */
.rkart.painted { flex-wrap: wrap; margin: 10px 0; }
.rkart.painted img { display: block; flex: none; width: 200px; max-width: calc(100% - 4px); height: auto; border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.rkart.painted figcaption { flex: 1 1 9em; }

/* a site painting across the top of a region sheet: the title painting's ink frame, cropped wide.
   The picture sits in an absolute clip box so the sheet's floated close button can sit over its corner
   (a clipping box in the flow would be pushed aside by the float); the clip also trims the painting's own paper margin. */
/* (width: 100% is needed: with an auto width the max-height would carry over through the ratio and narrow the banner) */
.sitebanner { position: relative; margin: 0 0 12px; width: 100%; aspect-ratio: 2.2 / 1; max-height: 220px;
  border: 4px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); background: var(--bone); }
.sitebanner .sb-clip { position: absolute; inset: 0; overflow: hidden; }
.sitebanner img { position: absolute; top: 0; left: -4%; width: 108%; height: 100%; max-width: none; object-fit: cover; display: block; }
/* not built yet: the structure as a faded proof, with a paper tag */
.sitebanner.unbuilt img { filter: grayscale(.85) sepia(.3) opacity(.5); }
.sitetag { position: absolute; left: 8px; bottom: 8px; padding: 1px 8px 2px; font: 1rem/1.2 var(--head); color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); transform: rotate(-1.5deg); }
