/* Hradiště – Classic: dark wood page, parchment panels, brown ink, gold accent (V1, 2026-10-21; palette in docs/village-classic-plan.md).
   Tokens first; components below. Parchment is the default surface; the top bar, nav, dropdowns, toast and map HUD are "wood" (see .topbar, .nav … below
   which re-map the same tokens to light-on-dark). Atmosphere (planks, grain, vignette) sits behind content only. */
:root {
  color-scheme: light;
  /* surfaces: --bg-0 = wood page; --bg-1 = field/inset (lightest); --bg-2 = parchment panel; --bg-3..5 = parchment 2 and deeper (chips, hover, active) */
  --bg-0: #2a1c11; --bg-1: #f8eed4; --bg-2: #f2e4c0; --bg-3: #e4cf9c; --bg-4: #d9c18a; --bg-5: #cdb279;
  /* hairlines */
  --hair: #d2b57e; --hair-2: #c4a468; --hair-3: #a98a52;
  /* hover / track overlays (ink tints on parchment, cream tints on wood) */
  --ov-0: #3a251308; --ov-1: #3a251310; --ov-2: #3a251320;
  /* text: brown ink */
  --text: #3a2513; --text-hi: #24150a; --text-2: #66492a; --text-3: #735533;
  /* one accent: gold. --accent = fills, rings, rules; --gold-ink = gold as text/links (AA on parchment); --accent-hi = light gold, kept for the map canvas */
  --accent: #b97a12; --accent-hi: #dcc58d; --accent-lo: #8a6232; --accent-bg: #b97a1220; --accent-bg2: #b97a1236; --accent-ink: #24150a; --gold-ink: #7d4f08; --focus: #8a5a0a;
  /* level badges / tags: dark brown tag, cream number */
  --badge: #4a2e15; --badge-ink: #f6e9c8; --badge-line: #8a6232;
  /* text fields */
  --field: #fbf3dc; --field-line: #a0824a;
  /* signal colours (AA on parchment) */
  --ok: #2a6234; --bad: #9a2f1c; --warn: #7d5006; --info: #2a5880;
  --ok-bg: #2f6b3a1c; --bad-bg: #a3341f18; --warn-bg: #b97a1226; --info-bg: #2f5f8618;
  --ok-line: #2f6b3a55; --bad-line: #a3341f55; --warn-line: #89580866; --info-line: #2f5f8655;
  /* resource icon tints */
  --ic-wood: #8a5a24; --ic-clay: #a8452a; --ic-iron: #5d6f85; --ic-pop: #4f7a58; --ic-storage: #6b6558;
  /* shape, space, depth, motion */
  --r-sm: 4px; --r: 6px; --r-lg: 10px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --sh-1: 0 1px 2px #2a1c1155; --sh-2: 0 14px 34px -12px #140c06d0, 0 2px 8px #2a1c1155;
  --ease: cubic-bezier(.2, .7, .2, 1); --t: .14s;
  --sans: ui-sans-serif, system-ui, "Segoe UI Variable Text", "Segoe UI", -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", ui-sans-serif, system-ui, "Segoe UI", -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  /* film grain: feTurbulence, white speckle (used by body::after) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.1 -.42'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* legacy aliases (kept so older rules/inline code keep working) */
  --ink: var(--text); --muted: var(--text-2); --link: var(--gold-ink); --line: var(--hair-2); --line-soft: var(--hair);
}
/* Wood scope: same tokens, light on dark. Everything that sits on the wood page or over the map canvas
   (`#app > .notice` = a notice printed straight on the page, e.g. chrome.nav's beginner protection; `.boot` = index.html's loading placeholder). */
.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .vart .vlabel, .vart .vtag, .scrhead, .pbar, .pmenu, .pm-hint,
#app > .notice, .boot, .taptip, .site-links, .site-foot, .pgfoot {
  color-scheme: dark; color: var(--text);
  --bg-1: #1d130b; --bg-2: #2a1c11; --bg-3: #3b2715; --bg-4: #4a321c; --bg-5: #5a3e24;
  --hair: #f2e4c01c; --hair-2: #f2e4c033; --hair-3: #f2e4c052;
  --ov-0: #ffffff06; --ov-1: #ffffff0d; --ov-2: #ffffff16;
  --text: #f2e4c0; --text-hi: #fff4d6; --text-2: #c4a77a; --text-3: #b39769;
  --accent: #d9a441; --accent-hi: #e8c77e; --accent-lo: #a67a38; --accent-bg: #d9a44122; --accent-bg2: #d9a44140; --accent-ink: #24150a; --gold-ink: #e8c77e; --focus: #e8c77e;
  --field: #1d130b; --field-line: #8a6232;
  --ok: #9fd08a; --bad: #f0907a; --warn: #e8b85c; --info: #9cc0e3;
  --ok-bg: #9fd08a1c; --bad-bg: #f0907a1c; --warn-bg: #e8b85c1c; --info-bg: #9cc0e31c;
  --ok-line: #9fd08a55; --bad-line: #f0907a55; --warn-line: #e8b85c55; --info-line: #9cc0e355;
  --ic-wood: #c9a06a; --ic-clay: #d98a66; --ic-iron: #a9b9cc; --ic-pop: #9cc0a6; --ic-storage: #b4b0a4;
  --sh-1: 0 1px 2px #0007; --sh-2: 0 14px 34px -12px #000d, 0 2px 8px #0006;
}
* { box-sizing: border-box; }
html { background: linear-gradient(180deg, #33230f 0%, #2a1c11 70%) fixed, var(--bg-0); scrollbar-color: #6b4a2a transparent; scrollbar-width: thin; }
body {
  margin: 0; color: var(--text); font: .84375rem/1.5 var(--sans); letter-spacing: .005em; min-height: 100vh; display: flow-root;
  background: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a, .link { color: var(--gold-ink); cursor: pointer; text-decoration: none; font-weight: 500; transition: color var(--t); }
a:hover, .link:hover { color: var(--text-hi); text-decoration: underline; text-decoration-color: var(--accent-lo); text-underline-offset: 3px; }
.ic { width: 18px; height: 18px; vertical-align: -4px; flex: none; }
::selection { background: #b97a1255; color: var(--text-hi); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
/* text for screen readers only (the page's h1, the toast announcements) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #6b4a2a; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #8a6232; background-clip: content-box; border: 2px solid transparent; } ::-webkit-scrollbar-track { background: transparent; }

#app { max-width: 1340px; margin: 0 auto; padding: 0 var(--s4) 56px; }

/* ---- Atmosphere (behind content only): wood planks, warm light falloff + vignette, grain ---- */
html::before { content: ''; position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 190px, #00000038 190px 192px, #ffffff08 192px 194px, transparent 194px 380px); opacity: .7; }
body::before { content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(1200px 560px at 82% -10%, #b97a1230, transparent 70%), radial-gradient(900px 520px at 6% 108%, #b97a1220, transparent 70%),
    radial-gradient(ellipse 125% 95% at 50% 42%, transparent 52%, #140c06b0 100%); }
body::after { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--grain); background-size: 240px; opacity: .05; }
body:has(.login)::before { background: radial-gradient(1000px 600px at 50% 18%, #b97a1238, transparent 70%), radial-gradient(ellipse 120% 90% at 50% 45%, transparent 45%, #140c06c0 100%); }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px;
  background: #1d130bf0; -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--hair); border-top: none; border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: 0 16px 30px -18px #000;
}
.topbar .title { display: inline-flex; align-items: center; gap: 9px; font: 600 .75rem/1 var(--display); letter-spacing: .22em; text-transform: uppercase; color: var(--gold-ink); }
.topbar .title::before { content: ''; width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 10px var(--accent-lo); }
.topbar .res { display: flex; flex-wrap: wrap; gap: 5px; margin-left: auto; align-items: center; }
.topbar .res > span {
  position: relative; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 4px 10px 6px;
  background: var(--bg-3); border: 1px solid var(--hair); border-radius: var(--r); font-variant-numeric: tabular-nums; font-size: .8125rem;
}
.topbar .res b { font-weight: 600; color: var(--text-hi); letter-spacing: .01em; }
.topbar .res .fill { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--ov-2); overflow: hidden; }
.topbar .res .fill i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-lo), var(--accent)); transition: width .4s var(--ease); }
.topbar .res .fill i.hi { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.topbar .res > span:empty { display: none; }
.full { color: var(--bad) !important; }
.vswitch { display: inline-flex; gap: 4px; align-items: center; }
/* Village picker (T31): the top-bar button and its popup (a child of <body>, positioned by app.js) */
.vpick { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 5px 9px; font: 500 .8125rem/1.2 var(--sans); color: var(--text-hi); cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--hair-2); border-radius: var(--r); transition: border-color var(--t), background var(--t); }
.vpick:hover { border-color: var(--hair-3); background: var(--bg-4); }
.vpick:focus-visible, .vpick[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg2); }
.vpick .vn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vpick .vxy { color: var(--text-3); font-weight: 400; font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vpick .vg { color: var(--gold-ink); font-size: .75rem; font-weight: 500; padding: 1px 6px; border: 1px solid var(--accent-lo); border-radius: 9px; white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.vpick svg { flex: none; color: var(--text-3); }
#vpicker { position: absolute; z-index: 60; max-width: calc(100vw - 16px); display: flex; flex-direction: column; background: var(--bg-3); border: 1px solid var(--hair-2);
  border-radius: var(--r-lg); box-shadow: var(--sh-2); animation: navmenu-in var(--t) var(--ease); }
#vpicker .vp-head { display: flex; gap: 6px; align-items: center; padding: 8px 8px 6px; }
#vpicker .vp-q { flex: 1; min-width: 0; font-size: .875rem; }
#vpicker .vp-tabs { display: flex; gap: 2px; padding: 0 8px 6px; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--hair); }
#vpicker .vp-tabs button { flex: none; padding: 4px 9px; font: 500 .75rem/1.3 var(--sans); color: var(--text-2); background: transparent; border: 1px solid transparent; border-radius: var(--r);
  cursor: pointer; white-space: nowrap; transition: background var(--t), color var(--t); }
#vpicker .vp-tabs button:hover { background: var(--ov-1); color: var(--text-hi); }
#vpicker .vp-tabs button:focus-visible { outline: none; border-color: var(--accent-lo); }
#vpicker .vp-tabs button.on { color: var(--text-hi); background: var(--bg-5); border-color: var(--hair-2); box-shadow: inset 0 -2px 0 var(--accent); }
#vpicker .vp-tabs .cnt { margin-left: 3px; color: var(--text-3); font-size: .75rem; font-variant-numeric: tabular-nums; }
#vpicker .vp-list { max-height: min(52vh, 380px); overflow-y: auto; padding: 4px; overscroll-behavior: contain; }
#vpicker .vp-list > div { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; border-radius: var(--r); cursor: pointer; font-size: .8125rem; color: var(--text); }
#vpicker .vp-list .vn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
#vpicker .vp-list .vxy, #vpicker .vp-list .vpt { flex: none; color: var(--text-3); font-size: .75rem; font-variant-numeric: tabular-nums; }
#vpicker .vp-list .vpt { min-width: 52px; text-align: right; }
#vpicker .vp-list .act { background: var(--ov-1); color: var(--text-hi); }
#vpicker .vp-list .cur { color: var(--text-hi); background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
#vpicker .vp-list .cur.act { background: var(--accent-bg2); }
#vpicker .vp-empty { margin: 0; padding: 14px 10px; text-align: center; }
#vpicker .vp-foot { padding: 5px 12px 7px; font-size: .75rem; border-top: 1px solid var(--hair); }
@media (pointer: coarse) { #vpicker .vp-list > div { padding: 11px 10px; } #vpicker .vp-tabs button { padding: 8px 11px; } #vpicker .vp-q { font-size: 1rem; } }
.topbar .mini { background: transparent; }
.topbar.vrow { margin: 0 0 var(--s2); border-top: 1px solid var(--hair); border-radius: var(--r-lg); }
.nav .rk { margin-left: 4px; padding: 0 6px; border: 1px solid var(--accent-lo); border-radius: 9px; font-size: .75rem; color: var(--gold-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Footer: server clock and links */
.pgfoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; margin: var(--s4, 18px) 0 var(--s3); padding: 8px 12px; border-top: 1px solid var(--hair); font-size: .78125rem; color: var(--text-3); }
.pgfoot .fclock { font-variant-numeric: tabular-nums; }
.pgfoot .flinks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.pgfoot .link { color: var(--gold-ink); cursor: pointer; }
/* Rank chip (T34): own place and points in the top bar, opens the player ranking */
.rankchip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 4px 10px 6px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--hair); border-radius: var(--r); color: var(--gold-ink);
  font-family: inherit; font-size: .8125rem; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; transition: border-color var(--t), color var(--t);
}
.rankchip:hover { border-color: var(--accent-lo); color: var(--text-hi); }

/* ---- Main navigation ---- */
.nav { display: flex; flex-wrap: wrap; gap: 2px; margin: var(--s2) 0; padding: 3px; align-items: center; background: #1d130bcc; border: 1px solid var(--hair); border-radius: var(--r-lg); }
/* Each item is a split button (.ni): label = default page, caret (.nc) = menu of sub-pages. The pair shares hover/active state. */
.nav .ni { display: inline-flex; align-items: stretch; border: 1px solid transparent; border-radius: 7px; transition: background var(--t); }
.nav button {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; font: 500 .8125rem/1.2 var(--sans); color: var(--text-2); cursor: pointer;
  background: transparent; border: 0; border-radius: 7px; transition: background var(--t), color var(--t);
}
.nav .ni:has(.nc) > [data-tab] { padding-right: 6px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.nav .nc { padding: 6px 7px 6px 4px; border-top-left-radius: 0; border-bottom-left-radius: 0; opacity: .7; }
.nav .nc svg { display: block; transition: transform var(--t); }
.nav .nc[aria-expanded="true"] { background: var(--ov-2); color: var(--gold-ink); opacity: 1; }
.nav .nc[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav button .ic { width: 16px; height: 16px; }
.nav button:hover { background: var(--ov-1); color: var(--text-hi); }
.nav .nc:hover { opacity: 1; }
.nav .ni.on { background: var(--bg-4); border-color: var(--hair); box-shadow: inset 0 -2px 0 var(--accent); }
.nav .ni.on > button { color: var(--text-hi); }
.nav .ni.on > button:hover { background: var(--ov-1); }
.nav .right { margin-left: auto; }
.nav .badge { margin-left: 2px; }
/* U39: below 1400 px tighter items, so the full row (admin entry and rank chip included) still fits one line at 1280 px. */
@media (max-width: 1400px) { .nav button { padding: 6px 8px; gap: 5px; } .nav .ni:has(.nc) > [data-tab] { padding-right: 4px; } .nav .nc { padding: 6px 6px 6px 3px; } .nav .nlab { display: none; } }
.rkfind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: var(--s2) 0; }
/* The menu is a child of <body> (positioned in px by app.js), so it survives page re-renders. */
#navmenu {
  position: absolute; z-index: 60; min-width: 190px; max-width: calc(100vw - 16px); max-height: min(70vh, 520px); overflow-y: auto; padding: 4px;
  background: var(--bg-3); border: 1px solid var(--hair-2); border-radius: var(--r-lg); box-shadow: var(--sh-2); display: flex; flex-direction: column; gap: 1px;
  animation: navmenu-in var(--t) var(--ease);
}
@keyframes navmenu-in { from { opacity: 0; transform: translateY(-3px); } }
#navmenu button {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 6px 10px; text-align: left; font: 500 .8125rem/1.3 var(--sans);
  color: var(--text); background: transparent; border: 0; border-radius: var(--r); cursor: pointer; white-space: nowrap; transition: background var(--t), color var(--t);
}
#navmenu button:hover, #navmenu button:focus-visible { background: var(--ov-1); color: var(--text-hi); outline: none; }
#navmenu button:focus-visible { box-shadow: inset 0 0 0 1px var(--accent-lo); }
#navmenu button.on { color: var(--text-hi); background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
#navmenu .mh { padding: 8px 10px 3px; margin-top: 3px; border-top: 1px solid var(--hair); font: 600 .75rem/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
#navmenu .cnt { color: var(--text-3); font-size: .75rem; font-variant-numeric: tabular-nums; }
.quickbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; background: transparent; border: 1px dashed var(--hair-2); border-radius: var(--r); padding: 5px 12px; margin: 0 0 var(--s2); font-size: .78125rem; }
.quickbar .link { color: var(--gold-ink); }
.quickbar .qi + .qi::before { content: '·'; color: var(--text-3); margin: 0 9px; }   /* dot between links, not after a separator */
.quickbar .qsep { width: 1px; height: 14px; margin: 0 10px; background: var(--hair-3); }
.quickbar kbd { font-size: .75rem; padding: 1px 4px 0; margin-right: 6px; color: var(--text-3); }

/* Keyboard help (T30): a modal over the page, same flat surfaces as the menus */
.hk-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--s4); background: #140c06cc; animation: navmenu-in var(--t) var(--ease); }
.hk-panel { width: min(720px, 100%); max-height: calc(100vh - 2 * var(--s4)); overflow-y: auto; padding: var(--s5); outline: none;
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: var(--r-lg); box-shadow: var(--sh-2); }
.hk-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.hk-head h2 { margin: 0; font-size: 1rem; color: var(--text-hi); }
.hk-note { margin: 0 0 var(--s3); color: var(--warn); }
.hk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--s4) var(--s5); }
.hk-grid h3 { margin: 0 0 var(--s2); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.hk-grid dl { margin: 0; display: grid; gap: 7px; }
.hk-grid dl > div { display: grid; grid-template-columns: minmax(70px, auto) 1fr; gap: var(--s2); align-items: baseline; }
.hk-grid dt { white-space: nowrap; }
.hk-grid dd { margin: 0; color: var(--text); }
.hk-foot { margin: var(--s4) 0 0; font-size: .75rem; }
kbd { display: inline-block; min-width: 20px; padding: 2px 6px 1px; font: 600 .75rem/1.35 var(--mono); text-align: center; color: var(--text-hi);
  background: var(--bg-4); border: 1px solid var(--hair-3); border-bottom-width: 2px; border-radius: var(--r-sm); }
@media (max-width: 480px) { .hk-panel { padding: var(--s4); } }
/* Dark ink on an amber tint, for parchment. A notice straight on the wood page (#app > .notice) is in the wood scope at the top:
   its colour there (cream ink) outranks the #5e3b04 below, and --warn-bg / --warn-line become the wood amber. */
.notice {
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: #5e3b04; padding: 7px 12px; margin: 0 0 var(--s3); border-radius: var(--r); font-size: .8125rem;
}
.sitbar { background: var(--badge); border-bottom: 2px solid var(--accent); color: var(--badge-ink); padding: 8px 14px; border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; gap: 12px; align-items: center; }

/* ---- Panels & boxes ---- */
.panel {
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: var(--r-lg); padding: var(--s4) var(--s5); box-shadow: var(--sh-2), inset 0 1px 0 #fff6;
}
.panel.wide { overflow-x: auto; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s4); align-items: start; }
.cols > div:not(.panel) > .box:first-child { margin-top: 0; }
@media (max-width: 820px) { .cols, .cols.rep { grid-template-columns: minmax(0, 1fr) !important; }
  .tribeov > div:last-child { order: -1; } /* RP20: one column = the tribe's card (rank, role, Write, Leave) before the news */
}
h2 { margin: 0 0 var(--s3); font: 600 1.25rem/1.25 var(--display); letter-spacing: -.01em; color: var(--text-hi); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
h2 .muted { font: 400 .8125rem var(--sans); letter-spacing: 0; }
h2 > .ic { width: 24px; height: 24px; color: var(--gold-ink); }
h3 {
  margin: 0; padding: 9px 12px; font: 600 .75rem/1.25 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--text-2);
  background: transparent; border-bottom: 1px solid var(--hair); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center;
}
.box h3 { background: var(--bg-3); border-bottom-color: var(--hair-2); }
h3 .muted { color: var(--text-2); font: 400 .75rem var(--sans); letter-spacing: 0; text-transform: none; }
h3 .link { color: var(--gold-ink); text-transform: none; letter-spacing: 0; font-size: .75rem; }
.box {
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: var(--r-lg); margin-bottom: var(--s3); overflow: hidden; box-shadow: var(--sh-1);
}
.box .in { padding: 10px 12px; }
.box > table.vis { border-radius: 0; }
details.box > summary { list-style: none; cursor: pointer; } details.box > summary::-webkit-details-marker { display: none; }
details > summary { cursor: pointer; }
fieldset { border: 1px solid var(--hair); border-radius: var(--r); margin: 0 0 var(--s3); padding: 8px 12px; background: var(--ov-0); }
legend { font: 600 .75rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); padding: 0 6px; }

/* ---- Sub navigation (tabs inside a page): a framed wood bar like the main nav, so the tabs stand out on parchment ---- */
.subnav {
  display: flex; flex-wrap: wrap; gap: 3px; margin: 0 0 var(--s4); padding: 3px;
  background: #1d130be6; border: 1px solid var(--accent-lo); border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.subnav button {
  background: var(--ov-0); border: 1px solid var(--hair-2); padding: 6px 11px;
  font: 500 .8125rem/1.2 var(--sans); color: var(--text-2); cursor: pointer; border-radius: 7px; transition: color var(--t), background var(--t), border-color var(--t);
}
.subnav button:hover { background: var(--ov-2); border-color: var(--hair-3); color: var(--text-hi); }
.subnav button.on { color: var(--text-hi); background: var(--bg-4); border-color: var(--accent-lo); box-shadow: inset 0 -2px 0 var(--accent); }
.subnav button:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
/* A tab that can't be used yet (e.g. HQ "Demolish" below HQ 15): greyed, no hover, its label/title says why. */
.subnav button:disabled, .subnav button:disabled:hover { opacity: .45; cursor: default; background: var(--ov-0); border-color: var(--hair-2); color: var(--text-2); }
/* RP18: a tab row under the page's own row (core.js tabs(..., 'sub2'): HQ modes, Market, Court, account manager, the tribe's shared data)
   is parchment with brown ink and a gold underline, so the wood row above it stays the one that reads as the page. Seen from 640 px
   up (below that every tab row folds into a dropdown). .subnav is in the wood scope, so the colours are the page's own, written out.
   Text contrast: idle #3a2513 on #e4cf9c 9.4:1, hover and chosen #24150a on #d9c18a 10.1:1, disabled #66492a on #e4cf9c 5.4:1. */
.subnav.sub2 { color-scheme: light; background: #e4cf9c; border-color: #c4a468; box-shadow: none; }
.subnav.sub2 button { background: transparent; border-color: transparent; color: #3a2513; }
.subnav.sub2 button:hover { background: #d9c18a; border-color: #c4a468; color: #24150a; }
.subnav.sub2 button.on { background: #d9c18a; border-color: #a98a52; color: #24150a; box-shadow: inset 0 -2px 0 #b97a12; }
.subnav.sub2 button:focus-visible { outline: 2px solid #8a5a0a; }
.subnav.sub2 button:disabled, .subnav.sub2 button:disabled:hover { opacity: 1; background: transparent; border: 1px dashed #c4a468; color: #66492a; }

/* ---- Tables ---- */
table.vis { width: 100%; border-collapse: separate; border-spacing: 0; background: transparent; font-variant-numeric: tabular-nums; }
table.vis th {
  text-align: left; padding: 7px 10px; font: 600 .75rem var(--sans); color: var(--text-2); letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 1px solid var(--hair-2); white-space: nowrap; background: var(--ov-1);
}
table.vis td { padding: 5px 10px; border-top: 1px solid var(--hair); vertical-align: middle; }
table.vis tr:first-child td { border-top: none; }
table.vis tr:hover td { background: var(--ov-1); }
tr.unread td { font-weight: 600; color: var(--text-hi); }
tr.me td { background: var(--accent-bg) !important; color: var(--text-hi); font-weight: 600; }
tr.tot td { border-top: 1px solid var(--hair-3); background: var(--ov-1) !important; font-weight: 600; }
tr.past td { opacity: .45; }
table.hq td:nth-child(2), table.hq td:nth-child(3), table.hq td:nth-child(4) { white-space: nowrap; }
@media (max-width: 760px) { table.hq td:nth-child(2) { white-space: normal; } }
table.rec td:nth-child(2) { white-space: normal; }
table.ut th, table.ut td { text-align: center; padding: 4px 5px; }
table.ut td:first-child, table.ut th:first-child { text-align: left; white-space: nowrap; }
table.ut td.zero { color: var(--text-3); opacity: .55; }
table.ut th .ic { width: 16px; height: 16px; }
@media (max-width: 760px) { table.ut .ic { width: 14px; height: 14px; } table.ut { font-size: .75rem; } }
table.mail td { vertical-align: top; }
.cost { display: inline-flex; flex-wrap: wrap; gap: 2px 12px; }
.cost span { white-space: nowrap; }
.short { color: var(--bad); }
.ok { color: var(--ok); }
.muted { color: var(--text-2); font-size: .75rem; }
.nowrap { white-space: nowrap; }
.right { float: right; }
.pre { white-space: pre-wrap; word-break: break-word; }
b, strong { font-weight: 600; color: var(--text-hi); }

/* ---- Buttons & fields ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 13px; font: 600 .78125rem/1.3 var(--sans); letter-spacing: .01em; color: #5e3a06; cursor: pointer; white-space: nowrap;
  background: var(--accent-bg2); border: 1px solid #b97a1288; border-radius: var(--r);
  transition: background var(--t), border-color var(--t), color var(--t), transform .06s;
}
.btn:hover { background: #b97a1252; border-color: var(--accent); color: var(--text-hi); }
.btn:active { transform: translateY(1px); }
.topbar .btn, .sitbar .btn, #vpicker .btn, #toast .btn, .mapstage .btn, .boot .btn { color: var(--gold-ink); }
.btn:disabled { opacity: .5; cursor: default; background: var(--ov-1); border-color: var(--hair); color: var(--text-2); transform: none; }
.btn.danger { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.btn.danger:hover { background: #a3341f2e; border-color: var(--bad); color: #7a1f10; }
.btn .ic { width: 15px; height: 15px; }
.mini {
  display: inline-flex; align-items: center; gap: 4px; background: var(--bg-3); border: 1px solid var(--hair-2); border-radius: var(--r-sm);
  padding: 2px 8px; font: 500 .75rem var(--sans); cursor: pointer; color: var(--text); transition: background var(--t), border-color var(--t), color var(--t);
}
.mini:hover { background: var(--bg-5); border-color: var(--hair-3); color: var(--text-hi); }
.mini.danger { color: var(--bad); }
/* Same as .btn:disabled: an unusable small button (a PP action the player can't afford, the first item's "up") looks it. */
.mini:disabled, .mini:disabled:hover { opacity: .5; cursor: default; background: var(--bg-3); border-color: var(--hair-2); color: var(--text); }
input, textarea, select {
  font: .8125rem var(--sans); padding: 5px 8px; border: 1px solid var(--field-line); background: var(--field); color: var(--text); border-radius: var(--r);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
input:hover, textarea:hover, select:hover { border-color: var(--accent-lo); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg2); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 14px; height: 14px; vertical-align: -2px; padding: 0; }
input[type=number], input[type=text], input:not([type]) { font-variant-numeric: tabular-nums; }
input[type=color] { padding: 1px 2px; background: var(--field); cursor: pointer; }
textarea { line-height: 1.5; }
/* UX20c: frame B's styled controls (approved sheet docs/ux20-b-detail.jpg, user 2026-12-01 "Yes, build it"; mock art/ux20/b-inner.css).
   Parchment plates (button, small button), a dark-wood primary with gold lozenges, an oxblood danger plate, inset parchment fields,
   a select with a wood cap and gold chevron, a wood checkbox with a gold tick, dotted gold links. Parchment only: the wood areas
   (top bar, menus, picker, toast, map stage, phone bars, site header/footer) keep the flat light-on-dark controls above, so every
   rule excludes them with `:not(:where(<wood scope>) *)` (zero specificity: later component rules still win as before); links also
   skip the page footer on the wood.
   Radio buttons stay the browser's (gold accent). */
:root { --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; --b-gold: #b98a2e; --b-gold-hi: #ecd08a; --b-focus: #d7a845; }
.btn:not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) {
  min-height: 32px; padding: 5px 16px 6px; border-radius: 3px; gap: 8px;
  font: 600 .875rem/1.2 var(--serif); letter-spacing: .03em; color: #3a2513; text-shadow: 0 1px 0 #fff8;
  background: linear-gradient(180deg, #fcf3dc 0%, #ecd9ab 55%, #dcc28a 100%); border: 1px solid #6b4a26;
  box-shadow: inset 0 1px 0 #fffaf0c0, inset 0 -2px 0 #b8995e80, 0 2px 3px #140c0640;
  transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t), transform .06s;
  &:hover { color: #24150a; border-color: var(--b-gold); background: linear-gradient(180deg, #fff8e6 0%, #f2e1b6 55%, #e4cb90 100%);
    box-shadow: inset 0 1px 0 #fffaf0, inset 0 -2px 0 #c9a45f, 0 0 0 1px #d7a84566, 0 2px 4px #140c0650; }
  &:active { transform: translateY(1px); background: linear-gradient(180deg, #d9bf86, #ead7a8); box-shadow: inset 0 2px 4px #6b4a2670, 0 1px 1px #140c0640; }
  &:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  &:disabled, &:disabled:hover { cursor: default; transform: none; opacity: .6; color: #735533; text-shadow: none;
    background: repeating-linear-gradient(135deg, #e6d7b2 0 6px, #e0cfa6 6px 12px); border-color: #a98a52; box-shadow: none; }
  /* primary: a dark-wood plate, gold letters between two gold lozenges (no lozenge while the busy spinner uses ::after) */
  &.primary { color: #f0d48e; text-shadow: 0 1px 0 #000; background: linear-gradient(180deg, #5e4127 0%, #3b2715 52%, #24170d 100%); border-color: #140c06;
    box-shadow: inset 0 0 0 1px #b98a2e99, inset 0 1px 0 #ecd08a40, 0 2px 4px #140c0680; }
  &.primary::before, &.primary:not(.busy)::after { content: ''; flex: none; width: 5px; height: 5px; background: var(--b-focus); transform: rotate(45deg); box-shadow: 0 0 0 1px #140c06; }
  &.primary:hover { color: #fde9b4; border-color: #140c06; background: linear-gradient(180deg, #6e4d2e 0%, #4a321c 52%, #2a1c11 100%);
    box-shadow: inset 0 0 0 1px var(--b-focus), inset 0 1px 0 #ecd08a66, 0 0 10px #d7a84540, 0 2px 4px #140c0680; }
  &.primary:active { background: linear-gradient(180deg, #24170d, #3b2715); box-shadow: inset 0 0 0 1px #b98a2e99, inset 0 3px 5px #000a; }
  &.primary:disabled { color: #b8a27a; text-shadow: none; background: #4a3b2c; border-color: #2a1c11; box-shadow: inset 0 0 0 1px #8a623260; opacity: .7; }
  &.primary:disabled::before, &.primary:disabled::after { background: #8a6232; }
  /* danger: an oxblood plate */
  &.danger { color: #f8e6c8; text-shadow: 0 1px 0 #3a0e04; background: linear-gradient(180deg, #9a3c24 0%, #74281a 55%, #561a0e 100%);
    border-color: #2e0c04; box-shadow: inset 0 0 0 1px #e0a07a55, inset 0 1px 0 #ffd2b040, 0 2px 4px #140c0670; }
  &.danger:hover { color: #fff1dc; border-color: #2e0c04; background: linear-gradient(180deg, #ad4a2e 0%, #84301e 55%, #631f12 100%); box-shadow: inset 0 0 0 1px #f0b48c99, 0 0 10px #a3341f50, 0 2px 4px #140c0670; }
  &.danger:active { background: linear-gradient(180deg, #561a0e, #74281a); box-shadow: inset 0 3px 5px #0009; }
  &.danger:disabled, &.danger:disabled:hover { color: #e0c4b0; background: #8a5a4a; border-color: #4a2014; opacity: .6; box-shadow: none; }
}
/* small button ("Použít"): a slim parchment tab with a brass edge */
.mini:not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) {
  min-height: 26px; padding: 3px 12px 4px; border-radius: 3px; font: 600 .8125rem/1.2 var(--serif); letter-spacing: .02em; color: #3a2513;
  background: linear-gradient(180deg, #f8ecd0, #e2cb96); border: 1px solid #8a6232; box-shadow: inset 0 1px 0 #fff9, 0 1px 2px #140c0640;
  &:hover { color: #24150a; background: linear-gradient(180deg, #fff6e0, #ead6a6); border-color: var(--b-gold); box-shadow: inset 0 1px 0 #fff, 0 0 0 1px #d7a84555, 0 1px 2px #140c0640; }
  &:active { transform: translateY(1px); background: linear-gradient(180deg, #dcc28a, #ecd9ab); box-shadow: inset 0 2px 3px #6b4a2660; }
  &:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  &:disabled, &:disabled:hover { opacity: .6; color: #735533; background: #e4d6b4; border-color: #a98a52; box-shadow: none; transform: none; }
}
/* fields: inset parchment; the select gets a dark-wood cap with a gold chevron */
:is(select, textarea, input:where(:not([type=checkbox], [type=radio], [type=color], [type=hidden]))):not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) {
  min-height: 32px; padding: 5px 10px; border-radius: 3px; font: .875rem/1.3 var(--sans); color: #24150a;
  background-color: #fdf6e3; border: 1px solid #8a6232; box-shadow: inset 0 2px 3px #6b4a2638, 0 1px 0 #fff9;
  &:hover { border-color: var(--b-gold); }
  &:focus { outline: none; border-color: var(--focus); box-shadow: inset 0 2px 3px #6b4a2638, 0 0 0 3px #d7a84566; background-color: #fffaf0; }
  &:disabled { opacity: .55; cursor: default; filter: grayscale(.5); }
}
textarea:not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) { line-height: 1.5; }
select:where(:not([multiple], [size])):not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; text-overflow: ellipsis;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23ecd08a' stroke-width='2'/%3E%3C/svg%3E") right 9px center / 12px 8px no-repeat,
    linear-gradient(#b98a2e, #b98a2e) right 29px top / 1px 100% no-repeat, linear-gradient(180deg, #5e4127, #2a1c11) right top / 29px 100% no-repeat, #fdf6e3;
  &:focus { background-color: #fffaf0; }
}
/* checkbox: a wood box, a gold tick (absolute: the tick never moves the box's baseline) */
input[type=checkbox]:not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) {
  appearance: none; -webkit-appearance: none; position: relative; display: inline-block; flex: none; width: 18px; height: 18px; margin: 0; vertical-align: -4px;
  border: 1px solid #6b4a26; border-radius: 3px; background: linear-gradient(180deg, #fdf6e3, #ecdcb4); box-shadow: inset 0 1px 2px #6b4a2650; cursor: pointer;
  &:checked { background: linear-gradient(180deg, #5e4127, #24170d); border-color: #140c06; box-shadow: inset 0 0 0 1px var(--b-gold); }
  &:checked::after { content: ''; position: absolute; left: 50%; top: 42%; width: 50%; height: 25%;
    border-left: 2px solid var(--b-gold-hi); border-bottom: 2px solid var(--b-gold-hi); transform: translate(-50%, -50%) rotate(-45deg); }
  &:indeterminate::after { content: ''; position: absolute; left: 25%; right: 25%; top: calc(50% - 1px); height: 2px; background: #6b4a26; }
  &:hover { border-color: var(--b-gold); }
  &:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
  &:disabled { opacity: .5; cursor: default; }
}
/* links on parchment: gold ink over a dotted gold rule */
.link:not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot, .pgfoot) *) {
  font-weight: 600; border-bottom: 1px dotted var(--b-gold);
  &:hover { color: #5e3a06; text-decoration: none; border-bottom-style: solid; border-bottom-color: var(--gold-ink); }
}
/* RP21: on the phone, the text links that are the only way to do something are 44 px tall to tap: padding, not bigger type. The dotted
   rule becomes a dotted underline, or the padding would push it 13 px under the text. Named links only: a positioned ::before hit area
   on every .link would paint over the button beside it and take its taps, and ::after is the busy spinner. */
@media (max-width: 639.98px) {
  .pgfoot .link { padding-block: 13px; min-height: 44px; }
  :is(#mailback, #repback, #repback ~ [data-report], [data-mpage], [data-reppage], [data-mquote], [data-buildcheap]) {
    display: inline-block; min-height: 44px; padding-block: 13px; border-bottom: 0; text-decoration: underline dotted var(--b-gold); text-underline-offset: 3px; }
}
@media (max-width: 760px) {
  .btn:not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *),
  :is(select, input:where(:not([type=checkbox], [type=radio], [type=color], [type=hidden]))):not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) { min-height: 40px; }
  .mini:not(:where(.topbar, .nav, .quickbar, .sitbar, .subnav, #navmenu, #vpicker, #toast, .console, .mapstage, .scene, .scrhead, .pbar, .pmenu, #app > .notice, .boot, .taptip, .site-links, .site-foot) *) { min-height: 36px; padding: 6px 14px; }
}
.form-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; align-items: center; }
.form-grid > label { font-weight: 500; color: var(--text-2); }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
/* RP20: the admin's settings form: a long label wraps (at most 60 % of the row) instead of pushing the field column to nothing */
@media (min-width: 601px) { #setf fieldset { min-width: 0; } #setf .form-grid { grid-template-columns: fit-content(60%) minmax(0, 1fr); } }
.inline { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 0; }
.send-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.send-row .invlink { flex: 1 1 260px; min-width: 0; } /* INV1: the invite link beside its Copy button */
.blk { display: block; margin: 4px 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-3); border: 1px solid var(--hair-2); border-radius: 999px; padding: 2px 10px; margin: 2px; font-size: .78125rem; cursor: pointer; transition: background var(--t), border-color var(--t); }
.pill:hover { background: var(--bg-4); }
.pill:has(input:checked) { background: var(--accent-bg2); border-color: var(--accent-lo); color: var(--text-hi); }
.vpick { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; font-size: .78125rem; }
.tag { display: inline-block; background: var(--ov-1); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 0 6px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; color: var(--text-2); margin-left: 4px; }
.badge { background: #a3341f; color: #fff; border-radius: 9px; padding: 0 6px; font-size: .75rem; font-weight: 700; line-height: 1rem; display: inline-block; min-width: 17px; text-align: center; }

/* ---- Units ---- */
.un { white-space: nowrap; margin-right: 8px; display: inline-flex; align-items: center; gap: 4px; }
.units-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.uin { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.uin input { width: 70px; }
.tpls { margin: 0 0 var(--s2); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* ---- Village grid (list view) ---- */
.village-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--s2); }
.bld {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; border-radius: var(--r-lg); position: relative;
  background: var(--bg-3); border: 1px solid var(--hair); transition: border-color var(--t), background var(--t), transform var(--t);
}
.bld:hover { background: var(--bg-4); border-color: var(--accent-lo); transform: translateY(-1px); }
.bld.zero { background: transparent; border-style: dashed; border-color: var(--hair-2); }
.bld.zero .ic.big { opacity: .4; }
.ic.big { width: 40px; height: 40px; padding: 8px; border-radius: 9px; background: var(--bg-5); border: 1px solid var(--hair); color: var(--text); }
.bld b { font-weight: 600; font-size: .8125rem; }
.bld .lvl { font-size: .75rem; color: var(--text-2); }
.bld .lvl b { color: var(--gold-ink); font-size: .75rem; }

/* ---- Village plan (abstract terrain-contour backdrop from village.js ground()) ---- */
.scene { position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 340px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--hair-2);
  box-shadow: inset 0 0 90px #140c06c0, var(--sh-1); background: radial-gradient(ellipse 70% 60% at 50% 42%, #6d6a3c, #3a3420 80%); user-select: none; }
.scene > svg.ground { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene .cl { fill: none; stroke: #f2e4c0; stroke-width: 1px; opacity: .1; vector-effect: non-scaling-stroke; }
.scene .cl.ix { opacity: .2; }
.scene .path { fill: none; stroke: var(--accent); stroke-width: 1px; stroke-dasharray: 2 5; stroke-linecap: round; opacity: .32; vector-effect: non-scaling-stroke; }
.scene .road { stroke-dasharray: none; opacity: .24; }
.scene .rng { fill: none; stroke: #f2e4c0; stroke-width: 1px; stroke-dasharray: 1 6; opacity: .16; vector-effect: non-scaling-stroke; }
.scene .wall { fill: none; stroke: var(--accent); opacity: .55; vector-effect: non-scaling-stroke; }
.scene .stakes { fill: none; stroke: var(--gold-ink); stroke-dasharray: 2 7; opacity: .5; vector-effect: non-scaling-stroke; }
.scene .spot { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; cursor: pointer; z-index: 2; }
.scene .spot .medal { width: 54px; height: 54px; border-radius: 13px; display: grid; place-items: center; position: relative; color: #3a2513;
  background: linear-gradient(180deg, #f2e4c0, #e4cf9c); border: 1px solid #8a6232; box-shadow: 0 10px 18px -8px #000, inset 0 1px 0 #fff8;
  transition: transform .14s var(--ease), box-shadow .14s var(--ease), border-color .14s; }
.scene .spot .medal .ic { width: 28px; height: 28px; }
.scene .spot:hover .medal { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg2), 0 14px 22px -8px #000; }
.scene .spot.zero .medal { background: #2a1c11a0; color: #f2e4c0; border-style: dashed; box-shadow: none; }
.scene .spot.zero .medal .ic { opacity: .38; }
.scene .spot .lv { position: absolute; right: -7px; top: -7px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center;
  background: var(--badge); color: var(--badge-ink); font: 700 .75rem var(--sans); border: 1px solid var(--badge-line); font-variant-numeric: tabular-nums; }
.scene .spot .lv.up { background: #2f6b3a; border-color: #9fd08a; }
.scene .spot .nm { margin-top: 6px; padding: 1px 8px; border-radius: var(--r-sm); background: #2a1c11d0; color: var(--text-2); font: 500 .75rem var(--sans); white-space: nowrap; border: 1px solid var(--hair); }
.scene .spot:hover .nm { color: var(--text-hi); }
.scene .spot.zero .nm { opacity: .6; }
.scene-tools { display: flex; justify-content: space-between; align-items: center; margin: 0 0 var(--s2); gap: var(--s2); flex-wrap: wrap; }
/* T24a rendered village (villageart.js): plate + layers as <img>s in image-% positions, hit polygons in an SVG on top. */
/* UX15 (user 2026-11-20): the render is shown as is with a hard edge (no glow, no fade into the panel), cropped to the part that
   holds every building and the wall (villageart.js cropOf; .vart has the crop's aspect, --ar = its width / height) and sized to
   fit both the panel's width and the window's height below the sticky top bar (--vfit, villageart.js fit); no panning on phones. */
.vart { position: relative; width: 100%; margin: var(--s2) auto; aspect-ratio: 3600 / 1950; isolation: isolate;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.vart.wait { display: grid; place-items: center; }
.vpan { margin: var(--s2) 0; }
.vpan > .vart { width: min(100%, calc(max(200px, var(--vfit, 100svh)) * var(--ar, 1.85))); margin: 0 auto; }
.vart .vclip { position: absolute; inset: 0; overflow: hidden; }
.vart .vpic { position: absolute; }
.vpic > img { position: absolute; display: block; max-width: none; pointer-events: none; }
.vpic > img.plate { left: 0; top: 0; width: 100%; height: 100%; }
.vpic > img.ghost { opacity: .32; filter: grayscale(.6); }
/* SK46: the moving pieces of a skin's village (villageart.js motion engine): turning wings and their shadow, the river's
   sheen (a canvas over the water), marching soldiers (a sprite sheet each, moved with transform). */
.vpic > img.vmw { will-change: transform; }
.vpic > canvas.vmr, .vpic > i.vmk { position: absolute; display: block; pointer-events: none; }
.vpic > i.vmk { left: 0; top: 0; opacity: 0; background-repeat: no-repeat; will-change: transform; }
.vart .vhit { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.vart .hb { pointer-events: all; cursor: pointer; outline: none; }
.vart .hb polygon { fill: transparent; stroke: transparent; stroke-width: 2px; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill var(--t), stroke var(--t); }
.vart .hb.on polygon, .vart .hb:focus-visible polygon { fill: #b97a1626; stroke: var(--accent); }
.vart .hb.zero.on polygon, .vart .hb.zero:focus-visible polygon { fill: #2a1c1140; stroke: var(--text-2); stroke-dasharray: 5 5; }
/* UX16: the click area traced from a sprite's opaque pixels (villageart.js maskOf); never drawn, the hull outline shows the hover. */
.vart .hm path { fill: transparent; stroke: none; }
.vart .vlabel, .vart .vtag { position: absolute; transform: translate(-50%, calc(-100% - 4px)); border-radius: var(--r-sm); white-space: nowrap; pointer-events: none;
  background: var(--badge); border: 1px solid var(--badge-line); color: var(--badge-ink); font: 500 .75rem/1.3 var(--sans); font-variant-numeric: tabular-nums; z-index: 2; }
.vart .vlabel { z-index: 3; padding: 2px 8px; color: var(--badge-ink); border-color: var(--accent); transform: translate(-50%, calc(-100% - 30px)); }
.vart .vtag { z-index: 2; display: inline-flex; align-items: center; gap: 5px; min-width: 22px; justify-content: center; padding: 1px 6px; color: var(--badge-ink); box-shadow: 0 2px 6px #0008; }
.vart .vtag b { font-weight: 650; }
.vart .vtag i { font-style: normal; font-size: .75rem; color: var(--text-2); }
.vart .vtag.up { border-color: var(--ok); }
.vart .vtag.up b { color: var(--ok); }
.vart .vtag .cd { font-size: .75rem; color: var(--text-2); padding-left: 5px; border-left: 1px solid var(--hair-2); }
@media (max-width: 600px) { .vart .vtag { padding: 0 4px; gap: 3px; min-width: 16px; }
  .vart .vlabel { padding: 1px 5px; transform: translate(-50%, calc(-100% - 22px)); } }
/* SK22b: no room above the tag (villageart.js hover): the label goes just below the tag's anchor, inside the picture. */
.vart .vlabel.below { transform: translate(-50%, 6px); }
@media (max-width: 600px) { .scene .spot .medal { width: 42px; height: 42px; border-radius: 10px; } .scene .spot .medal .ic { width: 22px; height: 22px; } .scene .spot .nm { display: none; } }

/* ---- Boot placeholder: index.html's #boot sits in #app until the app's first render replaces it; boot.js adds .boot-fail after 15 s ---- */
.boot { display: flex; flex-direction: column; align-items: center; gap: 16px; margin: 22vh auto 0; padding: 0 var(--s4); text-align: center; }
.boot-title { display: flex; flex-direction: column; align-items: center; gap: 14px; font: 600 1.25rem/1 var(--display); letter-spacing: .34em; padding-left: .34em; text-transform: uppercase; color: var(--text-hi); }
.boot-title::before { content: ''; width: 9px; height: 9px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 10px var(--accent-lo); animation: boot-pulse 1.2s ease-in-out infinite alternate; }
@keyframes boot-pulse { from { opacity: .35; } }
.boot-msg { margin: 0; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.boot-fail { margin: 4px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 12px; color: var(--text); }

/* ---- Login ---- */
.login { max-width: 380px; margin: 13vh auto 0; }
.login .topbar { position: static; border-radius: 14px 14px 0 0; border: 1px solid var(--hair-2); border-bottom: none; justify-content: center; padding: 26px 18px 20px; background: #3b2715; flex-direction: column; gap: 8px; box-shadow: none; }
.login .topbar .title { font-size: 1.25rem; letter-spacing: .34em; padding-left: .34em; color: var(--text-hi); flex-direction: column; gap: 14px; }
.login .topbar .title::before { width: 9px; height: 9px; }
.login .topbar .res { margin: 0; }
.login .topbar .res.muted { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.login .panel { border-radius: 0 0 14px 14px; border: 1px solid var(--hair-2); border-top: 2px solid var(--accent); background: var(--bg-2); box-shadow: 0 30px 70px -20px #000; }
.login label { display: block; margin: 12px 0 5px; font: 600 .75rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.login input { width: 100%; padding: 9px 11px; }
.login .row { display: flex; gap: 8px; margin-top: 18px; }
.login .row .btn { flex: 1; padding: 9px; }
.login .row .btn[name=register] { color: var(--text); background: transparent; border-color: var(--hair-2); }
.login .row .btn[name=register]:hover { background: var(--ov-1); border-color: var(--hair-3); }
.err { color: var(--bad); min-height: 1.4em; margin-top: 8px; }

/* ---- Admin console ---- */
.console {
  background: #1d130b; color: #e6d6b0; font: .75rem/1.5 var(--mono); padding: 10px 12px; height: 360px;
  overflow: auto; white-space: pre-wrap; border-radius: var(--r); border: 1px solid var(--hair); box-shadow: inset 0 2px 10px #000;
}
.console .prompt { color: var(--gold-ink); } .console .tool { color: var(--info); } .console .done { color: var(--ok); } .console .error { color: var(--bad); }

/* ---- Reports ---- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 0; box-shadow: 0 0 0 3px var(--ov-1); }
.dot.win { background: var(--ok); } .dot.win_loss { background: var(--warn); } .dot.loss { background: var(--bad); }
.dot.scout, .dot.support { background: var(--info); } .dot.trade { background: #9a6b3a; } .dot.info { background: #8a7a5e; } .dot.event { background: var(--accent); }
/* UX9 (U11): haul mark after a report's title in the list, a CSS circle: filled = full haul (the farm assistant's rule), half = part, empty = none */
.haul { display: inline-block; width: 10px; height: 10px; margin-left: 6px; box-sizing: border-box; border: 1.5px solid currentColor; border-radius: 50%; vertical-align: -1px; cursor: default; }
.haul.h-full { color: var(--gold-ink); background: currentColor; } .haul.h-part { color: var(--text-2); background: linear-gradient(90deg, currentColor 50%, transparent 50%); } .haul.h-none { color: var(--text-3); }   /* not .full: a global red rule */
.outcome { padding: 10px 14px !important; font: 600 .875rem var(--display) !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--text-hi) !important; border-left: 3px solid transparent; }
.outcome.win { background: var(--ok-bg) !important; border-left-color: var(--ok); } .outcome.win_loss { background: var(--warn-bg) !important; border-left-color: var(--warn); }
.outcome.loss { background: var(--bad-bg) !important; border-left-color: var(--bad); }
.outcome.scout, .outcome.support { background: var(--info-bg) !important; border-left-color: var(--info); }
.outcome.trade, .outcome.info, .outcome.event { background: var(--ov-1) !important; border-left-color: var(--hair-3); }
.mods { background: var(--ov-0); border: 1px solid var(--hair); padding: 5px 10px; border-radius: var(--r); font-size: .78125rem; }
.conquered { font: 600 1rem var(--display); color: var(--ok); }
.cols.rep { grid-template-columns: minmax(0, 1fr) 260px; }
@media (max-width: 820px) { .cols.rep { grid-template-columns: 1fr; } }
.star { color: var(--text-3); font-size: 1rem; } .star.on { color: var(--accent); -webkit-text-stroke: 1px var(--gold-ink); }
.note { background: var(--warn-bg); }

/* ---- Mail, forum, BB-codes ---- */
.post h3 { justify-content: flex-start; } .post h3 .right { margin-left: auto; float: none; }
.post.new { border-color: var(--accent-lo); box-shadow: 0 0 0 3px var(--accent-bg); }
.preview { font-weight: normal; max-width: 440px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
blockquote { margin: 6px 0; padding: 5px 12px; border-left: 2px solid var(--accent-lo); background: var(--ov-0); border-radius: 0 var(--r) var(--r) 0; color: var(--text-2); }
.bb { word-break: break-word; line-height: 1.6; } .bb-small { font-size: .75rem; } .bb-large, .bb-big { font-size: 1.125rem; }
.bb details { background: var(--ov-0); border-radius: var(--r); padding: 3px 8px; }
.bbbar { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; }
/* RP20: the BB-code list folds behind a round "?" (core.js bbHelp); open, it takes a line of its own */
.bbhelp { display: inline-block; vertical-align: middle; } .bbhelp[open] { display: block; flex-basis: 100%; }
.bbhelp > summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; border: 1px solid var(--hair-3); border-radius: 999px; font-weight: 600; color: var(--text-2); }
.bbhelp > summary::-webkit-details-marker { display: none; }
/* RP20: a Premium jump button scrolls its box to just under the sticky top bar */
.box[class*="pp-"] { scroll-margin-top: 72px; }
.fh { background: none; color: var(--text-hi); padding: 0; font: 600 1.0625rem var(--display); letter-spacing: -.005em; text-transform: none; margin: 4px 0 var(--s3); border: none; }
.pager { margin: var(--s2) 0; display: flex; gap: 6px; }
.news > div { padding: 5px 0; border-bottom: 1px solid var(--hair); font-size: .8125rem; }
.online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.online.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.rel3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin-bottom: var(--s3); }
.rel3 .col { background: var(--ov-0); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 10px; }
@media (max-width: 760px) { .rel3 { grid-template-columns: 1fr; } }
code { background: var(--ov-2); padding: 1px 5px; border-radius: var(--r-sm); font: .75rem var(--mono); word-break: break-all; color: var(--gold-ink); }

/* ---- Progress bits ---- */
.bar { display: inline-block; width: 100px; height: 6px; background: var(--ov-2); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-lo), var(--accent)); border-radius: 4px; transition: width .4s var(--ease); }
.tierdot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ov-1); border: 1px solid var(--hair-2); font-size: .75rem; margin-right: 2px; color: var(--text-3); }
.tierdot.on { background: var(--accent-bg2); border-color: var(--accent); color: var(--gold-ink); font-weight: 700; }
.full-cell { color: var(--bad); font-weight: 600; }
.quest { border-bottom: 1px solid var(--hair); padding: 10px 12px; }
.quest:last-child { border-bottom: none; }
.quest.done { background: linear-gradient(90deg, var(--ok-bg), transparent); }
.qhead { display: flex; gap: 10px; align-items: center; margin-bottom: 3px; font: 600 .875rem var(--sans); color: var(--text-hi); }
.qhead .btn { margin-left: auto; }
.reward { font-size: .78125rem; margin-top: 4px; color: var(--text-2); }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s2); }
@media (max-width: 760px) { .calendar { grid-template-columns: repeat(3, 1fr); } }
.day { background: var(--ov-0); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 8px; font-size: .75rem; min-height: 100px; opacity: .5; }
.day.reached { opacity: 1; background: var(--bg-3); } .day.claimed { background: var(--ok-bg); border-color: var(--ok-line); }
.day.reached:not(.claimed) { border-color: var(--accent-lo); box-shadow: 0 0 0 3px var(--accent-bg); }
.day .dn { font: 600 .8125rem var(--display); color: var(--text-hi); margin-bottom: 3px; }
.day .locked { margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--hair-2); color: var(--text-2); }
.chart { margin: 0 0 var(--s3); } .chart figcaption { font: 600 .75rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 4px; }
.chart svg { width: 100%; max-width: 580px; height: auto; background: var(--bg-1); border: 1px solid var(--hair); border-radius: var(--r); }
.chart .axis { stroke: var(--hair-3); } .chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .dotp { fill: var(--gold-ink); } .chart .lbl { font-size: .75rem; fill: var(--text-2); }
.emblem { width: 44px; height: 44px; vertical-align: middle; }
h2 .emblem { width: 32px; height: 32px; }
.emblems { display: flex; flex-wrap: wrap; gap: 4px; }
.emblems .em { border: 1px solid transparent; border-radius: var(--r); cursor: pointer; padding: 3px; transition: border-color var(--t), background var(--t); }
.emblems .em:hover { background: var(--ov-1); }
.emblems .em.on { border-color: var(--accent); background: var(--accent-bg); }
.emblems input { display: none; }
.ach-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.ach { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-bg); border: 1px solid #b97a1266; color: var(--gold-ink); border-radius: 999px; padding: 2px 10px 2px 5px; font-size: .75rem; white-space: nowrap; }
.coins { background: var(--ov-0); border-bottom: 1px solid var(--hair); }
.tier .in { min-height: 44px; }
.sim-opts { margin-top: var(--s3); max-width: 540px; }
.farmtpl { margin: 3px 0; }
.box select, .box input:not([type=checkbox]):not([type=radio]) { max-width: 100%; }
.box td .inline { margin-top: 4px; }

/* empty states: a quiet ring + muted text (no illustration) */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 14px !important; text-align: center; color: var(--text-3) !important; font-size: .78125rem; }
.empty::before { content: ''; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--hair-3); background: radial-gradient(circle, var(--hair-3) 0 2px, transparent 2.5px); }

/* ---- Map ---- */
.mappanel h2 { font-size: .9375rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
/* Map canvas (T13): one pan/zoom canvas drawn by public/views/map.js; the page only supplies the frame and overlays */
.mapwrap { position: relative; }
.mapstage { position: relative; height: clamp(400px, 66vh, 720px); border: 1px solid var(--hair-2); border-radius: var(--r); overflow: hidden; background: #1a110a; box-shadow: 0 18px 40px -16px #140c06; }
.mapstage::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 70px 6px #140c069c; }
#mapcv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; outline: none; }
#mapcv:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-lo); }
.maphud { position: absolute; left: 44px; bottom: 10px; z-index: 2; max-width: calc(100% - 100px); padding: 4px 10px; pointer-events: none; font: 500 .75rem/1.45 var(--sans); letter-spacing: .02em; font-variant-numeric: tabular-nums;
  color: var(--text); background: #1d130bd6; border: 1px solid var(--hair-2); border-radius: var(--r-sm); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapzoom { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: flex; flex-direction: column; overflow: hidden; background: #1d130be6; border: 1px solid var(--hair-2); border-radius: var(--r); box-shadow: var(--sh-1); }
.mz { width: 32px; height: 30px; padding: 0; display: grid; place-items: center; font: 500 1.0625rem/1 var(--sans); color: var(--text); background: none; border: 0; cursor: pointer; transition: background var(--t), color var(--t); }
.mz + .mz { border-top: 1px solid var(--hair); }
.mz:hover { background: var(--accent-bg2); color: var(--gold-ink); }
.mz .ic { width: 15px; height: 15px; vertical-align: 0; }
.hlrow { margin: 4px 0; } .hlrow input[type=color] { width: 26px; height: 20px; padding: 0; vertical-align: middle; }
.map-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.map-nav form { display: flex; gap: 4px; align-items: center; }
.legend { font-size: .6875rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 4px 2px; align-items: center; letter-spacing: .02em; }
.sw { display: inline-block; width: 9px; height: 9px; margin: 0 4px 0 10px; border: 1px solid #0008; border-radius: 50%; vertical-align: -1px; }
.lgi { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
.gb { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: rgba(26,17,10,.82); border: 1px solid rgba(255,255,255,.18); font-size: .625rem; font-weight: 600; line-height: 1; }
.gb i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
#mappop .pgroups { display: flex; flex-wrap: wrap; gap: 2px 10px; }
#mappop .pg { display: inline-flex; align-items: center; gap: 4px; }
#mappop .pg i { width: 8px; height: 8px; border-radius: 50%; }
#minimap { display: block; width: 100%; max-width: 260px; aspect-ratio: 1; border: 1px solid var(--hair-2); border-radius: var(--r); cursor: crosshair; touch-action: none; background: #1a110a; }

/* Map hover popup, click ring, quick commands */
#mappop { position: fixed; z-index: 50; max-width: 320px; padding: 8px 11px; font-size: .75rem; line-height: 1.5; background: #f2e4c0f5; color: var(--text);
  border: 1px solid var(--hair-2); border-radius: var(--r); box-shadow: var(--sh-2); pointer-events: none; font-family: var(--sans); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#mappop .vis { margin: 2px 0; } #mappop[hidden] { display: none; }
#mappop b { color: var(--text-hi); } #mappop .muted { color: var(--text-2); }
.ring { position: absolute; width: 0; height: 0; z-index: 20; }
.ring .rb { position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid #a98a52; background: #f2e4c0f5; color: #3a2513;
  cursor: pointer; font-size: .875rem; line-height: 1; padding: 0; box-shadow: var(--sh-2); transform: rotate(var(--a)) translate(46px) rotate(calc(-1 * var(--a)));
  transition: background var(--t), border-color var(--t); }
.ring .rb:hover { background: #d9c18a; border-color: #b97a12; color: #24150a; }
.ring .rb.rc { transform: none; width: 20px; height: 20px; left: -10px; top: -10px; font-size: .625rem; background: #e4cf9c; color: #a3341f; }
.ring .rb .rl { display: none; }
/* U8: touch screens (tablets too) get 44 px ring discs, further out so they keep apart; phones also get a short label under each disc
   (the ring's radius there keeps every label clear of the next disc). Desktop with a mouse is unchanged. */
@media (pointer: coarse), (max-width: 760px) {
  .mz { width: 44px; height: 44px; }
  .ring .rb { left: -22px; top: -22px; width: 44px; height: 44px; font-size: 1.1875rem; transform: rotate(var(--a)) translate(66px) rotate(calc(-1 * var(--a))); }
  .ring .rb.rc { left: -18px; top: -18px; width: 36px; height: 36px; font-size: .8125rem; }
}
@media (max-width: 760px) {
  .ring .rb { transform: rotate(var(--a)) translate(92px) rotate(calc(-1 * var(--a))); }
  .ring .rb .rl { display: block; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; padding: 1px 5px; max-width: 76px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; font: 600 .625rem/1.3 var(--sans); color: #3a2513; background: #f2e4c0f2; border: 1px solid #a98a52; border-radius: var(--r-sm); box-shadow: var(--sh-1); }
}
/* U60: on phones (and short landscape touch screens) the map leaves room above and below it to scroll the page with a finger
   (RP19: 68 % instead of 55 %; the first fold header under the map still shows above the bottom bar, and the page scrolls from there) */
@media (max-width: 760px), (pointer: coarse) and (max-height: 540px) { .mapstage { height: max(240px, 68vh); height: max(240px, 68svh); } .mapstage::after { box-shadow: inset 0 0 30px 3px #140c069c; } }
#mappop .ptap { margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--hair); color: var(--gold-ink); font-weight: 600; }
.popset { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 2px 0 var(--s2); font-size: .75rem; }

/* ---- Toast ---- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: min(560px, calc(100% - 32px));
  background: #3b2715f5; color: var(--text-hi); padding: 10px 18px; border-radius: var(--r-lg); border: 1px solid var(--hair-2); border-left: 3px solid var(--accent);
  box-shadow: var(--sh-2); animation: toastIn .2s var(--ease); font-weight: 500;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- UX13: a control whose action is still running (core.js runOnce: class busy + aria-busy) and the "no connection" bar (core.js netBar) ---- */
.busy { cursor: progress; }
:is(.btn, .mini).busy, form.busy { opacity: .72; }
:is(.btn, .mini, .link).busy::after { content: ''; display: inline-block; width: .7em; height: .7em; margin-left: .45em; vertical-align: -.06em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: busy-spin .8s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
/* UX9: the control that opened a game dialog (core.js dialog) waits for the answer: no spinner behind the box, only while its request runs */
body:has(> .dlg) :is(.btn, .mini, .link).busy::after { display: none; }
body:has(> .dlg) :is(.btn, .mini).busy, body:has(> .dlg) form.busy { opacity: 1; }
#netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 150; height: 26px; padding: 0 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 600 .8125rem/1.625rem var(--sans); text-align: center; color: #fff4d6; background: #5a3510f5; border-bottom: 2px solid var(--accent); box-shadow: var(--sh-1); }
#netbar[hidden] { display: none; }
body.offline { padding-top: 28px; }
body.offline .topbar { top: 28px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } .busy::after { animation: none !important; } }

/* ---- Small screens ---- */
@media (max-width: 600px) {
  #app { padding: 0 6px 40px; }
  .panel { padding: 12px 10px; }
  .topbar { position: static; gap: 6px 10px; }
  .topbar .res { margin-left: 0; }
  .nav button { padding: 5px 8px; font-size: .75rem; } .nav .ni:has(.nc) > [data-tab] { padding-right: 4px; } .nav .nc { padding: 5px 7px 5px 3px; }
  .village-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 7px; }
  .bld { padding: 7px; gap: 7px; } .bld .ic.big { width: 34px; height: 34px; padding: 6px; } .bld b { font-size: .78125rem; }
  h2 { font-size: 1.0625rem; }
  .subnav button { padding: 5px 9px; font-size: .75rem; }
}
@media (max-width: 760px) { table.vis { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; } .panel { overflow-x: hidden; } }

/* ---- Icon tints (icons.js sets data-i; everything else follows the text colour) ---- */
.ic[data-i=wood] { color: var(--ic-wood); } .ic[data-i=clay] { color: var(--ic-clay); } .ic[data-i=iron] { color: var(--ic-iron); }
.ic[data-i=pop] { color: var(--ic-pop); } .ic[data-i=storage] { color: var(--ic-storage); } .ic[data-i=pp] { color: var(--gold-ink); }
.ic[data-i=attack] { color: var(--bad); } .ic[data-i=support] { color: var(--info); } .ic[data-i=return] { color: var(--ok); }
.ic[data-i=star], .ic[data-i=trophy], .ic[data-i=crown] { color: var(--accent); } .ic[data-i=clock], .ic[data-i=moon] { color: var(--text-2); }
.nav button .ic, .ic.big { color: inherit; }
/* Painted icons (icons.js pic): the <img> brings its own size inline, so it is never rescaled away from its file. In text lines they take no
   more height than the 18 px glyphs did (negative margins). Clicks and long presses go to the link or button around them. */
img.ic.pi { pointer-events: none; vertical-align: -5px; margin-block: -4px; }
img.ic.pi[width="32"] { vertical-align: middle; margin-block: -7px; }
img.ic.pi[width="64"] { vertical-align: top; margin-block: 0; }
h3 img.ic.pi { margin-block: -1px; } #mapinfo .vis img.ic.pi { vertical-align: -4px; }
.uin img.ic.pi { margin-block: -1px; }   /* the unit columns of the send form stay level with the glyph columns */
@media (max-width: 760px) { h3 img.ic.pi, .uin img.ic.pi { margin-block: -2px; } }

/* ---- Side panels on the map page (box colours come from the base theme) ---- */
/* the world box keeps room for the minimap while it loads; a closed phone fold (map.js fold) is only its header (UX9) */
.mapside .box:first-child:not(details.mfold:not([open])) { min-height: 120px; }
.mapside input[type=color] { padding: 0; background: none; }

/* T27 account manager dashboard */
.grprow { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 var(--s3); }
.grprow .pill { font-family: inherit; color: var(--text); }
.grprow .pill.on { background: var(--accent-bg2); border-color: var(--accent-lo); color: var(--text-hi); }
.mdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; background: var(--bg-5); box-shadow: 0 0 0 3px var(--ov-1); }
.mdot.s-ok { background: var(--ok); } .mdot.s-wait { background: var(--warn); } .mdot.s-warn { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.mdot.s-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--hair-3, #55606e); }
td.mdc { text-align: center; }
tr.mpaused td { opacity: .55; }
tr.mpaused td:first-child, tr.mpaused td:last-child { opacity: 1; }
.tag { font-size: .75rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--hair-2); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
/* FND1: the founder badge on a profile (views/profile.js): dark tag, gold rule and lettering */
.founder-badge { display: inline-block; background: var(--badge); color: var(--accent-hi); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 10px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.mgrbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-bottom: 1px solid var(--hair-2); background: var(--bg-2); }
.mgrbar select { max-width: 150px; } .mgrbar input[type=number] { width: 52px; margin-left: 2px; }
.mgrlegend { margin: 6px 12px; } .mgrlegend .mdot { margin-left: 10px; }
.warnlist { list-style: none; margin: 0; padding: 4px 12px 8px; }
.warnlist li { padding: 5px 0; border-bottom: 1px solid var(--hair); }
.warnlist li:last-child { border-bottom: 0; }
.warnlist .wk { display: inline-block; min-width: 60px; margin-right: 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--warn); }
/* T28 build-template editor */
.tpled .tsum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--hair-2); border-radius: var(--r); background: var(--bg-2); }
.tchip { padding: 1px 8px; border: 1px solid var(--hair-3); border-radius: 99px; font-size: .75rem; background: var(--bg-3); font-variant-numeric: tabular-nums; }
.tchip b { color: var(--gold-ink); }
.tcount { margin-left: auto; }
.tsteps { list-style: none; margin: 0 0 8px; padding: 0; max-height: 340px; overflow-y: auto; border: 1px solid var(--hair-2); border-radius: var(--r); background: var(--bg-1, var(--bg-2)); }
.tstep { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-bottom: 1px solid var(--hair); position: relative; user-select: none; }
.tstep:last-child { border-bottom: 0; }
.tstep:hover { background: var(--bg-3); }
.tstep:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tstep.dragging { background: var(--accent-bg); }
.tstep.t-before::before, .tstep.t-after::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); }
.tstep.t-before::before { top: -1px; } .tstep.t-after::after { bottom: -1px; }
.tgrip { cursor: grab; touch-action: none; color: var(--text-3); padding: 4px 6px; letter-spacing: -2px; font-size: .875rem; line-height: 1; }
.tgrip:hover { color: var(--accent); }
.tn { width: 28px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.tb .ic { width: 16px; height: 16px; }
.tlv { color: var(--text-2, var(--text)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tlv b { color: var(--gold-ink); }
.tact { display: flex; gap: 4px; }
.tact .mini { min-width: 30px; min-height: 28px; justify-content: center; }
.tact .mini:disabled { opacity: .35; cursor: default; }
.tadd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tadd input[type=number] { width: 64px; }
.tadv { margin-top: 4px; padding: 8px 10px; border: 1px solid var(--hair-2); border-radius: var(--r); background: var(--bg-2); }
.tadv textarea { font-family: var(--mono, ui-monospace, monospace); }
@media (max-width: 640px) { .tstep { gap: 4px; padding: 4px; } .tp { display: none; } .tn { width: 20px; } .tb { overflow: hidden; white-space: nowrap; } .tb b { overflow: hidden; text-overflow: ellipsis; } .tact .mini { min-width: 34px; min-height: 34px; } }
.warnlist .w-build .wk, .warnlist .w-troops .wk, .warnlist .w-research .wk, .warnlist .w-loyalty .wk { color: var(--bad); }
/* T29 troop progress + reserve */
td.pg { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.pg small { color: var(--info); }
td.pg-ok { color: var(--ok); background: var(--ok-bg); } td.pg-mid { color: var(--warn); background: var(--warn-bg); } td.pg-low { color: var(--bad); background: var(--bad-bg); }
td.pg .muted { color: inherit; opacity: .6; }
.pgkey { display: inline-block; padding: 0 8px; margin-left: 4px; border-radius: 99px; font-size: .75rem; }
.pgkey.pg-ok { color: var(--ok); background: var(--ok-bg); } .pgkey.pg-mid { color: var(--warn); background: var(--warn-bg); } .pgkey.pg-low { color: var(--bad); background: var(--bad-bg); }
.rsv { margin: 8px 0; } .rsvrow .uin { margin-right: 4px; }
/* T33 overview polish: build-queue strip, row icons, pager */
.qstrip { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: middle; }
.qi { display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px 1px 3px; border: 1px solid var(--hair-2); border-radius: var(--r-sm); background: var(--bg-3); font-size: .75rem; font-variant-numeric: tabular-nums; }
.qi svg { width: 14px; height: 14px; vertical-align: -2px; }
.vact { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; vertical-align: middle; }
.vact .link { display: inline-flex; align-items: center; color: var(--text-3); }
.vact .link:hover { color: var(--text-hi); }
.vact svg { width: 13px; height: 13px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 var(--s3); font-size: .78125rem; }
.pager .pg-nav { display: inline-flex; gap: 10px; margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---- Settings: section menu on the left, horizontal pill row on narrow screens (T35) ---- */
.setlayout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.setnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: var(--s3); padding-right: var(--s3); border-right: 1px solid var(--hair-2); }
.setnav button {
  background: transparent; border: none; border-left: 2px solid transparent; text-align: left; padding: 8px 12px;
  font: 500 .8125rem var(--sans); color: var(--text-2); cursor: pointer; border-radius: 0 var(--r) var(--r) 0; transition: color var(--t), background var(--t), border-color var(--t);
}
.setnav button:hover { background: var(--ov-1); color: var(--text-hi); }
.setnav button.on { color: var(--text-hi); border-left-color: var(--accent); background: linear-gradient(90deg, var(--accent-bg), transparent); }
.setnav button:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.setbody { min-width: 0; }

/* ---- Inventory (IT3): running effects, category chips, item tiles with rarity border, detail panel ---- */
.invlayout { grid-template-columns: 170px minmax(0, 1fr); }
.invfx { background: var(--bg-3); border: 1px solid var(--hair-2); border-radius: var(--r); padding: var(--s2) var(--s3); margin: 0 0 var(--s3); }
.invfx h4 { margin: 0 0 var(--s1); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.invfx ul { list-style: none; margin: 0; padding: 0; }
.invfx li { display: grid; grid-template-columns: minmax(130px, auto) 1fr auto; gap: var(--s3); align-items: baseline; padding: 3px 0; border-top: 1px solid var(--hair); }
.invfx li:first-child { border-top: none; }
.invfx .fxn .ic { width: 16px; height: 16px; vertical-align: -3px; color: var(--accent-lo); }
.invfx .fxt { font-variant-numeric: tabular-nums; color: var(--gold-ink); font-weight: 600; }
.invfx p { margin: 0; }
.invchips { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 var(--s3); }
.invchips .chip { display: inline-flex; align-items: center; gap: 5px; background: var(--ov-0); border: 1px solid var(--hair-2); border-radius: 999px; padding: 4px 11px;
  font: 500 .78125rem var(--sans); color: var(--text-2); cursor: pointer; transition: color var(--t), background var(--t), border-color var(--t); }
.invchips .chip .ic { width: 15px; height: 15px; }
.invchips .chip:hover { background: var(--ov-2); color: var(--text-hi); }
.invchips .chip.on { color: var(--text-hi); border-color: var(--accent); background: var(--accent-bg); }
.invsplit { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s4); align-items: start; }
.itiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--s2); }
.itile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; min-height: 92px; background: var(--bg-1);
  border: 2px solid var(--rc, var(--hair-3)); border-radius: var(--r); color: var(--text); font: 500 .75rem/1.2 var(--sans); text-align: center; cursor: pointer; transition: background var(--t), box-shadow var(--t); }
.itile:hover { background: var(--bg-3); }
.itile.on { box-shadow: 0 0 0 2px var(--accent-bg2), inset 0 0 0 1px var(--accent); background: var(--accent-bg); }
.itile:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.itile > .ic { width: 30px; height: 30px; color: var(--rc, var(--text-2)); }
.itile .iq { position: absolute; top: 3px; right: 5px; font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--text-hi); }
.itile .inm { overflow-wrap: anywhere; }
/* UX18: banner, relic and gear cards: picture, name, tier and the bonus always on the card */
.icards { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s3); }
.icard { flex-direction: row; align-items: flex-start; gap: var(--s3); padding: var(--s3); min-height: 0; text-align: left; border-width: 1px; border-left-width: 3px; }
.icard .ipic { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: var(--r-sm); background: var(--bg-3); }   /* UX20a: room for the 64 px painted picture */
.icard .ipic .ic { width: 28px; height: 28px; color: var(--rc, var(--text-2)); }
.icard .ibody { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: var(--s4); }
.icard .inm { font-weight: 600; font-size: .8125rem; color: var(--text-hi); }
.icard .isub { font-size: .75rem; color: var(--text-3); }
.icard .ifx { font-size: .78125rem; color: var(--gold-ink); font-weight: 600; }
.icard .iq { top: var(--s2); right: var(--s2); }
.invacts { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.invmore { margin: var(--s4) 0 0; }
.invmix p { margin: 0 0 var(--s2); }
.invmix div { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.invmix select { flex: 1 1 180px; min-width: 0; }
.r1 { --rc: var(--hair-3); } .r2 { --rc: var(--ok); } .r3 { --rc: var(--info); } .r4 { --rc: var(--accent); }
.invdet { position: sticky; top: var(--s3); background: var(--bg-2); border: 1px solid var(--rc, var(--hair-2)); border-top-width: 3px; border-radius: var(--r); padding: var(--s3); }
.invdet h3 { margin: 0 0 var(--s1); font-size: .9375rem; }
/* UX20a: the detail panel opens with the painted picture beside the name and tier */
.invhead { display: flex; gap: var(--s3); align-items: center; margin-bottom: var(--s2); }
.invhead > .ic { flex: none; width: 64px; height: 64px; color: var(--rc, var(--text-2)); } .invhead p { margin: 0; }
.slotcur + form { margin-top: var(--s1); }   /* village banner & relic slot: what hangs there, then the place / swap form */
.invdet h3 .ic { width: 20px; height: 20px; vertical-align: -4px; color: var(--rc, var(--text-2)); }
.invdet p { margin: 0 0 var(--s2); }
.invdet .in { padding: 0; margin: var(--s2) 0; }
.invdet form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: end; }
.invdet label { display: flex; flex-direction: column; gap: 2px; font-size: .75rem; color: var(--text-2); }
.invdesc { margin: 0 0 var(--s2); padding-left: 1.1em; }
.invdet.empty { border-style: dashed; border-top-width: 1px; }
.invlist { margin: 0 0 var(--s3); padding-left: 1.1em; }
@media (max-width: 900px) { .invsplit { grid-template-columns: minmax(0, 1fr); } .invdet { position: static; order: -1; scroll-margin-top: 72px; } .invdet.empty { display: none; } }
@media (max-width: 760px) { .invfx li { grid-template-columns: 1fr auto; } .invfx .fxd { grid-column: 1 / -1; order: 3; } }
.setbody > .box:first-child, .setbody > .subnav:first-child { margin-top: 0; }
@media (max-width: 760px) {
  .setlayout { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .setnav { flex-direction: row; overflow-x: auto; position: static; padding: 0 0 var(--s2); border-right: none; border-bottom: 1px solid var(--hair-2); -webkit-overflow-scrolling: touch; }
  .setnav button { flex: none; white-space: nowrap; border-left: none; border: 1px solid var(--hair-2); border-radius: 999px; padding: 6px 12px; font-size: .75rem; }
  .setnav button.on { border-color: var(--accent); background: var(--accent-bg); }
}

/* Timed controls (data-showat) wait invisible but keep their space, so nothing shifts when they appear. */
[data-showat] { visibility: hidden; }
.mini[hidden], .btn[hidden] { display: none; }
/* Build queue: fixed-width time and tools cells, so rows don't jump as timers and buttons change. */
td.qtime { white-space: nowrap; min-width: 6.5em; }
td.qtools { white-space: nowrap; }
td.qat { white-space: nowrap; }
/* RP18: on a phone the build queue row (village.js queueBox: Headquarters, building page, overview widget) is a small grid: name and
   cancel, time left and "done at", then the tools on their own line. As a table row it was about 100 px wider than its box, with
   "Finish now" cut off and the rush off screen. */
@media (max-width: 639.98px) {
  table.vis.queue, table.vis.queue tbody { display: block; width: 100%; overflow: visible; }
  table.vis.queue tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n x" "t a" "o o"; align-items: center; gap: 4px 10px; padding: 7px 8px; border-bottom: 1px solid var(--hair); }
  table.vis.queue tr:last-child { border-bottom: 0; }
  table.vis.queue td { display: block; padding: 0; border: 0; min-width: 0; }
  table.vis.queue td:first-child { grid-area: n; } table.vis.queue td.qtime { grid-area: t; } table.vis.queue td.qat { grid-area: a; justify-self: end; }
  table.vis.queue td.qtools { grid-area: o; white-space: normal; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; } table.vis.queue td.qtools:empty { display: none; }
  #app table.vis.queue tr > td.qx:last-child { grid-area: x; justify-self: end; position: static; background: none; box-shadow: none; } /* not the sticky last cell of wide phone tables */
  table.vis.queue td.qx .link { display: inline-block; min-width: 36px; padding: 4px 0; text-align: center; } /* a cancel ✕ a thumb can hit */
}

/* Map: send-troops popup from the ring (lives in <body>) */
.mapsend { position: fixed; right: 24px; top: 96px; z-index: 60; width: 340px; max-width: calc(100vw - 32px); max-height: calc(100vh - 120px); overflow: auto;
  background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: var(--r-lg); box-shadow: 0 12px 32px rgba(20,12,6,.5); padding: 12px 14px; }
.mapsend .ms-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mapsend input[type=number] { width: 80px; }
.mapsend .ms-tpl { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 600px) { .mapsend { left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-height: 70vh; } }

/* Hall of Champions (Champion 2.0): effect list, gear slots, three skill paths */
.chfx { margin: 4px 0 8px; padding-left: 18px; } .chfx li { margin: 2px 0; }
.chgear td { vertical-align: top; } .small { font-size: .75rem; }
.chpaths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3, 12px); }
.chpath h4 { margin: 0 0 6px; color: var(--gold-ink); }
.chskill { border: 1px solid var(--hair-2); border-radius: var(--r); padding: 6px 8px; margin-bottom: 6px; background: var(--bg-2); }
.chskill.on { border-color: var(--gold-ink); }
.chskill .mini { margin-top: 4px; }
@media (max-width: 700px) { .chpaths { grid-template-columns: 1fr; } }

/* Town Hall build list (and the building info page) on phones: one card per building instead of a 5-column table,
   so the build button never sits off-screen. Row = name / cost on one line / time + population + button. */
@media (max-width: 640px) {
  table.vis.hq, table.vis.hq tbody { display: block; width: 100%; }
  table.vis.hq tr:has(th) { display: none; }
  table.vis.hq tr { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 6px 14px; padding: 10px 12px; border-bottom: 1px solid var(--hair); }
  table.vis.hq td { display: block; padding: 0; border: 0; min-width: 0; }
  table.vis.hq td:first-child, table.vis.hq td[colspan] { grid-column: 1 / -1; }
  table.vis.hq td:nth-child(2):not([colspan]) { grid-column: 1 / -1; }
  table.vis.hq td:last-child { justify-self: end; text-align: right; }
  table.vis.hq td:empty { display: none; }
  table.vis.hq .cost { flex-wrap: wrap; gap: 2px 14px; }
}
@media (max-width: 640px) { table.vis.hq.bi td:nth-child(2) { grid-column: auto; } } /* info page row has no name cell */

/* U12 (UX9): the game's dialog box (core.js dialog: confirm, text, colour; ppConfirm adds "don't ask again today"): a modal card */
.dlg { position: fixed; inset: 0; z-index: 80; background: rgba(20, 12, 6, .62); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg-box { background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: var(--r-lg); box-shadow: 0 16px 40px rgba(20,12,6,.55); padding: 16px 18px;
  max-width: 420px; width: 100%; max-height: calc(100dvh - 32px); overflow: auto; }
.dlg-box > #dlgtext { margin-top: 0; white-space: normal; overflow-wrap: anywhere; }
.dlg-box .dlgf { display: grid; gap: 4px; margin: 10px 0; }
.dlg-box .dlgf > span { font-weight: 600; font-size: .8125rem; color: var(--text-2); }
.dlg-box .dlgf input:not([type=color]), .dlg-box .dlgf textarea { width: 100%; box-sizing: border-box; }
.dlg-box .dlgcol { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.dlg-box .dlgcol > span { grid-column: 1 / -1; }
.dlg-box input[type=color] { width: 64px; height: 40px; padding: 2px; cursor: pointer; }
.dlg-box .dlgchk { display: flex; gap: 6px; align-items: center; margin: 8px 0; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin: 14px 0 0; }

/* ---- UX20c: frame B "Carved frame" on every card and pop-up (approved sheet docs/ux20-b-detail.jpg, user 2026-12-01; mock art/ux20/frame-b.css).
   A dark-wood moulding with a gold bead and gold lozenge bosses: one SVG 9-slice (art/ui/frame-b.svg, slice 30) drawn as border-image
   at --fw wide (tile/tooltip 11 px, card 14 px, send box 18 px, pop-up 26 px). Square corners: border-image ignores border-radius.
   Rarity (--rc) = a band under the top of the frame. Titles in a book serif from the system (--serif, no font file).
   The name/village skin cards (.nmcard) get the same frame in names.css. ---- */
.itile, .invdet, .dlg-box, .mapsend, #mappop, .hk-panel, #toast, .taptip {
  border-radius: 0; border-style: solid; border-color: transparent; border-width: var(--fw); background-clip: padding-box;
  border-image: url(art/ui/frame-b.svg) 30 / var(--fw) stretch;
}
.itile { --fw: 11px; padding: 6px 3px 5px; background-color: #f8eed4;
  background-image: radial-gradient(ellipse at 50% 30%, #fbf3dc, #eedcae); box-shadow: inset 0 3px 0 var(--rc, #a98a52), 0 3px 6px #140c0680; }
.itile:hover { background-image: radial-gradient(ellipse at 50% 30%, #fbf3dc, #e4cf9c); }
.itile.on { background-image: radial-gradient(ellipse at 50% 30%, #fdf4d9, #e8cf8e);
  box-shadow: inset 0 3px 0 var(--rc, #a98a52), inset 0 0 0 1px #d7a845, inset 0 0 14px #b97a1255, 0 0 0 2px #d7a845, 0 3px 10px #140c06a0; }
.itile .iq { top: 3px; right: 5px; padding: 1px 7px; border-radius: 9px; font: 600 .75rem/1.4 var(--sans); color: var(--b-gold-hi);
  background: linear-gradient(180deg, #4a321c, #24170d); border: 1px solid var(--b-gold); box-shadow: 0 1px 2px #0006; }
.icard { --fw: 14px; padding: 10px 10px 9px; }
.icard .ipic { border-radius: 0; margin: 3px; background: radial-gradient(circle at 50% 40%, #f2e4c0, #cdb279);
  box-shadow: 0 0 0 1px #8a6232, 0 0 0 3px #2a1c11, 0 0 0 4px #b98a2e; }
.icard .iq { top: 62px; left: 49px; right: auto; }   /* the quantity seal sits on the picture's lower corner, clear of the text */
.icard .ibody { padding-right: 0; }
.icard .inm, .invdet h3 { font-family: var(--serif); font-size: .90625rem; letter-spacing: .01em; }
.invdet { --fw: 14px; padding: 12px; background: radial-gradient(ellipse at 50% 0%, #fbf3dc, #efdfb6); box-shadow: inset 0 3px 0 var(--rc, #a98a52), 0 3px 8px #140c0680; }
.invdet.empty { border-width: var(--fw); opacity: .85; }
.invdet h3 { font-size: 1.0625rem; text-transform: none; letter-spacing: .01em; color: var(--text-hi); border-bottom: 1px solid var(--b-gold); padding: 2px 0 6px; margin-bottom: 8px; }
.invdet label { font: 600 .75rem/1.3 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: #735533; gap: 4px; }
.invdet .invacts { gap: 14px; }
.invdesc { list-style: none; padding-left: 0; }
.invdesc li { position: relative; padding-left: 16px; margin: 2px 0; }
.invdesc li::before { content: ''; position: absolute; left: 2px; top: .55em; width: 6px; height: 6px; background: var(--b-gold); transform: rotate(45deg); box-shadow: 0 0 0 1px #5e3a06; }
/* category chips: parchment plates, the chosen one dark wood */
.invchips { gap: 6px; }
.invchips .chip { min-height: 30px; padding: 4px 12px; border-radius: 3px; font: 600 .8125rem var(--serif); color: #3a2513;
  background: linear-gradient(180deg, #f8ecd0, #e4cf9c); border: 1px solid #8a6232; box-shadow: inset 0 1px 0 #fff9, 0 1px 2px #140c0640; }
.invchips .chip:hover { background: linear-gradient(180deg, #fff6e0, #ead6a6); border-color: var(--b-gold); color: #24150a; }
.invchips .chip.on { color: #f0d48e; background: linear-gradient(180deg, #5e4127, #2a1c11); border-color: #140c06; box-shadow: inset 0 0 0 1px #b98a2e99, 0 1px 2px #140c0680; }
.invchips .chip.on .ic { color: #f0d48e; }
.invchips .chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.invchips .chip .muted { min-width: 18px; padding: 0 5px; border-radius: 9px; font: 600 .75rem/1rem var(--sans); text-align: center; color: #3a2513; background: #d9c18a; }
.invchips .chip.on .muted { color: #24150a; background: var(--b-focus); }

/* pop-ups: the full-width moulding, a carved title plank, an aged-parchment body */
.dlg-box { --fw: 26px; padding: 14px 16px; background-color: #f2e4c0;
  background-image: radial-gradient(ellipse 110% 90% at 50% 45%, #f8ecce 40%, #e6d0a0); box-shadow: inset 0 0 16px #6b4a2640, 0 20px 48px #0a0603c0; }
.dlg-head, .mapsend .ms-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: -14px -16px 14px; padding: 9px 10px 9px 16px;
  background: linear-gradient(180deg, #3d2816, #24170d 70%, #1d130b); border-bottom: 3px double var(--b-gold); color: var(--b-gold-hi); }
.dlg-head b, .mapsend .ms-head b { min-width: 0; overflow-wrap: anywhere; font: 600 1.1875rem/1.2 var(--serif); font-variant: small-caps; letter-spacing: .06em; color: var(--b-gold-hi); text-shadow: 0 1px 0 #000; }
.dlg-x, .mapsend .ms-head .mini { flex: none; display: grid; place-items: center; min-width: 32px; min-height: 32px; padding: 0; color: var(--b-gold-hi); background: none;
  border: 1px solid #8a6232; border-radius: 50%; box-shadow: none; font: 1.125rem/1 var(--sans); text-shadow: none; cursor: pointer; }
.dlg-x:hover, .mapsend .ms-head .mini:hover { color: #fde9b4; background: #ffffff12; border-color: var(--b-gold); box-shadow: none; }
.dlg-x:focus-visible, .mapsend .ms-head .mini:focus-visible { outline: 2px solid var(--b-focus); outline-offset: 2px; }
.dlg-box > #dlgtext { font-family: var(--serif); font-size: .96875rem; line-height: 1.45; text-align: center; margin: 4px 0; }
.dlg-box .dlgf > span { font: 600 .75rem/1.3 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: #735533; }
.dlg-box .dlgchk { gap: 9px; font: .875rem var(--serif); color: #3a2513; }
.dlg-btns { justify-content: center; margin-top: 16px; }
.mapsend { --fw: 18px; padding: 12px 14px; background: radial-gradient(ellipse 110% 90% at 50% 40%, #f8ecce 40%, #e9d5a8); box-shadow: 0 16px 40px #0a0603b0; }
.mapsend .ms-head { margin: -12px -14px 10px; padding: 7px 8px 7px 14px; }
.mapsend .ms-head b { font-size: 1.0625rem; }
#mappop { --fw: 14px; background-color: #f2e4c0f5; box-shadow: 0 10px 28px #0a0603a0; }
.hk-panel { --fw: 26px; background: radial-gradient(ellipse 110% 90% at 50% 40%, #f8ecce 40%, #e6d0a0); box-shadow: inset 0 0 16px #6b4a2640, 0 20px 48px #0a0603c0; }
.hk-head h2 { font: 600 1.1875rem/1.2 var(--serif); font-variant: small-caps; letter-spacing: .06em; }
#toast, .taptip { --fw: 11px; }
@media (max-width: 760px) {
  .dlg-box, .hk-panel { --fw: 18px; padding: 12px; }
  .dlg-head { margin: -12px -12px 12px; }
  .dlg-x, .mapsend .ms-head .mini { min-width: 36px; min-height: 36px; }
}

/* Sortable overview headers (survey gap, 2026-10-21) */
.vis th .sorth { color: inherit; white-space: nowrap; }
.vis th .sorth.on { color: var(--gold-ink); }

/* Map hover popup as a wide sideways card (2026-10-21): info | travel times | commands */
#mappop { max-width: min(760px, calc(100vw - 16px)); display: flex; gap: 14px; align-items: flex-start; }
#mappop .pcol { min-width: 0; }
#mappop .pinfo { flex: 0 1 260px; }
#mappop .pcol + .pcol { padding-left: 14px; border-left: 1px solid var(--hair); }
#mappop .pcmds { flex: 0 1 280px; }
#mappop .ph { font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 2px; }
#mappop .pcmds td { vertical-align: top; } #mappop .pu { color: var(--text-2); }
#mappop .nowrap { white-space: nowrap; }
@media (max-width: 600px) { #mappop { flex-wrap: wrap; } #mappop .pcol + .pcol { padding-left: 0; border-left: 0; border-top: 1px solid var(--hair); padding-top: 4px; } }
/* unit icons (engraved set, V7): gold accent follows the theme accent; 32 px woodcut in recruit rows */
.ic.uic { color: inherit; }
.uic-cell .ic.uic { vertical-align: middle; margin-right: 4px; }
/* TRIPO4 unit info (village.js unitInfo, in the dialog box): name, the unit's portrait, its values in two columns */
.uic-cell .uinfo-open { text-decoration: none; }
.uinfo { display: grid; justify-items: center; gap: 10px; }
.uinfo-pic { display: block; width: 240px; max-width: 100%; height: auto; aspect-ratio: 4 / 5; border: 3px solid #2a1c11; box-shadow: 0 0 0 1px var(--b-gold), 0 4px 12px #140c0680; }   /* UX20c: framed like the cards */
.uinfo-st { display: grid; grid-template-columns: 1fr auto; gap: 3px 16px; width: 100%; max-width: 300px; }
.uinfo-st > span { text-align: left; font-family: var(--serif); font-size: .875rem; }
.uinfo-st > b { text-align: right; }

/* ---- Phones: mobile audit 2026-10-22 (list in docs/mobile-audit.md). Desktop is untouched: every rule sits in a max-width query. ---- */
/* Tables that scroll inside their own box (<= 760 px): tighter cells; with a checkbox column the checkbox + village stay put (sticky), a lone action link in the last column stays at the right edge. */
@media (max-width: 760px) {
  #app table.vis th, #app table.vis td { padding-left: 7px; padding-right: 7px; }
  #app table.vis th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
  #app table.vis.rk :is(th, td):last-child { display: none; } /* ranking: the kills column is the least important one */
  #app table.vis:not(.farmt, .mail, .replist):has(> tbody > tr:first-child > th:first-child input[type=checkbox]) :is(th, td):is(:nth-child(1), :nth-child(2)) { position: sticky; z-index: 1; background-color: var(--bg-2); }
  #app table.vis:not(.farmt, .mail, .replist):has(> tbody > tr:first-child > th:first-child input[type=checkbox]) th:is(:nth-child(1), :nth-child(2)) { background-color: var(--bg-3); }
  #app table.vis:not(.farmt, .mail, .replist):has(> tbody > tr:first-child > th:first-child input[type=checkbox]) :is(th, td):nth-child(1) { left: 0; width: 32px; min-width: 32px; max-width: 32px; padding-left: 9px; padding-right: 0; }
  #app table.vis:not(.farmt, .mail, .replist):has(> tbody > tr:first-child > th:first-child input[type=checkbox]) :is(th, td):nth-child(2) { left: 32px; min-width: 108px; box-shadow: 1px 0 0 var(--hair-2); }
  #app table.vis.ut:not(.sim):not(:has(> tbody > tr:first-child > th:first-child input[type=checkbox])) :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background-color: var(--bg-2); box-shadow: 1px 0 0 var(--hair-2); }
  #app table.vis.ut:not(.sim):not(:has(> tbody > tr:first-child > th:first-child input[type=checkbox])) th:first-child { background-color: var(--bg-3); }
  #app table.vis :is(td, th):last-child:has(> .link:only-child, > .mini:only-child) { position: sticky; right: 0; z-index: 1; background-color: var(--bg-2); box-shadow: -1px 0 0 var(--hair-2); }
  #app table.vis th:last-child:empty { position: sticky; right: 0; z-index: 1; background-color: var(--bg-3); }
  /* long option texts in a select must not push a table cell wider than the screen */
  #app table.vis select { max-width: 160px; }
  .setnav { flex-wrap: wrap; overflow: visible; }
}
@media (max-width: 640px) {
  /* form controls: big enough for a thumb, 16 px so Android/iOS do not zoom the page on focus */
  #app input[type=number], #app input[type=text], #app input[type=search], #app input[type=password], #app input[type=date], #app input:not([type]), #app select { min-height: 36px; font-size: 1rem; }
  #app input[type=checkbox], #app input[type=radio] { width: 18px; height: 18px; }
  #app select { max-width: 100%; }
  #app .inline { max-width: 100%; } #app .inline > select, #app .inline > input { min-width: 0; }
  #app .mini { min-height: 32px; padding: 4px 10px; } #app .btn { min-height: 36px; }
  #app table.vis :is(td, th) [data-fill], #app .uin [data-fill] { padding: 6px 2px; }
  td[data-l]::before { content: attr(data-l); display: block; font: 600 .75rem/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Recruit (Nábor): one card per unit - name + home/total, cost + time, then the number field with its max link and no sideways scrolling */
  table.vis.rec, table.vis.rec tbody { display: block; width: 100%; overflow: visible; }
  table.vis.rec tr:has(th) { display: none; }
  table.vis.rec tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "u h" "c t" "n n"; align-items: center; gap: 6px 12px; padding: 10px 12px; border-bottom: 1px solid var(--hair); }
  table.vis.rec td { display: block; padding: 0; border: 0; min-width: 0; }
  table.vis.rec td:nth-child(1) { grid-area: u; } table.vis.rec td:nth-child(2) { grid-area: c; }
  table.vis.rec td:nth-child(3) { grid-area: t; justify-self: end; white-space: nowrap; }
  table.vis.rec td:nth-child(4) { grid-area: h; justify-self: end; text-align: right; }
  table.vis.rec td:nth-child(5) { grid-area: n; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  table.vis.rec td:nth-child(5) input { width: 110px !important; }
  table.vis.rec .cost { gap: 2px 12px; }
  .box > form > .in { padding-top: 8px; }

  /* Mail list: [tick] [star] subject + preview / people / date, one card per thread */
  table.vis.mail, table.vis.mail tbody { display: block; width: 100%; overflow: visible; }
  table.vis.mail tr:has(th) { display: block; padding: 6px 10px; border-bottom: 1px solid var(--hair-2); }
  table.vis.mail th:not(:first-child) { display: none; }
  table.vis.mail tr:not(:has(th)) { display: grid; grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "c s m" ". . p" ". . d"; gap: 2px 8px; align-items: start; padding: 8px 10px; border-bottom: 1px solid var(--hair); }
  table.vis.mail td { display: block; padding: 0; border: 0; min-width: 0; }
  table.vis.mail td:nth-child(1) { grid-area: c; } table.vis.mail td:nth-child(2) { grid-area: s; } table.vis.mail td:nth-child(3) { grid-area: m; }
  table.vis.mail td:nth-child(4) { grid-area: p; font-size: .75rem; color: var(--text-2); } table.vis.mail td:nth-child(5) { grid-area: d; font-size: .75rem; }
  table.vis.mail .preview { max-width: 100%; }
  /* RP20: mail and report lists: a tap in the tick or star cell ticks the row, a tap anywhere else opens it, so the two cells are
     thumb-sized; the report list keeps them narrow and its date on one line */
  #app table.vis:is(.mail, .replist) :is(th, td):is(:nth-child(1), :nth-child(2)) { min-width: 44px; padding-left: 0; padding-right: 0; text-align: center; }
  table.vis.mail td:is(:nth-child(1), :nth-child(2)) { align-self: stretch; } /* the whole height of the card's first line */
  table.vis.replist :is(th, td):is(:nth-child(1), :nth-child(2)) { width: 1%; }
  #app table.vis.replist td:last-child { white-space: nowrap; }
  table.vis:is(.mail, .replist) .star { display: inline-block; min-width: 44px; padding: 11px 0; border-bottom: 0; }
  .bbhelp > summary { min-width: 44px; min-height: 44px; }

  /* Hall of Champions gear: slot / worn item / equip form stacked */
  table.vis.chgear, table.vis.chgear tbody { display: block; width: 100%; overflow: visible; }
  table.vis.chgear tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--hair); }
  table.vis.chgear td { display: block; padding: 2px 4px; border: 0; }
  table.vis.chgear form.inline { display: flex; flex-wrap: nowrap; }
  table.vis.chgear select { flex: 1 1 0; min-width: 0; max-width: none; }

  /* Farm assistant: one card per target - [tick] village [A B C] / distance points report wall / loot scouted */
  table.vis.farmt, table.vis.farmt tbody { display: block; width: 100%; overflow: visible; }
  table.vis.farmt tr:has(th) { display: block; padding: 6px 12px; border-bottom: 1px solid var(--hair-2); }
  table.vis.farmt th:not(:first-child) { display: none; }
  table.vis.farmt tr:not(:has(th)) { display: grid; grid-template-columns: 26px repeat(3, minmax(0, 1fr)) auto; align-items: center; gap: 6px 8px; padding: 9px 10px; border-bottom: 1px solid var(--hair); }
  table.vis.farmt td { display: block; padding: 0; border: 0; min-width: 0; font-size: .78125rem; }
  table.vis.farmt td:nth-child(1) { grid-area: 1 / 1; }
  table.vis.farmt td:nth-child(2) { grid-area: 1 / 2 / 2 / 5; font-size: .84375rem; }
  table.vis.farmt td:nth-child(9) { grid-area: 1 / 5; justify-self: end; }
  table.vis.farmt td:nth-child(3) { grid-area: 2 / 2; } table.vis.farmt td:nth-child(4) { grid-area: 2 / 3; } table.vis.farmt td:nth-child(7) { grid-area: 2 / 4; }
  table.vis.farmt td:nth-child(5) { grid-area: 3 / 2 / 4 / 4; } table.vis.farmt td:nth-child(6) { grid-area: 3 / 4 / 4 / 6; } table.vis.farmt td:nth-child(8) { grid-area: 4 / 2 / 5 / 6; }
  table.vis.farmt td:empty { display: none; }
  table.vis.farmt td[data-l] span { white-space: nowrap; margin-right: 4px; }
  table.vis.farmt .mini { min-width: 34px; justify-content: center; }

  /* Combat simulator: the table is turned 90 degrees (units down, columns = attacker / defender / losses) so every number field is on screen */
  table.vis.sim { display: block; overflow: visible; }
  table.vis.sim tbody { display: grid; grid-template-columns: 30px; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: row dense; gap: 4px 6px; align-items: center; }
  table.vis.sim tr { display: contents; }
  table.vis.sim tr:nth-child(1) > * { grid-column: 1; } table.vis.sim tr:nth-child(2) > * { grid-column: 2; }
  table.vis.sim tr:nth-child(3) > * { grid-column: 3; } table.vis.sim tr:nth-child(4) > * { grid-column: 4; } table.vis.sim tr:nth-child(5) > * { grid-column: 5; }
  table.vis.sim th, table.vis.sim td { padding: 0; border: 0; text-align: center; font-size: .75rem; line-height: 1.25; white-space: normal; min-width: 0; background: none; }
  table.vis.sim td:first-child { text-align: center; white-space: normal; font-weight: 600; color: var(--text-2); }
  table.vis.sim input { width: 100% !important; min-width: 0; padding: 4px 6px; text-align: center; }
  table.vis.sim td.short, table.vis.sim td.zero { font-size: .8125rem; }
}

/* ---- Phones: compact density + one-row menus (2026-10-22). Desktop untouched: every rule sits in a max-width query. ---- */
@media (max-width: 600px) {
  :root { --s3: 8px; --s4: 10px; --s5: 14px; --s6: 20px; }
  body { font-size: .8125rem; line-height: 1.42; }
  .ic { width: 16px; height: 16px; vertical-align: -3px; }
  /* top bar: [◀ village ▶] [log out] on one line, the resource chips below; the world name is left out */
  .topbar { padding: 5px 6px 6px; gap: 5px; }
  .topbar .title { display: none; }
  .topbar .vswitch { flex: 1; min-width: 0; }
  .topbar .vpick { flex: 1; min-width: 0; max-width: none; padding: 4px 8px; justify-content: space-between; }
  .topbar .res { order: 3; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
  .topbar .res > span, .rankchip { gap: 4px; padding: 2px 6px 4px; font-size: .75rem; justify-content: center; min-width: 0; }
  .topbar .res .ic, .rankchip .ic { width: 14px; height: 14px; vertical-align: -2px; }
  .topbar .res .fill { left: 5px; right: 5px; bottom: 1px; }
  #app .topbar .mini { min-height: 30px; padding: 3px 8px; }
  /* main nav, quick bar and every sub-tab bar: one row each that scrolls sideways (app.js keepRows keeps the
     position and brings the active item into view); the right edge fades so it reads as "more this way" */
  .nav, .subnav, .quickbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); }
  .nav::-webkit-scrollbar, .subnav::-webkit-scrollbar, .quickbar::-webkit-scrollbar { display: none; }
  .nav > *, .subnav > *, .quickbar > * { flex: none; white-space: nowrap; }
  .nav::after, .subnav::after { content: ''; flex: none; width: 12px; }
  .nav { margin: 6px 0 4px; padding: 2px; gap: 1px; }
  .nav button { padding: 5px 7px; gap: 4px; font-size: .75rem; }
  .nav .ni:has(.nc) > [data-tab] { padding-right: 3px; } .nav .nc { padding: 5px 6px 5px 2px; }
  .nav button .ic { width: 14px; height: 14px; }
  .nav .right { margin-left: 0; }
  .quickbar { padding: 3px 8px; margin-bottom: 4px; font-size: .75rem; }
  .subnav { gap: 2px; padding: 2px; margin-bottom: 8px; }
  .subnav button { padding: 4px 8px; font-size: .75rem; border-radius: 6px; }
  /* surfaces and type */
  .panel { padding: 8px; border-radius: var(--r); }
  .box { border-radius: var(--r); margin-bottom: 8px; }
  .box .in { padding: 7px 8px; }
  h2 { font-size: 1rem; margin-bottom: 8px; gap: 2px 8px; } h2 > .ic { width: 20px; height: 20px; }
  h3 { padding: 6px 8px; }
  .fh { font-size: .9375rem; }
  fieldset { padding: 6px 8px; }
  .notice { padding: 5px 8px; font-size: .75rem; }
  #app table.vis th { padding: 4px 6px; }
  #app table.vis td { padding: 4px 6px; }
  .quest { padding: 7px 8px; } .qhead { font-size: .8125rem; }
  .cost { gap: 2px 8px; }
  .scene-tools { margin-bottom: 4px; }
  /* recruit cards, two lines per unit: [icon name | home/total | count (max)] / [cost ... time];
     a unit that cannot be recruited yet gets its note on a third line */
  table.vis.rec tr { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "u h n" "c c t"; gap: 4px 10px; padding: 7px 8px; }
  table.vis.rec td:nth-child(5) { gap: 4px; flex-wrap: nowrap; justify-self: end; }
  table.vis.rec td:nth-child(5):not(:has(input)) { grid-area: auto; grid-column: 1 / -1; justify-self: start; }
  table.vis.rec td:nth-child(5) input { width: 72px !important; }
  table.vis.rec td:nth-child(1) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.vis.rec .uic-cell .ic.uic { width: 26px; height: 26px; margin-right: 2px; }
  table.vis.hq tr { padding: 7px 8px; gap: 4px 10px; }
  #app .btn { min-height: 32px; padding: 4px 11px; }
  #app .mini { min-height: 28px; padding: 3px 8px; }
}

/* ---- Phone shell (LM2, app.js phoneTop / views.menu). Its markup exists only below 640 px, so none of this reaches the desktop. ---- */
#app:has(> .pbar) { padding: 0 6px calc(70px + env(safe-area-inset-bottom)); }
/* top bar: [← ◀ village name (x|y) Kxx ▶ switch], compact resources + population under the name */
.topbar.ptop { position: sticky; top: 0; flex-wrap: nowrap; gap: 2px; padding: 4px 3px 5px; margin: 0 -6px 4px; border-radius: 0; border-left: 0; border-right: 0; }
#app .ptop .pnav { flex: none; min-width: 32px; min-height: 40px; padding: 0 4px; justify-content: center; font-size: .9375rem; border-color: transparent; }
#app .ptop .pnav[disabled] { opacity: .35; cursor: default; }
.ptop .pswitch .ic { width: 21px; height: 21px; }
.ptop .pv { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.ptop .pvn { display: flex; align-items: baseline; gap: 5px; max-width: 100%; padding: 1px 4px; background: none; border: 0; color: var(--text-hi); font: 600 .84375rem/1.25 var(--sans); cursor: pointer; }
.ptop .pvn .vn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptop .pvn .vxy { flex: none; color: var(--text-3); font-size: .75rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.ptop .pres { display: flex; flex-wrap: nowrap; justify-content: center; gap: 9px; max-width: 100%; font-size: .75rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ptop .pr { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.ptop .pr:empty { display: none; }
.ptop .pr .ic { width: 13px; height: 13px; vertical-align: 0; }
.ptop .pr b { font-weight: 600; color: var(--text); }
.ptop .pr.hi b { color: var(--warn); }
.ptop .pr.full b { color: var(--bad); }
/* quick bar: one row that swipes sideways */
.ptop ~ .quickbar { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; padding: 3px 8px; margin: 0 0 4px; font-size: .75rem;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); }
.ptop ~ .quickbar::-webkit-scrollbar { display: none; }
.ptop ~ .quickbar > * { flex: none; white-space: nowrap; }
/* screen header: "Building (level)" + info on the left, the sub-page dropdown on the right */
.scrhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; margin: 0 0 6px; padding: 4px 6px 4px 10px;
  background: #1d130be6; border: 1px solid var(--accent-lo); border-radius: var(--r); box-shadow: var(--sh-1); }
.scrhead .sh-l { display: flex; align-items: center; gap: 7px; min-width: 0; }
.scrhead .sh-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .875rem; color: var(--text-hi); }
#app .scrhead .shinfo { flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; justify-content: center; border-radius: 50%; border-color: var(--accent-lo); color: var(--gold-ink); font: italic 600 .8125rem/1 Georgia, serif; }
.scrhead .sh-r { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; max-width: 60%; }
#app .scrhead .sh-r .mini { min-height: 32px; }
.scrhead .sh-r .mini.on { border-color: var(--accent); color: var(--gold-ink); }
.subdd { min-width: 0; }
.subdd > .folded { display: none; }   /* the folded button row stays in the page for its click handlers */
.subdd select { width: 100%; min-height: 34px; padding: 4px 8px; font-size: 1rem; text-overflow: ellipsis; }   /* 16 px: phones don't zoom into the field */
.panel .subdd, #app > .subdd { margin: 0 0 var(--s3); }
/* bottom tab bar: Menu (unread badge) · Game · Map · Account */
.pbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 2px 4px calc(2px + env(safe-area-inset-bottom));
  background: #1d130bf5; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--accent-lo); box-shadow: 0 -10px 24px -14px #000; }
.pbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 54px; padding: 1px 2px 3px;
  background: none; border: 0; border-radius: var(--r-sm); color: var(--text-2); font: 500 .75rem/1.1 var(--sans); cursor: pointer; }
.pbar button .ic { width: 22px; height: 22px; color: inherit; } .pbar button img.ic.pi { margin-block: 0; }
.pbar button.on { color: var(--gold-ink); box-shadow: inset 0 2px 0 var(--accent); }
.pbar .badge { position: absolute; top: 3px; left: calc(50% + 5px); }
.pbar .badge:empty { display: none; }
/* Menu screen: icon grid, four per row; Edit shows move arrows on every tile */
.pm-hint { margin: 0 2px 6px; font-size: .75rem; color: var(--text-2); }
.pmenu { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ptile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; min-height: 96px; padding: 6px 2px 6px;
  background: none; border: 0; border-radius: var(--r); color: var(--text); font: 500 .75rem/1.2 var(--sans); text-align: center; cursor: pointer; }
button.ptile:active { background: var(--ov-1); }
.ptile .pt-ic { position: relative; display: grid; place-items: center; width: 64px; height: 64px; color: var(--gold-ink); }   /* painted cut-out, no tile behind it */
.ptile .pt-ic svg.ic { width: 36px; height: 36px; color: inherit; }   /* tile without a painted icon */
.ptile .badge { position: absolute; top: 0; right: -4px; }
.ptile .pt-l { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.pmenu.edit .ptile { border: 1px dashed var(--hair-2); cursor: default; }
.ptile .pt-mv { display: flex; gap: 4px; margin-top: auto; }
#app .ptile .pt-mv .mini { min-width: 30px; min-height: 30px; padding: 0 6px; }

/* LM10 profile */
.pf-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4, 16px); align-items: start; }
.pf-cols > div { min-width: 0; }
.pf-acts { list-style: none; margin: var(--s3, 12px) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pf-act { display: flex; align-items: center; gap: 8px; }
.pf-ic { flex: 0 0 20px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; } /* icon slot, drawn in LM14 */
.pf-ic svg { width: 100%; height: 100%; }
.pf-pic { float: left; margin: 0 12px 6px 0; }
@media (max-width: 639.98px) { .pf-cols { grid-template-columns: minmax(0, 1fr); } }

/* LM5 rally */
.lm5-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px 8px; }
.lm5-unit { flex-direction: column; align-items: center; gap: 3px; white-space: normal; }
.lm5-unit input { width: 64px; text-align: center; }
.lm5-xy { gap: 10px; }
.lm5-sc { margin-top: var(--s2); }
.lm5-sclist { margin: 4px 0 8px; line-height: 1.8; }
.tpls .link { white-space: nowrap; }

/* LM7 overviews */
.grprow { align-items: center; gap: 4px; }
.grprow > .muted { margin-right: var(--s2); }

/* LM3 overview widgets */
.ovw-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.ovw-col { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.ovw { background: var(--bg-2); border: 1px solid var(--hair-2); border-radius: 4px; min-width: 0; }
.ovw > h3 { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin: 0; padding: 0; background: var(--bg-3); border-bottom: 1px solid var(--hair-2); }
.ovw.off > h3 { border-bottom: 0; }
.ovw-t { flex: 1; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: var(--s2) var(--s3); cursor: pointer; min-height: 32px; }
.ovw-mv { display: flex; gap: 8px; padding-right: var(--s2); }
.ovw-mv .mini:disabled { opacity: .35; cursor: default; }
.ovw-body > .box { margin: 0; border: 0; }
/* RP18: a widget's text keeps off the border (.ovw is no .box, so .in had no padding here); an empty widget is one quiet line, not
   the 26 px ring with 26 px of padding (.empty), which on a phone pushed production and the build queue 1.5 screens down */
.ovw-body > .in { padding: 10px 12px; }
.ovw-body .empty { display: block; padding: 8px 12px !important; text-align: left; }
.ovw-body .empty::before { display: none; }
.ovw-arr { margin: var(--s3) 0 0; text-align: right; }
.ovw-arr .mini:focus-visible { outline-color: var(--b-focus); } /* this button stands on the bare wood page: the light ring */
.ovw-note { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 8em; overflow: auto; }
@media (max-width: 639.98px) {
  .ovw-cols { grid-template-columns: minmax(0, 1fr); }
  .ovw-body > .in { padding: 7px 8px; } .ovw-body .empty { padding: 7px 8px !important; }
  .ovw-mv .mini { min-height: 32px; min-width: 32px; }
}

/* LM13 map */
.mapstage .maphud, .mapstage .mapzoom { bottom: 30px; }
.mapbelow { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 var(--s3); margin-top: var(--s3); align-items: start; }
.mapbelow .box { margin-top: var(--s3); }
.mapbelow form.inline { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.mapbelow form input[name=q] { flex: 1 1 160px; min-width: 0; }
.mapbelow form input[type=number] { width: 64px; } .mapbelow form input[name=k] { width: 52px; }
.mapbelow .map-nav { margin-top: var(--s2); }
.mapbelow .searchres { margin-top: var(--s2); }
.mapopts, .mapsizes { display: flex; flex-direction: column; gap: 4px; }
.mapopts .popdet summary { cursor: pointer; color: var(--text-2); }
.mapopts .popdet .popset { flex-direction: column; }
#mappop { display: block; max-width: min(340px, calc(100vw - 8px)); max-height: calc(100vh - 8px); overflow: hidden; }
#mappop .pinfo > div + div { margin-top: 1px; }
#mappop .ph { margin-top: 6px; }
#mappop .ptrav { display: flex; flex-wrap: wrap; gap: 2px; font-size: .6875rem; font-variant-numeric: tabular-nums; }
#mappop .ptrav span { display: flex; flex-direction: column; align-items: center; min-width: 44px; padding: 2px 3px; border: 1px solid var(--hair); border-radius: var(--r-sm); }
#mappop .ptrav i { font-style: normal; line-height: 1; } #mappop .ptrav .ic { width: 15px; height: 15px; } #mappop .ptrav img.ic.pi { margin-block: -2.5px; }
#mappop .pcmd { width: 100%; margin-top: 6px; font-size: .6875rem; }
#mappop .pcmd th { text-align: left; font-weight: 600; white-space: normal; }
#mappop .pcmd td { vertical-align: top; }
#mappop .pms { font-size: .5625rem; color: var(--text-2); }
.mapsend .ms-from select { max-width: 100%; }
.mapsend .ms-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.mapsend .ms-u { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 4px; align-items: center; margin: 3px 0; font-size: .6875rem; }
.mapsend .ms-u .link { grid-column: 2; }
.mapsend .ms-u input[type=number] { width: 100%; min-width: 0; }
.mapsend .ms-ic .ic { width: 16px; height: 16px; }
.mapsend .ms-target { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s2); padding: var(--s2); border: 1px solid var(--hair); border-radius: var(--r); font-size: .75rem; }
.mapsend .ms-target canvas { flex: none; border-radius: var(--r-sm); background: #1b2216; }
/* U17: on phones the map page's boxes fold (views/map.js fold()); the whole title bar is the toggle */
details.mfold > summary h3 { min-height: 44px; }
details.mfold > summary h3::after { content: '▸'; margin-left: auto; font-size: .8125rem; color: var(--text-3); }
details.mfold[open] > summary h3::after { content: '▾'; }
details.mfold:not([open]) > summary h3 { border-bottom: 0; }
@media (max-width: 639.98px) {
  .mapbelow { grid-template-columns: minmax(0, 1fr); }
  .mapsend .ms-u input[type=number] { min-height: 32px; }
}

/* LM4 LM6 */
.merch { margin: 0 0 var(--s2, 8px); }
.hq td .link { display: inline-block; margin-top: 2px; }

/* Subadmin problem reports: the send form and the admin list */
.problem-form textarea { width: 100%; max-width: 640px; box-sizing: border-box; font: inherit; }
.prob-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 560px; }
td.nowrap { white-space: nowrap; }
tr.prob-new td:first-child { box-shadow: inset 3px 0 var(--accent); }
tr.prob-done td { color: var(--text-3); }

/* SK12c: the Night Vigil (event page, views/quests.js vigilHtml). Covered barrow = dark wood tile, uncovered = parchment with a brown-ink
   number, a mark = thin gold ring, the last uncovered barrow = gold edge, restless (after the field ends) = deep red-brown; the field sits
   on a dark wood tray. Tiles are 56 px and shrink to fit a phone. Numbers carry the meaning; colour only repeats it. */
.vg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin: 4px 0 var(--s2); }
.vg-head .fh { margin: 0; }
.vigil { --tile: 56px; --vg-wood: #4a321c; --vg-wood-hi: #6b4a2a; --vg-wood-lo: #2f1f10; --vg-red: #8a2c1a; --vg-red-lo: #4e170d; }
.vigil > .box { margin-top: 0; }
.vg-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 28px; margin-bottom: var(--s3); }
.vg-oil { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.vg-k { font: 600 .75rem/1.25 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--text-2); }
.vg-bar { display: inline-flex; width: 190px; max-width: 40vw; height: 8px; border-radius: 4px; background: var(--ov-2); overflow: hidden; box-shadow: inset 0 1px 1px #3a251322; }
.vg-free { background: linear-gradient(180deg, #d39a2c, var(--accent)); }
.vg-buy { background: var(--accent-lo); }
.vg-oil b { font-size: 1rem; color: var(--text-hi); }
.vg-lantern { color: var(--text); }
.vg-pts { font: 600 1.5rem/1 var(--display); color: var(--gold-ink); vertical-align: -2px; }
.vg-main { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s4) var(--s5); }
.vg-tray { display: inline-block; max-width: 100%; padding: 8px; border-radius: var(--r-lg); background: linear-gradient(180deg, #2f2012, #1d130b);
  box-shadow: inset 0 0 0 1px #00000066, inset 0 2px 6px #000a, 0 1px 0 #fff6; }
.vg-field { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, var(--tile))); gap: 6px; }
.vg-b { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--r);
  font: 600 clamp(.9375rem, 4.8vw, 1.3125rem)/1 var(--display); color: var(--text-hi); }
button.vg-b { cursor: pointer; }
button.vg-b:disabled { cursor: default; opacity: 1; }
.vg-b:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.vg-c { background: radial-gradient(circle at 50% 42%, var(--vg-wood-hi) 0%, var(--vg-wood) 52%, var(--vg-wood-lo) 100%); box-shadow: inset 0 1px 0 #ffffff14, inset 0 -2px 4px #0006; }
button.vg-c:not(:disabled):hover { background: radial-gradient(circle at 50% 42%, #7c5733 0%, #573b20 55%, #352312 100%); }
.vg-o { background: linear-gradient(180deg, var(--field), #eadbb2); box-shadow: inset 0 0 0 1px var(--hair-3), inset 0 -2px 0 #3a25131a; }
.vg-o i { font-style: normal; color: var(--text-3); }
.vg-r { background: radial-gradient(circle at 50% 42%, var(--vg-red) 0%, #6a2214 55%, var(--vg-red-lo) 100%); box-shadow: inset 0 1px 0 #ffffff1a, inset 0 -2px 4px #0006; }
.vg-last { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 1px #00000055; }
.vg-m::after, .vg-hit::after { content: ''; position: absolute; width: 42%; height: 42%; border-radius: 50%; border: 2px solid var(--accent); }
.vg-hit::after { border-color: #e2b04f; }
.vg-f::before { content: ''; position: absolute; top: 12%; right: 14%; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--field); }
.vg-main.marking button.vg-c:not(:disabled) { cursor: cell; }
.vg-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 300px; font-size: .78125rem; color: var(--text-2); }
.vg-legend li { display: flex; align-items: center; gap: 10px; }
.vg-legend .vg-b { --tile: 26px; flex: 0 0 26px; width: 26px; font-size: .8125rem; border-radius: var(--r-sm); }
.vg-legend .vg-f::before { width: 5px; height: 5px; }
.vg-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: var(--s3); }
.btn.vg-keep { background: linear-gradient(180deg, #c98d22, #a8700f); border-color: #8a5a0a; color: #fff6dc; font-weight: 600; padding: 7px 16px; text-shadow: 0 1px 0 #0003; }
.btn.vg-keep:hover { background: linear-gradient(180deg, #d69a2c, #b47a14); border-color: #7a4f08; color: #fff; }
.vg-modes { display: inline-flex; border: 1px solid var(--hair-3); border-radius: var(--r); overflow: hidden; }
.vg-modes button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; background: var(--bg-3); color: var(--text-2); font: inherit; cursor: pointer; }
.vg-modes button + button { border-left: 1px solid var(--hair-3); }
.vg-modes button.on { background: var(--bg-5); color: var(--text-hi); font-weight: 600; }
.vg-modes i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.vg-modes [data-vgmode="mark"] i { background: none; border: 2px solid var(--accent); width: 10px; height: 10px; box-sizing: border-box; }
.vg-hint { font-size: .78125rem; }
@media (pointer: coarse) { .vg-hint { display: none; } }
.vg-empty { margin-top: var(--s3); padding: 10px 12px; border: 1px solid var(--hair-2); border-radius: var(--r); background: var(--bg-3); }
.vg-empty p { margin: 0 0 6px; } .vg-empty p:last-child { margin-bottom: 0; }
.vg-offer { margin: var(--s3) 0 0; }
.vg-offer .ic { width: 16px; height: 16px; vertical-align: -3px; }
.vg-help ol.in { margin: 0; padding: 10px 12px 10px 32px; } .vg-help li + li { margin-top: 4px; }
@media (max-width: 640px) {
  .vg-legend { display: none; }
  .vg-top { gap: 6px 18px; }
  .vg-tray { padding: 6px; } .vg-field { gap: 5px; }
}

/* ---- UX4 (U18, U19): incoming attack warning and the Defence page ---- */
/* UX14: the admin's emergency notice under the top bar on every page (app.js alarmBar; it was U18's attack bar); deep brick red, cream ink. */
.alarm { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0 var(--s3); padding: 8px 10px 8px 12px; border-radius: var(--r);
  background: #7a1f10; color: #fff4d6; border: 1px solid #b8442b; box-shadow: var(--sh-2), inset 0 1px 0 #ffffff1f; font-size: .84375rem; line-height: 1.4; }
.alarm[hidden] { display: none; }
.alarm b { color: #fff; font-variant-numeric: tabular-nums; }
.alarm .al-t { flex: 1 1 280px; min-width: 0; overflow-wrap: anywhere; }
/* A toast with an action (core.js toast(msg, ms, go)) is one big button. */
#toast.go { cursor: pointer; text-decoration: underline; text-decoration-color: #e8c77e88; text-underline-offset: 3px; }
/* UX9: a toast with a named action ("Undo"): plain text, the action as a gold button-like word, at least 44 px high to tap */
#toast.golabel { text-decoration: none; }
#toast.golabel:not([hidden]) { display: flex; align-items: center; gap: 14px; min-height: 44px; box-sizing: border-box; }
#toast .toastgo { color: var(--gold-ink, #e8c77e); white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; margin-left: auto; }
#toast.go:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Phone layout: toasts sit above the tab bar, so they never cover (or catch taps meant for) Menu, Game, Map and Account. */
body:has(.pbar) #toast { bottom: calc(70px + env(safe-area-inset-bottom)); }
/* Phone tab bar: red dot on "Game" while an attack is on its way */
.pbar .pdot { position: absolute; top: 6px; left: calc(50% + 8px); width: 10px; height: 10px; border-radius: 50%; background: #c8452c; box-shadow: 0 0 0 2px #1d130b; }
.pbar .pdot[hidden] { display: none; }
/* Rally point > Defence: the steps */
.defsteps { margin: 0; padding: 10px 14px 10px 30px; display: grid; gap: 10px; }
.defsteps li { line-height: 1.5; }
.defsteps .btn { margin: 2px 0 0 4px; }
/* Lost defence report: what helps next time */
.deftip { margin: var(--s3) 0 0; padding: 8px 12px; border: 1px solid var(--warn-line); border-radius: var(--r); background: var(--warn-bg); }
.deftip .ic { width: 18px; height: 18px; vertical-align: -4px; }
@media (max-width: 639.98px) {
  .alarm { margin: 0 0 6px; font-size: .8125rem; }
  .defsteps { padding-left: 22px; }
  .defsteps .btn { min-height: 44px; }
}
/* UX5 (U9) Rally point > Send: the target line under the arrival time */
.sendtgt { margin: 2px 0 6px; line-height: 1.5; }
.sendtgt:empty { display: none; }
/* UX5 (U21) mass support: the total of the ticked villages above the Send button */
.mstotal { line-height: 1.6; }
.mstotal .un { white-space: nowrap; margin-right: 0; }
/* UX5 (U23) Overviews > Incoming on phones: one card per command, the filters behind one button */
.incfbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inccall { display: block; padding: 6px 12px; border-bottom: 1px solid var(--hair-2); }
.inccards { list-style: none; margin: 0; padding: 0; }
.inccard { display: grid; gap: 3px; padding: 9px 12px; border-bottom: 1px solid var(--hair); font-size: .8125rem; line-height: 1.45; }
.inccard .ic-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.inccard .ic-top label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.inccard .ic-cd { white-space: nowrap; font-weight: 600; }
.inccard .link { overflow-wrap: anywhere; }
/* ---- UX7b: touch screens. Phones get these below 640 px; tablets and other touch screens through (pointer: coarse). A screen with a
   mouse wider than 640 px matches neither, so the desktop look is untouched. ---- */
/* U52: the phone block's thumb sizes for tablets too: 16 px fields (iOS zooms into anything smaller), 36 px high, 18 px checkboxes */
@media (pointer: coarse) {
  #app input[type=number], #app input[type=text], #app input[type=search], #app input[type=password], #app input[type=date], #app input:not([type]), #app select { min-height: 36px; font-size: 1rem; }
  #app input[type=checkbox], #app input[type=radio] { width: 18px; height: 18px; }
  #app .mini { padding: 4px 10px; }
}
@media (max-width: 639.98px), (pointer: coarse) {
  /* U57: text areas 16 px as well (mail, forum, notes, profile...), also in the map's send box */
  #app textarea, .mapsend textarea { font-size: 1rem; }
  .mapsend input[type=number], .mapsend select { font-size: 1rem; }
  /* U36: main action buttons at least 44 px high; small buttons 36 px plus an invisible 4 px band above and below (44 px to tap,
     rows of them stay compact); the overview box headers follow them */
  #app .btn, .mapsend .btn, .dlg .btn { min-height: 44px; }
  .dlg-btns .btn { flex: 1; }
  #app .repbtns .btn { flex: 1 1 auto; }   /* UX9 (U30): the report's action buttons fill their rows */
  #app .mini, .mapsend .mini { min-height: 36px; position: relative; }
  #app .mini::before, .mapsend .mini::before { content: ''; position: absolute; inset: -4px 0; }
  .ovw-t { min-height: 44px; }
  .ovw-mv .mini { min-width: 40px; justify-content: center; }
  /* U59: bigger tap areas, same look. An invisible ::before reaches past the edges of a small control. */
  .ptop .pvn, .ptop .pr, #app .scrhead .shinfo { position: relative; }
  .ptop .pvn::before, .ptop .pr:not(.link)::before, #app .scrhead .shinfo::before { content: ''; position: absolute; }
  .ptop .pvn::before { inset: -7px -6px -1px; }          /* up to the top bar's edge (the resources sit right below) */
  .ptop .pr:not(.link)::before { inset: -1px -4px -8px; } /* down to the top bar's edge */
  #app .scrhead .shinfo::before { inset: -11px; border-radius: 50%; }
  /* map options: the label around each checkbox, and around the highlight rows' checkbox and colour (map.js hlck), is the tap area */
  .mapopts label, .mapside label:has(> input[type=checkbox]) { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
  label.hlck { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; vertical-align: middle; cursor: pointer; }
  /* village picture: each building's click shape grows by a 6 px transparent rim (stroke) */
  .vart .hb polygon { stroke-width: 12px; }
  .vart .hb.on polygon, .vart .hb:focus-visible polygon { stroke-opacity: .45; }
}
/* U27: the short unit name under each picture: phones only. On touch screens the picture is a box of its own, so a tap shows the
   full name (core.js data-tip); with a mouse it has no box and the picture sits in its row exactly as before. */
.upic { display: contents; }
.usn { display: none; }
@media (max-width: 639.98px), (pointer: coarse) {
  .upic { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; }
}
@media (max-width: 639.98px) {
  .usn { display: block; max-width: 54px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 600 .75rem/1.15 var(--sans); letter-spacing: 0; text-transform: none; color: var(--text-2); }
  table.ut th .upic { min-width: 36px; }
  table.vis.sim tbody { grid-template-columns: 56px; }   /* the simulator's picture column has room for the name */
  .mapsend .ms-u { grid-template-columns: minmax(20px, auto) minmax(0, 1fr); }
  .mapsend .ms-u .usn { max-width: 44px; }
}
/* the tap box itself (core.js showTip) */
.taptip { position: fixed; z-index: 120; max-width: min(280px, calc(100vw - 16px)); padding: 6px 10px; white-space: pre-line; pointer-events: none;
  font: 500 .8125rem/1.45 var(--sans); color: var(--text-hi); background: #3b2715f5; box-shadow: var(--sh-2); }   /* border: frame B (UX20c block) */
.taptip::first-line { font-weight: 650; }
/* U58: a table wider than the phone screen scrolls sideways; a soft shade shows on the side that has more columns
   (the bg-2 covers move with the content and hide the shade at either end). */
@media (max-width: 760px) {
  #app table.vis {
    background: linear-gradient(90deg, var(--bg-2) 40%, transparent) left / 40px 100% no-repeat local,
      linear-gradient(270deg, var(--bg-2) 40%, transparent) right / 40px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / .3), transparent) left / 14px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / .3), transparent) right / 14px 100% no-repeat scroll;
  }
}

/* ---- UX8: new-player guidance ---- */
/* U2: the "Next step" box on top of the village overview (village.js nextStep): a parchment card with a gold edge, green once it can be claimed */
.nstep { background: var(--bg-2); border: 1px solid var(--hair-2); border-left: 4px solid var(--accent); border-radius: 4px; margin-bottom: var(--s3); box-shadow: var(--sh-1); }
.nstep.ready { border-left-color: var(--ok); }
.nstep .ns-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: var(--s2) var(--s3); background: var(--bg-3); border-bottom: 1px solid var(--hair-2); }
.nstep .ns-head h3 { padding: 0; border: 0; background: none; color: var(--text-hi); }
.nstep .ns-links { margin-left: auto; font-size: .78125rem; }
.nstep .ns-body { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding: var(--s2) var(--s3) var(--s3); }
.nstep .ns-q { flex: 1 1 320px; min-width: 0; }
.nstep .ns-q p { margin: 4px 0; }
.nstep .ns-act { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.nstep .ns-wait { font-weight: 600; font-variant-numeric: tabular-nums; }
.nstep [data-showat] { display: none; } /* RP18: the free finish takes no room here until it can be pressed */
.nstep .ns-act .btn { min-height: 40px; padding-inline: 18px; }
@media (max-width: 639.98px) { .nstep .ns-links { margin-left: 0; } .nstep .ns-act { flex: 1 1 100%; } .nstep .ns-act .btn { width: 100%; } }
/* U2: How to play (app.js views.guide): one readable column */
.guide { max-width: 780px; }
.guide .g-intro { font-size: .9375rem; }
.guide section { margin: var(--s4) 0 0; }
.guide section h3 { padding: 0 0 4px; background: none; font: 600 1rem/1.3 var(--display); letter-spacing: 0; text-transform: none; color: var(--text-hi); }
.guide p { margin: 6px 0; line-height: 1.55; }
.guide .g-go { font-size: .8125rem; }
.hk-guide { margin: 0 0 var(--s3); }
/* U10: Headquarters - the buildings whose requirements are not met yet, folded under the buildable ones; the row the player was sent to
   (village.js hqAt: the Go button, an empty plot) lights up for a moment */
.hqlater { margin-top: var(--s3); border: 1px solid var(--hair-2); border-radius: var(--r); background: var(--ov-0); }
.hqlater > summary { padding: 8px 12px; color: var(--text-2); font: 600 .78125rem var(--sans); }
table.hq tr.hqfocus > td { animation: hqfocus 5s ease-out; }
table.hq tr.hqfocus > td:first-child { animation-name: hqfocusbar; }
@keyframes hqfocus { 0%, 40% { background: var(--accent-bg2); } 100% { background: transparent; } }
@keyframes hqfocusbar { 0%, 40% { background: var(--accent-bg2); box-shadow: inset 3px 0 0 var(--accent); } 100% { background: transparent; box-shadow: inset 3px 0 0 transparent; } }
/* phones: the row is one card (display: grid), so the whole card lights up instead of each cell on its own */
@media (max-width: 640px) { table.hq tr.hqfocus { animation: hqfocusbar 5s ease-out; } table.hq tr.hqfocus > td, table.hq tr.hqfocus > td:first-child { animation: none; } }
/* U29: the other quest chains folded under the starter chain; the Go link on a quest card */
.qmore { margin-top: var(--s3); }
.qmore > summary { padding: 8px 2px; font: 600 .8125rem var(--sans); color: var(--gold-ink); }
.qhead .link { margin-left: auto; font: 500 .8125rem var(--sans); }
/* U28: empty plots on the village picture: a faint dashed outline and a faint "+" (both open the Headquarters at that building) */
.vart .hb.zero polygon { fill: #f2e4c00d; stroke: #f2e4c04a; stroke-dasharray: 4 6; }
.vart .vtag.plot { pointer-events: auto; cursor: pointer; min-width: 18px; padding: 0 5px; background: #2a1c11a0; border-color: #f2e4c04a; color: #f2e4c0; box-shadow: none; font-weight: 600; }
.vart .vtag.plot:hover { color: var(--badge-ink); border-color: var(--accent); background: var(--badge); }
/* ---- WEB1: the public website (server/site.js: landing page, /news, /help) ----
   One centred column on the wood page: a row of links, the banner (our rendered village, cropped wide and low) with the name,
   the page's parchment boxes, a footer of link columns. `.site-links` and `.site-foot` are in the wood scope above. */
.site-col { max-width: 780px; margin: 0 auto; padding: 0 12px 24px; }
.site-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 10px 2px 8px; font-size: .8125rem; }
.site-links a { color: var(--text-2); }
.site-links a[aria-current] { color: var(--text-hi); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.site-lang { margin-left: auto; font-size: .75rem; color: var(--text-3); }
.site-lang a { color: var(--text-3); font-weight: 400; }
.site-lang b { color: var(--text-hi); font-weight: 600; }
.site-banner { height: 190px; display: grid; place-items: center; border: 1px solid #a67a3888; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-2);
  background: linear-gradient(180deg, #1d130b26 0%, #1d130b80 100%), url(/art/stone/1x/max.webp) 50% 46% / 150% auto no-repeat, #3b2715; }
.site-name { padding: 8px 26px 8px calc(26px + .2em); font: 700 2.75rem/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: #fff4d6;
  background: #1d130bb0; border-top: 1px solid #d9a441aa; border-bottom: 1px solid #d9a441aa; text-shadow: 0 2px 10px #000c; }
.site-name:hover { color: #fff4d6; text-decoration: none; }
.site-main { display: grid; gap: 12px; margin-top: 12px; }
.site .site-banner h1 { display: flex; margin: 0; font: inherit; } /* flex: the name inside stays the box the banner centres */
.site h1 { margin: 0 0 var(--s3); font: 600 1.625rem/1.2 var(--display); letter-spacing: -.01em; color: var(--text-hi); }
.site-main h2 { font-size: 1rem; }
.site-duo { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; }
.site-duo .panel { min-width: 0; }
.site-duo .panel > :first-child { margin-top: 0; }
.site-lead { margin-top: 0; font-size: .96875rem; line-height: 1.5; color: var(--text-hi); }
.site-cta { padding: 10px 24px; font-size: .9375rem; color: #fff8e6; background: var(--accent); border-color: var(--accent-lo); box-shadow: var(--sh-1); text-shadow: 0 1px 0 #0003; }   /* UX20c: not the plate's light glow */
.site-cta:hover { color: #fff8e6; background: #a86c0c; text-decoration: none; }
.site-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; } /* RP9: the sign-up button and the Discord link */
.site-jump { display: none; } /* RP9: the jump link to the login box, phone only (below) */
.site-jump a::after { content: ' ↓'; }
.site-intro h2 { margin: var(--s4) 0 var(--s2); }
.site-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.site-shots a { display: block; padding: 4px 4px 2px; text-align: center; font-size: .75rem; color: var(--text-2); background: var(--bg-1); border: 1px solid var(--hair); border-radius: var(--r); }
.site-shots a:hover { border-color: var(--accent); text-decoration: none; }
.site-shots img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 3px; }
.site-shots span { display: block; padding-top: 3px; }
.site-login label { display: block; margin: 10px 0 4px; font: 600 .75rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.site-login input { width: 100%; padding: 9px 11px; }
.site-login .err { margin: 0; }
.site-login form > .btn { margin-top: 14px; } /* /join (access.js): the button sits straight in the form */
.site-newsbar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px var(--s5); }
.site-newsbar h2 { margin: 0; }
.site-newsbar ul { flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; }
.site-newsbar li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-newsbar time { margin-right: 8px; font-size: .75rem; color: var(--text-3); }
.site-more { margin-left: auto; white-space: nowrap; }
.site-post + .site-post { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--hair); }
.site-post h2 { margin: 0; font: 600 1.0625rem/1.3 var(--display); color: var(--text-hi); }
.site-post .muted { margin: 2px 0 6px; }
.site-post p { line-height: 1.6; overflow-wrap: anywhere; }
.site .guide { max-width: none; }
.site .guide section h2 { margin: 0; font: 600 1.0625rem/1.3 var(--display); }
.site-foot { margin-top: 20px; padding: 16px 4px 0; border-top: 1px solid var(--hair-2); font-size: .78125rem; }
.site-fcols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
.site-foot h2 { display: block; margin: 0 0 6px; font: 600 .75rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.site-foot ul { margin: 0; padding: 0; list-style: none; line-height: 1.9; }
.site-foot li span, .site-foot p { color: var(--text-3); }
.site-foot p { margin: 4px 0; }
.site-small { margin-top: 14px !important; text-align: center; font-size: .75rem; }
/* WEB6: the welcome box (in place of the login box: the worlds as buttons) and "log out", a form button that looks like the links around it */
.site-welcome h3 { margin: 14px 0 6px; padding: 0; border: 0; }
.site-notyou { margin: 0; font-size: .8125rem; color: var(--text-2); }
.site-wbtns { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.site-wbtns .btn { flex: 1 1 auto; padding: 9px 16px; font-size: .875rem; white-space: normal; }
.site-welcome .err { margin-top: 10px; }
/* PRE1: a world not open yet: name and opening time, the pre-register button or "pre-registered", one line on what it gives */
.site-wsoon { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--hair-2); border-radius: 6px; }
.site-wsoon p { margin: 0 0 6px; }
.site-wsoon form { margin: 0 0 6px; }
.site-wsoon .muted { margin: 0; font-size: .78125rem; }
.site-outf { display: contents; }
.site-out { padding: 0; border: 0; background: none; font: inherit; font-weight: 500; color: var(--gold-ink); cursor: pointer; }
.site-links .site-out { color: var(--text-2); }
.site-out:hover { color: var(--text-hi); text-decoration: underline; text-decoration-color: var(--accent-lo); text-underline-offset: 3px; }
@media (max-width: 640px) {
  .site-col { padding: 0 8px 20px; }
  /* RP9: a phone loads its own crop (public/art/landing: the part of max.webp the 230% view showed, so 100% wide), not the 1800 px file */
  .site-banner { height: 120px; background-image: linear-gradient(180deg, #1d130b26 0%, #1d130b80 100%), url(/art/landing/banner-phone.webp), none; background-size: auto, 100% auto, auto; }
  .site-name { font-size: 1.75rem; padding: 6px 16px 6px calc(16px + .2em); }
  .site-duo { grid-template-columns: minmax(0, 1fr); }
  .site-welcome { order: -1; } /* phone: the logged-in welcome box (the world buttons) first; RP9: a visitor gets the pitch first, the login box after it */
  .site-jump { display: block; margin: 0 0 6px; text-align: right; font-size: .8125rem; }
  .site-newsbar { padding: 10px var(--s4); }
  .site-newsbar ul { flex-basis: 100%; }
  .site-newsbar li { white-space: normal; margin: 2px 0; }
  .site-newsbar time { display: block; }
  .site h1 { font-size: 1.375rem; }
}
