/* Fonts (art/fonts, from Google Fonts, SIL OFL). Two sets under role names:
   menus are pixel (Jacquard 24 titles, Jersey 10 buttons and labels, VT323 text),
   the battle is gothic (Grenze Gotisch headings, Grenze for everything else, also on the canvas).
   size-adjust evens out the pixel faces, which run small, so one font-size reads the same in either set.
   A weight range on single-weight faces stops the browser smearing them into a fake bold. */
@font-face { font-family: 'Menu Display'; src: url(art/fonts/jacquard-24.woff2?v=623a306b) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Menu UI'; src: url(art/fonts/jersey-10.woff2?v=623a306b) format('woff2'); font-weight: 100 900; size-adjust: 124%; font-display: swap; }
@font-face { font-family: 'Menu Body'; src: url(art/fonts/vt323.woff2?v=623a306b) format('woff2'); size-adjust: 128%; font-display: swap; }
@font-face { font-family: 'Game Display'; src: url(art/fonts/grenze-gotisch.woff2?v=623a306b) format('woff2'); font-weight: 100 900; size-adjust: 106%; font-display: swap; }
@font-face { font-family: 'Game UI'; src: url(art/fonts/grenze.woff2?v=623a306b) format('woff2'); font-weight: 100 900; size-adjust: 106%; font-display: swap; }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ink-1); color: var(--bone-1);
  font-family: var(--body-font);
  user-select: none;
}
#game { position: fixed; inset: 0; display: block; cursor: default; }
.hidden { display: none !important; }

button {
  font: inherit; color: var(--bone-1); background: var(--umber-2);
  border: 1px solid var(--wood-4); border-radius: 4px; padding: 6px 14px; cursor: pointer;
}
button:hover { background: var(--umber-3); }
button.primary { background: var(--wood-2); border-color: var(--gold-0); }
button.primary:hover { background: var(--wood-3); }

/* Top bar */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 38px;
  display: flex; align-items: center; gap: 18px; padding: 0 14px;
  background: linear-gradient(var(--stone-0), var(--ink-2)); border-bottom: 2px solid var(--wood-2);
  font-size: 16px; z-index: 5;
}
#topbar > * { white-space: nowrap; }
#topbar .res { display: flex; align-items: center; gap: 6px; min-width: 70px; }
#topbar .ico { font-size: 16px; }
#topbar .spacer { flex: 1; }
#topbar button { padding: 2px 10px; }
#btn-idle.has-idle { background: var(--wood-3); border-color: var(--gold-2); color: var(--gold-4); }
.wave { color: var(--ember-4); }
#btn-fullscreen { font-size: 17px; line-height: 1; }
.card .fs-hint { margin: -8px 0 18px; }
.card .fs-hint button { font-size: 14px; padding: 4px 14px; }
#btn-music.off:not(:has(canvas)), #btn-pixel.off:not(:has(canvas)) { opacity: 0.4; text-decoration: line-through; }
#info .status { color: var(--gold-3); margin-bottom: 2px; }
#info .chip .st { position: absolute; top: -4px; right: -4px; line-height: 0; }
#info .chip .st img.uicon { width: 16px; height: 16px; }
.wave.soon { color: var(--blood-5); font-weight: bold; }

/* Bottom panel */
#panel {
  position: fixed; left: 0; right: 0; bottom: 0; height: 196px;
  display: flex; gap: 10px; padding: 8px;
  background: linear-gradient(var(--stone-0), var(--ink-2)); border-top: 2px solid var(--wood-2); z-index: 5;
}
#minimap { background: var(--ink-0); border: 1px solid var(--wood-2); cursor: pointer; flex: none; }
#info {
  flex: 1; min-width: 0; padding: 8px 12px; background: var(--ink-2);
  border: 1px solid var(--umber-3); border-radius: 4px; overflow: hidden;
}
#info h3 { margin: 0 0 6px; font-size: 18px; color: var(--gold-3); }
#info .stats { font-size: 13px; color: var(--stone-9); line-height: 1.6; }
#info .hpbar { height: 8px; background: var(--blood-0); border-radius: 3px; overflow: hidden; margin: 4px 0 8px; max-width: 260px; }
#info .hpbar > div { height: 100%; background: var(--leaf-5); }
#info .multi { display: flex; flex-wrap: wrap; gap: 8px 4px; padding-top: 6px; }   /* room for stacked cards */
#info .multi .chip.tstart { margin-left: 6px; }
#info .chip {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: var(--stone-0); border: 1px solid var(--umber-4); border-radius: 4px; position: relative; cursor: pointer;
}
#info .chip .mini { position: absolute; left: 2px; right: 2px; bottom: 2px; height: 3px; background: var(--blood-0); }
#info .chip .mini > div { height: 100%; background: var(--leaf-5); }
#info .queue { display: flex; gap: 4px; margin-top: 6px; align-items: center; }
/* Several buildings picked (UI.buildingsInfo): a card each, its queue beside it; past six, small cards. */
#info .bmulti { display: flex; flex-wrap: wrap; gap: 6px 10px; }
#info .bcard { display: flex; gap: 6px; align-items: center; min-width: 0; }
#info .bcard .bq { display: flex; flex-direction: column; gap: 3px; width: 180px; }
#info .bcard .bq .progress { width: 100%; height: 5px; }
#info .bcard .bq .idle { font-size: 12px; color: var(--stone-7); font-style: italic; line-height: 5px; }
#info .bcard .queue { margin-top: 0; gap: 2px; min-height: 20px; }
#info .bcard .queue .chip { width: 20px; height: 20px; font-size: 12px; }
#info .bcard .queue .chip img.art { width: 16px; height: 16px; }
#info .bcard .queue .chip img.uicon { width: 14px; height: 14px; }
#info .bmulti.small { gap: 6px 4px; }
#info .bcard.small { flex-direction: column; gap: 2px; }
#info .bcard.small .progress { width: 38px; height: 4px; }
#info .queue .chip { width: 34px; height: 34px; font-size: 18px; }
#info .progress { height: 6px; background: var(--stone-0); border-radius: 3px; overflow: hidden; width: 200px; }
#info .progress > div { height: 100%; background: var(--gold-0); }

#commands {
  width: 300px; flex: none; display: grid; grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 56px; gap: 6px; align-content: start;
}
#commands .cmd {
  position: relative; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1.1;
}
#commands .cmd small { font-size: 10px; color: var(--sand-1); }
#commands .cmd .key {
  position: absolute; top: 2px; right: 4px; font-size: 10px; color: var(--gold-3);
}
#commands .cmd.disabled { opacity: 0.4; }
#commands .cmd.active { background: var(--leaf-0); border-color: var(--leaf-6); }

/* Floating messages */
/* Big news (announce() in character.js): a banner under the top bar. */
#announce {
  position: fixed; left: 50%; top: 64px; transform: translate(-50%, -8px); z-index: 7; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 28px 10px; opacity: 0;
  background: color-mix(in srgb, var(--ink-0) 78%, transparent); border: 2px solid var(--gold-1);
  box-shadow: inset 0 0 0 2px var(--ink-1), 0 4px 14px color-mix(in srgb, var(--ink-0) 60%, transparent);
  transition: opacity 0.4s, transform 0.4s; text-align: center; max-width: 70vw;
}
#announce.show { opacity: 1; transform: translate(-50%, 0); }
#announce b { font-family: var(--logo-font); font-size: 24px; color: var(--gold-3); text-shadow: 0 2px 0 var(--ink-0); letter-spacing: 1px; }
#announce small { font-size: 14px; color: var(--sand-1); }
#announce.bad { border-color: var(--ember-2); }
#announce.bad b { color: var(--ember-4); }
#messages {
  position: fixed; left: 50%; bottom: 210px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; z-index: 6;
}
#messages div {
  background: color-mix(in srgb, var(--ink-0) 65%, transparent); padding: 4px 12px; border-radius: 4px; font-size: 15px;
  transition: opacity 0.6s;
}

#tooltip {
  position: fixed; z-index: 20; max-width: 260px; pointer-events: none;
  background: var(--ink-2); border: 1px solid var(--wood-4); border-radius: 4px; padding: 8px 10px; font-size: 13px;
}
#tooltip b { color: var(--gold-3); }
#tooltip .cost { color: var(--gold-3); margin: 2px 0 4px; }

/* The game's own cursor while the pointer is locked in full screen (src/vpointer.js): the size of a system
   arrow, so the action badge the game draws beside it (axe, pick, sword...) stays clear of it. */
#vcursor {
  display: none; position: fixed; left: 0; top: 0; width: 13px; height: 19px; z-index: 1000; pointer-events: none;
  background: no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='19'%3E%3Cpath d='M1 1 L1 15 L4.4 11.8 L6.8 17.2 L9 16.2 L6.7 11 L11.2 11 Z' fill='%23e8d9a8' stroke='%231a120c' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E");
}
#vcursor.cross {
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Cg stroke-linecap='square'%3E%3Cpath d='M11 1V8M11 14V21M1 11H8M14 11H21' stroke='%231a120c' stroke-width='4'/%3E%3Cpath d='M11 1V8M11 14V21M1 11H8M14 11H21' stroke='%23e8d9a8' stroke-width='1.6'/%3E%3C/g%3E%3C/svg%3E");
}
#vtip {
  display: none; position: fixed; z-index: 999; pointer-events: none; max-width: 260px;
  background: var(--ink-2); border: 1px solid var(--wood-4); border-radius: 4px; padding: 4px 8px; font-size: 12px;
}
.vhover { filter: brightness(1.25); }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--ink-2) 85%, transparent), color-mix(in srgb, var(--ink-0) 95%, transparent));
}
.card {
  max-width: 560px; padding: 28px 34px; text-align: center;
  background: var(--ink-2); border: 2px solid var(--wood-4); border-radius: 8px; box-shadow: 0 0 60px color-mix(in srgb, var(--ember-3) 15%, transparent);
}
.card h1 { margin: 0; font-size: 46px; letter-spacing: 2px; color: var(--gold-3); text-shadow: 0 0 18px color-mix(in srgb, var(--amber-1) 50%, transparent); }
.card h2 { margin-top: 0; color: var(--gold-3); }
.card .sub { color: var(--blood-6); font-style: italic; color: var(--sand-1); }
.card .diff { display: flex; justify-content: center; gap: 12px; margin: 22px 0; }
.card .diff button { font-size: 18px; padding: 8px 22px; }
.card .howto { text-align: left; font-size: 14px; color: var(--stone-9); line-height: 1.5; }
.card table { margin: 0 auto 12px; text-align: left; font-size: 14px; border-collapse: collapse; }
.card td { padding: 3px 10px; }
.card td:first-child { color: var(--gold-3); white-space: nowrap; }

/* Setup screen */
.card.setup { max-width: 820px; width: calc(100% - 32px); max-height: 94vh; overflow-y: auto; padding: 22px 28px; }
.card.setup h1 { font-size: 40px; }
.card h4 { margin: 16px 0 8px; text-align: left; color: var(--gold-3); font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }
.factions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.factions button, .maps button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; text-align: center;
  background: var(--stone-0); border: 2px solid var(--umber-4);
}
.factions button .ic { font-size: 30px; }
.factions button b { font-size: 14px; }
.factions button small, .maps button small { font-size: 11px; color: var(--stone-9); }
.factions button.sel, .maps button.sel, .chips button.sel { border-color: var(--gold-3); background: var(--umber-3); box-shadow: 0 0 12px color-mix(in srgb, var(--gold-3) 25%, transparent); }
.maps button:disabled { opacity: 0.35; filter: grayscale(0.8); cursor: not-allowed; }
.faction-info { text-align: left; font-size: 13px; color: var(--stone-9); background: var(--ink-2); border: 1px solid var(--umber-2); border-radius: 4px; padding: 8px 12px; margin-top: 8px; line-height: 1.5; }
.faction-info ul { margin: 4px 0 0; padding-left: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 5px 12px; font-size: 14px; }
.maps { display: grid; gap: 8px; }   /* the columns by the cards' look, below */
.go { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }
/* The setup's two steps (Main.setupStep). */
.steps { display: flex; justify-content: center; gap: 8px; margin: 4px 0 14px; }
.steps .step-tab { padding: 5px 14px; font-size: 14px; opacity: 0.7; }
.steps .step-tab b { display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 50%; margin-right: 6px; background: var(--ink-2); font-size: 12px; }
.steps .step-tab.sel { opacity: 1; border-color: var(--gold-3); }
.steps .step-tab.sel b { background: var(--gold-3); color: var(--ink-0); }
.card.setup .step { display: none; }
.card.setup[data-step="1"] .step1, .card.setup[data-step="2"] .step2 { display: block; }
.card.setup .step2 > .sub { margin-top: 0; }
.card.setup .step2 .row2 { grid-template-columns: 2fr 1fr; }
.card.setup .step2 .go { position: sticky; bottom: -22px; margin: 12px -28px -22px; padding: 12px 0 14px;
  background: linear-gradient(transparent, var(--ink-1) 30%); }
details.advanced { margin-top: 16px; border-top: 1px solid color-mix(in srgb, var(--wood-4) 50%, transparent); padding-top: 10px; }
details.advanced summary { cursor: pointer; color: var(--stone-9); font-size: 14px; }
details.advanced[open] summary { margin-bottom: 4px; }
button.big { font-size: 20px; padding: 10px 30px; }
@media (max-width: 700px) {
  .factions { grid-template-columns: repeat(2, 1fr); }
  .row2, .card.setup .step2 .row2 { grid-template-columns: 1fr; }
  .card.setup { padding: 16px; }
  .card.setup .step2 .go { margin: 12px -16px -16px; bottom: -16px; }
  /* every setup screen's header (← Back, the title): the title shrinks with the screen so it stays inside the frame */
  .setup-head { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .setup-head .ptitle { font-size: clamp(24px, 9vw, 54px) !important; white-space: nowrap; }
}

/* Command buttons: cooldown sweep, locked (tier) state */
#commands .cmd { overflow: hidden; }
#commands .cmd .cd { position: absolute; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--ink-0) 55%, transparent); pointer-events: none; }
#commands .cmd .cdt { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); font-size: 18px; font-weight: bold; color: var(--bone-3); text-shadow: 0 0 4px var(--ink-0); pointer-events: none; }
#commands .cmd.locked { opacity: 0.3; filter: grayscale(1); }
#info .chip .lv { position: absolute; top: -3px; left: -3px; font-size: 9px; background: var(--umber-1); color: var(--gold-3); border-radius: 6px; padding: 0 3px; }
#commands { grid-auto-rows: 52px; }

/* Portrait art (tools/portraits). Files are stored at 2x for sharp display on high-DPI screens. */
img.art { display: block; width: 32px; height: 32px; border-radius: 3px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink-0) 60%, transparent); }
img.art.inline { display: inline-block; width: 20px; height: 20px; vertical-align: middle; }
#info .chip img.art { width: 32px; height: 32px; }
#info .queue .chip img.art { width: 28px; height: 28px; }
#info .queue .chip img.uicon { width: 28px; height: 28px; }   /* an upgrade or a research: no larger than a unit's */
#commands .cmd.locked img.art, #commands .cmd.disabled img.art { filter: grayscale(0.7); }
#info .single { display: flex; gap: 12px; align-items: flex-start; }
#info .single .body { flex: 1; min-width: 0; }
/* A person's name line, traits and carried items (character.js). */
#info .wholine { margin: -4px 0 4px; color: var(--sand-1); font-size: 13px; font-style: italic; }
#info .single .body { position: relative; }
/* The land and the sky (skies.js): a badge saying what helps or hinders now. */
.env { font-family: var(--pixel-font); font-size: 12px; font-weight: 400; letter-spacing: 0; text-shadow: none;
  margin-left: 8px; padding: 0 4px; border: 1px solid; vertical-align: middle; white-space: nowrap; }
.env.up { color: var(--leaf-7); border-color: var(--leaf-4); }
.env.down { color: var(--ember-4); border-color: var(--ember-2); }
.env.mixed { color: var(--gold-3); border-color: var(--gold-1); }
#topbar .env { margin-left: 4px; }
/* The dragons' clock (endgame.js): as quiet as the game clock until they are coming for us. */
#topbar #endgame-box.near { color: var(--ember-4); }
.sky-picks { display: flex; gap: 6px; margin: 4px 0 0 24px; }
.sky-picks select { font-size: 13px; }
#sky-icon { image-rendering: pixelated; }
#info h3 .renamable { cursor: text; }
#info h3 .renamable:hover { text-decoration: underline dotted; text-underline-offset: 4px; }
#rename-input { font: inherit; font-size: 17px; width: 260px; padding: 0 4px; }
#info .single .body.has-kit > :not(.kit) { margin-right: 128px; }   /* text stops short of the item slots */
#info .wholine { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#info .kit { position: absolute; top: 0; right: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#info .traits { display: flex; gap: 4px; }
#info .trait { font-size: 12px; padding: 1px 5px; border: 1px solid; }
#info .trait.good { color: var(--leaf-7); border-color: var(--leaf-4); }
#info .trait.bad { color: var(--ember-4); border-color: var(--ember-2); }
#info .kit-slots { display: flex; flex-direction: row; gap: 4px; flex: none; }
#info .item-slot { width: 34px; height: 34px; display: grid; place-items: center; font-size: 20px; cursor: pointer;
  background: var(--ink-2); border: 2px solid var(--wood-4); }
#info .item-slot.empty { cursor: default; border-color: var(--stone-3); }
#info .item-slot img.uicon { width: 28px; height: 28px; }
#info .item-slot.empty img.uicon { opacity: 0.25; filter: grayscale(1); }
#info .item-slot.artefact { border-color: var(--gold-4); box-shadow: 0 0 6px color-mix(in srgb, var(--gold-4) 60%, transparent); }
#info .item-slot.unsuited img.uicon { opacity: 0.6; }   /* made for the other reach: half as good */
#info .kit-slots.pack .item-slot { width: 26px; height: 26px; border-style: dashed; }
#info .kit-slots.pack .item-slot img.uicon { width: 20px; height: 20px; }
#info img.portrait {
  object-fit: cover;
  flex: none; width: 96px; height: 96px; border: 2px solid var(--wood-4); border-radius: 4px;
  box-shadow: 0 0 0 1px var(--ink-0), 0 2px 8px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
img.px { image-rendering: pixelated; }


/* ===================== Front end: title, menus, end screens ===================== */
:root {
  --stone: var(--stone-0); --stone-hi: var(--umber-3); --stone-lo: var(--ink-2);
  --gold: var(--gold-3); --gold-deep: var(--gold-0); --ink: var(--bone-1); --dim: var(--sand-0);
  --pixel-font: 'Menu UI', 'Trebuchet MS', sans-serif;
  --logo-font: 'Menu Display', 'Menu UI', Georgia, serif;
  --body-font: 'Menu Body', 'Menu UI', monospace;
}
/* In battle the same roles switch to the gothic set. */
#topbar, #panel, #tooltip, #messages, #tutor, #cheat, #netbanner, #netping, #chatline, #framemeter {
  --pixel-font: 'Game UI', Georgia, serif;
  --logo-font: 'Game Display', 'Game UI', Georgia, serif;
  --body-font: 'Game UI', Georgia, serif;
  font-family: var(--body-font);
}
/* Counters keep their width as they tick. */
#topbar .res, #info .stats, #tooltip .cost { font-variant-numeric: lining-nums tabular-nums; }

.screen { position: fixed; inset: 0; z-index: 30; overflow: hidden; background: var(--ink-1); }

/* Pixel-art scenes: kept crisp, gently drifting. */
.title-art, .end-art {
  position: absolute; inset: -3%;
  background: center / cover no-repeat;
  image-rendering: pixelated;
  animation: drift 60s ease-in-out infinite alternate;
}
.title-art { background-image: url(art/menu/title.png?v=9d9e0593); }
.end.won .end-art { background-image: url(art/menu/victory.png?v=9d9e0593); }
.end.lost .end-art { background-image: url(art/menu/defeat.png?v=9d9e0593); }
@keyframes drift { from { transform: scale(1.0) translate(0, 0); } to { transform: scale(1.06) translate(-1.5%, 1%); } }

#title::after, .end::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--ink-0) 0%, transparent) 30%, color-mix(in srgb, var(--ink-0) 55%, transparent) 100%),
              linear-gradient(to bottom, color-mix(in srgb, var(--ink-0) 15%, transparent), color-mix(in srgb, var(--ink-0) 0%, transparent) 30%, color-mix(in srgb, var(--ink-0) 55%, transparent));
}

/* Floating embers. */
.embers { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.embers i {
  position: absolute; bottom: -10px; width: 4px; height: 4px; background: var(--amber-1);
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--amber-1) 80%, transparent); opacity: 0;
  animation: ember linear infinite;
}
@keyframes ember {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 0.9; }
  100% { transform: translate(var(--dx, 40px), -95vh); opacity: 0; }
}

/* The title stays dark until its painting and fonts are in, then fades in whole (index.html adds .title-shown). */
/* The drifting art reaches past the edges; clip, so nothing (a click, a focus) can scroll the screen over. */
#title { overflow: clip; }
#title > * { opacity: 0; transition: opacity 0.4s; }
.title-shown #title > * { opacity: 1; }

.title-content {
  position: relative; z-index: 2; height: 100%;
  display: flex; flex-direction: column; align-items: center; padding-top: 7vh;
}
.logo {
  margin: 0; font-family: var(--logo-font); font-weight: 400;
  font-size: clamp(40px, 11vw, 132px); line-height: 0.95; letter-spacing: 2px; color: var(--gold);
  text-shadow: 0 4px 0 var(--wood-1), 0 8px 0 var(--umber-1), 0 0 30px color-mix(in srgb, var(--amber-1) 45%, transparent);
  text-align: center;
}
/* The title's menu: Battle first and biggest (a picture banner over New Game, Continue and the RTS's other ways
   in, all stone-and-gold buttons), then Campaign, Adventure and Hearthlands as menu entries in a column (a small
   picture, the name, a line, and its own Continue when it has a save); Options and the wiki at the foot. On a
   narrow screen the entries go under Battle. */
.title-menu { margin-top: auto; margin-bottom: max(24px, 5vh); display: flex; flex-direction: column; align-items: center; gap: 16px;
  width: min(900px, calc(100vw - 32px)); }
.title-modes { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; width: 100%; align-items: stretch; }
.battle-block { display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 3px solid var(--ink-1);
  background: color-mix(in srgb, var(--ink-2) 90%, transparent);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 0 var(--ink-0), 0 10px 30px color-mix(in srgb, var(--ink-0) 60%, transparent); }
.bb-banner { position: relative; height: clamp(84px, 16vh, 150px); overflow: hidden; border: 2px solid var(--ink-1);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 0 12px 8px; }
.bb-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; image-rendering: pixelated; }
.bb-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, color-mix(in srgb, var(--ink-1) 85%, transparent)); }
.bb-banner h2, .bb-banner p { position: relative; z-index: 1; margin: 0; }
.bb-banner h2 { font-family: var(--logo-font); font-weight: 400; font-size: 38px; line-height: 1; color: var(--gold);
  text-shadow: 0 3px 0 var(--wood-0), 0 0 14px color-mix(in srgb, var(--amber-1) 35%, transparent); }
.bb-banner p { font-family: var(--body-font); font-size: 13px; color: var(--bone-0); text-shadow: 0 1px 0 var(--ink-0); }
.bb-main { display: flex; gap: 10px; }
.bb-main .pbtn { flex: 1 1 0; min-width: 0; }
.bb-main .bb-continue { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 12px; }
.bb-continue small { font-family: var(--body-font); font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--bone-0);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-more { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bb-more .pbtn { padding: 9px 10px; }
/* An entry: the stone button's look, its picture at the left. */
.mode-col { display: grid; grid-auto-rows: 1fr; gap: 12px; }
.mode-card { position: relative; }
.mode-open { width: 100%; height: 100%; min-height: 76px; display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 6px; text-align: left; cursor: pointer;
  font-family: var(--pixel-font); color: var(--ink); background: var(--stone); border: 3px solid var(--ink-1); border-radius: 0;
  box-shadow: inset 3px 3px 0 var(--stone-hi), inset -3px -3px 0 var(--stone-lo), 0 4px 0 var(--ink-0); transition: transform 0.06s, filter 0.1s; }
.mode-open:hover, .mode-open:focus-visible { filter: brightness(1.2); background: var(--umber-2); outline: none; }
.mode-open:focus-visible { border-color: var(--gold-3); }
.mode-open:active { transform: translateY(3px); box-shadow: inset 3px 3px 0 var(--stone-lo), inset -3px -3px 0 var(--stone-hi), 0 1px 0 var(--ink-0); }
.mode-open img { flex: none; width: 96px; height: 70px; object-fit: cover; object-position: var(--focus, 50% 50%); image-rendering: pixelated; border: 2px solid var(--ink-1); }
.mode-open .label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mode-open b { font-size: 18px; letter-spacing: 1px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
.mode-open small { font-family: var(--body-font); font-size: 13px; color: var(--bone-0); }
.mode-card:has(.mode-continue:not(.hidden)) .label { margin-bottom: 26px; }
.mode-continue { position: absolute; left: 117px; bottom: 9px; max-width: calc(100% - 129px); padding: 2px 8px; border-radius: 0; cursor: pointer;
  font-family: var(--body-font); font-size: 12px; color: var(--sand-2); background: var(--wood-3); border: 1px solid var(--gold-0);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.mode-continue:hover, .mode-continue:focus-visible { background: var(--wood-4); color: var(--gold); outline: none; }
/* A product without a mode (src/product.js puts no-<mode> on <html>) has no entry for it; one with Battle alone
   (battle-only: The Long Dusk) has the Battle block by itself, in the middle. */
html.no-campaign [data-product-mode="campaign"], html.no-adventure [data-product-mode="adventure"], html.no-hearth [data-product-mode="hearth"] { display: none; }
html.battle-only .mode-col { display: none; }
/* Lines that name one product's things (the F1 help): Crown of Shadow's, hidden in Steam & Iron, and Steam & Iron's own. */
html.product-steam .crown-only, html:not(.product-steam) .steam-only { display: none !important; }
html.battle-only .title-modes { grid-template-columns: minmax(0, 560px); justify-content: center; }
.title-links { display: flex; align-items: center; gap: 12px; font-family: var(--pixel-font); color: var(--bone-1); }
.title-links i { font-style: normal; opacity: 0.6; }
.linkbtn { font-family: var(--pixel-font); font-size: 16px; letter-spacing: 1px; color: var(--bone-0); background: none; border: 0;
  padding: 4px 6px; cursor: pointer; text-decoration: none; text-shadow: 0 2px 0 var(--ink-0); }
.linkbtn:hover, .linkbtn:focus-visible { color: var(--gold); outline: none; text-decoration: underline; text-underline-offset: 4px; background: none; }
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .title-content { overflow-y: auto; }
  .title-menu { margin-top: 28px; width: min(520px, calc(100vw - 32px)); }
  .title-modes { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .title-content { padding-top: 24px; }
  .title-menu { margin-top: 16px; }
  .bb-banner { height: 92px; }
  .mode-open { min-height: 76px; }
  .mode-open img { width: 80px; height: 60px; }
  .mode-continue { left: 101px; max-width: calc(100% - 113px); }
  .title-foot { display: none; }
}

/* Continue and Load on the Hearthlands and Adventure screens (Main.modeSaves). */
.mode-saved { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0 2px; }
.mode-saved .pbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 18px; }
.mode-saved small { font-family: var(--body-font); font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--bone-0); }
.mode-saved .pbtn.primary { min-width: min(320px, 100%); }

/* While the orchestra loads, a bar stands where the menu will be. */
.title-loading { display: none; margin-top: auto; margin-bottom: 14vh; width: min(340px, 86vw); text-align: center;
  font-family: var(--pixel-font); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--bone-0);
  text-shadow: 0 1px 0 var(--ink-0); }
.load-bar { height: 10px; margin-bottom: 10px; border: 2px solid var(--wood-2); background: color-mix(in srgb, var(--ink-0) 70%, transparent); }
.load-bar i { display: block; height: 100%; width: 0; background: var(--gold-3); transition: width 0.15s; }
#title.loading .title-loading { display: block; }
#btn-enter { display: none; width: 100%; }
#title.ready .load-bar, #title.ready #load-text { display: none; }
#title.ready #btn-enter { display: block; }
#title.loading .title-menu { display: none; }
.title-foot {
  position: absolute; z-index: 2; right: 16px; bottom: 12px; font-family: var(--pixel-font);
  font-size: 12px; color: color-mix(in srgb, var(--bone-1) 60%, transparent); text-shadow: 0 1px 0 var(--ink-0);
}

/* The link between the live game and the preview of the next release (src/release-links.js). */
.release-link {
  position: absolute; z-index: 2; left: 16px; bottom: 12px; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 14px; font-family: var(--pixel-font); text-decoration: none; color: var(--sand-2);
  background: color-mix(in srgb, var(--ink-2) 88%, transparent); border: 2px solid var(--gold-3);
  box-shadow: 0 3px 0 var(--ink-0); text-shadow: 0 1px 0 var(--ink-0);
}
.release-link b { font-size: 15px; letter-spacing: 1px; color: var(--gold-3); }
.release-link span { font-size: 12px; color: var(--bone-0); }
.release-link:hover { filter: brightness(1.2); }
.release-link[hidden] { display: none; }
#title.loading .release-link { display: none; }
@media (max-width: 899px), (orientation: portrait) { .release-link { position: static; margin: 14px auto 40px; width: max-content; max-width: 92vw; } }

/* Chunky stone-and-gold pixel buttons. */
.pbtn {
  font-family: var(--pixel-font); font-weight: 600; font-size: 17px; letter-spacing: 1px;
  color: var(--ink); text-decoration: none; text-align: center; cursor: pointer;
  background: var(--stone); padding: 10px 18px; border: 3px solid var(--ink-1); border-radius: 0;
  box-shadow: inset 3px 3px 0 var(--stone-hi), inset -3px -3px 0 var(--stone-lo), 0 4px 0 var(--ink-0);
  text-shadow: 0 2px 0 var(--ink-0); transition: transform 0.06s, filter 0.1s; display: block;
}
.pbtn:hover { filter: brightness(1.25); background: var(--umber-2); }
.pbtn:active { transform: translateY(3px); box-shadow: inset 3px 3px 0 var(--stone-lo), inset -3px -3px 0 var(--stone-hi), 0 1px 0 var(--ink-0); }
.pbtn.primary {
  background: var(--wood-3); color: var(--sand-2);
  box-shadow: inset 3px 3px 0 var(--gold-0), inset -3px -3px 0 var(--umber-2), 0 4px 0 var(--ink-0);
}
.pbtn.primary:hover { background: var(--wood-4); }
.pbtn.big { font-size: 22px; padding: 14px 22px; }
.pbtn.small { font-size: 14px; padding: 6px 12px; }
.title-menu .pbtn { backdrop-filter: blur(2px); }
/* Framed panels. */
.card.frame {
  border-radius: 0; border: 4px solid var(--ink-1); background: color-mix(in srgb, var(--ink-2) 94%, transparent);
  box-shadow: inset 0 0 0 3px var(--wood-2), inset 0 0 0 6px var(--ink-2), 0 10px 40px color-mix(in srgb, var(--ink-0) 70%, transparent);
}
.ptitle {
  font-family: var(--logo-font) !important; font-weight: 400 !important; color: var(--gold);
  font-size: 54px !important; letter-spacing: 1px; margin: 0; text-shadow: 0 3px 0 var(--wood-0), 0 0 18px color-mix(in srgb, var(--amber-1) 35%, transparent);
}
h2.ptitle { font-size: 46px !important; margin-bottom: 14px; }
.opt-list { display: flex; flex-direction: column; gap: 10px; min-width: 300px; margin-bottom: 16px; }

/* Saved battles (saves.js). */
.saves-card { width: min(640px, calc(100vw - 32px)); max-width: none; max-height: 92vh; display: flex; flex-direction: column; }
.saves-new { display: flex; gap: 8px; margin-bottom: 6px; }
.saves-new .field { flex: 1; min-width: 0; }
#saves-note { min-height: 1.2em; margin: 6px 0; font-size: 14px; }
#saves-note.bad { color: var(--ember-3); font-style: normal; }
.saves-list { list-style: none; margin: 0 0 14px; padding: 0; overflow-y: auto; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.saves-list li { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: color-mix(in srgb, var(--ink-1) 80%, transparent); border: 1px solid var(--umber-3); }
.saves-list li.auto { border-color: var(--wood-4); }
.saves-list li.empty { justify-content: center; color: var(--sand-1); font-style: italic; }
.saves-list .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.saves-list .what b { color: var(--gold-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saves-list .what small { color: var(--stone-9); font-size: 12px; }
.saves-list .pbtn { flex: none; }
.saves-foot { display: flex; justify-content: space-between; gap: 8px; }
#btn-saves-close { margin-left: auto; }
@media (max-width: 560px) {
  .saves-list li { flex-wrap: wrap; }
  .saves-list .what { flex-basis: 100%; }
  .saves-list li .pbtn[data-act="load"], .saves-list li .pbtn[data-act="over"] { margin-left: auto; }
}
#replaying .card, #gate .card { width: min(420px, calc(100vw - 32px)); }
#gate { z-index: 40; background: var(--ink-0); }   /* (the map is not seen until its pictures have come) */
#replaying .pbtn { margin: 4px auto 0; }
.opt-row { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.pbtn.opt { display: flex; justify-content: space-between; align-items: center; gap: 16px; text-align: left; }
.pbtn.opt span { color: var(--gold); min-width: 34px; text-align: right; }
.pbtn.opt.vol { cursor: default; }
.pbtn.opt.vol input { flex: 1 1 90px; min-width: 70px; max-width: 170px; margin-left: auto; accent-color: var(--gold); cursor: pointer; }
.pbtn.opt.vol span { min-width: 44px; }
.overlay.dim { background: color-mix(in srgb, var(--ink-0) 60%, transparent); }

/* The New Battle screen sits over the darkened title art. */
.setup-screen { background: var(--ink-1) url(art/menu/title.png?v=9d9e0593) center / cover no-repeat; image-rendering: pixelated; }
.setup-screen::before { content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--ink-1) 72%, transparent); }
.setup-screen .card { position: relative; image-rendering: auto; }
.setup-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.setup-head .ptitle { text-align: center; }
.card.setup h4 { font-family: var(--pixel-font); letter-spacing: 2px; }
/* Each AI's difficulty (Main.syncAIDiffs): small rows, three to a line on a wide screen, one on a phone. */
.ai-diffs { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-diffs .slot { flex: 1 1 230px; flex-wrap: nowrap; gap: 6px; padding: 5px 6px; }
.ai-diffs .slot .who { min-width: 0; flex: 1; white-space: nowrap; font-size: 14px; }
.ai-diffs .slot select { min-width: 0; flex: 0 1 auto; }
.card.setup .chips button, .card.setup .go button, .maps button {
  border-radius: 0; font-family: var(--pixel-font);
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo);
}

/* Faction cards with their illustrations. */
.factions button.art-card { position: relative; padding: 0; overflow: hidden; border-radius: 0; aspect-ratio: 3 / 4; justify-content: flex-end; border: 3px solid var(--ink-1); }
.factions button.art-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform 0.25s; }
.factions button.art-card:hover img { transform: scale(1.04); }
.factions button.art-card .label {
  position: relative; width: 100%; padding: 26px 6px 8px; display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--ink-0) 0%, transparent), color-mix(in srgb, var(--ink-1) 92%, transparent) 45%);
}
.factions button.art-card b { font-family: var(--pixel-font); font-size: 15px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
.factions button.art-card small { color: var(--bone-0); }
.factions button.art-card.sel { border-color: var(--gold-3); box-shadow: 0 0 0 2px var(--gold-3), 0 0 22px color-mix(in srgb, var(--gold-3) 50%, transparent); }
.factions button.art-card:not(.sel) img { filter: saturate(0.7) brightness(0.8); }

/* The battlefield cards (src/map-previews.js), in the look Options.mapPreviews picks: the painted chart
   (five to a row), the diorama or the atlas (four). Their pictures are drawn at the size they show, at the
   screen's density (Main.drawMapCards sets it); until then they fill the card. The columns may shrink below
   a picture's width (minmax 0) so a narrower window can't be held open by the pictures it is about to redraw. */
.card.setup .step2 .maps.painted { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.card.setup .step2 .maps.diorama, .card.setup .step2 .maps.atlas { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.card.setup .step2 .maps.painted canvas, .card.setup .step2 .maps.diorama canvas, .card.setup .step2 .maps.atlas canvas {
  display: block; width: 100%; height: auto; max-width: 100%; image-rendering: auto; transition: filter 0.2s;
}
.maps .tag, .maps .map-chips { display: none; }
/* Painted chart: the chart fills the card, its name in a dark strip under it; the chosen one ringed in gold. */
.maps.painted button, .maps.diorama button { padding: 0; gap: 0; overflow: hidden; justify-content: flex-start; }
.maps.painted button { border: 2px solid var(--ink-1); background: var(--ink-2); box-shadow: inset 0 -2px 0 var(--stone-lo); }
.card.setup .step2 .maps.painted canvas { aspect-ratio: 1; }
.maps.painted button b {
  width: 100%; flex: 1; min-height: 2.9em; padding: 5px 4px 6px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1.15; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); background: linear-gradient(var(--umber-1), var(--ink-2));
}
.maps.painted button:not(.sel) canvas, .maps.diorama button:not(.sel) canvas { filter: saturate(0.85) brightness(0.88); }
.maps.painted button:hover canvas, .maps.diorama button:hover canvas { filter: none; }
.maps.painted button.sel, .maps.diorama button.sel { border-color: var(--gold-3); box-shadow: 0 0 0 2px var(--gold-3), 0 0 22px color-mix(in srgb, var(--gold-3) 50%, transparent); }
.maps.painted button.sel b { background: linear-gradient(var(--umber-3), var(--umber-2)); color: var(--gold-3); }
/* Diorama: the model on its table, the name under it, a tag in the corner for the siege and hold maps. */
.maps.diorama button { position: relative; background: var(--ink-2); }
.card.setup .step2 .maps.diorama canvas { aspect-ratio: 184 / 104; }
.maps.diorama button b {
  width: 100%; flex: 1; min-height: 34px; padding: 3px 8px 5px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1.05; color: var(--bone-0); text-shadow: 0 2px 0 var(--ink-0);
  border-top: 1px solid color-mix(in srgb, var(--umber-4) 70%, transparent); background: linear-gradient(var(--ink-2), var(--ink-1));
}
.maps.diorama button.sel b { color: var(--gold); background: linear-gradient(var(--umber-3), var(--ink-1)); }
.maps.diorama .tag:not(:empty) {
  display: block; position: absolute; top: 5px; left: 5px; padding: 1px 5px 2px; font-family: var(--pixel-font); font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--bone-1); background: color-mix(in srgb, var(--ink-0) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--umber-4) 80%, transparent);
}
.maps.diorama .tag.siege { color: var(--ember-3); }
.maps.diorama .tag.halls { color: var(--steel-8); }
/* Atlas: the plate on the card's stone, the name, then the chips that fit on one row (all in their titles). */
.maps.atlas button { padding: 6px 4px 7px; gap: 4px; justify-content: flex-start; }
.card.setup .step2 .maps.atlas canvas { max-width: 168px; aspect-ratio: 168 / 92; }
.maps.atlas button b { font-size: 13px; line-height: 1.1; min-height: 15px; color: var(--bone-1); text-shadow: 0 1px 0 var(--ink-0); }
.maps.atlas button.sel b { color: var(--gold-3); }
.maps.atlas .map-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; height: 15px; overflow: hidden; }
.maps.atlas .chip {
  display: inline-flex; align-items: center; gap: 1px; height: 15px; padding: 0 4px 0 1px; font-size: 11px; line-height: 1; color: var(--bone-0);
  background: color-mix(in srgb, var(--ink-1) 85%, transparent); border: 1px solid color-mix(in srgb, var(--umber-4) 90%, transparent); border-radius: 3px;
}
.maps.atlas button.sel .chip { border-color: color-mix(in srgb, var(--gold-0) 55%, transparent); }
.maps.atlas .chip img { width: 12px; height: 12px; }
/* The key under the map's description: what the marks on the cards mean. */
.map-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; color: var(--stone-9); }
.map-key span { display: inline-flex; align-items: center; gap: 4px; }
.map-key img { width: 16px; height: 16px; }
.map-key img + img { margin-left: -4px; }   /* the painted key's foes: their banners side by side */
.map-key.atlas { gap: 4px 16px; color: var(--sand-0); }
.map-key.atlas img { width: 18px; height: 18px; }
@media (max-width: 700px) {
  .card.setup .step2 .maps.painted { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .card.setup .step2 .maps.diorama, .card.setup .step2 .maps.atlas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .maps.atlas .map-chips { height: auto; max-height: 33px; }   /* two rows of chips on a narrow card */
}

/* End screens. */
.end { display: flex; align-items: center; justify-content: center; }
.end-card { position: relative; z-index: 2; max-width: 560px; text-align: center; }
.end-card .ptitle { font-size: 72px !important; }
.end-card:has(.end-table) { max-width: min(760px, calc(100vw - 32px)); }
#end-stats { overflow-x: auto; margin: 4px 0 16px; }
.end-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.end-table th, .end-table td { padding: 5px 8px; text-align: right; white-space: nowrap; }
.end-table thead th { color: var(--gold-3); font-weight: normal; border-bottom: 1px solid var(--wood-4); }
.end-table tbody th { text-align: left; font-weight: normal; }
.end-table tbody tr + tr { border-top: 1px solid color-mix(in srgb, var(--wood-4) 40%, transparent); }
.end-table tr.me { background: color-mix(in srgb, var(--gold-3) 10%, transparent); }
.end-table td.top { color: var(--gold-3); }
.end-table .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.end.lost .end-card .ptitle { color: var(--ember-3); text-shadow: 0 3px 0 var(--blood-0), 0 0 18px color-mix(in srgb, var(--ember-2) 45%, transparent); }

/* ===================== In-game HUD, in the front-end's pixel style ===================== */
/* Carved dark stone with a gold edge, chunky bevels, pixel font for numbers and labels. */
#topbar, #panel {
  background:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--bone-3) 2.5%, transparent) 0 2px, color-mix(in srgb, var(--ink-0) 0%, transparent) 2px 6px),
    linear-gradient(var(--stone-0), var(--ink-2));
  font-family: var(--pixel-font);
}
#topbar {
  height: 42px; gap: 10px; padding: 0 10px;
  border-bottom: 3px solid var(--ink-1);
  box-shadow: inset 0 -3px 0 var(--wood-2), inset 0 -6px 0 var(--ink-2), 0 4px 10px color-mix(in srgb, var(--ink-0) 50%, transparent);
}
#topbar .res {
  min-width: 82px; gap: 6px; padding: 3px 10px 3px 4px;
  background: var(--ink-1); border: 2px solid var(--ink-1);
  box-shadow: inset 2px 2px 0 var(--ink-0), inset -2px -2px 0 var(--umber-2);
  font-size: 17px; font-weight: 600; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0);
}
#topbar img.ico, #topbar canvas.ico { width: 26px; height: 26px; image-rendering: pixelated; flex: none; }
/* Every box keeps its size; the AI's status takes what room is left and trims itself. */
#topbar .res, #topbar button { flex: none; }
/* One line: every box and button is 32px tall, centred in the bar above its 6px trim. */
#topbar { padding-bottom: 6px; box-sizing: border-box; }
#topbar .res, #topbar .wave, #topbar button { height: 32px; box-sizing: border-box; }
#topbar .res { padding-top: 0; padding-bottom: 0; }
#topbar .wave { line-height: 24px; padding-top: 2px; padding-bottom: 2px; }
#topbar .wave { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#topbar .wave:empty { display: none; }
/* Buttons: one size, one pixel glyph each (hud-icons.js). */
#topbar button:not(#btn-idle) { width: 32px; padding: 0; display: grid; place-items: center; }
/* Painted icons (art/ui, art/hud) and pixel glyphs inside text and on buttons. */
img.uicon, img.glyph { image-rendering: pixelated; }
img.uicon.inline { height: 1.3em; width: auto; vertical-align: -0.3em; }
img.glyph.inline { height: 1em; width: auto; vertical-align: -0.12em; }
#commands .cmd .rep img.glyph { width: 14px; height: 14px; display: block; }
#topbar button canvas.glyph { width: 28px; height: 28px; image-rendering: pixelated; display: block; }
#topbar button.off canvas.glyph { opacity: 0.4; }
#topbar #btn-idle { width: auto; padding: 3px 9px; display: flex; }
#topbar button, #panel button {
  font-family: var(--pixel-font); font-weight: 600; color: var(--ink); border-radius: 0;
  background: var(--stone); border: 2px solid var(--ink-1); padding: 3px 9px; font-size: 15px;
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo), 0 2px 0 var(--ink-0);
  text-shadow: 0 1px 0 var(--ink-0);
}
#topbar button:hover, #panel button:hover { filter: brightness(1.25); background: var(--umber-2); }
#topbar button:active, #panel button:active { transform: translateY(2px); box-shadow: inset 2px 2px 0 var(--stone-lo), inset -2px -2px 0 var(--stone-hi); }
#btn-idle { display: flex; align-items: center; gap: 4px; }
#btn-idle img.ico { width: 22px !important; height: 22px !important; }
#btn-idle.has-idle { background: var(--wood-3); border-color: var(--ink-1); color: var(--sand-2); box-shadow: inset 2px 2px 0 var(--gold-0), inset -2px -2px 0 var(--umber-2), 0 2px 0 var(--ink-0); animation: idlePulse 1.2s steps(2) infinite; }
@keyframes idlePulse { 50% { filter: brightness(1.3); } }
#topbar .wave { font-size: 15px; letter-spacing: 1px; text-shadow: 0 2px 0 var(--ink-0);
  padding: 4px 10px; background: var(--ink-1); border: 2px solid var(--ink-1);
  box-shadow: inset 2px 2px 0 var(--ink-0), inset -2px -2px 0 var(--umber-2); }
#topbar .wave.soon { color: var(--ember-3); animation: idlePulse 0.8s steps(2) infinite; }
/* Gifts to allies (UI.renderGifts): a chest on the top bar opens a box of buttons under it. */
#gifts { position: relative; flex: none; }
#btn-gifts img.uicon { width: 26px; height: 26px; }
#giftbox {
  position: absolute; top: calc(100% + 9px); left: 0; z-index: 6; display: grid; gap: 6px; padding: 8px 10px;
  background: color-mix(in srgb, var(--ink-2) 97%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 16px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#giftbox h4 { margin: 0; font-size: 14px; letter-spacing: 0.5px; color: var(--gold-3); text-shadow: 0 1px 0 var(--ink-0); }
#giftbox .gift-row { display: flex; align-items: center; gap: 6px; }
#giftbox .who { min-width: 96px; font-size: 15px; text-shadow: 0 1px 0 var(--ink-0); }
#topbar #giftbox button { width: auto; height: 28px; padding: 0 8px; display: flex; align-items: center; gap: 4px; font-size: 14px; }
#giftbox button img.uicon { width: 18px; height: 18px; }
#giftbox button:disabled { opacity: 0.45; filter: grayscale(0.6); cursor: not-allowed; }

#panel {
  height: 200px; gap: 8px; padding: 10px 8px 8px;
  border-top: 3px solid var(--ink-1);
  box-shadow: inset 0 3px 0 var(--wood-2), inset 0 6px 0 var(--ink-2), 0 -4px 10px color-mix(in srgb, var(--ink-0) 50%, transparent);
}
/* Our heroes, a row of buttons over the minimap (UI.renderHeroBar). */
#herobar { position: absolute; left: 8px; bottom: calc(100% + 6px); display: flex; gap: 6px; }
#herobar.hidden { display: none; }
#panel #herobar .hero-btn { position: relative; width: 46px; height: 50px; padding: 3px 3px 9px; display: grid; place-items: center; }
#herobar .hero-btn img.art { width: 36px; height: 36px; }
#panel #herobar .hero-btn.sel { border-color: var(--gold-3); box-shadow: inset 2px 2px 0 var(--gold-0), inset -2px -2px 0 var(--umber-2), 0 0 0 2px var(--gold-3), 0 2px 0 var(--ink-0); }
#herobar .hero-btn.away img.art { filter: grayscale(0.8) brightness(0.6); }
#herobar .hero-btn .hp { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; background: var(--blood-0); }
#herobar .hero-btn .hp > span { display: block; height: 100%; background: var(--leaf-5); }
#herobar .hero-btn .hot { position: absolute; top: 1px; left: 3px; font-size: 11px; line-height: 1; color: var(--gold-4); text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0); }
#herobar .hero-btn .st { position: absolute; top: -5px; right: -5px; line-height: 0; }
#herobar .hero-btn .st img.uicon { width: 16px; height: 16px; }
/* Recessed wells for the minimap, the info panel and the command grid. */
#minimap, #info, #commands {
  background-color: var(--ink-1); border: 3px solid var(--ink-1); border-radius: 0;
  box-shadow: inset 3px 3px 0 var(--ink-0), inset -3px -3px 0 var(--umber-2), 0 0 0 2px var(--wood-2);
}
#minimap { image-rendering: pixelated; }
#info { padding: 8px 12px; }
#commands { padding: 6px; width: 312px; grid-auto-rows: 52px; }
#info h3 { font-family: var(--logo-font); font-weight: 700; font-size: 20px; letter-spacing: 1px; text-shadow: 0 2px 0 var(--ink-0); }
#info .stats { font-family: var(--body-font); }
#info .status { font-family: var(--pixel-font); }

/* Blocky, segmented bars. */
#info .hpbar, #info .progress, #info .chip .mini {
  border-radius: 0; border: 2px solid var(--ink-1); background: var(--ink-2); box-sizing: content-box;
}
#info .hpbar { height: 10px; }
#info .progress { height: 6px; background: var(--ink-2); }
#info .hpbar > div, #info .progress > div, #info .chip .mini > div {
  background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--ink-0) 0%, transparent) 0 6px, color-mix(in srgb, var(--ink-0) 35%, transparent) 6px 8px);
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--bone-3) 25%, transparent);
}
#info .progress > div { background-color: var(--gold-0); }

/* Unit chips and the training queue: bevelled tiles. */
#info .chip {
  border-radius: 0; background: var(--stone-0); border: 2px solid var(--ink-1);
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo);
}
#info .chip:hover { filter: brightness(1.25); }
#info .chip img.art, img.art { border-radius: 0; image-rendering: pixelated; }
#info img.portrait { border-radius: 0; border: 3px solid var(--ink-1); box-shadow: 0 0 0 2px var(--wood-2); image-rendering: pixelated; }
#info .chip .lv { border-radius: 0; font-family: var(--pixel-font); border: 1px solid var(--ink-1); }
/* A stack of cards: one or two bevelled tiles peeking out behind, up and to the right, and a count. */
#info .multi .chip.stack { margin-right: 3px;
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo), 3px -3px 0 0 var(--stone-3), 3px -3px 0 2px var(--ink-1); }
#info .multi .chip.stack3 { margin-right: 6px;
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo), 3px -3px 0 0 var(--stone-3), 3px -3px 0 2px var(--ink-1),
    6px -6px 0 0 var(--stone-2), 6px -6px 0 2px var(--ink-1); }
#info .chip .n { position: absolute; right: -3px; bottom: 7px;   /* clear of the health bar under it */ font-family: var(--pixel-font); font-size: 10px; line-height: 1;
  color: var(--bone-3); background: var(--ink-1); padding: 1px 2px; }
#info .chip .rk { position: absolute; top: -1px; left: 1px; font-size: 7px; line-height: 1; letter-spacing: -1px; color: var(--gold-3); text-shadow: 0 1px 0 var(--ink-0); }

/* Command buttons. */
#commands .cmd {
  border-radius: 0; background: var(--stone); border: 2px solid var(--ink-1);
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo), 0 2px 0 var(--ink-0);
  padding: 2px; gap: 1px;
}
#commands .cmd:hover { filter: brightness(1.3); background: var(--umber-2); }
#commands .cmd:active { transform: translateY(2px); box-shadow: inset 2px 2px 0 var(--stone-lo), inset -2px -2px 0 var(--stone-hi); }
#commands .cmd small { font-family: var(--pixel-font); font-size: 10px; letter-spacing: 0.3px; color: var(--bone-0); text-shadow: 0 1px 0 var(--ink-0); line-height: 1; }
#commands .cmd .key {
  top: 1px; right: 2px; font-family: var(--pixel-font); font-weight: 700; font-size: 11px; color: var(--gold);
  text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0);
}
#commands .cmd.active { background: var(--moss-2); box-shadow: inset 2px 2px 0 var(--leaf-3), inset -2px -2px 0 var(--moss-0), 0 0 0 2px var(--leaf-6); }
#commands .cmd .cdt { font-family: var(--pixel-font); }

/* Tooltip and messages: framed pixel panels. */
#tooltip {
  border-radius: 0; background: color-mix(in srgb, var(--ink-2) 97%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 16px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#tooltip b { font-family: var(--pixel-font); font-size: 15px; letter-spacing: 0.5px; }
#tooltip .cost { font-family: var(--pixel-font); font-weight: 600; display: flex; gap: 10px; align-items: center; }
#tooltip .cost img { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: -4px; margin-right: 2px; }
#messages { bottom: 214px; }
#messages div {
  border-radius: 0; font-family: var(--pixel-font); font-size: 15px; letter-spacing: 0.5px;
  background: color-mix(in srgb, var(--ink-1) 88%, transparent); border: 2px solid var(--ink-1); border-left: 4px solid var(--gold-0);
  box-shadow: 0 2px 0 var(--ink-0); text-shadow: 0 1px 0 var(--ink-0); padding: 5px 12px;
}

/* The help screen uses the framed panel too. */
#help .card { border-radius: 0; border: 4px solid var(--ink-1); background: color-mix(in srgb, var(--ink-2) 96%, transparent);
  box-shadow: inset 0 0 0 3px var(--wood-2), inset 0 0 0 6px var(--ink-2), 0 10px 40px color-mix(in srgb, var(--ink-0) 70%, transparent); }
#help .card { max-height: calc(100vh - 32px); overflow-y: auto; }   /* the list is longer than a short screen */
@media (max-width: 560px) {   /* a key over what it does, so the words get the width */
  #help .card td { display: block; padding: 0 4px; }
  #help .card td:first-child { padding-top: 8px; }
}
#help .card h2 { font-family: var(--logo-font); font-weight: 400; font-size: 46px; color: var(--gold); text-shadow: 0 3px 0 var(--wood-0); margin-bottom: 10px; }
#help .card td:first-child { font-family: var(--pixel-font); }
#help .card button { font-family: var(--pixel-font); font-weight: 600; border-radius: 0; background: var(--wood-3); color: var(--sand-2); border: 3px solid var(--ink-1); padding: 10px 18px;
  box-shadow: inset 3px 3px 0 var(--gold-0), inset -3px -3px 0 var(--umber-2), 0 4px 0 var(--ink-0); }
/* Two-line labels fit inside the command buttons. */
#commands .cmd img.art { width: 26px; height: 26px; flex: none; }
#commands .cmd small {
  font-size: 9.5px; max-width: 100%; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: center;
}
#commands { grid-auto-rows: 54px; }

/* Command card groups: each kind of button has its own frame colour and starts a new row. */
#commands { overflow-y: auto; scrollbar-width: thin; }
#commands .cmd.g-action  { --g-hi: var(--stone-4); --g-lo: var(--dusk-0); background: var(--dusk-1); }
#commands .cmd.g-ability { --g-hi: var(--arcane-4); --g-lo: var(--arcane-0); background: var(--arcane-1); }
#commands .cmd.g-quest   { --g-hi: var(--gold-1); --g-lo: var(--umber-1); background: var(--umber-2); }
#commands .cmd.g-unit    { --g-hi: var(--sky-5); --g-lo: var(--steel-0); background: var(--steel-1); }
#commands .cmd.g-hero    { --g-hi: var(--wood-6); --g-lo: var(--umber-1); background: var(--steel-1); }
#commands .cmd.g-build   { --g-hi: var(--leaf-4); --g-lo: var(--moss-0); background: var(--moss-1); }
#commands .cmd.g-upgrade { --g-hi: var(--gold-0); --g-lo: var(--umber-2); background: var(--umber-2); }
#commands .cmd[class*="g-"] { box-shadow: inset 2px 2px 0 var(--g-hi), inset -2px -2px 0 var(--g-lo), 0 2px 0 var(--ink-0); }
#commands .cmd.g-hero { box-shadow: inset 2px 2px 0 var(--g-hi), inset -2px -2px 0 var(--g-lo), inset 0 0 0 3px var(--sky-5), 0 2px 0 var(--ink-0); }
#commands .cmd.active { background: var(--moss-2); box-shadow: inset 2px 2px 0 var(--leaf-3), inset -2px -2px 0 var(--moss-0), 0 0 0 2px var(--leaf-6); }
#commands .cmd .up {
  position: absolute; top: 1px; left: 3px; font-size: 9px; line-height: 1; color: var(--gold-3); text-shadow: 0 1px 0 var(--ink-0);
}
#commands .cmd .rep {
  position: absolute; bottom: 1px; left: 2px; font-size: 11px; line-height: 1; pointer-events: none;
}
#commands .cmd.repeating { outline: 2px solid var(--leaf-6); outline-offset: -2px; animation: repPulse 1.4s steps(2) infinite; }
@keyframes repPulse { 50% { outline-color: var(--leaf-2); } }
#tooltip .kind {
  font-family: var(--pixel-font); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
  display: inline-block; padding: 1px 6px; margin-bottom: 3px; color: var(--sand-2); border: 1px solid var(--ink-1);
}
#tooltip .kind.g-action  { background: var(--stone-2); }
#tooltip .kind.g-ability { background: var(--arcane-2); }
#tooltip .kind.g-quest   { background: var(--wood-4); }
#tooltip .kind.g-unit    { background: var(--sky-2); }
#tooltip .kind.g-hero    { background: var(--wood-4); }
#tooltip .kind.g-build   { background: var(--leaf-1); }
#tooltip .kind.g-upgrade { background: var(--wood-4); }
/* Three grouped rows must fit in the panel well. */
#commands { grid-auto-rows: 50px; gap: 5px; padding: 5px; }

/* Picture buttons: the art is the whole face, the name lives in the tooltip. Square tiles, five per row. */
#commands { grid-template-columns: repeat(5, 52px); grid-auto-rows: 52px; gap: 3px 5px; justify-content: center; }   /* three rows fit */
#commands .cmd { padding: 0; gap: 0; overflow: hidden; }
#commands .cmd small { display: none; }
#commands .cmd img.art.face {
  position: absolute; inset: 0; width: 100%; height: 100%; box-shadow: none; border-radius: 0; image-rendering: pixelated;
}
#commands .cmd img.uicon.face { width: 42px; height: 42px; filter: drop-shadow(0 2px 0 var(--ink-0)); }
/* The group frame sits on top of the picture. */
#commands .cmd::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--g-hi, var(--wood-2)), inset 0 0 0 3px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#commands .cmd.g-hero::after { box-shadow: inset 0 0 0 2px var(--gold-1), inset 0 0 0 3px color-mix(in srgb, var(--ink-0) 60%, transparent); }
#commands .cmd.active::after { box-shadow: inset 0 0 0 3px var(--leaf-6); }
#commands .cmd.repeating { outline: none; }
#commands .cmd.repeating::after { box-shadow: inset 0 0 0 3px var(--leaf-6); animation: repPulse2 1.4s steps(2) infinite; }
@keyframes repPulse2 { 50% { box-shadow: inset 0 0 0 3px var(--leaf-2); } }
#commands .cmd .key, #commands .cmd .up, #commands .cmd .rep, #commands .cmd .cd, #commands .cmd .cdt { z-index: 1; }
#commands .cmd .key {
  top: 3px; right: 3px; padding: 0 3px; line-height: 13px; background: color-mix(in srgb, var(--ink-1) 85%, transparent); font-size: 11px;
}
#commands .cmd .up { top: 3px; left: 3px; padding: 0 2px; line-height: 12px; background: color-mix(in srgb, var(--ink-1) 85%, transparent); }
#commands .cmd .rep { bottom: 3px; left: 3px; background: color-mix(in srgb, var(--ink-1) 85%, transparent); padding: 1px; }
#commands .cmd:hover { filter: brightness(1.2); }
#commands .cmd.disabled { opacity: 1; }
#commands .cmd.disabled img.art.face, #commands .cmd.disabled img.uicon.face { filter: grayscale(0.8) brightness(0.55); }
#commands .cmd.locked { opacity: 1; filter: none; }
#commands .cmd.locked img.art.face, #commands .cmd.locked img.uicon.face { filter: grayscale(1) brightness(0.5); }

/* Cheat code box (Enter in game) */
#cheat { position: fixed; left: 50%; bottom: 214px; transform: translateX(-50%); z-index: 20; }
#cheat input {
  width: 420px; max-width: calc(100vw - 32px); padding: 7px 10px; font: inherit; font-size: 14px;
  color: var(--bone-1); background: color-mix(in srgb, var(--ink-2) 92%, transparent); border: 1px solid var(--gold-0); border-radius: 4px; outline: none;
}

/* ===================== Tutorial ===================== */
#tut-pick { margin-top: 14px; }
#tut-pick .tut-done {
  position: absolute; top: 6px; right: 6px; z-index: 1; width: 28px; height: 28px; line-height: 26px;
  font-family: var(--pixel-font); font-size: 18px; color: var(--ink-1); background: var(--leaf-6); border: 2px solid var(--ink-1);
}
#tutor {
  position: fixed; top: 48px; right: 12px; z-index: 6; width: 340px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 196px - 64px); overflow-y: auto; padding: 10px 14px 12px;
  font-family: var(--pixel-font); font-size: 15px; line-height: 1.45; color: var(--ink);
  background: color-mix(in srgb, var(--ink-2) 94%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 24px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#tutor .tut-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--dim); letter-spacing: 1px; }
#tutor .tut-x { background: none; border: none; color: var(--dim); padding: 0 4px; font-size: 16px; }
#tutor .tut-x:hover { color: var(--gold); background: none; }
#tutor .tut-bar { height: 5px; background: var(--ink-2); margin: 6px 0 8px; }
#tutor .tut-bar > div { height: 100%; background: var(--gold-deep); transition: width 0.4s; }
#tutor h3 { margin: 0 0 6px; font-family: var(--logo-font); font-weight: 700; font-size: 21px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#tutor.passed h3 { color: var(--leaf-6); }
#tutor .tut-text p { margin: 0 0 8px; }
#tutor .tut-text b { color: var(--gold-3); }
#tutor .tut-count { margin-top: 6px; color: var(--leaf-6); }
#tutor .tut-tips { margin: 8px 0 0; padding-left: 18px; font-size: 14px; color: var(--bone-0); }
#tutor .tut-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#tutor .tut-btns:empty { display: none; }
#tutor.min { width: auto; }
#tutor.min > :not(.tut-head):not(h3) { display: none; }
#tutor.min h3 { font-size: 16px; margin: 4px 0 0; }
#commands .cmd.tut-glow { outline: 3px solid var(--gold-3); outline-offset: -3px; animation: tutGlow 0.8s steps(2) infinite; }
@keyframes tutGlow { 50% { outline-color: var(--sand-2); } }
@media (max-width: 700px) { #tutor { top: auto; bottom: 206px; right: 8px; width: auto; left: 8px; } }

/* ---------- Online: room, lobby, in-game banner (src/lobby.js) ---------- */
.field { font: inherit; font-size: 15px; padding: 6px 10px; background: var(--ink-1); color: var(--bone-1); border: 1px solid var(--umber-3); border-radius: 4px; }
.field:disabled { opacity: 0.75; }
.field.small { font-size: 13px; padding: 4px 6px; }
.field.code { width: 110px; text-transform: uppercase; letter-spacing: 4px; text-align: center; font-size: 20px; }
#online-name { width: 260px; }
.join-row { display: flex; gap: 10px; align-items: center; }
.room-code { font-size: 26px; letter-spacing: 5px; color: var(--gold-3); }
.small-link { font-size: 12px; padding: 3px 8px; margin-left: 8px; }
.slots { display: flex; flex-direction: column; gap: 6px; }
.slot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: color-mix(in srgb, var(--ink-1) 70%, transparent); border: 1px solid var(--umber-2); border-radius: 4px; }
.slot.empty { opacity: 0.8; }
.slot .who { min-width: 160px; text-align: left; }
.slot .who.dim { color: var(--stone-7); }
.slot button.small { font-size: 12px; padding: 3px 8px; }
.swatch { width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--ink-0); display: inline-block; }
.swatch.none { background: transparent; border-style: dashed; border-color: var(--stone-5); }
.spectators, .note { font-size: 13px; color: var(--stone-7); margin-top: 6px; text-align: left; min-height: 1em; }
#online-status { text-align: center; color: var(--sand-1); }
.check { display: block; text-align: left; font-size: 14px; margin: 4px 0; }
.chat { height: 90px; overflow-y: auto; text-align: left; font-size: 13px; padding: 6px; background: var(--ink-1); border: 1px solid var(--umber-2); border-radius: 4px; margin-bottom: 6px; }
#lobby-say { width: 100%; box-sizing: border-box; }
#netbanner { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 25; padding: 8px 18px; background: color-mix(in srgb, var(--ink-0) 85%, transparent); color: var(--gold-3); border: 1px solid var(--gold-0); border-radius: 4px; font-size: 15px; pointer-events: none; }
#gfxnote { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 40; max-width: min(720px, 92vw); display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: color-mix(in srgb, var(--ink-0) 92%, transparent); color: var(--bone-1); border: 1px solid var(--ember-3, var(--gold-1)); border-radius: 4px; font-family: 'Game UI', Georgia, serif; font-size: 15px; line-height: 1.3; box-shadow: 0 4px 14px color-mix(in srgb, var(--ink-0) 60%, transparent); }
#gfxnote.in-game { bottom: auto; top: 96px; }
#gfxnote a { color: var(--gold-3); white-space: nowrap; }
#gfxnote .gfx-close { flex: none; background: none; border: none; color: var(--stone-7); font-size: 20px; line-height: 1; padding: 0 2px; cursor: pointer; }
#gfxnote.hidden { display: none; }
#netping { position: fixed; top: 46px; right: 8px; z-index: 20; font-size: 11px; color: var(--stone-7); pointer-events: none; }
/* The frame-rate readout (F9, src/frame-meter.js): under the top bar at the left, clear of the gifts box's button. */
#framemeter { position: fixed; top: 46px; left: 8px; z-index: 4; padding: 3px 8px 4px; pointer-events: none;
  font-size: 13px; line-height: 1.35; color: var(--bone-1); font-variant-numeric: lining-nums tabular-nums;
  background: color-mix(in srgb, var(--ink-0) 72%, transparent); border: 1px solid var(--wood-2); border-radius: 3px; }
#framemeter b { font-size: 16px; }
#chatline { position: fixed; bottom: 210px; left: 50%; transform: translateX(-50%); z-index: 26; }
#chatline input { width: 420px; max-width: 80vw; font: inherit; font-size: 15px; padding: 6px 10px; background: var(--ink-1); color: var(--bone-1); border: 1px solid var(--gold-0); border-radius: 4px; }
#pausemenu.online h2::after { content: ' (the battle goes on)'; font-size: 14px; color: var(--stone-7); }
#pausemenu.behind .card { visibility: hidden; }   /* Options or Controls are open over it */
#options { z-index: 31; }

/* Experimental effects (postfx-ui.js): a panel at the side, with the game showing beside it. */
body.fx-tuning #pausemenu, body.fx-tuning #options { display: none; }
#fx-panel {
  position: fixed; top: 46px; right: 12px; bottom: 12px; width: 340px; max-width: calc(100vw - 24px); z-index: 32;
  overflow-y: auto; padding: 12px 16px; font-size: 14px;
  background: color-mix(in srgb, var(--ink-2) 94%, transparent); border: 4px solid var(--ink-1);
  box-shadow: inset 0 0 0 3px var(--wood-2), inset 0 0 0 6px var(--ink-2), 0 10px 40px color-mix(in srgb, var(--ink-0) 70%, transparent);
}
#fx-panel .fx-head { display: flex; justify-content: space-between; align-items: center; }
#fx-panel h3 { margin: 0; font-family: var(--pixel-font); color: var(--gold); font-size: 20px; }
#fx-panel .fx-x { padding: 2px 8px; }
#fx-panel .fx-warn { color: var(--stone-7); font-size: 12px; margin: 6px 0 10px; }
#fx-panel .fx-sec { border-top: 1px solid var(--wood-2); padding: 8px 0; }
#fx-panel .fx-switch { display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--gold); font-family: var(--pixel-font); font-size: 16px; }
#fx-panel .fx-note { margin: 4px 0 0 26px; font-size: 12px; color: var(--stone-7); }
#fx-panel .fx-ctl { display: none; margin: 6px 0 0 26px; }
#fx-panel .fx-sec.on .fx-ctl { display: block; }
#fx-panel .fx-row { display: grid; grid-template-columns: 1fr 120px 36px; gap: 6px; align-items: center; margin: 4px 0; font-size: 13px; }
#fx-panel .fx-row select { grid-column: 2 / 4; font: inherit; background: var(--ink-1); color: var(--bone-1); border: 1px solid var(--wood-4); }
#fx-panel .fx-row input[type=checkbox] { justify-self: start; }
#fx-panel .fx-row output { color: var(--gold); text-align: right; font-size: 12px; }
#fx-panel input[type=range] { width: 100%; accent-color: var(--gold); }
#fx-panel .fx-try { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#fx-panel .fx-try .pbtn { font-size: 12px; padding: 4px 8px; }
#fx-panel .fx-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--wood-2); padding-top: 10px; }
.slot .ready { font-size: 12px; color: var(--stone-7); margin-left: 4px; }
.slot .ready.yes { color: var(--leaf-6); }
#btn-lobby-start:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.6); }
#btn-lobby-start.is-ready { border-color: var(--leaf-6); }

/* Legends (legends.js): the map's history, the chronicle, and the lives of the famous. Above the end screen. */
#legends { z-index: 40; }
#legends .lcard { max-width: 760px; width: calc(100vw - 32px); max-height: calc(100vh - 48px); display: flex; flex-direction: column; text-align: left; padding: 20px 26px; }
#legends .lhead-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
#legends .lhead-row h2.ptitle { font-size: 34px !important; margin: 0; }
#legends .ltabs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
#legends .ltabs button.on { background: var(--gold-1); color: var(--ink-0); }
#legends-body { overflow-y: auto; padding-right: 6px; min-height: 160px; }
#legends h3 { font-size: 22px; color: var(--gold); margin: 4px 0 2px; }
#legends h4 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sand-2); margin: 14px 0 6px; }
#legends .lhead, #legends .lsub { color: var(--sand-2); margin: 0 0 8px; }
#legends .lnone { color: var(--stone-7); font-style: italic; }
#legends ul { list-style: none; margin: 0; padding: 0; }
#legends .lbook li { padding: 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--wood-3) 40%, transparent); line-height: 1.4; }
#legends .lbook li b { display: inline-block; min-width: 64px; color: var(--gold-3); font-family: var(--pixel-font); font-weight: 400; margin-right: 8px; }
#legends .lbook .k-death b, #legends .lbook .k-grudge b { color: var(--ember-4); }
#legends .lbook .k-bond b, #legends .lbook .k-vengeance b, #legends .lbook .k-title b { color: var(--leaf-7); }
#legends .lbook .k-wed b { color: var(--gold-4); }
#legends .lfig li { padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--wood-3) 40%, transparent); }
#legends .lfig small { color: var(--stone-7); }
#legends a { color: var(--gold-3); cursor: pointer; text-decoration: underline; }
#legends .lbio { color: var(--bone-1); line-height: 1.45; margin: 8px 0; }
#legends .ldeeds { color: var(--gold-3); }
#legends .lties { color: var(--ember-4); }
#legends .traits { display: flex; gap: 4px; margin: 6px 0; }
#legends .trait { font-size: 12px; padding: 1px 5px; border: 1px solid; }
#legends .trait.good { color: var(--leaf-7); border-color: var(--leaf-4); }
#legends .trait.bad { color: var(--ember-4); border-color: var(--ember-2); }
#info .lifelink { float: right; margin-left: 6px; color: var(--gold-3); cursor: pointer; text-decoration: underline; font-size: 12px; font-style: normal; }
/* The end screen's few lines on the famous of the battle (Legends.endHtml). */
.end-legends { margin-top: 14px; text-align: left; }
.end-legends h4 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sand-2); margin: 0 0 6px; }
.end-legends ul { list-style: none; margin: 0; padding: 0; }
.end-legends li { padding: 3px 0; border-bottom: 1px solid color-mix(in srgb, var(--wood-3) 40%, transparent); }
.end-legends small { color: var(--stone-7); }
.end-card:has(.end-legends) { max-height: calc(100vh - 32px); overflow-y: auto; }

/* Choosing a sub-faction at the hall's first upgrade (src/subfactions.js: SubPicker). */
#subpick { z-index: 35; }
#subpick .subpick { max-width: 1180px; width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px 24px; }
#subpick .subpick .cost { color: var(--stone-9); font-size: 14px; margin: 4px 0 12px; }
#subpick .ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; margin-bottom: 14px; }
#subpick .way { text-align: left; border: 1px solid var(--wood-2); border-radius: 6px; padding: 12px; background: var(--ink-1);
  display: grid; grid-template-columns: 190px 1fr; grid-template-rows: 1fr auto; gap: 8px 14px; align-items: start; }
#subpick .way > .pbtn { grid-column: 1 / -1; }
/* The card: the New Battle screen's faction card (style of .factions button.art-card). */
#subpick .art-card { position: relative; padding: 0; overflow: hidden; border-radius: 0; aspect-ratio: 3 / 4; width: 190px;
  display: flex; flex-direction: column; justify-content: flex-end; border: 3px solid var(--ink-1); cursor: pointer; background: var(--ink-2); }
#subpick .art-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform 0.25s; }
#subpick .art-card:hover { border-color: var(--gold-3); box-shadow: 0 0 0 2px var(--gold-3), 0 0 22px color-mix(in srgb, var(--gold-3) 50%, transparent); }
#subpick .art-card:hover img { transform: scale(1.04); }
#subpick .art-card .label { position: relative; width: 100%; padding: 26px 6px 8px; display: flex; flex-direction: column; gap: 2px; text-align: left;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--ink-0) 0%, transparent), color-mix(in srgb, var(--ink-1) 92%, transparent) 45%); }
#subpick .art-card b { font-family: var(--pixel-font); font-size: 16px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#subpick .art-card small { color: var(--bone-0); font-size: 12px; font-style: italic; }
@media (max-width: 560px) { #subpick .way { grid-template-columns: 1fr; } #subpick .art-card { width: 100%; max-width: 220px; margin: 0 auto; } }
#subpick .way p { margin: 4px 0; font-size: 13px; line-height: 1.45; color: var(--stone-9); }
#subpick .way p b { color: var(--gold-2); font-weight: normal; }
#subpick .way p.lose b { color: var(--ember-3); }
#subpick .way .pbtn { margin-top: 6px; }
#subpick .key { font-size: 11px; color: var(--gold-3); margin-left: 6px; }
#subpick .subpick > .pbtn { margin: 0 auto; }

/* Watching the AIs (watch.js): no purse of our own in the top bar. */
#topbar.watching .res:not(#sky-box):not(#endgame-box):not(:has(#clock)), #topbar.watching #btn-idle { display: none; }
#topbar.watching .wave { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* The game's speed (Main.syncSpeed): as wide as its words; lit gold when not 1×, so a slowed or hurried battle shows. */
#topbar #btn-speed { width: auto; min-width: 40px; padding: 0 6px; font-weight: bold; }
#topbar #btn-speed.on { color: var(--gold-3); border-color: var(--gold-0); }
#watch .slot select { flex: 0 1 auto; }
#watch #watch-map { margin-bottom: 4px; }
.watch-panel { font-size: 13px; }
.watch-panel .watch-head { margin-bottom: 4px; }
.watch-panel table { border-collapse: collapse; width: 100%; }
.watch-panel th { text-align: left; font-weight: normal; font-size: 11px; padding: 0 6px 2px 0; }
.watch-panel td { padding: 0 6px 0 0; line-height: 19px; white-space: nowrap; }
.watch-panel tr.viewing td { background: color-mix(in srgb, var(--gold-3) 14%, transparent); }
.watch-panel tr.out { opacity: 0.5; }
.watch-panel .who { cursor: pointer; }
.watch-panel .dim { color: var(--stone-7); }
.watch-panel .atk { color: var(--ember-4); }
.watch-panel .def { color: var(--leaf-6); }
#panel .watch-panel button.eye { font-size: 11px; padding: 0 5px; min-width: 22px; height: 17px; line-height: 13px; border-width: 1px; box-shadow: none; }
#panel .watch-panel button.eye.sel { outline: 1px solid var(--gold-4); }

/* The AI inspector (src/ai-inspect.js): beside the battle, while watching the AIs. */
#ai-inspect { position: fixed; top: 44px; right: 8px; bottom: 200px; width: min(460px, calc(100vw - 16px)); z-index: 30; display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--ink-1) 94%, transparent); border: 2px solid var(--umber-3); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6); font-family: var(--body-font); font-size: 14px; color: var(--bone-1); }
#ai-inspect.hidden { display: none; }
#ai-inspect .insp-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--umber-2); }
#ai-inspect .insp-head .swatch { width: 12px; height: 12px; display: inline-block; }
#ai-inspect .insp-btns { margin-left: auto; display: flex; gap: 3px; }
#ai-inspect .insp-btns button { font-size: 12px; padding: 1px 7px; }
#ai-inspect .insp-btns button.sel { outline: 1px solid var(--gold-4); }
#ai-inspect .insp-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px 10px; }
#ai-inspect h4 { margin: 10px 0 3px; color: var(--gold-3); font-size: 13px; cursor: pointer; user-select: none; }
#ai-inspect h4 .fold { display: inline-block; width: 12px; color: var(--stone-7); }
#ai-inspect .insp-sec.shut h4 { color: var(--stone-7); }
#ai-inspect p { margin: 3px 0; line-height: 1.35; }
#ai-inspect .dim { color: var(--stone-7); }
#ai-inspect ol, #ai-inspect ul { margin: 2px 0; padding-left: 20px; }
#ai-inspect li { margin: 2px 0; line-height: 1.3; }
#ai-inspect .insp-prio li.on { color: var(--gold-4); }
#ai-inspect .insp-prio li.on::marker { color: var(--gold-4); }
#ai-inspect .insp-gate { list-style: none; padding-left: 4px; }
#ai-inspect .insp-gate .ok { color: var(--leaf-6); }
#ai-inspect .insp-gate .no { color: var(--ember-4); }
#ai-inspect .insp-gate .skip { color: var(--stone-7); }
#ai-inspect .insp-verdict { font-weight: bold; }
#ai-inspect .insp-log { list-style: none; padding-left: 0; font-size: 12px; }
#ai-inspect .insp-log .odd { color: var(--ember-4); }
.watch-panel tr[data-side] { cursor: pointer; }

/* ===== Adventure (src/adventure.js, band.js, town.js, dialogue.js) ===== */
#talk, #advlog, #pack {
  --pixel-font: 'Game UI', Georgia, serif; --logo-font: 'Game Display', 'Game UI', Georgia, serif; --body-font: 'Game UI', Georgia, serif;
  font-family: var(--body-font); color: var(--ink);
}
/* No wood, supply or workers in the Wilds. */
#topbar.adventure .res[title="Wood"], #topbar.adventure .res[title^="Supply"], #topbar.adventure #btn-idle { display: none; }
.adv-heroes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.adv-heroes button { display: flex; align-items: center; gap: 12px; padding: 8px; text-align: left; border: 3px solid var(--ink-1); background: var(--stone-0); color: var(--ink); cursor: pointer; }
.adv-heroes button.sel { border-color: var(--gold-3); background: var(--umber-3); box-shadow: 0 0 12px color-mix(in srgb, var(--gold-3) 25%, transparent); }
.adv-heroes img.portrait { width: 64px; height: 64px; image-rendering: pixelated; border: 2px solid var(--ink-1); flex: none; }
.adv-heroes b { display: block; font-family: var(--pixel-font); color: var(--gold); font-size: 15px; }
.adv-heroes small { font-size: 12px; color: var(--stone-9); }
@media (max-width: 560px) { .adv-heroes { grid-template-columns: 1fr; } }

/* Talking heads: over the bottom panel, in the middle. */
#talk {
  position: fixed; left: 50%; bottom: 214px; transform: translateX(-50%); z-index: 8; width: min(640px, calc(100vw - 32px));
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px 12px; cursor: pointer;
  background: color-mix(in srgb, var(--ink-2) 95%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 24px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#talk.hidden { display: none; }
#talk img.portrait, #talk .portrait.none { width: 76px; height: 76px; flex: none; image-rendering: pixelated; border: 3px solid var(--ink-1); box-shadow: 0 0 0 2px var(--wood-2); background: var(--ink-1); }
#talk .talk-body { flex: 1; min-width: 0; position: relative; }
#talk .talk-who b { font-family: var(--logo-font); font-size: 20px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#talk .talk-who small { margin-left: 8px; font-size: 13px; color: var(--sand-1); font-style: italic; }
#talk .talk-text { margin-top: 4px; font-size: 16px; line-height: 1.4; }
#talk .talk-more { position: absolute; right: 0; bottom: -6px; font-size: 12px; color: var(--dim); }

/* The journal: the drake and the tasks taken, at the top right. */
#advlog {
  position: fixed; top: 48px; right: 12px; z-index: 6; width: 310px; max-width: calc(100vw - 24px); padding: 8px 12px 10px;
  font-size: 14px; line-height: 1.4; background: color-mix(in srgb, var(--ink-2) 92%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 24px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#advlog.hidden { display: none; }
#advlog .adv-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--dim); letter-spacing: 1px; }
#advlog .adv-x { background: none; border: none; color: var(--dim); font-size: 16px; padding: 0 4px; cursor: pointer; }
#advlog h3 { margin: 2px 0 4px; font-family: var(--logo-font); font-weight: 700; font-size: 19px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#advlog ul { margin: 0; padding-left: 18px; }
#advlog li { margin: 2px 0; }
#advlog li.done { color: var(--leaf-6); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--leaf-6) 50%, transparent); }
#advlog li.ready b { color: var(--leaf-6); }
#advlog li.failed { color: var(--ember-3); }
#advlog .adv-hint { margin: 6px 0 0; font-size: 13px; color: var(--gold-3); }
#advlog.min h3, #advlog.min ul, #advlog.min .adv-hint { display: none; }

/* The pack, and the trader's goods when trading. */
#pack {
  position: fixed; left: 12px; top: 48px; z-index: 7; width: min(560px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 380px);
  overflow-y: auto; padding: 12px 16px; text-align: left;
}
#pack.hidden { display: none; }
#pack .pack-head { display: flex; align-items: center; gap: 12px; }
#pack .pack-head h3 { flex: 1; margin: 0; font-family: var(--logo-font); font-size: 22px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#pack .gold { font-family: var(--pixel-font); color: var(--gold-3); display: flex; align-items: center; gap: 4px; }
#pack .gold img.uicon { width: 20px; height: 20px; }
#pack .pack-cols { display: grid; grid-template-columns: 190px 1fr; gap: 14px; margin-top: 6px; }
#pack h4 { margin: 8px 0 6px; color: var(--gold-3); font-family: var(--pixel-font); font-size: 14px; letter-spacing: 2px; text-transform: uppercase; }
#pack h4 small { color: var(--dim); letter-spacing: 0; }
#pack .worn { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--sand-1); }
#pack .worn b { color: var(--ink); font-size: 13px; font-weight: 400; }
#pack .grid { display: grid; grid-template-columns: repeat(5, 46px); gap: 6px; }
#pack .item-cell {
  position: relative; width: 46px; height: 46px; padding: 0; display: grid; place-items: center; cursor: pointer; flex: none;
  background: var(--stone-0); border: 2px solid var(--ink-1); border-radius: 0;
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo);
}
#pack .item-cell:hover { filter: brightness(1.25); }
#pack .item-cell img.uicon { width: 34px; height: 34px; }
#pack .item-cell.empty { cursor: default; background: var(--ink-1); box-shadow: inset 2px 2px 0 var(--ink-0); }
#pack .item-cell.empty img.uicon { opacity: 0.25; filter: grayscale(1); }
#pack .item-cell.artefact { border-color: var(--gold-4); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo), 0 0 6px color-mix(in srgb, var(--gold-4) 60%, transparent); }
#pack .item-cell.quest { border-color: var(--sky-6); }
#pack .item-cell .price { position: absolute; right: 1px; bottom: 0; font-size: 11px; color: var(--gold-4); text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0); }
#pack .note { margin: 8px 0 0; font-size: 12px; color: var(--dim); }
@media (max-width: 560px) { #pack .pack-cols { grid-template-columns: 1fr; } }

/* ===== Hearthlands (src/hearth.js, hearth-ui.js) ===== */
#hearthbar, #hpack, #hsong {
  --pixel-font: 'Game UI', Georgia, serif; --logo-font: 'Game Display', 'Game UI', Georgia, serif; --body-font: 'Game UI', Georgia, serif;
  font-family: var(--body-font); color: var(--ink);
}
#topbar.hearth .res[title="Wood"], #topbar.hearth .res[title^="Supply"], #topbar.hearth #btn-idle { display: none; }
/* The day's bar, top right. */
#hearthbar {
  position: fixed; top: 48px; right: 12px; z-index: 6; width: 320px; max-width: calc(100vw - 24px); padding: 8px 12px 10px;
  font-size: 14px; line-height: 1.4; background: color-mix(in srgb, var(--ink-2) 92%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 24px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#hearthbar.hidden, #hpack.hidden, #hsong.hidden { display: none; }
#hearthbar .hb-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--dim); letter-spacing: 1px; }
#hearthbar .hb-coin { font-family: var(--pixel-font); color: var(--gold-3); display: flex; align-items: center; gap: 4px; font-size: 14px; }
#hearthbar .hb-coin img.uicon { width: 18px; height: 18px; }
#hearthbar .hb-day { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 4px; }
#hearthbar .hb-day b { flex: 1; font-family: var(--logo-font); font-size: 19px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); font-weight: 700; }
#hearthbar .hb-clock { font-family: var(--pixel-font); font-size: 16px; color: var(--bone-1); }
#hearthbar .hb-clock.eve { color: var(--gold-3); }
#hearthbar .hb-clock.late { color: var(--ember-3); }
#hearthbar .hb-wx { font-size: 12px; color: var(--sky-7); }
#hearthbar .hb-str { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sand-1); }
#hearthbar .hb-str .bar { flex: 1; height: 9px; background: var(--ink-1); border: 2px solid var(--ink-0); box-shadow: inset 0 0 0 1px var(--stone-2); }
#hearthbar .hb-str .bar div { height: 100%; background: linear-gradient(var(--leaf-6), var(--leaf-3)); }
#hearthbar .hb-str small { width: 26px; text-align: right; font-family: var(--pixel-font); color: var(--bone-1); }
#hearthbar .hb-news { margin: 6px 0 0; font-size: 13px; color: var(--sand-1); }
#hearthbar .hb-news b { color: var(--gold-3); }
#hearthbar .hb-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
/* The pack, and dealing with folk. */
#hpack {
  position: fixed; left: 12px; top: 48px; z-index: 7; width: min(420px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 300px);
  overflow-y: auto; padding: 12px 16px; text-align: left;
}
#hpack .pack-head { display: flex; align-items: center; gap: 12px; }
#hpack .pack-head h3 { flex: 1; margin: 0; font-family: var(--logo-font); font-size: 20px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#hpack .gold { font-family: var(--pixel-font); color: var(--gold-3); display: flex; align-items: center; gap: 4px; }
#hpack .gold img.uicon { width: 20px; height: 20px; }
#hpack h4 { margin: 10px 0 6px; color: var(--gold-3); font-family: var(--pixel-font); font-size: 14px; letter-spacing: 2px; text-transform: uppercase; }
#hpack h4 small { color: var(--dim); letter-spacing: 0; }
#hpack .grid { display: grid; grid-template-columns: repeat(6, 50px); gap: 6px; }
#hpack .item-cell {
  position: relative; width: 50px; height: 50px; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--stone-0); border: 2px solid var(--ink-1); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo);
}
#hpack .item-cell:hover { filter: brightness(1.25); }
#hpack .item-cell.no { opacity: 0.5; }
#hpack .item-cell img { width: 42px; height: 42px; image-rendering: pixelated; }
#hpack .item-cell.empty { cursor: default; background: var(--ink-1); box-shadow: inset 2px 2px 0 var(--ink-0); }
#hpack .item-cell .cnt { position: absolute; right: 2px; bottom: 0; font-family: var(--pixel-font); font-size: 12px; color: var(--bone-2); text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0); }
#hpack .item-cell .price { position: absolute; left: 2px; top: 0; font-family: var(--pixel-font); font-size: 11px; color: var(--gold-3); text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0); }
#hpack .note { margin: 10px 0 0; font-size: 13px; color: var(--sand-1); }
#hpack .note.bad { color: var(--ember-3); }
#hpack .pbtn.on { border-color: var(--gold-3); color: var(--gold); }
/* The song: a note crossing a bar, struck on the gold. */
#hsong {
  position: fixed; left: 50%; top: 34%; transform: translateX(-50%); z-index: 8; width: 360px; padding: 10px 16px 12px; text-align: center;
  background: color-mix(in srgb, var(--ink-2) 95%, transparent); border: 3px solid var(--ink-1); box-shadow: inset 0 0 0 2px var(--jade-1), 0 6px 24px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#hsong .hs-title { font-family: var(--logo-font); font-size: 18px; color: var(--jade-3); text-shadow: 0 2px 0 var(--ink-0); }
#hsong .hs-bar { position: relative; height: 18px; margin: 10px 0 8px; background: var(--ink-1); border: 2px solid var(--ink-0); box-shadow: inset 0 0 0 1px var(--moss-2); }
#hsong .hs-zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--gold-3) 55%, transparent); }
#hsong .hs-mark { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; background: var(--jade-4); box-shadow: 0 0 6px var(--jade-3); }
#hsong .hs-beats { display: flex; justify-content: center; gap: 14px; font-size: 20px; color: var(--dim); }
#hsong .hs-beats .hit { color: var(--gold-3); }
#hsong .hs-beats .miss { color: var(--ember-3); }
#hsong .hs-hint { margin-top: 4px; font-size: 12px; color: var(--sand-1); }
/* Hearthlands' tools and seeds on the command card: painted icons (art2/hearth-art.js) and how many seeds are left. */
#commands .cmd img.painted { image-rendering: pixelated; }
#commands .cmd .cnt { position: absolute; right: 3px; bottom: 1px; font-family: var(--pixel-font); font-size: 12px; color: var(--bone-2); text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0); pointer-events: none; }

/* Hearthlands: going through a gate, the screen goes dark and names where you are going (hearth-ui.js) */
#hfade { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: var(--ink-0); opacity: 0; transition: opacity 0.32s ease; display: flex; align-items: center; justify-content: center; }
#hfade.on { opacity: 1; }
#hfade.hidden { display: none; }
#hfade span { font-family: var(--logo-font); font-size: 34px; color: var(--gold-3); text-shadow: 0 3px 0 var(--ink-0); letter-spacing: 1px; }

/* ===== Hearthlands: goals and onboarding (src/hearth-goals-ui.js) ===== */
#hguide, #htrack, #hgoal, #hday {
  --pixel-font: 'Game UI', Georgia, serif; --logo-font: 'Game Display', 'Game UI', Georgia, serif; --body-font: 'Game UI', Georgia, serif;
  font-family: var(--body-font); color: var(--ink);
}
#hguide.hidden, #htrack.hidden, #hgoal.hidden, #hday.hidden { display: none; }
.hearth-guide { display: block; margin: 4px 0 0; font-size: 14px; color: var(--sand-1); cursor: pointer; }
.hearth-guide input { vertical-align: middle; margin-right: 6px; }
/* The guide's hint: top middle, the guide's face, the step, a skip. */
#hguide {
  position: fixed; top: 50px; left: 50%; transform: translateX(-50%); z-index: 7; width: 480px; max-width: calc(100vw - 680px); min-width: 300px;
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: 15px; line-height: 1.35;
  background: color-mix(in srgb, var(--ink-2) 94%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--gold-0), 0 6px 24px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#hguide img.portrait { width: 44px; height: 44px; flex: none; image-rendering: pixelated; border: 2px solid var(--ink-1); box-shadow: 0 0 0 1px var(--wood-2); }
#hguide .hg-body { flex: 1; min-width: 0; }
#hguide .hg-who b { font-family: var(--logo-font); color: var(--gold); font-size: 15px; text-shadow: 0 2px 0 var(--ink-0); }
#hguide .hg-who small { margin-left: 8px; font-size: 12px; color: var(--sand-1); font-style: italic; }
#hguide .hg-hint { color: var(--bone-1); }
@media (max-width: 1100px) { #hguide { top: auto; bottom: 250px; max-width: calc(100vw - 24px); } }
/* The card's button for the guide's tool glows. */
#commands .cmd.hglow { outline: 2px solid var(--gold-3); outline-offset: -2px; animation: hglow 0.9s ease-in-out infinite alternate; }
@keyframes hglow { from { box-shadow: 0 0 2px var(--gold-3); } to { box-shadow: 0 0 14px var(--gold-4); } }
/* The goals tracker: top left. */
#htrack {
  position: fixed; left: 12px; top: 48px; z-index: 6; width: 290px; max-width: calc(100vw - 24px); padding: 6px 10px 8px; font-size: 13px; line-height: 1.35;
  background: color-mix(in srgb, var(--ink-2) 88%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 24px color-mix(in srgb, var(--ink-0) 50%, transparent);
}
#htrack .ht-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--logo-font); font-size: 17px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); margin-bottom: 2px; }
#htrack .ht-item { padding: 4px 6px; margin: 2px -6px; cursor: pointer; border-left: 3px solid transparent; }
#htrack .ht-item:hover { background: color-mix(in srgb, var(--wood-2) 40%, transparent); }
#htrack .ht-item.on { border-left-color: var(--gold-3); background: color-mix(in srgb, var(--umber-3) 50%, transparent); }
#htrack .ht-item b { display: block; color: var(--gold-3); font-size: 13px; }
#htrack .ht-item span { display: block; color: var(--bone-1); }
#htrack .ht-item small { display: block; color: var(--sky-7); font-size: 12px; }
#htrack .ht-more { color: var(--dim); font-size: 12px; margin-top: 2px; }
/* The journal, the notice board, the smith, the inn, the mill: a panel at the left, as the pack. */
#hgoal {
  position: fixed; left: 12px; top: 48px; z-index: 7; width: min(500px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 290px);
  overflow-y: auto; padding: 12px 16px; text-align: left; font-size: 14px;
}
#hgoal .hg-head { display: flex; align-items: center; gap: 10px; }
#hgoal .hg-head img { width: 40px; height: 40px; image-rendering: pixelated; }
#hgoal .hg-head h3 { flex: 1; margin: 0; font-family: var(--logo-font); font-size: 20px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#hgoal .hg-head h3 small { font-family: var(--body-font); font-size: 13px; color: var(--sand-1); font-style: italic; text-shadow: none; }
#hgoal .gold { font-family: var(--pixel-font); color: var(--gold-3); display: flex; align-items: center; gap: 4px; }
#hgoal .gold img.uicon { width: 20px; height: 20px; }
#hgoal h4 { margin: 12px 0 6px; color: var(--gold-3); font-family: var(--pixel-font); font-size: 14px; letter-spacing: 2px; text-transform: uppercase; }
#hgoal .note { margin: 8px 0; font-size: 13px; color: var(--sand-1); }
#hgoal .hg-tabs { display: flex; gap: 6px; margin: 10px 0 4px; }
#hgoal .pbtn.on { border-color: var(--gold-3); color: var(--gold); }
#hgoal .hg-task { margin: 8px 0; padding: 6px 8px; background: color-mix(in srgb, var(--stone-0) 70%, transparent); border: 2px solid var(--ink-1); }
#hgoal .hg-task-head { display: flex; justify-content: space-between; align-items: center; }
#hgoal .hg-task-head b { color: var(--gold-3); }
#hgoal .hg-task ol { margin: 4px 0; padding-left: 20px; }
#hgoal .hg-task li { color: var(--dim); }
#hgoal .hg-task li.now { color: var(--bone-1); }
#hgoal .hg-task li.done { color: var(--leaf-6); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--leaf-6) 50%, transparent); }
#hgoal .hg-task small { display: block; font-size: 12px; }
#hgoal .hg-task small.where { color: var(--sky-7); }
#hgoal .hg-task small.note { color: var(--sand-1); margin: 2px 0 0; }
#hgoal .hg-done { margin: 0; padding-left: 18px; color: var(--leaf-6); }
#hgoal .hg-bar { height: 8px; margin: 4px 0; background: var(--ink-1); border: 2px solid var(--ink-0); box-shadow: inset 0 0 0 1px var(--stone-2); }
#hgoal .hg-bar div { height: 100%; background: linear-gradient(var(--gold-3), var(--gold-0)); }
#hgoal .hg-proj { margin: 10px 0; padding: 8px 10px; background: color-mix(in srgb, var(--stone-0) 75%, transparent); border: 2px solid var(--ink-1); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo); }
#hgoal .hg-proj.done { border-color: var(--leaf-3); }
#hgoal .hg-proj-head { display: flex; align-items: baseline; gap: 8px; }
#hgoal .hg-proj-head b { font-family: var(--logo-font); font-size: 17px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#hgoal .hg-proj-head small { flex: 1; color: var(--sand-1); font-style: italic; }
#hgoal .hg-proj-head .st { font-family: var(--pixel-font); color: var(--gold-3); }
#hgoal .hg-proj.done .st { color: var(--leaf-6); }
#hgoal .hg-proj p { margin: 4px 0; font-size: 13px; color: var(--stone-9); }
#hgoal .hg-proj .unlock { display: block; margin-top: 6px; font-size: 12px; color: var(--sky-7); }
#hgoal .hg-bundle { display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 4px 0; border-top: 1px solid color-mix(in srgb, var(--ink-1) 70%, transparent); flex-wrap: wrap; }
#hgoal .hg-bundle-name { width: 140px; font-size: 13px; color: var(--bone-1); }
#hgoal .hg-bundle.full .hg-bundle-name { color: var(--leaf-6); }
#hgoal .hg-cells { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
#hgoal .hg-good, #hday .hg-good { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px 1px 1px; background: var(--ink-1); border: 2px solid var(--ink-0); font-family: var(--pixel-font); font-size: 12px; color: var(--bone-2); }
#hgoal .hg-good img, #hday .hg-good img { width: 26px; height: 26px; image-rendering: pixelated; }
#hgoal .hg-good img.uicon, #hday .hg-good img.uicon { width: 18px; height: 18px; }
#hgoal .hg-good.can { border-color: var(--gold-0); }
#hgoal .hg-good.done { border-color: var(--leaf-3); color: var(--leaf-6); }
#hgoal .hg-any { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 1px; padding: 1px 4px; background: var(--ink-1); border: 2px solid var(--ink-0); font-family: var(--pixel-font); font-size: 12px; color: var(--bone-2); }
#hgoal .hg-any img { width: 22px; height: 22px; image-rendering: pixelated; opacity: 0.55; }
#hgoal .hg-any img.can { opacity: 1; }
#hgoal .hg-skills, #hgoal .hg-tools { display: flex; flex-direction: column; gap: 6px; }
#hgoal .hg-skill, #hgoal .hg-tool { display: flex; align-items: center; gap: 10px; }
#hgoal .hg-skill > img, #hgoal .hg-tool > img { width: 42px; height: 42px; image-rendering: pixelated; flex: none; background: var(--stone-0); border: 2px solid var(--ink-1); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo); }
#hgoal .hg-skill > div, #hgoal .hg-tool > div { flex: 1; min-width: 0; }
#hgoal .hg-skill b, #hgoal .hg-tool b { color: var(--gold-3); }
#hgoal .hg-skill b span { font-family: var(--pixel-font); color: var(--bone-1); margin-left: 4px; }
#hgoal .hg-skill.hook { opacity: 0.6; }
#hgoal .hg-skill small, #hgoal .hg-tool small { display: block; font-size: 12px; color: var(--sand-1); }
#hgoal .hg-tool img.mini { width: 20px; height: 20px; vertical-align: middle; image-rendering: pixelated; }
/* The end of the day: a card in the middle. */
#hday {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -54%); z-index: 30; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 80px);
  overflow-y: auto; padding: 16px 22px 14px; text-align: left; font-size: 14px;
}
#hday h2 { margin: 0; text-align: center; font-family: var(--logo-font); font-size: 30px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#hday .hd-sub { margin: 0 0 10px; text-align: center; color: var(--sand-1); font-style: italic; }
#hday .hd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
#hday .hd-sec h4 { margin: 8px 0 4px; color: var(--gold-3); font-family: var(--pixel-font); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
#hday .hd-sec p { margin: 2px 0; }
#hday .hd-sec ul { margin: 2px 0; padding-left: 18px; }
#hday .hg-cells { display: flex; flex-wrap: wrap; gap: 4px; }
#hday .up { color: var(--leaf-6); }
#hday .down { color: var(--ember-3); }
#hday .hd-coin b { font-family: var(--pixel-font); color: var(--gold-3); }
#hday .hd-coin img.uicon { width: 18px; height: 18px; vertical-align: middle; }
#hday .hd-skill { display: inline-flex; align-items: center; gap: 4px; margin: 0 8px 2px 0; }
#hday .hd-skill img { width: 26px; height: 26px; image-rendering: pixelated; }
#hday .hd-skill.up b { color: var(--gold-4); }
#hday .hd-review { margin: 4px 0 8px; padding: 8px 12px; background: color-mix(in srgb, var(--umber-3) 60%, transparent); border: 2px solid var(--gold-0); }
#hday .hd-review h3 { margin: 0 0 4px; font-family: var(--logo-font); color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#hday .hd-review ul { margin: 4px 0 0; padding-left: 18px; columns: 2; }
#hday .hd-review li.done { color: var(--leaf-6); }
#hday .hd-review li span { font-family: var(--pixel-font); color: var(--gold-3); }
#hday .hd-go { margin-top: 12px; text-align: center; }
@media (max-width: 560px) { #hday .hd-grid { grid-template-columns: 1fr; } }
/* ===== Hearthlands, stage 2d: work, ride and fight (src/hearth-work-ui.js) ===== */
#hwork {
  --pixel-font: 'Game UI', Georgia, serif; --logo-font: 'Game Display', 'Game UI', Georgia, serif; --body-font: 'Game UI', Georgia, serif;
  font-family: var(--body-font); color: var(--ink);
  position: fixed; left: 12px; top: 48px; z-index: 7; width: min(440px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 300px);
  overflow-y: auto; padding: 12px 16px; text-align: left;
}
#hwork.hidden { display: none; }
#hwork .pack-head { display: flex; align-items: center; gap: 12px; }
#hwork .pack-head h3 { flex: 1; margin: 0; font-family: var(--logo-font); font-size: 20px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#hwork .gold { font-family: var(--pixel-font); color: var(--gold-3); display: flex; align-items: center; gap: 4px; }
#hwork .gold img.uicon { width: 20px; height: 20px; }
#hwork h4 { margin: 10px 0 6px; color: var(--gold-3); font-family: var(--pixel-font); font-size: 14px; letter-spacing: 2px; text-transform: uppercase; }
#hwork h4 small { color: var(--dim); letter-spacing: 0; text-transform: none; }
#hwork .note { margin: 8px 0; font-size: 13px; color: var(--sand-1); }
#hwork .hw-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--wood-2) 60%, transparent); }
#hwork .hw-row > div { flex: 1; font-size: 14px; color: var(--bone-1); }
#hwork .hw-row b { color: var(--gold-3); }
#hwork .hw-row small { color: var(--dim); }
#hwork .hw-desc { display: block; font-size: 12px; color: var(--sand-1); }
#hwork .hw-cost, #hwork .hw-cost .hw-c { display: inline-flex; align-items: center; gap: 2px; }
#hwork .hw-cost { gap: 8px; margin: 2px 0; font-family: var(--pixel-font); font-size: 13px; color: var(--bone-2); }
#hwork .hw-c img { width: 22px; height: 22px; image-rendering: pixelated; }
#hwork .hw-c img.uicon { width: 16px; height: 16px; }
#hwork .pbtn[disabled] { opacity: 0.45; cursor: default; }
#hwork .grid { display: grid; grid-template-columns: repeat(6, 50px); gap: 6px; }
#hwork .item-cell {
  position: relative; width: 50px; height: 50px; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--stone-0); border: 2px solid var(--ink-1); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo);
}
#hwork .item-cell img { width: 42px; height: 42px; image-rendering: pixelated; }
#hwork .item-cell .cnt { position: absolute; right: 2px; bottom: 0; font-family: var(--pixel-font); font-size: 12px; color: var(--bone-2); text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0); }
#hearthbar .hw-bar { display: flex; gap: 4px; margin-top: 6px; }
#hearthbar .hw-b {
  position: relative; flex: 1; height: 36px; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--stone-0); border: 2px solid var(--ink-1); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo);
}
#hearthbar .hw-b:hover { filter: brightness(1.25); }
#hearthbar .hw-b.off { opacity: 0.5; }
#hearthbar .hw-b img { width: 30px; height: 30px; image-rendering: pixelated; }
#hearthbar .hw-b kbd { position: absolute; right: 1px; bottom: -1px; font-family: var(--pixel-font); font-size: 10px; color: var(--gold-3); text-shadow: 0 1px 0 var(--ink-0), 1px 0 0 var(--ink-0); background: none; border: 0; padding: 0; }
/* The campaign (src/campaign.js): the menu, the story's scenes, a mission's objectives. */
#campaign-menu .camp-diff { margin-top: 10px; }
#campaign-menu .camp-diff .chips { justify-content: center; }
#campaign-menu .camp-going { text-align: center; margin: 4px 0 18px; }
#campaign-menu .opt-row { justify-content: center; margin-top: 14px; }
.card.camp-scene { position: relative; max-width: 760px; width: calc(100% - 32px); max-height: 92vh; overflow-y: auto; padding: 26px 34px; text-align: left; image-rendering: auto; }
/* A told scene: the picture on top and the buttons at the bottom stay put; only the story between them scrolls. */
#campaign-scene .card.camp-scene { display: flex; flex-direction: column; overflow: hidden; }
#campaign-scene .camp-scene-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#campaign-scene .camp-pic { flex: none; }
#campaign-scene .camp-main { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding-right: 6px; }
#campaign-scene .opt-row { flex: none; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--umber-2); }
/* Wide screens: the picture on the left, the story beside it with the whole height to itself. */
@media (min-width: 1100px) {
  #campaign-scene .card.camp-scene { max-width: 1240px; }
  #campaign-scene .camp-scene-body { display: grid; grid-template-columns: 576px 1fr; grid-template-rows: auto 1fr auto; column-gap: 28px; }
  #campaign-scene .camp-main { display: contents; }
  #campaign-scene .camp-pic { grid-column: 1; grid-row: 1; margin: 0; }
  #campaign-scene .camp-side { grid-column: 1; grid-row: 2; min-height: 0; overflow-y: auto; padding-right: 6px; }
  #campaign-scene .camp-scroll { grid-column: 2; grid-row: 1 / 3; min-height: 0; overflow-y: auto; padding-right: 6px; }
  #campaign-scene .opt-row { grid-column: 1 / -1; grid-row: 3; }
  #campaign-scene .camp-cards { grid-template-columns: 1fr 1fr; }
}
.camp-scene .camp-act { text-align: center; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--stone-9); }
.camp-scene .ptitle { text-align: center; font-size: 46px !important; margin: 4px 0 16px; }
.camp-scene .camp-text p { margin: 0 0 12px; font-size: 16px; line-height: 1.6; color: var(--bone-0); }
.camp-scene .camp-brief { margin: 16px 0 4px; padding: 10px 14px; background: var(--ink-2); border-left: 3px solid var(--gold-3); font-size: 15px; line-height: 1.55; }
.camp-scene .camp-note { color: var(--stone-9); font-size: 14px; }
.camp-scene .opt-row { justify-content: flex-end; margin-top: 18px; }
#campaign-panel {
  position: fixed; top: 48px; right: 12px; z-index: 6; width: 320px; max-width: calc(100vw - 24px);
  padding: 10px 14px 12px; font-family: var(--pixel-font); font-size: 15px; line-height: 1.45; color: var(--ink);
  background: color-mix(in srgb, var(--ink-2) 94%, transparent); border: 3px solid var(--ink-1);
  box-shadow: inset 0 0 0 2px var(--wood-2), 0 6px 24px color-mix(in srgb, var(--ink-0) 60%, transparent);
}
#campaign-panel .tut-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--dim); letter-spacing: 1px; }
#campaign-panel .tut-x { background: none; border: none; color: var(--dim); padding: 0 4px; font-size: 16px; }
#campaign-panel h3 { margin: 4px 0 6px; font-family: var(--logo-font); font-weight: 700; font-size: 21px; color: var(--gold); text-shadow: 0 2px 0 var(--ink-0); }
#campaign-panel .camp-goals { margin: 0; padding-left: 18px; }
#campaign-panel .camp-goals li.done { color: var(--leaf-6); }
#campaign-panel .camp-goals b { color: var(--gold-3); }
#campaign-panel.min .camp-goals { display: none; }
@media (max-width: 700px) {
  #campaign-panel { top: auto; bottom: 206px; right: 8px; left: 8px; width: auto; }
  .card.camp-scene { padding: 18px 16px; }
}
#campaign-panel .camp-ally { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line, rgba(255,255,255,.12)); font-size: 13px; color: var(--sky-8, #9cc3e6); }
#campaign-panel .camp-ally i { color: var(--dim); }
#campaign-panel.min .camp-ally { display: none; }
#campaign-menu .camp-house[disabled] { opacity: .45; cursor: default; }

/* ---------- The campaign's story, told (src/campaign-story.js) ---------- */
/* The whole painting at 3 screen pixels per art pixel (192 x 108 art pixels), chunky like the faction cards and title. */
.camp-scene .camp-pic { position: relative; margin: 0 auto 14px; width: 576px; max-width: 100%; aspect-ratio: 16 / 9; background: var(--ink-1) center / cover no-repeat; image-rendering: pixelated; border: 2px solid var(--gold-3); }
.camp-scene .camp-pic.plain { background-size: cover; filter: saturate(.75) brightness(.7); }
.camp-scene .camp-pic-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 20px 10px; background: linear-gradient(transparent, rgba(8, 7, 6, .88)); }
.camp-scene .camp-pic-title .ptitle { margin: 0 !important; }
.camp-beats { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; cursor: pointer; }
.camp-beat { display: none; gap: 12px; align-items: flex-start; opacity: .78; }
.camp-beat.shown { display: flex; animation: camp-beat-in .5s ease-out; }
@keyframes camp-beat-in { from { opacity: 0; transform: translateY(6px); } }
.camp-beat.now { opacity: 1; }
.camp-beat img { width: 56px; height: 56px; flex: none; border: 2px solid var(--gold-3); background: var(--ink-2); image-rendering: pixelated; }
.camp-beat-text { font-size: 18px; line-height: 1.5; color: var(--bone-0); }
.camp-beat.narrator .camp-beat-text { font-style: italic; font-size: 19px; color: var(--bone-0); padding-left: 2px; }
.camp-beat.now .camp-beat-text { color: #fff; }
.camp-say-who { font-weight: 700; color: var(--gold-3); font-size: 14px; letter-spacing: .5px; }
.camp-say-who small { font-weight: 400; color: var(--stone-9); margin-left: 4px; }
.camp-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.camp-card { display: flex; gap: 10px; padding: 10px 12px; background: var(--ink-2); border-left: 3px solid var(--gold-3); font-size: 14px; line-height: 1.45; }
.camp-card.wide { grid-column: 1 / -1; }
.camp-card b { color: var(--gold-3); }
.camp-card p { margin: 3px 0 0; color: var(--bone-0); }
.camp-card-ic { font-size: 20px; color: var(--gold-3); line-height: 1; }
.camp-toll { margin: 10px 0; padding: 10px 14px; background: var(--ink-2); border-left: 3px solid var(--leaf-6); }
.camp-toll.lost { border-left-color: var(--ember-3, #c4502a); }
.camp-toll-head { font-family: var(--logo-font); font-size: 22px; color: var(--gold-3); }
.camp-toll.lost .camp-toll-head { color: var(--ember-3, #d0603a); }
.camp-toll-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; font-size: 14px; color: var(--stone-9); }
.camp-toll-row b { color: var(--bone-0); font-size: 17px; }
.camp-account { margin: 10px 0; }
.camp-account summary { cursor: pointer; color: var(--stone-9); font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
.camp-account .camp-text { margin-top: 10px; }
.camp-scene .opt-row .grow { flex: 1; }
#campaign-panel .camp-goals li.at { cursor: pointer; }
#campaign-panel .camp-goals li.at:hover { color: var(--gold-3); }
#campaign-panel .camp-gn { display: inline-block; min-width: 16px; padding: 0 3px; margin-right: 2px; text-align: center; background: var(--gold-3); color: var(--ink-0); font-size: 11px; font-weight: 700; border-radius: 2px; }
#campaign-panel .camp-goals { list-style: none; padding-left: 0; }
/* The talking head: who speaks in battle, their face and their words. */
#camp-say { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 30; display: flex; gap: 12px; align-items: center; max-width: min(620px, calc(100% - 32px));
  padding: 10px 16px 10px 10px; background: rgba(12, 10, 8, .9); border: 2px solid var(--gold-3); box-shadow: 0 6px 24px rgba(0, 0, 0, .5); cursor: pointer; animation: campSay .35s ease-out; }
#camp-say img { width: 72px; height: 72px; flex: none; border: 1px solid var(--stone-7, #555); image-rendering: pixelated; }
#camp-say.narrator { border-color: var(--stone-7, #555); }
#camp-say.narrator img { width: 44px; height: 44px; opacity: .8; }
#camp-say .camp-say-text { font-size: 16px; line-height: 1.45; color: var(--bone-0); }
#camp-say.narrator .camp-say-text { font-style: italic; }
@keyframes campSay { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* A new rule, explained once. */
#camp-rule { position: fixed; left: 16px; bottom: 220px; z-index: 29; max-width: 360px; padding: 10px 30px 10px 12px; background: rgba(12, 10, 8, .92); border-left: 3px solid var(--sky-7, #7fb0d8); font-size: 14px; line-height: 1.45; color: var(--bone-0); }
#camp-rule b { color: var(--sky-8, #9cc3e6); text-transform: uppercase; letter-spacing: 1px; font-size: 12px; margin-right: 6px; }
#camp-rule .tut-x { position: absolute; right: 6px; top: 4px; background: none; border: none; color: var(--dim); }
/* The war journal. */
#camp-journal { z-index: 60; }
.camp-jt { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 14px; }
.camp-jt td, .camp-jt th { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, .08); text-align: left; }
.camp-jt tr.won td:nth-child(3) { color: var(--leaf-6); }
.camp-jt tr.lost td:nth-child(3) { color: var(--ember-3, #d0603a); }
.camp-jt tr.now td { color: var(--gold-3); }
.camp-jt tr.later { opacity: .45; }
.camp-journal-body h3 { color: var(--gold-3); margin: 12px 0 4px; }
.camp-journal-body p { margin: 4px 0; font-size: 14px; }
@media (max-width: 700px) {
  .camp-cards { grid-template-columns: 1fr; }
  #camp-say { top: 56px; }
  #camp-say img { width: 52px; height: 52px; }
  #camp-rule { left: 8px; right: 8px; max-width: none; bottom: 280px; }
}
/* A big screen: the menu a little larger. */
@media (min-width: 1600px) and (min-height: 950px) {
  .title-menu { width: 1040px; }
  .bb-banner { height: 170px; }
}
/* The Hearthlands screen's second step: you (hearth-wardrobe.js's maker), with room to breathe. */
#hearth-you-head { margin: 0 0 12px; }
#hearth-you .hwr { justify-content: center; gap: 28px; }
#hearth-you .hwr-fig { padding: 10px; gap: 10px; }
#hearth-you #hwr-menu .hwr-cv { width: 168px !important; height: 224px !important; }
#hearth-you .hwr-side { gap: 12px; text-align: left; }
#hearth-you #hwr-menu .hwr-rows { row-gap: 10px; column-gap: 28px; }
#hearth-you .hwr-fl { gap: 8px; }
#hearth-you .hwr-note { max-width: none; }
@media (max-width: 700px) {
  #hearth-you .hwr { flex-direction: column; align-items: center; gap: 14px; }
  #hearth-you #hwr-menu .hwr-cv { width: 132px !important; height: 176px !important; }
  #hearth-you #hwr-menu .hwr-rows { grid-template-columns: auto; grid-template-rows: none; grid-auto-flow: row; }
}
/* Its first step: the four hearths a little shorter than the battle's people, so the step fits a 720-px screen. */
#hearth-people button.art-card { aspect-ratio: 4 / 4.2; }
#hearth-menu .hearth-intro { margin-top: 0; }
#hearth-menu .mode-saved { margin: 0 0 12px; }

/* ---------- Touch screens (src/touch.js) ---------- */
/* The map and the minimap take every finger themselves: no page scroll, pinch-zoom or long-press menu there. */
#game, #minimap { touch-action: none; -webkit-touch-callout: none; }
#topbar, #panel, #touchbar { touch-action: manipulation; -webkit-touch-callout: none; }
/* The bar on a touch page: drop, queue, army; at the right, just above the panel. */
#touchbar { position: fixed; right: 8px; bottom: 212px; z-index: 6; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#touchbar .row, #touchbar .groups { display: flex; gap: 6px; }
#touchbar .groups.hidden { display: none; }
#touchbar [data-g] { min-width: 44px; position: relative; }
#touchbar [data-g] small { position: absolute; right: 3px; bottom: 1px; font-size: 10px; color: var(--sand-2); }
#touchbar [data-g].empty { opacity: 0.55; }
#touchbar.hidden { display: none; }
#touchbar button {
  min-width: 48px; height: 44px; padding: 0 12px; font-family: var(--pixel-font); font-size: 15px;
  background: var(--stone-2); color: var(--bone-1); border: 2px solid var(--ink-0);
  box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo), 0 2px 0 var(--ink-0);
}
#touchbar button:active { transform: translateY(2px); }
#touchbar button.on { background: var(--wood-3); color: var(--sand-2); box-shadow: inset 2px 2px 0 var(--gold-0), inset -2px -2px 0 var(--umber-2), 0 2px 0 var(--ink-0); }

/* ---------- A phone on its side (body.phone, touch.js layout()) ----------
   The map fills the screen; the HUD floats over its corners: the minimap bottom left, the unit's card beside it,
   the command buttons bottom right (under the thumb), the touch bar above them. The top bar keeps what you read
   (gold, wood, supply, idle, the clock); its settings live in the pause menu (Options). */
body.phone #topbar { height: 34px; gap: 8px; padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); font-size: 14px; }
body.phone #topbar .res { min-width: 0; gap: 4px; }
body.phone #topbar .ico { width: 18px !important; height: 18px !important; }
body.phone #btn-art, body.phone #btn-silhouettes, body.phone #btn-music, body.phone #btn-sfx,
body.phone #btn-legends, body.phone #btn-help { display: none !important; }
body.phone #topbar button:not(#btn-idle) { width: 30px; height: 28px; }
body.phone #topbar #btn-speed { width: auto; min-width: 38px; }
body.phone #panel { height: 0; padding: 0; border: 0; background: none; pointer-events: none; }
body.phone #panel > * { pointer-events: auto; }
body.phone #minimap { position: fixed; left: max(6px, env(safe-area-inset-left)); bottom: 6px; width: 116px; height: 116px; }
/* (zoom scales an element's own offsets too: they are divided by it, so they land in screen pixels) */
body.phone #commands { position: fixed; right: calc(max(6px, env(safe-area-inset-right)) / 0.84); bottom: calc(6px / 0.84); zoom: 0.84; width: auto; grid-template-columns: repeat(4, 52px); }
body.phone #info {
  position: fixed; left: calc((max(6px, env(safe-area-inset-left)) + 128px) / 0.72); bottom: calc(6px / 0.72); zoom: 0.72;
  width: calc((100vw - 128px - 268px) / 0.72); box-sizing: border-box; max-height: calc(116px / 0.72); overflow: hidden;
}
/* The card, cut to what you glance at: who, life, what they're doing; the long words wait for a bigger screen. */
body.phone #info .desc, body.phone #info .wholine { display: none; }
body.phone #herobar { position: fixed; left: calc(max(6px, env(safe-area-inset-left)) / 0.84); top: calc(40px / 0.84); bottom: auto; zoom: 0.84; }
body.phone #touchbar { right: max(6px, env(safe-area-inset-right)); bottom: 166px; }
body.phone #touchbar button { min-width: 44px; height: 38px; padding: 0 8px; font-size: 13px; }
body.phone #messages { top: 40px; bottom: auto; }

/* Upright, in a game: turn it on its side. */
#upright { display: none; }
body.upright #upright {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 50;
  background: color-mix(in srgb, var(--ink-0) 88%, transparent);
}
#upright .card { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 20px 24px; text-align: center;
  font-family: var(--pixel-font); color: var(--bone-1); background: var(--ink-2); border: 2px solid var(--wood-2); }
#upright .card b { font-size: 20px; color: var(--gold-3); }

/* ---------- One hero on a touch screen (touch.js hero()): the stick, Use and Talk, the panels' tabs ---------- */
#stick { position: fixed; left: 24px; bottom: 216px; width: 120px; height: 120px; z-index: 6; touch-action: none;
  border-radius: 50%; background: color-mix(in srgb, var(--ink-0) 45%, transparent); border: 2px solid color-mix(in srgb, var(--wood-2) 80%, transparent); }
#stick .knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: var(--stone-2); border: 2px solid var(--ink-0); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo); pointer-events: none; }
#heroacts { position: fixed; right: 24px; bottom: 216px; z-index: 6; display: flex; gap: 12px; align-items: flex-end; touch-action: manipulation; }
#heroacts button { width: 76px; height: 76px; border-radius: 50%; font-family: var(--pixel-font); font-size: 16px; color: var(--bone-1);
  background: var(--stone-2); border: 2px solid var(--ink-0); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo), 0 2px 0 var(--ink-0); }
#heroacts button[data-a=use] { width: 88px; height: 88px; background: var(--wood-3); color: var(--sand-2); }
#heroacts button:active { transform: translateY(2px); }
#stick.hidden, #heroacts.hidden, #dock.hidden { display: none; }
#dock { position: fixed; top: 40px; right: max(8px, env(safe-area-inset-right)); z-index: 7; display: flex; gap: 6px; }
#dock button { height: 32px; padding: 0 12px; font-family: var(--pixel-font); font-size: 13px; color: var(--bone-1);
  background: var(--stone-2); border: 2px solid var(--ink-0); box-shadow: inset 2px 2px 0 var(--stone-hi), inset -2px -2px 0 var(--stone-lo); }
#dock button.on { background: var(--wood-3); color: var(--sand-2); }
/* On a phone the stick and the buttons sit low (the panel floats), and the panels wait behind their tabs. */
body.phone:not(.show-htrack) #htrack, body.phone:not(.show-hearthbar) #hearthbar, body.phone:not(.show-advlog) #advlog { display: none !important; }
body.phone #htrack, body.phone #hearthbar, body.phone #advlog { top: 78px !important; zoom: 0.8; }
/* One hero on a phone: the stick takes the card's place (the hero's card is a tap on the hero bar away). */
body.phone.onehero #info { display: none; }

/* Hearthlands' plate on a touch page (hearth-prompt.js): Use and Talk as the round buttons are, and a row is tapped. */
/* A hover tip shown by touch (touch.js showTip: Hearthlands' goods, skills, garments, faces), and no callout menu over them */
#ttip { position: fixed; z-index: 998; max-width: min(320px, calc(100vw - 12px)); padding: 5px 10px; pointer-events: none; white-space: pre-line;
  font-family: 'Game UI', Georgia, serif; font-size: 15px; line-height: 1.3; color: var(--bone-1); text-shadow: 0 1px 0 var(--ink-0);
  background: color-mix(in srgb, var(--ink-1) 96%, transparent); border: 2px solid var(--ink-0); box-shadow: inset 0 0 0 1px var(--wood-2); }
#ttip.hidden { display: none; }
body.touch.hearth-on [title], body.touch #hearth-menu [title] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
body.touch #hprompt { pointer-events: auto; }
body.touch #hprompt .hp-tap { cursor: pointer; padding: 3px 0; }
#hprompt .hp-btn { display: inline-grid; place-items: center; min-width: 3.2em; height: 1.5em; margin-right: 6px; border-radius: 0.75em;
  font-family: var(--pixel-font); font-size: 13px; background: var(--stone-2); color: var(--bone-1); border: 1px solid var(--ink-0); }
#hprompt .hp-btn.lmb { background: var(--wood-3); color: var(--sand-2); }

/* ---------- Short screens: a phone on its side (about 340-430px tall) ----------
   The cards over the game (pause, options, controls, saves, the end of a battle) were made for a desktop's
   height and ran off the top and the bottom. Here they keep inside the screen and scroll; the pause menu's and
   the options' buttons go two to a row, and the titles shrink. */
@media (max-height: 500px) {
  .overlay > .card { max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; padding: 12px 18px; box-sizing: border-box; }
  .overlay { padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left)); box-sizing: border-box; }
  h2.ptitle { font-size: 30px !important; margin-bottom: 8px; }
  #help .card h2 { font-size: 30px; margin-bottom: 6px; }
  .end-card .ptitle { font-size: 44px !important; }
  #pausemenu .card, #options .card { width: min(620px, calc(100vw - 24px)); max-width: none; }
  #pausemenu .opt-list, #options .opt-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; min-width: 0; width: 100%; margin-bottom: 8px; }
  #options .opt-list .pbtn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #pausemenu .opt-list .pbtn, #options .opt-list .pbtn { padding: 8px 10px; font-size: 15px; }
  #pausemenu #btn-resume { grid-column: 1 / -1; font-size: 18px; padding: 10px; }
  #options .card > :not(h2):not(.opt-list) { font-size: 14px; }
  /* The title: a smaller name, and the menu scrolls (the modes' entries sat under the bottom edge). */
  .title-content { overflow-y: auto; padding-top: 3vh; overscroll-behavior: contain; }
  .logo { font-size: clamp(32px, 15vh, 64px); }
  .title-menu { margin-top: 3vh; }
  .title-foot { display: none; }   /* (it sat over the menu's buttons) */
}

/* ---------- One hero on a phone on its side (body.phone.onehero): thumbs at the corners ----------
   The user, on a phone (2026-10-31): the dialogues covered the top bar, the buttons were too big and on each
   other. Left thumb: the stick, bottom left. Right thumb: Use (big) and Talk, bottom right. The card of tools and
   seeds: two rows of six, small, bottom middle. The minimap waits behind the Map tab with Goals and Day. A
   dialogue sits under the top bar, smaller, and the guide's hint gives way while someone talks. */
body.phone.onehero #stick { left: calc(max(10px, env(safe-area-inset-left)) + 4px); bottom: 10px; width: 104px; height: 104px; }
body.phone.onehero #stick .knob { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
body.phone.onehero #heroacts { right: calc(max(10px, env(safe-area-inset-right)) + 2px); bottom: 10px; gap: 8px; }
body.phone.onehero #heroacts button { width: 52px; height: 52px; font-size: 13px; margin-bottom: 30px; }
body.phone.onehero #heroacts button[data-a=use] { width: 70px; height: 70px; font-size: 15px; margin-bottom: 0; }
body.phone.onehero #commands { zoom: 0.62; right: auto; bottom: calc(6px / 0.62); grid-template-columns: repeat(6, 52px);
  left: calc((50vw - (6 * 52px + 5 * 6px + 18px) * 0.62 / 2) / 0.62); }
body.phone.onehero:not(.show-minimap) #minimap { display: none; }
body.phone.onehero #minimap { left: auto; right: calc(max(8px, env(safe-area-inset-right))); top: 78px; bottom: auto; }
body.phone.onehero #messages { top: auto; bottom: 128px; }
body.phone.onehero #touchbar { bottom: 132px; }
body.phone #talk { top: 38px; bottom: auto; width: min(600px, calc(100vw - 16px)); padding: 6px 10px 8px; gap: 10px; }
body.phone #talk img.portrait, body.phone #talk .portrait.none { width: 48px; height: 48px; }
body.phone #talk .talk-who b { font-size: 16px; }
body.phone #talk .talk-who small { font-size: 12px; }
body.phone #talk .talk-text { font-size: 14px; line-height: 1.3; margin-top: 2px; }
body.phone #hguide { top: 38px !important; bottom: auto !important; left: max(8px, env(safe-area-inset-left)) !important; right: auto !important;
  transform: none !important; width: min(520px, calc(100vw - 150px)) !important; max-width: none !important; zoom: 0.82; }
body.phone:has(#talk:not(.hidden)) #hguide { display: none !important; }
/* (The card's buttons sit where their keys are, QWERT over ASDFG over ZXCVB, inline; one hero on a phone they
   flow instead, two rows of six.) */
body.phone.onehero #commands { grid-template-columns: repeat(6, 52px) !important; grid-auto-rows: 52px; }
body.phone.onehero #commands .cmd { grid-row: auto !important; grid-column: auto !important; }

/* Opened from a phone's home screen (touch.js): full screen already. */
body.home-app #btn-fullscreen { display: none !important; }
