/* BackgammonX v0.3.05 — 22-x-presentation.css (introduced in v0.3.04; v0.3.05 removes the one rule that styled the computer opponent's
   status line and adds the two-people note under the masthead and the row of website links in the footer, both at the end of
   the sections they belong to)
   Owns: the X-family PRESENTATION of the page chrome, aligned with the approved TrigammonX look — the header (control bar,
   quick controls, tabs, centred masthead), the page-sections menu, the footer (entry tiles and release note), and, in
   the later blocks, buttons, panels, dialogs and toasts.

   WHERE THE VALUES COME FROM. Every number below is a value measured (getComputedStyle) on the approved TrigammonX page
   at 1440 x 900 and recorded in STYLING-RECORD.md next to this package, re-expressed in BackgammonX's own class names
   and tokens. No TX source, script, image, font file or name is used; the emblem is BackgammonX's own. Where the measured
   TX styling has a defect (a link left browser-blue on a dark page, a hover that turns text near-black on a dark pill,
   a missing focus ring) this file does not copy the defect; those places are listed in STYLING-RECORD.md.

   PRESENTATION ONLY and override-only: it sits after css/01–20, edits none of them, and sets no size, position,
   transform or z-index on the board, checkers, rails, hit targets or dice (the inherited tests read css/09 and css/12
   and the appearance-layer test C17 reads this layer's selectors). Colours come from the X-family tokens (--x-*) in
   css/16 wherever one exists, so both appearances and every colourway follow. */

:root {
  --bgx-css-22: 1;

  /* "warm chrome" values measured on the approved page (hard-coded hex there), named once here */
  --x-tab: #d9c9aa;
  --x-tab-current: #f3d18c;
  --x-tab-hover: #fff0cd;
  --x-util-bg: #201d18;
  --x-util-bg-on: #30291d;
  --x-util-line: #84704c;
  --x-util-line-on: #ba9857;
  --x-util-text: #efdbb2;
  --x-heading-gold: #efd292;
  --x-title-gold: #e4c17a;
  --x-key-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 0 rgba(0, 0, 0, 0.7), 0 4px 6px rgba(0, 0, 0, 0.35);
  --x-key-shadow-hover: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 0 rgba(0, 0, 0, 0.7), 0 4px 10px rgba(111, 168, 216, 0.25), 0 4px 6px rgba(0, 0, 0, 0.35);
  --x-key-shadow-active: inset 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 0 rgba(0, 0, 0, 0.7);
  --x-font-system: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --x-font-mono: "Courier New", monospace;

  /* the collapsible bar as measured (#352416 face, #65492d line, #e0bd86 title): the default brown of the section bars, the tab
     bar rules and the brown keys. A colourway (css/16) and the Light header band still set their own. */
  --x-brown-bg: #352416;
  --x-brown-border: #65492d;
  --x-brown-text: #e0bd86;
}
html[data-appearance="light"] {
  --x-tab: #f0e2c0;
  --x-tab-current: #ffe29a;
  --x-tab-hover: #ffffff;
  --x-util-text: #f7e8c4;
}

/* ═══ page background ═══════════════════════════════════════════════
   The measured page paints two soft radial lights over the deep navy; the same two lights, dark appearance only. */
html[data-appearance="dark"] body {
  background-color: var(--x-bg-deep);
  background-image:
    radial-gradient(ellipse 1200px 700px at 50% -4%, rgba(111, 168, 216, 0.07), transparent 60%),
    radial-gradient(ellipse 1600px 1100px at 50% 38%, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.35) 100%);
  background-attachment: fixed;
}

/* ═══ header: a compact control bar over a masthead ═══════════════════
   Band 1 (.x-header-bar): the menu key, the quick controls (.x-header-utilities) and the page tabs (#bgx-tabbar, placed here by
   js/31). Band 2 (.x-header-primary): the masthead — the name on the left, two lines of copy on the right (v0.3.06; until v0.3.05
   the brand was centred, a v0.2.22 review requirement that the new arrangement intentionally replaces). The header scrolls away
   with the page, as on the approved page. */
body.bgx-v22-layout .x-header {
  position: static;
  height: auto;
  min-height: 0;
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 18px 4px;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
body.bgx-v22-layout .x-header-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin-bottom: 8px;
}
/* the menu key and every key of the bar: the measured "chunky key" — a bottom-edge shelf, a glow on hover, a 2px press */
body.bgx-v22-layout .x-header-bar .x-icon-button[data-action="menu-open"] {
  position: static;
  flex: none;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--x-blue);
  border-radius: var(--x-radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 50%), var(--x-panel-2);
  color: var(--x-blue);
  box-shadow: var(--x-key-shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s, color 0.15s;
}
body.bgx-v22-layout .x-header-bar .x-icon-button[data-action="menu-open"] .x-hamburger i { background: var(--x-blue); }
body.bgx-v22-layout .x-header-bar .x-icon-button[data-action="menu-open"]:hover { background: var(--x-blue); box-shadow: var(--x-key-shadow-hover); }
body.bgx-v22-layout .x-header-bar .x-icon-button[data-action="menu-open"]:hover .x-hamburger i { background: #0a121a; }
body.bgx-v22-layout .x-header-bar .x-icon-button[data-action="menu-open"]:active { transform: translateY(2px); box-shadow: var(--x-key-shadow-active); }
body.bgx-v22-layout .x-header-bar .x-icon-button[data-action="menu-open"]:focus-visible { outline: 3px solid #80d8ff; outline-offset: 3px; }

/* quick controls (the "utility" keys) */
.x-header-utilities { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.x-header-utilities:empty { display: none; }
.x-utility {
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid var(--x-util-line);
  border-radius: 8px;
  background: var(--x-util-bg);
  color: var(--x-util-text);
  font: 600 12px/1.3 var(--x-font-system);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--x-key-shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s, color 0.15s;
}
.x-utility:hover { background: #342b1c; box-shadow: var(--x-key-shadow-hover); }
.x-utility:active { transform: translateY(2px); box-shadow: var(--x-key-shadow-active); }
.x-utility[aria-pressed="true"] { border-color: var(--x-util-line-on); background: var(--x-util-bg-on); }
.x-utility:focus-visible { outline: 3px solid #80d8ff; outline-offset: 2px; }

/* the page tabs: borderless text links in the bar, a gold underline on the current one */
body.bgx-v22-layout .x-header-bar .bgx-tabbar {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
body.bgx-v22-layout .x-header-bar .bgx-tabbar-track {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 12px;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: visible;
}
body.bgx-v22-layout .bgx-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--x-tab);
  font: 600 13px/1.3 var(--x-font-system);
  white-space: nowrap;
  text-decoration: none;
  text-underline-offset: 6px;
  text-decoration-thickness: 2px;
}
body.bgx-v22-layout .bgx-tab:hover { background: transparent; border: 0; color: var(--x-tab-hover); text-decoration-line: underline; }
body.bgx-v22-layout .bgx-tab[aria-current="true"] { background: transparent; border: 0; color: var(--x-tab-current); text-decoration-line: underline; }
body.bgx-v22-layout .bgx-tab:focus-visible { outline: 3px solid #80d8ff; outline-offset: 3px; border-radius: 3px; }

/* The version chip and the channel line are not part of the header any more (v0.3.06): they are the build identity, and js/38
   places them in the footer's release note and build line (see the footer rules below). */

/* the masthead (the X-family arrangement, v0.3.06): the name on the left and two lines of copy on the right, as measured on the
   approved page — a grid of 380px + 1fr with a 28px gap, up to 1100px wide, centred on the page. At 650px and below the two
   stack and centre. The emblem is part of the wordmark. */
body.bgx-v22-layout .x-header-primary {
  display: flex;
  justify-content: center;
  min-height: 0;
  padding: 0 6px;
  text-align: left;
}
body.bgx-v22-layout .x-header-primary .x-brand {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  align-items: center;
  column-gap: 28px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 4px;
  padding: 0;
  text-align: left;
}
body.bgx-v22-layout .x-brand-name {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
  font-family: var(--x-font-serif);
  font-weight: 700;
  font-size: clamp(28px, 2.7vw, 38px);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: var(--x-header-text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 18px rgba(216, 180, 106, 0.28);
}
body.bgx-v22-layout .x-brand-name::before {
  content: "";
  position: static;
  flex: none;
  width: 50px;
  height: 50px;
  transform: none;
  background: url("../assets/BGX-emblem-red-256.png") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(216, 180, 106, 0.25));
}
body.bgx-v22-layout .x-brand-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
body.bgx-v22-layout .x-brand-sub {
  display: block;
  font-family: var(--x-font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.25;
  letter-spacing: 0.015em;
  text-transform: none;
  color: #edd398;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 14px rgba(232, 196, 123, 0.18);
}
/* the one line that says what this page is for: two people, one device (v0.3.05); the second line of copy (v0.3.06). The link
   inside it opens How to Play. */
body.bgx-v22-layout .x-header-primary .x-brand-note {
  display: block;
  margin: 0;
  max-width: none;
  font: italic 600 clamp(14px, 1.35vw, 19px)/1.35 var(--x-font-serif);
  color: #d9c8a2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
}
body.bgx-v22-layout .x-brand-note-link {
  appearance: none;
  -webkit-appearance: none;
  display: inline;
  margin: 0;
  padding: 2px 3px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  font: inherit;
  color: var(--x-title-gold);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
body.bgx-v22-layout .x-brand-note-link:hover { color: var(--x-tab-hover); background: rgba(216, 180, 106, 0.14); }
body.bgx-v22-layout .x-brand-note-link:focus-visible { outline: 3px solid #80d8ff; outline-offset: 2px; }
body.bgx-v22-layout .x-header-secondary { padding: 0 6px; }

/* Light appearance: the header band stays dark brown (as it was in v0.2.24), full width, with the light focus ring */
html[data-appearance="light"] body.bgx-v22-layout .x-header {
  max-width: none;
  padding-left: max(18px, calc((100vw - 1600px) / 2 + 18px));
  padding-right: max(18px, calc((100vw - 1600px) / 2 + 18px));
  background: var(--x-header-bg);
  border-bottom: 1px solid var(--x-header-border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
html[data-appearance="light"] body.bgx-v22-layout .x-header-bar .x-icon-button[data-action="menu-open"]:focus-visible,
html[data-appearance="light"] body.bgx-v22-layout .bgx-tab:focus-visible,
html[data-appearance="light"] body.bgx-v22-layout .x-header .x-utility:focus-visible { outline-color: var(--x-header-focus); }

/* the tabs drop under the keys at 1100px and below, as on the approved page; the masthead keeps its two columns until 650px */
@media (max-width: 1100px) {
  body.bgx-v22-layout .x-header-bar { flex-wrap: wrap; }
  body.bgx-v22-layout .x-header-bar .bgx-tabbar { order: 3; flex-basis: 100%; }
  body.bgx-v22-layout .x-header-bar .bgx-tabbar-track { flex-wrap: wrap; gap: 0 18px; }     /* every tab stays visible: a narrow screen wraps them, as the approved page does */
}
@media (max-width: 760px) { body.bgx-v22-layout .x-header { padding: 12px 10px 4px; } }
@media (max-width: 650px) {
  body.bgx-v22-layout .x-header-primary .x-brand { grid-template-columns: minmax(0, 1fr); justify-items: center; row-gap: 6px; text-align: center; }
  body.bgx-v22-layout .x-brand-name { justify-self: center; font-size: clamp(26px, 8vw, 34px); }
  body.bgx-v22-layout .x-brand-name::before { width: 40px; height: 40px; }
  body.bgx-v22-layout .x-brand-copy { align-items: center; }
  body.bgx-v22-layout .x-brand-sub { font-size: 20px; }
  body.bgx-v22-layout .x-header-primary .x-brand-note { font-size: 15px; }
}
@media (max-width: 450px) {
  body.bgx-v22-layout .x-header-bar { gap: 6px; }
  body.bgx-v22-layout .x-header-bar .bgx-tabbar-track { gap: 0 14px; }
  .x-utility { padding: 5px 8px; font-size: 11px; }
}
/* a finger, not a pointer: the quick controls reach the 44px touch size (the approved page does the same for its header keys) */
@media (pointer: coarse) { .x-utility { min-height: 44px; } }

/* ═══ page-sections menu: a centred card with a two-column grid (was a side drawer) ═══════════════ */
.x-drawer {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: fit-content;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  border: 1px solid #9b7947;
  border-radius: 16px;
  background: linear-gradient(145deg, #18271f, #0c1510);
  color: #f1e5c9;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  font: 16px/1.5 var(--x-font-system);
}
.x-drawer-head {
  position: relative;
  height: auto;
  min-height: 40px;
  padding: 0 84px 0 0;
  margin: 0 0 8px;
  border: 0;
}
.x-drawer-title { color: var(--x-heading-gold); font: 700 22px/1.25 var(--x-font-system); }
.x-drawer-head .x-drawer-close {
  position: absolute;
  top: 0;
  right: 0;
  width: auto;
  height: 40px;
  padding: 8px 14px;
  border: 1px solid #876d43;
  border-radius: 9px;
  background: #292219;
  color: var(--x-heading-gold);
  font: 600 14px/1.4 var(--x-font-system);
}
.x-drawer-head .x-drawer-close:hover { border-color: #b99658; background: #342a1d; }
.x-drawer-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0; flex: none; }
.x-drawer-list li { margin: 0; }
.x-drawer-list button {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #49664f;
  border-radius: 9px;
  background: #16291e;
  color: #f0e4c9;
  font: 600 15px/1.4 var(--x-font-system);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
}
.x-drawer-list button:hover { background: #213b2b; border-color: #b99658; }
.x-drawer-list button:focus-visible { outline: 3px solid #80d8ff; outline-offset: 3px; }
.x-drawer-list button[aria-current="page"] { box-shadow: none; border-color: #d5b06a; color: #fff0cd; }
.x-drawer-list .bgx-drawer-sub { grid-column: auto; }
@media (max-width: 460px) {
  .x-drawer { padding: 16px; width: calc(100vw - 24px); max-width: calc(100vw - 24px); border-radius: 12px; }
  .x-drawer-title { font-size: 20px; }
  .x-drawer-list { grid-template-columns: minmax(0, 1fr); }
}
.x-scrim { background: rgba(0, 0, 0, 0.72); }

/* ═══ footer: entry tiles, their choices, the release note ═══════════ */
.bgx-footer { max-width: 1600px; margin: 0 auto; padding: 0 16px 28px; }
.bgx-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px auto 0;
  width: min(100%, 1500px);
}
.bgx-tile {
  --bgx-accent: #8bc8f4;
  --bgx-surface: #122c40;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 154px;
  padding: 17px 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 3px solid var(--bgx-accent);
  border-radius: 12px;
  background: var(--bgx-surface);
  color: #f4efdf;
  text-align: left;
  font: inherit;
  box-shadow: none;
  cursor: pointer;
}
.bgx-tile--green { --bgx-accent: #7ed6ad; --bgx-surface: #12392c; }
.bgx-tile--gold { --bgx-accent: #efd083; --bgx-surface: #42321a; }
.bgx-tile--purple { --bgx-accent: #c4aff0; --bgx-surface: #302343; }
.bgx-tile:hover { border-color: var(--bgx-accent); filter: brightness(1.08); }
.bgx-tile[aria-expanded="true"] { border-color: var(--bgx-accent); box-shadow: inset 0 0 0 1px var(--bgx-accent); }
.bgx-tile:focus-visible { outline: 3px solid #f6d88f; outline-offset: 4px; }
.bgx-tile__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--bgx-accent); }
.bgx-tile__icon { font-size: 28px; line-height: 1; }
.bgx-tile__mark { font-size: 24px; line-height: 1; }
.bgx-tile__name { font-size: clamp(16px, 1.6vw, 21px); font-weight: 650; line-height: 1.3; }
.bgx-tile__sub { font-size: 14px; color: #ecece4; line-height: 1.4; }
.bgx-tilepanel {
  width: min(100% - 0px, 1500px);
  margin: 16px auto 0;
  padding: 18px;
  background: #101814;
  border: 1px solid #3d4237;
  border-radius: 12px;
  color: #f4efdf;
}
.bgx-tilepanel__head { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bgx-tilepanel h2 { margin: 0; font-size: 21px; line-height: 1.3; color: #f4efdf; text-transform: none; letter-spacing: normal; }
.bgx-tilepanel__close {
  padding: 9px 15px;
  min-height: 44px;
  background: #232d26;
  color: #f4efdf;
  border: 1px solid #64644d;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.bgx-tilepanel__choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.bgx-choice {
  font: inherit;
  font-size: 15px;
  text-align: left;
  color: #f4efdf;
  background: #1c2821;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 46px;
  min-width: 0;
  cursor: pointer;
  white-space: normal;
  line-height: 1.4;
}
.bgx-choice:hover { border-color: #d6b66f; }
.bgx-tilepanel button:focus-visible { outline: 3px solid #f6d88f; outline-offset: 4px; }
.bgx-tilepanel__status { display: block; font-size: 13px; color: #d0d2c5; margin-top: 12px; }
@media (max-width: 900px) { .bgx-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bgx-tilepanel__choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .bgx-footer { padding: 0 10px 24px; }
  .bgx-tiles { gap: 9px; margin-top: 16px; }
  .bgx-tile { padding: 13px 11px 15px; min-height: 140px; }
  .bgx-tile__name { font-size: 16px; }
  .bgx-tile__sub { font-size: 12px; }
  .bgx-tilepanel { padding: 13px; }
  .bgx-tilepanel__choices { grid-template-columns: 1fr; }
  .bgx-tilepanel h2 { font-size: 19px; }
}
/* v0.3.05 — the BackgammonX website's own pages (About, Privacy Policy, Terms and Conditions, Contact). They sit on the page
   itself, not on a tile, so they follow the appearance (--x-gold-bright is gold on the dark page and dark brown on the light
   one). Every link is a 44px-high touch target with a visible underline and a visible focus ring. */
.bgx-pagelinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 8px;
  margin: 24px 0 0;
}
.bgx-pagelink {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--x-gold-bright);
  font: 600 14px/1.3 var(--x-font-system);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bgx-pagelink:hover { background: rgba(216, 180, 106, 0.14); }
.bgx-pagelink:focus-visible { outline: 3px solid #80d8ff; outline-offset: 2px; }
.bgx-pagelink__arrow { font-size: 12px; opacity: 0.9; text-decoration: none; }
html[data-appearance="light"] .bgx-pagelink:focus-visible { outline-color: #0b4f8a; }
.bgx-pagelinks + .bgx-footer-release { margin-top: 8px; }
.bgx-footer-release {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 26px 0 0;
  color: #cbb68b;
  font: 12px/1.5 var(--x-font-system);
}
.bgx-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border: 1px solid rgba(201, 164, 104, 0.55);
  border-radius: 999px;
  background: rgba(216, 180, 106, 0.08);
  color: #d9c08a;
  font-family: var(--x-font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* The release note sits on the page itself, not on a tile, so it follows the appearance (the tiles and the choices panel
   carry their own dark surfaces in both). Light: the dark-tan text that reads on the ivory page. */
html[data-appearance="light"] .bgx-footer-release { color: var(--x-text-faint); }
html[data-appearance="light"] .bgx-chip { color: var(--x-gold-bright); border-color: var(--x-gold-dim); background: var(--x-panel-glow); }

/* v0.3.06 — the BUILD IDENTITY. js/38 moves the version chip (the button that opens "About this build") into the release note
   and the channel line into a build line under it, with an "About this build" key and, on a release-candidate page, a
   "Developer" key. The chip keeps a 44px hit area (the ::after) around its 32px pill. */
body.bgx-v22-layout .bgx-footer .x-brand-version {
  position: relative;
  transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  margin: 0 2px 0 6px;
  padding: 3px 12px;
  border: 1px solid rgba(201, 164, 104, 0.55);
  border-radius: 999px;
  background: rgba(216, 180, 106, 0.08);
  color: #d9c08a;
  font: 700 12px/1.5 var(--x-font-system);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  box-shadow: none;
  cursor: pointer;
}
body.bgx-v22-layout .bgx-footer .x-brand-version::after { content: ""; position: absolute; inset: -6px -4px; }
body.bgx-v22-layout .bgx-footer .x-brand-version:hover { filter: none; background: rgba(216, 180, 106, 0.17); border-color: var(--x-gold-bright); }
body.bgx-v22-layout .bgx-footer .x-brand-version:focus-visible { outline: 3px solid #80d8ff; outline-offset: 2px; }
html[data-appearance="light"] body.bgx-v22-layout .bgx-footer .x-brand-version { color: var(--x-gold-bright); border-color: var(--x-gold-dim); background: var(--x-panel-glow); }
html[data-appearance="light"] body.bgx-v22-layout .bgx-footer .x-brand-version:focus-visible { outline-color: #0b4f8a; }
.bgx-footer-build {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 2px 0 0;
  color: #cbb68b;
  font: 12px/1.5 var(--x-font-system);
}
body.bgx-v22-layout .bgx-footer .x-channel-tag {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: italic 12px/1.5 var(--x-font-serif);
  color: inherit;
}
.bgx-footer-link {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--x-gold-bright);
  font: 600 12px/1.3 var(--x-font-system);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.bgx-footer-link:hover { background: rgba(216, 180, 106, 0.14); }
.bgx-footer-link:focus-visible { outline: 3px solid #80d8ff; outline-offset: 2px; }
.bgx-footer-link[aria-pressed="true"] { color: var(--x-tab-hover); text-decoration-style: double; }
html[data-appearance="light"] .bgx-footer-build { color: var(--x-text-faint); }
html[data-appearance="light"] .bgx-footer-link:focus-visible { outline-color: #0b4f8a; }
html[data-appearance="light"] .bgx-footer-link[aria-pressed="true"] { color: var(--x-gold-bright); }

/* ═══ keys: the "chunky key" recipe ══════════════════════════════════
   Every key of the turn controls, the saves row, the page toolbar, the board-size row and the dialogs gets the measured
   key: a bottom-edge shelf, a glow on hover, a 2px press, a flat look when disabled. Dark appearance only (the Light
   appearance keeps the flat keys it has had since v0.2.23). */
html[data-appearance="dark"] .dtf-hud .x-button,
html[data-appearance="dark"] .bgx-btn:not(.bgx-btn-quiet),
html[data-appearance="dark"] .bgx-stack-toolbar button,
html[data-appearance="dark"] .bgx-board-size-row .x-button {
  box-shadow: var(--x-key-shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s, color 0.15s;
}
html[data-appearance="dark"] .dtf-hud .x-button:hover:not(:disabled),
html[data-appearance="dark"] .bgx-btn:not(.bgx-btn-quiet):hover:not(:disabled),
html[data-appearance="dark"] .bgx-stack-toolbar button:hover:not(:disabled),
html[data-appearance="dark"] .bgx-board-size-row .x-button:hover:not(:disabled) { box-shadow: var(--x-key-shadow-hover); filter: none; }
html[data-appearance="dark"] .dtf-hud .x-button:active:not(:disabled),
html[data-appearance="dark"] .bgx-btn:not(.bgx-btn-quiet):active:not(:disabled),
html[data-appearance="dark"] .bgx-stack-toolbar button:active:not(:disabled),
html[data-appearance="dark"] .bgx-board-size-row .x-button:active:not(:disabled) { transform: translateY(2px); box-shadow: var(--x-key-shadow-active); }
html[data-appearance="dark"] .dtf-hud .x-button:disabled,
html[data-appearance="dark"] .bgx-btn:disabled { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 0 rgba(0, 0, 0, 0.5); }

/* the roles of the turn controls (dark appearance) */
html[data-appearance="dark"] .dtf-hud .dtf-roll-btn { color: var(--x-gold-bright); border-color: var(--x-gold); }
html[data-appearance="dark"] .dtf-hud .dtf-roll-btn:hover:not(:disabled) { background-color: var(--x-gold); color: #14110a; }
html[data-appearance="dark"] .dtf-hud .dtf-new-game-btn { background-color: #221a13; background-image: none; border-color: #8a6d45; color: #e0c48f; }
html[data-appearance="dark"] .dtf-hud .dtf-new-game-btn:hover:not(:disabled) { background-color: #8a6d45; color: #140f08; }
html[data-appearance="dark"] .dtf-hud .bgx-undo-btn { color: #fdcb6e; border-color: #fdcb6e; }
html[data-appearance="dark"] .dtf-hud .bgx-undo-btn:hover:not(:disabled) { background-color: #fdcb6e; color: #0d0d1a; }
html[data-appearance="dark"] .dtf-hud .bgx-rotate-btn { color: var(--x-blue); border-color: var(--x-blue); }
html[data-appearance="dark"] .dtf-hud .bgx-rotate-btn:hover:not(:disabled) { background-color: var(--x-blue); color: #0a121a; }
html[data-appearance="dark"] .dtf-hud .bgx-auto-rotate-btn:hover:not(:disabled),
html[data-appearance="dark"] .dtf-hud .bgx-combo-toggle:hover:not(:disabled) { background-color: var(--x-blue); color: #0a121a; border-color: var(--x-blue); }
/* the Save / Resume / Clear keys are the neutral key */
html[data-appearance="dark"] .bgx-saves-row .bgx-btn { background-color: #121722; background-image: none; border-color: #495466; color: #c8d1df; }
html[data-appearance="dark"] .bgx-saves-row .bgx-btn:hover:not(:disabled) { background-color: #1c2432; border-color: #8192aa; color: #f2f5fa; }

/* ═══ the turn controls panel: status line first, as an information bar over the keys ═══════════ */
html[data-appearance="dark"] .dtf-hud {
  padding: 12px;
  border-top-color: rgba(255, 255, 255, 0.07);
  background-image: linear-gradient(180deg, rgba(216, 180, 106, 0.05), transparent 35%);
}
.dtf-hud > .dtf-status { order: 0; margin-top: 0; margin-bottom: 8px; }
html[data-appearance="dark"] .dtf-hud .dtf-status {
  min-height: 0;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 1px solid var(--x-line-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--x-text-dim);
  font-size: 14px;
  line-height: 1.4;
}

/* ═══ the Players panel: a side panel with a brown header bar ═════════════════════════════════ */
html[data-appearance="dark"] .bgx-players-panel {
  padding: 0 0 12px;
  border: 1px solid #6b5333;
  border-radius: 12px;
  background-color: #121621;
  background-image: linear-gradient(180deg, #191d29, #121621);
  box-shadow: none;
  overflow: hidden;
  color: #ecdcb8;
}
html[data-appearance="dark"] .bgx-players-head {
  margin: 0;
  padding: 8px 12px;
  background: #2a1f15;
  border-bottom: 1px solid #4d3d27;
}
html[data-appearance="dark"] .bgx-players-title {
  font-family: var(--x-font-system);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: #e8c47b;
}
html[data-appearance="dark"] .bgx-players-body { padding: 10px 10px 0; margin-top: 0; }
html[data-appearance="dark"] .bgx-players-panel.bgx-players-collapsed { padding-bottom: 0; }
html[data-appearance="dark"] .bgx-players-panel.bgx-players-collapsed .bgx-players-head { border-bottom: 0; }

/* ═══ dialogs: the measured modal card ══════════════════════════════ */
.bgx-ui-scrim { background: rgba(2, 4, 10, 0.82); }
html[data-appearance="dark"] .bgx-ui-dialog {
  padding: 18px 18px 16px;
  border: 1px solid var(--x-gold-dim);
  border-radius: 14px;
  background-image: linear-gradient(170deg, rgba(216, 180, 106, 0.06), transparent 44%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 20px 50px rgba(0, 0, 0, 0.55);
}
.bgx-ui-title { color: var(--x-heading-gold); }
html[data-appearance="light"] .bgx-ui-title { color: #6b4a00; }
html[data-appearance="dark"] .bgx-ui-actions .bgx-btn { min-height: 44px; padding: 9px 14px; font-size: 12px; background-color: var(--x-panel-2); background-image: none; border-color: var(--x-line); color: var(--x-text-dim); }
html[data-appearance="dark"] .bgx-ui-actions .bgx-btn:hover:not(:disabled) { background-color: var(--x-blue); color: #0a121a; border-color: var(--x-gold-dim); }
html[data-appearance="dark"] .bgx-ui-actions .bgx-btn-primary { background-color: var(--x-panel-2); border-color: #55efc4; color: #55efc4; }
html[data-appearance="dark"] .bgx-ui-actions .bgx-btn-primary:hover:not(:disabled) { background-color: #55efc4; color: #0d0d1a; border-color: #55efc4; }
html[data-appearance="dark"] .bgx-ui-actions .bgx-btn-danger { background-color: var(--x-panel-2); border-color: #ff7675; color: #ff7675; }
html[data-appearance="dark"] .bgx-ui-actions .bgx-btn-danger:hover:not(:disabled) { background-color: #ff7675; color: #0d0d1a; }

/* ═══ toasts: a gold left edge ═════════════════════════════════════ */
html[data-appearance="dark"] .bgx-toast {
  padding: 12px 14px;
  background: rgba(8, 10, 20, 0.97);
  border: 1px solid var(--x-gold-dim);
  border-left: 4px solid var(--x-gold);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
html[data-appearance="dark"] .bgx-toast-warn { border-left-color: var(--x-amber); }
