/* Parchment and moss, after Maple Washer (Ren, 2026-10-08): light only. Fraunces for headings, Inter Tight for
   text, JetBrains Mono for figures, all three served from `fonts/` (SIL Open Font License): nothing loads from
   outside. The account rail on the left (chips on a phone), one working pane; the rest under More. */
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("fonts/fraunces-v38.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/inter-tight-v9.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/jetbrains-mono-v24.woff2") format("woff2"); }
:root {
  --bg: #f5f1e8;
  --panel: #fffdf8;
  --glass: rgb(255 253 248 / .74);
  --raise: #f7f0e5;
  --track: #ebe2d3;
  --ink: #151914;
  --ink-2: #3f4b40;
  --muted: #5c6159;
  --line: #e4dacb;
  --edge: #cbbca7;
  --field: #bbae9c;
  --field-hover: #8d8172;
  --accent: #0f5536;
  --accent-hover: #093e27;
  --accent-ink: #fffdf8;
  --accent-soft: #edf3e9;
  --maple: #c9301a;
  --good: #2d6a2f;
  --good-soft: #e3efdf;
  --warn: #8a6316;
  --warn-soft: #f6ecd6;
  --bad: #a52314;
  --bad-soft: #f8e4dd;
  --info: #3d5a8a;
  --info-soft: #e6ebf3;
  --wood: #8a5d31;
  --clay: #b5653f;
  --iron: #5f6d7d;
  --crop: #b8921c;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 12px;
  --shadow: 0 1px 2px rgb(65 48 28 / .04), 0 14px 36px rgb(65 48 28 / .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font-body); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  font-variant-ligatures: no-contextual; /* JetBrains Mono would join "|-" in coordinates into one sign */
  background-color: var(--bg);
  background-image: radial-gradient(ellipse 70% 45% at 68% -10%, rgb(224 190 135 / .14), transparent), url("images/grain-1.svg");
}
::selection { background: rgb(201 48 26 / .14); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-weight: 600; text-wrap: balance; margin: 0; }
h2, h3, .brand h1 { font-family: var(--font-display); font-variation-settings: "opsz" 90, "SOFT" 70; font-weight: 450; letter-spacing: -.02em; }
h2 { font-size: 1.75rem; line-height: 1.1; }
h3 { font-size: 1.12rem; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
.mono { font-family: var(--font-mono); font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.label { font-size: .68rem; color: var(--ink-2); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

/* Top bar */
.top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 10px 24px; border-bottom: 1px solid var(--line); background: rgb(245 241 232 / .88); backdrop-filter: blur(8px); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.brand { margin-right: auto; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand h1 { font-size: 1.45rem; font-weight: 400; font-variation-settings: "opsz" 144, "SOFT" 100; }
.brand .em-w { font-weight: 300; color: var(--maple); }

/* More: a menu of links that opens below its button */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { background: var(--raise); color: var(--ink); }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 190px; display: flex; flex-direction: column; padding: 6px; background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; box-shadow: 0 10px 30px rgb(65 48 28 / .14); }
.menu-list a { padding: 6px 10px; border-radius: 6px; color: var(--ink); white-space: nowrap; }
.menu-list a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.menu-list a[aria-current="page"] { font-weight: 600; color: var(--accent); }
.menu-who { padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; overflow-wrap: anywhere; }
.menu-list form { padding: 2px 4px; }

/* Pills: quiet words with a tint, only where a state needs one */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 500; white-space: nowrap; line-height: 1.6; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-good { background: var(--good-soft); color: var(--good); }
.p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); }
.p-info { background: var(--info-soft); color: var(--info); }
.p-acc { background: var(--accent-soft); color: var(--accent); }
.p-plain { background: none; color: var(--muted); padding-inline: 0; }
a.pill.p-plain:hover { color: var(--accent); text-decoration: none; }

/* Shell: rail and pane. A sitting group's accounts sit in one block under its name. */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100% - 56px); }
.rail { padding: 18px 12px; display: flex; flex-direction: column; gap: 1px; border-right: 1px solid var(--line); scrollbar-width: thin; }
.navbtn { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 0 8px; align-items: center; width: 100%; border-radius: 8px; padding: 6px 10px; color: var(--ink); }
.navbtn:hover { background: var(--raise); text-decoration: none; }
.navbtn[aria-current="page"] { background: var(--accent-soft); }
.navbtn[aria-current="page"] .nm { font-weight: 600; color: var(--accent); }
.navbtn .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbtn .sub { grid-column: 2 / 4; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbtn .seat { font-size: .66rem; padding: 0 7px; }
.navbtn .sd { width: 7px; height: 7px; border-radius: 50%; }
.sd-good { background: var(--good); } .sd-warn { background: var(--warn); } .sd-bad { background: var(--bad); } .sd-info { background: var(--info); } .sd-muted { background: var(--edge); }
.rail-group { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.rail-group + .navbtn { margin-top: 8px; }
.rail-group .gh { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 8px; padding: 0 10px 4px; }
.rail-group .gh .small { font-size: .74rem; }

.main { padding: 26px 32px 56px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.head .small.muted { font-size: .82rem; }
.acct { display: flex; flex-direction: column; gap: 10px; }
.head h2 a { color: var(--ink); }
.head h2 a:hover { color: var(--accent); text-decoration: none; }
.page-title { margin-top: -4px; font-style: italic; color: var(--maple); font-weight: 400; }
.controls { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.controls form { display: contents; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--edge); background: var(--panel); padding: 5px 13px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: .85rem; color: var(--ink); line-height: 1.4; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--field-hover); background: #fffefa; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--raise); }
.btn.tiny { padding: 2px 10px; font-size: .8rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Tabs */
.tabs { display: flex; gap: 22px; box-shadow: inset 0 -1px 0 var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { padding: 8px 0 10px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }

.stopbar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 14px; background: var(--bad-soft); border: 1px solid rgb(165 35 20 / .18); border-radius: 10px; }
.stopbar strong { color: var(--bad); font-weight: 600; }
.warnbar { padding: 10px 14px; background: var(--warn-soft); color: var(--warn); border: 1px solid rgb(138 99 22 / .2); border-radius: 10px; font-weight: 500; }
.t-warn { color: var(--warn); } .t-bad { color: var(--bad); }

/* An account's status, and the card per account */
.status { display: flex; flex-direction: column; gap: 12px; }
.last { display: flex; gap: 8px; align-items: baseline; min-width: 0; color: var(--ink); }
.last:hover { text-decoration: none; } .last:hover .last-text { color: var(--accent); }
.last-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The status page's hero, culture points and gold (Ren's pick, 2026-10-08): labels in a column, values beside them. */
.card.facts-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 24px; margin: 0; align-self: flex-start; max-width: 100%; }
.facts-list dt { color: var(--muted); }
.facts-list dd { margin: 0; min-width: 0; }
.villages { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
/* Each card's seven parts (head, resources, stores, building, training, troops, merchants) share the row's tracks, so they line up. */
.village { background: var(--glass); border: 1px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; display: grid; grid-row: span 7; grid-template-rows: subgrid; row-gap: 10px; min-width: 0; }
.v-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.v-h strong { font-family: var(--font-display); font-variation-settings: "opsz" 90, "SOFT" 70; font-weight: 500; font-size: 1.05rem; letter-spacing: -.01em; }
.village .q { display: flex; flex-direction: column; gap: 1px; }
.fills { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
/* `.fills` stays when both are empty: hiding it would move the parts below it up a track. */
.fill:empty, .rs .boost:empty { display: none; }
/* Once one card shows a line, every card keeps it, so the cards read alike down the page too. */
.villages:has(.boost:not(:empty)) .rs .boost:empty::before, .villages:has(.fill:not(:empty)) .fill:empty::before { content: "\00a0"; }
.villages:has(.boost:not(:empty)) .rs .boost:empty, .villages:has(.fill:not(:empty)) .fill:empty { display: block; }
.fill.t-warn, .fill.t-bad { font-weight: 600; }
.grid-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: .85rem; }
.grid th { text-align: left; font-weight: 500; font-size: .75rem; color: var(--muted); padding: 0 10px 6px; white-space: nowrap; }
.grid td { padding: 8px 10px; vertical-align: top; box-shadow: inset 0 1px 0 var(--line); }
.grid .acc { display: flex; gap: 8px; align-items: center; } .grid .nm { font-weight: 600; white-space: nowrap; }
.grid .inline { margin-top: 4px; } .grid .last { min-width: 260px; max-width: 420px; flex-wrap: wrap; } .nowrap { white-space: nowrap; }
/* Facts (Progress) and bars */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 24px; padding-block: 2px; }
.fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact .v { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.fact .v-text { font-family: var(--font-body); font-size: .92rem; }
.bar { height: 4px; background: var(--track); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* Cards */
.cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.card { background: var(--glass); border: 1px solid var(--edge); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.muted { color: var(--muted); }
.card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-h .btn, .card-h .pill { margin-left: auto; }
.card > a.btn { align-self: flex-start; }
.plan { font-family: var(--font-mono); font-size: .8rem; line-height: 1.6; white-space: pre-wrap; background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
.dir { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.dir:first-of-type { border-top: none; padding-top: 0; }
.dir .q { font-weight: 500; }
.dir .u { font-size: .82rem; color: var(--muted); grid-column: 1 / 2; }

/* Resources */
.res { display: grid; grid-template-columns: repeat(4, minmax(64px, 1fr)); gap: 8px; }
.rs { display: flex; flex-direction: column; gap: 2px; }
.rs .n { font-family: var(--font-mono); font-size: .76rem; font-variant-numeric: tabular-nums; }
.rs .per { display: flex; flex-direction: column; gap: 2px; }
.rs .boost { color: var(--good); }
.rs .bar { height: 3px; margin-top: 0; }
.rs.wood .bar > span { background: var(--wood); } .rs.clay .bar > span { background: var(--clay); }
.rs.iron .bar > span { background: var(--iron); } .rs.crop .bar > span { background: var(--crop); }
.rs.full .n { color: var(--bad); font-weight: 600; }
.rs i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 5px; }
.k-wood { background: var(--wood); } .k-clay { background: var(--clay); } .k-iron { background: var(--iron); } .k-crop { background: var(--crop); }
.q-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.vcell { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }

/* Forms */
textarea, input:not([type="radio"]):not([type="checkbox"]), select { border: 1px solid var(--field); background: rgb(255 255 255 / .72); border-radius: 6px; padding: 6px 9px; transition: border-color .15s, box-shadow .15s; }
textarea:hover, input:not([type="radio"]):not([type="checkbox"]):hover, select:hover { border-color: var(--field-hover); }
textarea:focus, input:focus, select:focus { border-color: var(--accent); background: #fffefa; box-shadow: 0 0 0 3px rgb(15 85 54 / .1); outline: none; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
select { font-size: .85rem; padding: 3px 6px; }
.lesson textarea { width: 100%; min-height: 60px; }
details.act > summary { list-style: none; display: inline-flex; }
details.act > summary::-webkit-details-marker { display: none; }
details.act[open] { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 6px 0; }
.list details.act { margin-top: 4px; }
form.inline, div.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.goal-form { display: flex; flex-direction: column; gap: 6px; }
.goal-form textarea { width: 100%; min-height: 76px; resize: vertical; }
.hist-box > summary, details.earlier > summary { cursor: pointer; color: var(--muted); }
.hist details > summary { cursor: pointer; margin-top: 4px; }
fieldset { border: none; margin: 0; padding: 0; }

/* Notices: a done form's fades away at the foot; a refused one stays at the top */
.flash { padding: 10px 14px; border-radius: 10px; font-weight: 500; }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash.good { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 20; max-width: min(520px, calc(100vw - 32px)); background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px rgb(46 38 28 / .14); animation: toast 6s ease forwards; pointer-events: none; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  4%, 85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); visibility: hidden; }
}
.main.login { max-width: 30rem; margin-inline: auto; padding-top: 12vh; }
.main.login > a.btn { align-self: flex-start; }

.notes-text { font-family: var(--font-mono); font-size: .8rem; line-height: 1.6; white-space: pre-wrap; background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
.list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.pager { display: flex; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.filters .btn[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.role { font-weight: 600; font-size: .75rem; padding: 0 6px; border-radius: 3px; border: 1px solid currentColor; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The script's page bar (`nav.js`) and a page on its way */
.nav-bar { position: fixed; top: 0; left: 0; z-index: 50; height: 2px; width: 0; background: var(--maple); opacity: 0; pointer-events: none; }
.nav-bar.on { opacity: 1; width: 85%; transition: width 6s cubic-bezier(.08, .8, .2, 1); }
html[aria-busy] .main { opacity: .65; transition: opacity .15s .2s; }

.w-0 { width: 0%; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; }
.w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; }
.w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; }
.w-100 { width: 100%; }

@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }
/* A phone (Ren's pick, 2026-10-08): pill chips for the rail, a compact head with full-width controls, the facts
   as labels and values, and the stock two by two with each rate beside it. */
@media (max-width: 760px) {
  .top { padding: 8px 16px; }
  .brand h1 { font-size: 1.25rem; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .rail { border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 10px 16px; gap: 6px; }
  .rail-group { display: contents; }
  .rail-group .gh { display: none; }
  .rail-group + .navbtn { margin-top: 0; }
  .navbtn { width: auto; min-width: 120px; max-width: 200px; flex: 0 0 auto; align-content: start; border: 1px solid var(--edge); border-radius: 999px; background: var(--panel); padding: 5px 16px; }
  .navbtn[aria-current="page"] { border-color: var(--accent); }
  .main { padding: 16px 16px 48px; gap: 14px; }
  h2 { font-size: 1.45rem; }
  .head { gap: 4px 10px; }
  .head > .small.muted { flex-basis: 100%; }
  .controls { margin-left: 0; width: 100%; gap: 8px; }
  .controls > *, .controls > form > .btn { flex: 1 1 0; }
  .controls > .small { flex-basis: 100%; }
  .controls .btn { width: 100%; padding-block: 8px; }
  .controls .btn.ghost { border-color: var(--edge); background: var(--panel); color: var(--ink); }
  .card.facts-list { align-self: stretch; gap: 4px 14px; }
  .res { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
  .rs { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; align-items: baseline; }
  .rs .bar { grid-column: 1 / -1; grid-row: 2; }
  .rs .per { flex-direction: row; gap: 6px; }
  /* A More that wrapped to the left would open off-screen: on a phone each menu spans the screen below its button */
  .menu-list { position: fixed; top: auto; left: 16px; right: 16px; min-width: 0; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .flash.good { position: static; transform: none; max-width: none; background: var(--good-soft); color: var(--good); box-shadow: none; }
}
